PostgreSQL 11.0 commit log

Stamp 11.0.

commit   : 19f20081df059fef87e14c8e953669bd173dd7f1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Oct 2018 17:12:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Oct 2018 17:12:02 -0400    

Click here for diff

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

Check for stack overrun in standard_ProcessUtility().

commit   : db9034bf7653fa527e2531e1a713dbbd37066a6b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Oct 2018 14:01:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Oct 2018 14:01:38 -0400    

Click here for diff

ProcessUtility can recurse, and indeed can be driven to infinite  
recursion, so it ought to have a check_stack_depth() call.  This  
covers the reported bug (portal trying to execute itself) and a bunch  
of other cases that could perhaps arise somewhere.  
  
Per bug #15428 from Malthe Borch.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/utility.c

Translation updates

commit   : 6c6deadb044bd0353641aff8203fd92eb0e6606f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 11:33:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 11:33:11 +0200    

Click here for diff

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

M src/backend/po/ja.po
M src/backend/po/sv.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_rewind/po/ja.po
M src/bin/pg_verify_checksums/po/ja.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/ja.po
M src/pl/plpgsql/src/po/ja.po

Fixes for "Glyph not available" warnings from FOP

commit   : d315639c82e8a2cfd1d1b98b7acf0f6c033ab955    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 09:48:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 09:48:49 +0200    

Click here for diff

With the PostgreSQL 11 release notes acknowledgments list, FOP reported  
  
WARNING: Glyph "?" (0x144, nacute) not available in font "Times-Roman".  
WARNING: Glyph "?" (0x15e, Scedilla) not available in font "Times-Roman".  
WARNING: Glyph "?" (0x15f, scedilla) not available in font "Times-Roman".  
WARNING: Glyph "?" (0x131, dotlessi) not available in font "Times-Roman".  
  
This is because we have some new contributors whose names use letters  
that we haven't used before, and apparently FOP can't handle them out  
of the box.  
  
For now, just fix this by "unaccenting" those names.  In the future,  
maybe this can be fixed better with a different font configuration.  
  
There is also another warning  
  
WARNING: Glyph "?" (0x3c0, pi) not available in font "Times-Roman".  
  
but that existed in previous releases and is not touched here.  

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

contrib/bloom documentation improvement

commit   : 1846bac46da142e0a9fdef3f9004c306370d7213    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Oct 2018 00:40:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Oct 2018 00:40:17 +0300    

Click here for diff

This commit documents rounding of "length" parameter and absence of support  
for unique indexes and NULLs searching.  Backpatch to 9.6 where contrib/bloom  
was introduced.  
  
Discussion: https://postgr.es/m/CAF4Au4wPQQ7EHVSnzcLjsbY3oLSzVk6UemZLD1Sbmwysy3R61g%40mail.gmail.com  
Author: Oleg Bartunov with minor editorialization by me  
Backpatch-through: 9.6  

M doc/src/sgml/bloom.sgml

Avoid duplicate XIDs at recovery when building initial snapshot

commit   : 18781cd2af97002234f2db08f68cc4b392b2e463    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 14 Oct 2018 22:23:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 14 Oct 2018 22:23:29 +0900    

Click here for diff

On a primary, sets of XLOG_RUNNING_XACTS records are generated on a  
periodic basis to allow recovery to build the initial state of  
transactions for a hot standby.  The set of transaction IDs is created  
by scanning all the entries in ProcArray.  However it happens that its  
logic never counted on the fact that two-phase transactions finishing to  
prepare can put ProcArray in a state where there are two entries with  
the same transaction ID, one for the initial transaction which gets  
cleared when prepare finishes, and a second, dummy, entry to track that  
the transaction is still running after prepare finishes.  This way  
ensures a continuous presence of the transaction so as callers of for  
example TransactionIdIsInProgress() are always able to see it as alive.  
  
So, if a XLOG_RUNNING_XACTS takes a standby snapshot while a two-phase  
transaction finishes to prepare, the record can finish with duplicated  
XIDs, which is a state expected by design.  If this record gets applied  
on a standby to initial its recovery state, then it would simply fail,  
so the odds of facing this failure are very low in practice.  It would  
be tempting to change the generation of XLOG_RUNNING_XACTS so as  
duplicates are removed on the source, but this requires to hold on  
ProcArrayLock for longer and this would impact all workloads,  
particularly those using heavily two-phase transactions.  
  
XLOG_RUNNING_XACTS is also actually used only to initialize the standby  
state at recovery, so instead the solution is taken to discard  
duplicates when applying the initial snapshot.  
  
Diagnosed-by: Konstantin Knizhnik  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

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

Doc: still further copy-editing for v11 release notes.

commit   : 52f76a02f6609ab84a4b929d8b0f1ccc0f7f3c9e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 21:39:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 21:39:20 -0400    

Click here for diff

Justin Pryzby and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add "B" suffix for bytes to docs

commit   : e2002b4014d4650ebb42c93111b8a7a9b34ec8d9    
  
author   : Greg Stark <[email protected]>    
date     : Sat, 6 Oct 2018 13:03:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 13:03:43 -0400    

Click here for diff

6e7baa3227 and b06d8e58b5 added "B" as a valid suffix for  
GUC_UNIT_BYTES but neglected to add it to the docs.  

M doc/src/sgml/config.sgml

Doc: further copy-editing for v11 release notes.

commit   : d1fd7576e1d3d17d1d63c8796a02de1649fd63fe    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 17:29:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 17:29:12 -0400    

Click here for diff

Justin Pryzby, Jonathan S. Katz, and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: copy-editing for CREATE INDEX reference page.

commit   : 4d00ee4b4ac2c17e32633d3c305041f5e6570bea    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:42:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:42:58 -0400    

Click here for diff

Justin Pryzby, Jonathan S. Katz, and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make an editing pass over v11 release notes.

commit   : a31af2551fed8cb7d2d52f3dbe6c6e0d21a1c57c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:31:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:31:09 -0400    

Click here for diff

Set the release date.  Do a bunch of copy-editing and markup improvement,  
rearrange some stuff into what seemed a more sensible order, move some  
things that did not seem to be in the right section.  

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

Remove abstime, reltime, tinterval tables from old regression databases.

commit   : 184951a48a107c7e1f128f7fa3887fbd216d6d60    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 19:33:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 19:33:56 -0400    

Click here for diff

In the back branches, drop these tables after the regression tests are  
done with them.  This fixes failures of cross-branch pg_upgrade testing  
caused by these types having been removed in v12.  We do lose the ability  
to test dump/restore behavior with these types in the back branches, but  
the actual loss of code coverage seems to be nil given that there's nothing  
very special about these types.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/horology.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/horology.sql

Simplify use of AllocSetContextCreate() wrapper macro.

commit   : 3d059655be7dfcb7124c6b3ce0925448de89f669    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 14:26:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 14:26:56 -0400    

Click here for diff

We can allow this macro to accept either abbreviated or non-abbreviated  
allocation parameters by making use of __VA_ARGS__.  As noted by Andres  
Freund, it's unlikely that any compiler would have __builtin_constant_p  
but not __VA_ARGS__, so this gives up little or no error checking, and  
it avoids a minor but annoying API break for extensions.  
  
With this change, there is no reason for anybody to call  
AllocSetContextCreateExtended directly, so in HEAD I renamed it to  
AllocSetContextCreateInternal.  It's probably too late for an ABI  
break like that in 11, though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Correct attach/detach logic for FKs in partitions

commit   : 355684ee3fa3001adf0de3873fddadd119773819    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Oct 2018 12:36:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Oct 2018 12:36:26 -0300    

Click here for diff

There was no code to handle foreign key constraints on partitioned  
tables in the case of ALTER TABLE DETACH; and if you happened to ATTACH  
a partition that already had an equivalent constraint, that one was  
ignored and a new constraint was created.  Adding this to the fact that  
foreign key cloning reuses the constraint name on the partition instead  
of generating a new name (as it probably should, to cater to SQL  
standard rules about constraint naming within schemas), the result was a  
pretty poor user experience -- the most visible failure was that just  
detaching a partition and re-attaching it failed with an error such as  
  
  ERROR:  duplicate key value violates unique constraint "pg_constraint_conrelid_contypid_conname_index"  
  DETAIL:  Key (conrelid, contypid, conname)=(26702, 0, test_result_asset_id_fkey) already exists.  
  
because it would try to create an identically-named constraint in the  
partition.  To make matters worse, if you tried to drop the constraint  
in the now-independent partition, that would fail because the constraint  
was still seen as dependent on the constraint in its former parent  
partitioned table:  
  ERROR:  cannot drop inherited constraint "test_result_asset_id_fkey" of relation "test_result_cbsystem_0001_0050_monthly_2018_09"  
  
This fix attacks the problem from two angles: first, when the partition  
is detached, the constraint is also marked as independent, so the drop  
now works.  Second, when the partition is re-attached, we scan existing  
constraints searching for one matching the FK in the parent, and if one  
exists, we link that one to the parent constraint.  So we don't end up  
with a duplicate -- and better yet, we don't need to scan the referenced  
table to verify that the constraint holds.  
  
To implement this I made a small change to previously planner-only  
struct ForeignKeyCacheInfo to contain the constraint OID; also relcache  
now maintains the list of FKs for partitioned tables too.  
  
Backpatch to 11.  
  
Reported-by: Michael Vitale (bug #15425)  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix logical decoding error when system table w/ toast is repeatedly rewritten.

commit   : 88670a4366110c946ef47048d1cebd641209fb0d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 10 Oct 2018 13:53:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 10 Oct 2018 13:53:02 -0700    

Click here for diff

Repeatedly rewriting a mapped catalog table with VACUUM FULL or  
CLUSTER could cause logical decoding to fail with:  
ERROR, "could not map filenode \"%s\" to relation OID"  
  
To trigger the problem the rewritten catalog had to have live tuples  
with toasted columns.  
  
The problem was triggered as during catalog table rewrites the  
heap_insert() check that prevents logical decoding information to be  
emitted for system catalogs, failed to treat the new heap's toast table  
as a system catalog (because the new heap is not recognized as a  
catalog table via RelationIsLogicallyLogged()). The relmapper, in  
contrast to the normal catalog contents, does not contain historical  
information. After a single rewrite of a mapped table the new relation  
is known to the relmapper, but if the table is rewritten twice before  
logical decoding occurs, the relfilenode cannot be mapped to a  
relation anymore.  Which then leads us to error out.   This only  
happens for toast tables, because the main table contents aren't  
re-inserted with heap_insert().  
  
The fix is simple, add a new heap_insert() flag that prevents logical  
decoding information from being emitted, and accept during decoding  
that there might not be tuple data for toast tables.  
  
Unfortunately that does not fix pre-existing logical decoding  
errors. Doing so would require not throwing an error when a filenode  
cannot be mapped to a relation during decoding, and that seems too  
likely to hide bugs.  If it's crucial to fix decoding for an existing  
slot, temporarily changing the ERROR in ReorderBufferCommit() to a  
WARNING appears to be the best fix.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where logical decoding was introduced  

M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/sql/rewrite.sql
M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/access/heapam.h

Stamp 11rc1.

commit   : 4c676181cdb6c16c414d5e9cd2304f5c73881601    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 17:24:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 17:24:40 -0400    

Click here for diff

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

Advance transaction timestamp for intra-procedure transactions.

commit   : 1145c26b749a73419d32e4c997237e84fbbffa04    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 16:16:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 16:16:36 -0400    

Click here for diff

Per discussion, this behavior seems less astonishing than not doing so.  
  
Peter Eisentraut and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/executor/spi.c
M src/include/executor/spi.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Silence compiler warning in Assert()

commit   : 8569ef63f4d30d25f950270f62ca7263b56157a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 8 Oct 2018 10:36:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 8 Oct 2018 10:36:33 -0300    

Click here for diff

gcc 6.3 does not whine about this mistake I made in 39808e8868c8 but  
evidently lots of other compilers do, according to Michael Paquier,  
Peter Eisentraut, Arthur Zakirov, Tomas Vondra.  
  
Discussion: too many to list  

M src/backend/commands/event_trigger.c

Translation updates

commit   : 69ff26b96f6f1ea947bd52d18f21e99fd61c25ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Oct 2018 12:03:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Oct 2018 12:03:54 +0200    

Click here for diff

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

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

Track procedure calls in pg_stat_user_functions

commit   : c2055a4a171b11a7d0df7fabeaaeec9b8cdf85af    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 14:14:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 14:14:03 +0200    

Click here for diff

This was forgotten when procedures were implemented.  
  
Reported-by: Lukas Fittl <[email protected]>  

M src/backend/commands/functioncmds.c

commit   : c8ed820c68bcad00d07d60e436cdddb7c0edf44d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Oct 2018 17:56:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Oct 2018 17:56:13 +0900    

Click here for diff

Error messages for creating a foreign key on a partitioned table using  
ONLY or NOT VALID were wrong in mentioning the objects they worked on.  
This commit adds on the way some regression tests missing for those  
cases.  
  
Author: Laurenz Albe  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Fix speling error

commit   : 4d7c74039f091e04e520d5688c964f653f8c55a8    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 8 Oct 2018 08:57:24 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 8 Oct 2018 08:57:24 +0200    

Click here for diff

Reported by Alexander Lakhin in bug #15423  

M src/bin/pg_basebackup/pg_basebackup.c

Fix catalog insertion order for ATTACH PARTITION

commit   : 1c7f585b5c1a317bdbdf7d41c7ffab9968738149    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 22:13:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 22:13:19 -0300    

Click here for diff

Commit 2fbdf1b38bc changed the order in which we inserted catalog rows  
when creating partitions, so that we could remove an unsightly hack  
required for untimely relcache invalidations.  However, that commit only  
changed the ordering for CREATE TABLE PARTITION OF, and left ALTER TABLE  
ATTACH PARTITION unchanged, so the latter can be affected when catalog  
invalidations occur, for instance when the partition key involves an SQL  
function.  
  
Reported-by: Rajkumar Raghuwanshi  
Author: Amit Langote  
Reviewed-by: Michaƫl Paquier  
Discussion: https://postgr.es/m/CAKcux6=nTz9KSfTr_6Z2mpzLJ_09JN-rK6=dWic6gGyTSWueyQ@mail.gmail.com  

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

Fix event triggers for partitioned tables

commit   : 1a852f7c1e27eef563cf0577c2604baec1be5512    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 19:17:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 19:17:46 -0300    

Click here for diff

Index DDL cascading on partitioned tables introduced a way for ALTER  
TABLE to be called reentrantly.  This caused an an important deficiency  
in event trigger support to be exposed: on exiting the reentrant call,  
the alter table state object was clobbered, causing a crash when the  
outer alter table tries to finalize its processing.  Fix the crash by  
creating a stack of event trigger state objects.  There are still ways  
to cause things to misbehave (and probably other crashers) with more  
elaborate tricks, but at least it now doesn't crash in the obvious  
scenario.  
  
Backpatch to 9.5, where DDL deparsing of event triggers was introduced.  
  
Reported-by: Marco Slot  
Authors: Michaƫl Paquier, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/CANNhMLCpi+HQ7M36uPfGbJZEQLyTy7XvX=5EFkpR-b1bo0uJew@mail.gmail.com  

M src/backend/catalog/index.c
M src/backend/commands/event_trigger.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/include/catalog/index.h
M src/include/tcop/deparse_utility.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Propagate xactStartTimestamp and stmtStartTimestamp to parallel workers.

commit   : 6bf278df891d7601eda2824a8b0df15dc52b7def    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 12:00:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 12:00:09 -0400    

Click here for diff

Previously, a worker process would establish values for these based on  
its own start time.  In v10 and up, this can trivially be shown to cause  
misbehavior of transaction_timestamp(), timestamp_in(), and related  
functions which are (perhaps unwisely?) marked parallel-safe.  It seems  
likely that other behaviors might diverge from what happens in the parent  
as well.  
  
It's not as trivial to demonstrate problems in 9.6 or 9.5, but I'm sure  
it's still possible, so back-patch to all branches containing parallel  
worker infrastructure.  
  
In HEAD only, mark now() and statement_timestamp() as parallel-safe  
(other affected functions already were).  While in theory we could  
still squeeze that change into v11, it doesn't seem important enough  
to force a last-minute catversion bump.  
  
Konstantin Knizhnik, whacked around a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Assign constraint name when cloning FK definition for partitions

commit   : c905b67b79b72b88ba80d2486443c824232c6d85    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 6 Oct 2018 14:59:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 6 Oct 2018 14:59:52 +0900    

Click here for diff

This is for example used when attaching a partition to a partitioned  
table which includes foreign keys, and in this case the constraint name  
has been missing in the data cloned.  This could lead to hard crashes,  
as when validating the foreign key constraint, the constraint name is  
always expected.  Particularly, when using log_min_messages >= DEBUG1, a  
log message would be generated with this unassigned constraint name,  
leading to an assertion failure on HEAD.  
  
While on it, rename a variable in ATExecAttachPartition which was  
declared twice with the same name.  
  
Author: Michael Paquier  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c

doc: update PG 11 release notes

commit   : 076cfffb39af281f4e3b7d9852715bb09e214171    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Oct 2018 17:20:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Oct 2018 17:20:24 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Author: Jonathan S. Katz  
  
Backpatch-through: 11  

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

Allow btree comparison functions to return INT_MIN.

commit   : 67e7d4da72dca6525fd2b9a2f2522994040897ba    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 16:01:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 16:01:29 -0400    

Click here for diff

Historically we forbade datatype-specific comparison functions from  
returning INT_MIN, so that it would be safe to invert the sort order  
just by negating the comparison result.  However, this was never  
really safe for comparison functions that directly return the result  
of memcmp(), strcmp(), etc, as POSIX doesn't place any such restriction  
on those library functions.  Buildfarm results show that at least on  
recent Linux on s390x, memcmp() actually does return INT_MIN sometimes,  
causing sort failures.  
  
The agreed-on answer is to remove this restriction and fix relevant  
call sites to not make such an assumption; code such as "res = -res"  
should be replaced by "INVERT_COMPARE_RESULT(res)".  The same is needed  
in a few places that just directly negated the result of memcmp or  
strcmp.  
  
To help find places having this problem, I've also added a compile option  
to nbtcompare.c that causes some of the commonly used comparators to  
return INT_MIN/INT_MAX instead of their usual -1/+1.  It'd likely be  
a good idea to have at least one buildfarm member running with  
"-DSTRESS_SORT_INT_MIN".  That's far from a complete test of course,  
but it should help to prevent fresh introductions of such bugs.  
  
This is a longstanding portability hazard, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/ltree_op.c
M contrib/pgcrypto/imath.c
M doc/src/sgml/btree.sgml
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMergeAppend.c
M src/bin/pg_rewind/filemap.c
M src/include/access/nbtree.h
M src/include/c.h
M src/include/utils/sortsupport.h

Ensure that PLPGSQL_DTYPE_ROW variables have valid refname fields.

commit   : 6e526b78706a99dc52182387d0e6f84d05bd597a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 12:45:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 12:45:37 -0400    

Click here for diff

Without this, the syntax-tree-dumping functions in pl_funcs.c crash,  
and there are other places that might be at risk too.  Per report  
from Pavel Stehule.  
  
Looks like I broke this in commit f9263006d, so back-patch to v11.  
  
Discussion: https://postgr.es/m/CAFj8pRA+3f5n4642q2g8BXCKjbTd7yU9JMYAgDyHgozk6cQ-VA@mail.gmail.com  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Remove redundant allocation

commit   : 40159d91cc546b2585efd3eb0b3db05cd6f2be93    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 17:10:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 17:10:19 +0200    

Click here for diff

Author: Nikita Glukhov <[email protected]>  

M contrib/jsonb_plpython/jsonb_plpython.c

Fix duplicate primary keys in partitions

commit   : ff347f8aff04865680c19ffc818460bb2afaad5b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Oct 2018 11:37:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Oct 2018 11:37:20 -0300    

Click here for diff

When using the CREATE TABLE .. PARTITION OF syntax, it's possible to  
cause a partition to get two primary keys if the parent already has one.  
Tighten the check to disallow that.  
  
Reported-by: Rajkumar Raghuwanshi  
Author: Amul Sul  
Discussion: https://postgr.es/m/CAKcux6=OnSV3-qd8Gb6W=KPPwcCz6Fe_O_MQYjTa24__Xn8XxA@mail.gmail.com  

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

Fix issues around EXPLAIN with JIT.

commit   : e97c4d967ba500c7ec427a56467440f036127158    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 12:48:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 12:48:37 -0700    

Click here for diff

I (Andres) was more than a bit hasty in committing 33001fd7a7072d48327  
after last minute changes, leading to a number of problems (jit output  
was only shown for JIT in parallel workers, and just EXPLAIN without  
ANALYZE didn't work).  Lukas luckily found these issues quickly.  
  
Instead of combining instrumentation in in standard_ExecutorEnd(), do  
so on demand in the new ExplainPrintJITSummary().  
  
Also update a documentation example of the JIT output, changed in  
52050ad8ebec8d831.  
  
Author: Lukas Fittl, with minor changes by me  
Discussion: https://postgr.es/m/CAP53PkxmgJht69pabxBXJBM+0oc6kf3KHMborLP7H2ouJ0CCtQ@mail.gmail.com  
Backpatch: 11, where JIT compilation was introduced  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/jit.sgml
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/include/commands/explain.h
M src/include/nodes/execnodes.h

MAXALIGN the target address where we store flattened value.

commit   : ca5ca25d08710d7f5aaf0e390aae284bc594a6da    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 3 Oct 2018 09:14:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 3 Oct 2018 09:14:09 +0530    

Click here for diff

The API (EOH_flatten_into) that flattens the expanded value representation  
expects the target address to be maxaligned.  All it's usage adhere to that  
principle except when serializing datums for parallel query.  Fix that  
usage.  
  
Diagnosed-by: Tom Lane  
Author: Tom Lane and Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/[email protected]  

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

Set snprintf.c's maximum number of NL arguments to be 31.

commit   : a051c19c3cf4415b36e6333a83a113de4d90a973    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 12:41:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 12:41:28 -0400    

Click here for diff

Previously, we used the platform's NL_ARGMAX if any, otherwise 16.  
The trouble with this is that the platform value is hugely variable,  
ranging from the POSIX-minimum 9 to as much as 64K on recent FreeBSD.  
Values of more than a dozen or two have no practical use and slow down  
the initialization of the argtypes array.  Worse, they cause snprintf.c  
to consume far more stack space than was the design intention, possibly  
resulting in stack-overflow crashes.  
  
Standardize on 31, which is comfortably more than we need (it looks like  
no existing translatable message has more than about 10 parameters).  
I chose that, not 32, to make the array sizes powers of 2, for some  
possible small gain in speed of the memset.  
  
The lack of reported crashes suggests that the set of platforms we  
use snprintf.c on (in released branches) may have no overlap with  
the set where NL_ARGMAX has unreasonably large values.  But that's  
not entirely clear, so back-patch to all supported branches.  
  
Per report from Mateusz Guzik (via Thomas Munro).  
  
Discussion: https://postgr.es/m/CAEepm=3VF=PUp2f8gU8fgZB22yPE_KBS0+e1AHAtQ=09schTHg@mail.gmail.com  

M src/port/snprintf.c

Fix corner-case failures in has_foo_privilege() family of functions.

commit   : 419cc8add5fb81331efbc7ea8862e08b981b7762    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 11:54:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 11:54:12 -0400    

Click here for diff

The variants of these functions that take numeric inputs (OIDs or  
column numbers) are supposed to return NULL rather than failing  
on bad input; this rule reduces problems with snapshot skew when  
queries apply the functions to all rows of a catalog.  
  
has_column_privilege() had careless handling of the case where the  
table OID didn't exist.  You might get something like this:  
	select has_column_privilege(9999,'nosuchcol','select');  
	ERROR:  column "nosuchcol" of relation "(null)" does not exist  
or you might get a crash, depending on the platform's printf's response  
to a null string pointer.  
  
In addition, while applying the column-number variant to a dropped  
column returned NULL as desired, applying the column-name variant  
did not:  
	select has_column_privilege('mytable','........pg.dropped.2........','select');  
	ERROR:  column "........pg.dropped.2........" of relation "mytable" does not exist  
It seems better to make this case return NULL as well.  
  
Also, the OID-accepting variants of has_foreign_data_wrapper_privilege,  
has_server_privilege, and has_tablespace_privilege didn't follow the  
principle of returning NULL for nonexistent OIDs.  Superusers got TRUE,  
everybody else got an error.  
  
Per investigation of Jaime Casanova's report of a new crash in HEAD.  
These behaviors have been like this for a long time, so back-patch to  
all supported branches.  
  
Patch by me; thanks to Stephen Frost for discussion and review  
  
Discussion: https://postgr.es/m/CAJGNTeP=-6Gyqq5TN9OvYEydi7Fv1oGyYj650LGTnW44oAzYCg@mail.gmail.com  

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

Fix documentation of pgrowlocks using "lock_type" instead of "modes"

commit   : e9cff306168743e6ff2abdc03e4857ecb9fb4001    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Oct 2018 16:34:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Oct 2018 16:34:59 +0900    

Click here for diff

The example used in the documentation is outdated as well.  This is an  
oversight from 0ac5ad5, which bumped up pgrowlocks but forgot some bits  
of the documentation.  
  
Reported-by: Chris Wilson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

M doc/src/sgml/pgrowlocks.sgml

Change PROCEDURE to FUNCTION in CREATE EVENT TRIGGER syntax

commit   : 3b983c3354df78f273594dc711c207d09cd214dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Oct 2018 23:02:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Oct 2018 23:02:55 +0200    

Click here for diff

This was claimed to have been done in  
0a63f996e018ac508c858e87fa39cc254a5db49f, but that actually only  
changed the documentation and not the grammar.  (That commit did fully  
change it for CREATE TRIGGER.)  

M src/backend/parser/gram.y
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Fix tuple_data_split() to not open a relation without any lock.

commit   : 1f25c7a8fc99bb33a9b978ab92b9ba9840366753    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:51:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:51:07 -0400    

Click here for diff

contrib/pageinspect's tuple_data_split() function thought it could get  
away with opening the referenced relation with NoLock.  In practice  
there's no guarantee that the current session holds any lock on that  
rel (even if we just read a page from it), so that this is unsafe.  
  
Switch to using AccessShareLock.  Also, postpone closing the relation,  
so that we needn't copy its tupdesc.  Also, fix unsafe use of  
att_isnull() for attributes past the end of the tuple.  
  
Per testing with a patch that complains if we open a relation without  
holding any lock on it.  I don't plan to back-patch that patch, but we  
should close the holes it identifies in all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/heapfuncs.c

Fix ALTER COLUMN TYPE to not open a relation without any lock.

commit   : 4c985549fe82c2a283f5f113747ae2ffd1a95926    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:39:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:39:13 -0400    

Click here for diff

If the column being modified is referenced by a foreign key constraint  
of another table, ALTER TABLE would open the other table (to re-parse  
the constraint's definition) without having first obtained a lock on it.  
This was evidently intentional, but that doesn't mean it's really safe.  
It's especially not safe in 9.3, which pre-dates use of MVCC scans for  
catalog reads, but even in current releases it doesn't seem like a good  
idea.  
  
We know we'll need AccessExclusiveLock shortly to drop the obsoleted  
constraint, so just get that a little sooner to close the hole.  
  
Per testing with a patch that complains if we open a relation without  
holding any lock on it.  I don't plan to back-patch that patch, but we  
should close the holes it identifies in all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Fix detection of the result type of strerror_r().

commit   : 7871a36255e2675075990714bfe0d051f3807efc    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Sep 2018 16:24:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Sep 2018 16:24:56 -0400    

Click here for diff

The method we've traditionally used, of redeclaring strerror_r() to  
see if the compiler complains of inconsistent declarations, turns out  
not to work reliably because some compilers only report a warning,  
not an error.  Amazingly, this has gone undetected for years, even  
though it certainly breaks our detection of whether strerror_r  
succeeded.  
  
Let's instead test whether the compiler will take the result of  
strerror_r() as a switch() argument.  It's possible this won't  
work universally either, but it's the best idea I could come up with  
on the spur of the moment.  
  
Back-patch of commit 751f532b9.  Buildfarm results indicate that only  
icc-on-Linux actually has an issue here; perhaps the lack of field  
reports indicates that people don't build PG for production that way.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-library.m4
M configure
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Improve error reporting for unsupported effective_io_concurrency setting.

commit   : a8fb03fceadb5fe9698ff0182ca76b0640348e70    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 16:12:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 16:12:13 -0400    

Click here for diff

Give a specific error complaining about lack of posix_fadvise() when  
someone tries to set effective_io_concurrency > 0 on platforms  
without that.  
  
This probably isn't worth extensive back-patching, but I (tgl) felt  
cramming it into v11 was reasonable.  
  
James Robinson  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/include/pg_config_manual.h

Fix assertion failure when updating full_page_writes for checkpointer.

commit   : 6c8671bc395c9be44571e424c458b94ec20975d3    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 28 Sep 2018 12:24:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 28 Sep 2018 12:24:09 +0530    

Click here for diff

When the checkpointer receives a SIGHUP signal to update its configuration,  
it may need to update the shared memory for full_page_writes and need to  
write a WAL record for it.  Now, it is quite possible that the XLOG  
machinery has not been initialized by that time and it will lead to  
assertion failure while doing that.  Fix is to allow the initialization of  
the XLOG machinery outside critical section.  
  
This bug has been introduced by the commit 2c03216d83 which added the XLOG  
machinery initialization in RecoveryInProgress code path.  
  
Reported-by: Dilip Kumar  
Author: Dilip Kumar  
Reviewed-by: Michael Paquier and Amit Kapila  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/CAFiTN-u4BA8KXcQUWDPNgaKAjDXC=C2whnzBM8TAcv=stckYUw@mail.gmail.com  

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

Fix WAL recycling on standbys depending on archive_mode

commit   : 88926fd481b7d1c928947230e154235d9d9720f4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 28 Sep 2018 11:55:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 28 Sep 2018 11:55:43 +0900    

Click here for diff

A restart point or a checkpoint recycling WAL segments treats segments  
marked with neither ".done" (archiving is done) or ".ready" (segment is  
ready to be archived) in archive_status the same way for archive_mode  
being "on" or "always".  While for a primary this is fine, a standby  
running a restart point with archive_mode = on would try to mark such a  
segment as ready for archiving, which is something that will never  
happen except after the standby is promoted.  
  
Note that this problem applies only to WAL segments coming from the  
local pg_wal the first time archive recovery is run.  Segments part of a  
self-contained base backup are the most common case where this could  
happen, however even in this case normally the .done markers would be  
most likely part of the backup.  Segments recovered from an archive are  
marked as .ready or .done by the startup process, and segments finished  
streaming are marked as such by the WAL receiver, so they are handled  
already.  
  
Reported-by: Haruka Takatsuka  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5, where archive_mode = always has been added.  

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

Fix assorted bugs in pg_get_partition_constraintdef().

commit   : 49507dec46010cc781a4b4575b6c2ff5088b13d3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Sep 2018 18:15:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Sep 2018 18:15:06 -0400    

Click here for diff

It failed if passed a nonexistent relation OID, or one that was a non-heap  
relation, because of blindly applying heap_open to a user-supplied OID.  
This is not OK behavior for a SQL-exposed function; we have a project  
policy that we should return NULL in such cases.  Moreover, since  
pg_get_partition_constraintdef ought now to work on indexes, restricting  
it to heaps is flat wrong anyway.  
  
The underlying function generate_partition_qual() wasn't on board with  
indexes having partition quals either, nor for that matter with rels  
having relispartition set but yet null relpartbound.  (One wonders  
whether the person who wrote the function comment blocks claiming that  
these functions allow a missing relpartbound had ever tested it.)  
  
Fix by testing relispartition before opening the rel, and by using  
relation_open not heap_open.  (If any other relkinds ever grow the  
ability to have relispartition set, the code will work with them  
automatically.)  Also, don't reject null relpartbound in  
generate_partition_qual.  
  
Back-patch to v11, and all but the null-relpartbound change to v10.  
(It's not really necessary to change generate_partition_qual at all  
in v10, but I thought s/heap_open/relation_open/ would be a good  
idea anyway just to keep the code in sync with later branches.)  
  
Per report from Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Recurse to sequences on ownership change for all relkinds

commit   : 6485469606c15ae219977b1c228a266087eb30ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jun 2018 23:22:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jun 2018 23:22:14 -0400    

Click here for diff

When a table ownership is changed, we must apply that also to any owned  
sequences.  (Otherwise, it would result in a situation that cannot be  
restored, because linked sequences must have the same owner as the  
table.)  But this was previously only applied to regular tables and  
materialized views.  But it should also apply to at least foreign  
tables.  This patch removes the relkind check altogether, because it  
doesn't save very much and just introduces the possibility of similar  
omissions.  
  
Bug: #15238  
Reported-by: Christoph Berg <[email protected]>  

M src/backend/commands/tablecmds.c

Rework activation of commit timestamps during recovery

commit   : 180feb8c7ef5d4968170d49136faf492b6a03c67    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Sep 2018 10:29:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Sep 2018 10:29:20 +0900    

Click here for diff

The activation and deactivation of commit timestamp tracking has not  
been handled consistently for a primary or standbys at recovery.  The  
facility can be activated at three different moments of recovery:  
- The beginning, where a primary would use the GUC value for the  
decision-making, and where a standby relies on the contents of the  
control file.  
- When replaying a XLOG_PARAMETER_CHANGE record at redo.  
- The end, where both primary and standby rely on the GUC value.  
  
Using the GUC value for a primary at the beginning of recovery causes  
problems with commit timestamp access when doing crash recovery.  
Particularly, when replaying transaction commits, it could be possible  
that an attempt to read commit timestamps is done for a transaction  
which committed at a moment when track_commit_timestamp was disabled.  
  
A test case is added to reproduce the failure.  The test works down to  
v11 as it takes advantage of transaction commits within procedures.  
  
Reported-by: Hailong Li  
Author: Masahiko Sawasa, Michael Paquier  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5, where commit timestamps have been introduced.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/test/modules/commit_ts/t/004_restart.pl

Remove obsolete comment

commit   : 2886a8f7045411c8a1607cf3b01f3856cb475f9e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 25 Sep 2018 17:55:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 25 Sep 2018 17:55:22 -0300    

Click here for diff

The documented shortcoming was actually fixed in 4c728f3829  
so the comment is not true anymore.  

M src/backend/executor/execParallel.c

Collect JIT instrumentation from workers.

commit   : e63441c3f5ca4a3cdb47f9c7fed9e61dde17b60d    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 12:54:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 12:54:29 -0700    

Click here for diff

Previously, when using parallel query, EXPLAIN (ANALYZE)'s JIT  
compilation timings did not include the overhead from doing so on the  
workers.  Fix that.  
  
We do so by simply aggregating the cost of doing JIT compilation on  
workers and the leader together. Arguably that's not quite accurate,  
because the total time spend doing so is spent in parallel - but it's  
hard to do much better.  For additional detail, when VERBOSE is  
specified, the stats for workers are displayed separately.  
  
Author: Amit Khandekar and Andres Freund  
Discussion: https://postgr.es/m/CAJ3gD9eLrz51RK_gTkod+71iDcjpB_N8eC6vU2AW-VicsAERpQ@mail.gmail.com  
Backpatch: 11-  

M contrib/auto_explain/auto_explain.c
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/commands/explain.h
M src/include/executor/execParallel.h
M src/include/jit/jit.h
M src/include/nodes/execnodes.h

Make some fixes to allow building Postgres on macOS 10.14 ("Mojave").

commit   : 9590f7d6c66321214926e13558c42f0099737ce4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Sep 2018 13:23:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Sep 2018 13:23:29 -0400    

Click here for diff

Apple's latest rearrangements of the system-supplied headers have broken  
building of PL/Perl and PL/Tcl.  The only practical way to fix PL/Tcl is to  
start using the "-isysroot" compiler flag to point to SDK-supplied headers,  
as Apple expects.  We must also start distinguishing where to find Perl's  
headers from where to find its shared library; but that seems like good  
cleanup anyway.  
  
Extensions that formerly did something like -I$(perl_archlibexp)/CORE  
should now do -I$(perl_includedir)/CORE instead.  perl_archlibexp  
is still the place to look for libperl.so, though.  
  
If for some reason you don't like the default -isysroot setting, you can  
override that by setting PG_SYSROOT in configure's arguments.  I don't  
currently think people would need to do so, unless maybe for cross-version  
build purposes.  
  
In addition, teach configure where to find tclConfig.sh.  Our traditional  
method of searching $auto_path hasn't worked for the last couple of macOS  
releases, and it now seems clear that Apple's not going to change that.  
The workaround of manually specifying --with-tclconfig was annoying  
already, but Mojave's made it a lot more so because the sysroot path now  
has to be included as well.  Let's just wire the knowledge into configure  
instead.  To avoid breaking builds against non-default Tcl installations  
(e.g. MacPorts) wherein the $auto_path method probably still works,  
arrange to try the additional case only after all else has failed.  
  
Back-patch to all supported versions, since at least the buildfarm  
cares about that.  The changes are set up to not do anything on macOS  
releases that are old enough to not have functional sysroot trees.  

M config/tcl.m4
M configure
M configure.in
M contrib/hstore_plperl/Makefile
M contrib/jsonb_plperl/Makefile
M src/Makefile.global.in
M src/pl/plperl/GNUmakefile
M src/template/darwin

Ignore publication tables when --no-publications is used

commit   : 1f50394119642f1a0e4a207ca57c27a97bfbc8c9    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 11:05:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 11:05:13 +0900    

Click here for diff

96e1cb4 has added support for --no-publications in pg_dump, pg_dumpall  
and pg_restore, but forgot the fact that publication tables also need to  
be ignored when this option is used.  
  
Author: Gilles Darold  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10, where publications have been added.  

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

Revoke pg_stat_statements_reset() permissions

commit   : a3bb831efebf846ea1745b5cbe7ba2597bf33029    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 09:56:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 09:56:41 +0900    

Click here for diff

Commit 25fff40 has granted execute permission of the function  
pg_stat_statements_reset() to default role "pg_read_all_stats", but this  
role is meant to read statistics, and not to reset them.  The  
permissions on this function are revoked from "pg_read_all_stats".  The  
version of pg_stat_statements is bumped up in consequence.  
  
Author: Haribabu Kommi  
Reviewed-by: Michael Paquier, Amit Kapila  
Discussion: https://postgr.es/m/CAJrrPGf5fCnKqXObpwGN9nMyD--tzOf-7LFCJiz59Z1wJ5qj9A@mail.gmail.com  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/pg_stat_statements–1.5–1.6.sql
M contrib/pg_stat_statements/pg_stat_statements.control

auto_explain: Include JIT information if applicable.

commit   : e5b2bd091aa4884f8f68e2d55c851e9ebd2d8c11    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:40:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:40:57 -0700    

Click here for diff

Due to my (Andres') omission auto_explain did not include information  
about JIT compilation. Fix that.  
  
Author: Lukas Fittl  
Discussion:  
https://postgr.es/m/CAP53PkzgSyoTCau0-5FNaM484B=uO8nLzma7L1ncWLb1=oVJQA@mail.gmail.com  
Backpatch: 11-, where JIT compilation was introduced  

M contrib/auto_explain/auto_explain.c

Make EXPLAIN output for JIT compilation more dense.

commit   : 6859bd2632d80e21d25830ac60bbb48bf12f6d46    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:27:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:27:08 -0700    

Click here for diff

A discussion about also reporting JIT compilation overhead on workers  
brought unhappiness with the verbosity of the current explain format  
to light.  Make the text format more dense, and restructure the  
structured output to mirror that more closely.  
  
As we're re-jiggering the output format anyway: The denser format  
allows us to report all flags for JIT compilation (now also reporting  
PGJIT_EXPR and PGJIT_DEFORM), and report the total time in addition to  
the individual times.  
  
Per complaint from Tom Lane.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where JIT compilation was introduced  

M src/backend/commands/explain.c

Fast default trigger and expand_tuple fixes

commit   : 9625ab79245b5b91162ede9d1b4d8b4be823c21c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 24 Sep 2018 16:11:24 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 24 Sep 2018 16:11:24 -0400    

Click here for diff

Ensure that triggers get properly filled in tuples for the OLD value.  
Also fix the logic of detecting missing null values. The previous logic  
failed to detect a missing null column before the first missing column  
with a default. Fixing this has simplified the logic a bit.  
  
Regression tests are added to test changes. This should ensure better  
coverage of expand_tuple().  
  
Original bug reports, and some code and test scripts from Tomas Vondra  
  
Backpatch to release 11.  

M src/backend/access/common/heaptuple.c
M src/backend/commands/trigger.c
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Fix over-allocation of space for array_out()'s result string.

commit   : bfdd02f88b9678dea0e0ba5866ee772f3aa55cba    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 11:30:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 11:30:51 -0400    

Click here for diff

array_out overestimated the space needed for its output, possibly by  
a very substantial amount if the array is multi-dimensional, because  
of wrong order of operations in the loop that counts the number of  
curly-brace pairs needed.  While the output string is normally  
short-lived, this could still cause problems in extreme cases.  
  
An additional minor error was that it counted one more delimiter than  
is actually needed.  
  
Repair those errors, add an Assert that the space is now correctly  
calculated, and make some minor improvements in the comments.  
  
I also failed to resist the temptation to get rid of an integer  
modulus operation per array element; a simple comparison is sufficient.  
  
This bug dates clear back to Berkeley days, so back-patch to all  
supported versions.  
  
Keiichi Hirobe, minor additional work by me  
  
Discussion: https://postgr.es/m/CAH=EFxE9W0tRvQkixR2XJRRCToUYUEDkJZk6tnADXugPBRdcdg@mail.gmail.com  

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

Initialize random() in bootstrap/stand-alone postgres and in initdb.

commit   : 89f2b64da370e7b0737760e3282f096591d6518f    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 23 Sep 2018 22:56:39 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 23 Sep 2018 22:56:39 -0700    

Click here for diff

This removes a difference between the standard IsUnderPostmaster  
execution environment and that of --boot and --single.  In a stand-alone  
backend, "SELECT random()" always started at the same seed.  
  
On a system capable of using posix shared memory, initdb could still  
conclude "selecting dynamic shared memory implementation ... sysv".  
Crashed --boot or --single postgres processes orphaned shared memory  
objects having names that collided with the not-actually-random names  
that initdb probed.  The sysv fallback appeared after ten crashes of  
--boot or --single postgres.  Since --boot and --single are rare in  
production use, systems used for PostgreSQL development are the  
principal candidate to notice this symptom.  
  
Back-patch to 9.3 (all supported versions).  PostgreSQL 9.4 introduced  
dynamic shared memory, but 9.3 does share the "SELECT random()" problem.  
  
Reviewed by Tom Lane and Kyotaro HORIGUCHI.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/init/miscinit.c
M src/bin/initdb/initdb.c

Doc: warn against using parallel restore with --load-via-partition-root.

commit   : b1356f18b70e566da5acd9544632db7b196b3220    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 18:34:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 18:34:18 -0400    

Click here for diff

This isn't terribly safe, and making it so doesn't seem like a small  
project, so for the moment just warn against it.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix failure in WHERE CURRENT OF after rewinding the referenced cursor.

commit   : fe30cd25ec82bdc9bb9e12d3b52adadc08bedc8e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 16:05:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 16:05:45 -0400    

Click here for diff

In a case where we have multiple relation-scan nodes in a cursor plan,  
such as a scan of an inheritance tree, it's possible to fetch from a  
given scan node, then rewind the cursor and fetch some row from an  
earlier scan node.  In such a case, execCurrent.c mistakenly thought  
that the later scan node was still active, because ExecReScan hadn't  
done anything to make it look not-active.  We'd get some sort of  
failure in the case of a SeqScan node, because the node's scan tuple  
slot would be pointing at a HeapTuple whose t_self gets reset to  
invalid by heapam.c.  But it seems possible that for other relation  
scan node types we'd actually return a valid tuple TID to the caller,  
resulting in updating or deleting a tuple that shouldn't have been  
considered current.  To fix, forcibly clear the ScanTupleSlot in  
ExecScanReScan.  
  
Another issue here, which seems only latent at the moment but could  
easily become a live bug in future, is that rewinding a cursor does  
not necessarily lead to *immediately* applying ExecReScan to every  
scan-level node in the plan tree.  Upper-level nodes will think that  
they can postpone that call if their child node is already marked  
with chgParam flags.  I don't see a way for that to happen today in  
a plan tree that's simple enough for execCurrent.c's search_plan_tree  
to understand, but that's one heck of a fragile assumption.  So, add  
some logic in search_plan_tree to detect chgParam flags being set on  
nodes that it descended to/through, and assume that that means we  
should consider lower scan nodes to be logically reset even if their  
ReScan call hasn't actually happened yet.  
  
Per bug #15395 from Matvey Arye.  This has been broken for a long time,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execCurrent.c
M src/backend/executor/execScan.c
M src/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

docs: remove use of escape strings and use bytea hex output

commit   : 7f203d60f413007a654a0f9b7763ef986150ce95    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Sep 2018 19:55:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Sep 2018 19:55:07 -0400    

Click here for diff

standard_conforming_strings defaulted to 'on' in PG 9.1.  
bytea_output defaulted to 'hex' in PG 9.0.  
  
Reported-by: AndrƩ HƤnsel  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/array.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/rowtypes.sgml

Fix bogus tab-completion rule for CREATE PUBLICATION.

commit   : 45a2d45f4ff2e2f1524e7eb3aca9243895eefa8a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 15:58:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 15:58:37 -0400    

Click here for diff

You can't use "FOR TABLE" as a single Matches argument, because readline  
will consider that input to be two words not one.  It's necessary to make  
the pattern contain two arguments.  
  
The case accidentally worked anyway because the words_after_create  
test fired ... but only for the first such table name.  
  
Noted by Edmund Horner, though this isn't exactly his proposed fix.  
Backpatch to v10 where the faulty code came in.  
  
Discussion: https://postgr.es/m/CAMyN-kDe=gBmHgxWwUUaXuwK+p+7g1vChR7foPHRDLE592nJPQ@mail.gmail.com  

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

Use size_t consistently in dsa.{ch}.

commit   : ec7b27675dcc39e81555260a5e33c5aa0fb2bcd2    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 22 Sep 2018 00:40:13 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 22 Sep 2018 00:40:13 +1200    

Click here for diff

Takeshi Ideriha complained that there is a mixture of Size and size_t  
in dsa.c and corresponding header.  Let's use size_t.  Back-patch to 10  
where dsa.c landed, to make future back-patching easy.  
  
Discussion: https://postgr.es/m/4E72940DA2BF16479384A86D54D0988A6F19ABD9%40G01JPEXMBKW04  

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

Document lock taken on referenced table when adding a foreign key

commit   : 3d4b143dc7fd9d060e9f11ac6c17620f58cfc33d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Sep 2018 15:09:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Sep 2018 15:09:40 +0900    

Click here for diff

This can happen for CREATE TABLE and ALTER TABLE, so a mention is added  
to both of them in the concerned subsections.  
  
Author: Adrien Nayrat  
Discussion: https://postgr.es/m/[email protected]  

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

Error out for clang on x86-32 without SSE2 support, no -fexcess-precision.

commit   : 84f14fb788523d5175fc9b5a11c36853a3697d32    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 14:18:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 14:18:43 -0700    

Click here for diff

As clang currently doesn't support -fexcess-precision=standard,  
compiling x86-32 code with SSE2 disabled, can lead to problems with  
floating point overflow checks and the like.  
  
This issue was noticed because clang, on at least some BSDs, defaults  
to i386 compatibility, whereas it defaults to pentium4 on Linux.  Our  
forced usage of __builtin_isinf() lead to some overflow checks not  
triggering when compiling for i386, e.g. when the result of the  
calculation didn't overflow in 80bit registers, but did so in 64bit.  
  
While we could just fall back to a non-builtin isinf, it seems likely  
that the use of 80bit registers leads to other problems (which is why  
we force the flag for GCC already).  Therefore error out when  
detecting clang in that situation.  
  
Reported-By: Victor Wagner  
Analyzed-By: Andrew Gierth and Andres Freund  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.3-, all supported versions are affected  

M configure
M configure.in

Fix segment_bins corruption in dsa.c.

commit   : 8ffc3be10f86af74d1341ba886237a330e47485f    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 15:52:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 15:52:39 +1200    

Click here for diff

If a segment has been freed by dsa.c because it is entirely empty, other  
backends must make sure to unmap it before following links to new  
segments that might happen to have the same index number, or they could  
finish up looking at a defunct segment and then corrupt the segment_bins  
lists.  The correct protocol requires checking freed_segment_counter  
after acquiring the area lock and before resolving any index number to a  
segment.  Add the missing checks and an assertion.  
  
Back-patch to 10, where dsa.c first arrived.  
  
Author: Thomas Munro  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAEepm%3D0thg%2Bja5zGVa7jBy-uqyHrTqTm8HGhEOtMmigGrAqTbw%40mail.gmail.com  

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

Defer restoration of libraries in parallel workers.

commit   : 9d178fb928040f1a5ab5b566f1ec76d7ac554587    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 14:02:56 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 14:02:56 +1200    

Click here for diff

Several users of extensions complained of crashes in parallel workers  
that turned out to be due to syscache access from their _PG_init()  
functions.  Reorder the initialization of parallel workers so that  
libraries are restored after the caches are initialized, and inside a  
transaction.  
  
This was reported in bug #15350 and elsewhere.  We don't consider it  
to be a bug: extensions shouldn't do that, because then they can't be  
used in shared_preload_libraries.  However, it's a fairly obscure  
hazard and these extensions worked in practice before parallel query  
came along.  So let's make it work.  Later commits might add a warning  
message and eventually an error.  
  
Back-patch to 9.6, where parallel query landed.  
  
Author: Thomas Munro  
Reviewed-by: Amit Kapila  
Reported-by: Kieran McCusker, Jimmy  
Discussion: https://postgr.es/m/153512195228.1489.8545997741965926448%40wrigleys.postgresql.org  

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

Fix minor error message style guide violation.

commit   : 6449616419c59c3223b3c4f731cefa3d77fac567    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 17:06:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 17:06:40 -0400    

Click here for diff

No periods at the ends of primary error messages, please.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't ignore locktable-full failures in StandbyAcquireAccessExclusiveLock.

commit   : c84f83975eb48d19f712b2b4d3c788c018906ed2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 12:43:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 12:43:51 -0400    

Click here for diff

Commit 37c54863c removed the code in StandbyAcquireAccessExclusiveLock  
that checked the return value of LockAcquireExtended.  That created a  
bug, because it's still passing reportMemoryError = false to  
LockAcquireExtended, meaning that LOCKACQUIRE_NOT_AVAIL will be returned  
if we're out of shared memory for the lock table.  
  
In such a situation, the startup process would believe it had acquired an  
exclusive lock even though it hadn't, with potentially dire consequences.  
  
To fix, just drop the use of reportMemoryError = false, which allows us  
to simplify the call into a plain LockAcquire().  It's unclear that the  
locktable-full situation arises often enough that it's worth having a  
better recovery method than crash-and-restart.  (I strongly suspect that  
the only reason the code path existed at all was that it was relatively  
simple to do in the pre-37c54863c implementation.  But now it's not.)  
  
LockAcquireExtended's reportMemoryError parameter is now dead code and  
could be removed.  I refrained from doing so, however, because there  
was some interest in resurrecting the behavior if we do get reports of  
locktable-full failures in the field.  Also, it seems unwise to remove  
the parameter concurrently with shipping commit f868a8143, which added a  
parameter; if there are any third-party callers of LockAcquireExtended,  
we want them to get a wrong-number-of-parameters compile error rather  
than a possibly-silent misinterpretation of its last parameter.  
  
Back-patch to 9.6 where the bug was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c

Revert "Allow concurrent-safe open() and fopen() in frontend code for Windows"

commit   : df8b5f3eb8a7c477156d0ad9d83e7297912cfe79    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 17:28:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 17:28:27 -0400    

Click here for diff

This reverts commit f02259fe93e75d5443a2fabe2f2f38b81924ab36, in the  
v11 branch only.  
  
The hack this required in initdb.c should probably have clued us that it  
wasn't really ready, but we didn't get the hint.  Subsequent developments  
have made clear that it affected text-vs-binary behavior in a lot of  
places, and there's no reason to think that any of those behavioral changes  
are desirable.  There's no time to fix this before 11beta4, so just revert  
for the moment.  We can keep working on this in HEAD, and maybe reconsider  
a back-patch once we're satisfied things are stable.  
  
(I take the blame for this fiasco, having encouraged Michael to back-patch  
a change at the last possible moment before beta wrap.)  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/common/file_utils.c
M src/include/port.h

Fix some probably-minor oversights in readfuncs.c.

commit   : 5c07d6497d8e694e5de5a78c1e3f74e2b9790c48    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 13:02:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 13:02:27 -0400    

Click here for diff

The system expects TABLEFUNC RTEs to have coltypes, coltypmods, and  
colcollations lists, but outfuncs doesn't dump them and readfuncs doesn't  
restore them.  This doesn't cause obvious failures, because the only things  
that look at those fields are expandRTE() and get_rte_attribute_type(),  
which are mostly used during parse analysis, before anything would've  
passed the parsetree through outfuncs/readfuncs.  But expandRTE() is used  
in build_physical_tlist(), which means that that function will return a  
wrong answer for a TABLEFUNC RTE that came from a view.  Very accidentally,  
this doesn't cause serious problems, because what it will return is NIL  
which callers will interpret as "couldn't build a physical tlist because  
of dropped columns".  So you still get a plan that works, though it's  
marginally less efficient than it could be.  There are also some other  
expandRTE() calls associated with transformation of whole-row Vars in  
the planner.  I have been unable to exhibit misbehavior from that, and  
it may be unreachable in any case that anyone would care about ... but  
I'm not entirely convinced, so this seems like something we should back-  
patch a fix for.  Fortunately, we can fix it without forcing a change  
of stored rules and a catversion bump, because we can just copy these  
lists from the subsidiary TableFunc object.  
  
readfuncs.c was also missing support for NamedTuplestoreScan plan nodes.  
This accidentally fails to break parallel query because a query using  
a named tuplestore would never be considered parallel-safe anyway.  
However, project policy since parallel query came in is that all plan  
node types should have outfuncs/readfuncs support, so this is clearly  
an oversight that should be repaired.  
  
Noted while fooling around with a patch to test outfuncs/readfuncs more  
thoroughly.  That exposed some other issues too, but these are the only  
ones that seem worth back-patching.  
  
Back-patch to v10 where both of these features came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/readfuncs.c
M src/include/nodes/parsenodes.h

Allow DSM allocation to be interrupted.

commit   : 63efab4ca139ab18095b8e095d5708d5566fc9e2    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 18 Sep 2018 22:56:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 18 Sep 2018 22:56:36 +1200    

Click here for diff

Chris Travers reported that the startup process can repeatedly try to  
cancel a backend that is in a posix_fallocate()/EINTR loop and cause it  
to loop forever.  Teach the retry loop to give up if an interrupt is  
pending.  Don't actually check for interrupts in that loop though,  
because a non-local exit would skip some clean-up code in the caller.  
  
Back-patch to 9.4 where DSM was added (and posix_fallocate() was later  
back-patched).  
  
Author: Chris Travers  
Reviewed-by: Ildar Musin, Murat Kabilov, Oleksii Kliukin  
Tested-by: Oleksii Kliukin  
Discussion: https://postgr.es/m/CAN-RpxB-oeZve_J3SM_6%3DHXPmvEG%3DHX%2B9V9pi8g2YR7YW0rBBg%40mail.gmail.com  

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

Stamp 11beta4.

commit   : 3d65e406d1ea82060ad13a7bc41178ed22c599d1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 18:43:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 18:43:41 -0400    

Click here for diff

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

Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)).

commit   : 486cfb3b8ce6e94eaad48038acff51064c070ccb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 13:16:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 13:16:32 -0400    

Click here for diff

The original coding for XMLTABLE thought it could represent a default  
namespace by a T_String Value node with a null string pointer.  That's  
not okay, though; in particular outfuncs.c/readfuncs.c are not on board  
with such a representation, meaning you'll get a null pointer crash  
if you try to store a view or rule containing this construct.  
  
To fix, change the parsetree representation so that we have a NULL  
list element, instead of a bogus Value node.  
  
This isn't really a functional limitation since default XML namespaces  
aren't yet implemented in the executor; you'd just get "DEFAULT  
namespace is not supported" anyway.  But crashes are not nice, so  
back-patch to v10 where this syntax was added.  Ordinarily we'd consider  
a parsetree representation change to be un-backpatchable; but since  
existing releases would crash on the way to storing such constructs,  
there can't be any existing views/rules to be incompatible with.  
  
Per report from Andrey Lepikhov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeTableFuncscan.c
M src/backend/parser/parse_clause.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.h
M src/include/nodes/primnodes.h

Fix pgbench lexer's "continuation" rule to cope with Windows newlines.

commit   : d45f157e8b07aee455df0bcc76fdf4e9963c0200    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 12:11:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 12:11:43 -0400    

Click here for diff

Our general practice in frontend code is to accept input with either  
Unix-style newlines (\n) or DOS-style (\r\n).  pgbench was mostly down  
with that, but its rule for line continuations (backslash-newline) was  
not.  This had been masked on Windows buildfarm machines before commit  
0ba06e0bf by use of Windows text mode to read files.  We could have fixed  
it by forcing text mode again, but it's better to fix the parsing code  
so that Windows-style text files on Unix systems don't cause problems.  
  
Back-patch to v10 where pgbench grew line continuations.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/exprscan.l

Allow concurrent-safe open() and fopen() in frontend code for Windows

commit   : f02259fe93e75d5443a2fabe2f2f38b81924ab36    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Sep 2018 20:38:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Sep 2018 20:38:42 +0900    

Click here for diff

PostgreSQL uses a custom wrapper for open() and fopen() which is  
concurrent-safe, allowing multiple processes to open and work on the  
same file.  This has a couple of advantages:  
- pg_test_fsync does not handle O_DSYNC correctly otherwise, leading to  
false claims that disks are unsafe.  
- TAP tests can run into race conditions when a postmaster and pg_ctl  
open postmaster.pid, fixing some random failures in the buildfam.  
  
pg_upgrade is one frontend tool using workarounds to bypass file locking  
issues with the log files it generates, however the interactions with  
pg_ctl are proving to be tedious to get rid of, so this is left for  
later.  
  
Author: Laurenz Albe  
Reviewed-by: Michael Paquier, Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/common/file_utils.c
M src/include/port.h

Translation updates

commit   : bcbd1590279c1dfc3e6756a09166943437071bd2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Sep 2018 08:40:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Sep 2018 08:40:36 +0200    

Click here for diff

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

M src/backend/nls.mk
M src/backend/po/de.po
D src/backend/po/id.po
M src/backend/po/ja.po
M src/backend/po/ko.po
D src/backend/po/pt_BR.po
M src/backend/po/sv.po
M src/backend/po/tr.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ko.po
M src/bin/initdb/po/sv.po
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/ko.po
D src/bin/pg_basebackup/po/pt_BR.po
D src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_config/po/ja.po
M src/bin/pg_controldata/po/ja.po
M src/bin/pg_controldata/po/ko.po
M src/bin/pg_ctl/po/ja.po
M src/bin/pg_ctl/po/ko.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_dump/po/ko.po
M src/bin/pg_resetwal/nls.mk
D src/bin/pg_resetwal/po/it.po
M src/bin/pg_resetwal/po/ja.po
M src/bin/pg_resetwal/po/ko.po
D src/bin/pg_resetwal/po/pl.po
D src/bin/pg_resetwal/po/pt_BR.po
M src/bin/pg_resetwal/po/sv.po
D src/bin/pg_resetwal/po/zh_CN.po
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/ja.po
M src/bin/pg_rewind/po/ko.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/ko.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_verify_checksums/nls.mk
A src/bin/pg_verify_checksums/po/de.po
A src/bin/pg_verify_checksums/po/ja.po
A src/bin/pg_verify_checksums/po/ko.po
A src/bin/pg_verify_checksums/po/sv.po
A src/bin/pg_verify_checksums/po/tr.po
M src/bin/pg_waldump/po/ja.po
M src/bin/pg_waldump/po/ko.po
M src/bin/psql/nls.mk
M src/bin/psql/po/de.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ko.po
M src/bin/psql/po/sv.po
M src/bin/psql/po/tr.po
D src/bin/psql/po/zh_TW.po
M src/bin/scripts/po/ja.po
M src/bin/scripts/po/ko.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/ecpg/preproc/po/ko.po
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ko.po
M src/interfaces/libpq/po/sv.po
D src/interfaces/libpq/po/zh_TW.po
M src/pl/plperl/nls.mk
D src/pl/plperl/po/zh_TW.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/de.po
M src/pl/plpgsql/src/po/ko.po
D src/pl/plpgsql/src/po/zh_TW.po
M src/pl/plpython/po/ja.po
M src/pl/plpython/po/ko.po
M src/pl/tcl/nls.mk
D src/pl/tcl/po/pt_BR.po
D src/pl/tcl/po/ro.po
D src/pl/tcl/po/zh_CN.po
D src/pl/tcl/po/zh_TW.po

Add list of acknowledgments to release notes

commit   : 05ae1bafa540e7eeba6faa7fd217a2997021c214    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 16 Sep 2018 22:06:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 16 Sep 2018 22:06:42 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 11 development.  
  
current through 7a2f70f0e5e83871d091ee479abea4b8f850dd29  

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

Fix out-of-tree build for transform modules.

commit   : f1ca5a654d5db32c2af8b28b7fbca38bbb793f56    
  
author   : Andrew Gierth <[email protected]>    
date     : Sun, 16 Sep 2018 18:46:45 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sun, 16 Sep 2018 18:46:45 +0100    

Click here for diff

Neither plperl nor plpython installed sufficient header files to  
permit transform modules to be built out-of-tree using PGXS. Fix that  
by installing all plperl and plpython header files (other than those  
with special purposes such as generated data tables), and also install  
plpython's special .mk file for mangling regression tests.  
  
(This commit does not fix the windows install, which does not  
currently install _any_ plperl or plpython headers.)  
  
Also fix the existing transform modules for hstore and ltree so that  
their cross-module #include directives work as anticipated by commit  
df163230b9 et seq. This allows them to serve as working examples of  
how to reference other modules when doing separate out-of-tree builds.  
  
Discussion: https://postgr.es/m/87o9ej8bgl.fsf%40news-spur.riddles.org.uk  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/Makefile
M contrib/hstore_plpython/hstore_plpython.c
M contrib/ltree_plpython/Makefile
M contrib/ltree_plpython/ltree_plpython.c
M src/pl/plperl/GNUmakefile
M src/pl/plpython/Makefile
M src/tools/msvc/Mkvcbuild.pm

Add outfuncs.c support for RawStmt nodes.

commit   : 0ca27ea66a18cbf9b9bc69443df15a637f26b9b4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Sep 2018 13:02:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Sep 2018 13:02:47 -0400    

Click here for diff

I noticed while poking at a report from Andrey Lepikhov that the  
recent addition of RawStmt nodes at the top of raw parse trees  
makes it impossible to print any raw parse trees whatsoever,  
because outfuncs.c doesn't know RawStmt and hence fails to descend  
into it.  
  
While we generally lack outfuncs.c support for utility statements,  
there is reasonably complete support for what you can find in a  
raw SELECT statement.  It was not my intention to make that all  
dead code ... so let's add support for RawStmt.  
  
Back-patch to v10 where RawStmt appeared.  

M src/backend/nodes/outfuncs.c

doc: clarify pg_basebackup's -C/--create-slot description

commit   : 7a2f70f0e5e83871d091ee479abea4b8f850dd29    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 16 Sep 2018 11:35:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 16 Sep 2018 11:35:34 -0400    

Click here for diff

The previous text was overly complex.  
  
Backpatch-through: 11  

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

In v11, disable JIT by default (it's still enabled by default in HEAD).

commit   : 0fdadfb0192935e0f8bec7fa5ec9dbb470d6d587    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 17:24:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 17:24:35 -0400    

Click here for diff

Per discussion, JIT isn't quite mature enough to ship enabled-by-default.  
  
I failed to resist the temptation to do a bunch of copy-editing on the  
related documentation.  Also, clean up some inconsistencies in which  
section of config.sgml the JIT GUCs are documented in vs. what guc.c  
and postgresql.config.sample had.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/release-11.sgml
M src/backend/jit/jit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Fix failure with initplans used conditionally during EvalPlanQual rechecks.

commit   : f13e2d1cec9b786405d649c72a4aa29fadcea617    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 13:42:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 13:42:34 -0400    

Click here for diff

The EvalPlanQual machinery assumes that any initplans (that is,  
uncorrelated sub-selects) used during an EPQ recheck would have already  
been evaluated during the main query; this is implicit in the fact that  
execPlan pointers are not copied into the EPQ estate's es_param_exec_vals.  
But it's possible for that assumption to fail, if the initplan is only  
reached conditionally.  For example, a sub-select inside a CASE expression  
could be reached during a recheck when it had not been previously, if the  
CASE test depends on a column that was just updated.  
  
This bug is old, appearing to date back to my rewrite of EvalPlanQual in  
commit 9f2ee8f28, but was not detected until Kyle Samson reported a case.  
  
To fix, force all not-yet-evaluated initplans used within the EPQ plan  
subtree to be evaluated at the start of the recheck, before entering the  
EPQ environment.  This could be inefficient, if such an initplan is  
expensive and goes unused again during the recheck --- but that's piling  
one layer of improbability atop another.  It doesn't seem worth adding  
more complexity to prevent that, at least not in the back branches.  
  
It was convenient to use the new-in-v11 ExecEvalParamExecParams function  
to implement this, but I didn't like either its name or the specifics of  
its API, so revise that.  
  
Back-patch all the way.  Rather than rewrite the patch to avoid depending  
on bms_next_member() in the oldest branches, I chose to back-patch that  
function into 9.4 and 9.3.  (This isn't the first time back-patches have  
needed that, and it exhausted my patience.)  I also chose to back-patch  
some test cases added by commits 71404af2a and 342a1ffa2 into 9.4 and 9.3,  
so that the 9.x versions of eval-plan-qual.spec are all the same.  
  
Andrew Gierth diagnosed the problem and contributed the added test cases,  
though the actual code changes are by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeSubplan.c
M src/include/executor/execExpr.h
M src/include/executor/nodeSubplan.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Move PartitionDispatchData struct definition to execPartition.c

commit   : 444455c2d9094c70f42706184064a9729906253e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 19:06:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 19:06:57 -0300    

Click here for diff

There's no reason to expose the struct definition, so don't.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix ALTER/TYPE on columns referenced by FKs in partitioned tables

commit   : 6009bad9134782babfc45c6bae6cfbca7f4899d0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 13:57:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 13:57:30 -0300    

Click here for diff

When ALTER TABLE ... SET DATA TYPE affects a column referenced by  
constraints and indexes, it drop those constraints and indexes and  
recreates them afterwards, so that the definitions match the new data  
type.  The original code did this by dropping one object at a time  
(commit 077db40fa1f3 of May 2004), which worked fine because the  
dependencies between the objects were pretty straightforward, and  
ordering the objects in a specific way was enough to make this work.  
However, when there are foreign key constraints in partitioned tables,  
the dependencies are no longer so straightforward, and we were getting  
errors when attempted:  
  ERROR:  cache lookup failed for constraint 16398  
  
This can be fixed by doing all the drops in one pass instead, using  
performMultipleDeletions (introduced by df18c51f2955 of Aug 2006).  With  
this change we can also remove the code to carefully order the list of  
objects to be deleted.  
  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAKcux6nWS_m+s=1Udk_U9B+QY7pA-Ac58qR5BdUfOyrwnWHDew@mail.gmail.com  

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

Don't allow LIMIT/OFFSET clause within sub-selects to be pushed to workers.

commit   : 830d7565902f8d1da5f07259982a6a54dc65e40d    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 14 Sep 2018 09:51:47 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 14 Sep 2018 09:51:47 +0530    

Click here for diff

Allowing sub-select containing LIMIT/OFFSET in workers can lead to  
inconsistent results at the top-level as there is no guarantee that the  
row order will be fully deterministic.  The fix is to prohibit pushing  
LIMIT/OFFSET within sub-selects to workers.  
  
Reported-by: Andrew Fletcher  
Bug: 15324  
Author: Amit Kapila  
Reviewed-by: Dilip Kumar  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planner.c
M src/include/optimizer/planner.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Message style improvements

commit   : a2afcdab8a1a90245cab3ed4b2d4bd0812d4955a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Sep 2018 23:35:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Sep 2018 23:35:43 +0200    

Click here for diff

Fix one untranslatable string concatenation in pg_rewind.  
  
Fix one message in pg_verify_checksums to use a style use elsewhere  
and avoid plural issues.  
  
Fix one gratuitous abbreviation in psql.  

M src/bin/pg_rewind/filemap.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/psql/help.c

Detect LLVM 7 without specifying binaries explicitly.

commit   : 99ba795d982efe2305d94573f2f4594bedaf6eab    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 10:41:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 10:41:39 -0700    

Click here for diff

Before this commit LLVM 7 was supported, but only if one explicitly  
provided LLVM_CONFIG= and CLANG= paths.  As LLVM 7 is the first  
version that includes our upstreamed debugging and profiling features,  
and as debian is planning to default to 7 due to wider architecture  
support, it seems good to support auto-detecting that version.  
  
Author: Christoph Berg  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, where LLVM was introduced  

M config/llvm.m4
M configure

Attach FPI to the first record after full_page_writes is turned on.

commit   : ff4220ead2c833fb36e9709ab2568c6ac43e9d3b    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 13 Sep 2018 15:38:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 13 Sep 2018 15:38:15 +0530    

Click here for diff

XLogInsert fails to attach a required FPI to the first record after  
full_page_writes is turned on by the last checkpoint.  This bug got  
introduced in 9.5 due to code rearrangement in commits 2c03216d83 and  
2076db2aea.  Fix it by ensuring that XLogInsertRecord performs a  
recomputation when the given record is generated with FPW as off but  
found that the flag has been turned on while actually inserting the  
record.  
  
Reported-by: Kyotaro Horiguchi  
Author: Kyotaro Horiguchi  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.5 where this problem was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Minor fixes for psql tab completion.

commit   : 12368f5e83e70e015a7352f52115579c135e82e5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Sep 2018 15:24:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Sep 2018 15:24:56 -0400    

Click here for diff

* Include partitioned tables in what's offered after ANALYZE.  
  
* Include toast_tuple_target in what's offered after ALTER TABLE ... SET|RESET.  
  
* Include HASH in what's offered after PARTITION BY.  
  
This is extracted from a larger patch; these bits seem like  
uncontroversial bug fixes for v11 features, so back-patch them into v11.  
  
Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

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

Repair bug in regexp split performance improvements.

commit   : f7d0343ead29cd3e44eccd1c8b7cc291b79209fe    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 12 Sep 2018 19:31:06 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 12 Sep 2018 19:31:06 +0100    

Click here for diff

Commit c8ea87e4b introduced a temporary conversion buffer for  
substrings extracted during regexp splits. Unfortunately the code that  
sized it was failing to ignore the effects of ignored degenerate  
regexp matches, so for regexp_split_* calls it could under-size the  
buffer in such cases.  
  
Fix, and add some regression test cases (though those will only catch  
the bug if run in a multibyte encoding).  
  
Backpatch to 9.3 as the faulty code was.  
  
Thanks to the PostGIS project, Regina Obe and Paul Ramsey for the  
report (via IRC) and assistance in analysis. Patch by me.  

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

ecpg: Change --version output to common style

commit   : b91ae36029df3db31a951ebda102ace8be5741ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Sep 2018 14:33:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Sep 2018 14:33:15 +0200    

Click here for diff

When we removed the ecpg-specific versions, we also removed the  
"(PostgreSQL)" from the --version output, which we show in other  
programs.  
  
Reported-by: Ioseph Kim <[email protected]>  

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

doc: adjust PG 11 release notes

commit   : 293010a68afd5b3a1f1e7621d5c89ba422c21d09    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 11 Sep 2018 17:01:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 11 Sep 2018 17:01:51 -0400    

Click here for diff

Fixes for channel binding, SQL procedures, and pg_trgm.  
  
Backpatch-through: 11  

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

Remove ruleutils.c's special case for BIT [VARYING] literals.

commit   : 224256f890c71b809c1a6b62b426fc8ceec7b0da    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Sep 2018 16:32:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Sep 2018 16:32:12 -0400    

Click here for diff

Up to now, get_const_expr() insisted on prefixing BIT and VARBIT  
literals with 'B'.  That's not really necessary, because we always  
append explicit-cast syntax to identify the constant's type.  
Moreover, it's subtly wrong for VARBIT, because the parser will  
interpret B'...' as '...'::"bit"; see make_const() which explicitly  
assigns type BITOID for a T_BitString literal.  So what had been  
a simple VARBIT literal is reconstructed as ('...'::"bit")::varbit,  
which is not the same thing, at least not before constant folding.  
This results in odd differences after dump/restore, as complained  
of by the patch submitter, and it could result in actual failures in  
partitioning or inheritance DDL operations (see commit 542320c2b,  
which repaired similar misbehaviors for some other data types).  
  
Fixing it is pretty easy: just remove the special case and let the  
default code path handle these types.  We could have kept the special  
case for BIT only, but there seems little point in that.  
  
Like the previous patch, I judge that back-patching this into stable  
branches wouldn't be a good idea.  However, it seems not quite too  
late for v11, so let's fix it there.  
  
Paul Guo, reviewed by Davy Machado and John Naylor, minor adjustments  
by me  
  
Discussion: https://postgr.es/m/CABQrizdTra=2JEqA6+Ms1D1k1Kqw+aiBBhC9TreuZRX2JzxLAA@mail.gmail.com  

M contrib/btree_gist/expected/bit.out
M contrib/btree_gist/expected/varbit.out
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/bit.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/bit.sql

Repair double-free in SP-GIST rescan (bug #15378)

commit   : e331d6712f0224160d2699591704ddcc3ef2d67b    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 11 Sep 2018 18:14:19 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 11 Sep 2018 18:14:19 +0100    

Click here for diff

spgrescan would first reset traversalCxt, and then traverse a  
potentially non-empty stack containing pointers to traversalValues  
which had been allocated in those contexts, freeing them a second  
time. This bug originates in commit ccd6eb49a where traversalValue was  
introduced.  
  
Repair by traversing the stack before the context reset; this isn't  
ideal, since it means doing retail pfree in a context that's about to  
be reset, but the freeing of a stack entry is also done in other  
places in the code during the scan so it's not worth trying to  
refactor it further. Regression test added.  
  
Backpatch to 9.6 where the problem was introduced.  
  
Per bug #15378; analysis and patch by me, originally from a report on  
IRC by user velix; see also PostGIS ticket #4174; review by Alexander  
Korotkov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgscan.c
M src/test/regress/expected/spgist.out
M src/test/regress/sql/spgist.sql

Use -Bsymbolic for shared libraries on HP-UX and Solaris.

commit   : e3aafe200125975022653eb3197bcf03f7744391    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Sep 2018 22:22:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Sep 2018 22:22:12 -0400    

Click here for diff

These platforms are also subject to the mis-linking problem addressed  
in commit e3d77ea6b.  It's not clear whether we could solve it with  
a solution equivalent to GNU ld's version scripts, but -Bsymbolic  
appears to fix it, so let's use that.  
  
Like the previous commit, back-patch as far as v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Prevent mis-linking of src/port and src/common functions on *BSD.

commit   : 6395ac14d99e4a5d9ee1b83dcc382a368e50240c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 15:16:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 15:16:51 -0400    

Click here for diff

On ELF-based platforms (and maybe others?) it's possible for a shared  
library, when dynamically loaded into the backend, to call the backend  
versions of src/port and src/common functions rather than the frontend  
versions that are actually linked into the shlib.  This is the cause  
of bug #15367 from Jeremy Evans, and is likely to lead to more problems  
in future; it's accidental that we've failed to notice any bad effects  
up to now.  
  
The recommended way to fix this on ELF-based platforms is to use a  
linker "version script" that makes the shlib's versions of the functions  
local.  (Apparently, -Bsymbolic would fix it as well, but with other  
side effects that we don't want.)  Doing so has the additional benefit  
that we can make sure the shlib only exposes the symbols that are meant  
to be part of its API, and not ones that are just for cross-file  
references within the shlib.  So we'd already been using a version  
script for libpq on popular platforms, but it's now apparent that it's  
necessary for correctness on every ELF-based platform.  
  
Hence, add appropriate logic to the openbsd, freebsd, and netbsd stanzas  
of Makefile.shlib; this is just a copy-and-paste from the linux stanza.  
There may be additional work to do if commit ed0cdf0e0 reveals that the  
problem exists elsewhere, but this is all that is known to be needed  
right now.  
  
Back-patch to v10 where SCRAM support came in.  The problem is ancient,  
but analysis suggests that there were no really severe consequences  
in older branches.  Hence, I won't take the risk of such a large change  
in the build process for older branches.  
  
In passing, remove a rather opaque comment about -Bsymbolic; I don't  
think it's very on-point about why we don't use that, if indeed that's  
what it's talking about at all.  
  
Patch by me; thanks to Andrew Gierth for helping to diagnose the problem,  
and for additional testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Fix past pd_upper write in ginRedoRecompress()

commit   : cc909ddbfb480928a781c21b1c142ccf1adb2fe5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 9 Sep 2018 21:19:29 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 9 Sep 2018 21:19:29 +0300    

Click here for diff

ginRedoRecompress() replays actions over compressed segments of posting list  
in-place.  However, it might lead to write past pg_upper, because intermediate  
state during playing the changes can take more space than both original state  
and final state.  This commit fixes that by refuse from in-place modification.  
Instead page tail is copied once modification is started, and then it's used  
as the source of original segments.  Backpatch to 9.4 where posting list  
compression was introduced.  
  
Reported-by: Sivasubramanian Ramasubramanian  
Discussion: https://postgr.es/m/1536091151804.6588%40amazon.com  
Author: Alexander Korotkov based on patch from and ideas by Sivasubramanian Ramasubramanian  
Review: Sivasubramanian Ramasubramanian  
Backpatch-through: 9.4  

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

Allow ENOENT in check_mode_recursive().

commit   : f7d745318b180634e8bb1734867caaf71b00b305    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 18:26:10 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 18:26:10 -0700    

Click here for diff

Buildfarm member tern failed src/bin/pg_ctl/t/001_start_stop.pl when a  
check_mode_recursive() call overlapped a server's startup-time deletion  
of pg_stat/global.stat.  Just warn.  Also, include errno in the message.  
Back-patch to v11, where check_mode_recursive() first appeared.  

M src/test/perl/TestLib.pm

Fix logical subscriber wait in test.

commit   : 475c1fb5a765da70a77f9f24454977a873d96dc4    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 16:20:50 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 16:20:50 -0700    

Click here for diff

Buildfarm members sungazer and tern revealed this deficit.  Back-patch  
to v10, like commit 4f10e7ea7b2231f453bb18b6e710ac333eaf121b, which  
introduced the test.  

M src/test/subscription/t/002_types.pl

Minor cleanup/future-proofing for pg_saslprep().

commit   : 86d226ae5a3607b8bbde2487f821b8f8807da1c8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Sep 2018 18:20:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Sep 2018 18:20:36 -0400    

Click here for diff

Ensure that pg_saslprep() initializes its output argument to NULL in  
all failure paths, and then remove the redundant initialization that  
some (not all) of its callers did.  This does not fix any live bug,  
but it reduces the odds of future bugs of omission.  
  
Also add a comment about why the existing failure-path coding is  
adequate.  
  
Back-patch so as to keep the function's API consistent across branches,  
again to forestall future bug introduction.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth-scram.c
M src/common/saslprep.c
M src/interfaces/libpq/fe-auth-scram.c

Save/restore SPI's global variables in SPI_connect() and SPI_finish().

commit   : 825f10fbda7a5d8a48d187b8193160e5e44e4011    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 20:09:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 20:09:57 -0400    

Click here for diff

This patch removes two sources of interference between nominally  
independent functions when one SPI-using function calls another,  
perhaps without knowing that it does so.  
  
Chapman Flack pointed out that xml.c's query_to_xml_internal() expects  
SPI_tuptable and SPI_processed to stay valid across datatype output  
function calls; but it's possible that such a call could involve  
re-entrant use of SPI.  It seems likely that there are similar hazards  
elsewhere, if not in the core code then in third-party SPI users.  
Previously SPI_finish() reset SPI's API globals to zeroes/nulls, which  
would typically make for a crash in such a situation.  Restoring them  
to the values they had at SPI_connect() seems like a considerably more  
useful behavior, and it still meets the design goal of not leaving any  
dangling pointers to tuple tables of the function being exited.  
  
Also, cause SPI_connect() to reset these variables to zeroes/nulls after  
saving them.  This prevents interference in the opposite direction: it's  
possible that a SPI-using function that's only ever been tested standalone  
contains assumptions that these variables start out as zeroes.  That was  
the case as long as you were the outermost SPI user, but not so much for  
an inner user.  Now it's consistent.  
  
Report and fix suggestion by Chapman Flack, actual patch by me.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/spi.c
M src/include/executor/spi_priv.h

Limit depth of forced recursion for CLOBBER_CACHE_RECURSIVELY.

commit   : 90fd3bfd17070d3c2467a45204ede17b70a15387    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:13:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:13:29 -0400    

Click here for diff

It's somewhat surprising that we got away with this before.  (Actually,  
since nobody tests this routinely AFAIK, it might've been broken for  
awhile.  But it's definitely broken in the wake of commit f868a8143.)  
It seems sufficient to limit the forced recursion to a small number  
of levels.  
  
Back-patch to all supported branches, like the preceding patch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix longstanding recursion hazard in sinval message processing.

commit   : 2569ca0dc8a28f0aa475c32ff122c439700f020a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:04:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:04:38 -0400    

Click here for diff

LockRelationOid and sibling routines supposed that, if our session already  
holds the lock they were asked to acquire, they could skip calling  
AcceptInvalidationMessages on the grounds that we must have already read  
any remote sinval messages issued against the relation being locked.  
This is normally true, but there's a critical special case where it's not:  
processing inside AcceptInvalidationMessages might attempt to access system  
relations, resulting in a recursive call to acquire a relation lock.  
  
Hence, if the outer call had acquired that same system catalog lock, we'd  
fall through, despite the possibility that there's an as-yet-unread sinval  
message for that system catalog.  This could, for example, result in  
failure to access a system catalog or index that had just been processed  
by VACUUM FULL.  This is the explanation for buildfarm failures we've been  
seeing intermittently for the past three months.  The bug is far older  
than that, but commits a54e1f158 et al added a new recursion case within  
AcceptInvalidationMessages that is apparently easier to hit than any  
previous case.  
  
To fix this, we must not skip calling AcceptInvalidationMessages until  
we have *finished* a call to it since acquiring a relation lock, not  
merely acquired the lock.  (There's already adequate logic inside  
AcceptInvalidationMessages to deal with being called recursively.)  
Fortunately, we can implement that at trivial cost, by adding a flag  
to LOCALLOCK hashtable entries that tracks whether we know we have  
completed such a call.  
  
There is an API hazard added by this patch for external callers of  
LockAcquire: if anything is testing for LOCKACQUIRE_ALREADY_HELD,  
it might be fooled by the new return code LOCKACQUIRE_ALREADY_CLEAR  
into thinking the lock wasn't already held.  This should be a fail-soft  
condition, though, unless something very bizarre is being done in  
response to the test.  
  
Also, I added an additional output argument to LockAcquireExtended,  
assuming that that probably isn't called by any outside code given  
the very limited usefulness of its additional functionality.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/include/storage/lock.h

Refactor installation of extension headers.

commit   : 094ffd68460a8ba905df7b4eae4e9c690dc6e06f    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 7 Sep 2018 13:51:30 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 7 Sep 2018 13:51:30 +0100    

Click here for diff

Commit be54b3777 failed on gmake 3.80 due to a chained conditional,  
which on closer examination could be removed entirely with some  
refactoring elsewhere for a net simplification and more robustness  
against empty expansions. Along the way, add some more comments.  
  
Also make explicit in the documentation and comments that built  
headers are not removed by 'make clean', since we don't typically want  
that for headers generated by a separate ./configure step, and it's  
much easier to add your own 'distclean' rule or use EXTRA_CLEAN than  
to try and override a deletion rule in pgxs.mk.  
  
Per buildfarm member prariedog and comments by Michael Paquier, though  
all the actual changes are my fault.  

M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk

Make contrib/unaccent's unaccent() function work when not in search path.

commit   : 23aad181f44741c2061ce5caceb307774ac14fb8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Sep 2018 10:49:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Sep 2018 10:49:45 -0400    

Click here for diff

Since the fixes for CVE-2018-1058, we've advised people to schema-qualify  
function references in order to fix failures in code that executes under  
a minimal search_path setting.  However, that's insufficient to make the  
single-argument form of unaccent() work, because it looks up the "unaccent"  
text search dictionary using the search path.  
  
The most expedient answer seems to be to remove the search_path dependency  
by making it look in the same schema that the unaccent() function itself  
is declared in.  This will definitely work for the normal usage of this  
function with the unaccent dictionary provided by the extension.  
It's barely possible that there are people who were relying on the  
search-path-dependent behavior to select other dictionaries with the same  
name; but if there are any such people at all, they can still get that  
behavior by writing unaccent('unaccent', ...), or possibly  
unaccent('unaccent'::text::regdictionary, ...) if the lookup has to be  
postponed to runtime.  
  
Per complaint from Gunnlaugur Thor Briem.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CAPs+M8LCex6d=DeneofdsoJVijaG59m9V0ggbb3pOH7hZO4+cQ@mail.gmail.com  

M contrib/unaccent/unaccent.c
M doc/src/sgml/unaccent.sgml

Fix the overrun in hash index metapage for smaller block sizes.

commit   : 834bce0a5293424d127ab72440b9eacc8841051f    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 6 Sep 2018 10:07:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 6 Sep 2018 10:07:18 +0530    

Click here for diff

The commit 620b49a1 changed the value of HASH_MAX_BITMAPS with the intent  
to allow many non-unique values in hash indexes without worrying to reach  
the limit of the number of overflow pages.  At that time, this didn't  
occur to us that it can overrun the block for smaller block sizes.  
  
Choose the value of HASH_MAX_BITMAPS based on BLCKSZ such that it gives  
the same answer as now for the cases where the overrun doesn't occur, and  
some other sufficiently-value for the cases where an overrun currently  
does occur.  This allows us not to change the behavior in any case that  
currently works, so there's really no reason for a HASH_VERSION bump.  
  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAA4eK1LtF4VmU4mx_+i72ff1MdNZ8XaJMGkt2HV8+uSWcn8t4A@mail.gmail.com  

M src/include/access/hash.h

Allow extensions to install built as well as unbuilt headers.

commit   : 235526a20a2efb199c4138c5d793260ce37d7231    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 5 Sep 2018 22:01:21 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 5 Sep 2018 22:01:21 +0100    

Click here for diff

Commit df163230b overlooked the case that an out-of-tree extension  
might need to build its header files (e.g. via ./configure). If it is  
also doing a VPATH build, the HEADERS_* rules in the original commit  
would then fail to find the files, since they would be looking only  
under $(srcdir) and not in the build directory.  
  
Fix by adding HEADERS_built and HEADERS_built_$(MODULE) which behave  
like DATA_built in that they look in the build dir rather than the  
source dir (and also make the files dependencies of the "all" target).  
  
No Windows support appears to be needed for this, since it is only  
relevant to out-of-tree builds (no support exists in Mkvcbuild.pm to  
build extension header files in any case).  

M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk

Remove no-longer-used variable.

commit   : c1ea31147248842743c3ba931f71b5a4a218cb58    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 14:29:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 14:29:58 -0400    

Click here for diff

Oversight in 2fbdf1b38.  Per buildfarm.  

M src/backend/commands/tablecmds.c

Make argument names of pg_get_object_address consistent, and fix docs.

commit   : 337bf254ae81a3c8426504f3bee04cd6c5eb8a59    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 13:47:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 13:47:16 -0400    

Click here for diff

pg_get_object_address and pg_identify_object_as_address are supposed  
to be inverses, but they disagreed as to the names of the arguments  
representing the textual form of an object address.  Moreover, the  
documented argument names didn't agree with reality at all, either  
for these functions or pg_identify_object.  
  
In HEAD and v11, I think we can get away with renaming the input  
arguments of pg_get_object_address to match the outputs of  
pg_identify_object_as_address.  In theory that might break queries  
using named-argument notation to call pg_get_object_address, but  
it seems really unlikely that anybody is doing that, or that they'd  
have much trouble adjusting if they were.  In older branches, we'll  
just live with the lack of consistency.  
  
Aside from fixing the documentation of these functions to match reality,  
I couldn't resist the temptation to do some copy-editing.  
  
Per complaint from Jean-Pierre Pelletier.  Back-patch to 9.5 where these  
functions were introduced.  (Before v11, this is a documentation change  
only.)  
  
Discussion: https://postgr.es/m/CANGqjDnWH8wsTY_GzDUxbt4i=y-85SJreZin4Hm8uOqv1vzRQA@mail.gmail.com  

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

Simplify partitioned table creation vs. relcache

commit   : 52ab02d593e9d83c7bff8b6853aba59242ce967a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Sep 2018 14:36:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Sep 2018 14:36:13 -0300    

Click here for diff

In the original code, we were storing the pg_inherits row for a  
partitioned table too early: enough that we had a hack for relcache to  
avoid falling flat on its face while reading such a partial entry.  If  
we finish the pg_class creation first and *then* store the pg_inherits  
entry, we don't need that hack.  
  
Also recognize that pg_class.relpartbound is not marked NOT NULL and  
therefore it's entirely possible to read null values, so having only  
Assert() protection isn't enough.  Change those to if/elog tests  
instead.  This qualifies as a robustness fix, so backpatch to pg11.  
  
In passing, remove one access that wasn't actually needed, and reword  
one message to be like all the others that check for the same thing.  
  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c

docs: improve AT TIME ZONE description

commit   : 838fd62cab520a5ae15fdab30d0f962070571bdb    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 4 Sep 2018 22:34:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 4 Sep 2018 22:34:07 -0400    

Click here for diff

The previous description was unclear.  Also add a third example, change  
use of time zone acronyms to more verbose descriptions, and add a  
mention that using 'time' with AT TIME ZONE uses the current time zone  
rules.  
  
Backpatch-through: 9.3  

M doc/src/sgml/func.sgml

Fully enforce uniqueness of constraint names.

commit   : fb466d7b5dbe73f318324cada80203522f46401f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Sep 2018 13:45:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Sep 2018 13:45:35 -0400    

Click here for diff

It's been true for a long time that we expect names of table and domain  
constraints to be unique among the constraints of that table or domain.  
However, the enforcement of that has been pretty haphazard, and it missed  
some corner cases such as creating a CHECK constraint and then an index  
constraint of the same name (as per recent report from AndrƩ HƤnsel).  
Also, due to the lack of an actual unique index enforcing this, duplicates  
could be created through race conditions.  
  
Moreover, the code that searches pg_constraint has been quite inconsistent  
about how to handle duplicate names if one did occur: some places checked  
and threw errors if there was more than one match, while others just  
processed the first match they came to.  
  
To fix, create a unique index on (conrelid, contypid, conname).  Since  
either conrelid or contypid is zero, this will separately enforce  
uniqueness of constraint names among constraints of any one table and any  
one domain.  (If we ever implement SQL assertions, and put them into this  
catalog, more thought might be needed.  But it'd be at least as reasonable  
to put them into a new catalog; having overloaded this one catalog with  
two kinds of constraints was a mistake already IMO.)  This index can replace  
the existing non-unique index on conrelid, though we need to keep the one  
on contypid for query performance reasons.  
  
Having done that, we can simplify the logic in various places that either  
coped with duplicates or neglected to, as well as potentially improve  
lookup performance when searching for a constraint by name.  
  
Also, as per our usual practice, install a preliminary check so that you  
get something more friendly than a unique-index violation report in the  
case complained of by AndrƩ.  And teach ChooseIndexName to avoid choosing  
autogenerated names that would draw such a failure.  
  
While it's not possible to make such a change in the back branches,  
it doesn't seem quite too late to put this into v11, so do so.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_constraint.h
M src/include/commands/defrem.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Prohibit pushing subqueries containing window function calculation to workers.

commit   : 2ce253cf57b1c3f8100a31f30647449d0b88fe24    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 10:26:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 10:26:06 +0530    

Click here for diff

Allowing window function calculation in workers leads to inconsistent  
results because if the input row ordering is not fully deterministic, the  
output of window functions might vary across workers.  The fix is to treat  
them as parallel-restricted.  
  
In the passing, improve the coding pattern in max_parallel_hazard_walker  
so that it has a chain of mutually-exclusive if ... else if ... else if  
... else if ... IsA tests.  
  
Reported-by: Marko Tiikkaja  
Bug: 15324  
Author: Amit Kapila  
Reviewed-by: Tom Lane  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/CAL9smLAnfPJCDUUG4ckX2iznj53V7VSMsYefzZieN93YxTNOcw@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

During the split, set checksum on an empty hash index page.

commit   : 16e7bcfac57fc21dd2124b39132c58971e41448a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 08:33:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 08:33:33 +0530    

Click here for diff

On a split, we allocate a new splitpoint's worth of bucket pages wherein  
we initialize the last page with zeros which is fine, but we forgot to set  
the checksum for that last page.  
  
We decided to back-patch this fix till 10 because we don't have an easy  
way to test it in prior versions.  Another reason is that the hash-index  
code is changed heavily in 10, so it is not advisable to push the fix  
without testing it in prior versions.  
  
Author: Amit Kapila  
Reviewed-by: Yugo Nagata  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  

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

Remove pg_constraint.conincluding

commit   : bd47c4a9d4ec55e26e841754ce62c23ca9008e87    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 3 Sep 2018 12:58:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 3 Sep 2018 12:58:42 -0300    

Click here for diff

This column was added in commit 8224de4f42cc ("Indexes with INCLUDE  
columns and their support in B-tree") to ease writing the ruleutils.c  
supporting code for that feature, but it turns out to be unnecessary --  
we can do the same thing with just one more syscache lookup.  
  
Even the documentation for the new column being removed in this commit  
is awkward.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_constraint.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/index_including.out
M src/test/regress/sql/index_including.sql

Fix memory leak in TRUNCATE decoding

commit   : 081cf78d12f17c97efc6199039bc83f059fffcf6    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 3 Sep 2018 02:10:24 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 3 Sep 2018 02:10:24 +0200    

Click here for diff

When decoding a TRUNCATE record, the relids array was being allocated in  
the main ReorderBuffer memory context, but not released with the change  
resulting in a memory leak.  
  
The array was also ignored when serializing/deserializing the change,  
assuming all the information is stored in the change itself.  So when  
spilling the change to disk, we've only we have serialized only the  
pointer to the relids array.  Thanks to never releasing the array,  
the pointer however remained valid even after loading the change back  
to memory, preventing an actual crash.  
  
This fixes both the memory leak and (de)serialization.  The relids array  
is still allocated in the main ReorderBuffer memory context (none of the  
existing ones seems like a good match, and adding an extra context seems  
like an overkill).  The allocation is wrapped in a new ReorderBuffer API  
functions, to keep the details within reorderbuffer.c, just like the  
other ReorderBufferGet methods do.  
  
Author: Tomas Vondra  
Discussion: https://www.postgresql.org/message-id/flat/66175a41-9342-2845-652f-1bd4c3ee50aa%402ndquadrant.com  
Backpatch: 11, where decoding of TRUNCATE was introduced  

M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/replication/reorderbuffer.h

Fix initial sync of slot parent directory when restoring status

commit   : 680f89e5613cc859356152ae65597c78f0cea4dd    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 2 Sep 2018 12:40:38 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 2 Sep 2018 12:40:38 -0700    

Click here for diff

At the beginning of recovery, information from replication slots is  
recovered from disk to memory.  In order to ensure the durability of the  
information, the status file as well as its parent directory are  
synced.  It happens that the sync on the parent directory was done  
directly using the status file path, which is logically incorrect, and  
the current code has been doing a sync on the same object twice in a  
row.  
  
Reported-by: Konstantin Knizhnik  
Diagnosed-by: Konstantin Knizhnik  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4-  

M src/backend/replication/slot.c

Doc: fix oversights in "Client/Server Character Set Conversions" table.

commit   : 3099eec7468f081d638be25475f2c5b43b7d1f88    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 16:02:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 16:02:47 -0400    

Click here for diff

This table claimed that JOHAB could be used as a server encoding, which  
was true originally but hasn't been true since 8.3.  It also lacked  
entries for EUC_JIS_2004 and SHIFT_JIS_2004.  
  
JOHAB problem noted by Lars Kanis, the others by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml

Avoid using potentially-under-aligned page buffers.

commit   : f5c93cf92223534df862ab7d8c698f05d5b38485    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 15:27:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 15:27:13 -0400    

Click here for diff

There's a project policy against using plain "char buf[BLCKSZ]" local  
or static variables as page buffers; preferred style is to palloc or  
malloc each buffer to ensure it is MAXALIGN'd.  However, that policy's  
been ignored in an increasing number of places.  We've apparently got  
away with it so far, probably because (a) relatively few people use  
platforms on which misalignment causes core dumps and/or (b) the  
variables chance to be sufficiently aligned anyway.  But this is not  
something to rely on.  Moreover, even if we don't get a core dump,  
we might be paying a lot of cycles for misaligned accesses.  
  
To fix, invent new union types PGAlignedBlock and PGAlignedXLogBlock  
that the compiler must allocate with sufficient alignment, and use  
those in place of plain char arrays.  
  
I used these types even for variables where there's no risk of a  
misaligned access, since ensuring proper alignment should make  
kernel data transfers faster.  I also changed some places where  
we had been palloc'ing short-lived buffers, for coding style  
uniformity and to save palloc/pfree overhead.  
  
Since this seems to be a live portability hazard (despite the lack  
of field reports), back-patch to all supported versions.  
  
Patch by me; thanks to Michael Paquier for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_standby/pg_standby.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/tablecmds.c
M src/backend/replication/walsender.c
M src/backend/storage/file/buffile.c
M src/backend/storage/freespace/freespace.c
M src/backend/utils/sort/logtape.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/c.h

Ignore server-side delays when enforcing wal_sender_timeout.

commit   : ee0ab275408f8fc10eedd7fb8c767cdbad0cb57b    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 31 Aug 2018 22:59:58 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 31 Aug 2018 22:59:58 -0700    

Click here for diff

Healthy clients of servers having poor I/O performance, such as  
buildfarm members hamster and tern, saw unexpected timeouts.  That  
disagreed with documentation.  This fix adds one gettimeofday() call  
whenever ProcessRepliesIfAny() finds no client reply messages.  
Back-patch to 9.4; the bug's symptom is rare and mild, and the code all  
moved between 9.3 and 9.4.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Fix 8a934d677 for libc++ and make more include order resistant.

commit   : 1f349aa7d9a6633e87db071390c73a39ac279ba4    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 Aug 2018 16:56:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 Aug 2018 16:56:11 -0700    

Click here for diff

The previous definition was used in C++ mode, which causes problems  
when using clang with libc++ (rather than libstdc++), due to bugs  
therein.  So just avoid in C++ mode.  
  
A second problem is that depending on include order and implicit  
includes the previous definition did not guarantee that the current  
hack was effective by the time isinf was used, fix that by forcing  
math.h to be included.  This can cause clang using builds, or gcc  
using ones with JIT enabled, to slow down noticably.  
  
It's likely that we at some point want a better solution for the  
performance problem, but while it's there it should better work.  
  
Reported-By: Steven Winfield  
Bug: #15270  
Discussion: https://postgr.es/m/[email protected]  
Author: Andres Freund  
Backpatch: 11, like the previous commit.  

M src/include/port.h

Fix psql's \dC command to annotate I/O conversion casts as such.

commit   : ed9c336b0f6bcf08e7b6bbe7080fdb63640a680e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 16:45:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 16:45:33 -0400    

Click here for diff

A cast declared WITH INOUT was described as '(binary coercible)',  
which seems pretty inaccurate; let's print '(with inout)' instead.  
Per complaint from Jean-Pierre Pelletier.  
  
This definitely seems like a bug fix, but given that it's been wrong  
since 8.4 and nobody complained before, I'm hesitant to back-patch a  
behavior change into stable branches.  It doesn't seem too late for  
v11 though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Ensure correct minimum consistent point on standbys

commit   : c34f8078aa354a9c352b6db488ca1d5aac39560c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 31 Aug 2018 11:03:55 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 31 Aug 2018 11:03:55 -0700    

Click here for diff

Startup process has improved its calculation of incorrect minimum  
consistent point in 8d68ee6, which ensures that all WAL available gets  
replayed when doing crash recovery, and has introduced an incorrect  
calculation of the minimum recovery point for non-startup processes,  
which can cause incorrect page references on a standby when for example  
the background writer flushed a couple of pages on-disk but was not  
updating the control file to let a subsequent crash recovery replay to  
where it should have.  
  
The only case where this has been reported to be a problem is when a  
standby needs to calculate the latest removed xid when replaying a btree  
deletion record, so one would need connections on a standby that happen  
just after recovery has thought it reached a consistent point.  Using a  
background worker which is started after the consistent point is reached  
would be the easiest way to get into problems if it connects to a  
database.  Having clients which attempt to connect periodically could  
also be a problem, but the odds of seeing this problem are much lower.  
  
The fix used is pretty simple, as the idea is to give access to the  
minimum recovery point written in the control file to non-startup  
processes so as they use a reference, while the startup process still  
initializes its own references of the minimum consistent point so as the  
original problem with incorrect page references happening post-promotion  
with a crash do not show up.  
  
Reported-by: Alexander Kukushkin  
Diagnosed-by: Alexander Kukushkin  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Alexander Kukushkin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

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

Code review for pg_verify_checksums.c.

commit   : d787af7badfe8c4c9afb7f0af9958a69b723a212    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 13:42:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 13:42:18 -0400    

Click here for diff

Use postgres_fe.h, since this is frontend code.  Pretend that we've heard  
of project style guidelines for, eg, #include order.  Use BlockNumber not  
int arithmetic for block numbers, to avoid misbehavior with relations  
exceeding 2^31 blocks.  Avoid an unnecessary strict-aliasing warning  
(per report from Michael Banck).  Const-ify assorted stuff.  Avoid  
scribbling on the output of readdir() -- perhaps that's safe in practice,  
but POSIX forbids it, and this code has so far earned exactly zero  
credibility portability-wise.  Editorialize on an ambiguously-worded  
message.  
  
I did not touch the problem of the "buf" local variable being possibly  
insufficiently aligned; that's not specific to this code, and seems like  
it should be fixed as part of a different, larger patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Enforce cube dimension limit in all cube construction functions

commit   : 36343e59b51165da542943d2043878737fbe910b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:18:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:18:53 +0300    

Click here for diff

contrib/cube has a limit to 100 dimensions for cube datatype.  However, it's  
not enforced everywhere, and one can actually construct cube with more than  
100 dimensions having then trouble with dump/restore.  This commit add checks  
for dimensions limit in all functions responsible for cube construction.  
Backpatch to all supported versions.  
  
Reported-by: Andrew Gierth  
Discussion: https://postgr.es/m/87va7uybt4.fsf%40news-spur.riddles.org.uk  
Author: Andrey Borodin with small additions by me  
Review: Tom Lane  
Backpatch-through: 9.3  

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

Split contrib/cube platform-depended checks into separate test

commit   : 1668186eb37851df41c9ff4b9ba9b4f71ce4f348    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:09:25 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:09:25 +0300    

Click here for diff

We're currently maintaining two outputs for cube regression test.  But that  
appears to be unsuitable, because these outputs are different in out few checks  
involving scientific notation.  So, split checks involving scientific notation  
into separate test, making contrib/cube easier to maintain.  Backpatch to all  
supported versions in order to make further backpatching easier.  
  
Discussion: https://postgr.es/m/CAPpHfdvJgWjxHsJTtT%2Bo1tz3OR8EFHcLQjhp-d3%2BUcmJLh-fQA%40mail.gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 9.3  

M contrib/cube/Makefile
M contrib/cube/expected/cube.out
D contrib/cube/expected/cube_2.out
A contrib/cube/expected/cube_sci.out
A contrib/cube/expected/cube_sci_1.out
M contrib/cube/sql/cube.sql
A contrib/cube/sql/cube_sci.sql

Make checksum_impl.h safe to compile with -fstrict-aliasing.

commit   : 9daff2fe69dcfaf29c7901b9e6bad285778a45c0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 12:26:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 12:26:20 -0400    

Click here for diff

In general, Postgres requires -fno-strict-aliasing with compilers that  
implement C99 strict aliasing rules.  There's little hope of getting  
rid of that overall.  But it seems like it would be a good idea if  
storage/checksum_impl.h in particular didn't depend on it, because  
that header is explicitly intended to be included by external programs.  
We don't have a lot of control over the compiler switches that an  
external program might use, as shown by Michael Banck's report of  
failure in a privately-modified version of pg_verify_checksums.  
  
Hence, switch to using a union in place of willy-nilly pointer casting  
inside this file.  I think this makes the code a bit more readable  
anyway.  
  
checksum_impl.h hasn't changed since it was introduced in 9.3,  
so back-patch all the way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/checksum_impl.h

Disable support for partitionwise joins in problematic cases.

commit   : 940487956ede2a6d0fb98b0b92cbf1f4656baaf0    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 20:47:17 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 20:47:17 +0900    

Click here for diff

Commit f49842d, which added support for partitionwise joins, built the  
child's tlist by applying adjust_appendrel_attrs() to the parent's.  So in  
the case where the parent's included a whole-row Var for the parent, the  
child's contained a ConvertRowtypeExpr.  To cope with that, that commit  
added code to the planner, such as setrefs.c, but some code paths still  
assumed that the tlist for a scan (or join) rel would only include Vars  
and PlaceHolderVars, which was true before that commit, causing errors:  
  
* When creating an explicit sort node for an input path for a mergejoin  
  path for a child join, prepare_sort_from_pathkeys() threw the 'could not  
  find pathkey item to sort' error.  
* When deparsing a relation participating in a pushed down child join as a  
  subquery in contrib/postgres_fdw, get_relation_column_alias_ids() threw  
  the 'unexpected expression in subquery output' error.  
* When performing set_plan_references() on a local join plan generated by  
  contrib/postgres_fdw for EvalPlanQual support for a pushed down child  
  join, fix_join_expr() threw the 'variable not found in subplan target  
  lists' error.  
  
To fix these, two approaches have been proposed: one by Ashutosh Bapat and  
one by me.  While the former keeps building the child's tlist with a  
ConvertRowtypeExpr, the latter builds it with a whole-row Var for the  
child not to violate the planner assumption, and tries to fix it up later,  
But both approaches need more work, so refuse to generate partitionwise  
join paths when whole-row Vars are involved, instead.  We don't need to  
handle ConvertRowtypeExprs in the child's tlists for now, so this commit  
also removes the changes to the planner.  
  
Previously, partitionwise join computed attr_needed data for each child  
separately, and built the child join's tlist using that data, which also  
required an extra step for adding PlaceHolderVars to that tlist, but it  
would be more efficient to build it from the parent join's tlist through  
the adjust_appendrel_attrs() transformation.  So this commit builds that  
list that way, and simplifies build_joinrel_tlist() and placeholder.c as  
well as part of set_append_rel_size() to basically what they were before  
partitionwise join went in.  
  
Back-patch to PG11 where partitionwise join was introduced.  
  
Report by Rajkumar Raghuwanshi.  Analysis by Ashutosh Bapat, who also  
provided some of regression tests.  Patch by me, reviewed by Robert Haas.  
  
Discussion: https://postgr.es/m/CAKcux6ktu-8tefLWtQuuZBYFaZA83vUzuRd7c1YHC-yEWyYFpg@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_aggregate.sql
M src/test/regress/sql/partition_join.sql

Fix pg_verify_checksums on Windows.

commit   : 762a16572bb5d9be6c9c53c9ecd29288da213d02    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 31 Aug 2018 15:45:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 31 Aug 2018 15:45:09 +0530    

Click here for diff

To verify the checksums, we open the file in text mode which doesn't work  
on Windows as WIN32 treats Control-Z as EOF in files opened in text mode.  
This leads to "short read of block .." error in some cases.  
  
Fix it by opening the files in the binary mode.  
  
Author: Amit Kapila  
Reviewed-by: Magnus Hagander  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAA4eK1+LOnzod+h85FGmyjWzXKy-XV1FYwEyP-Tky2WpD5cxwA@mail.gmail.com  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Remove extra word from src/backend/optimizer/README

commit   : 40e981391395ae93aadfaf08cd343af65cc6252b    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 16:42:30 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 16:42:30 +0900    

Click here for diff

M src/backend/optimizer/README

pg_verify_checksums: rename -d to --verbose

commit   : a840a8ac7b8ab5f8cb86627779d7b1250cdaca8d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 06:31:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 06:31:05 -0300    

Click here for diff

Using -d is odd, because we normally reserve that for a database  
argument, so rename it to -v and add long version --verbose.  
  
Also, reduce it to emit one line per file checked rather than one line  
per block.  
  
Per a complaint from Michael Banck.  
  
Author: Yugo Nagata <[email protected]>  
Reviewed-by: Michael Banck <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Mention change of width of values generated by SERIAL sequences

commit   : c731ec455a234bb0b6fd736898d9dddf3e8d517f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 05:39:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 05:39:56 -0300    

Click here for diff

This changed during pg10 development, but had not been documented.  
  
Co-authored-by: Jonathan S. Katz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix IndexInfo comments.

commit   : c1c1bfc500a09eacf90f7d006e645714f0383f98    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Aug 2018 09:08:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Aug 2018 09:08:33 +0300    

Click here for diff

Recently, ii_KeyAttrNumbers was renamed to ii_IndexAttrNumbers, and ii_Am  
field was added, but the comments were not updated.  
  
Author: Yugo Nagata  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/execnodes.h

Stop bgworkers during fast shutdown with postmaster in startup phase

commit   : 35622f7d3210f251c507e77730a3f18246629a95    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 Aug 2018 17:10:13 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 Aug 2018 17:10:13 -0700    

Click here for diff

When a postmaster gets into its phase PM_STARTUP, it would start  
background workers using BgWorkerStart_PostmasterStart mode immediately,  
which would cause problems for a fast shutdown as the postmaster forgets  
to send SIGTERM to already-started background workers.  With smart and  
immediate shutdowns, this correctly happened, and fast shutdown is the  
only mode missing the shot.  
  
Author: Alexander Kukushkin  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAFh8B=mvnD8+DZUfzpi50DoaDfZRDfd7S=gwj5vU9GYn8UvHkA@mail.gmail.com  
Backpatch-through: 9.5  

M src/backend/postmaster/postmaster.c

Make pg_restore's identify_locking_dependencies() more bulletproof.

commit   : 49841edcc6440ccfe8cab2a2f478edadc9a0b266    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:46:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:46:59 -0400    

Click here for diff

This function had a blacklist of dump object types that it believed  
needed exclusive lock ... but we hadn't maintained that, so that it  
was missing ROW SECURITY, POLICY, and INDEX ATTACH items, all of  
which need (or should be treated as needing) exclusive lock.  
  
Since the same oversight seems likely in future, let's reverse the  
sense of the test so that the code has a whitelist of safe object  
types; better to wrongly assume a command can't be run in parallel  
than the opposite.  Currently the only POST_DATA object type that's  
safe is CREATE INDEX ... and that list hasn't changed in a long time.  
  
Back-patch to 9.5 where RLS came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Code review for pg_dump's handling of ALTER INDEX ATTACH PARTITION.

commit   : 18f6258e5ee8ea8d9c06bd58655cf8c6e4f1016f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:33:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:33:04 -0400    

Click here for diff

Ensure the TOC entry is marked with the correct schema, so that its  
name is as unique as the index's is.  
  
Fix the dependencies: we want dependencies from this TOC entry to the  
two indexes it depends on, and we don't care (at least not for this  
purpose) what order the indexes are created in.  Also, add dependencies  
on the indexes' underlying tables.  Those might seem pointless given  
the index dependencies, but they are helpful to cue parallel restore  
to avoid running the ATTACH PARTITION in parallel with other DDL on  
the same tables.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Include contrib modules in the temp installation even without REGRESS.

commit   : 8ede2691d65e4c0aa1ae23453b5bed63f9a36254    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 17:26:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 17:26:09 -0400    

Click here for diff

Now that we have TAP tests, a contrib module may have something useful  
to do in "make check" even if it has no pg_regress-style regression  
scripts, and hence no REGRESS setting.  But the TAP tests will fail,  
or else test the wrong installed files, unless we install the contrib  
module into the temp installation.  So move the bit about adding to  
EXTRA_INSTALL so that it applies regardless.  
  
We might want this in back branches in future, but for the moment  
I only risked adding it to v11.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/makefiles/pgxs.mk

postgres_fdw: don't push ORDER BY with no vars (bug #15352)

commit   : 8bc6a301b21cc189f5141c45be93938215e21fb7    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 14:43:51 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 14:43:51 +0100    

Click here for diff

Commit aa09cd242 changed a condition in find_em_expr_for_rel from  
being a bms_equal comparison of relids to bms_is_subset, in order to  
support order by clauses on foreign joins. But this also allows  
through the degenerate case of expressions with no Vars at all (and  
hence empty relids), including integer constants which will be parsed  
unexpectedly on the remote (viz. "ERROR: ORDER BY position 0 is not in  
select list" as in the bug report).  
  
Repair by adding an additional !bms_is_empty test.  
  
Backpatch through to 9.6 where the aforementioned change was made.  
  
Per bug #15352 from Maksym Boguk; analysis and patch by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

Avoid quadratic slowdown in regexp match/split functions.

commit   : bc552b322fd954f8d87aef850b64e0d9ed376cfa    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 09:52:25 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 09:52:25 +0100    

Click here for diff

regexp_matches, regexp_split_to_table and regexp_split_to_array all  
work by compiling a list of match positions as character offsets (NOT  
byte positions) in the source string.  
  
Formerly, they then used text_substr to extract the matched text; but  
in a multi-byte encoding, that counts the characters in the string,  
and the characters needed to reach the starting byte position, on  
every call. Accordingly, the performance degraded as the product of  
the input string length and the number of match positions, such that  
splitting a string of a few hundred kbytes could take many minutes.  
  
Repair by keeping the wide-character copy of the input string  
available (only in the case where encoding_max_length is not 1) after  
performing the match operation, and extracting substrings from that  
instead. This reduces the complexity to being linear in the number of  
result bytes, discounting the actual regexp match itself (which is not  
affected by this patch).  
  
In passing, remove cleanup using retail pfree() which was obsoleted by  
commit ff428cded (Feb 2008) which made cleanup of SRF multi-call  
contexts automatic. Also increase (to ~134 million) the maximum number  
of matches and provide an error message when it is reached.  
  
Backpatch all the way because this has been wrong forever.  
  
Analysis and patch by me; review by Kaiting Chen.  
  
Discussion: https://postgr.es/m/[email protected]  
  
see also https://postgr.es/m/[email protected]  

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

pg_verify_checksums: Message style improvements and NLS support

commit   : da793baca29fa83e3fb1eb09d2ef9aa863a02f7a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Aug 2018 11:49:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Aug 2018 11:49:11 +0200    

Click here for diff

The source code was already set up for NLS support, so just a nls.mk  
file needed to be added.  Also, fix the old problem of putting the int64  
format specifier right into the string, which breaks NLS.  

A src/bin/pg_verify_checksums/nls.mk
M src/bin/pg_verify_checksums/pg_verify_checksums.c

Fix snapshot leak warning for some procedures

commit   : 2657d4ea66c775c3334181722115be2d6128c5cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 15:13:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 15:13:48 +0200    

Click here for diff

The problem arises with the combination of CALL with output parameters  
and doing a COMMIT inside the procedure.  When a CALL has output  
parameters, the portal uses the strategy PORTAL_UTIL_SELECT instead of  
PORTAL_MULTI_QUERY.  Using PORTAL_UTIL_SELECT causes the portal's  
snapshot to be registered with the current resource  
owner (portal->holdSnapshot); see  
9ee1cf04ab6bcefe03a11837b53f29ca9dc24c7a for the reason.  
  
Normally, PortalDrop() unregisters the snapshot.  If not, then  
ResourceOwnerRelease() will print a warning about a snapshot leak on  
transaction commit.  A transaction commit normally drops all  
portals (PreCommit_Portals()), except the active portal.  So in case of  
the active portal, we need to manually release the snapshot to avoid the  
warning.  
  
Reported-by: Prabhat Sahu <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M src/backend/utils/mmgr/portalmem.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Fix missing dependency for pg_dump's ENABLE ROW LEVEL SECURITY items.

commit   : c5e235ff8ad0f4907a736a6440dc4be6f939e65c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Aug 2018 15:11:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Aug 2018 15:11:12 -0400    

Click here for diff

The archive should show a dependency on the item's table, but it failed  
to include one.  This could cause failures in parallel restore due to  
emitting ALTER TABLE ... ENABLE ROW LEVEL SECURITY before restoring  
the table's data.  In practice the odds of a problem seem low, since  
you would typically need to have set FORCE ROW LEVEL SECURITY as well,  
and you'd also need a very high --jobs count to have any chance of this  
happening.  That probably explains the lack of field reports.  
  
Still, it's a bug, so back-patch to 9.5 where RLS was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Fix typos.

commit   : 9ca2207990002a2fd594fd7f9776d9d91acba189    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 27 Aug 2018 09:32:59 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 27 Aug 2018 09:32:59 +1200    

Click here for diff

Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f8du35u5DprpykWvgNEScxapbWYJdHq%2Bz06Wj3Y2KFPbw%40mail.gmail.com  

M src/backend/partitioning/partprune.c
M src/backend/statistics/dependencies.c
M src/backend/utils/adt/geo_spgist.c

Make syslogger more robust against failures in opening CSV log files.

commit   : f8fc5f5f50dbabec866dee79cd739bb3f68052a1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Aug 2018 14:21:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Aug 2018 14:21:55 -0400    

Click here for diff

The previous coding figured it'd be good enough to postpone opening  
the first CSV log file until we got a message we needed to write there.  
This is unsafe, though, because if the open fails we end up in infinite  
recursion trying to report the failure.  Instead make the CSV log file  
management code look as nearly as possible like the longstanding logic  
for the stderr log file.  In particular, open it immediately at postmaster  
startup (if enabled), or when we get a SIGHUP in which we find that  
log_destination has been changed to enable CSV logging.  
  
It seems OK to fail if a postmaster-start-time open attempt fails, as  
we've long done for the stderr log file.  But we can't die if we fail  
to open a CSV log file during SIGHUP, so we're still left with a problem.  
In that case, write any output meant for the CSV log file to the stderr  
log file.  (This will also cover race-condition cases in which backends  
send CSV log data before or after we have the CSV log file open.)  
  
This patch also fixes an ancient oversight that, if CSV logging was  
turned off during a SIGHUP, we never actually closed the last CSV  
log file.  
  
In passing, remember to reset whereToSendOutput = DestNone during syslogger  
start, since (unlike all other postmaster children) it's forked before the  
postmaster has done that.  This made for a platform-dependent difference  
in error reporting behavior between the syslogger and other children:  
except on Windows, it'd report problems to the original postmaster stderr  
as well as the normal error log file(s).  It's barely possible that that  
was intentional at some point; but it doesn't seem likely to be desirable  
in production, and the platform dependency definitely isn't desirable.  
  
Per report from Alexander Kukushkin.  It's been like this for a long time,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAFh8B==iLUD_gqC-dAENS0V+kVrCeGiKujtKqSQ7++S-caaChw@mail.gmail.com  

M src/backend/postmaster/syslogger.c

doc: "Latest checkpoint location" will not match in pg_upgrade

commit   : 231cf30e984b1501cbe640f567c08919a195d9d1    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:35:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:35:14 -0400    

Click here for diff

Mention that "Latest checkpoint location" will not match in pg_upgrade  
if the standby server is still running during the upgrade, which is  
possible.  "Match" text first appeared in PG 9.5.  
  
Reported-by: Paul Bonaud  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

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

commit   : 3c712c580e63a983081758059607ca1ee4bc4b6b    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:01:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:01:24 -0400    

Click here for diff

Reported-by: Ashutosh Sharma  
  
Discussion: https://postgr.es/m/CAE9k0PnhnL6MNDLuvkk8USzOa_DpzDzFQPAM_uaGuXbh9HMKYw@mail.gmail.com  
  
Author: Ashutosh Sharma  
  
Backpatch-through: 9.3  

M doc/src/sgml/information_schema.sgml

docs: Clarify pg_ctl initdb option text to match options proto.

commit   : 04d36cf44bcc14c649037470e72fb990e794e212    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 12:01:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 12:01:53 -0400    

Click here for diff

The options string appeared in PG 10.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

docs: clarify plpython SD and GD dictionary behavior

commit   : 2c852e3e53c8e64b84f518ee2ab04509c3f29b95    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 11:52:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 11:52:29 -0400    

Click here for diff

Reported-by: Adam Bielański  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/plpython.sgml

LLVMJIT: LLVMGetHostCPUFeatures now is upstream, use LLMV version if available.

commit   : 24f127b0042e6bd70e3076cfe0cf13e3bc481037    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Aug 2018 10:20:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Aug 2018 10:20:55 -0700    

Click here for diff

Noticed thanks to buildfarm animal seawasp.  
  
Author: Andres Freund  
Backpatch: v11-, where LLVM based JIT compliation was introduced.  

M config/llvm.m4
M configure
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/include/jit/llvmjit.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Suppress uninitialized-variable warning in new SCRAM code.

commit   : 7ed1db3f4625c4cb873a21c380913433820d50ce    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Aug 2018 10:51:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Aug 2018 10:51:10 -0400    

Click here for diff

While we generally don't sweat too much about "may be used uninitialized"  
warnings from older compilers, I noticed that there's a fair number of  
buildfarm animals that are producing such a warning *only* for this  
variable.  So it seems worth silencing.  

M src/backend/libpq/auth.c

Fix lexing of standard multi-character operators in edge cases.

commit   : 5b4555f90c08dd0d31572b22f5b2affdc4304b69    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 18:29:18 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 18:29:18 +0100    

Click here for diff

Commits c6b3c939b (which fixed the precedence of >=, <=, <> operators)  
and 865f14a2d (which added support for the standard => notation for  
named arguments) created a class of lexer tokens which look like  
multi-character operators but which have their own token IDs distinct  
from Op. However, longest-match rules meant that following any of  
these tokens with another operator character, as in (1<>-1), would  
cause them to be incorrectly returned as Op.  
  
The error here isn't immediately obvious, because the parser would  
usually still find the correct operator via the Op token, but there  
were more subtle problems:  
  
1. If immediately followed by a comment or +-, >= <= <> would be given  
   the old precedence of Op rather than the correct new precedence;  
  
2. If followed by a comment, != would be returned as Op rather than as  
   NOT_EQUAL, causing it not to be found at all;  
  
3. If followed by a comment or +-, the => token for named arguments  
   would be lexed as Op, causing the argument to be mis-parsed as a  
   simple expression, usually causing an error.  
  
Fix by explicitly checking for the operators in the {operator} code  
block in addition to all the existing special cases there.  
  
Backpatch to 9.5 where the problem was introduced.  
  
Analysis and patch by me; review by Tom Lane.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/polymorphism.sql

Reduce an unnecessary O(N^3) loop in lexer.

commit   : 0b42bd459af0532c6894d7699747986eaf4e86b5    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 20:01:03 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 20:01:03 +0100    

Click here for diff

The lexer's handling of operators contained an O(N^3) hazard when  
dealing with long strings of + or - characters; it seems hard to  
prevent this case from being O(N^2), but the additional N multiplier  
was not needed.  
  
Backpatch all the way since this has been there since 7.x, and it  
presents at least a mild hazard in that trying to do Bind, PREPARE or  
EXPLAIN on a hostile query could take excessive time (without  
honouring cancels or timeouts) even if the query was never executed.  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l

In libpq, don't look up all the hostnames at once.

commit   : c781a066ea4f0de0dc46e953ba55e10943199d6d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Aug 2018 16:39:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Aug 2018 16:39:19 -0400    

Click here for diff

Historically, we looked up the target hostname in connectDBStart, so that  
PQconnectPoll did not need to do DNS name resolution.  The patches that  
added multiple-target-host support to libpq preserved this division of  
labor; but it's really nonsensical now, because it means that if any one  
of the target hosts fails to resolve in DNS, the connection fails.  That  
negates the no-single-point-of-failure goal of the feature.  Additionally,  
DNS lookups aren't exactly cheap, but the code did them all even if the  
first connection attempt succeeds.  
  
Hence, rearrange so that PQconnectPoll does the lookups, and only looks  
up a hostname when it's time to try that host.  This does mean that  
PQconnectPoll could block on a DNS lookup --- but if you wanted to avoid  
that, you should be using hostaddr, as the documentation has always  
specified.  It seems fairly unlikely that any applications would really  
care whether the lookup occurs inside PQconnectStart or PQconnectPoll.  
  
In addition to calling out that fact explicitly, do some other minor  
wordsmithing in the docs around the multiple-target-host feature.  
  
Since this seems like a bug in the multiple-target-host feature,  
backpatch to v10 where that was introduced.  In the back branches,  
avoid moving any existing fields of struct pg_conn, just in case  
any third-party code is looking into that struct.  
  
Tom Lane, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Copy-editing of pg_verify_checksums help and ref page

commit   : 9126b4ee1c59ef07c55227b55c45a8d4bc6590d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 20:32:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 20:32:56 +0200    

Click here for diff

Reformat synopsis, put options into better order, make the desciption  
line a bit shorter, and put more details into the description.  

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

PL/pgSQL: Extend test case

commit   : ca02434a0b86e7dbc5b790f1a4d6b782ca8f4916    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 17:20:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 17:20:47 +0200    

Click here for diff

This test was supposed to check the interaction of INOUT and default  
parameters in a procedure call, but it only checked the case where the  
parameter was not supplied.  Now it also checks the case where the  
parameter was supplied.  It was already working correctly, so no code  
changes required.  

M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Return type of txid_status is text, not txid_status

commit   : c2b5d177182a96aa0f9926c3bee2598253918700    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 23 Aug 2018 11:40:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 23 Aug 2018 11:40:30 -0300    

Click here for diff

Thinko in commit 857ee8e39.  
  
Discovered-by: Gianni Ciolli  

M doc/src/sgml/func.sgml

doc: Clarify some wording in PL/pgSQL about transactions

commit   : 17df2a8b3946895c78f4ca088804341172ef27ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 15:42:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 15:42:22 +0200    

Click here for diff

Some text was still claiming that committing transactions was not  
possible in PL/pgSQL.  

M doc/src/sgml/plpgsql.sgml

Change PROCEDURE to FUNCTION in CREATE TRIGGER syntax

commit   : e0dc839e72d43e6c299deca892a8209e11dd88f6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 23:08:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 23:08:34 +0200    

Click here for diff

Since procedures are now a different thing from functions, change the  
CREATE TRIGGER and CREATE EVENT TRIGGER syntax to use FUNCTION in the  
clause that specifies the function.  PROCEDURE is still accepted for  
compatibility.  
  
pg_dump and ruleutils.c output is not changed yet, because that would  
require a change in information_schema.sql and thus a catversion change.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/tcn.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/trigger.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Change PROCEDURE to FUNCTION in CREATE OPERATOR syntax

commit   : fd4417e8ac46ea4cb079ed53f849dc48199506d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 18:05:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 18:05:46 +0200    

Click here for diff

Since procedures are now a different thing from functions, change the  
CREATE OPERATOR syntax to use FUNCTION in the clause that specifies the  
function.  PROCEDURE is still accepted for compatibility.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/xoper.sgml
M src/backend/commands/operatorcmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/create_operator.out
M src/test/regress/sql/create_operator.sql

doc: Update uses of the word "procedure"

commit   : b7b16605db8804161097f80df0fef703a0d19b61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 17:01:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 17:01:39 +0200    

Click here for diff

Historically, the term procedure was used as a synonym for function in  
Postgres/PostgreSQL.  Now we have procedures as separate objects from  
functions, so we need to clean up the documentation to not mix those  
terms.  
  
In particular, mentions of "trigger procedures" are changed to "trigger  
functions", and access method "support procedures" are changed to  
"support functions".  (The latter already used FUNCTION in the SQL  
syntax anyway.)  Also, the terminology in the SPI chapter has been  
cleaned up.  
  
A few tests, examples, and code comments are also adjusted to be  
consistent with documentation changes, but not everything.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xplang.sgml
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/commands/opclasscmds.c
M src/bin/psql/describe.c
M src/include/access/hash.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/create_operator.out
M src/test/regress/sql/create_operator.sql

Do not dump identity sequences with excluded parent table

commit   : 4ed59e02f5aa97618bb33355dc3accbcc2d5ace1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Aug 2018 14:22:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Aug 2018 14:22:39 +0900    

Click here for diff

This commit prevents a crash of pg_dump caused by the exclusion of a  
table which has identity columns, as the table would be correctly  
excluded but not its identity sequence.  In order to fix that, identity  
sequences are excluded if the parent table is defined as such.  Knowing  
about such sequences has no meaning without their parent table anyway.  
  
Reported-by: Andy Abelisto  
Author: David Rowley  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_dump/pg_dump.c

Fix typo

commit   : 561a5ab7514cd38fa7433d2214ce308481b10044    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:16:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:16:10 -0300    

Click here for diff

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

fix typo

commit   : 5065596e510f899122c1189de23af56c4953e2e0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:03:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:03:35 -0300    

Click here for diff

M src/backend/access/hash/README

Fix typo

commit   : 69183651118e39512f37e9ca246b6bf4c648bb63    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:00:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:00:54 -0300    

Click here for diff

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

Fix set of NLS translation issues

commit   : 3ef153c7157fd679c0acc20433c99d109b16222b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 15:17:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 15:17:25 +0900    

Click here for diff

While monitoring the code, a couple of issues related to string  
translation has showed up:  
- Some routines for auto-updatable views return an error string, which  
sometimes missed the shot.  A comment regarding string translation is  
added for each routine to help with future features.  
- GSSAPI authentication missed two translations.  
- vacuumdb handles non-translated strings.  
  
Reported-by: Kyotaro Horiguchi  
Author: Kyotaro Horiguchi  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/libpq/auth.c
M src/backend/rewrite/rewriteHandler.c
M src/bin/scripts/vacuumdb.c

Fix typo in description of enable_parallel_hash

commit   : 87c596cda6d7c79266cde44a1e9fc8ea1b8acefa    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 12:13:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 12:13:16 +0900    

Click here for diff

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

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

Clarify comment about assignment and reset of temp namespace ID in MyProc

commit   : 9fc9933695af4e233c2da704be4ad5c681cf7104    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 08:37:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 08:37:01 +0900    

Click here for diff

The new wording comes from Ɓlvaro, which I modified a bit.  
  
Reported-by: Andres Freund, Ɓlvaro Herrera  
Author: Ɓlvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/catalog/namespace.c

MSVC: Finish clean.bat tmp_check coverage.

commit   : 8fb9aa08742038765b94a8be614a9eb0908f825d    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    

Click here for diff

Use wildcards, so one can add a TAP test suite without updating this  
file.  Back-patch to v11, which omitted multiple new suites.  

M src/tools/msvc/clean.bat

MSVC: Remove any tmp_check directory before running a TAP test suite.

commit   : 4cd8479369ee3d366a8014593e6a3405eb9952a9    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    

Click here for diff

Back-patch to v11, where commit 90627cf98a8e7d0531789391fd798c9bfcc3bc1a  
made the GNU make build system do likewise.  Without this, when a  
typical PostgresNode-using test failed, subsequent runs bailed out with  
a "File exists" error.  

M src/tools/msvc/vcregress.pl

Improve error messages for CREATE OR REPLACE PROCEDURE

commit   : 49c1a4da641d52effb403bf79798975975b725a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Aug 2018 20:39:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Aug 2018 20:39:26 +0200    

Click here for diff

Change the hint to recommend DROP PROCEDURE instead of FUNCTION.  Also  
make the error message when changing the return type more specific to  
the case of procedures.  
  
Reported-by: Jeremy Evans <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/catalog/pg_proc.c

Ensure schema qualification in pg_restore DISABLE/ENABLE TRIGGER commands.

commit   : d73093c4ffefebadd25ea855bd8745f4fcb4462a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Aug 2018 17:12:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Aug 2018 17:12:21 -0400    

Click here for diff

Previously, this code blindly followed the common coding pattern of  
passing PQserverVersion(AH->connection) as the server-version parameter  
of fmtQualifiedId.  That works as long as we have a connection; but in  
pg_restore with text output, we don't.  Instead we got a zero from  
PQserverVersion, which fmtQualifiedId interpreted as "server is too old to  
have schemas", and so the name went unqualified.  That still accidentally  
managed to work in many cases, which is probably why this ancient bug went  
undetected for so long.  It only became obvious in the wake of the changes  
to force dump/restore to execute with restricted search_path.  
  
In HEAD/v11, let's deal with this by ripping out fmtQualifiedId's server-  
version behavioral dependency, and just making it schema-qualify all the  
time.  We no longer support pg_dump from servers old enough to need the  
ability to omit schema name, let alone restoring to them.  (Also, the few  
callers outside pg_dump already didn't work with pre-schema servers.)  
  
In older branches, that's not an acceptable solution, so instead just  
tweak the DISABLE/ENABLE TRIGGER logic to ensure it will schema-qualify  
its output regardless of server version.  
  
Per bug #15338 from Oleg somebody.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/scripts/common.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h

Set scan direction appropriately for SubPlans (bug #15336)

commit   : 67b161eae32b0e900f74a2fe0b3f01667ca70850    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 17 Aug 2018 15:04:26 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 17 Aug 2018 15:04:26 +0100    

Click here for diff

When executing a SubPlan in an expression, the EState's direction  
field was left alone, resulting in an attempt to execute the subplan  
backwards if it was encountered during a backwards scan of a cursor.  
Also, though much less likely, it was possible to reach the execution  
of an InitPlan while in backwards-scan state.  
  
Repair by saving/restoring estate->es_direction and forcing forward  
scan mode in the relevant places.  
  
Backpatch all the way, since this has been broken since 8.3 (prior to  
commit c7ff7663e, SubPlans had their own EStates rather than sharing  
the parent plan's, so there was no confusion over scan direction).  
  
Per bug #15336 reported by Vladimir Baranoff; analysis and patch by  
me, review by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_upgrade: issue helpful error message for use on standbys

commit   : 45d74631b3973390ff02cd765a674e6322e1c8db    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 17 Aug 2018 10:25:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 17 Aug 2018 10:25:48 -0400    

Click here for diff

Commit 777e6ddf1723306bd2bf8fe6f804863f459b0323 checked for a shut down  
message from a standby and allowed it to continue.  This patch reports a  
helpful error message in these cases, suggesting to use rsync as  
documented.  
  
Diagnosed-by: Martƭn MarquƩs  
  
Discussion: https://postgr.es/m/CAPdiE1xYCow-reLjrhJ9DqrMu-ppNq0ChUUEvVdxhdjGRD5_eA@mail.gmail.com  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c

Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

commit   : b43cf1dcded905abeceefc74fe44bbffc52ac96d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Aug 2018 11:29:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Aug 2018 11:29:15 +0900    

Click here for diff

Author: Dian Fay  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

M doc/src/sgml/ref/refresh_materialized_view.sgml

Proof-reading for documentation.

commit   : dedc6a2bb15d1b62485840ad871902137d74c9a1    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 17 Aug 2018 11:32:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 17 Aug 2018 11:32:55 +1200    

Click here for diff

Somebody accidentally a word.  Back-patch to 9.6.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20180816195431.GA23707%40telsasoft.com  

M doc/src/sgml/parallel.sgml

Fix executor prune failure when plan already pruned

commit   : 6589a435d83ba0b22cb56381fc5b410eb0e27834    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Aug 2018 12:43:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Aug 2018 12:43:04 -0300    

Click here for diff

In a multi-layer partitioning setup, if at plan time all the  
sub-partitions are pruned but the intermediate one remains, the executor  
later throws a spurious error that there's nothing to prune.  That is  
correct, but there's no reason to throw an error.  Therefore, don't.  
  
Reported-by: Andreas Seltenreich <[email protected]>  
Author: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Close the file descriptor in ApplyLogicalMappingFile

commit   : 43ba5ac6aa4879eea2d16f7f531b256c8203a3c3    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 16:49:10 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 16:49:10 +0200    

Click here for diff

The function was forgetting to close the file descriptor, resulting  
in failures like this:  
  
  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open  
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"  
  LOCATION:  OpenTransientFile, fd.c:2161  
  
Simply close the file at the end, and backpatch to 9.4 (where logical  
decoding was introduced). While at it, fix a nearby typo.  
  
Discussion: https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com  

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

Make snprintf.c follow the C99 standard for snprintf's result value.

commit   : 36147ec9f1e2dcbe35fc813825242d72d1c57b70    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 17:25:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 17:25:23 -0400    

Click here for diff

C99 says that the result should be the number of bytes that would have  
been emitted given a large enough buffer, not the number we actually  
were able to put in the buffer.  It's time to make our substitute  
implementation comply with that.  Not doing so results in inefficiency  
in buffer-enlargement cases, and also poses a portability hazard for  
third-party code that might expect C99-compliant snprintf behavior  
within Postgres.  
  
In passing, remove useless tests for str == NULL; neither C99 nor  
predecessor standards ever allowed that except when count == 0,  
so I see no reason to expend cycles on making that a non-crash case  
for this implementation.  Also, don't waste a byte in pg_vfprintf's  
local I/O buffer; this might have performance benefits by allowing  
aligned writes during flushbuffer calls.  
  
Back-patch of commit 805889d7d.  There was some concern about this  
possibly breaking code that assumes pre-C99 behavior, but there is  
much more risk (and reality, in our own code) of code that assumes  
C99 behavior and hence fails to detect buffer overrun without this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Update FSM on WAL replay of page all-visible/frozen

commit   : 6872c2be6a97057aa736110e31f0390a53305c9e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Aug 2018 18:09:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Aug 2018 18:09:29 -0300    

Click here for diff

We aren't very strict about keeping FSM up to date on WAL replay,  
because per-page freespace values aren't critical in replicas (can't  
write to heap in a replica; and if the replica is promoted, the values  
would be updated by VACUUM anyway).  However, VACUUM since 9.6 can skip  
processing pages marked all-visible or all-frozen, and if such pages are  
recorded in FSM with wrong values, those values are blindly propagated  
to FSM's upper layers by VACUUM's FreeSpaceMapVacuum.  (This rationale  
assumes that crashes are not very frequent, because those would cause  
outdated FSM to occur in the primary.)  
  
Even when the FSM is outdated in standby, things are not too bad  
normally, because, most per-page FSM values will be zero (other than  
those propagated with the base-backup that created the standby); only  
once the remaining free space is less than 0.2*BLCKSZ the per-page value  
is maintained by WAL replay of heap ins/upd/del.  However, if  
wal_log_hints=on causes complete FSM pages to be propagated to a standby  
via full-page images, many too-optimistic per-page values can end up  
being registered in the standby.  
  
Incorrect per-page values aren't critical in most cases, since an  
inserter that is given a page that doesn't actually contain the claimed  
free space will update FSM with the correct value, and retry until it  
finds a usable page.  However, if there are many such updates to do, an  
inserter can spend a long time doing them before a usable page is found;  
in a heavily trafficked insert-only table with many concurrent inserters  
this has been observed to cause several second stalls, causing visible  
application malfunction.  
  
To fix this problem, it seems sufficient to have heap_xlog_visible  
(replay of setting all-visible and all-frozen VM bits for a heap page)  
update the FSM value for the page being processed.  This fixes the  
per-page counters together with making the page skippable to vacuum, so  
when vacuum does FreeSpaceMapVacuum, the values propagated to FSM upper  
layers are the correct ones, avoiding the problem.  
  
While at it, apply the same fix to heap_xlog_clean (replay of tuple  
removal by HOT pruning and vacuum).  This makes any space freed by the  
cleaning available earlier than the next vacuum in the promoted replica.  
  
Backpatch to 9.6, where this problem was diagnosed on an insert-only  
table with all-frozen pages, which were introduced as a concept in that  
release.  Theoretically it could apply with all-visible pages to older  
branches, but there's been no report of that and it doesn't backpatch  
cleanly anyway.  
  
Author: Ɓlvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up assorted misuses of snprintf()'s result value.

commit   : d7ed4eea539dbd6bf89163213ea6068b4ef0fe11    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 16:29:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 16:29:32 -0400    

Click here for diff

Fix a small number of places that were testing the result of snprintf()  
but doing so incorrectly.  The right test for buffer overrun, per C99,  
is "result >= bufsize" not "result > bufsize".  Some places were also  
checking for failure with "result == -1", but the standard only says  
that a negative value is delivered on failure.  
  
(Note that this only makes these places correct if snprintf() delivers  
C99-compliant results.  But at least now these places are consistent  
with all the other places where we assume that.)  
  
Also, make psql_start_test() and isolation_start_test() check for  
buffer overrun while constructing their shell commands.  There seems  
like a higher risk of overrun, with more severe consequences, here  
than there is for the individual file paths that are made elsewhere  
in the same functions, so this seemed like a worthwhile change.  
  
Also fix guc.c's do_serialize() to initialize errno = 0 before  
calling vsnprintf.  In principle, this should be unnecessary because  
vsnprintf should have set errno if it returns a failure indication ...  
but the other two places this coding pattern is cribbed from don't  
assume that, so let's be consistent.  
  
These errors are all very old, so back-patch as appropriate.  I think  
that only the shell command overrun cases are even theoretically  
reachable in practice, but there's not much point in erroneous error  
checks.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/misc/guc.c
M src/common/ip.c
M src/interfaces/ecpg/pgtypeslib/common.c
M src/port/getaddrinfo.c
M src/test/isolation/isolation_main.c
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress_main.c

pg_upgrade: fix shutdown check for standby servers

commit   : 995133410de7c0f3670022d0d7d982f6e8f81bc0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 Aug 2018 17:19:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 Aug 2018 17:19:02 -0400    

Click here for diff

Commit 244142d32afd02e7408a2ef1f249b00393983822 only tested for the  
pg_controldata output for primary servers, but standby servers have  
different "Database cluster state" output, so check for that too.  
  
Diagnosed-by: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c

doc: Update broken links

commit   : c6eedb4d86dfdf5cf526af4df696e73dc8a5c275    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Aug 2018 22:54:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Aug 2018 22:54:52 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/153044458767.13254.16049977382403131287%40wrigleys.postgresql.org  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/runtime.sgml

Remove duplicate function declarations.

commit   : d39079a8b2d6d860a1ab7484ef19c31261c6b099    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Aug 2018 14:25:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Aug 2018 14:25:14 -0400    

Click here for diff

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

M src/include/libpq/pqformat.h

Remove obsolete comment

commit   : 4c9611e576e8b70abe14a616d776670339f956c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Aug 2018 21:07:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Aug 2018 21:07:31 +0200    

Click here for diff

The sequence name is no longer stored in the sequence relation, since  
1753b1b027035029c2a2a1649065762fafbf63f3.  

M src/backend/commands/tablecmds.c

Fix libpq's implementation of per-host connection timeouts.

commit   : 998c7366414ad6f93c2643339499ce9e6ab007eb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Aug 2018 13:07:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Aug 2018 13:07:52 -0400    

Click here for diff

Commit 5f374fe7a attempted to turn the connect_timeout from an overall  
maximum time limit into a per-host limit, but it didn't do a great job of  
that.  The timer would only get restarted if we actually detected timeout  
within connectDBComplete(), not if we changed our attention to a new host  
for some other reason.  In that case the old timeout continued to run,  
possibly causing a premature timeout failure for the new host.  
  
Fix that, and also tweak the logic so that if we do get a timeout,  
we advance to the next available IP address, not to the next host name.  
There doesn't seem to be a good reason to assume that all the IP  
addresses supplied for a given host name will necessarily fail the  
same way as the current one.  Moreover, this conforms better to the  
admittedly-vague documentation statement that the timeout is "per  
connection attempt".  I changed that to "per host name or IP address"  
to be clearer.  (Note that reconnections to the same server, such as for  
switching protocol version or SSL status, don't get their own separate  
timeout; that was true before and remains so.)  
  
Also clarify documentation about the interpretation of connect_timeout  
values less than 2.  
  
This seems like a bug, so back-patch to v10 where this logic came in.  
  
Tom Lane, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c

Make autovacuum more aggressive to remove orphaned temp tables

commit   : 943576bddcb52971041d9f5f806789921fa107ee    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Aug 2018 11:49:12 +0200    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Aug 2018 11:49:12 +0200    

Click here for diff

Commit dafa084, added in 10, made the removal of temporary orphaned  
tables more aggressive.  This commit makes an extra step into the  
aggressiveness by adding a flag in each backend's MyProc which tracks  
down any temporary namespace currently in use.  The flag is set when the  
namespace gets created and can be reset if the temporary namespace has  
been created in a transaction or sub-transaction which is aborted.  The  
flag value assignment is assumed to be atomic, so this can be done in a  
lock-less fashion like other flags already present in PGPROC like  
databaseId or backendId, still the fact that the temporary namespace and  
table created are still locked until the transaction creating those  
commits acts as a barrier for other backends.  
  
This new flag gets used by autovacuum to discard more aggressively  
orphaned tables by additionally checking for the database a backend is  
connected to as well as its temporary namespace in-use, removing  
orphaned temporary relations even if a backend reuses the same slot as  
one which created temporary relations in a past session.  
  
The base idea of this patch comes from Robert Haas, has been written in  
its first version by Tsunakawa Takayuki, then heavily reviewed by me.  
  
Author: Tsunakawa Takayuki  
Reviewed-by: Michael Paquier, Kyotaro Horiguchi, Andres Freund  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8A4DC6@G01JPEXMBYT05  
Backpatch: 11-, as PGPROC gains a new flag and we don't want silent ABI  
breakages on already released versions.  

M src/backend/access/transam/twophase.c
M src/backend/catalog/namespace.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/lmgr/proc.c
M src/include/catalog/namespace.h
M src/include/storage/proc.h

Adjust comment atop ExecShutdownNode.

commit   : f34d4b79fab42de09b43a1aa54dc2d77150ed94a    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 10:12:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 10:12:39 +0530    

Click here for diff

After commits a315b967cc and b805b63ac2, part of the comment atop  
ExecShutdownNode is redundant.  Adjust it.  
  
Author: Amit Kapila  
Backpatch-through: 10 where both the mentioned commits are present.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c

Prohibit shutting down resources if there is a possibility of back up.

commit   : c054afd0a22c75acec8f85872ae1036bd8519132    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 08:33:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 08:33:55 +0530    

Click here for diff

Currently, we release the asynchronous resources as soon as it is evident  
that no more rows will be needed e.g. when a Limit is filled.  This can be  
problematic especially for custom and foreign scans where we can scan  
backward.  Fix that by disallowing the shutting down of resources in such  
cases.  
  
Reported-by: Robert Haas  
Analysed-by: Robert Haas and Amit Kapila  
Author: Amit Kapila  
Reviewed-by: Robert Haas  
Backpatch-through: 9.6 where this code was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/nodeLimit.c

Avoid query-lifetime memory leaks in XMLTABLE (bug #15321)

commit   : 78f70e07e2cf42b95c9f0adb57e37cf6c1274ec3    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 13 Aug 2018 01:45:35 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 13 Aug 2018 01:45:35 +0100    

Click here for diff

Multiple calls to XMLTABLE in a query (e.g. laterally applying it to a  
table with an xml column, an important use-case) were leaking large  
amounts of memory into the per-query context, blowing up memory usage.  
  
Repair by reorganizing memory context usage in nodeTableFuncscan; use  
the usual per-tuple context for row-by-row evaluations instead of  
perValueCxt, and use the explicitly created context -- renamed from  
perValueCxt to perTableCxt -- for arguments and state for each  
individual table-generation operation.  
  
Backpatch to PG10 where this code was introduced.  
  
Original report by IRC user begriffs; analysis and patch by me.  
Reviewed by Tom Lane and Pavel Stehule.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix bogus loop logic in 013_crash_restart test's pump_until subroutine.

commit   : badaa0c50de0e1c8b1deb27d0a1ee00498e40002    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Aug 2018 18:05:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Aug 2018 18:05:49 -0400    

Click here for diff

The pump_nb() step might've already received the desired data, so we must  
check for that at the top of the loop not the bottom.  Otherwise, the  
call to pump() will sit with nothing to do until the timeout elapses.  
pump_until then falls out with apparent success ... but the timeout has  
been used up, causing the next call of pump_until to report a timeout  
failure.  I believe this explains the intermittent timeout failures  
we've seen in the buildfarm ever since this test went in.  I was able  
to reproduce the problem on gaur semi-repeatably, and this appears to  
fix it.  
  
In passing, remove a duplicate assignment, fix one stdin-assignment to  
look like the rest, and document the test's dependency on test_decoding.  

M src/test/recovery/README
M src/test/recovery/t/013_crash_restart.pl

Fix wrong order of operations in inheritance_planner.

commit   : 0ff8f521d40f271c57f29f0ca773981e4465b35b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 15:53:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 15:53:20 -0400    

Click here for diff

When considering a partitioning parent rel, we should stop processing that  
subroot as soon as we've done adjust_appendrel_attrs and any securityQuals  
updates.  The rest of this is unnecessary, and indeed adding duplicate  
subquery RTEs to the subroot is *wrong*.  As the code stood, the children  
of that partition ended up with two sets of copied subquery RTEs, confusing  
matters greatly.  Even more hilarity ensued if all of the children got  
excluded by constraint exclusion, so that the extra RTEs didn't make it  
back into the parent rtable.  
  
Per fuzz testing by Andreas Seltenreich.  Back-patch to v11 where this  
got broken (by commit 0a480502b, it looks like).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert changes in execMain.c from commit 16828d5c0273b

commit   : afff44303cc316d2fe8ad15ac5a5fc90d59dcd67    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 10 Aug 2018 16:05:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 10 Aug 2018 16:05:54 -0400    

Click here for diff

These changes were put in at some stage of the development process, but  
are unnecessary and should not have made it into the final patch. Mea  
culpa.  
  
Per gripe from Andreas Freund  
  
Backpatch to REL_11_STABLE  

M src/backend/executor/execMain.c

Handle parallel index builds on mapped relations.

commit   : 9353d94a9b70c6cbe181f78e49b2e8c1dc38eada    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 10 Aug 2018 13:01:33 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 10 Aug 2018 13:01:33 -0700    

Click here for diff

Commit 9da0cc35284, which introduced parallel CREATE INDEX, failed to  
propagate relmapper.c backend local cache state to parallel worker  
processes.  This could result in parallel index builds against mapped  
catalog relations where the leader process (participating as a worker)  
scans the new, pristine relfilenode, while worker processes scan the  
obsolescent relfilenode.  When this happened, the final index structure  
was typically not consistent with the owning table's structure.  The  
final index structure could contain entries formed from both heap  
relfilenodes.  Only rebuilds on mapped catalog relations that occur as  
part of a VACUUM FULL or CLUSTER could become corrupt in practice, since  
their mapped relation relfilenode swap is what allows the inconsistency  
to arise.  
  
On master, fix the problem by propagating the required relmapper.c  
backend state as part of standard parallel initialization (Cf. commit  
29d58fd3).  On v11, simply disallow builds against mapped catalog  
relations by deeming them parallel unsafe.  
  
Author: Peter Geoghegan  
Reported-By: "death lock"  
Reviewed-By: Tom Lane, Amit Kapila  
Bug: #15309  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where parallel CREATE INDEX was introduced.  

M src/backend/optimizer/plan/planner.c
M src/backend/utils/cache/relmapper.c

Fix typo in SP-GiST error message

commit   : 1b9d1b08fe5972f06f0eee41f7d8040c740aaa6b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 17:28:48 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 17:28:48 +0300    

Click here for diff

Error message didn't match the actual check.  Fix that.  Compression of leaf  
SP-GiST values was introduced in 11.  So, backpatch.  
  
Discussion: https://postgr.es/m/20180810.100742.15469435.horiguchi.kyotaro%40lab.ntt.co.jp  
Author: Kyotaro Horiguchi  
Backpatch-through: 11  

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

Add missing documentation for argument of amcostestimate()

commit   : dc444801ba692f773836308a44b2c0ed88af87e5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 14:14:36 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 14:14:36 +0300    

Click here for diff

5262f7a4fc44 have introduced parallel index scan.  In order to estimate the  
number of parallel workers, it adds extra argument to amcostestimate() index  
access method API function.  However, this extra argument was missed in the  
documentation.  This commit fixes that.  
  
Discussion: https://postgr.es/m/4128fdb4-8b63-2e05-38f6-3125f8c27263%40lab.ntt.co.jp  
Author: Tatsuro Yamada, Alexander Korotkov  
Backpatch-through: 10  

M doc/src/sgml/indexam.sgml

Add RECURSIVE to documentation index

commit   : 58a36f91b36f30603e5983f19d26c67941cefd3a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 9 Aug 2018 16:19:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 9 Aug 2018 16:19:32 -0400    

Click here for diff

Author: Daniel VĆ©ritĆ© <[email protected]>  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Document need to clear MAKELEVEL when invoking PG build from a makefile.

commit   : a015ae54a7fd5d613470033d624879804f629fae    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Aug 2018 15:21:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Aug 2018 15:21:09 -0400    

Click here for diff

Since commit 3b8f6e75f, failure to do this would lead to  
submake-generated-headers not doing anything, so that references to  
generated or symlinked headers would fail.  Previous to that, the  
omission only led to temp-install not doing anything, which apparently  
affects many fewer people (doesn't anybody use "make check" in their  
build rules??).  Hence, backpatch to v11 but not further.  
  
Per complaints from Christoph Berg, Jakob Egger, and others.  

M doc/src/sgml/installation.sgml

docs: Only first instance of a PREPARE parameter sets data type

commit   : 8c92638c008b074df9cf3087816e3aa8c01177a5    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 Aug 2018 10:13:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 Aug 2018 10:13:15 -0400    

Click here for diff

If the first reference to $1 is "($1 = col) or ($1 is null)", the data  
type can be determined, but not for "($1 is null) or ($1 = col)".  This  
change documents this.  
  
Reported-by: Morgan Owens  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

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

Spell "partitionwise" consistently.

commit   : 83f2691a3f2bafa397ff1dcca94c4d059df0e056    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Aug 2018 10:41:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Aug 2018 10:41:28 +0300    

Click here for diff

I'm not sure which spelling is better, "partitionwise" or "partition-wise",  
but everywhere else we spell it "partitionwise", so be consistent.  
  
Tatsuro Yamada reported the one in README, I found the other one with grep.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/README

Restrict access to reindex of shared catalogs for non-privileged users

commit   : 87330e21c32793237791756ddffae676775e3aaa    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Aug 2018 09:40:27 +0200    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Aug 2018 09:40:27 +0200    

Click here for diff

A database owner running a database-level REINDEX has the possibility to  
also do the operation on shared system catalogs without being an owner  
of them, which allows him to block resources it should not have access  
to.  The same goes for a schema owner.  For example, PostgreSQL would go  
unresponsive and even block authentication if a lock is waited for  
pg_authid.  This commit makes sure that a user running a REINDEX SYSTEM,  
DATABASE or SCHEMA only works on the following relations:  
- The user is a superuser  
- The user is the table owner  
- The user is the database/schema owner, only if the relation worked on  
is not shared.  
  
Robert has worded most the documentation changes, and I have coded the  
core part.  
  
Reported-by: Lloyd Albin, Jeremy Schneider  
Author: Michael Paquier, Robert Haas  
Reviewed by: Nathan Bossart, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11- as the current behavior has been around for a  
very long time and could be disruptive for already released branches.  

M doc/src/sgml/ref/reindex.sgml
M src/backend/commands/indexcmds.c

Remove bogus Assert in make_partitionedrel_pruneinfo().

commit   : 69d0e7e6b81db733971508da0e512115930edf1e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 20:02:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 20:02:10 -0400    

Click here for diff

This Assert thought that a given rel couldn't be both leaf and  
non-leaf, but it turns out that in some unusual plan trees  
that's wrong, so remove it.  
  
The lack of testing for cases like that is quite concerning ---  
there is little reason for confidence that there aren't other  
bugs in the area.  But developing a stable test case seems  
rather difficult, and in any case we don't need this Assert.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAJGNTeOkdk=UVuMugmKL7M=owgt4nNr1wjxMg1F+mHsXyLCzFA@mail.gmail.com  

M src/backend/partitioning/partprune.c

Doc: Correct description of amcheck example query.

commit   : 393e539c54d14ecd2b7d15b4cf2ac4a858ec451b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 8 Aug 2018 12:56:23 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 8 Aug 2018 12:56:23 -0700    

Click here for diff

The amcheck documentation incorrectly claimed that its example query  
verifies every catalog index in the database.  In fact, the query only  
verifies the 10 largest indexes (as determined by pg_class.relpages).  
Adjust the description accordingly.  
  
Backpatch: 10-, where contrib/amcheck was introduced.  

M doc/src/sgml/amcheck.sgml

Don't run atexit callbacks in quickdie signal handlers.

commit   : 79f17d45e82f3648c2459b8128ab4d516fb7640a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Aug 2018 19:08:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Aug 2018 19:08:10 +0300    

Click here for diff

exit() is not async-signal safe. Even if the libc implementation is, 3rd  
party libraries might have installed unsafe atexit() callbacks. After  
receiving SIGQUIT, we really just want to exit as quickly as possible, so  
we don't really want to run the atexit() callbacks anyway.  
  
The original report by Jimmy Yih was a self-deadlock in startup_die().  
However, this patch doesn't address that scenario; the signal handling  
while waiting for the startup packet is more complicated. But at least this  
alleviates similar problems in the SIGQUIT handlers, like that reported  
by Asim R P later in the same thread.  
  
Backpatch to 9.3 (all supported versions).  
  
Discussion: https://www.postgresql.org/message-id/CAOMx_OAuRUHiAuCg2YgicZLzPVv5d9_H4KrL_OFsFP%3DVPekigA%40mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/backend/tcop/postgres.c

Match RelOptInfos by relids not pointer equality.

commit   : a3deecb1c9af1e3d210a321401e40f22db859290    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 11:44:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 11:44:50 -0400    

Click here for diff

Commit 1c2cb2744 added some code that tried to detect whether two  
RelOptInfos were the "same" rel by pointer comparison; but it turns  
out that inheritance_planner breaks that, through its shenanigans  
with copying some relations forward into new subproblems.  Compare  
relid sets instead.  Add a regression test case to exercise this  
area.  
  
Problem reported by Rushabh Lathia; diagnosis and fix by Amit Langote,  
modified a bit by me.  
  
Discussion: https://postgr.es/m/CAGPqQf3anJGj65bqAQ9edDr8gF7qig6_avRgwMT9MsZ19COUPw@mail.gmail.com  

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

Don't record FDW user mappings as members of extensions.

commit   : ea1b659710663240a6c41b57ba10a37f3f82eb23    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:32:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:32:50 -0400    

Click here for diff

CreateUserMapping has a recordDependencyOnCurrentExtension call that's  
been there since extensions were introduced (very possibly my fault).  
However, there's no support anywhere else for user mappings as members  
of extensions, nor are they listed as a possible member object type in  
the documentation.  Nor does it really seem like a good idea for user  
mappings to belong to extensions when roles don't.  Hence, remove the  
bogus call.  
  
(As we saw in bug #15310, the lack of any pg_dump support for this case  
ensures that any such membership record would silently disappear during  
pg_upgrade.  So there's probably no need for us to do anything else  
about cleaning up after this mistake.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/foreigncmds.c

Fix incorrect initialization of BackendActivityBuffer.

commit   : 1b5438ec2a4ddb2bc632916efc1ec89f593dac06    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:00:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:00:44 -0400    

Click here for diff

Since commit c8e8b5a6e, this has been zeroed out using the wrong length.  
In practice the length would always be too small, leading to not zeroing  
the whole buffer rather than clobbering additional memory; and that's  
pretty harmless, both because shmem would likely start out as zeroes  
and because we'd reinitialize any given entry before use.  Still,  
it's bogus, so fix it.  
  
Reported by Petru-Florin Mihancea (bug #15312)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

Fix pg_upgrade to handle event triggers in extensions correctly.

commit   : 187331fefdb0b4cc2c2aaab42c754dcafa2a0f08    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 15:43:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 15:43:48 -0400    

Click here for diff

pg_dump with --binary-upgrade must emit ALTER EXTENSION ADD commands  
for all objects that are members of extensions.  It forgot to do so for  
event triggers, as per bug #15310 from Nick Barnes.  Back-patch to 9.3  
where event triggers were introduced.  
  
Haribabu Kommi  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Ensure pg_dump_sort.c sorts null vs non-null namespace consistently.

commit   : f7364300667befd892667d54414268aafc24377e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 13:13:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 13:13:42 -0400    

Click here for diff

The original coding here (which is, I believe, my fault) supposed that  
it didn't need to concern itself with the possibility that one object  
of a given type-priority has a namespace while another doesn't.  But  
that's not reliably true anymore, if it ever was; and if it does happen  
then it's possible that DOTypeNameCompare returns self-inconsistent  
comparison results.  That leads to unspecified behavior in qsort()  
and a resultant weird output order from pg_dump.  
  
This should end up being only a cosmetic problem, because any ordering  
constraints that actually matter should be enforced by the later  
dependency-based sort.  Still, it's a bug, so back-patch.  
  
Report and fix by Jacob Champion, though I editorialized on his  
patch to the extent of making NULL sort after non-NULL, for consistency  
with our usual sorting definitions.  
  
Discussion: https://postgr.es/m/CABAq_6Hw+V-Kj7PNfD5tgOaWT_-qaYkc+SRmJkPLeUjYXLdxwQ@mail.gmail.com  

M src/bin/pg_dump/pg_dump_sort.c

Stamp 11beta3.

commit   : e62cc60fb97ae49f8a892cf98675c36727830cba    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 16:02:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 16:02:42 -0400    

Click here for diff

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

Translation updates

commit   : 10dc69ef8f7e82079738e96ca171fd0e513e72ad    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Aug 2018 20:09:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Aug 2018 20:09:07 +0200    

Click here for diff

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

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

Last-minute updates for release notes.

commit   : 749839c4d53c60de2e51ef82a03f1084e3ec1f6c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 13:13:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 13:13:40 -0400    

Click here for diff

Security: CVE-2018-10915, CVE-2018-10925  

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

Fix failure to reset libpq's state fully between connection attempts.

commit   : f6f735f78d9e05b757c96b036dfd31b1f9f77312    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 10:53:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 10:53:35 -0400    

Click here for diff

The logic in PQconnectPoll() did not take care to ensure that all of  
a PGconn's internal state variables were reset before trying a new  
connection attempt.  If we got far enough in the connection sequence  
to have changed any of these variables, and then decided to try a new  
server address or server name, the new connection might be completed  
with some state that really only applied to the failed connection.  
  
While this has assorted bad consequences, the only one that is clearly  
a security issue is that password_needed didn't get reset, so that  
if the first server asked for a password and the second didn't,  
PQconnectionUsedPassword() would return an incorrect result.  This  
could be leveraged by unprivileged users of dblink or postgres_fdw  
to allow them to use server-side login credentials that they should  
not be able to use.  
  
Other notable problems include the possibility of forcing a v2-protocol  
connection to a server capable of supporting v3, or overriding  
"sslmode=prefer" to cause a non-encrypted connection to a server that  
would have accepted an encrypted one.  Those are certainly bugs but  
it's harder to paint them as security problems in themselves.  However,  
forcing a v2-protocol connection could result in libpq having a wrong  
idea of the server's standard_conforming_strings setting, which opens  
the door to SQL-injection attacks.  The extent to which that's actually  
a problem, given the prerequisite that the attacker needs control of  
the client's connection parameters, is unclear.  
  
These problems have existed for a long time, but became more easily  
exploitable in v10, both because it introduced easy ways to force libpq  
to abandon a connection attempt at a late stage and then try another one  
(rather than just giving up), and because it provided an easy way to  
specify multiple target hosts.  
  
Fix by rearranging PQconnectPoll's state machine to provide centralized  
places to reset state properly when moving to a new target host or when  
dropping and retrying a connection to the same host.  
  
Tom Lane, reviewed by Noah Misch.  Our thanks to Andrew Krasichkov  
for finding and reporting the problem.  
  
Security: CVE-2018-10915  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Release notes for 10.5, 9.6.10, 9.5.14, 9.4.19, 9.3.24.

commit   : c6db605c3ee5664327dc5444dc7e76e013e631fe    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 16:38:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 16:38:42 -0400    

Click here for diff

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

Doc: fix incorrectly stated argument list for pgcrypto's hmac() function.

commit   : 1d6c93f8f412c135550748afa22f447809baf424    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 13:03:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 13:03:42 -0400    

Click here for diff

The bytea variant takes (bytea, bytea, text).  
Per unsigned report.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgcrypto.sgml

Remove now unused check for HAVE_X509_GET_SIGNATURE_NID in test.

commit   : a2441558a66669744cfeb03b921e915ce59283ce    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 17:16:12 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 17:16:12 +0300    

Click here for diff

I removed the code that used this in the previous commit.  
  
Spotted by Michael Paquier.  

M src/test/ssl/t/002_scram.pl

Remove support for tls-unique channel binding.

commit   : 1b7378b3d6894466d6b38bf93c7fe11ef7449226    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 13:44:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 13:44:21 +0300    

Click here for diff

There are some problems with the tls-unique channel binding type. It's not  
supported by all SSL libraries, and strictly speaking it's not defined for  
TLS 1.3 at all, even though at least in OpenSSL, the functions used for it  
still seem to work with TLS 1.3 connections. And since we had no  
mechanism to negotiate what channel binding type to use, there would be  
awkward interoperability issues if a server only supported some channel  
binding types. tls-server-end-point seems feasible to support with any SSL  
library, so let's just stick to that.  
  
This removes the scram_channel_binding libpq option altogether, since there  
is now only one supported channel binding type.  
  
This also removes all the channel binding tests from the SSL test suite.  
They were really just testing the scram_channel_binding option, which  
is now gone. Channel binding is used if both client and server support it,  
so it is used in the existing tests. It would be good to have some tests  
specifically for channel binding, to make sure it really is used, and the  
different combinations of a client and a server that support or doesn't  
support it. The current set of settings we have make it hard to write such  
tests, but I did test those things manually, by disabling  
HAVE_BE_TLS_GET_CERTIFICATE_HASH and/or  
HAVE_PGTLS_GET_PEER_CERTIFICATE_HASH.  
  
I also removed the SCRAM_CHANNEL_BINDING_TLS_END_POINT constant. This is a  
matter of taste, but IMO it's more readable to just use the  
"tls-server-end-point" string.  
  
Refactor the checks on whether the SSL library supports the functions  
needed for tls-server-end-point channel binding. Now the server won't  
advertise, and the client won't choose, the SCRAM-SHA-256-PLUS variant, if  
compiled with an OpenSSL version too old to support it.  
  
In the passing, add some sanity checks to check that the chosen SASL  
mechanism, SCRAM-SHA-256 or SCRAM-SHA-256-PLUS, matches whether the SCRAM  
exchange used channel binding or not. For example, if the client selects  
the non-channel-binding variant SCRAM-SHA-256, but in the SCRAM message  
uses channel binding anyway. It's harmless from a security point of view,  
I believe, and I'm not sure if there are some other conditions that would  
cause the connection to fail, but it seems better to be strict about these  
things and check explicitly.  
  
Discussion: https://www.postgresql.org/message-id/ec787074-2305-c6f4-86aa-6902f98485a4%40iki.fi  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/release-11.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/include/common/scram-common.h
M src/include/libpq/libpq-be.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/002_scram.pl

Update version 11 release notes.

commit   : 87790fd1eaa5d2cd50c15ac55bfbcda602dfd272    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 23:49:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 23:49:53 -0400    

Click here for diff

Remove description of commit 1944cdc98, which has now been back-patched  
so it's not relevant to v11 any longer.  Add descriptions of other  
recent commits that seemed worth mentioning.  
  
I marked the update as stopping at 2018-07-30, because it's unclear  
whether d06eebce5 will be allowed to stay in v11, and I didn't feel like  
putting effort into writing a description of it yet.  If it does stay,  
I think it will deserve mention in the Source Code section.  

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

Fix INSERT ON CONFLICT UPDATE through a view that isn't just SELECT *.

commit   : e7154b6acfeb70cb079cfa17c8d22725f77455b4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 19:38:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 19:38:58 -0400    

Click here for diff

When expanding an updatable view that is an INSERT's target, the rewriter  
failed to rewrite Vars in the ON CONFLICT UPDATE clause.  This accidentally  
worked if the view was just "SELECT * FROM ...", as the transformation  
would be a no-op in that case.  With more complicated view targetlists,  
this omission would often lead to "attribute ... has the wrong type" errors  
or even crashes, as reported by Mario De Frutos Dieguez.  
  
Fix by adding code to rewriteTargetView to fix up the data structure  
correctly.  The easiest way to update the exclRelTlist list is to rebuild  
it from scratch looking at the new target relation, so factor the code  
for that out of transformOnConflictClause to make it sharable.  
  
In passing, avoid duplicate permissions checks against the EXCLUDED  
pseudo-relation, and prevent useless view expansion of that relation's  
dummy RTE.  The latter is only known to happen (after this patch) in cases  
where the query would fail later due to not having any INSTEAD OF triggers  
for the view.  But by exactly that token, it would create an unintended  
and very poorly tested state of the query data structure, so it seems like  
a good idea to prevent it from happening at all.  
  
This has been broken since ON CONFLICT was introduced, so back-patch  
to 9.5.  
  
Dean Rasheed, based on an earlier patch by Amit Langote;  
comment-kibitzing and back-patching by me  
  
Discussion: https://postgr.es/m/CAFYwGJ0xfzy8jaK80hVN2eUWr6huce0RU8AgU04MGD00igqkTg@mail.gmail.com  

M src/backend/parser/analyze.c
M src/backend/rewrite/rewriteHandler.c
M src/include/parser/analyze.h
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Reset properly errno before calling write()

commit   : 58673b4a5fdff4d0d327c2d07e0cf8743f86f44c    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 5 Aug 2018 05:31:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 5 Aug 2018 05:31:56 +0900    

Click here for diff

6cb3372 enforces errno to ENOSPC when less bytes than what is expected  
have been written when it is unset, though it forgot to properly reset  
errno before doing a system call to write(), causing errno to  
potentially come from a previous system call.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/twophase.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/bin/pg_basebackup/walmethods.c

Make "kerberos" test suite independent of "localhost" name resolution.

commit   : 75224ac20e90d2a9ba18ead1af62c74858d48c41    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 3 Aug 2018 20:53:25 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 3 Aug 2018 20:53:25 -0700    

Click here for diff

This suite malfunctioned if the canonical name of "localhost" was  
something other than "localhost", such as "localhost.localdomain".  Use  
hostaddr=127.0.0.1 and a fictitious host=, so the resolver's answers for  
"localhost" don't affect the outcome.  Back-patch to v11, which  
introduced this test suite.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add table relcache invalidation to index builds.

commit   : b9612e5cfab828e496108c8e5379fdfac625ae01    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 3 Aug 2018 14:45:02 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 3 Aug 2018 14:45:02 -0700    

Click here for diff

It's necessary to make sure that owning tables have a relcache  
invalidation prior to advancing the command counter to make  
newly-entered catalog tuples for the index visible.  inval.c must be  
able to maintain the consistency of the local caches in the event of  
transaction abort.  There is usually only a problem when CREATE INDEX  
transactions abort, since there is a generic invalidation once we reach  
index_update_stats().  
  
This bug is of long standing.  Problems were made much more likely by  
the addition of parallel CREATE INDEX (commit 9da0cc35284), but it is  
strongly suspected that similar problems can be triggered without  
involving plan_create_index_workers().  (plan_create_index_workers()  
triggers a relcache build or rebuild, which previously only happened in  
rare edge cases.)  
  
Author: Peter Geoghegan  
Reported-By: Luca Ferrari  
Diagnosed-By: Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAKoxK+5fVodiCtMsXKV_1YAKXbzwSfp7DgDqUmcUAzeAhf=HEQ@mail.gmail.com  
Backpatch: 9.3-  

M src/backend/catalog/index.c

Add 'n' to list of possible values to pg_default_acl.defaclobjtype

commit   : a3958178935a0258a1850a9f4ac710fbaaa3344f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:45:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:45:08 -0400    

Click here for diff

This was missed in commit ab89e465cb20; backpatch to v10.  
  
Author: Fabien Coelho <[email protected]>  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1807302243001.13230@lancre  

M doc/src/sgml/catalogs.sgml

Fix pg_replication_slot example output

commit   : d25c48d0c9f09355eaee4bb8f2c21c354ac47358    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:34:59 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:34:59 -0400    

Click here for diff

The example output of pg_replication_slot is wrong.  Correct it and make  
the output stable by explicitly listing columns to output.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Remove no-longer-appropriate special case in psql's \conninfo code.

commit   : d8b2beb269c9606513a1693ac2e21586aa693e1a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:20:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:20:47 -0400    

Click here for diff

\conninfo prints the results of PQhost() and some other libpq functions.  
It used to override the PQhost() result with the hostaddr parameter if  
that'd been given, but that's unhelpful when multiple hosts were listed  
in the connection string.  Furthermore, it seems unnecessary in the wake  
of commit 1944cdc98, since PQhost does any useful substitution itself.  
So let's just remove the extra code and print PQhost()'s result without  
any editorialization.  
  
Back-patch to v10, as 1944cdc98 (just) was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Change libpq's internal uses of PQhost() to inspect host field directly.

commit   : 6efc30167188f2adea8741dc1b69f6536b2c9b44    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:12:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:12:10 -0400    

Click here for diff

Commit 1944cdc98 changed PQhost() to return the hostaddr value when that  
is specified and host isn't.  This is a good idea in general, but  
fe-auth.c and related files contain PQhost() calls for which it isn't.  
Specifically, when we compare SSL certificates or other server identity  
information to the host field, we do not want to use hostaddr instead;  
that's not what's documented, that's not what happened pre-v10, and  
it doesn't seem like a good idea.  
  
Instead, we can just look at connhost[].host directly.  This does what  
we want in v10 and up; in particular, if neither host nor hostaddr  
were given, the host field will be replaced with the default host name.  
That seems useful, and it's likely the reason that these places were  
coded to call PQhost() originally (since pre-v10, the stored field was  
not replaced with the default).  
  
Back-patch to v10, as 1944cdc98 (just) was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-secure-common.c

Fix buffer usage stats for parallel nodes.

commit   : dac7fe13bbf10c249a519d6a41c683c42c7e3312    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 11:16:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 11:16:25 +0530    

Click here for diff

The buffer usage stats is accounted only for the execution phase of the  
node.  For Gather and Gather Merge nodes, such stats are accumulated at  
the time of shutdown of workers which is done after execution of node due  
to which we missed to account them for such nodes.  Fix it by treating  
nodes as running while we shut down them.  
  
We can also miss accounting for a Limit node when Gather or Gather Merge  
is beneath it, because it can finish the execution before shutting down  
such nodes.  So we allow a Limit node to shut down the resources before it  
completes the execution.  
  
In the passing fix the gather node code to allow workers to shut down as  
soon as we find that all the tuples from the workers have been retrieved.  
The original code use to do that, but is accidently removed by commit  
01edb5c7fc.  
  
Reported-by: Adrien Nayrat  
Author: Amit Kapila and Robert Haas  
Reviewed-by: Robert Haas and Andres Freund  
Backpatch-through: 9.6 where this code was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeLimit.c

Match the buffer usage tracking for leader and worker backends.

commit   : ef305bd59d9828805bfdbf33ff4003bb74a63865    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 09:29:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 09:29:45 +0530    

Click here for diff

In the leader backend, we don't track the buffer usage for ExecutorStart  
phase whereas in worker backend we track it for ExecutorStart phase as  
well.  This leads to different value for buffer usage stats for the  
parallel and non-parallel query.  Change the code so that worker backend  
also starts tracking buffer usage after ExecutorStart.  
  
Author: Amit Kapila and Robert Haas  
Reviewed-by: Robert Haas and Andres Freund  
Backpatch-through: 9.6 where this code was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execParallel.c

Fix run-time partition pruning for appends with multiple source rels.

commit   : 1b54e91faabf3764b6786915881e514e42dccf89    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 19:42:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 19:42:46 -0400    

Click here for diff

The previous coding here supposed that if run-time partitioning applied to  
a particular Append/MergeAppend plan, then all child plans of that node  
must be members of a single partitioning hierarchy.  This is totally wrong,  
since an Append could be formed from a UNION ALL: we could have multiple  
hierarchies sharing the same Append, or child plans that aren't part of any  
hierarchy.  
  
To fix, restructure the related plan-time and execution-time data  
structures so that we can have a separate list or array for each  
partitioning hierarchy.  Also track subplans that are not part of any  
hierarchy, and make sure they don't get pruned.  
  
Per reports from Phil Florent and others.  Back-patch to v11, since  
the bug originated there.  
  
David Rowley, with a lot of cosmetic adjustments by me; thanks also  
to Amit Langote for review.  
  
Discussion: https://postgr.es/m/HE1PR03MB17068BB27404C90B5B788BCABA7B0@HE1PR03MB1706.eurprd03.prod.outlook.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partprune.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix logical replication slot initialization

commit   : 7326a7d63801673d3569def65cb7955d6486f254    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 17:39:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 17:39:07 -0400    

Click here for diff

This was broken in commit 9c7d06d60680, which inadvertently gave the  
wrong value to fast_forward in one StartupDecodingContext call.  Fix by  
flipping the value.  Add a test for the obvious error, namely trying to  
initialize a replication slot with an nonexistent output plugin.  
  
While at it, move the CreateDecodingContext call earlier, so that any  
errors are reported before sending the CopyBoth message.  
  
Author: Dave Cramer <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CADK3HHLVkeRe1v4P02-5hj55H3_yJg3AEtpXyEY5T3wuzO2jSg@mail.gmail.com  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M src/backend/replication/logical/logical.c
M src/backend/replication/walsender.c

Fix per-tuple memory leak in partition tuple routing

commit   : 34295b87fbbcbaf26280f53f006b20971dbad1f3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 15:06:47 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 15:06:47 -0400    

Click here for diff

Some operations were being done in a longer-lived memory context,  
causing intra-query leaks.  It's not noticeable unless you're doing a  
large COPY, but if you are, it eats enough memory to cause a problem.  
  
Co-authored-by: Kohei KaiGai <[email protected]>  
Co-authored-by: Amit Langote <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CAOP8fzYtVFWZADq4c=KoTAqgDrHWfng+AnEPEZccyxqxPVbbWQ@mail.gmail.com  

M src/backend/executor/execPartition.c

Fix libpq's code for searching .pgpass; rationalize empty-list-item cases.

commit   : e9bbfe60882e037b4bddddc5077d19c1a9762e58    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 12:30:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 12:30:36 -0400    

Click here for diff

Before v10, we always searched ~/.pgpass using the host parameter,  
and nothing else, to match to the "hostname" field of ~/.pgpass.  
(However, null host or host matching DEFAULT_PGSOCKET_DIR was replaced by  
"localhost".)  In v10, this got broken by commit 274bb2b38, repaired by  
commit bdac9836d, and broken again by commit 7b02ba62e; in the code  
actually shipped, we'd search with hostaddr if both that and host were  
specified --- though oddly, *not* if only hostaddr were specified.  
Since this is directly contrary to the documentation, and not  
backwards-compatible, it's clearly a bug.  
  
However, the change wasn't totally without justification, even though it  
wasn't done quite right, because the pre-v10 behavior has arguably been  
buggy since we added hostaddr.  If hostaddr is specified and host isn't,  
the pre-v10 code will search ~/.pgpass for "localhost", and ship that  
password off to a server that most likely isn't local at all.  That's  
unhelpful at best, and could be a security breach at worst.  
  
Therefore, rather than just revert to that old behavior, let's define  
the behavior as "search with host if provided, else with hostaddr if  
provided, else search for localhost".  (As before, a host name matching  
DEFAULT_PGSOCKET_DIR is replaced by localhost.)  This matches the  
behavior of the actual connection code, so that we don't pick up an  
inappropriate password; and it allows useful searches to happen when  
only hostaddr is given.  
  
While we're messing around here, ensure that empty elements within a  
host or hostaddr list select the same behavior as a totally-empty  
field would; for instance "host=a,,b" is equivalent to "host=a,/tmp,b"  
if DEFAULT_PGSOCKET_DIR is /tmp.  Things worked that way in some cases  
already, but not consistently so, which contributed to the confusion  
about what key ~/.pgpass would get searched with.  
  
Update documentation accordingly, and also clarify some nearby text.  
  
Back-patch to v10 where the host/hostaddr list functionality was  
introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c

Update parallel.sgml for Parallel Append

commit   : ac535cd478060f84b67d08c54e482bd373bf1779    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 1 Aug 2018 08:14:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 1 Aug 2018 08:14:05 -0400    

Click here for diff

Patch by me, reviewed by Thomas Munro, in response to a complaint  
from Adrien Nayrat.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/parallel.sgml

pg_upgrade: fix --check for live source server checks

commit   : 9200016335a030d70907dfa9bcb680681a61608e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Jul 2018 18:10:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Jul 2018 18:10:06 -0400    

Click here for diff

Fix for commit 244142d32afd02e7408a2ef1f249b00393983822.  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c

Provide for contrib and pgxs modules to install include files.

commit   : d06eebce5fa4aece311d4042362d1652b484c52c    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 31 Jul 2018 19:58:39 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 31 Jul 2018 19:58:39 +0100    

Click here for diff

This allows out-of-tree PLs and similar code to get access to  
definitions needed to work with extension data types.  
  
The following existing modules now install headers: contrib/cube,  
contrib/hstore, contrib/isn, contrib/ltree, contrib/seg.  
  
Discussion: https://postgr.es/m/87y3euomjh.fsf%40news-spur.riddles.org.uk  

M contrib/cube/Makefile
M contrib/hstore/Makefile
M contrib/isn/Makefile
M contrib/ltree/Makefile
M contrib/seg/Makefile
M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk
M src/tools/msvc/Install.pm

Further fixes for quoted-list GUC values in pg_dump and ruleutils.c.

commit   : a56c11d44dfcce1cbed3a6ed243ae43e001dfb9f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Jul 2018 13:00:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Jul 2018 13:00:08 -0400    

Click here for diff

Commits 742869946 et al turn out to be a couple bricks shy of a load.  
We were dumping the stored values of GUC_LIST_QUOTE variables as they  
appear in proconfig or setconfig catalog columns.  However, although that  
quoting rule looks a lot like SQL-identifier double quotes, there are two  
critical differences: empty strings ("") are legal, and depending on which  
variable you're considering, values longer than NAMEDATALEN might be valid  
too.  So the current technique fails altogether on empty-string list  
entries (as reported by Steven Winfield in bug #15248) and it also risks  
truncating file pathnames during dump/reload of GUC values that are lists  
of pathnames.  
  
To fix, split the stored value without any downcasing or truncation,  
and then emit each element as a SQL string literal.  
  
This is a tad annoying, because we now have three copies of the  
comma-separated-string splitting logic in varlena.c as well as a fourth  
one in dumputils.c.  (Not to mention the randomly-different-from-those  
splitting logic in libpq...)  I looked at unifying these, but it would  
be rather a mess unless we're willing to tweak the API definitions of  
SplitIdentifierString, SplitDirectoriesString, or both.  That might be  
worth doing in future; but it seems pretty unsafe for a back-patched  
bug fix, so for now accept the duplication.  
  
Back-patch to all supported branches, as the previous fix was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varlena.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/include/utils/varlena.h
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Remove dead code left behind by 1b6801051.

commit   : 5a71d3e58333f764b4fc34f3cf93521c964f64f6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 19:11:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 19:11:02 -0400    

Click here for diff

M src/backend/nodes/bitmapset.c

Verify range bounds to bms_add_range when necessary

commit   : a0655ba68fb54a011b1c57901ad66764b1e5473f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:03:19 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:03:19 -0400    

Click here for diff

Now that the bms_add_range boundary protections are gone, some  
alternative ones are needed in a few places.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAppend.c
M src/backend/partitioning/partprune.c

Change bms_add_range to be a no-op for empty ranges

commit   : 192d1bbf99699de76473184c57fff9ff4b4246f4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:18:42 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:18:42 -0400    

Click here for diff

In commit 84940644de93, bms_add_range was added with an API to fail with  
an error if an empty range was specified.  This seems arbitrary and  
unhelpful, so turn that case into a no-op instead.  Callers that require  
further verification on the arguments or result can apply them by  
themselves.  
  
This fixes the bug that partition pruning throws an API error for a case  
involving the default partition of a default partition, as in the  
included test case.  
  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Diagnosed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/bitmapset.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Ensure we build generated headers at the start of some more cases.

commit   : 739d9b29948bb508656d7f6c779630788abac560    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 18:04:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 18:04:39 -0400    

Click here for diff

"make installcheck" and some related cases, when invoked from the toplevel  
directory, start out by doing "make all" in src/test/regress.  Since that's  
one make recursion level down, the submake-generated-headers target will  
do nothing, causing us to fail to create/update generated headers before  
building pg_regress.  This is, I believe, a new failure mode induced by  
commit 3b8f6e75f, so let's fix it.  To do so, we have to invoke  
submake-generated-headers at the top level.  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M src/Makefile.global.in

Set ActiveSnapshot when logically replaying inserts

commit   : 5dbd0beb8a95fa1de3a931d20102cc9f273fceef    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 16:30:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 16:30:07 -0400    

Click here for diff

Input functions for the inserted tuples may require a snapshot, when  
they are replayed by native logical replication.  An example is a domain  
with a constraint using a SQL-language function, which prior to this  
commit failed to apply on the subscriber side.  
  
Reported-by: Mai Peng <[email protected]>  
Co-authored-by: Minh-Quan TRAN <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/002_types.pl

Fix pg_dump's failure to dump REPLICA IDENTITY for constraint indexes.

commit   : f6ef3ed43669350e0d5fd5a02ae3be6ec150a64e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 12:35:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 12:35:49 -0400    

Click here for diff

pg_dump knew about printing ALTER TABLE ... REPLICA IDENTITY USING INDEX  
for indexes declared as indexes, but it failed to print that for indexes  
declared as unique or primary-key constraints.  Per report from Achilleas  
Mantzios.  
  
This has been broken since the feature was introduced, AFAICS.  
Back-patch to 9.4.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Doc: fix oversimplified example for CREATE POLICY.

commit   : 506bbbf02e8c045b6d35dc3b0083e5a12f7b3837    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 11:54:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 11:54:41 -0400    

Click here for diff

As written, this policy constrained only the post-image not the pre-image  
of rows, meaning that users could delete other users' rows or take  
ownership of such rows, contrary to what the docs claimed would happen.  
We need two separate policies to achieve the documented effect.  
  
While at it, try to explain what's happening a bit more fully.  
  
Per report from ŠžŠ»ŠµŠ³ Š”Š°Š¼Š¾Š¹Š»Š¾Š².  Back-patch to 9.5 where this was added.  
Thanks to Stephen Frost for off-list discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Fix earthdistance test suite function name typo.

commit   : 5ed0b6daec542ea1787ed4265fb75448e8f27e66    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 29 Jul 2018 12:02:07 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 29 Jul 2018 12:02:07 -0700    

Click here for diff

Affected test queries have been testing the wrong thing since their  
introduction in commit 4c1383efd132e4f532213c8a8cc63a455f55e344.  
Back-patch to 9.3 (all supported versions).  

M contrib/earthdistance/expected/earthdistance.out
M contrib/earthdistance/sql/earthdistance.sql

Document security implications of qualified names.

commit   : a117c7a7b62f8978052b69e8e3bfdf8f8099a61d    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 28 Jul 2018 20:08:01 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 28 Jul 2018 20:08:01 -0700    

Click here for diff

Commit 5770172cb0c9df9e6ce27c507b449557e5b45124 documented secure schema  
usage, and that advice suffices for using unqualified names securely.  
Document, in typeconv-func primarily, the additional issues that arise  
with qualified names.  Back-patch to 9.3 (all supported versions).  
  
Reviewed by Jonathan S. Katz.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/typeconv.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/utils/adt/ruleutils.c

pgtest: run clean, build, and check stages separately

commit   : 9a513f8f9e87462ec63a9f08bcd2d4a7e1f6fa4d    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:34:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:34:06 -0400    

Click here for diff

This allows for cleaner error reporting.  
  
Backpatch-through: 9.5  

M src/tools/pgtest

pg_upgrade: check for clean server shutdowns

commit   : 113224848aa010ce03431c76198bfdac871e8a0e    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:01:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:01:55 -0400    

Click here for diff

Previously pg_upgrade checked for the pid file and started/stopped the  
server to force a clean shutdown.  However, "pg_ctl -m immediate"  
removes the pid file but doesn't do a clean shutdown, so check  
pg_controldata for a clean shutdown too.  
  
Diagnosed-by: Vimalraj A  
  
Discussion: https://postgr.es/m/CAFKBAK5e4Q-oTUuPPJ56EU_d2Rzodq6GWKS3ncAk3xo7hAsOZg@mail.gmail.com  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.c

pgtest: grab possible warnings from install.log

commit   : f0aff14d43394c669747af244e3c47fb8020cc77    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 11:35:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 11:35:53 -0400    

Click here for diff

Since PG 9.5, 'make check' records the build output in install.log, so  
look in there for warnings too.  
  
Backpatch-through: 9.5  

M src/tools/pgtest

Fix the buffer release order for parallel index scans.

commit   : 09a5be587b6546aa10a71b112683c115d0b11586    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 27 Jul 2018 10:56:07 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 27 Jul 2018 10:56:07 +0530    

Click here for diff

During parallel index scans, if the current page to be read is deleted, we  
skip it and try to get the next page for a scan without releasing the buffer  
lock on the current page.  To get the next page, sometimes it needs to wait  
for another process to complete its scan and advance it to the next page.  
Now, it is quite possible that the master backend has errored out before  
advancing the scan and issued a termination signal for all workers.  The  
workers failed to notice the termination request during wait because the  
interrupts are held due to buffer lock on the previous page.  This lead to  
all workers being stuck.  
  
The fix is to release the buffer lock on current page before trying to get  
the next page.  We are already doing same in backward scans, but missed  
it for forward scans.  
  
Reported-by: Victor Yegorov  
Bug: 15290  
Diagnosed-by: Thomas Munro and Amit Kapila  
Author: Amit Kapila  
Reviewed-by: Thomas Munro  
Tested-By: Thomas Munro and Victor Yegorov  
Backpatch-through: 10 where parallel index scans were introduced  
Discussion:https://postgr.es/m/[email protected]  

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

Fix handling of pgbench's hash when no argument is provided

commit   : c2e5f60db160d74ba862023ec460ace938f4fb1c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Jul 2018 13:43:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Jul 2018 13:43:36 +0900    

Click here for diff

Depending on the platform used, this can cause a crash in the worst  
case, or an unhelpful error message, so fail gracefully.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1807262302550.29874@lancre  
Backpatch: 11-, where hash() has been added in pgbench.  

M src/bin/pgbench/exprparse.y
M src/bin/pgbench/t/002_pgbench_no_server.pl

Provide plpgsql tests for cases involving record field changes.

commit   : c606f10ff832fc54258bb8a259a8e0daa46468ee    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 18:18:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 18:18:37 -0400    

Click here for diff

We suppressed one of these test cases in commit feb1cc559 because  
it was failing to produce the expected results on CLOBBER_CACHE_ALWAYS  
buildfarm members.  But now we need another test with similar behavior,  
so let's set up a test file that is expected to vary between regular and  
CLOBBER_CACHE_ALWAYS cases, and provide variant expected files.  
  
Someday we should fix plpgsql's failure for change-of-field-type, and  
then the discrepancy will go away and we can fold these tests back  
into plpgsql_record.sql.  But today is not that day.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_cache.out
A src/pl/plpgsql/src/expected/plpgsql_cache_1.out
M src/pl/plpgsql/src/expected/plpgsql_record.out
A src/pl/plpgsql/src/sql/plpgsql_cache.sql
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Avoid crash in eval_const_expressions if a Param's type changes.

commit   : 9207a64e1496d9be8b7f33f2ac30052c130c61c3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 16:08:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 16:08:45 -0400    

Click here for diff

Since commit 6719b238e it's been possible for the values of plpgsql  
record field variables to be exposed to the planner as Params.  
(Before that, plpgsql never supplied values for such variables during  
planning, so that the problematic code wasn't reached.)  Other places  
that touch potentially-type-mutable Params either cope gracefully or  
do runtime-test-and-ereport checks that the type is what they expect.  
But eval_const_expressions() just had an Assert, meaning that it either  
failed the assertion or risked crashes due to using an incompatible  
value.  
  
In this case, rather than throwing an ereport immediately, we can just  
not perform a const-substitution in case of a mismatch.  This seems  
important for the same reason that the Param fetch was speculative:  
we might not actually reach this part of the expression at runtime.  
  
Test case will follow in a separate commit.  
  
Patch by me, pursuant to bug report from Andrew Gierth.  
Back-patch to v11 where the previous commit appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

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

LLVMJIT: Release JIT context after running ExprContext shutdown callbacks.

commit   : ed7e319eb41361250ccb19379ef206b4a6d866de    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:31:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:31:49 -0700    

Click here for diff

Due to inlining it previously was possible that an ExprContext's  
shutdown callback pointed to a JITed function. As the JIT context  
previously was shut down before the shutdown callbacks were called,  
that could lead to segfaults.  Fix the ordering.  
  
Reported-By: Dmitry Dolgov  
Author: Andres Freund  
Discussion: https://postgr.es/m/CA+q6zcWO7CeAJtHBxgcHn_hj+PenM=tvG0RJ93X1uEJ86+76Ug@mail.gmail.com  
Backpatch: 11-, where JIT compilation was added  

M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c

LLVMJIT: Check for 'noinline' attribute in recursively inlined functions.

commit   : 1cfa69dcd8eff4a9611bf726bb90e89b77922a61    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:23:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:23:59 -0700    

Click here for diff

Previously the attribute was only checked for external functions  
inlined, not "static" functions that had to be inlined as  
dependencies.  
  
This isn't really a bug, but makes debugging a bit harder. The new  
behaviour also makes more sense. Therefore backpatch.  
  
Author: Andres Freund  
Backpatch: 11-, where JIT compilation was added  

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

Pad semaphores to avoid false sharing.

commit   : f2db5f3bb0b5d429e9fa5b093936f8524e4192b1    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 25 Jul 2018 10:58:44 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 25 Jul 2018 10:58:44 +1200    

Click here for diff

In a USE_UNNAMED_SEMAPHORES build, the default on Linux and FreeBSD  
since commit ecb0d20a, we have an array of sem_t objects.  This  
turned out to reduce performance compared to the previous default  
USE_SYSV_SEMAPHORES on an 8 socket system.  Testing showed that the  
lost performance could be regained by padding the array elements so  
that they have their own cache lines.  This matches what we do for  
similar hot arrays (see LWLockPadded, WALInsertLockPadded).  
  
Back-patch to 10, where unnamed semaphores were adopted as the default  
semaphore interface on those operating systems.  
  
Author: Thomas Munro  
Reviewed-by: Andres Freund  
Reported-by: Mithun Cy  
Tested-by: Mithun Cy, Tom Lane, Thomas Munro  
Discussion: https://postgr.es/m/CAD__OugYDM3O%2BdyZnnZSbJprSfsGFJcQ1R%3De59T3hcLmDug4_w%40mail.gmail.com  

M src/backend/port/posix_sema.c

doc: Fix reference to "decoder" to instead be the correct "output plugin".

commit   : e0a2a4c87f22a9031fd5af7ca70fa76809609c12    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 24 Jul 2018 10:51:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 24 Jul 2018 10:51:06 -0700    

Click here for diff

Author: Jonathan Katz  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where logical decoding was added  

M doc/src/sgml/test-decoding.sgml

psql: Add option for procedures to \df

commit   : 07055a2c8cbfb772d3c7c114cfe12dddae0f90fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 14 Jul 2018 12:17:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 14 Jul 2018 12:17:49 +0200    

Click here for diff

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Fix calculation for WAL segment recycling and removal

commit   : 9915735ebbc5c5362f5834f6ad7b86394ded4a85    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Jul 2018 10:33:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Jul 2018 10:33:07 +0900    

Click here for diff

Commit 4b0d28de06 has removed the prior checkpoint and related  
facilities but has left WAL recycling based on the LSN of the prior  
checkpoint, which causes incorrect calculations for WAL removal and  
recycling for max_wal_size and min_wal_size.  This commit changes things  
so as the base calculation point is the last checkpoint generated.  
  
Reported-by: Kyotaro Horiguchi  
Author: Kyotaro Horiguchi  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where the prior checkpoint has been removed.  

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

pgbench: Remove duplicate entries from table of builtin functions.

commit   : 14ca287bcf329b26a6a8041ba69cc12332aba22c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 23 Jul 2018 11:48:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 23 Jul 2018 11:48:38 -0400    

Click here for diff

Fabien Coelho  
  
Discussion: http://postgr.es/m/alpine.DEB.2.21.1807221822320.19939@lancre  

M src/bin/pgbench/exprparse.y

LLVMJIT: Adapt to API changes in gdb and perf support.

commit   : 1b957e59b92dc44c14708762f882d7910463a9ac    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:13:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:13:20 -0700    

Click here for diff

During the work of upstreaming my previous patches for gdb and perf  
support the API changed. Adapt.  Normally this wouldn't necessarily be  
something to backpatch, but the previous API wasn't upstream, and at  
least the gdb support is quite useful for debugging.  
  
Author: Andres Freund  
Backpatch: 11, where LLVM based JIT support was added.  

M config/llvm.m4
M configure
M src/backend/jit/llvm/llvmjit.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

LLVMJIT: Fix LLVM build for LLVM > 7.

commit   : 9820f5c41edfd17abc4faab80e54bbd933817d01    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:05:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:05:06 -0700    

Click here for diff

The location of LLVMAddPromoteMemoryToRegisterPass moved.  
  
Author: Andres Freund  
Backpatch: 11, where LLVM based JIT support was added.  

M src/backend/jit/llvm/llvmjit.c

Reset context at the tail end of JITed EEOP_AGG_PLAIN_TRANS.

commit   : 0171ad9308ac232d5934d548a2adc898b794c5e0    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 20:31:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 20:31:22 -0700    

Click here for diff

While no negative consequences are currently known, it's clearly wrong  
to not reset the context in one of the branches.  
  
Reported-By: Dmitry Dolgov  
Author: Dmitry Dolgov  
Discussion: https://postgr.es/m/CAGPqQf165-=+Drw3Voim7M5EjHT1zwPF9BQRjLFQzCzYnNZEiQ@mail.gmail.com  
Backpatch: 11-, where JIT compilation support was added  

M src/backend/jit/llvm/llvmjit_expr.c

Fix JITed EEOP_AGG_INIT_TRANS, which missed some state.

commit   : a9a0a4d3f88b87564533b87af64d3282ca417dc6    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 16:47:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 16:47:00 -0700    

Click here for diff

The JIT compiled implementation missed maintaining  
AggState->{current_set,curaggcontext}. That could lead to trouble  
because the transition value could be allocated in the wrong context.  
  
Reported-By: Rushabh Lathia  
Diagnosed-By: Dmitry Dolgov  
Author: Dmitry Dolgov, with minor changes by me  
Discussion: https://postgr.es/m/CAGPqQf165-=+Drw3Voim7M5EjHT1zwPF9BQRjLFQzCzYnNZEiQ@mail.gmail.com  
Backpatch: 11-, where JIT compilation support was added  

M src/backend/jit/llvm/llvmjit_expr.c

Further portability hacking in pg_upgrade's test script.

commit   : 04e3492c5c46822c756f575d6105a8a6ff76d4f2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 15:40:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 15:40:51 -0400    

Click here for diff

I blew the dust off a Bourne shell (file date 1996, yea verily) and  
tried to run test.sh with it.  It mostly worked, but I found that the  
temp-directory creation code introduced by commit be76a6d39 was not  
compatible, for a couple of reasons: this shell thinks "set -e" should  
force an exit if a command within backticks fails, and it also thinks code  
within braces should be executed by a sub-shell, meaning that variable  
settings don't propagate back up to the parent shell.  In view of Victor  
Wagner's report that Solaris is still using pre-POSIX shells, seems like  
we oughta make this case work.  It's not like the code is any less  
idiomatic this way; the prior coding technique appeared nowhere else.  
  
(There is a remaining bash-ism here, which is that $RANDOM doesn't do  
what the code hopes in non-bash shells.  But the use of $$ elsewhere in  
that path should be enough to ensure uniqueness and some amount of  
randomness, so I think it's okay as-is.)  
  
Back-patch to all supported branches, as the previous commit was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Be more paranoid about quoting in pg_upgrade's test script.

commit   : 5e5d131202c3494f4360f001b4805c8944e9600c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 12:05:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 12:05:25 -0400    

Click here for diff

Double-quote $PGDATA in "find" commands introduced by commit da9b580d8,  
in case that path contains spaces or other special characters.  
  
Adjust a few other places so that quoting is done more consistently.  
None of the others are actual bugs AFAICS, but it's confusing to readers  
if the same thing is done differently in different places.  
  
Noted by Tels.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Avoid unportable shell syntax in pg_upgrade's test script.

commit   : e6105686dcfa5b3b0a3937f9b6c4d44a865adc17    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Jul 2018 13:59:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Jul 2018 13:59:27 -0400    

Click here for diff

Most of test.sh uses traditional backtick syntax for command substitution,  
but commit da9b580d8 introduced two uses of $(...) syntax, which is not  
recognized by very old shells.  Bring those into line with the rest.  
  
Victor Wagner  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Guard against rare RAND_bytes() failures in pg_strong_random().

commit   : 1f919e663ee20430dfde5614a025ac2dbd0f4bfb    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 20 Jul 2018 08:57:08 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 20 Jul 2018 08:57:08 +0100    

Click here for diff

When built using OpenSSL, pg_strong_random() uses RAND_bytes() to  
generate the random number. On very rare occasions that can fail, if  
its PRNG has not been seeded with enough data. Additionally, once it  
does fail, all subsequent calls will also fail until more seed data is  
added. Since this is required during backend startup, this can result  
in all new backends failing to start until a postmaster restart.  
  
Guard against that by checking the state of OpenSSL's PRNG using  
RAND_status(), and if necessary (very rarely), seeding it using  
RAND_poll().  
  
Back-patch to v10, where pg_strong_random() was introduced.  
  
Dean Rasheed and Michael Paquier.  
  
Discussion: https://postgr.es/m/CAEZATCXMtxbzSAvyKKk5uCRf9pNt4UV%2BF_5v%3DgLfJUuPxU4Ytg%40mail.gmail.com  

M src/port/pg_strong_random.c

Fix handling of empty uncompressed posting list pages in GIN

commit   : 608793266dbbc4f9064e6737ab3363adf9584892    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 19 Jul 2018 21:04:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 19 Jul 2018 21:04:17 +0300    

Click here for diff

PostgreSQL 9.4 introduces posting list compression in GIN.  This feature  
supports online upgrade, so that after pg_upgrade uncompressed posting  
lists are compressed on-the-fly.  Underlying code appears to always  
expect at least one item on uncompressed posting list page.  But there  
could be completely empty pages, because VACUUM never deletes leftmost  
and rightmost pages from posting trees.  This commit fixes that.  
  
Reported-by: Sivasubramanian Ramasubramanian  
Discussion: https://postgr.es/m/1531867212836.63354%40amazon.com  
Author: Sivasubramanian Ramasubramanian, Alexander Korotkov  
Backpatch-through: 9.4  

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

Remove undocumented restriction against duplicate partition key columns.

commit   : b1af4bcc42f7e95abb9e8bceb894e0ef2acfc55a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 15:41:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 15:41:46 -0400    

Click here for diff

transformPartitionSpec rejected duplicate simple partition columns  
(e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression  
columns, resulting in inconsistent behavior.  Worse, cases like  
"PARTITION BY RANGE (x,(x))") were accepted but would then result in  
dump/reload failures, since the expression (x) would get simplified  
to a plain column later.  
  
There seems no better reason for this restriction than there was for  
the one against duplicate included index columns (cf commit 701fd0bbc),  
so let's just remove it.  
  
Back-patch to v10 where this code was added.  
  
Report and patch by Yugo Nagata.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve psql's \d command to show whether index columns are key columns.

commit   : f4a5ce359587257c6d14b8e746889077c649439a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 14:53:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 14:53:41 -0400    

Click here for diff

This is essential information when looking at an index that has  
"included" columns.  Per discussion, follow the style used in \dC  
and some other places: column header is "Key?" and values are "yes"  
or "no" (all translatable).  
  
While at it, revise describeOneTableDetails to be a bit more maintainable:  
avoid hard-wired column numbers and multiple repetitions of what needs  
to be identical test logic.  This also results in the emitted catalog  
query corresponding more closely to what we print, which should be a  
benefit to users of ECHO_HIDDEN mode, and perhaps a bit faster too  
(the old logic sometimes asked for values it would not print, even  
ones that are fairly expensive to get).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/index_including.out
M src/test/regress/output/tablespace.source

Fix pg_get_indexdef()'s behavior for included index columns.

commit   : 0f49a2de96e7b58e15899b2639e096b771e45886    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 13:48:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 13:48:05 -0400    

Click here for diff

The multi-argument form of pg_get_indexdef() failed to print anything when  
asked to print a single index column that is an included column rather than  
a key column.  This seems an unintentional result of someone having tried  
to take a short-cut and use the attrsOnly flag for two different purposes.  
To fix, split said flag into two flags, attrsOnly which suppresses  
non-attribute info, and keysOnly which suppresses included columns.  
Add a test case using psql's \d command, which relies on that function.  
  
(It's mighty tempting at this point to replace pg_get_indexdef_worker's  
mess of boolean flag arguments with a single bitmask-of-flags argument,  
which would allow making the call sites much more self-documenting.  
But I refrained for the moment.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rewrite comments in replication slot advance implementation

commit   : 96bd49437cca5d7a6e4024c602a9fdbdbf7c7433    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jul 2018 14:15:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jul 2018 14:15:44 -0400    

Click here for diff

The code added by 9c7d06d60680 was a bit obscure; clarify that by  
rewriting the comments.  Lack of clarity has already caused bugs, so  
it's a worthy goal.  
  
Co-authored-by: Arseny Sher <[email protected]>  
Co-authored-by: MichaĆ«l Paquier <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Petr JelĆ­nek <[email protected]>  
Discussion: https://postgr.es/m/87y3fgoyrn.fsf@ars-thinkpad  

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

Fix error message when a hostaddr cannot be parsed.

commit   : dc961e5822343c8b22371a78ded4d6263418de61    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 20:24:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 20:24:29 +0300    

Click here for diff

We were incorrectly passing hostname, not hostaddr, in the error message,  
and because of that, you got:  
  
$ psql 'hostaddr=foo'  
psql: could not parse network address "(null)": Name or service not known  
  
Backpatch to v10, where this was broken (by commit 7b02ba62e9).  
  
Report and fix by Robert Haas.  
  
Discussion: https://www.postgresql.org/message-id/CA+TgmoapFQA30NomGKEaZCu3iN7mF7fux8fbbk9SouVOT2JP7w@mail.gmail.com  

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

Rephrase a few comments for clarity.

commit   : 45fcd758a07fef44a8773202b13f469c9636dffc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 16:08:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 16:08:09 +0300    

Click here for diff

I was confused by what "intended to be parallel serially" meant, until  
Robert Haas and David G. Johnston explained it. Rephrase the comment to  
make it more clear, using David's suggested wording.  
  
Discussion: https://www.postgresql.org/message-id/1fec9022-41e8-e484-70ce-2179b08c2092%40iki.fi  

M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSeqscan.c

Fix print of Path nodes when using OPTIMIZER_DEBUG

commit   : bc62aef53d686b282f164277da0f2405a4fd0ac3    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:55:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:55:02 +0900    

Click here for diff

GatherMergePath (introduced in 10) and CustomPath (introduced in 9.5)  
have gone missing.  The order of the Path nodes was inconsistent with  
what is listed in nodes.h, so make the order consistent at the same time  
to ease future checks and additions.  
  
Author: Sawada Masahiko  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAD21AoBQMLoc=ohH-oocuAPsELrmk8_EsRJjOyR8FQLZkbE0wA@mail.gmail.com  

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

Fix re-parameterize of MergeAppendPath

commit   : 6365ebacdd08f988cd31572c7190c8f08194bf5d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:02:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:02:09 +0900    

Click here for diff

Instead of MergeAppendPath, MergeAppend nodes were considered.  This  
code is not covered by any tests now, which should be addressed at some  
point.  
  
This is an oversight from f49842d, which introduced partition-wise joins  
in v11, so back-patch down to that.  
  
Author: Michael Paquier  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

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

Remove race-prone hot_standby_feedback test cases in 001_stream_rep.pl.

commit   : ade18277a0dc6a5981f8c189ed7743b48d3a1516    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 17:39:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 17:39:27 -0400    

Click here for diff

This script supposed that if it turned hot_standby_feedback on and then  
shut down the standby server, at least one feedback message would be  
guaranteed to be sent before the standby stops.  But there is no such  
guarantee, if the standby's walreceiver process is slow enough --- and  
we've seen multiple failures in the buildfarm showing that that does  
happen in practice.  While we could rearrange the walreceiver logic to  
make it less likely, it seems probably impossible to create a really  
bulletproof guarantee of that sort; and if we tried, we might create  
situations where the walreceiver wouldn't react in a timely manner to  
shutdown commands.  It seems better instead to remove the script's  
assumption that feedback will occur before shutdown.  
  
But once we do that, these last few tests seem quite redundant with  
the earlier tests in the script.  So let's just drop them altogether  
and save some buildfarm cycles.  
  
Backpatch to v10 where these tests were added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Drop the rule against included index columns duplicating key columns.

commit   : eb00eb4e8c529ee0783c1b3052cfa736d457cbb5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 14:43:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 14:43:03 -0400    

Click here for diff

The initial version of the included-index-column feature stated that  
included columns couldn't be the same as any key column of the index.  
While it'd be pretty silly to do that, since the included column would be  
entirely redundant, we've never prohibited redundant index columns before  
so it's not very consistent to do so here.  Moreover, the prohibition  
was itself badly implemented, so that it failed to reject columns that  
were effectively identical but not spelled quite alike, as reported by  
Aditya Toshniwal.  
  
(Moreover, it's not hard to imagine that for some non-btree index types,  
such cases would be non-silly anyhow: the index might use a lossy  
representation for key columns but be able to support retrieval of the  
original form of included columns.)  
  
Hence, let's just drop the prohibition.  
  
In passing, do some copy-editing on the documentation for the  
included-column feature.  
  
Yugo Nagata; documentation and test corrections by me  
  
Discussion: https://postgr.es/m/CAM9w-_mhBCys4fQNfaiQKTRrVWtoFrZ-wXmDuE9Nj5y-Y7aDKQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/indexcmds.c
M src/test/regress/expected/index_including.out
M src/test/regress/sql/index_including.sql

Fix misc typos, mostly in comments.

commit   : 65976cd86a9bdeec5a5277545e5efa33724102c8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Jul 2018 16:10:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Jul 2018 16:10:44 +0300    

Click here for diff

A collection of typos I happened to spot while reading code, as well as  
grepping for common mistakes.  
  
Backpatch to all supported versions, as applicable, to avoid conflicts  
when backporting other commits in the future.  

M contrib/bloom/blscan.c
M doc/src/sgml/protocol.sgml
M doc/src/sgml/spi.sgml
M src/backend/access/transam/multixact.c
M src/backend/commands/cluster.c
M src/backend/commands/explain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_func.c
M src/backend/replication/logical/origin.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_upgrade/tablespace.c
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/port/pg_bswap.h
M src/include/storage/latch.h
M src/include/utils/rel.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/preproc/parse.pl
M src/pl/tcl/pltcl.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql

doc: move PARTITION OF stanza to just below PARTITION BY

commit   : 07f303ab6076c10e36ebcf46155e6ca66fcfe56e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jul 2018 00:54:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jul 2018 00:54:53 -0400    

Click here for diff

It's more logical this way, since the new ordering matches the way the  
tables are created; but in any case, the previous location of PARTITION OF  
did not appear carefully chosen anyway (since it didn't match the  
location in which it appears in the synopsys either, which is what we  
normally do.)  
  
In the PARTITION BY stanza, add a link to the partitioning section in  
the DDL chapter, too.  
  
Suggested-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwY4Ld7ecxL_KAmaxwt0FUu5VcPPN2L4dh+3BeYbrdBa5g@mail.gmail.com  

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

Fix ALTER TABLE...SET STATS error message for included columns

commit   : 802b04cb3fadeb381001611f3ffa3c2762bdcc25    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 20:00:24 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 20:00:24 -0400    

Click here for diff

The existing error message was complaining that the column is not an  
expression, which is not correct.  Introduce a suitable wording  
variation and a test.  
  
Co-authored-by: Yugo Nagata <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Ɓlvaro Herrera <[email protected]>  

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

Fix partition pruning with IS [NOT] NULL clauses

commit   : fb2b61a21e141843697de7982c9f6485effcd915    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 18:38:09 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 18:38:09 -0400    

Click here for diff

The original code was unable to prune partitions that could not possibly  
contain NULL values, when the query specified less than all columns in a  
multicolumn partition key.  Reorder the if-tests so that it is, and add  
more commentary and regression tests.  
  
Reported-by: Ashutosh Bapat <[email protected]>  
Co-authored-by: Dilip Kumar <[email protected]>  
Co-authored-by: Amit Langote <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Reviewed-by: amul sul <[email protected]>  
Discussion: https://postgr.es/m/CAFjFpRc7qjLUfXLVBBC_HAnx644sjTYM=qVoT3TJ840HPbsTXw@mail.gmail.com  

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

Add subtransaction handling for table synchronization workers.

commit   : 9ec9f8f6833db5bafc30c480f96f06bdf5c012e6    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 Jul 2018 17:33:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 Jul 2018 17:33:22 -0400    

Click here for diff

Since the old logic was completely unaware of subtransactions, a  
change made in a subsequently-aborted subtransaction would still cause  
workers to be stopped at toplevel transaction commit.  Fix that by  
managing a stack of worker lists rather than just one.  
  
Amit Khandekar and Robert Haas  
  
Discussion: http://postgr.es/m/CAJ3gD9eaG_mWqiOTA2LfAug-VRNn1hrhf50Xi1YroxL37QkZNg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/replication/logical/launcher.c
M src/include/replication/logicallauncher.h
M src/tools/pgindent/typedefs.list

doc: Update redirecting links

commit   : e716dc3fc4cdfbc53d65e93ab9c6600c32f824ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jul 2018 10:44:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jul 2018 10:44:06 +0200    

Click here for diff

Update links that resulted in redirects.  Most are changes from http to  
https, but there are also some other minor edits.  (There are still some  
redirects where the target URL looks less elegant than the one we  
currently have.  I have left those as is.)  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/passwordcheck.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/release.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/wal.sgml
M src/backend/lib/bipartite_match.c
M src/backend/utils/adt/numeric.c
M src/bin/pgbench/pgbench.c

Fix hashjoin costing mistake introduced with inner_unique optimization.

commit   : 704e393190725f54ddaaaee2cda1a6f3a26bff6d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Jul 2018 11:59:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Jul 2018 11:59:12 -0400    

Click here for diff

In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases  
to follow a code path previously used only for SEMI/ANTI joins; but it  
neglected to fix an if-test within that path that assumed SEMI and ANTI  
were the only possible cases.  This resulted in a wrong value for  
hashjointuples, and an ensuing bad cost estimate, for inner_unique normal  
joins.  Fortunately, for inner_unique normal joins we can assume the number  
of joined tuples is the same as for a SEMI join; so there's no need for  
more code, we just have to invert the test to check for ANTI not SEMI.  
  
It turns out that in two contrib tests in which commit 9c7f5229a  
changed the plan expected for a query, the change was actually wrong  
and induced by this estimation error, not by any real improvement.  
Hence this patch also reverts those changes.  
  
Per report from RK Korlapati.  Backpatch to v10 where the error was  
introduced.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CA+SNy03bhq0fodsfOkeWDCreNjJVjsdHwUsb7AG=jpe0PtZc_g@mail.gmail.com  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/path/costsize.c

Fix crash in contrib/ltree's lca() function for empty input array.

commit   : dbd7f4e7c433b4fc202e9520d2bd360200f07805    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 18:45:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 18:45:30 -0400    

Click here for diff

lca_inner() wasn't prepared for the possibility of getting no inputs.  
Fix that, and make some cosmetic improvements to the code while at it.  
  
Also, I thought the documentation of this function as returning the  
"longest common prefix" of the paths was entirely misleading; it really  
returns a path one shorter than the longest common prefix, for the typical  
definition of "prefix".  Don't use that term in the docs, and adjust the  
examples to clarify what really happens.  
  
This has been broken since its beginning, so back-patch to all supported  
branches.  
  
Per report from Hailong Li.  Thanks to Pierre Ducroquet for diagnosing  
and for the initial patch, though I whacked it around some and added  
test cases.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_op.c
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Update documentation editor setup instructions

commit   : bc4e355f013d6122e4ae17fa99e9db20babbb86a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jul 2018 21:23:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jul 2018 21:23:41 +0200    

Click here for diff

Now that the documentation sources are in XML rather than SGML, some of  
the documentation about the editor, or more specifically Emacs, setup  
needs updating.  The updated instructions recommend using nxml-mode,  
which works mostly out of the box, with some small tweaks in  
emacs.samples and .dir-locals.el.  
  
Also remove some obsolete stuff in .dir-locals.el.  I did, however,  
leave the sgml-mode settings in there so that someone using Emacs  
without emacs.samples gets those settings when editing a *.sgml file.  

M .dir-locals.el
M doc/src/sgml/docguide.sgml
M src/tools/editors/emacs.samples

Fix crash in json{b}_populate_recordset() and json{b}_to_recordset().

commit   : 9a5e8ed283e583782b3f40e6ededcb005d5c0333    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 14:16:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 14:16:47 -0400    

Click here for diff

As of commit 37a795a60, populate_recordset_worker() tried to pass back  
(as rsi.setDesc) a tupdesc that it also had cached in its fn_extra.  
But the core executor would free the passed-back tupdesc, risking a  
crash if the function were called again in the same query.  The safest  
and least invasive way to fix that is to make an extra tupdesc copy  
to pass back.  
  
While at it, I failed to resist the temptation to get rid of unnecessary  
get_fn_expr_argtype() calls here and in populate_record_worker().  
  
Per report from Dmitry Dolgov; thanks to Michael Paquier and  
Andrew Gierth for investigation and discussion.  
  
Discussion: https://postgr.es/m/CA+q6zcWzN9ztCfR47ZwgTr1KLnuO6BAY6FurxXhovP4hxr+yOQ@mail.gmail.com  

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

Dump foreign keys on partitioned tables

commit   : 2af39c39df94096ecc593f5a162947e1e994cab3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Jul 2018 13:13:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Jul 2018 13:13:26 -0400    

Click here for diff

The patch that ended up as commit 3de241dba86f ("Foreign keys on  
partitioned tables") lacked pg_dump tests, so the pg_dump code that was  
there to support it inadvertently stopped working when in later  
development I modified the backend code not to emit pg_trigger rows for  
the partitioned table itself.  
  
Bug analysis and code fix is by Michaƫl.  I (Ɓlvaro) added the test.  
  
Reported-by: amul sul <[email protected]>  
Co-authored-by: MichaĆ«l Paquier <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CAAJ_b94n=UsNVhgs97vCaWEZAMe-tGDRVuZ73oePQH=eaJKGSA@mail.gmail.com  

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

Fix inadequate buffer locking in FSM and VM page re-initialization.

commit   : 5586e42b349346df5d88f71a5a41d8cb76b8c491    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 11:52:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 11:52:50 -0400    

Click here for diff

When reading an existing FSM or VM page that was found to be corrupt by the  
buffer manager, the code applied PageInit() to reinitialize the page, but  
did so without any locking.  There is thus a hazard that two backends might  
concurrently do PageInit, which in itself would still be OK, but the slower  
one might then zero over subsequent data changes applied by the faster one.  
Even that is unlikely to be fatal; but it's not desirable, so add locking  
to prevent it.  
  
This does not add any locking overhead in the normal code path where the  
page is OK.  It's not immediately obvious that that's safe, but I believe  
it is, for reasons explained in the added comments.  
  
Problem noted by R P Asim.  It's been like this for a long time, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CANXE4Te4G0TGq6cr0-TvwP0H4BNiK_-hB5gHe8mF+nz0mcYfMQ@mail.gmail.com  

M src/backend/access/heap/visibilitymap.c
M src/backend/storage/freespace/freespace.c

docs: Remove "New" description of the libpqxx interface

commit   : 4980f51845278afba8d382c3b294741c3efed168    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 13 Jul 2018 11:16:56 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 13 Jul 2018 11:16:56 -0400    

Click here for diff

Backpatch-through: 9.3  

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

Prohibit transaction commands in security definer procedures

commit   : 3804e89bd0e94fb412d3eecb2113cc97e0f7310b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 09:26:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 09:26:19 +0200    

Click here for diff

Starting and aborting transactions in security definer procedures  
doesn't work.  StartTransaction() insists that the security context  
stack is empty, so this would currently cause a crash, and  
AbortTransaction() resets it.  This could be made to work by  
reorganizing the code, but right now we just prohibit it.  
  
Reported-by: amul sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b96Gupt_LFL7uNyy3c50-wbhA68NUjiK5%3DrF6_w%3Dpq_T%3DQ%40mail.gmail.com  

M doc/src/sgml/ref/create_procedure.sgml
M src/backend/commands/functioncmds.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Reset shmem_exit_inprogress after shmem_exit()

commit   : 39035a52894a419ae1b905adfdb0bad72ee19a36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jul 2018 20:22:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jul 2018 20:22:17 +0200    

Click here for diff

In ad9a274778d2d88c46b90309212b92ee7fdf9afe, shmem_exit_inprogress was  
introduced.  But we need to reset it after shmem_exit(), because unlike  
the similar proc_exit(), shmem_exit() can also be called for cleanup  
when the process will not exit.  
  
Reported-by: Andrew Gierth <[email protected]>  

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

Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

commit   : aacdf9a06966d57bb8f6968a41e0690a31d35a51    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 12:28:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 12:28:43 -0400    

Click here for diff

Explain that you can use any integer expression for the "count" in  
pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only  
allow a constant.  
  
Remove the duplicate version of this para under MOVE.  I don't see  
a good reason to maintain two identical paras when we just said that  
MOVE works exactly like FETCH.  
  
Per Pavel Stehule, though I didn't use his text.  
  
Discussion: https://postgr.es/m/CAFj8pRAcvSXcNdUGx43bOK1e3NNPbQny7neoTLN42af+8MYWEA@mail.gmail.com  

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

Fix FK checks of TRUNCATE involving partitioned tables

commit   : 727196ced2423008bb25d7775c4e3b7fca063c8b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Jul 2018 12:09:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Jul 2018 12:09:08 -0400    

Click here for diff

When truncating a table that is referenced by foreign keys in  
partitioned tables, the check to ensure the referencing table are also  
truncated spuriously failed.  This is because it was relying on  
relhastriggers as a proxy for the table having FKs, and that's wrong for  
partitioned tables.  Fix it to consider such tables separately.  There  
may be a better way ... but this code is pretty inefficient already.  
  
Author: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Michael PaquiĆ«r <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/truncate.out
M src/test/regress/sql/truncate.sql

Doc: clarify release note text about v11's new window function features.

commit   : 510421c45fb41869969a708a8c03c12798a724ec    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:13:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:13:41 -0400    

Click here for diff

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

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

Doc: update documentation for requirement of ORDER BY in GROUPS mode.

commit   : 663060e8c3832ea8388e4ae128420f76680e5fe9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:10:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:10:24 -0400    

Click here for diff

Commit ff4f88916 adjusted the code to enforce the SQL spec's requirement  
that a window using GROUPS mode must have an ORDER BY clause.  But I missed  
that the documentation explicitly said you didn't have to have one.  
  
Also minor wordsmithing in the window-function section of select.sgml.  
  
Per Masahiko Sawada, though I didn't use his patch.  

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

Allow using the updated tuple while moving it to a different partition.

commit   : 0527df732beb8c2d584c7e4ea5aeb05cf92e14a2    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 12 Jul 2018 12:17:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 12 Jul 2018 12:17:27 +0530    

Click here for diff

An update that causes the tuple to be moved to a different partition was  
missing out on re-constructing the to-be-updated tuple, based on the latest  
tuple in the update chain.  Instead, it's simply deleting the latest tuple  
and inserting a new tuple in the new partition based on the old tuple.  
Commit 2f17844104 didn't consider this case, so some of the updates were  
getting lost.  
  
In passing, change the argument order for output parameter in ExecDelete  
and add some commentary about it.  
  
Reported-by: Pavan Deolasee  
Author: Amit Khandekar, with minor changes by me  
Reviewed-by: Dilip Kumar, Amit Kapila and Alvaro Herrera  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAJ3gD9fRbEzDqdeDq1jxqZUb47kJn+tQ7=Bcgjc8quqKsDViKQ@mail.gmail.com  

M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h
A src/test/isolation/expected/partition-key-update-4.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-key-update-4.spec

Make logical WAL sender report streaming state appropriately

commit   : 0414ac6a1eb2e457c8019c5a558bd72b37dede89    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 10:19:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 10:19:51 +0900    

Click here for diff

WAL senders sending logically-decoded data fail to properly report in  
"streaming" state when starting up, hence as long as one extra record is  
not replayed, such WAL senders would remain in a "catchup" state, which  
is inconsistent with the physical cousin.  
  
This can be easily reproduced by for example using pg_recvlogical and  
restarting the upstream server.  The TAP tests have been slightly  
modified to detect the failure and strengthened so as future tests also  
make sure that a node is in streaming state when waiting for its  
catchup.  
  
Backpatch down to 9.4 where this code has been introduced.  
  
Reported-by: Sawada Masahiko  
Author: Simon Riggs, Sawada Masahiko  
Reviewed-by: Petr Jelinek, Michael Paquier, Vaishnavi Prabakaran  
Discussion: https://postgr.es/m/CAD21AoB2ZbCCqOx=bgKMcLrAvs1V0ZMqzs7wBTuDySezTGtMZA@mail.gmail.com  

M src/backend/replication/walsender.c
M src/test/perl/PostgresNode.pm
M src/test/subscription/t/001_rep_changes.pl

Fix create_scan_plan's handling of sortgrouprefs for physical tlists.

commit   : 5b762d96e8c602434bc7e56f910c23c54e95f80d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 15:25:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 15:25:28 -0400    

Click here for diff

We should only run apply_pathtarget_labeling_to_tlist if CP_LABEL_TLIST  
was specified, because only in that case has use_physical_tlist checked  
that the labeling will succeed; otherwise we may get an "ORDER/GROUP BY  
expression not found in targetlist" error.  (This subsumes the previous  
test about gating_clauses, because we reset "flags" to zero earlier  
if there are gating clauses to apply.)  
  
The only known case in which a failure can occur is with a ProjectSet  
path directly atop a table scan path, although it seems likely that there  
are other cases or will be such in future.  This means that the failure  
is currently only visible in the v10 branch: 9.6 didn't have ProjectSet,  
while in v11 and HEAD, apply_scanjoin_target_to_paths for some weird  
reason is using create_projection_path not apply_projection_to_path,  
masking the problem because there's a ProjectionPath in between.  
  
Nonetheless this code is clearly wrong on its own terms, so back-patch  
to 9.6 where this logic was introduced.  
  
Per report from Regina Obe.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

Fix bugs with degenerate window ORDER BY clauses in GROUPS/RANGE mode.

commit   : 8893d48e7fbfacb77fee0080faf7b4228c33ce35    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 12:07:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 12:07:21 -0400    

Click here for diff

nodeWindowAgg.c failed to cope with the possibility that no ordering  
columns are defined in the window frame for GROUPS mode or RANGE OFFSET  
mode, leading to assertion failures or odd errors, as reported by Masahiko  
Sawada and Lukas Eder.  In RANGE OFFSET mode, an ordering column is really  
required, so add an Assert about that.  In GROUPS mode, the code would  
work, except that the node initialization code wasn't in sync with the  
execution code about when to set up tuplestore read pointers and spare  
slots.  Fix the latter for consistency's sake (even though I think the  
changes described below make the out-of-sync cases unreachable for now).  
  
Per SQL spec, a single ordering column is required for RANGE OFFSET mode,  
and at least one ordering column is required for GROUPS mode.  The parser  
enforced the former but not the latter; add a check for that.  
  
We were able to reach the no-ordering-column cases even with fully spec  
compliant queries, though, because the planner would drop partitioning  
and ordering columns from the generated plan if they were redundant with  
earlier columns according to the redundant-pathkey logic, for instance  
"PARTITION BY x ORDER BY y" in the presence of a "WHERE x=y" qual.  
While in principle that's an optimization that could save some pointless  
comparisons at runtime, it seems unlikely to be meaningful in the real  
world.  I think this behavior was not so much an intentional optimization  
as a side-effect of an ancient decision to construct the plan node's  
ordering-column info by reverse-engineering the PathKeys of the input  
path.  If we give up redundant-column removal then it takes very little  
code to generate the plan node info directly from the WindowClause,  
ensuring that we have the expected number of ordering columns in all  
cases.  (If anyone does complain about this, the planner could perhaps  
be taught to remove redundant columns only when it's safe to do so,  
ie *not* in RANGE OFFSET mode.  But I doubt anyone ever will.)  
  
With these changes, the WindowAggPath.winpathkeys field is not used for  
anything anymore, so remove it.  
  
The test cases added here are not actually very interesting given the  
removal of the redundant-column-removal logic, but they would represent  
important corner cases if anyone ever tries to put that back.  
  
Tom Lane and Masahiko Sawada.  Back-patch to v11 where RANGE OFFSET  
and GROUPS modes were added.  
  
Discussion: https://postgr.es/m/CAD21AoDrWqycq-w_+Bx1cjc+YUhZ11XTj9rfxNiNDojjBx8Fjw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeWindowAgg.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_clause.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Block replication slot advance for these not yet reserving WAL

commit   : 9069eb95f48c8200f8589faf7adc5e324eed25cd    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Jul 2018 08:57:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Jul 2018 08:57:18 +0900    

Click here for diff

Such replication slots are physical slots freshly created without WAL  
being reserved, which is the default behavior, which have not been used  
yet as WAL consumption resources to retain WAL.  This prevents advancing  
a slot to a position older than any WAL available, which could falsify  
calculations for WAL segment recycling.  
  
This also cleans up a bit the code, as ReplicationSlotRelease() would be  
called on ERROR, and improves error messages.  
  
Reported-by: Kyotaro Horiguchi  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Ɓlvaro Herrera, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/catalogs.sgml
M src/backend/replication/slotfuncs.c

Better handle pseudotypes as partition keys

commit   : e7df94f317c979ad176adc0155a3e8af63e68ac9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Jul 2018 15:07:28 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Jul 2018 15:07:28 -0400    

Click here for diff

We fail to handle polymorphic types properly when they are used as  
partition keys: we were unnecessarily adding a RelabelType node on top,  
which confuses code examining the nodes.  In particular, this makes  
predtest.c-based partition pruning not to work, and ruleutils.c to emit  
expressions that are uglier than needed.  Fix it by not adding RelabelType  
when not needed.  
  
In master/11 the new pruning code is separate so it doesn't suffer from  
this problem, since we already fixed it (in essentially the same way) in  
e5dcbb88a15d, which also added a few tests; back-patch those tests to  
pg10 also.  But since UPDATE/DELETE still uses predtest.c in pg11, this  
change improves partitioning for those cases too.  Add tests for this.  
The ruleutils.c behavior change is relevant in pg11/master too.  
  
Co-authored-by: Amit Langote <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typos

commit   : 4cf30f6fdeed4977dfe52bf1d4fda74c883d3760    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 11:14:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 11:14:53 +0200    

Click here for diff

M config/c-compiler.m4
M src/include/pg_config.h.in

Fix typo

commit   : 1287c051723261ac197d3cb0d3c753b045908202    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 22:13:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 22:13:16 +0200    

Click here for diff

M config/c-compiler.m4
M src/include/pg_config.h.in

Avoid emitting a bogus WAL record when recycling an all-zero btree page.

commit   : cfcfbd39b182c989b59c7b3787e7d528ef9b29ce    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 19:26:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 19:26:19 -0400    

Click here for diff

Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for  
a page that it was about to recycle.  However, it failed to distinguish  
all-zero pages from dead pages, which is important because only the  
latter have valid btpo.xact values, or indeed any special space at all.  
Recycling an all-zero page with XLogStandbyInfoActive() enabled therefore  
led to an Assert failure, or to emission of a WAL record containing a  
bogus cutoff XID, which might lead to unnecessary query cancellations  
on hot standby servers.  
  
Per reports from Antonin Houska and č‡Ŗå·±.  Amit Kapila was first to  
propose this fix, and Robert Haas, myself, and Kyotaro Horiguchi  
reviewed it at various times.  
  
This is an old bug, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/2628.1474272158@localhost  
Discussion: https://postgr.es/m/[email protected]  

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

Flip argument order in XLogSegNoOffsetToRecPtr

commit   : 52b4854a9afd82fa4d7a707f589a5740e854b42a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:21 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:21 -0400    

Click here for diff

Commit fc49e24fa69a added an input argument after the existing output  
argument.  Flip those.  
  
Author: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/logical/reorderbuffer.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog_internal.h

Fix yet more problems with incorrectly-constructed zero-length arrays.

commit   : 95cce84c16ca9d1477ef9e2d35bb688173142461    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:04 -0400    

Click here for diff

Commit 716ea626a attempted to fix the problem of building 1-D zero-size  
arrays once and for all.  But it turns out that contrib/intarray has some  
code that doesn't use construct_array() but just builds arrays by hand,  
so it didn't get the memo.  This appears to affect all of subarray(),  
intset_subtract(), inner_int_union(), inner_int_inter(), and  
intarray_concat_arrays().  
  
Back-patch into v11.  In the past we've not back-patched this type of  
change, but since v11 is still in beta it seems all right to include  
this fix in it.  Besides it's more consistent to make the fix in v11  
where 716ea626a appeared.  
  
Report and patch by Alexey Kryuchkov, some cosmetic adjustments by me  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAN85JcYphDLYt4CpMDLZjjNVqGDrFJ5eS3YF=wLAhFoDQuBsyg@mail.gmail.com  

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

rel notes: mention enabling of parallelism in PG 10

commit   : b4f0d738c3c33752f82398f5e6d0db09e7c862cb    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 9 Jul 2018 11:19:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 9 Jul 2018 11:19:18 -0400    

Click here for diff

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

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

Add UtilityReturnsTuples() support for CALL

commit   : 59a85323d9d5927a852939fa93f09d142c72c91a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Jul 2018 13:58:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Jul 2018 13:58:08 +0200    

Click here for diff

This ensures that prepared statements for CALL can return tuples.  

M src/backend/commands/functioncmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h

Rework order of end-of-recovery actions to delay timeline history write

commit   : 5d7c9347e427cf50ea5d87877fbf89acb235e5a2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 9 Jul 2018 10:25:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 9 Jul 2018 10:25:40 +0900    

Click here for diff

A critical failure in some of the end-of-recovery actions before the  
end-of-recovery record is written can cause PostgreSQL to react  
inconsistently with the rest of the cluster in the event of a crash  
before the final record is written.  Two such failures are for example  
an error while processing a two-phase state files or when operating on  
recovery.conf.  With this commit, the failures are still considered  
FATAL, but the write of the timeline history file is delayed as much as  
possible so as the window between the moment the file is written and the  
end-of-recovery record is generated gets minimized. This way, in the  
event of a crash or a failure, the new timeline decided at promotion  
will not seem taken by other nodes in the cluster.  It is not really  
possible to reduce to zero this window, hence one could still see  
failures if a crash happens between the history file write and the  
end-of-recovery record, so any future code should be careful when  
adding new end-of-recovery actions.  The original report from Magnus  
Hagander mentioned a renamed recovery.conf as original end-of-recovery  
failure which caused a timeline to be seen as taken but the subsequent  
processing on the now-missing recovery.conf cause the startup process to  
issue stop on FATAL, which at follow-up startup made the system  
inconsistent because of on-disk changes which already happened.  
  
Processing of two-phase state files still needs some work as corrupted  
entries are simply ignored now.  This is left as a future item and this  
commit fixes the original complain.  
  
Reported-by: Magnus Hagander  
Author: Heikki Linnakangas  
Reviewed-by: Alexander Korotkov, Michael Paquier, David Steele  
Discussion: https://postgr.es/m/CABUevEz09XY2EevA2dLjPCY-C5UO4Hq=XxmXLmF6ipNFecbShQ@mail.gmail.com  

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

Add separate error message for procedure does not exist

commit   : e8137295b3fe8a38a579b402512a4442bc992250    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Jul 2018 11:17:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Jul 2018 11:17:04 +0200    

Click here for diff

While we probably don't want to split up all error messages into  
function and procedure variants, this one is a very prominent one, so  
it's helpful to be more specific here.  

M src/backend/parser/parse_func.c
M src/test/regress/expected/create_procedure.out

Add note in pg_rewind documentation about read-only files

commit   : 0e4a46670e3a731eae177d8fa961f97b89298922    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 7 Jul 2018 08:10:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 7 Jul 2018 08:10:32 +0900    

Click here for diff

When performing pg_rewind, the presence of a read-only file which is not  
accessible for writes will cause a failure while processing.  This can  
cause the control file of the target data folder to be truncated,  
causing it to not be reusable with a successive run.  
  
Also, when pg_rewind fails mid-flight, there is likely no way to be able  
to recover the target data folder anyway, in which case a new base  
backup is the best option.  A note is added in the documentation as  
well about.  
  
Reported-by: Christian H.  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/20180104200633.17004.16377%40wrigleys.postgresql.org  

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

Fix assert in nested SQL procedure call

commit   : d89348976c51952293ffe35845c372ffa7e93b47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 13:28:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 13:28:39 +0200    

Click here for diff

When executing CALL in PL/pgSQL, we need to set a snapshot before  
invoking the to-be-called procedure.  Otherwise, the to-be-called  
procedure might end up running without a snapshot.  For LANGUAGE SQL  
procedures, this would result in an assertion failure.  (For most other  
languages, this is usually not a problem, because those use SPI and SPI  
sets snapshots in most cases.)  Setting the snapshot restores the  
behavior of how CALL worked when it was handled as a generic SQL  
statement in PL/pgSQL (exec_stmt_execsql()).  
  
This change revealed another problem:  In SPI_commit(), we popped the  
active snapshot before committing the transaction, to avoid "snapshot %p  
still active" errors.  However, there is no particular reason why only  
at most one snapshot should be on the stack.  So change this to pop all  
active snapshots instead of only one.  

M src/backend/executor/spi.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Allow CALL with polymorphic type arguments

commit   : 6f50b1c70fe04dc0b08f58e87dd982d50e0edd22    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Jul 2018 22:27:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Jul 2018 22:27:42 +0200    

Click here for diff

In order to be able to resolve polymorphic types, we need to set fn_expr  
before invoking the procedure.  

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

Allow replication slots to be dropped in single-user mode

commit   : ef64645950163e472729eef3af22bfafc477b040    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Jul 2018 16:38:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Jul 2018 16:38:29 -0400    

Click here for diff

Starting with commit 9915de6c1cb2, replication slot drop uses a  
condition variable sleep to wait until the current user of the slot goes  
away.  This is more user friendly than the previous behavior of erroring  
out if the slot is in use, but it fails with a not-for-user-consumption  
error message in single-user mode; plus, if you're using single-user  
mode because you don't want to start the server in the regular mode  
(say, disk is full and WAL won't recycle because of the slot), it's  
inconvenient.  
  
Fix by skipping the cond variable sleep in single-user mode, since  
there can't be anybody to wait for anyway.  
  
Reported-by: tushar <[email protected]>  
Author: Ɓlvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c

doc: Reword old inheritance partitioning documentation

commit   : 77cb7eaa78cdc9bd63236aca7f16f1af31b17c98    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Jul 2018 15:26:04 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Jul 2018 15:26:04 -0400    

Click here for diff

Prefer to use phrases like "child" instead of "partition" when  
describing the legacy inheritance-based partitioning.  The word  
"partition" now has a fixed meaning for the built-in partitioning, so  
keeping it out of the documentation of the old method makes things  
clearer.  
  
Author: Justin Pryzby <[email protected]>  
Committer: Peter Eisentraut <[email protected]>  
Backpatch of: 0c06534bd63b  

M doc/src/sgml/ddl.sgml

logical decoding: beware of an unset specinsert change

commit   : 05c7426bac43aa3f07c32f40c16a78712d1f0c87    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 17:42:37 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 17:42:37 -0400    

Click here for diff

Coverity complains that there is no protection in the code (at least in  
non-assertion-enabled builds) against speculative insertion failing to  
follow the expected protocol.  Add an elog(ERROR) for the case.  

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

doc: Fix typos

commit   : d5176fa1e3c38ee651c9937b33e673db7cd4d9e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Jul 2018 22:51:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Jul 2018 22:51:56 +0200    

Click here for diff

Author: Justin Pryzby <[email protected]>  

M doc/src/sgml/ddl.sgml

Reduce cost of test_decoding's new oldest_xmin test

commit   : aba2184bed64ef3b6f01465df940eb560d5f772d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 16:37:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 16:37:32 -0400    

Click here for diff

Change a whole-database VACUUM into doing just pg_attribute, which is  
the portion that verifies what we want it to do.  The original  
formulation wastes a lot of CPU time, which leads the test to fail when  
runtime exceeds isolationtester timeout when it's super-slow, such as  
under CLOBBER_CACHE_ALWAYS.  Per buildfarm member friarbird.  
  
It turns out that the previous shape of the test doesn't always detect  
the condition it is supposed to detect (on unpatched reorderbuffer  
code): the reason is that there is a good chance of encountering a  
xl_running_xacts record (logged every 15 seconds) before the checkpoint  
-- and because we advance the xmin when we receive that WAL record, and  
we *don't* advance the xmin twice consecutively without receiving a  
client message in between, that means the xmin is not advanced enough  
for the tuple to be pruned from pg_attribute by VACUUM.  So the test  
would spuriously pass.  
  
The reason this test deficiency wasn't detected earlier is that HOT  
pruning removes the tuple anyway, even if vacuum leaves it in place, so  
the test correctly fails (detecting the coding mistake), but for the  
wrong reason.  
  
To fix this mess, run the s0_get_changes step twice before vacuum  
instead of once: this seems to cause the xmin to be advanced reliably,  
wreaking havoc with more certainty.  
  
Author: Arseny Sher  
Discussion: https://postgr.es/m/87h8lkuxoa.fsf@ars-thinkpad  

M contrib/test_decoding/expected/oldest_xmin.out
M contrib/test_decoding/specs/oldest_xmin.spec

Prevent references to invalid relation pages after fresh promotion

commit   : 9a1bd8271172b0dd353fc946857a8ca29e8b828d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Jul 2018 10:46:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Jul 2018 10:46:43 +0900    

Click here for diff

If a standby crashes after promotion before having completed its first  
post-recovery checkpoint, then the minimal recovery point which marks  
the LSN position where the cluster is able to reach consistency may be  
set to a position older than the first end-of-recovery checkpoint while  
all the WAL available should be replayed.  This leads to the instance  
thinking that it contains inconsistent pages, causing a PANIC and a hard  
instance crash even if all the WAL available has not been replayed for  
certain sets of records replayed.  When in crash recovery,  
minRecoveryPoint is expected to always be set to InvalidXLogRecPtr,  
which forces the recovery to replay all the WAL available, so this  
commit makes sure that the local copy of minRecoveryPoint from the  
control file is initialized properly and stays as it is while crash  
recovery is performed.  Once switching to archive recovery or if crash  
recovery finishes, then the local copy minRecoveryPoint can be safely  
updated.  
  
Pavan Deolasee has reported and diagnosed the failure in the first  
place, and the base fix idea to rely on the local copy of  
minRecoveryPoint comes from Kyotaro Horiguchi, which has been expanded  
into a full-fledged patch by me.  The test included in this commit has  
been written by Ɓlvaro Herrera and Pavan Deolasee, which I have modified  
to make it faster and more reliable with sleep phases.  
  
Backpatch down to all supported versions where the bug appears, aka 9.3  
which is where the end-of-recovery checkpoint is not run by the startup  
process anymore.  The test gets easily supported down to 10, still it  
has been tested on all branches.  
  
Reported-by: Pavan Deolasee  
Diagnosed-by: Pavan Deolasee  
Reviewed-by: Pavan Deolasee, Kyotaro Horiguchi  
Author: Michael Paquier, Kyotaro Horiguchi, Pavan Deolasee, Ɓlvaro  
Herrera  
Discussion: https://postgr.es/m/CABOikdPOewjNL=05K5CbNMxnNtXnQjhTx2F--4p4ruorCjukbA@mail.gmail.com  

M src/backend/access/transam/xlog.c
A src/test/recovery/t/015_promotion_pages.pl

Use context with correct lifetime in hypothetical_dense_rank_final.

commit   : e60cfcefe635b90bab60e885be689700759a01c6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 17:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 17:36:01 -0700    

Click here for diff

The query lifetime expression context created in  
hypothetical_dense_rank_final() was buggily allocated in the calling  
memory context. I (Andres) broke that in bf6c614a2f2.  
  
Reported-By: Rajkumar Raghuwanshi  
Author: Amit Langote  
Discussion:  https://postgr.es/m/CAKcux6kmzWmur5HhA_aU6gYVFu0RLQdgJJ+aC9SLdcOvBSrpfA@mail.gmail.com  
Backpatch: 11-  

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

Check for interrupts inside the nbtree page deletion code.

commit   : 0c69db762d886ce2c2b0cb311e24ab76c4740c0b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 14:53:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 14:53:30 -0700    

Click here for diff

When deleting pages the nbtree code has to walk through siblings of a  
tree node. When those sibling links are corrupted that can lead to  
endless loops - which are currently not interruptible.  This is  
especially problematic if autovacuum is repeatedly blocked on such  
indexes, as it can be hard to get out of that situation without  
resorting to single user mode.  
  
Thus add interrupt checks to appropriate places in such  
loops. Unfortunately in one of the cases it's it's not easy to do so.  
  
Between 9.3 and 9.4 the page deletion (and page split) code changed  
significantly. Before it was significantly less robust against  
interruptions. Therefore don't backpatch to 9.3.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-  

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

Improve the performance of relation deletes during recovery.

commit   : 9e53171b1057ddb50063a58651aff45f8fc339d7    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 5 Jul 2018 02:21:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 5 Jul 2018 02:21:15 +0900    

Click here for diff

When multiple relations are deleted at the same transaction,  
the files of those relations are deleted by one call to smgrdounlinkall(),  
which leads to scan whole shared_buffers only one time. OTOH,  
previously, during recovery, smgrdounlink() (not smgrdounlinkall()) was  
called for each file to delete, which led to scan shared_buffers  
multiple times. Obviously this could cause to increase the WAL replay  
time very much especially when shared_buffers was huge.  
  
To alleviate this situation, this commit changes the recovery so that  
it also calls smgrdounlinkall() only one time to delete multiple  
relation files.  
  
This is just fix for oversight of commit 279628a0a7, not new feature.  
So, per discussion on pgsql-hackers, we concluded to backpatch this  
to all supported versions.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Andres Freund, Thomas Munro, Kyotaro Horiguchi, Takayuki Tsunakawa  
Discussion: https://postgr.es/m/CAHGQGwHVQkdfDqtvGVkty+19cQakAydXn1etGND3X0PHbZ3+6w@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/storage/smgr/md.c
M src/include/storage/smgr.h

Remove dead code for temporary relations in partition planning

commit   : 5fca035903a2ad2fd143b14eccf5a58af85c189d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Jul 2018 10:41:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Jul 2018 10:41:44 +0900    

Click here for diff

Since recent commit 1c7c317c, temporary relations cannot be mixed with  
permanent relations within the same partition tree, and the same counts  
for temporary relations created by other sessions, which the planner  
simply discarded.  Instead be paranoid and issue an error, as those  
should be blocked at definition time, at least for now.  
  
At the same time, a test case is added to stress what has been moved  
when expand_partitioned_rtentry gets called recursively but bumps on a  
partitioned relation with no partitions which should be handled the same  
way as the non-inheritance case.  This code may be reworked in a close  
future, and covering this code path will limit surprises.  
  
Reported-by: David Rowley  
Author: David Rowley  
Reviewed-by: Amit Langote, Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/CAKJS1f_HyV1txn_4XSdH5EOhBMYaCwsXyAj6bHXk9gOu4JKsbw@mail.gmail.com  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/select.out
M src/test/regress/sql/select.sql

Correct comment

commit   : 31658f794370547eb19b233956afe92a07cd6fdd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jul 2018 18:33:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jul 2018 18:33:30 +0200    

Click here for diff

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

Fix libpq example programs

commit   : 8bfe83628b5135492fc8731a86b84887b2f7c904    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Jul 2018 14:06:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Jul 2018 14:06:40 +0200    

Click here for diff

When these programs call pg_catalog.set_config, they need to check for  
PGRES_TUPLES_OK instead of PGRES_COMMAND_OK.  Fix for  
5770172cb0c9df9e6ce27c507b449557e5b45124.  
  
Reported-by: Ideriha, Takeshi <[email protected]>  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/lobj.sgml
M src/test/examples/testlibpq.c
M src/test/examples/testlibpq2.c
M src/test/examples/testlibpq4.c
M src/test/examples/testlo.c
M src/test/examples/testlo64.c

perltidy run prior to branching

commit   : d8421390996dcd762383a28e57d1f3f16cc5f76f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:28:55 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:28:55 -0400    

Click here for diff

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/ssl/ServerSetup.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VCBuildProject.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/builddoc.pl
M src/tools/msvc/dummylib/Win32/Registry.pm
M src/tools/msvc/dummylib/Win32API/File.pm

pgindent run prior to branching

commit   : 1e9c8580904625576871eeb2efec7f04d4c3bc1c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:25:49 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:25:49 -0400    

Click here for diff

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/indexcmds.c
M src/backend/executor/execMain.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/jsonb.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/tab-complete.c
M src/include/access/xlogreader.h
M src/include/replication/reorderbuffer.h

Update typedefs list

commit   : 2c64d200484c40c1bfbd532bf140bea672f267a1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:07:27 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:07:27 -0400    

Click here for diff

M src/tools/pgindent/typedefs.list

Documentation spell checking and markup improvements

commit   : f7481d2c3c52042030269b91bfeb00f120adb618    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 21:26:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 21:26:41 +0200    

Click here for diff

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/release-11.sgml
M doc/src/sgml/user-manag.sgml

doc: Replace non-ASCII lines in psql example output

commit   : 539f32bdd6915e950d225e732959a1b068598993    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 21:23:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 21:23:23 +0200    

Click here for diff

M doc/src/sgml/ddl.sgml

psql: show cloned triggers in partitions

commit   : bc87f22ef6ef1137909ed7363976c67cf1efa7da    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jun 2018 11:40:36 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jun 2018 11:40:36 -0400    

Click here for diff

In a partition, row triggers that had been cloned from their parent  
partitioned table would not be listed at all in psql's \d, which could  
surprise users, per insistent complaint from Ashutosh Bapat (though his  
aim was elsewhere).  The simplest possible fix, suggested by Peter  
Eisentraut, seems to be to list triggers marked as internal if they have  
a row in pg_depend that points to some other trigger.  
  
Author: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Fix crash when ALTER TABLE recreates indexes on partitions

commit   : 41372071dfaab97a1a8dca83e32b88413460f477    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jun 2018 11:27:57 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jun 2018 11:27:57 -0400    

Click here for diff

The skip_build flag was not being passed correctly when recursing to  
indexes on partitions, leading to attempts to rebuild indexes when they  
were not yet ready to be rebuilt.  
  
Reported-by: Rajkumar Raghuwanshi  
Discussion: https://postgr.es/m/CAKcux6mxNCGsgATwf5CGMF8g4WSupCXicCVMeKUTuWbyxHOMsQ@mail.gmail.com  

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

Replace search.cpan.org with metacpan.org

commit   : dad335b89f2e1d543ef8226b7de4b191246a06dd    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 29 Jun 2018 22:02:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 29 Jun 2018 22:02:20 +0900    

Click here for diff

search.cpan.org has been EOL'd, with metacpan.org being the official  
replacement to which URLs now redirect.  Update links to match the new  
URL. Also update links to CPAN to use https as it will redirect from  
http.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/dmetaphone.c
M doc/src/sgml/acronyms.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/install-windows.sgml
M src/test/perl/PostgresNode.pm

Make capitalization of term "OpenSSL" more consistent

commit   : dad5f8a3d51c8b12bfa0d2c635639fff9fad5155    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 29 Jun 2018 09:45:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 29 Jun 2018 09:45:44 +0900    

Click here for diff

This includes code comments and documentation.  No backpatch as this is  
cosmetic even if there are documentation changes which are user-facing.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/openssl.c
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/Makefile

Fix typo in comment

commit   : f5545287dc5f565b091f2312684d14fda0705a9a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 27 Jun 2018 15:40:24 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 27 Jun 2018 15:40:24 -0400    

Click here for diff

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

M src/include/nodes/relation.h

Fix thinko in comments.

commit   : 2e61c50785a0dca6ed30a1a5522457b18bbb5498    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 27 Jun 2018 18:05:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 27 Jun 2018 18:05:24 +0530    

Click here for diff

A slot can not be stored in a tuple but it's vice versa.  
  
Reported-by: Ashutosh Bapat  
Author: Ashutosh Bapat  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAFjFpRcHhNhXdegyJv3KKDWrwO1_NB_KYZM_ZSDeMOZaL1A5jQ@mail.gmail.com  

M src/backend/executor/execReplication.c

Change pqformat.h's integer handling functions to take unsigned integers.

commit   : 42121790ca9b27e01fd0471fdac28ec4a381eaee    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Jun 2018 23:40:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Jun 2018 23:40:32 -0700    

Click here for diff

As added in 1de09ad8eb1fa673ee7899d6dfbb2b49ba204818 the new functions  
all accept signed integers as parameters. That's not great, because  
it's perfectly reasonable to call them with unsigned parameters.  
Unfortunately unsigned to signed conversion is not well defined, when  
exceeding the range of the signed value.  That's presently not a  
practical issue in postgres (among other reasons because we force  
gcc's hand with -fwrapv).  But it's clearly not quite right.  
  
Thus change the signatures to accept unsigned integers instead, signed  
to unsigned conversion is always well defined. Also change the  
backward compat pq_sendint() - while it's deprecated it seems better  
to be consistent.  
  
Per discussion between Andrew Gierth, Michael Paquier, Alvaro Herrera  
and Tom Lane.  
  
Reported-By: Andrew Gierth  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/pqformat.h

Remove duplicated return statement from llvmjit code.

commit   : 986070872ffaae5d9d0e39eddcc952bc261982a2    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Jun 2018 23:16:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Jun 2018 23:16:50 -0700    

Click here for diff

The duplicated return clearly doesn't make sense / isn't  
reachable. Likely introduced by me (Andres), while revising the code.  
  
Author: Rushabh Lathia  
Discussion: https://postgr.es/m/CAGPqQf2raxWOcbuTP36M1rEF3=Rfo7oD29K3psdyHMeE5swBRg@mail.gmail.com  

M src/backend/jit/llvm/llvmjit.c

Fix whitespace

commit   : 0fcf5e0e6e7a353f862504da0a321f148ad2de03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Jun 2018 08:03:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Jun 2018 08:03:54 +0200    

Click here for diff

M src/test/perl/TestLib.pm
M src/tools/perlcheck/find_perl_files
M src/tools/perlcheck/perlcriticrc

doc: Improve wording and fix whitespace

commit   : ae5ed75ed4a951c58ec6a76362241b6ac32be61c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Jun 2018 07:51:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Jun 2018 07:51:20 +0200    

Click here for diff

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

doc: Document some nuances of logical replication of TRUNCATE

commit   : c9d6a45724d642a00bd2b4c0f082cf4e1eb76e29    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Jun 2018 07:40:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Jun 2018 07:40:18 +0200    

Click here for diff

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

Cosmetic improvements for faster column addition.

commit   : 8121ab88e7dfe6ebe56c58257733354cb85f092c    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 27 Jun 2018 08:16:13 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 27 Jun 2018 08:16:13 +0530    

Click here for diff

Changed the name of few structure members for the sake of clarity and  
removed spurious whitespace.  
  
Reported-by: Amit Kapila  
Author: Amit Kapila, based on suggestion by Andrew Dunstan  
Reviewed-by: Alvaro Herrera  
Discussion: https://postgr.es/m/CAA4eK1K2znsFpC+NQ9A4vxT4uDxADN4RmvHX0L6Y=aHVo9gB4Q@mail.gmail.com  

M src/backend/access/common/heaptuple.c
M src/backend/access/common/tupdesc.c
M src/backend/utils/cache/relcache.c
M src/include/access/tupdesc_details.h

Fix "base" snapshot handling in logical decoding

commit   : f49a80c481f74fa81407dce8e51dea6956cb64f8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 26 Jun 2018 16:38:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 26 Jun 2018 16:38:34 -0400    

Click here for diff

Two closely related bugs are fixed.  First, xmin of logical slots was  
advanced too early.  During xl_running_xacts processing, xmin of the  
slot was set to the oldest running xid in the record, but that's wrong:  
actually, snapshots which will be used for not-yet-replayed transactions  
might consider older txns as running too, so we need to keep xmin back  
for them.  The problem wasn't noticed earlier because DDL which allows  
to delete tuple (set xmax) while some another not-yet-committed  
transaction looks at it is pretty rare, if not unique: e.g. all forms of  
ALTER TABLE which change schema acquire ACCESS EXCLUSIVE lock  
conflicting with any inserts. The included test case (test_decoding's  
oldest_xmin) uses ALTER of a composite type, which doesn't have such  
interlocking.  
  
To deal with this, we must be able to quickly retrieve oldest xmin  
(oldest running xid among all assigned snapshots) from ReorderBuffer. To  
fix, add another list of ReorderBufferTXNs to the reorderbuffer, where  
transactions are sorted by base-snapshot-LSN.  This is slightly  
different from the existing (sorted by first-LSN) list, because a  
transaction can have an earlier LSN but a later Xmin, if its first  
record does not obtain an xmin (eg. xl_xact_assignment).  Note this new  
list doesn't fully replace the existing txn list: we still need that one  
to prevent WAL recycling.  
  
The second issue concerns SnapBuilder snapshots and subtransactions.  
SnapBuildDistributeNewCatalogSnapshot never assigned a snapshot to a  
transaction that is known to be a subtxn, which is good in the common  
case that the top-level transaction already has one (no point in doing  
so), but a bug otherwise.  To fix, arrange to transfer the snapshot from  
the subtxn to its top-level txn as soon as the kinship gets known.  
test_decoding's snapshot_transfer verifies this.  
  
Also, fix a minor memory leak: refcount of toplevel's old base snapshot  
was not decremented when the snapshot is transferred from child.  
  
Liberally sprinkle code comments, and rewrite a few existing ones.  This  
part is my (Ɓlvaro's) contribution to this commit, as I had to write all  
those comments in order to understand the existing code and Arseny's  
patch.  
  
Reported-by: Arseny Sher <[email protected]>  
Diagnosed-by: Arseny Sher <[email protected]>  
Co-authored-by: Arseny Sher <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Reviewed-by: Antonin Houska <[email protected]>  
Discussion: https://postgr.es/m/87lgdyz1wj.fsf@ars-thinkpad  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/oldest_xmin.out
A contrib/test_decoding/expected/snapshot_transfer.out
A contrib/test_decoding/specs/oldest_xmin.spec
A contrib/test_decoding/specs/snapshot_transfer.spec
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/reorderbuffer.h

Fix upper limit for vacuum_cleanup_index_scale_factor

commit   : 4d54543efa5eb074ead4d0fadb2af4161c943044    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 26 Jun 2018 21:55:59 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 26 Jun 2018 21:55:59 +0300    

Click here for diff

6ca33a88 sets upper limit for vacuum_cleanup_index_scale_factor to  
DBL_MAX.  DBL_MAX appears to be platform-dependent. That causes  
many buildfarm animals to fail, because we check boundaries of  
vacuum_cleanup_index_scale_factor in regression tests.  
  
This commit changes upper limit from DBL_MAX to just "large enough"  
limit, which was arbitrary selected as 1e10.  
  
Author: Alexander Korotkov  
Reported-by: Tom Lane, Darafei Praliaskouski  
Discussion: https://postgr.es/m/CAPpHfdvewmr4PcpRjrkstoNn1n2_6dL-iHRB21CCfZ0efZdBTg%40mail.gmail.com  
Discussion: https://postgr.es/m/CAC8Q8tLYFOpKNaPS_E7V8KtPdE%3D_TnAn16t%3DA3LuL%3DXjfOO-BQ%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/common/reloptions.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/btree_index.out

|--- gitweb/email subject limit -----------------|-------------|

commit   : a89357e2f7839f5bc0815f4cf9e565cd3ad7a185    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 26 Jun 2018 14:31:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 26 Jun 2018 14:31:57 -0400    

Click here for diff

doc:  PG 11 relnotes: remove channel binding from major features  
  
Also move to the source code section, and expand the paragraph  

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

Correct a comment on logtape.c's leader tape.

commit   : aefb0a382c10877867d831afe8a292aa355c5a68    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 26 Jun 2018 11:16:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 26 Jun 2018 11:16:20 -0700    

Click here for diff

randomAccess parallel tuplesorts are disallowed because the leader would  
try to write to its own leader tape, not because the leader would try to  
write to a worker tape directly.  
  
Cleanup from commit 9da0cc35284.  

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

Remove obsolete comment block in nbtsort.c.

commit   : cdc2693a11b341043f33e1efc36debe0348fb361    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 26 Jun 2018 10:08:44 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 26 Jun 2018 10:08:44 -0700    

Click here for diff

Building a new nbtree index through incremental insertions would always  
be slower than our actual approach of sorting using tuplesort,  
assembling leaf pages from tuplesort output, and writing and WAL-logging  
whole pages.  Remove a comment block from the Berkeley days claiming  
that incremental insertions might be slightly faster with presorted  
input.  
  
Discussion: https://postgr.es/m/CAH2-WzmKs4mLAoFgJ3yHMRYc849efc=dw+pNRb3NEog2oJoCNw@mail.gmail.com  

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

Enable failure to rename a partitioned index

commit   : 040da42367a5de448ddecf6ee7c09f73580a6b28    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 26 Jun 2018 11:28:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 26 Jun 2018 11:28:41 -0400    

Click here for diff

Concurrently with partitioned index development (commit 8b08f7d4820f),  
the code to handle failure to rename indexes was refactored (commit  
8b9e9644dc6a).  Turns out that that particular case was untested, which  
naturally led it to be broken.  Add tests and the missing code line.  
  
Co-authored-by: David Rowley <[email protected]>  
Co-authored-by: Ɓlvaro Herrera <[email protected]>  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Discussion: https://postgr.es/m/CAKcux6mfYMS3OX0ywjOiWiGSEKhJf-1zdeTceHFbd0mScUzU5A@mail.gmail.com  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql

commit   : bbbbc2f8f3f7d628c74317959a2cfe71fea05575    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 27 Jun 2018 00:45:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 27 Jun 2018 00:45:21 +0900    

Click here for diff

The backup history file has been no longer necessary for recovery  
since the version 9.0. It's now basically just for informational purpose.  
But previously the documentations still described that a recovery  
requests the backup history file to proceed. The commit fixes this  
documentation bug.  
  
Back-patch to all supported versions.  
  
Author: Yugo Nagata  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Allow direct lookups of AppendRelInfo by child relid

commit   : 7d872c91a3f9d49b56117557cdbb0c3d4c620687    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 26 Jun 2018 10:35:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 26 Jun 2018 10:35:26 -0400    

Click here for diff

find_appinfos_by_relids had quite a large overhead when the number of  
items in the append_rel_list was high, as it had to trawl through the  
append_rel_list looking for AppendRelInfos belonging to the given  
childrelids.  Since there can only be a single AppendRelInfo for each  
child rel, it seems much better to store an array in PlannerInfo which  
indexes these by child relid, making the function O(1) rather than O(N).  
This function was only called once inside the planner, so just replace  
that call with a lookup to the new array.  find_childrel_appendrelinfo  
is now unused and thus removed.  
  
This fixes a planner performance regression new to v11 reported by  
Thomas Reiss.  
  
Author: David Rowley  
Reported-by: Thomas Reiss  
Reviewed-by: Ashutosh Bapat  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h

Increase upper limit for vacuum_cleanup_index_scale_factor

commit   : 6ca33a885bf892a7fa34020a2620c83ccec3cdd7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 26 Jun 2018 15:00:51 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 26 Jun 2018 15:00:51 +0300    

Click here for diff

Upper limits for vacuum_cleanup_index_scale_factor GUC and reloption  
were initially set to 100.0 in 857f9c36.  However, after further  
discussion, it appears that some users like to disable B-tree cleanup  
index scan completely (assuming there are no deleted pages).  
  
vacuum_cleanup_index_scale_factor is used barely to protect against  
stalled index statistics.  And after detailed consideration it appears  
that risk of stalled index statistics is low.  And it would be nice to  
allow advanced users setting higher values of  
vacuum_cleanup_index_scale_factor.  So, set upper limit for these  
GUC and reloption to DBL_MAX.  
  
Author: Alexander Korotkov  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAC8Q8tJCb%3DgxhzcV7T6ctx7PY-Ux1oA-AsTJc6cAVNsQiYcCzA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/nbtree/nbtree.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/btree_index.out

Reword SPI_ERROR_TRANSACTION errors in PL/pgSQL

commit   : c9301deb9bf86aaf9144a66026bc121a3eededee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jun 2018 11:38:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jun 2018 11:38:46 +0200    

Click here for diff

The previous message for SPI_ERROR_TRANSACTION claimed "cannot begin/end  
transactions in PL/pgSQL", but that is no longer true.  Nevertheless,  
the error can still happen, so reword the messages.  The error cases in  
exec_prepare_plan() could never happen, so remove them.  

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

Move RecoveryLockList into a hash table.

commit   : a40cff8956e842f737739d93a7b160f0b4a03d13    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 26 Jun 2018 17:16:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 26 Jun 2018 17:16:34 +1200    

Click here for diff

Standbys frequently need to release all locks held by a given xid.  
Instead of searching one big list linearly, let's create one list  
per xid and put them in a hash table, so we can find what we need  
in O(1) time.  
  
Earlier analysis and a prototype were done by David Rowley, though  
this isn't his patch.  
  
Back-patch all the way.  
  
Author: Thomas Munro  
Diagnosed-by: David Rowley, Andres Freund  
Reviewed-by: Andres Freund, Tom Lane, Robert Haas  
Discussion: https://postgr.es/m/CAEepm%3D1mL0KiQ2KJ4yuPpLGX94a4Ns_W6TL4EGRouxWibu56pA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAKJS1f9vJ841HY%3DwonnLVbfkTWGYWdPN72VMxnArcGCjF3SywA%40mail.gmail.com  

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

commit   : c672d709b089f919381a2c36eea32a29d8de4198    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Jun 2018 14:57:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Jun 2018 14:57:53 +0900    

Click here for diff

These descriptions have been referring to object dump, but a restore  
operation is done.  
  
Reported-by: Andrey Lizenko  
Author: Andrey Lizenko  
Discussion: https://postgr.es/m/[email protected]  

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

Correct handling of fsync failures with tar mode of walmethods.c

commit   : d08c3d5197fac1f49cedbd8417e685479ad7439a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Jun 2018 09:41:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Jun 2018 09:41:58 +0900    

Click here for diff

This file has been missing the fact that it needs to report back to  
callers a proper failure on fsync calls.  I have spotted the one in  
tar_finish() while Kuntal has spotted the one in tar_close().  
  
Backpatch down to 10 where this code has been introduced.  
  
Reported by: Michael Paquier, Kuntal Ghosh  
Author: Michael Paquier  
Reviewed-by: Kuntal Ghosh, Magnus Hagander  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/walmethods.c

Update obsolete comments

commit   : 322548a8abe225f2cfd6a48e07b99e2711d28ef7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Jun 2018 15:36:33 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Jun 2018 15:36:33 -0400    

Click here for diff

Commit 9fab40ad32ef removed some pre-allocating logic in  
reorderbuffer.c, but left outdated comments in place.  Repair.  
  
Author: Ɓlvaro Herrera  

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

Stamp 11beta2.

commit   : 1d4e5edc1dc22f00a0abb00ed9b56c08c4a1f599    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Jun 2018 11:09:49 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Jun 2018 11:09:49 -0400    

Click here for diff

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

Translation updates

commit   : 299addd592ccf36d495319bda0f14049548ee130    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Jun 2018 12:37:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Jun 2018 12:37:18 +0200    

Click here for diff

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

M src/backend/nls.mk
M src/backend/po/fr.po
M src/backend/po/it.po
A src/backend/po/sv.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/sv.po
M src/bin/psql/po/sv.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/interfaces/libpq/po/de.po

Address set of issues with errno handling

commit   : 6cb3372411fd6ed8ba0f8d36ae578a2daa517c16    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 Jun 2018 11:19:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 Jun 2018 11:19:05 +0900    

Click here for diff

System calls mixed up in error code paths are causing two issues which  
several code paths have not correctly handled:  
1) For write() calls, sometimes the system may return less bytes than  
what has been written without errno being set.  Some paths were careful  
enough to consider that case, and assumed that errno should be set to  
ENOSPC, other calls missed that.  
2) errno generated by a system call is overwritten by other system calls  
which may succeed once an error code path is taken, causing what is  
reported to the user to be incorrect.  
  
This patch uses the brute-force approach of correcting all those code  
paths.  Some refactoring could happen in the future, but this is let as  
future work, which is not targeted for back-branches anyway.  
  
Author: Michael Paquier  
Reviewed-by: Ashutosh Sharma  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/bin/pg_basebackup/walmethods.c

doc: adjust order of NUMERIC arguments to match syntax

commit   : 370e68ae1c0a8504a10b211a9c1d9e0ffa101259    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 24 Jun 2018 18:07:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 24 Jun 2018 18:07:00 -0400    

Click here for diff

Specifically, mention precision before scale  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/datatype.sgml

doc: show how interval's 3 unit buckets behave using EXTRACT()

commit   : b6e94b820a21146b898232bc3e3920b31198e637    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 Jun 2018 23:32:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 Jun 2018 23:32:42 -0400    

Click here for diff

This clarifies when justify_days() and justify_hours() are useful.  
Paragraph moved too.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/datatype.sgml

doc: update PG 11 release notes, mostly typo fixes

commit   : 2d502b81289f679a8244a0b6c94a4d294968bde1    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 Jun 2018 17:15:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 Jun 2018 17:15:34 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAJnrtny0mYCMoRanZ1wvGqcPV-UDBoPetavDM1SqxnGVfZRV3g@mail.gmail.com  
  
Author: Brad DeJong  

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

doc: mention use of cross platform logical replication

commit   : 21c1f0c607f0344ae8f71ecaae1fe6f58cf7ff9a    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 Jun 2018 16:35:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 Jun 2018 16:35:25 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAJrrPGfdknoqZcMipPy8XnH3hO3uRic6JTD=jv35oj1DWqL07g@mail.gmail.com  
  
Author: Haribabu Kommi  

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

Mark binary_upgrade_set_missing_value as parallel_unsafe

commit   : 123efbccea694626b36ad952086d883fa7469aa9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 23 Jun 2018 08:43:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 23 Jun 2018 08:43:05 -0400    

Click here for diff

per buildfarm.  
  
Bump catalog version again although in practice nobody is going to use  
this in a parallel query.  

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

When index recurses to a partition, map columns numbers

commit   : 475be5e790e2db4c5c18a2d378c4498ffccb6289    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jun 2018 15:12:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jun 2018 15:12:53 -0400    

Click here for diff

Two out of three code paths were mapping column numbers correctly if a  
partition had different column numbers than parent table, but the most  
commonly used one (recursing in CREATE INDEX to a new index on a  
partition) failed to map attribute numbers in expressions.  Oddly  
enough, attnums in WHERE clauses are already handled correctly  
everywhere.  
  
Reported-by: Amit Langote  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Ɓlvaro Herrera  

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

Avoid generating bogus paths with partitionwise aggregate.

commit   : c6f28af5d7af87d7370e5f169251d91437f100a2    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 22 Jun 2018 09:14:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 22 Jun 2018 09:14:34 -0400    

Click here for diff

Previously, if some or all partitions had no partially aggregated path,  
we would still try to generate a partially aggregated path for the  
parent, leading to assertion failures or wrong answers.  
  
Report by Rajkumar Raghuwanshi.  Patch by Jeevan Chalke, reviewed  
by Ashutosh Bapat.  A few changes by me.  
  
Discussion: http://postgr.es/m/CAKcux6=q4+Mw8gOOX16ef6ZMFp9Cve7KWFstUsrDa4GiFaXGUQ@mail.gmail.com  

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

Allow for pg_upgrade of attributes with missing values

commit   : 2448adf29c543befbac59f1ecfbb3ef4b0d808ce    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 22 Jun 2018 08:42:36 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 22 Jun 2018 08:42:36 -0400    

Click here for diff

Commit 16828d5c02 neglected to do this, so upgraded databases would  
silently get null instead of the specified default in rows without the  
attribute defined.  
  
A new binary upgrade function is provided to perform this and pg_dump is  
adjusted to output a call to the function if required in binary upgrade  
mode.  
  
Also included is code to drop missing attribute values for dropped  
columns. That way if the type is later dropped the missing value won't  
have a dangling reference to the type.  
  
Finally the regression tests are adjusted to ensure that there is a row  
with a missing value so that this code is exercised in upgrade testing.  
  
Catalog version unfortunately bumped.  
  
Regression test changes from Tom Lane.  
Remainder from me, reviewed by Tom Lane, Andres Freund, Alvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Fixes for vacuum_cleanup_index_scale_factor GUC option

commit   : 9a994e37e08df3578f52011543dc28085dc18e21    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 22 Jun 2018 12:17:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 22 Jun 2018 12:17:56 +0300    

Click here for diff

vacuum_cleanup_index_scale_factor was located in autovacuum group of  
GUCs.  However, it affects not only autovacuum, but also manually run  
VACUUM.  It appears that "client connection defaults" group of GUCs  
is more appropriate for vacuum_cleanup_index_scale_factor, because  
vacuum_*_age options are already located there.  
  
Also, vacuum_cleanup_index_scale_factor was missed in  
postgresql.conf.sample.  So, add it there with appropriate comment.  
  
Author: Masahiko Sawada with minor editorization by me  
Discussion: https://postgr.es/m/CAD21AoArsoXMLKudXSKN679FRzs6oubEchM53bHwn8Tp%3D2boNg%40mail.gmail.com  

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

Fix typo in comment of commit_ts.c for incorrect reference to CLOG

commit   : 0aa5e65ab4fd2695f0e4108b9ec53a0546261e1f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 22 Jun 2018 13:30:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 22 Jun 2018 13:30:26 +0900    

Click here for diff

Author: Shao Bret  

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

Improve coding pattern in Parallel Append code.

commit   : 98d476a965eefb52af53f4fb55dbfead0ede9282    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 22 Jun 2018 08:43:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 22 Jun 2018 08:43:36 +0530    

Click here for diff

The create_append_path code didn't consider that list_concat will  
modify it's first argument leading to inconsistent traversal of  
resulting list.  In practice, it won't lead to any user-visible bug  
but changing it for making the code behave consistently.  
  
Reported-by: Tom Lane  
Author: Tom Lane  
Reviewed-by: Amit Khandekar and Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

Disclaim support for default namespace in XMLTABLE

commit   : c7048977a73b4ab3b38b9a28bc58e600b598c176    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Jun 2018 17:01:10 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Jun 2018 17:01:10 -0400    

Click here for diff

Pavel Stehule's original patch had support for default namespace, but I  
ripped it out before commit -- hence the docs were correct when written,  
and I broke them by omission :-(.  Remove the offending phrase.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

commit   : ec4719cd155d1d58c8aa7c06c7ef24aef6e67622    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jun 2018 16:18:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jun 2018 16:18:33 -0400    

Click here for diff

A typo in numeric_poly_combine caused bogus results for queries using  
it, but of course would only manifest if parallel aggregation is  
performed.  Reported by Rajkumar Raghuwanshi.  
  
David Rowley did the diagnosis and the fix; I editorialized rather  
heavily on his regression test additions.  
  
Back-patch to v10 where the breakage was introduced (by 9cca11c91).  
  
Discussion: https://postgr.es/m/CAKcux6nU4E2x8nkSBpLOT2DPvQ5LviJ3SGyAN6Sz7qDH4G4+Pw@mail.gmail.com  

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

Set correct context for XPath evaluation

commit   : e474c2b7e4b656895d6afcbd36857c9ebb0fcedd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Jun 2018 15:56:11 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Jun 2018 15:56:11 -0400    

Click here for diff

According to the SQL standard, the context of XMLTABLE's XPath  
row_expression is the document node of the XML input document, not the  
root node.  This becomes visible when a relative path rather than  
absolute is used as row expression.  Absolute paths is what was used in  
original tests and docs (and the most common form used in examples  
throughout the interwebs), which explains why this wasn't noticed  
before.  
  
Other functions such as xpath() and xpath_exists() also have this  
problem.  While not specified by the SQL standard, it would be pretty  
odd to leave those functions to behave differently than XMLTABLE, so  
change them too.  However, this is a backwards-incompatible change.  
  
No backpatch, out of fear of breaking code depending on the original  
broken behavior.  
  
Author: Markus Winand  
Reported-By: Markus Winand  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Improve requirements documentation for ldap test suite.

commit   : 425b4c082c82672c646ed8bc9e140b4112899fe4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jun 2018 12:37:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jun 2018 12:37:21 -0400    

Click here for diff

Text by me; data contributed by me, Thomas Munro, Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ldap/README

Fix mishandling of sortgroupref labels while splitting SRF targetlists.

commit   : 07e5a213524853c06684155d4af5a0291d95d25a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jun 2018 10:58:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jun 2018 10:58:42 -0400    

Click here for diff

split_pathtarget_at_srfs() neglected to worry about sortgroupref labels  
in the intermediate PathTargets it constructs.  I think we'd supposed  
that their labeling didn't matter, but it does at least for the case that  
GroupAggregate/GatherMerge nodes appear immediately under the ProjectSet  
step(s).  This results in "ERROR: ORDER/GROUP BY expression not found in  
targetlist" during create_plan(), as reported by Rajkumar Raghuwanshi.  
  
To fix, make this logic track the sortgroupref labeling of expressions,  
not just their contents.  This also restores the pre-v10 behavior that  
separate GROUP BY expressions will be kept distinct even if they are  
textually equal().  
  
Discussion: https://postgr.es/m/CAKcux6=1_Ye9kx8YLBPmJs_xE72PPc6vNi5q2AOHowMaCWjJ2w@mail.gmail.com  

M src/backend/optimizer/util/tlist.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Improve wording of release notes item

commit   : bee6a683a5c35ddcdb8253771450c6cf641f3d60    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 21 Jun 2018 15:49:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 21 Jun 2018 15:49:19 +0300    

Click here for diff

PostgreSQL 11 introduces compress method for SP-GiST opclasses.  That  
was mistakenly interpreted as compression support for SP-GiST while  
actually that allows lossy representation of leaf keys.  
  
Author: Alexander Korotkov, based on proposal by Darafei Praliaskouski  
Discussion: https://postgr.es/m/CAC8Q8tKbYmNdiyWr7hE4GfMY4fbqHKkFziKgrUuWHH6HJQs3og%40mail.gmail.com  

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

Update expected XML output with disabled XML

commit   : 9cd929d36079e30cd43a85dd23e771d25c5f7b14    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jun 2018 13:05:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jun 2018 13:05:44 -0400    

Click here for diff

Should have been done in previous commit.  

M src/test/regress/expected/xml_1.out

Accept TEXT and CDATA nodes in XMLTABLE's column_expression.

commit   : b7f0be9a7e7ec1eb7b9780b169366495f24bf975    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jun 2018 12:58:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jun 2018 12:58:12 -0400    

Click here for diff

Column expressions that match TEXT or CDATA nodes must return the  
contents of the nodes themselves, not the content of non-existing  
children (i.e. the empty string).  
  
Author: Markus Winand  
Reported-by: Markus Winand  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Add missing include

commit   : 3adcad45588bff17b1253f60cf51c440e87df997    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 18:19:16 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 18:19:16 +0200    

Click here for diff

Per buildfarm  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Consistently use the term 'partitioned rel' in partprune comments

commit   : 8f97af60d19a46b37fe998be38df4e6dd0760e45    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jun 2018 11:43:01 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jun 2018 11:43:01 -0400    

Click here for diff

We were using 'partition rel' in a few places, which is quite confusing.  
  
Author: Amit Langote  
Reviewed-by: David Rowley  
Reviewed-by: Michaƫl Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c
M src/include/partitioning/partprune.h

Fix typo

commit   : 74cfbc8efd3f2f34d05e5c28a0299c2a7bc9c56d    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 16:06:03 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 16:06:03 +0200    

Click here for diff

Reported using the website comment form  

M doc/src/sgml/dml.sgml

Fix a number of typos

commit   : d9443d9608a872b1aa8697fa6f40a41573a35f9d    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 16:01:18 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 16:01:18 +0200    

Click here for diff

Author: Liudmila Mantrova <[email protected]>  

M doc/src/sgml/cube.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/release-11.sgml

Support long option for --pgdata in pg_verify_checksums

commit   : 741ee9dc819dd90270e66ab9bc254eeb7fda7100    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 14:33:48 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 14:33:48 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

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

Document the -D and $PGDATA switch/env for pg_verify_checksums

commit   : d73300a28683fb1723ecda1a3fa767dbe8be6502    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 14:32:51 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 14:32:51 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/ref/pg_verify_checksums.sgml

Move pg_verify_checksum docs to Server utils

commit   : b92ef305c3eebc379af7af52ff03f75c67d39e8f    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 14:28:56 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Jun 2018 14:28:56 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/reference.sgml

Don't consider parallel append for parallel unsafe paths.

commit   : 403318b71f7058ecbfb65bcc7de1eec96cd35d3f    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 20 Jun 2018 07:51:42 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 20 Jun 2018 07:51:42 +0530    

Click here for diff

Commit ab72716778 allowed Parallel Append paths to be generated for a  
relation that is not parallel safe.  Prevent that from happening.  
  
Initial analysis by Tom Lane.  
  
Reported-by: Rajkumar Raghuwanshi  
Author: Amit Kapila and Rajkumar Raghuwanshi  
Reviewed-by: Amit Khandekar and Robert Haas  
Discussion:https://postgr.es/m/CAKcux6=tPJ6nJ08r__nU_pmLQiC0xY15Fn0HvG1Cprsjdd9s_Q@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Clarify use of temporary tables within partition trees

commit   : 1c7c317cd9d1e5647454deed11b55dae764c83bf    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Jun 2018 10:42:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Jun 2018 10:42:25 +0900    

Click here for diff

Since their introduction, partition trees have been a bit lossy  
regarding temporary relations.  Inheritance trees respect the following  
patterns:  
1) a child relation can be temporary if the parent is permanent.  
2) a child relation can be temporary if the parent is temporary.  
3) a child relation cannot be permanent if the parent is temporary.  
4) The use of temporary relations also imply that when both parent and  
child need to be from the same sessions.  
  
Partitions share many similar patterns with inheritance, however the  
handling of the partition bounds make the situation a bit tricky for  
case 1) as the partition code bases a lot of its lookup code upon  
PartitionDesc which does not really look after relpersistence.  This  
causes for example a temporary partition created by session A to be  
visible by another session B, preventing this session B to create an  
extra partition which overlaps with the temporary one created by A with  
a non-intuitive error message.  There could be use-cases where mixing  
permanent partitioned tables with temporary partitions make sense, but  
that would be a new feature.  Partitions respect 2), 3) and 4) already.  
  
It is a bit depressing to see those error checks happening in  
MergeAttributes() whose purpose is different, but that's left as future  
refactoring work.  
  
Back-patch down to 10, which is where partitioning has been introduced,  
except that default partitions do not apply there.  Documentation also  
includes limitations related to the use of temporary tables with  
partition trees.  
  
Reported-by: David Rowley  
Author: Amit Langote, Michael Paquier  
Reviewed-by: Ashutosh Bapat, Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/CAKJS1f94Ojk0og9GMkRHGt8wHTW=ijq5KzJKuoBoqWLwSVwGmw@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/partition_prune.sql

Clarify the README files for the various separate TAP-based test suites.

commit   : c992dca26e2b7d02ec7d43f2b71ff23d77e39f27    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jun 2018 19:30:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jun 2018 19:30:50 -0400    

Click here for diff

Explain the difference between "make check" and "make installcheck".  
Mention the need for --enable-tap-tests (only some of these did so  
before).  Standardize their wording about how to run the tests.  

M src/test/authentication/README
M src/test/kerberos/README
M src/test/ldap/README
M src/test/recovery/README
M src/test/ssl/README
M src/test/subscription/README

README: add URLs for openldap installation

commit   : 9bab9cb36ad9186c9898703106b545d6dbb2aa24    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 19 Jun 2018 15:52:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 19 Jun 2018 15:52:17 -0400    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: head  

M src/test/ldap/README

doc: explain use of json_populate_record{set}()

commit   : 87a19eb9bf373f51e966ab496cce6bf3ee9cd909    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 19 Jun 2018 13:43:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 19 Jun 2018 13:43:40 -0400    

Click here for diff

The set-returning nature of these functions make their use unclear. The  
modified paragraph was added in PG 9.4.  
  
Reported-by: [email protected]  
  
Discussion:  https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/func.sgml

Fix typos in release notes

commit   : fb6accd27b99f5f91a7e9e5bd32b98a53fc6d6b8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 19 Jun 2018 18:32:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 19 Jun 2018 18:32:20 +0300    

Click here for diff

Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/8E8CF1F8-BCB2-4D86-A059-4BF5138F6D87%40yesql.se  

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

Track new configure flags introduced for version 11 in pg_config.h.win32

commit   : bde64eb6107622e8438dd61b93afd4d1adf178b3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Jun 2018 09:00:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Jun 2018 09:00:33 +0900    

Click here for diff

The following set of flags mainly matter when building Postgres code  
with MSVC and those have been forgotten with latest developments:  
- HAVE_LDAP_INITIALIZE, added by 35c0754f, and marked as disabled.  
ldap_initialize() is a non-standard extension that provides a way to use  
"ldaps" with OpenLDAP, but it is not supported on Windows, and instead  
the non-standard ldap_sslinit() is used if WIN32 is defined.  Per input  
from Thomas Munro.  
- HAVE_X509_GET_SIGNATURE_NID, added by 054e8c6c, which is used by  
SCRAM's channel binding tls-server-end-point.  Having this flag disabled  
would cause this channel binding type to be unsupported for Windows  
builds.  
- HAVE_SSL_CLEAR_OPTIONS, added recently as of a364dfa4 to disable SSL  
compression.  
- HAVE_ASN1_STRING_GET0_DATA, added by 5c6df67, which is used to track  
a new compatibility with OpenSSL 1.1.0.  This was missing from  
pg_config.win32.h and is not enabled by default.  HAVE_BIO_GET_DATA,  
HAVE_OPENSSL_INIT_SSL and HAVE_BIO_METH_NEW gain the same treatment.  
  
The second and third flags are enabled with this commit, which raises  
the bar of OpenSSL support to 1.0.2 on Windows as a minimum.  As this  
is the LTS (long-time support) version of OpenSSL community and knowing  
that all recent installers referred by OpenSSL upstream don't have  
anymore 1.0.1 or older, we could live with that requirement.  In order  
to allow the code to compile with OpenSSL 1.1.0, all the flags mentioned  
above need to be enabled in pg_config.h.win32.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pg_config.h.win32

Fix jsonb_plperl to convert Perl UV values correctly.

commit   : 93b6e03ab4794272986a11a427c6c391eafa5dea    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 17:39:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 17:39:57 -0400    

Click here for diff

Values greater than IV_MAX were incorrectly converted to SQL,  
for instance ~0 would become -1 rather than 18446744073709551615  
(on a 64-bit machine).  
  
Dagfinn Ilmari MannsƄker, adjusted a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix contrib/hstore_plperl to look through scalar refs.

commit   : e3b7f7cc50630dac958a48b533cce04e4222892b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 15:55:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 15:55:06 -0400    

Click here for diff

Bring this transform function into sync with the policy established  
by commit 3a382983d.  
  
Also, fix it to make sure that what it drills down to is indeed a  
hash, and not some other kind of Perl SV.  Previously, the test  
cases added here provoked crashes.  
  
Because of the crash hazard, back-patch to 9.5 where this module  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow plperl_sv_to_datum to look through scalar refs.

commit   : 3a382983d142ca270fe49c63fa6d4a95037ebee3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 15:31:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 15:31:57 -0400    

Click here for diff

There seems little reason for the policy of throwing error if we  
find a ref to something other than a hash or array.   Recursively  
look through the ref, instead.  This makes the behavior in non-transform  
cases comparable to what was already instantiated for jsonb_plperl.  
  
Note that because we invoke any available transform function before  
considering the ref case, it's up to each transform function whether  
it wants to play along with this behavior or do something different.  
  
Because the previous behavior was just to throw a useless error,  
this seems unlikely to create any compatibility issues.  Still, given  
the lack of field complaints so far, seems best not to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/expected/plperl.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl.sql

Avoid platform-dependent output from Data::Dumper.

commit   : e4300a3552b104f54ec781dd23cfcf96252ec5c1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 14:53:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 14:53:21 -0400    

Click here for diff

Per buildfarm, the output from Data::Dumper for an IEEE infinity  
is platform-dependent (e.g. "inf" vs "Inf").  Just skip that one  
test case in the plperlu test; testing it on the plperl side is  
coverage enough.  Fixes issue in commit 1731e3741.  

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

Fix excessive enreferencing in jsonb-to-plperl transform.

commit   : 1731e3741cbbf8e0b4481665d7d523bc55117f63    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 14:31:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 14:31:42 -0400    

Click here for diff

We want, say, 2 to be transformed as 2, not \\2 which is what the  
original coding produced.  Perl's standard seems to be to add an RV  
wrapper only for hash and array SVs, so do it like that.  
  
This was missed originally because the test cases only checked what came  
out of a round trip back to SQL, and the strip-all-dereferences loop at  
the top of SV_to_JsonbValue hides the extra refs from view.  As a better  
test, print the Perl value with Data::Dumper, like the hstore_plperlu  
tests do.  While we can't do that in the plperl test, only plperlu,  
that should be good enough because this code is the same for both PLs.  
But also add a simplistic test for extra REFs, which we can do in both.  
  
That strip-all-dereferences behavior is now a bit dubious; it's unlike  
what happens for other Perl-to-SQL conversions.  However, the best  
thing to do seems to be to leave it alone and make the other conversions  
act similarly.  That will be done separately.  
  
Dagfinn Ilmari MannsƄker, adjusted a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete prohibition on function name matching a column name.

commit   : 45e98ee730621fd34d0a132343cb3f906ccc8416    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 11:57:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 11:57:33 -0400    

Click here for diff

ProcedureCreate formerly threw an error if the function to be created  
has one argument of composite type and the function name matches some  
column of the composite type.  This was a (very non-bulletproof) defense  
against creating situations where f(x) and x.f are ambiguous.  But we  
don't really need such a defense in the wake of commit b97a3465d, which  
allows us to deal with such situations fairly cleanly.  This behavior  
also created a dump-and-reload hazard, since a function might be  
rejected if a conflicting column name had been added to the input  
composite type later.  Hence, let's just drop the check.  
  
Discussion: https://postgr.es/m/CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com  

M src/backend/catalog/pg_proc.c

Consider syntactic form when disambiguating function vs column reference.

commit   : b97a3465d73bfc2a9f5bcf5def1983dbaa0a26f8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 11:39:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jun 2018 11:39:33 -0400    

Click here for diff

Postgres has traditionally considered the syntactic forms f(x) and x.f  
to be equivalent, allowing tricks such as writing a function and then  
using it as though it were a computed-on-demand column.  However, our  
behavior when both interpretations are feasible left something to be  
desired: we always chose the column interpretation.  This could lead  
to very surprising results, as in a recent bug report from Neil Conway.  
It also created a dump-and-reload hazard, since what was a function  
call in a dumped view could get interpreted as a column reference  
at reload, if a matching column name had been added to the underlying  
table since the view was created.  
  
What seems better, in ambiguous situations, is to prefer the choice  
matching the syntactic form of the reference.  This seems much less  
astonishing in general, and it fixes the dump/reload hazard.  
  
Although this could be called a bug fix, there have been few complaints  
and there's some small risk of breaking applications that depend on the  
old behavior, so no back-patch.  It does seem reasonable to slip it  
into v11, though.  
  
Discussion: https://postgr.es/m/CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com  

M doc/src/sgml/rowtypes.sgml
M src/backend/parser/parse_func.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Add PGTYPESchar_free() to avoid cross-module problems on Windows.

commit   : 4c8156d87108fa1f245bee13775e76819cd46a90    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 18 Jun 2018 18:33:53 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 18 Jun 2018 18:33:53 +1200    

Click here for diff

On Windows, it is sometimes important for corresponding malloc() and  
free() calls to be made from the same DLL, since some build options can  
result in multiple allocators being active at the same time.  For that  
reason we already provided PQfreemem().  This commit adds a similar  
function for freeing string results allocated by the pgtypes library.  
  
Author: Takayuki Tsunakawa  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8AD5D6%40G01JPEXMBYT05  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/include/Makefile
A src/interfaces/ecpg/include/pgtypes.h
M src/interfaces/ecpg/include/pgtypes_date.h
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/include/pgtypes_numeric.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/pgtypeslib/common.c
M src/interfaces/ecpg/pgtypeslib/exports.txt
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc
M src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
M src/interfaces/ecpg/test/pgtypeslib/num_test.pgc
M src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc
M src/interfaces/ecpg/test/sql/sqlda.pgc

Prevent hard failures of standbys caused by recycled WAL segments

commit   : 70b4f82a4b5cab5fc12ff876235835053e407155    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Jun 2018 10:43:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Jun 2018 10:43:27 +0900    

Click here for diff

When a standby's WAL receiver stops reading WAL from a WAL stream, it  
writes data to the current WAL segment without having priorily zero'ed  
the page currently written to, which can cause the WAL reader to read  
junk data from a past recycled segment and then it would try to get a  
record from it.  While sanity checks in place provide most of the  
protection needed, in some rare circumstances, with chances increasing  
when a record header crosses a page boundary, then the startup process  
could fail violently on an allocation failure, as follows:  
FATAL:  invalid memory alloc request size XXX  
  
This is confusing for the user and also unhelpful as this requires in  
the worst case a manual restart of the instance, impacting potentially  
the availability of the cluster, and this also makes WAL data look like  
it is in a corrupted state.  
  
The chances of seeing failures are higher if the connection between the  
standby and its root node is unstable, causing WAL pages to be written  
in the middle.  A couple of approaches have been discussed, like  
zero-ing  new WAL pages within the WAL receiver itself but this has the  
disadvantage of impacting performance of any existing instances as this  
breaks the sequential writes done by the WAL receiver.  This commit  
deals with the problem with a more simple approach, which has no  
performance impact without reducing the detection of the problem: if a  
record is found with a length higher than 1GB for backends, then do not  
try any allocation and report a soft failure which will force the  
standby to retry reading WAL.  It could be possible that the allocation  
call passes and that an unnecessary amount of memory is allocated,  
however follow-up checks on records would just fail, making this  
allocation short-lived anyway.  
  
This patch owes a great deal to Tsunakawa Takayuki for reporting the  
failure first, and then discussing a couple of potential approaches to  
the problem.  
  
Backpatch down to 9.5, which is where palloc_extended has been  
introduced.  
  
Reported-by: Tsunakawa Takayuki  
Reviewed-by: Tsunakawa Takayuki  
Author: Michael Paquier  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8B57AD@G01JPEXMBYT05  

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

Suppress -Wshift-negative-value warnings.

commit   : 9b53d966847c55fbd2bff63b3e1a1c37fc694071    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jun 2018 16:15:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jun 2018 16:15:11 -0400    

Click here for diff

Clean up four places that result in compiler warnings when using recent  
gcc with this warning class enabled (as seen on buildfarm members  
calliphoridae, skink, and others).  In all these places, this is purely  
cosmetic, because the shift distance could not be large enough to risk  
a change of sign, so there's no chance of implementation-dependent  
behavior.  Still, it's easy enough to avoid the warning by casting the  
shifted value to unsigned, so let's do that.  
  
Patch HEAD only, this isn't worth a back-patch.  

M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/varbit.c

Remove INCLUDE attributes section from docs.

commit   : 514d4a1338d5409431d644eaf453193ac362ef16    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 16 Jun 2018 15:28:50 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 16 Jun 2018 15:28:50 -0700    

Click here for diff

Discussing covering indexes in a chapter that is mostly about the  
behavior of B-Tree operator classes is unnecessary.  The CREATE INDEX  
documentation's handling of covering indexes seems sufficient.  
  
Discussion: https://postgr.es/m/CAH2-WzmpU=L_6VjhhOAMfoyHLr-pZd1kDc+jpa3c3a8EOmtcXA@mail.gmail.com  

M doc/src/sgml/btree.sgml

Use -Wno-format-truncation and -Wno-stringop-truncation, if available.

commit   : e716585235b175de767d3b210f0a963457dfa77f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 15:34:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 15:34:07 -0400    

Click here for diff

gcc 8 has started emitting some warnings that are largely useless for  
our purposes, particularly since they complain about code following  
the project-standard coding convention that path names are assumed  
to be shorter than MAXPGPATH.  Even if we make the effort to remove  
that assumption in some future release, the changes wouldn't get  
back-patched.  Hence, just suppress these warnings, on compilers that  
have these switches.  
  
Backpatch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Avoid unnecessary use of strncpy in a couple of places in ecpg.

commit   : 6b74f5eaadc4489e08a23686f99f096ad0e08936    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 14:58:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 14:58:11 -0400    

Click here for diff

Use of strncpy with a length limit based on the source, rather than  
the destination, is non-idiomatic and draws warnings from gcc 8.  
Replace with memcpy, which does exactly the same thing in these cases,  
but with less chance for confusion.  
  
Backpatch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/pgtypeslib/common.c

Use snprintf not sprintf in pg_waldump's timestamptz_to_str.

commit   : 5d923eb29bb643e311680bab329363d8a9a9768a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 14:45:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 14:45:47 -0400    

Click here for diff

This could only cause an issue if strftime returned a ridiculously  
long timezone name, which seems unlikely; and it wouldn't qualify  
as a security problem even then, since pg_waldump (nee pg_xlogdump)  
is a debug tool not part of the server.  But gcc 8 has started issuing  
warnings about it, so let's use snprintf and be safe.  
  
Backpatch to 9.3 where this code was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_waldump/compat.c

Fix some minor error-checking oversights in ParseFuncOrColumn().

commit   : 0dcf68e5a1f1c600bdf29b47cab30a62301a7af1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 14:10:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jun 2018 14:10:17 -0400    

Click here for diff

Recent additions to ParseFuncOrColumn to make it reject non-procedure  
functions in CALL were neither adequate nor documented.  Reorganize  
the code to ensure uniform results for all the cases that should be  
rejected.  Also, use ERRCODE_WRONG_OBJECT_TYPE for this case as well  
as the converse case of a procedure in a non-CALL context.  The  
original coding used ERRCODE_UNDEFINED_FUNCTION which seems wrong,  
and is certainly inconsistent with the adjacent wrong-kind-of-routine  
errors.  
  
This reorganization also causes the checks for aggregate decoration with  
a non-aggregate function to be made in the FUNCDETAIL_COERCION case;  
that they were not is a long-standing oversight.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_func.c
M src/test/regress/expected/create_procedure.out

Remove AELs from subxids correctly on standby

commit   : 15378c1a15390a2b4c315f19f1644af46c7e3a15    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 16 Jun 2018 14:03:29 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 16 Jun 2018 14:03:29 +0100    

Click here for diff

Issues relate only to subtransactions that hold AccessExclusiveLocks  
when replayed on standby.  
  
Prior to PG10, aborting subtransactions that held an  
AccessExclusiveLock failed to release the lock until top level commit or  
abort. 49bff5300d527 fixed that.  
  
However, 49bff5300d527 also introduced a similar bug where subtransaction  
commit would fail to release an AccessExclusiveLock, leaving the lock to  
be removed sometimes early and sometimes late. This commit fixes  
that bug also. Backpatch to PG10 needed.  
  
Tested by observation. Note need for multi-node isolationtester to improve  
test coverage for this and other HS cases.  
  
Reported-by: Simon Riggs  
Author: Simon Riggs  

M src/backend/access/transam/xact.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/include/storage/standby.h

Fix memory leak in BufFileCreateShared().

commit   : 1cfdb1cb0e3f0acd0fac11537410c48dfd6d9075    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sat, 16 Jun 2018 14:21:08 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sat, 16 Jun 2018 14:21:08 +0900    

Click here for diff

Also this commit unifies some duplicated code in makeBufFile() and  
BufFileOpenShared() into new function makeBufFileCommon().  
  
Author: Antonin Houska  
Reviewed-By: Thomas Munro, Tatsuo Ishii  
Discussion: https://postgr.es/m/16139.1529049566%40localhost  

M src/backend/storage/file/buffile.c

Fix off-by-one bug in XactLogCommitRecord

commit   : ff03112bdc70541382b39fa4e36b9a9ad93b4b73    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 Jun 2018 15:00:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 Jun 2018 15:00:41 -0400    

Click here for diff

Commit 1eb6d6527aae introduced zeroed alignment bytes in the GID field  
of commit/abort WAL records.  Fixup commit cf5a1890592b later changed  
that representation into a regular cstring with a single terminating  
zero byte, but it also introduced an off-by-one mistake.  Fix that.  
  
Author: Nikhil Sontakke  
Reported-by: Nikhil Sontakke  
Discussion: https://postgr.es/m/CAMGcDxey6dG1DP34_tJMoWPcp5sPJUAL4K5CayUUXLQSx2GQpA@mail.gmail.com  

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

Fix memory leak in PLySequence_ToJsonbValue()

commit   : dad8bed04ab98ada84ecd58ace6f59839aa161c4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 15 Jun 2018 15:01:46 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 15 Jun 2018 15:01:46 +0300    

Click here for diff

PyObject returned from PySequence_GetItem() is not released.  Similar code in PLyMapping_ToJsonbValue() is correct, because according to Python documentation  
PyList_GetItem() and PyTuple_GetItem() return a borrowed reference while  
PySequence_GetItem() returns new reference.  contrib/jsonb_plpython is new  
in PostgreSQL 11, no backpatch is needed.  
  
Author: Nikita Glukhov  
Discussion: https://postgr.es/m/6001af16-b242-2527-bc7e-84b8a959163b%40postgrespro.ru  

M contrib/jsonb_plpython/jsonb_plpython.c

Fix memory leak.

commit   : 969274d813018b08389956e493f691671f0d84f1    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Fri, 15 Jun 2018 16:32:59 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Fri, 15 Jun 2018 16:32:59 +0900    

Click here for diff

Memory is allocated twice for "file" and "files" variables in  
BufFileOpenShared().  
  
Author: Antonin Houska  
Discussion: https://postgr.es/m/11329.1529045692%40localhost  

M src/backend/storage/file/buffile.c

Fail BRIN control functions during recovery explicitly

commit   : 74da7cda31c07122257c527d9fd068dc28493fc8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 14 Jun 2018 12:51:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 14 Jun 2018 12:51:32 -0400    

Click here for diff

They already fail anyway, but prior to this patch they raise an ugly  
error message about a lock that cannot be acquired.  This just improves  
the message.  
  
Author: Masahiko Sawada  
Reported-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoBZau4g4_NUf3BKNd=CdYK+xaPdtJCzvOC1TxGdTiJx_Q@mail.gmail.com  
Reviewed-by: Kuntal Ghosh, Alexander Korotkov, Simon Riggs, Michaƫl Paquier, Ɓlvaro Herrera  

M src/backend/access/brin/brin.c

commit   : dc878ffedf2aa461b11b617094101e3c4cf48daa    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 14 Jun 2018 12:17:51 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 14 Jun 2018 12:17:51 +0100    

Click here for diff

GetRunningTransactionData() suggested that subxids were not worth  
optimizing away if overflowed, yet they have already been removed  
for that case.  
  
Changes to LogAccessExclusiveLock() API forgot to remove the  
prior comment when it was copied to LockAcquire().  

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

Remove cut-off bug from RunningTransactionData

commit   : 802bde87ba3c64b28d019e8265c2d8948a027c9c    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 14 Jun 2018 12:02:41 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 14 Jun 2018 12:02:41 +0100    

Click here for diff

32ac7a118fc17f5 tried to fix a Hot Standby issue  
reported by Greg Stark, but in doing so caused  
a different bug to appear, noted by Andres Freund.  
  
Revoke the core changes from 32ac7a118fc17f5,  
leaving in its place a minor change in code  
ordering and comments to explain for the future.  

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

Code review for match_clause_to_partition_key().

commit   : 91781335ede4db549a28ffb8e84d3b592eef9f2f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jun 2018 16:10:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jun 2018 16:10:30 -0400    

Click here for diff

Fix inconsistent decisions about NOMATCH vs UNSUPPORTED result codes.  
If we're going to cater for partkeys that have the same expression and  
different collations, surely we should also support partkeys with the  
same expression and different opclasses.  
  
Clean up shaky handling of commuted opclauses, eg checking the wrong  
operator to see what its negator is.  This wouldn't cause any actual  
bugs given a sane opclass definition, but it doesn't seem helpful to  
expend more code to be less correct.  
  
Improve handling of null elements in ScalarArrayOp arrays: in the  
"op ALL" case, we can conclude they result in an unsatisfiable clause.  
  
Minor cosmetic changes and comment improvements.  

M src/backend/partitioning/partprune.c

Fix some ill-chosen names for globally-visible partition support functions.

commit   : 19832753f1bb052c5fe10328939b670507df7a93    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jun 2018 13:18:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jun 2018 13:18:02 -0400    

Click here for diff

"compute_hash_value" is particularly gratuitously generic, but IMO  
all of these ought to have names clearly related to partitioning.  

M src/backend/commands/tablecmds.c
M src/backend/executor/execPartition.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/utils/cache/partcache.c
M src/include/partitioning/partbounds.h

Fix up run-time partition pruning's use of relcache's partition data.

commit   : e23bae82cf3d76365d48b1204ca4c631bac7550d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jun 2018 12:03:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jun 2018 12:03:19 -0400    

Click here for diff

The previous coding saved pointers into the partitioned table's relcache  
entry, but then closed the relcache entry, causing those pointers to  
nominally become dangling.  Actual trouble would be seen in the field  
only if a relcache flush occurred mid-query, but that's hardly out of  
the question.  
  
While we could fix this by copying all the data in question at query  
start, it seems better to just hold the relcache entry open for the  
whole query.  
  
While at it, improve the handling of support-function lookups: do that  
once per query not once per pruning test.  There's still something to be  
desired here, in that we fail to exploit the possibility of caching data  
across queries in the fn_extra fields of the relcache's FmgrInfo structs,  
which could happen if we just used those structs in-place rather than  
copying them.  However, combining that with the possibility of per-query  
lookups of cross-type comparison functions seems to require changes in the  
APIs of a lot of the pruning support functions, so it's too invasive to  
consider as part of this patch.  A win would ensue only for complex  
partition key data types (e.g. arrays), so it may not be worth the  
trouble.  
  
David Rowley and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/partitioning/partprune.c
M src/backend/utils/cache/relcache.c
M src/include/executor/execPartition.h
M src/include/partitioning/partprune.h

Documentation improvement for pg_trgm

commit   : e146e4d02dbc241b6091596331fb1bdf0fb1c081    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 13 Jun 2018 18:23:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 13 Jun 2018 18:23:00 +0300    

Click here for diff

Documentation of word_similarity() and strict_word_similarity() functions  
contains some vague wordings which could confuse users.  This patch makes  
those wordings more clear.  word_similarity() was introduced in PostgreSQL 9.6,  
and corresponding part of documentation needs to be backpatched.  
  
Author: Bruce Momjian, Alexander Korotkov  
Discussion: https://postgr.es/m/20180526165648.GB12510%40momjian.us  
Backpatch: 9.6, where word_similarity() was introduced  

M doc/src/sgml/pgtrgm.sgml

Exclude files in .git from list of perl files

commit   : e3eb8be77ef82ccc8f87c515f96d01bf7c726ca8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 12 Jun 2018 14:54:43 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 12 Jun 2018 14:54:43 -0400    

Click here for diff

The .git directory might contain perl files, as hooks, for example.  
Since we have no control over these they should be excluded from things  
like our perlcritic checks.  
  
Per offline report from Mike Blackwell.  

M src/tools/perlcheck/find_perl_files

Fix bugs in vacuum of shared rels, by keeping their relcache entries current.

commit   : a54e1f1587793b5bf926630ec9ce142e4578d7a0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Jun 2018 11:13:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Jun 2018 11:13:21 -0700    

Click here for diff

When vacuum processes a relation it uses the corresponding relcache  
entry's relfrozenxid / relminmxid as a cutoff for when to remove  
tuples etc. Unfortunately for nailed relations (i.e. critical system  
catalogs) bugs could frequently lead to the corresponding relcache  
entry being stale.  
  
This set of bugs could cause actual data corruption as vacuum would  
potentially not remove the correct row versions, potentially reviving  
them at a later point.  After 699bf7d05c some corruptions in this vein  
were prevented, but the additional error checks could also trigger  
spuriously. Examples of such errors are:  
  ERROR: found xmin ... from before relfrozenxid ...  
and  
  ERROR: found multixact ... from before relminmxid ...  
To be caused by this bug the errors have to occur on system catalog  
tables.  
  
The two bugs are:  
  
1) Invalidations for nailed relations were ignored, based on the  
   theory that the relcache entry for such tables doesn't  
   change. Which is largely true, except for fields like relfrozenxid  
   etc.  This means that changes to relations vacuumed in other  
   sessions weren't picked up by already existing sessions.  Luckily  
   autovacuum doesn't have particularly longrunning sessions.  
  
2) For shared *and* nailed relations, the shared relcache init file  
   was never invalidated while running.  That means that for such  
   tables (e.g. pg_authid, pg_database) it's not just already existing  
   sessions that are affected, but even new connections are as well.  
   That explains why the reports usually were about pg_authid et. al.  
  
To fix 1), revalidate the rd_rel portion of a relcache entry when  
invalid. This implies a bit of extra complexity to deal with  
bootstrapping, but it's not too bad.  The fix for 2) is simpler,  
simply always remove both the shared and local init files.  
  
Author: Andres Freund  
Reviewed-By: Alvaro Herrera  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/CAMa1XUhKSJd98JW4o9StWPrfS=11bPgG+_GDMxe25TvUY4Sugg@mail.gmail.com  
    https://postgr.es/m/CAKMFJucqbuoDRfxPDX39WhA3vJyxweRg_zDVXzncr6+5wOguWA@mail.gmail.com  
    https://postgr.es/m/CAGewt-ujGpMLQ09gXcUFMZaZsGJC98VXHEFbF-tpPB0fB13K+A@mail.gmail.com  
Backpatch: 9.3-  

M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/include/storage/standbydefs.h

Convert debug message from ereport to elog

commit   : 8a07ebb3c172374aa2c83df61c4e05c059511c9a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jun 2018 11:33:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jun 2018 11:33:39 -0400    

Click here for diff

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

doc: Replace non-ASCII lines in psql example output

commit   : b5d099f82ae6e7c49c397bd85832f13729626035    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jun 2018 08:19:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Jun 2018 08:19:52 -0400    

Click here for diff

We normally use the default line mode in examples.  

M doc/src/sgml/jit.sgml

doc: Suggest logical replication more prominently for upgrading

commit   : 8f6c94272c485bb812aebe063fc412326a17b880    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 21:34:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 21:34:32 -0400    

Click here for diff

The previous wording suggested only Slony, and there are more options  
available.  

M doc/src/sgml/runtime.sgml

Fix access to just-closed relcache entry.

commit   : bdc643e5e46f84d55d989980e4ff5f8e2da103c6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 19:17:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 19:17:50 -0400    

Click here for diff

It might be impossible for this to cause a problem in non-debug builds,  
since there'd be no opportunity for the relcache entry to get recycled  
before the fetch.  It blows up nicely with -DRELCACHE_FORCE_RELEASE plus  
valgrind, though.  
  
Evidently introduced by careless refactoring in commit f0e44751d.  
Back-patch accordingly.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Fix oversight from 9e149c8 with spin-lock handling

commit   : f8795d2ec8632a7242896e0f8322d13bfe922512    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Jun 2018 06:52:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Jun 2018 06:52:34 +0900    

Click here for diff

Calling an external function while a pin-lock is held is a bad idea as  
those are designed to be short-lived.  The stress of a first commit into  
a large git history may contribute to that.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c

Improve ExecFindInitialMatchingSubPlans's subplan renumbering logic.

commit   : 69025c5a07a10c842bfbcb62d4af1221e5ce7e85    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 17:35:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 17:35:43 -0400    

Click here for diff

We don't need two passes if we scan child partitions before parents,  
as that way the children's present_parts are up to date before they're  
needed.  I (tgl) think there's actually a bug being fixed here, for the  
case of an intermediate partitioned table with no direct leaf children,  
but haven't attempted to construct a test case to prove it.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f-6GODRNgEtdPxCnAPme2h2hTztB6LmtfdmcYAAOE0kQg@mail.gmail.com  

M src/backend/executor/execPartition.c

Improve commentary about run-time partition pruning data structures.

commit   : 4e23236403336052a000c8bf85720e9d65ba8036    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 17:14:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 17:14:46 -0400    

Click here for diff

No code changes except for a couple of new Asserts.  
  
David Rowley and Tom Lane  
  
Discussion: https://postgr.es/m/CAKJS1f-6GODRNgEtdPxCnAPme2h2hTztB6LmtfdmcYAAOE0kQg@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

Adjust error message

commit   : e5d11b91e42e20ff80effb946cb461c490d491ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 17:19:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 17:19:11 -0400    

Click here for diff

Makes it look more similar to other ones, and avoids the need for  
pluralization.  

M src/common/controldata_utils.c

Don't needlessly check the partition contraint twice

commit   : 5b0c7e2f757a2cbdd8e0c478de51bcb5606d3a93    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Jun 2018 16:53:33 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Jun 2018 16:53:33 -0400    

Click here for diff

Starting with commit f0e44751d717, ExecConstraints was in charge of  
running the partition constraint; commit 19c47e7c8202 modified that so  
that caller could request to skip that checking depending on some  
conditions, but that commit and 15ce775faa42 together introduced a small  
bug there which caused ExecInsert to request skipping the constraint  
check but have this not be honored -- in effect doing the check twice.  
This could have been fixed in a very small patch, but on further  
analysis of the involved function and its callsites, it turns out to be  
simpler to give the responsibility of checking the partition constraint  
fully to the caller, and return ExecConstraints to its original  
(pre-partitioning) shape where it only checked tuple descriptor-related  
constraints.  Each caller must do partition constraint checking on its  
own schedule, which is more convenient after commit 2f178441044 anyway.  
  
Reported-by: David Rowley  
Author: David Rowley, Ɓlvaro Herrera  
Reviewed-by: Amit Langote, Amit Khandekar, Simon Riggs  
Discussion: https://postgr.es/m/CAKJS1f8w8+awsxgea8wt7_UX8qzOQ=Tm1LD+U1fHqBAkXxkW2w@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h

Move perlcritic files to new perlcheck directory

commit   : 85dd744a70d167ca86e83ea38f5ac3e1449bb028    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Jun 2018 14:54:28 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Jun 2018 14:54:28 -0400    

Click here for diff

R091 src/tools/pgperlcritic/perlcriticrc src/tools/perlcheck/perlcriticrc
R055 src/tools/pgperlcritic/pgperlcritic src/tools/perlcheck/pgperlcritic

Add a script to detect perl compile time errors and warnings

commit   : af616ce48347c68af7bdcfe0e62d9ad601cb8d75    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Jun 2018 14:47:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Jun 2018 14:47:20 -0400    

Click here for diff

Also add a function that centralizes the logic for locating all our perl  
files and use it in pgperlcritic and pgperltidy as well as the new  
pgperlcheck.  

A src/tools/perlcheck/find_perl_files
A src/tools/perlcheck/pgperlsyncheck
M src/tools/pgindent/pgperltidy
M src/tools/pgperlcritic/pgperlcritic

Fix run-time partition pruning code to handle NULL values properly.

commit   : be3d90026a3c17c7e6cc23d52430c37df403d869    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 12:08:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jun 2018 12:08:09 -0400    

Click here for diff

The previous coding just ignored pruning constraints that compare a  
partition key to a null-valued expression.  This is silly, since really  
what we can do there is conclude that all partitions are rejected: the  
pruning operator is known strict so the comparison must always fail.  
  
This also fixes the logic to not ignore constisnull for a Const comparison  
value.  That's probably an unreachable case, since the planner would  
normally have simplified away a strict operator with a constant-null input.  
But this code has no business assuming that.  
  
David Rowley, per a gripe from me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make new error code name match SQL standard more closely

commit   : 387543f7bdf0f1ca3dc06e6bb5c9ef7980cf9f44    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 11:15:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 11:15:28 -0400    

Click here for diff

Discussion: https://www.postgresql.org/message-id/dff3d555-bea4-ac24-29b2-29521b9d08e8%402ndquadrant.com  

M doc/src/sgml/btree.sgml
M src/backend/executor/nodeWindowAgg.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/errcodes.txt

Update config.guess and config.sub

commit   : bfbb13264ae76a952a8312091d600db110b1c0eb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 08:54:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jun 2018 08:54:58 -0400    

Click here for diff

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

commit   : d61bfdda8c2cae671ca4a252993bb8feaa619285    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jun 2018 09:54:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jun 2018 09:54:25 +0900    

Click here for diff

Reported-by: Christopher Jones  

M doc/src/sgml/wal.sgml

Fix a couple of bugs with replication slot advancing feature

commit   : f731cfa94c00164814625d5753d376a4a7c43fff    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jun 2018 09:26:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jun 2018 09:26:13 +0900    

Click here for diff

A review of the code has showed up a couple of issues fixed by this  
commit:  
- Physical slots have been using the confirmed LSN position as a start  
comparison point which is always 0/0, instead use the restart LSN  
position (logical slots need to use the confirmed LSN position, which  
was correct).  
- The actual slot update was incorrect for both physical and logical  
slots.  Physical slots need to use their restart_lsn as base comparison  
point (confirmed_flush was used because of previous point), and logical  
slots need to begin reading WAL from restart_lsn (confirmed_flush was  
used as well), while confirmed_flush is compiled depending on the  
decoding context and record read, and is the LSN position returned back  
to the caller.  
- Never return 0/0 if a slot cannot be advanced.  This way, if a slot is  
advanced while the activity is idle, then the same position is returned  
to the caller over and over without raising an error.  Instead return  
the LSN the slot has been advanced to.  With repetitive calls, the same  
position is returned hence caller can directly monitor the difference in  
progress in bytes by doing simply LSN difference calculations, which  
should be monotonic.  
  
Note that as the slot is owned by the backend advancing it, then the  
read of those fields is fine lock-less, while updates need to happen  
while the slot mutex is held, so fix that on the way as well.  Other  
locks for in-memory data of replication slots have been already fixed  
previously.  
  
Some of those issues have been pointed out by Petr and Simon during the  
patch, while I noticed some of them after looking at the code.  This  
also visibly takes of a recently-discovered bug causing assertion  
failures which can be triggered by a two-step slot forwarding which  
first advanced the slot to a WAL page boundary and secondly advanced it  
to the latest position, say 'FF/FFFFFFF' to make sure that the newest  
LSN is used as forward point.  It would have been nice to drop a test  
for that, but the set of operators working on pg_lsn limits it, so this  
is left for a future exercise.  
  
Author: Michael Paquier  
Reviewed-by: Petr Jelinek, Simon Riggs  
Discussion: https://postgr.es/m/CANP8+jLyS=X-CAk59BJnsxKQfjwrmKicHQykyn52Qj-Q=9GLCw@mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/2840048a-1184-417a-9da8-3299d207a1d7%40postgrespro.ru  

M src/backend/replication/slotfuncs.c

Assorted cosmetic cleanup of run-time-partition-pruning code.

commit   : 321f648a312bd188b7a5c33a0548a57f45dfbf42    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Jun 2018 18:24:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Jun 2018 18:24:34 -0400    

Click here for diff

Use "subplan" rather than "subnode" to refer to the child plans of  
a partitioning Append; this seems a bit more specific and hence  
clearer.  Improve assorted comments.  No non-cosmetic changes.  
  
David Rowley and Tom Lane  
  
Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/plannodes.h

Relocate partition pruning structs to a saner place.

commit   : 939449de0e571b8c0b07674bb7095e06e93cc059    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Jun 2018 16:30:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Jun 2018 16:30:14 -0400    

Click here for diff

These struct definitions were originally dropped into primnodes.h,  
which is a poor choice since that's mainly intended for primitive  
expression node types; these are not in that category.  What they  
are is auxiliary info in Plan trees, so move them to plannodes.h.  
  
For consistency, also relocate some related code that was apparently  
placed with the aid of a dartboard.  
  
There's no interesting code changes in this commit, just reshuffling.  
  
David Rowley and Tom Lane  
  
Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h

Improve run-time partition pruning to handle any stable expression.

commit   : 73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Jun 2018 15:22:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Jun 2018 15:22:25 -0400    

Click here for diff

The initial coding of the run-time-pruning feature only coped with cases  
where the partition key(s) are compared to Params.  That is a bit silly;  
we can allow it to work with any non-Var-containing stable expression, as  
long as we take special care with expressions containing PARAM_EXEC Params.  
The code is hardly any longer this way, and it's considerably clearer  
(IMO at least).  Per gripe from Pavel Stehule.  
  
David Rowley, whacked around a bit by me  
  
Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/primnodes.h
M src/include/partitioning/partprune.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix grammar in REVOKE documentation

commit   : c83e2029909c5411ca11fd841851016f1f9810e6    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 10 Jun 2018 22:44:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 10 Jun 2018 22:44:17 +0900    

Click here for diff

Reported-by: Erwin Brandstetter  

M doc/src/sgml/ref/revoke.sgml

Fix and document lock handling for in-memory replication slot data

commit   : 9e149c847f398793ec1641885434dcd10837d89d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Jun 2018 14:30:55 -0400    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Jun 2018 14:30:55 -0400    

Click here for diff

While debugging issues on HEAD for the new slot forwarding feature of  
Postgres 11, some monitoring of the code surrounding in-memory slot data  
has proved that the lock handling may cause inconsistent data to be read  
by read-only callers of slot functions, particularly  
pg_get_replication_slots() which fetches data for the system view  
pg_replication_slots, or modules looking directly at slot information.  
  
The code paths involved in those problems concern logical decoding  
initialization (down to 9.4) and WAL reservation for slots (new as of  
10).  
  
A set of comments documenting all the lock handlings, particularly the  
dependency with LW locks for slots and the in_use flag as well as the  
internal mutex lock is added, based on a suggested by Simon Riggs.  
  
Some of the fixed code exists down to 9.4 where WAL decoding has been  
introduced, but as those race conditions are really unlikely going to  
happen as those concern code paths for slot and decoding creation, just  
fix the problem on HEAD.  
  
Author: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

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

Limit Parallel Hash's bucket array to MaxAllocSize.

commit   : 86a2218eb00eb6f97898945967c5f9c95c72b4c6    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 10 Jun 2018 20:30:25 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 10 Jun 2018 20:30:25 +1200    

Click here for diff

Make sure that we don't exceed MaxAllocSize when increasing the number of  
buckets.  Perhaps later we'll remove that limit and use DSA_ALLOC_HUGE, but  
for now just prevent further increases like the non-parallel code.  This  
change avoids the error from bug report #15225.  
  
Author: Thomas Munro  
Reviewed-By: Tom Lane  
Reported-by: Frits Jalvingh  
Discussion: https://postgr.es/m/152802081668.26724.16985037679312485972%40wrigleys.postgresql.org  

M src/backend/executor/nodeHash.c

Fix typo in JIT README.

commit   : f6b95ff434bff28c0d9b390d5a0ff316847c4fb7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 9 Jun 2018 09:33:53 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 9 Jun 2018 09:33:53 -0700    

Click here for diff

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

M src/backend/jit/README

Teach SHOW ALL to honor pg_read_all_settings membership

commit   : 0c8910a0cab7c1e439bf5f5850122c36359e6799    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Jun 2018 16:18:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Jun 2018 16:18:40 -0400    

Click here for diff

Also, fix the pg_settings view to display source filename and line  
number when invoked by a pg_read_all_settings member.  This addition by  
me (Ɓlvaro).  
  
Also, fix wording of the comment in GetConfigOption regarding the  
restriction it implements, renaming the parameter for extra clarity.  
Noted by Michaƫl.  
  
These were all oversight in commit 25fff40798fc; backpatch to pg10,  
where that commit first appeared.  
  
Author: Laurenz Albe  
Reviewed-by: Michaƫl Paquier, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo

commit   : acad8b409add4bde37e3882c1680a7bd26289f03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jun 2018 11:55:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jun 2018 11:55:12 -0400    

Click here for diff

M src/backend/executor/execMain.c

Add missing serial commas

commit   : 25cf4ed1dc4e16da042e73ef5090e54bcf271f45    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jun 2018 23:37:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jun 2018 23:37:09 -0400    

Click here for diff

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

doc: Move some new options into better positions on man pages

commit   : 5efbdd36f1584d5e6e3870a05dc5f53692b18df6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jun 2018 23:36:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jun 2018 23:36:04 -0400    

Click here for diff

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

ecpg: Document new compatibility option

commit   : 3b9b7516f42b72589951bb8d47a0220c67fb70de    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jun 2018 23:33:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jun 2018 23:33:24 -0400    

Click here for diff

It's listed in --help, so it should be listed in the man page as well.  

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

Exclude VACUUMs from RunningXactData

commit   : 32ac7a118fc17f5baac1b370f50d759c30bee00a    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 7 Jun 2018 20:38:12 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 7 Jun 2018 20:38:12 +0100    

Click here for diff

GetRunningTransactionData() should ignore VACUUM procs because in some  
cases they are assigned xids. This could lead to holding back xmin via  
the route of passing the xid to standby and then having that hold back  
xmin on master via feedback.  
  
Backpatch to 9.1 needed, but will only do so on supported versions.  
Backpatch once proven on the buildfarm.  
  
Reported-by: Greg Stark  
Author: Simon Riggs  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CANP8+jJBYt=4PpTfiPb0UrH1_iPhzsxKH5Op_Wec634F0ohnAw@mail.gmail.com  

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

Fix typo in README

commit   : 848b1f3e358f4a1bb98d8c4a07ff8ee5fd7ea9a0    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 7 Jun 2018 14:40:38 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 7 Jun 2018 14:40:38 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/backend/optimizer/README

Fix obsolete comment.

commit   : 57f06a7611cc4806f581ae838f145181164056d4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 7 Jun 2018 09:56:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 7 Jun 2018 09:56:22 +0300    

Click here for diff

The 'orig_slot' argument was removed in commit c0a8ae7be392, but that  
commit forgot to update the comment.  
  
Author: Amit Langote  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/executor/nodeModifyTable.c

Fix function code in error report

commit   : eee381ef5ec4b16cff37865ccd70510e1e1abcdc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 6 Jun 2018 14:46:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 6 Jun 2018 14:46:53 -0400    

Click here for diff

This bug causes a lseek() failure to be reported as a "could not open"  
failure in the error message, muddling bug reports.  I introduced this  
copy-and-pasteo in commit 78e122010422.  
  
Noticed while reviewing code for bug report #15221, from lily liang.  In  
version 10 the affected function is only used by multixact.c and  
commit_ts, and only in corner-case circumstances, neither of which are  
involved in the reported bug (a pg_subtrans failure.)  
  
Author: Ɓlvaro Herrera  

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

Fix spurious non-ASCII bytes

commit   : 3f85c62d9e825eedd1315d249ef1ad793ca78ed4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jun 2018 16:17:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jun 2018 16:17:34 -0400    

Click here for diff

M src/backend/catalog/heap.c

Fix typo

commit   : 2241ad1556b3734b4867117bee8d78ef9577fceb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jun 2018 15:34:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jun 2018 15:34:42 -0400    

Click here for diff

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

Put new command-line options into alphabetical order

commit   : 4d6a854f176dbb48e62f017d8234f4736cb48d24    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jun 2018 15:03:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jun 2018 15:03:15 -0400    

Click here for diff

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

Tweak partitioning documentation wording

commit   : 12b9affb32a636777062b3feb5816621363fc108    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Jun 2018 14:54:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Jun 2018 14:54:43 -0400    

Click here for diff

For clarity, precision, grammar.  
  
Author: Justin Pryzby  
Reviewed-by: Amit Langote, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Reconcile nodes/*funcs.c with PostgreSQL 11 work.

commit   : ef3109500030030b0e8d3c1d7f2b409d702cc49a    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 31 May 2018 16:07:13 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 31 May 2018 16:07:13 -0700    

Click here for diff

This covers new fields in two outfuncs.c functions having no readfuncs.c  
counterpart.  Thus, this changes only debugging output.  

M src/backend/nodes/outfuncs.c

Fix compile-time warnings on all perl code

commit   : 0039049fb1d76afef05d550823b27731ad7d7b3d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 31 May 2018 08:13:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 31 May 2018 08:13:02 -0400    

Click here for diff

This patch does two things. First, it silences a number of compile-time  
warnings in the msvc tools files, mainly those due to the fact that in  
some cases we have more than one package per file. Second it supplies a  
dummy Perl library with just enough of the Windows API referred to in  
our code to let it run these checks cleanly, even on Unix machines where  
the code is never supposed to run. The dummy library should only be used  
for that purpose, as its README notes.  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VCBuildProject.pm
M src/tools/msvc/VSObjectFactory.pm
A src/tools/msvc/dummylib/README
A src/tools/msvc/dummylib/Win32.pm
A src/tools/msvc/dummylib/Win32/Registry.pm
A src/tools/msvc/dummylib/Win32API/File.pm

Fix grammar

commit   : d3b10f0d64e90e9c78b8adc24ab3e38b30ef60bd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 May 2018 14:08:51 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 May 2018 14:08:51 -0400    

Click here for diff

Reported-by: Pavlo Golub  
Author: Michaƫl Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Move _bt_upgrademetapage() into critical section.

commit   : 08186dc05b3eed9c1f29b3349b122487d84ef3eb    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 30 May 2018 19:45:39 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 30 May 2018 19:45:39 +0300    

Click here for diff

Any changes on page should be done in critical section, so move  
_bt_upgrademetapage into critical section. Improve comment. Found by Amit  
Kapila during post-commit review of 857f9c36.  
  
Author: Amit Kapila  

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

Initialize new jsonb iterator to zero

commit   : 3c9cf069454d80b0b4a54a0a90941a88a97b1122    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 May 2018 23:53:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 May 2018 23:53:43 -0400    

Click here for diff

Use palloc0() instead of palloc() to create a new JsonbIterator.  
Otherwise, the isScalar field is sometimes not initialized.  There is  
probably no impact in practice, but it's cleaner this way and it avoids  
future problems.  

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

Return a value from Install.pm's lcopy function

commit   : 01deec5f8ae64b5120cc8c93d54fe0e19e477b02    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 May 2018 16:44:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 May 2018 16:44:13 -0400    

Click here for diff

Commit 3a7cc727c was a little over eager about adding an explicit return  
to this function, whose value is checked in most call sites. This change  
reverses that and returns the expected value explicitly. It also adds a  
check to the one call site lacking one.  

M src/tools/msvc/Install.pm

doc: mark 'replaceable' parameter for backup program listing

commit   : 6a75b58065c8da69a259657fc40d18e76157f265    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 28 May 2018 14:19:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 28 May 2018 14:19:45 -0400    

Click here for diff

Reported-by: Liudmila Mantrova  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Liudmila Mantrova  
  
Backpatch-through: 9.3  

M doc/src/sgml/backup.sgml

doc: adjust DECLARE docs to mention FOR UPDATE behavior

commit   : 99164e6952917009929026a9a11e4a500f599c40    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 28 May 2018 13:16:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 28 May 2018 13:16:02 -0400    

Click here for diff

Reported-by: Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Peter Eisentraut, Tom Lane, me  
  
Backpatch-through: 9.3  

M doc/src/sgml/ref/declare.sgml

Avoid use of unportable hex constant in convutils.pm

commit   : f963f80970641246cbba172e197068193ad65189    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 27 May 2018 10:41:19 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 27 May 2018 10:41:19 -0400    

Click here for diff

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

M src/backend/utils/mb/Unicode/convutils.pm

Don't fall off the end of perl functions

commit   : 3a7cc727c7c502353dbb730a0db793abec4de44b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 27 May 2018 09:08:42 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 27 May 2018 09:08:42 -0400    

Click here for diff

This complies with the perlcritic policy  
Subroutines::RequireFinalReturn, which is a severity 4 policy. Since we  
only currently check at severity level 5, the policy is raised to that  
level until we move to level 4 or lower, so that any new infringements  
will be caught.  
  
A small cosmetic piece of tidying of the pgperlcritic script is  
included.  
  
Mike Blackwell  
  
Discussion: https://postgr.es/m/CAESHdJpfFm_9wQnQ3koY3c91FoRQsO-fh02za9R3OEMndOn84A@mail.gmail.com  

M contrib/bloom/t/001_wal.pl
M contrib/intarray/bench/create_test.pl
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/parser/check_keywords.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/sort/gen_qsort_tuple.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/include/catalog/reformat_dat_file.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/text2macro.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/SimpleTee.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/009_twophase.pl
M src/test/ssl/ServerSetup.pm
M src/tools/copyright.pl
M src/tools/git_changelog
M src/tools/msvc/Install.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VCBuildProject.pm
M src/tools/msvc/builddoc.pl
M src/tools/msvc/gendef.pl
M src/tools/msvc/vcregress.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/pgperlcritic/perlcriticrc
M src/tools/pgperlcritic/pgperlcritic
M src/tools/version_stamp.pl

Don't force a blank line before comments in perl code

commit   : 8a56ff484808e9c05df9656cf4244229e8c7960d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 27 May 2018 08:53:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 27 May 2018 08:53:54 -0400    

Click here for diff

Suggestion from Bruce Momjian  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/perltidyrc

Update a couple of long-obsolete comments in pg_type.h.

commit   : 71b349aef4c4eb766e556360cfb5f5190c02b9c1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 May 2018 13:47:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 May 2018 13:47:26 -0400    

Click here for diff

M src/include/catalog/pg_type.h

Fix misidentification of SQL statement type in plpgsql's exec_stmt_execsql.

commit   : 9a8aa25ccc6c285cd4f02afe4718eafd20dc34c5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 May 2018 14:31:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 May 2018 14:31:06 -0400    

Click here for diff

To distinguish SQL statements that are INSERT/UPDATE/DELETE from other  
ones, exec_stmt_execsql looked at the post-rewrite form of the statement  
rather than the original.  This is problematic because it did that only  
during first execution of the statement (in a session), but the correct  
answer could change later due to addition or removal of DO INSTEAD rules  
during the session.  That could lead to an Assert failure, as reported  
by Tushar Ahuja and Robert Haas.  In non-assert builds, there's a hazard  
that we would fail to enforce STRICT behavior when we'd be expected to.  
That would happen if an initially present DO INSTEAD, that replaced the  
original statement with one of a different type, were removed; after that  
the statement should act "normally", including strictness enforcement, but  
it didn't.  (The converse case of enforcing strictness when we shouldn't  
doesn't seem to be a hazard, as addition of a DO INSTEAD that changes the  
statement type would always lead to acting as though the statement returned  
zero rows, so that the strictness error could not fire.)  
  
To fix, inspect the original form of the statement not the post-rewrite  
form, making it valid to assume the answer can't change intra-session.  
This should lead to the same answer in every case except when there is a  
DO INSTEAD that changes the statement type; we will now set mod_stmt=true  
anyway, while we would not have done so before.  That breaks the Assert  
in the SPI_OK_REWRITTEN code path, which expected the latter behavior.  
It might be all right to assert mod_stmt rather than !mod_stmt there,  
but I'm not entirely convinced that that'd always hold, so just remove  
the assertion altogether.  
  
This has been broken for a long time, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CA+TgmoZUrRN4xvZe_BbBn_Xp0BDwuMEue-0OyF0fJpfvU2Yc7Q@mail.gmail.com  

M src/pl/plpgsql/src/pl_exec.c

Remove incorrect statement about IPC configuration on OpenBSD

commit   : 7019c21c1bf51eafb56595b916c216ca860ad499    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 25 May 2018 13:59:50 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 25 May 2018 13:59:50 +0200    

Click here for diff

kern.ipc.shm_use_phys is not a sysctl on OpenBSD, and SEMMAP is not  
a kernel configuration option. These were probably copy pasteos from  
when the documentation had a single paragraph for *BSD.  
  
Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/runtime.sgml

Update non-default collation tests for getObjectDescription() changes.

commit   : 2eb809ad7e71737b1a1ef5679d8e4c88e785669e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 17:41:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 17:41:52 -0400    

Click here for diff

Sigh, also missed in commit b86b7bfa3.  Per buildfarm.  

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

Update sepgsql regression test output for getObjectDescription() changes.

commit   : f248453b7a1b0590b3c7cf32a958573b70e23b09    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 16:11:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 16:11:25 -0400    

Click here for diff

Missed in commit b86b7bfa3.  Per buildfarm.  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/misc.out

Improve English wording of some other getObjectDescription() messages.

commit   : b86b7bfa3e8b3e4255352ca564b3f1270e708274    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 14:01:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 14:01:10 -0400    

Click here for diff

Print columns as "column C of <relation>" rather than "<relation> column  
C".  This seems to read noticeably better in English, as evidenced by the  
regression test output changes, and the code change also makes it possible  
for translators to adjust the phrase order in other languages.  
  
Also change the output for OCLASS_DEFAULT from "default for %s" to  
"default value for %s".  This seems to read better and is also more  
consistent with the output of, for instance, getObjectTypeDescription().  
  
Kyotaro Horiguchi, per a complaint from me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/earthdistance/expected/earthdistance.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/catalog/objectaddress.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/domain.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/triggers.out

Improve translatability of some getObjectDescription() messages.

commit   : 7c89eb750d0cc4e33c46c62154c461be57883b72    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 13:20:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 13:20:16 -0400    

Click here for diff

Refactor some cases in getObjectDescription so that the translator has  
more control over phrase order in the translated messages.  This doesn't  
cause any changes in the English results.  (I was sorely tempted to  
reorder "... belonging to role %s in schema %s" into "... in schema %s  
belonging to role %s", but refrained.)  
  
In principle we could back-patch this, but since translators have not  
complained about these cases previously, it seems better not to thrash  
the translatable strings in back branches.  
  
Kyotaro Horiguchi, tweaked a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c

Fix objectaddress.c code for publication relations.

commit   : 1a31baf61ed81a13d034bd50db19473ad67acc52    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 12:38:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 12:38:55 -0400    

Click here for diff

getObjectDescription and getObjectIdentity failed to schema-qualify  
the name of the published table, which is bad in getObjectDescription and  
unforgivable in getObjectIdentity.  Actually, getObjectIdentity failed to  
emit the table's name at all unless "objname" output is requested, which  
accidentally works for some (all?) extant callers but is clearly not the  
intended API.  Somebody had also not gotten the memo that the output of  
getObjectIdentity is not to be translated.  
  
To fix getObjectDescription, I made it call getRelationDescription, which  
required refactoring the translatable string for the case, but is more  
future-proof in case we ever publish relations that aren't plain tables.  
While at it, I made the English output look like "publication of table X  
in publication Y"; the added "of" seems to me to make it read much better.  
  
Back-patch to v10 where publications were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out

Properly schema-qualify additional object types in getObjectDescription().

commit   : 056f52d9c3ee2dd85b5f1acdbb4e0497f82725b3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 12:07:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 May 2018 12:07:41 -0400    

Click here for diff

Collations, conversions, extended statistics objects (in >= v10),  
and all four types of text search objects have schema-qualified names.  
getObjectDescription() ignored that and would emit just the base name of  
the object, potentially producing wrong or at least highly misleading  
output.  Fix it to add the schema name whenever the object is not "visible"  
in the current search path, as is the rule for other schema-qualifiable  
object types.  
  
Although in common situations the output won't change, this seems to me  
(tgl) to be a bug worthy of back-patching, hence do so.  
  
Kyotaro Horiguchi, per a complaint from me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Preserve information on use of git-external-diff

commit   : 4431c94c3606ab54594b15ad89c7e71e46b4fb6a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 24 May 2018 23:45:31 +0930    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 24 May 2018 23:45:31 +0930    

Click here for diff

Now that the Working with git wiki page no longer suggests producing  
context diffs, we should preserve the information on how to use  
git-external-diff for those people who want to view context format  
diffs. The most obvious place is in the script itself, so that's what's  
done here.  

M src/tools/git-external-diff

doc: PG 11 rel notes: add PL/pgSQL composite DDL item

commit   : 0c7e6b791a316431fb206a9ae2184377c4296995    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 23 May 2018 22:06:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 23 May 2018 22:06:31 -0400    

Click here for diff

Reported-by: Tom Lane  

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

Fix simple_prompt() to disable echo on Windows when stdin != terminal.

commit   : 50485b3e201dda8498e799b769e624db20e86cff    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 May 2018 19:04:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 May 2018 19:04:34 -0400    

Click here for diff

If echo = false, simple_prompt() is supposed to prevent echoing the  
input (for password input).  However, the Windows implementation applied  
the mode change to STD_INPUT_HANDLE.  That would not have the desired  
effect if stdin isn't actually the terminal, for instance if the user  
is piping something into psql.  Fix it to apply the mode change to  
the correct input file, so that passwords do not echo in such cases.  
  
In passing, shorten and de-uglify this code by using #elif rather than  
an #if nest and removing some duplicated code.  
  
Back-patch to all supported versions.  To simplify that, also back-patch  
the portions of commit 9daec77e1 that got rid of an unnecessary  
malloc/free in the same area.  
  
Matthew Stickney (cosmetic changes by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/sprompt.c

Remove configure's check for nonstandard "long long" printf modifiers.

commit   : b929614f5e867c70721b3db31d3dec6cb35e1eb5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 May 2018 14:19:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 May 2018 14:19:04 -0400    

Click here for diff

We used to claim to support platforms using 'q' or 'I64' as the printf  
length modifier for long long int, by dint of replacing snprintf with  
our own code which uses the C99 standard 'll' modifier.  But that is  
only adequate if we use INT64_MODIFIER only in snprintf-based calls,  
not directly with the platform's native printf or fprintf.  Which  
hasn't been the case for years.  We had not noticed, partially because  
of inadequate test coverage, and partially because the buildfarm is  
almost completely bare of machines that won't take 'll'.  The last  
one seems to have been frogmouth, which was adjusted recently so that  
it will take 'll'.  We might as well just give up on the pretense  
that anything else works, and save ourselves some configure cycles.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M config/c-library.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Fix incorrect ordering of operations in pg_resetwal and pg_rewind.

commit   : 1d96c1b91a4b7da6288ee63671a234b557ff5ccf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 May 2018 10:59:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 May 2018 10:59:55 -0400    

Click here for diff

Commit c37b3d08c dropped its added GetDataDirectoryCreatePerm call into  
the wrong place in pg_resetwal.c, namely after the chdir to DataDir.  
That broke invocations using a relative path, as reported by Tushar Ahuja.  
We could have left it where it was and changed the argument to be ".",  
but that'd result in a rather confusing error message in event of a  
failure, so re-ordering seems like a better solution.  
  
Similarly reorder operations in pg_rewind.c.  The issue there is that  
it doesn't seem like a good idea to do any actual operations before the  
not-root check (on Unix) or the restricted token acquisition (on Windows).  
I don't know that this is an actual bug, but I'm definitely not convinced  
that it isn't, either.  
  
Assorted other code review for c37b3d08c and da9b580d8: fix some  
misspelled or otherwise badly worded comments, put the #include for  
<sys/stat.h> where it actually belongs, etc.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/fd.c
M src/backend/utils/init/globals.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/common/file_perm.c
M src/include/common/file_perm.h

Accept "B" in all memory-unit GUCs, and improve error messages.

commit   : b06d8e58b5ac257c2119312c47c4a0f233c5e0ca    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 23 May 2018 10:02:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 23 May 2018 10:02:40 +0300    

Click here for diff

Commit 6e7baa3227 added support for "B" unit, for specifying config options  
in bytes. However, it was only accepted in GUC_UNIT_BYTE settings,  
wal_segment_size and track_activity_query_size, and not e.g. in work_mem.  
This patch makes it consistent, so that "B" accepted in all the same  
contexts where "kB", "MB", and so forth are accepted.  
  
Add "B" to the list of accepted units in the error hint, along with "kB",  
"MB", etc.  
  
Add an entry in the conversion table for "TB" to "B" conversion. A terabyte  
is out of range for any GUC_UNIT_BYTE option, so you always get an "out of  
range" error with that, but without it, you get a confusing error message  
that claims that "TB" is not an accepted unit, with a hint that nevertheless  
lists "TB" as an accepted unit.  
  
Reviewed-by: Alexander Korotkov, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

doc: PG 11 release notes fix for pg_dump --create, author

commit   : e41c2b057f92c3824ffe0157e83ee43624487035    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 22 May 2018 22:39:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 22 May 2018 22:39:48 -0400    

Click here for diff

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

doc: PG 11 release notes, add third author

commit   : fd287b4669cd728d6b436fac32a9b7ff26608248    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 22 May 2018 21:42:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 22 May 2018 21:42:25 -0400    

Click here for diff

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

doc: PG 11 release note fixes: PGhost, typo

commit   : 9490c2da28662ca2b0f60d09e83d278d00f20501    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 22 May 2018 21:40:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 22 May 2018 21:40:55 -0400    

Click here for diff

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

Widen COPY FROM's current-line-number counter from 32 to 64 bits.

commit   : ecac23511e04d96b94705731873fa3d238c41f8d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 May 2018 13:32:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 May 2018 13:32:52 -0400    

Click here for diff

Because the code for the HEADER option skips a line when this counter  
is zero, a very long COPY FROM WITH HEADER operation would drop a line  
every 2^32 lines.  A lesser but still unfortunate problem is that errors  
would show a wrong input line number for errors occurring beyond the  
2^31'st input line.  While such large input streams seemed impractical  
when this code was first written, they're not any more.  Widening the  
counter (and some associated variables) to uint64 should be enough to  
prevent problems for the foreseeable future.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f88yh-6wwEfO6QLEEvH3BEugOq2QX1TOja0vCauoynmOQ@mail.gmail.com  

M src/backend/commands/copy.c

Add missing files to src/backend/lib/README.

commit   : 17f188cf000787236b4099242300cda4df0af6c0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 22 May 2018 13:17:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 22 May 2018 13:17:33 +0300    

Click here for diff

The README lists all the files available in the directory, along with short  
descriptions of each, but a few newly added ones were missing. While we're  
at it, reorder the list into alphabetical order.  
  
Author: Takeshi Ideriha  
Discussion: https://www.postgresql.org/message-id/4E72940DA2BF16479384A86D54D0988A56793487@G01JPEXMBKW04  

M src/backend/lib/README

Fix typo in comment.

commit   : a0b37684ba1c7ce6380db6ff6817cf9f3a85b94c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 22 May 2018 11:15:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 22 May 2018 11:15:00 +0300    

Click here for diff

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

Stamp 11beta1.

commit   : 586e4e6df5b85ddd28c9e881d237bd7380ffeb8e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 17:08:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 17:08:10 -0400    

Click here for diff

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

Update SQL features list

commit   : 4f72ca14de87eccd2bc622fcbc109a3e7bfccb77    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 15:29:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 15:29:22 -0400    

Click here for diff

M src/backend/catalog/sql_features.txt

doc: Use = after long options in documentation

commit   : ca797f5c049db4adf27495adef1d91b71f0d481c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 14:54:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 14:54:24 -0400    

Click here for diff

It's good for consistency and makes the examples easier to read.  

M doc/src/sgml/logicaldecoding.sgml

doc: Fix some trailing whitespace

commit   : f037de6aeb6a4203d15b2b16dfaa194e952dffea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 14:49:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 14:49:53 -0400    

Click here for diff

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/spgist.sgml

doc: Whitespace fixes in man pages

commit   : 477d243b0f1fb4dfb3ca9e478824ccb7bcda72db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 14:41:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 14:41:27 -0400    

Click here for diff

M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml

Doc: preliminary list of PG11 major features.

commit   : 4aad161c9a6de56ceb470277038d9583e4260425    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 12:36:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 12:36:59 -0400    

Click here for diff

This might get bike-shedded a bit later, but it's better than shipping  
beta1 with no list.  
  
Jonathan Katz  
  
Discussion: https://postgr.es/m/[email protected]  

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

Translation updates

commit   : 917a68f010eb4c7e91b11ae1abe229cad722f675    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 12:27:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 12:27:42 -0400    

Click here for diff

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

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

Fix SQL:2008 FETCH FIRST syntax to allow parameters.

commit   : 1da162e1f5a783bd0ce26e6a07c0138dc8a47d44    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 21 May 2018 17:02:17 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 21 May 2018 17:02:17 +0100    

Click here for diff

OFFSET <x> ROWS FETCH FIRST <y> ROWS ONLY syntax is supposed to accept  
<simple value specification>, which includes parameters as well as  
literals. When this syntax was added all those years ago, it was done  
inconsistently, with <x> and <y> being different subsets of the  
standard syntax.  
  
Rectify that by making <x> and <y> accept the same thing, and allowing  
either a (signed) numeric literal or a c_expr there, which allows for  
parameters, variables, and parenthesized arbitrary expressions.  
  
Per bug #15200 from Lukas Eder.  
  
Backpatch all the way, since this has been broken from the start.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ref/select.sgml
M src/backend/parser/gram.y

Update key words table for version 11

commit   : 806d08c0489f72282e0a25629e0d6054176e0c9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 12:14:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 12:14:46 -0400    

Click here for diff

M doc/src/sgml/keywords.sgml

doc: Fix some whitespace issues

commit   : 17485552ec3a7f9a19d568e4bb9b4affae4efdfa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 11:41:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 11:41:37 -0400    

Click here for diff

M doc/src/sgml/jit.sgml
M doc/src/sgml/textsearch.sgml

Improve spelling of new FINALFUNC_MODIFY aggregate attribute.

commit   : f755a152d4e3e6f913c6b7b6afe1785b1171c1cb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 11:41:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 11:41:42 -0400    

Click here for diff

I'd used SHARABLE as a value originally, but Peter Eisentraut points out  
that dictionaries agree that SHAREABLE is the preferred spelling.  
Run around and change that before it's too late.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/xaggr.sgml
M src/backend/commands/aggregatecmds.c
M src/backend/executor/nodeAgg.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/pg_aggregate.h
M src/include/executor/nodeAgg.h
M src/test/regress/expected/create_aggregate.out
M src/test/regress/sql/create_aggregate.sql

Doc: fix bogus cross-reference link.

commit   : 3f5e3a98443c7f437465d79e4b99a0a661ae1b9b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 11:21:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 11:21:08 -0400    

Click here for diff

An xref to a <para>'s ID isn't very helpful because paras don't have  
names.  This causes a warning while building PDFs, though for some  
reason not while building HTML.  The link arguably went to the wrong  
place, too.  
  
To fix, introduce a sub-section we can reference.  

M doc/src/sgml/jit.sgml
M doc/src/sgml/storage.sgml

pg_basebackup: Remove short option -k

commit   : 3ce7f72529f5829f73e18240740bafc939b650b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 10:01:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 May 2018 10:01:49 -0400    

Click here for diff

-k meant --no-verify-checksums, which is the opposite of what initdb  
uses -k for.  After discussion, a short option does not seem necessary,  
so just keep the long option.  
  
Discussion: https://www.postgresql.org/message-id/flat/d510f8aa-19e1-d06e-7630-ad27f7441d68%402ndquadrant.com  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Fix unsafe usage of strerror(errno) within ereport().

commit   : 81256cd05f0745353c6572362155b57250a0d2a0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 00:32:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 May 2018 00:32:28 -0400    

Click here for diff

This is the converse of the unsafe-usage-of-%m problem: the reason  
ereport/elog provide that format code is mainly to dodge the hazard  
of errno getting changed before control reaches functions within the  
arguments of the macro.  I only found one instance of this hazard,  
but it's been there since 9.4 :-(.  

M src/backend/libpq/auth.c

Fix unportable usage of printf("%m").

commit   : a13b47a59ffce6f3c13c8b777738a3aab1db10d3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 May 2018 18:06:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 May 2018 18:06:00 -0400    

Click here for diff

While glibc's version of printf accepts %m, most others do not;  
to be portable, we have to do it the hard way with strerror(errno).  
pg_verify_checksums evidently did not get that memo.  
  
Noted while fooling around with NetBSD-current, which generates  
a compiler warning for this mistake.  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

printf("%lf") is not portable, so omit the "l".

commit   : c6e846446d17db40883eed91fa448e65333a0ae1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 May 2018 11:40:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 May 2018 11:40:54 -0400    

Click here for diff

The "l" (ell) width spec means something in the corresponding scanf usage,  
but not here.  While modern POSIX says that applying "l" to "f" and other  
floating format specs is a no-op, SUSv2 says it's undefined.  Buildfarm  
experience says that some old compilers emit warnings about it, and at  
least one old stdio implementation (mingw's "ANSI" option) actually  
produces wrong answers and/or crashes.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/btreefuncs.c
M doc/src/sgml/ecpg.sgml
M src/backend/access/rmgrdesc/nbtdesc.c
M src/interfaces/ecpg/test/compat_informix/sqlda.pgc
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/preproc/outofscope.pgc
M src/interfaces/ecpg/test/sql/sqlda.pgc

Assorted minor cleanups for bootstrap-data Perl scripts.

commit   : e7a808f947c66e2e2186c9495359865dadaf511a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 May 2018 16:04:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 May 2018 16:04:47 -0400    

Click here for diff

FindDefinedSymbol was intended to take an array of possible include  
paths, but it never actually worked correctly for any but the first  
array element.  Since there's no use-case for more than one path  
anyway, let's just simplify this code and its callers by redefining  
it as taking only one include path.  
  
Minor other code-beautification without functional effects, except  
that in one place we format the output as pgindent would do.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGXM_n32hTTkircW4_K1LQFsJNb6xjs0pAP4QC0ZpyJfPQ@mail.gmail.com  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/unused_oids

Support platforms where strtoll/strtoull are spelled __strtoll/__strtoull.

commit   : 06f66cff9e0b93db81db1595156b2aff8ba1786e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 May 2018 14:22:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 May 2018 14:22:18 -0400    

Click here for diff

Ancient HPUX, for one, does this.  We hadn't noticed due to the lack  
of regression tests that required a working strtoll.  
  
(I was slightly tempted to remove the other historical spelling,  
strto[u]q, since it seems we have no buildfarm members testing that case.  
But I refrained.)  
  
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

Arrange to supply declarations for strtoll/strtoull if needed.

commit   : a6228128fc48c222953dfd41fd438522a184054c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 22:42:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 22:42:10 -0400    

Click here for diff

Buildfarm member dromedary is still unhappy about the recently-added  
ecpg "long long" tests.  The reason turns out to be that it includes  
"-ansi" in its CFLAGS, and in their infinite wisdom Apple have decided  
to hide the declarations of strtoll/strtoull in C89-compliant builds.  
(I find it pretty curious that they hide those function declarations  
when you can nonetheless declare a "long long" variable, but anyway  
that is their behavior, both on dromedary's obsolete macOS version and  
the newest and shiniest.)  As a result, gcc assumes these functions  
return "int", leading naturally to wrong results.  
  
(Looking at dromedary's past build results, it's evident that this  
problem also breaks pg_strtouint64() on 32-bit platforms; but we  
evidently have no regression tests that exercise that function with  
values above 32 bits.)  
  
To fix, supply declarations for these functions when the platform  
provides the functions but not the declarations, using the same type  
of mechanism as we use for some other similar cases.  
  
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

Fix for globals.c- c.h must come first

commit   : e2b83ff556deb9a0001bdf6b511f8cfc9189ac10    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 18 May 2018 21:20:27 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 18 May 2018 21:20:27 -0400    

Click here for diff

Commit da9b580 mistakenly put a system header before postgres.h (which  
includes c.h).  That can cause portability issues and broke (at least)  
builds with older Windows compilers.  
  
Discovered by Mark Dilger.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/init/globals.c

Hot-fix ecpg regression test for missing ecpg_config.h inclusion.

commit   : 5e79405d82992efce15c27694f10fb4e1ac32657    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 19:03:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 19:03:32 -0400    

Click here for diff

I don't think this is really the best long-term answer, and in  
particular it doesn't fix the pre-existing hazard in sqltypes.h.  
But for the moment let's just try to make the buildfarm green again.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/sql/sqlda.pgc

Further adjust comment in get_partition_dispatch_recurse.

commit   : b949bbcb7eaf3719b541cbae99ef6c4b031174a1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 May 2018 16:09:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 May 2018 16:09:14 -0400    

Click here for diff

In editing 09b12d52db1cf1a4c72d876f3fb6c9d06919e51a I made it wrong;  
fix that and try to more clearly explain the situation.  
  
Patch by me, reviewed by David Rowley and Amit Langote  
  
Discussion: http://postgr.es/m/CA+TgmobAq+mA5hzm0a5OS38qQY5758DDDGqa3sBJN4hvir-H9w@mail.gmail.com  

M src/backend/executor/execPartition.c

Add some test coverage for ecpg's "long long" support.

commit   : dbccdd375b41618ca4ee3d1ea7109ab7f95d0865    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 13:04:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 13:04:59 -0400    

Click here for diff

This will only actually exercise the "long long" code paths on platforms  
where "long" is 32 bits --- otherwise, the SQL bigint type maps to  
plain "long", and we will test that code path instead.  But that's  
probably sufficient coverage, and anyway we weren't testing either  
code path before.  
  
Dang Minh Huong, tweaked a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/expected/sql-sqlda.stdout
M src/interfaces/ecpg/test/sql/sqlda.pgc

Recognize that MSVC can support strtoll() and strtoull().

commit   : f586f8638929b54de9e7f6b65fe6916b8cee38fe    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 12:52:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 12:52:28 -0400    

Click here for diff

This is needed for full support of "long long" variables in ecpg, but  
the previous patch for bug #15080 (commits 51057feaa et al) missed it.  
In MSVC versions where the functions don't exist under those names,  
we can nonetheless use _strtoi64() and _strtoui64().  
  
Like the previous patch, back-patch all the way.  
  
Dang Minh Huong  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pg_config.h.win32

Small improvement for plpgsql regression test.

commit   : 7d5b403b8d418742b734f85fda32b0eca8ee4113    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 12:10:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 12:10:19 -0400    

Click here for diff

Use DISCARD PLANS instead of a reconnect to force reconstruction of  
a cached plan; this corresponds more nearly to what people might  
actually do in practice.  

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

Fix error message on short read of pg_control

commit   : cfb758b6d9c1df58fb1dfd5d3f6e70393fb17869    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 18 May 2018 17:52:18 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 18 May 2018 17:52:18 +0200    

Click here for diff

Instead of saying "error: success", indicate that we got a working read  
but it was too short.  

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

MSVC builds must use a separate stamp file for copying generated headers.

commit   : a194106c1b4468c74dbf6e83d845be86239844aa    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 11:53:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 May 2018 11:53:18 -0400    

Click here for diff

Commit bad51a49a tried to use a shortcut with just one stamp file  
recording the actions of generating the pg_*_d.h headers and copying  
them to the src/include/catalog/ directory.  That doesn't work in all  
scenarios though, so we must use two stamp files like the Makefiles do.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CANFyU944GdHr=puPbA78STnqr=8kgMrGF-VDHck6aO_-qNDALg@mail.gmail.com  

M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Prevent possibly spurious error when running perl -cw

commit   : 3dacd9bf32873c80045a2b758d64c031d70dac83    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 May 2018 10:46:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 May 2018 10:46:38 -0400    

Click here for diff

M src/tools/msvc/Mkvcbuild.pm

Message wording and pluralization improvements

commit   : 9effb63e0dd12b0704cd8e11106fe08ff5c9d685    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 May 2018 23:05:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 May 2018 23:05:27 -0400    

Click here for diff

M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_waldump/pg_waldump.c

Fix whitespace

commit   : 6b30d1386fa37d8ae45e2d30e22771244afd13c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 May 2018 14:25:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 May 2018 14:25:04 -0400    

Click here for diff

M src/bin/pg_basebackup/streamutil.c
M src/test/isolation/specs/predicate-gin.spec
M src/test/isolation/specs/predicate-hash.spec
M src/test/regress/sql/func_index.sql
M src/test/regress/sql/index_including.sql

doc: fix description of backward_scan

commit   : 93f6c6328dcf74d1e42162e8f712c23fe16a8cf8    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 17 May 2018 21:23:48 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 17 May 2018 21:23:48 +0100    

Click here for diff

The description of the index property backward_scan was incorrect and  
misleading; rectify.  
  
Backpatch to 9.6 where the amutils functionality was introduced.  

M doc/src/sgml/func.sgml

doc: fix PG 11 attribution

commit   : 91ff29f036349f07b4b48856667735e51ef795a1    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 17 May 2018 14:23:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 17 May 2018 14:23:22 -0400    

Click here for diff

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

Make numeric power() handle NaNs according to the modern POSIX spec.

commit   : d1fc750b5199837a330c10d542191c8ab03a7dc8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 May 2018 11:10:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 May 2018 11:10:50 -0400    

Click here for diff

In commit 6bdf1303b, we ensured that power()/^ for float8 would honor  
the NaN behaviors specified by POSIX standards released in this century,  
ie NaN ^ 0 = 1 and 1 ^ NaN = 1.  However, numeric_power() was not  
touched and continued to follow the once-common behavior that every  
case involving NaN input produces NaN.  For consistency, let's switch  
the numeric behavior to the modern spec in the same release that ensures  
that behavior for float8.  
  
(Note that while 6bdf1303b was initially back-patched, we later undid  
that, concluding that any behavioral change should appear only in v11.)  
  
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

doc: PG 11 release notes adjustments

commit   : b2b82228ee5dc08f0341b5480546479c19e84baf    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 16 May 2018 20:36:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 16 May 2018 20:36:22 -0400    

Click here for diff

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

Detoast plpgsql variables if they might live across a transaction boundary.

commit   : 2efc924180f096070d684a712d6c162b6ae0a5e7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 May 2018 14:56:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 May 2018 14:56:52 -0400    

Click here for diff

Up to now, it's been safe for plpgsql to store TOAST pointers in its  
variables because the ActiveSnapshot for whatever query called the plpgsql  
function will surely protect such TOAST values from being vacuumed away,  
even if the owning table rows are committed dead.  With the introduction of  
procedures, that assumption is no longer good in "non atomic" executions  
of plpgsql code.  We adopt the slightly brute-force solution of detoasting  
all TOAST pointers at the time they are stored into variables, if we're in  
a non-atomic context, just in case the owning row goes away.  
  
Some care is needed to avoid long-term memory leaks, since plpgsql tends  
to run with CurrentMemoryContext pointing to its call-lifespan context,  
but we shouldn't assume that no memory is leaked by heap_tuple_fetch_attr.  
In plpgsql proper, we can do the detoasting work in the "eval_mcontext".  
  
Most of the code thrashing here is due to the need to add this capability  
to expandedrecord.c as well as plpgsql proper.  In expandedrecord.c,  
we can't assume that the caller's context is short-lived, so make use of  
the short-term sub-context that was already invented for checking domain  
constraints.  In view of this repurposing, it seems good to rename that  
variable and associated code from "domain_check_cxt" to "short_term_cxt".  
  
Peter Eisentraut and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/expandedrecord.c
M src/include/postgres.h
M src/include/utils/expandedrecord.h
M src/pl/plpgsql/src/pl_exec.c
A src/test/isolation/expected/plpgsql-toast.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/plpgsql-toast.spec

Fix misprocessing of equivalence classes involving record_eq().

commit   : a11b3bd37f14386310f25e89529bd3de8cd64383    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 May 2018 13:46:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 May 2018 13:46:09 -0400    

Click here for diff

canonicalize_ec_expression() is supposed to agree with coerce_type() as to  
whether a RelabelType should be inserted to make a subexpression be valid  
input for the operators of a given opclass.  However, it did the wrong  
thing with named-composite-type inputs to record_eq(): it put in a  
RelabelType to RECORDOID, which the parser doesn't.  In some cases this was  
harmless because all code paths involving a particular equivalence class  
did the same thing, but in other cases this would result in failing to  
recognize a composite-type expression as being a member of an equivalence  
class that it actually is a member of.  The most obvious bad effect was to  
fail to recognize that an index on a composite column could provide the  
sort order needed for a mergejoin on that column, as reported by Teodor  
Sigaev.  I think there might be other, subtler, cases that result in  
misoptimization.  It also seems possible that an unwanted RelabelType  
would sometimes get into an emitted plan --- but because record_eq and  
friends don't examine the declared type of their input expressions, that  
would not create any visible problems.  
  
To fix, just treat RECORDOID as if it were a polymorphic type, which in  
some sense it is.  We might want to consider formalizing that a bit more  
someday, but for the moment this seems to be the only place where an  
IsPolymorphicType() test ought to include RECORDOID as well.  
  
This has been broken for a long time, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/equivclass.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Pass the correct PlannerInfo to PlanForeignModify/PlanDirectModify.

commit   : 7fc7dac1a711d0dbd01d2daf6dc97d27d6c6409c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 May 2018 11:32:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 May 2018 11:32:38 -0400    

Click here for diff

Previously, we passed the toplevel PlannerInfo, but we actually want  
to pass the relevant subroot.  One problem with passing the toplevel  
PlannerInfo is that the FDW which wants to push down an UPDATE or  
DELETE against a join won't find the relevant joinrel there.  
As of commit 1bc0100d270e5bcc980a0629b8726a32a497e788, postgres_fdw  
tries to do exactly this and can be made to fail an assertion as a  
result.  
  
It's possible that this should be regarded as a bug fix and  
back-patched to earlier releases, but for lack of a test case that  
fails in earlier releases, no back-patch for now.  
  
Etsuro Fujita, reviewed by Amit Langote.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/createplan.c

Improve comment in get_partition_dispatch_recurse.

commit   : 09b12d52db1cf1a4c72d876f3fb6c9d06919e51a    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 May 2018 10:46:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 May 2018 10:46:55 -0400    

Click here for diff

David Rowley, reviewed by Amit Langote, and revised a bit by me.  
  
Discussion: http://postgr.es/m/CAKJS1f9yyimYyFzbHM4EwE+tkj4jvrHqSH0H4S4Kbas=UFpc9Q@mail.gmail.com  

M src/backend/executor/execPartition.c

docs: add space in PG 11 release notes, huge/large

commit   : 6bd1b4c31b56b5d0bbd50c6df7f49c5812174a43    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 20:03:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 20:03:42 -0400    

Click here for diff

Reported-by: Tatsuo Ishii  

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

docs: PG 11 rel notes, 'ps' display/background worker item

commit   : 7a4a37542311720e0c4e47dc0e7a94254eaf47bf    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 19:57:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 19:57:40 -0400    

Click here for diff

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

doc: adjust Extended Query PG 11 release note item

commit   : 3b07f6dadb359e88c5a4b8375765d2c10d9eabce    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 19:12:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 19:12:16 -0400    

Click here for diff

Reported-by: Tatsuo Ishii  

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

docs: update PG 11 release notes based on feedback

commit   : 3122e320913db0288d0b96a7eb65401962c4781b    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 15:55:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 15 May 2018 15:55:53 -0400    

Click here for diff

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

Fix type checking for support functions of parallel VARIADIC aggregates.

commit   : 05ca21b878a9e483a4635ba4b23e0f45d5442fc3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 May 2018 15:06:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 May 2018 15:06:53 -0400    

Click here for diff

The impact of VARIADIC on the combine/serialize/deserialize support  
functions of an aggregate wasn't thought through carefully.  There is  
actually no impact, because variadicity isn't passed through to these  
functions (and it doesn't seem like it would need to be).  However,  
lookup_agg_function was mistakenly told to check things as though it were  
passed through.  The net result was that it was impossible to declare an  
aggregate that had both VARIADIC input and parallelism support functions.  
  
In passing, fix a runtime check in nodeAgg.c for the combine function's  
strictness to make its error message agree with the creation-time check.  
The previous message was actually backwards, and it doesn't seem like  
there's a good reason to have two versions of this message text anyway.  
  
Back-patch to 9.6 where parallel aggregation was introduced.  
  
Alexey Bashtanov; message fix by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_aggregate.c
M src/backend/executor/nodeAgg.c

doc: clarify SCRAM channel binding

commit   : 185f4f84d5952e5692bd2712dd32288fcbb7fa71    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 14 May 2018 20:45:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 14 May 2018 20:45:35 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Reviewed-by: Michael Paquier  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml

doc: update PG 11 release notes with suggested changes

commit   : cf9c75ccea0bc15ce54c6fb017cd3edba03da743    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 14 May 2018 16:41:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 14 May 2018 16:41:49 -0400    

Click here for diff

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

Don't allow partitioned index on foreign-table partitions

commit   : 4eaa53727542c39cca71b80e8ff3e1f742d64452    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 May 2018 13:09:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 May 2018 13:09:32 -0400    

Click here for diff

Creating indexes on foreign tables is already forbidden, but local  
partitioned indexes (commit 8b08f7d4820f) forgot to check for them.  Add  
a preliminary check to prevent wasting time.  
  
Another school of thought says to allow the index to be created if it's  
not a unique index; but it's possible to do better in the future (enable  
indexing of foreign tables, somehow), so we avoid painting ourselves in  
a corner by rejecting all cases, to avoid future grief (a.k.a. backward  
incompatible changes).  
  
Reported-by: Arseny Sher  
Author: Amit Langote, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/87sh71cakz.fsf@ars-thinkpad  

M src/backend/tcop/utility.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Fix file paths in comments

commit   : fc2a41e23e10f2338be4907f71c277ea09526680    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 14 May 2018 18:59:43 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 14 May 2018 18:59:43 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/backend/utils/adt/inet_cidr_ntop.c
M src/port/inet_net_ntop.c

psql: have \d show FKs on partitioned tables

commit   : 93316299d6a185bed0a4be5376508fe2f7e6b2d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 May 2018 11:43:14 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 May 2018 11:43:14 -0400    

Click here for diff

Commit 3de241dba86f missed to update psql to display foreign keys on  
partitioned tables.  Add that.  
  
Reported-by: Amit Langote  
Author: Amit Langote  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Doc: fix minor release-note typo.

commit   : 60e2d9ab1437c8e4b12e7766198cf2e84f7d267e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 May 2018 12:08:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 May 2018 12:08:02 -0400    

Click here for diff

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

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

doc: update PG 11 rel. notes for ALTER TABLE's non-null default

commit   : 8c6227a2f3cdf144c4de135329fd76eb66f5684a    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 12 May 2018 20:46:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 12 May 2018 20:46:37 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

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

docs: Rework sections on partition pruning/exclusion

commit   : bebc46931a1215567d4aabaebb406848f5a82340    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 12 May 2018 12:08:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 12 May 2018 12:08:17 -0300    

Click here for diff

Explain partition pruning more thoroughly, in a section above the one  
that explains constraint exclusion, since the new feature is the one  
that will be used more extensively from now on.  Move some of the  
material from the constraint exclusion subsection to the one on  
partition pruning, so that we can explain the legacy method by  
explaining the differences with the new one instead of repeating it.  
  
Author: David Rowley, Ɓlvaro Herrera  
Reviewed-by: Amit Langote, David G. Johnston, Justin Pryzby  
Discussion: https://postgr.es/m/CAKJS1f8PECxEi1YQ9nhVtshtfOMHUzAMm_Zp4gGCOCnMPjEKJA@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml

Doc: fix overenthusiastic markup.

commit   : d9fcf7f5e387c29427ff37b5e0fb0763f9a2b10a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 May 2018 17:19:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 May 2018 17:19:21 -0400    

Click here for diff

I get "WARNING: nested link may be undefined in output: <xref @linkend =  
'pgbench'> nested inside parent element link" from this.  
  
Also remove some trailing whitespace.  

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

docs: more PG 11 markup and email suggestions

commit   : fb68638ae8af3d5f5a9dcddb8e513f21b2797361    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 11 May 2018 17:06:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 11 May 2018 17:06:22 -0400    

Click here for diff

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

doc: markup for PG 11 release notes and included email tips

commit   : 6186d0bd615ed2eb921ad13ccdf4ceed19d3f7a8    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 11 May 2018 14:47:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 11 May 2018 14:47:26 -0400    

Click here for diff

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

docs: initial draft of PG 11 release notes

commit   : 5631c99d2a374e17abcb2ff63f58fcaf5c3a5248    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 11 May 2018 10:54:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 11 May 2018 10:54:03 -0400    

Click here for diff

M doc/src/sgml/filelist.sgml
A doc/src/sgml/release-11.sgml
M doc/src/sgml/release.sgml

docs: clarify that CREATE TABLE ... _AS_ can be parallelized

commit   : 25468994cab87ab7e946b6866937ee642fc1261d    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 10 May 2018 22:37:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 10 May 2018 22:37:26 -0400    

Click here for diff

CREATE TABLE without AS doesn't have anything to parallelize.  

M doc/src/sgml/parallel.sgml

Various improvements of skipping index scan during vacuum technics

commit   : 8e12f4a250d250a89153da2eb9b91c31bb80c483    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 10 May 2018 13:31:47 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 10 May 2018 13:31:47 +0300    

Click here for diff

- Change vacuum_cleanup_index_scale_factor GUC to PGC_USERSET.  
  vacuum_cleanup_index_scale_factor GUC was defined as PGC_SIGHUP.  But this  
  GUC affects not only autovacuum.  So it might be useful to change it from user  
  session in order to influence manually runned VACUUM.  
- Add missing tab-complete support for vacuum_cleanup_index_scale_factor  
  reloption.  
- Fix condition for B-tree index cleanup.  
  Zero value of vacuum_cleanup_index_scale_factor means that user wants B-tree  
  index cleanup to be never skipped.  
- Documentation and comment improvements  
  
Authors: Justin Pryzby, Alexander Korotkov, Liudmila Mantrova  
Reviewed by: all authors and Robert Haas  
Discussion: https://www.postgresql.org/message-id/flat/20180502023025.GD7631%40telsasoft.com  

M doc/src/sgml/config.sgml
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/utils/misc/guc.c
M src/bin/psql/tab-complete.c

doc: Restrictions on InitPlans in parallel queries relaxed.

commit   : ddc1f32ee5073503a396c7a4df32865205dd3970    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 May 2018 15:15:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 May 2018 15:15:03 -0400    

Click here for diff

This updates the documentation for changes originally made in commit  
e89a71fb449af2ef74f47be1175f99956cf21524.  
  
Patch by me, reviewed (but not entirely endorsed) by Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+Tgmoa+vupW8V_gBonz6hU7WwN2zJ=UTsVWCVB+rN6vaaXfZw@mail.gmail.com  

M doc/src/sgml/parallel.sgml

Update time zone data files to tzdata release 2018e.

commit   : 234bb985c574d1ed9e63d382b327ac3d3e329c56    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 May 2018 13:55:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 May 2018 13:55:27 -0400    

Click here for diff

DST law changes in North Korea.  Redefinition of "daylight savings" in  
Ireland, as well as for some past years in Namibia and Czechoslovakia.  
Additional historical corrections for Czechoslovakia.  
  
With this change, the IANA database models Irish timekeeping as following  
"standard time" in summer, and "daylight savings" in winter, so that the  
daylight savings offset is one hour behind standard time not one hour  
ahead.  This does not change their UTC offset (+1:00 in summer, 0:00 in  
winter) nor their timezone abbreviations (IST in summer, GMT in winter),  
though now "IST" is more correctly read as "Irish Standard Time" not "Irish  
Summer Time".  However, the "is_dst" column in the pg_timezone_names view  
will now be true in winter and false in summer for the Europe/Dublin zone.  
  
Similar changes were made for Namibia between 1994 and 2017, and for  
Czechoslovakia between 1946 and 1947.  
  
So far as I can find, no Postgres internal logic cares about which way  
tm_isdst is reported; in particular, since commit b2cbced9e we do not  
rely on it to decide how to interpret ambiguous timestamps during DST  
transitions.  So I don't think this change will affect any Postgres  
behavior other than the timezone-view outputs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/timezone/data/tzdata.zi
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt

pgstatindex, pageinspect: handle partitioned indexes

commit   : bef5fcc36be3d08ec123889a0c82f5e07a63ff88    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 14:03:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 14:03:43 -0300    

Click here for diff

Commit 8b08f7d4820f failed to update these modules to at least give  
non-broken error messages for partitioned indexes.  Add appropriate  
error support to them.  
  
Peter G. was complaining about a problem of unfriendly error messages;  
while we haven't fixed that yet, subsequent discussion let to discovery  
of these unhandled cases.  
  
Author: Michaƫl Paquier  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-WzkOKptQiE51Bh4_xeEHhaBwHkZkGtKizrFMgEkfUuRRQg@mail.gmail.com  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/page.sql
M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M contrib/pgstattuple/sql/pgstattuple.sql

pgstatindex: HASH -> hash

commit   : c8478f4fd908b5a122b5638018bbb749ac0e862f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 13:44:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 13:44:50 -0300    

Click here for diff

Fix the lone error message in the whole source tree to use capitalized  
HASH when referring to hash indexes, making it look like all the other  
messages.  
  
Someday it would be good to standardize 'B-Tree', 'B-tree', 'btree', and  
random other spellings, too, but that's a larger patch ...  
  
Author: Ɓlvaro Herrera  

M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatindex.c

Add relkind 'I' to catalog.sgml's list relkinds

commit   : 550091f218ce9bff92e3753332142ed6917c27d5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 13:32:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 13:32:50 -0300    

Click here for diff

Commit 8b08f7d4820f added a relkind for local partitioned indexes, but  
failed to add it to pg_class's list of possible relkinds.  Repair.  
  
Author: Peter Geoghegan, Michaƫl Paquier  
Discussion: https://postgr.es/m/CAH2-WzkOKptQiE51Bh4_xeEHhaBwHkZkGtKizrFMgEkfUuRRQg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml

Fix assorted partition pruning bugs

commit   : d758d9702e2f64f08565e18eb6cb7991efa2dc16    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 10:51:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 10:51:23 -0300    

Click here for diff

match_clause_to_partition_key failed to consider COERCION_PATH_ARRAYCOERCE  
cases in scalar-op-array expressions, so it was possible to crash the  
server easily.  To handle this case properly (ie. prune partitions) we  
would need to run a bit of executor code during planning.  Maybe it can  
be improved, but for now let's just not crash.  Add a test case that  
used to trigger the crash.  
Author: Michaƫl Paquier  
  
match_clause_to_partition_key failed to indicate that operators that  
don't have a commutator in a btree opclass are unsupported.  It is  
possible for this to cause a crash later if such an operator is used in  
a scalar-op-array expression.  Add a test case that used to the crash.  
Author: Amit Langote  
  
One caller of gen_partprune_steps_internal in  
match_clause_to_partition_key was too optimistic about the former never  
returning an empty step list.  Rid it of its innocence.  (Having fixed  
the bug above, I no longer know how to exploit this, so no test case for  
it, but it remained a bug.)  Revise code flow a little bit, for  
succintness.  
Author: Ɓlvaro Herrera  
  
Reported-by: Marina Polyakova  
Reviewed-by: Michaƫl Paquier  
Reviewed-by: Amit Langote  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Restrict vertical tightness to parentheses in Perl code

commit   : 35361ee78890ce5b559a710c8fa2fdfa843eb280    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 9 May 2018 10:14:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 9 May 2018 10:14:46 -0400    

Click here for diff

The vertical tightness settings collapse vertical whitespace between  
opening and closing brackets (parentheses, square brakets and braces).  
This can make data structures in particular harder to read, and is not  
very consistent with our style in non-Perl code. This patch restricts  
that setting to parentheses only, and reformats all the perl code  
accordingly. Not applying this to parentheses has some unfortunate  
effects, so the consensus is to keep the setting for parentheses and not  
for the others.  
  
The diff for this patch does highlight some places where structures  
should have trailing commas. They can be added manually, as there is no  
automatic tool to do so.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/create_help.pl
M src/test/kerberos/t/001_auth.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/ssl/ServerSetup.pm
M src/tools/git_changelog
M src/tools/msvc/Install.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VCBuildProject.pm
M src/tools/pgindent/perltidyrc
M src/tools/pgindent/pgindent
M src/tools/win32tzlist.pl

perltidy some recent code changes before changing perltidy settings

commit   : 286bb240e1c8e279efa2d805c7f700abfb771925    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 9 May 2018 10:04:17 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 9 May 2018 10:04:17 -0400    

Click here for diff

M src/backend/catalog/Catalog.pm
M src/tools/msvc/Install.pm
M src/tools/msvc/vcregress.pl

Make gen_partprune_steps static

commit   : d1e2cac5ff7eaf3e9feac419205b3e08052be961    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 10:40:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 10:40:21 -0300    

Click here for diff

There's no need to export this function, so don't.  Michaƫl didn't  
actually write the patch, but we list him as first author because with a  
trivial one like this, intellectual authorship is as important (if not  
more) as bit shovelling.  
  
Author: Michaƫl Paquier, Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c
M src/include/partitioning/partprune.h

Remove useless 'default' clause

commit   : c775fb9e18ace94e61d5d9587b5667f7baaca459    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 10:33:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 May 2018 10:33:55 -0300    

Click here for diff

Author: Michael Paquier  
Reviewed-by: Amit Langote  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c

Add a script and a config file to run perlcritic

commit   : 91703ca2144e58d041c132fb7ff06a6d1721e904    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 9 May 2018 07:55:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 9 May 2018 07:55:23 -0400    

Click here for diff

This is similar to what we do to run perltidy. For now we only run at  
severity level 5. Over time we can improve our perl code and reduce the  
severity level.  
  
Discussion: https://postgr.es/m/[email protected]  

A src/tools/pgperlcritic/perlcriticrc
A src/tools/pgperlcritic/pgperlcritic

Improve jsonb cast error message

commit   : cb5d94295986298af666534970f9bb3715574646    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 9 May 2018 13:23:16 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 9 May 2018 13:23:16 +0300    

Click here for diff

Initial variant of error message didn't follow style of another casting error  
messages and wasn't informative. Per gripe from Robert Haas.  
  
Reviewer: Tom Lane  
Discussion: https://www.postgresql.org/message-id/flat/CA%2BTgmob08StTV9yu04D0idRFNMh%2BUoyKax5Otvrix7rEZC8rMw%40mail.gmail.com#CA+Tgmob08StTV9yu04D0idRFNMh+UoyKax5Otvrix7rEZC8rMw@mail.gmail.com  

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

Improve inefficient regexes in vacuumdb TAP test.

commit   : c63913ca7d1df241149a02fddf9819952b998028    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 May 2018 20:17:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 May 2018 20:17:43 -0400    

Click here for diff

The regexes used in 102_vacuumdb_stages.pl to check the postmaster log  
for expected output contained several places with ".*.*", which is  
underdetermined and can cause exponential runtime growth in Perl's regex  
matcher (since it's not bright enough not to waste time seeing whether  
different splits of the same substring would allow a match).  We were  
fortunate that the amount of text in the postmaster log was generally not  
enough to make the runtime go to the moon; although commit 6271fceb8 had  
been on the hairy edge of an obvious problem, thanks to its increasing the  
default log verbosity to DEBUG1.  Experimentation shows that anyone who  
tried to run this test case with an even higher log verbosity would have  
been in for serious pain.  But even at default logging level, fixing this  
saves several hundred ms on my workstation, more on slower buildfarm  
members.  
  
Remove the extra ".*"s, restoring more-or-less-linear matching speed.  
Back-patch to 9.4 where the test case was added, mostly in case anyone  
tries to do related debugging in a back branch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/102_vacuumdb_stages.pl

Improve initdb's query for generating default descriptions a little.

commit   : dec10340d5ba63cf338dea256ac0fa66c649bf9e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 May 2018 15:59:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 May 2018 15:59:01 -0400    

Click here for diff

While poking into initdb's performance, I noticed that this query  
wasn't being done very intelligently.  By forcing it to execute  
obj_description() for each pg_proc/pg_operator join row, we were  
essentially setting up a nestloop join to pg_description, which  
is not a bright query plan when there are hundreds of outer rows.  
Convert the check for a "deprecated" operator into a NOT EXISTS  
so that it can be done as a hashed antijoin.  On my workstation  
this reduces the time for this query from ~ 35ms to ~ 10ms.  
Which is not a huge win, but it adds up over buildfarm runs.  
  
In passing, insert forced query breaks (\n\n, in single-user mode)  
after each SQL-query file that initdb sources, and after some  
relatively new queries in setup_privileges().  This doesn't make  
a lot of difference normally, but it will result in briefer, saner  
error messages if anything goes wrong.  

M src/bin/initdb/initdb.c

Refine error messages

commit   : 831f5d11ec7bb8a693c581720d014b3a5ad7d446    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 May 2018 14:36:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 May 2018 14:36:31 -0400    

Click here for diff

"JSON" when not referring to a data type should be upper case.  

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

Count heap tuples in non-SnapshotAny path in IndexBuildHeapRangeScan().

commit   : 3a675f729ea96c8bf3e764996a0c743500e564ef    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 May 2018 00:20:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 May 2018 00:20:19 -0400    

Click here for diff

Brown-paper-bag bug in commit 7c91a0364: when we rearranged the placement  
of "reltuples += 1" statements, we missed including one in this code path.  
  
The net effect of that was that CREATE INDEX CONCURRENTLY would set the  
table's pg_class.reltuples to zero, as would index builds done during  
bootstrap mode.  (It seems like parallel index builds ought to fail  
similarly, but they don't, perhaps because reltuples is computed in some  
other way.  You certainly couldn't figure that out from the abysmally  
underdocumented parallelism code in this area.)  
  
I was led to this by wondering why initdb seemed to have slowed down as  
a result of 7c91a0364, as is evident in the buildfarm's timing history.  
The reason is that every system catalog with indexes had pg_class.reltuples  
= 0 after bootstrap, causing the planner to make some terrible choices for  
queries in the post-bootstrap steps.  On my workstation, this fix causes  
the runtime of "initdb -N" to drop from ~2.0 sec to ~1.4 sec, which is  
almost though not quite back to where it was in v10.  That's not much of  
a deal for production use perhaps, but it makes a noticeable difference  
for buildfarm and "make check-world" runs, which do a lot of initdbs.  

M src/backend/catalog/index.c

Clean up some perlcritic warnings

commit   : d2c1512ac48c1c25dfec07d341e9b74e57f6fbc4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 7 May 2018 15:21:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 7 May 2018 15:21:00 -0400    

Click here for diff

In Catalog.pm, mark eval of a string instead of a block as allowed.  
Disallow perlcritic completely in Gen_dummy_probes.pl, as it's  
generated code.  
Protect a couple of lines in plperl code from  perltidy, so that the  
annotation for perlcritic stays on the same line as the construct it  
would otherwise object to.  

M src/backend/catalog/Catalog.pm
M src/backend/utils/Gen_dummy_probes.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl

Undo extra chattiness of postmaster logs in TAP tests.

commit   : 17551f1a21fa8e70aa0bca1153de03460742565c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 15:12:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 15:12:01 -0400    

Click here for diff

Commit 6271fceb8 changed PostgresNode.pm to force log_min_messages = debug1  
in all TAP tests, without any discussion and without a concrete need for  
it.  This makes some of the TAP tests noticeably slower (although much of  
that may be due to poorly-written regexes), and for certain it's bloating  
the buildfarm logs.  Revert the change.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm

Update oidjoins regression test for v11.

commit   : fbb99e5883d88687de4dbd832c2843f600ab3dd8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 14:32:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 14:32:04 -0400    

Click here for diff

Commit 86f575948 already manually updated the oidjoins test for the  
new pg_constraint.conparentid => pg_constraint.oid relationship, but  
failed to update findoidjoins/README, thus the apparent inconsistency  
here.  
  
Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/oidjoins.sql
M src/tools/findoidjoins/README

Suppress compiler warnings when building with --enable-dtrace.

commit   : 513ff52e81675f26ceb91e8301019546439d73c9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 13:44:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 13:44:09 -0400    

Click here for diff

Most versions of "dtrace -h" drop const qualifiers from the declarations  
of probe functions (though macOS gets it right).  This causes compiler  
warnings when we pass in pointers to const.  Repair by extending our  
existing post-processing of the probes.h file.  To do so, assume that all  
"char *" arguments should be "const char *"; that seems reasonably safe.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm=2j1pWSruQJqJ91ZDzD8w9ZZDsM4j2C6x75C-VryWg-_w@mail.gmail.com  

M src/backend/utils/Makefile

Last-minute updates for release notes.

commit   : f34f0e4c58a31e5edd3aa8a23e171fbcf7e01ff2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 13:13:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 13:13:27 -0400    

Click here for diff

The set of functions that need parallel-safety adjustments isn't the  
same in 9.6 as 10, so I shouldn't have blindly back-patched that list.  
Adjust as needed.  Also, provide examples of the commands to issue.  

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

Last-minute updates for release notes.

commit   : b56d5f230fae5fccf4fb9f255dfa78b01afed0d9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 11:50:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 May 2018 11:50:05 -0400    

Click here for diff

Security: CVE-2018-1115  

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

doc: Improve spelling and wording a bit

commit   : a43a4509f8a9249ba6c2734596c029f0430a75bc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 May 2018 11:05:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 May 2018 11:05:19 -0400    

Click here for diff

M doc/src/sgml/config.sgml

doc: Fix minor markup issue

commit   : baf21b922a18c2809068238503ebb3797994e615    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 May 2018 10:16:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 May 2018 10:16:17 -0400    

Click here for diff

There shouldn't be a line break between two adjacent tags, because that  
will appear as whitespace in the output.  (The rendering engine might in  
turn collapse that whitespace away, so it might not actually make a  
difference, but it's more correct this way.)  

M doc/src/sgml/config.sgml

adminpack: Revoke EXECUTE on pg_logfile_rotate()

commit   : 7b347409fa2776fbaa4ec9c57365f48a2bbdb80c    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 7 May 2018 10:10:33 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 7 May 2018 10:10:33 -0400    

Click here for diff

In 9.6, we moved a number of functions over to using the GRANT system to  
control access instead of having hard-coded superuser checks.  
  
As it turns out, adminpack was creating another function in the catalog  
for one of those backend functions where the superuser check was  
removed, specifically pg_rotate_logfile(), but it didn't get the memo  
about having to REVOKE EXECUTE on the alternative-name function  
(pg_logfile_rotate()), meaning that in any installations with adminpack  
on 9.6 and higher, any user is able to run the pg_logfile_rotate()  
function, which then calls pg_rotate_logfile() and rotates the logfile.  
  
Fix by adding a new version of adminpack (1.1) which handles the REVOKE.  
As this function should have only been available to the superuser, this  
is a security issue, albeit a minor one.  
  
In HEAD, move the changes implemented for adminpack up to be adminpack  
2.0 instead of 1.1.  
  
Security: CVE-2018-1115  

M contrib/adminpack/Makefile
M contrib/adminpack/adminpack–1.0–1.1.sql
A contrib/adminpack/adminpack–1.1–2.0.sql
M contrib/adminpack/adminpack.control

Documentation updates for partitioning.

commit   : f955d7ee166dfa053caa6d1bdb2a28b28b212fe3    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 7 May 2018 09:48:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 7 May 2018 09:48:47 -0400    

Click here for diff

Takayuki Tsunakawa  
  
Discussion: http://postgr.es/m/0A3221C70F24FB45833433255569204D1F965627@G01JPEXMBYT05  

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

Remove unused macro

commit   : 659442e40d57af5ea00dfc3d31266ef0cfb8278e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 6 May 2018 20:10:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 6 May 2018 20:10:05 -0400    

Click here for diff

left behind by db3af9feb19f39827e916145f88fa5eca3130cb2  

M src/test/regress/regress.c

Release notes for 10.4, 9.6.9, 9.5.13, 9.4.18, 9.3.23.

commit   : 2667e019c61f392c6af28afeee43dbfdcc943d28    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 May 2018 15:30:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 May 2018 15:30:44 -0400    

Click here for diff

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

Clear severity 5 perlcritic warnings from vcregress.pl

commit   : 2b9bdda74485909a4a3067bf0ba3f0821e82660e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 6 May 2018 07:37:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 6 May 2018 07:37:05 -0400    

Click here for diff

My recent update for python3 support used some idioms that are  
unapproved. This fixes them. Backpatch to all live branches like the  
original.  

M src/tools/msvc/vcregress.pl

Fix bootstrap parser so that its keywords are unreserved words.

commit   : d160882a17403d61bc04c5745493e027e60165ce    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 May 2018 16:23:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 May 2018 16:23:07 -0400    

Click here for diff

Mark Dilger pointed out that the bootstrap parser does not allow  
any of its keywords to appear as column values unless they're quoted,  
and proposed dealing with that by quoting such values in genbki.pl.  
Looking closer, though, we also have that problem with respect to table,  
column, and type names appearing in the .bki file: the parser would fail  
if any of those matched any of its keywords.  While so far there have  
been no conflicts (that I've heard of), this seems like a booby trap  
waiting to catch somebody.  Rather than clutter genbki.pl with enough  
quoting logic to handle all that, let's make the bootstrap parser grow  
up a little bit and treat its keywords as unreserved.  
  
Experimentation shows that it's fairly easy to do so with the exception  
of _null_, which I don't have a big problem with keeping as a reserved  
word.  The only change needed is that we can't have the "close" command  
take an optional table name: it has to either require or forbid the  
table name to avoid shift/reduce conflicts.  genbki.pl has historically  
always included the table name, so I took that option.  
  
The implementation has bootscanner.l passing forward the string value  
of each keyword, in case bootparse.y needs that.  This avoids needing to  
know the precise spelling of each keyword in bootparse.y, which is good  
because that's not always obvious from the token name.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bki.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l

Revert "Test conversion of NaN between float4 and float8."

commit   : 5c4c771dafefa7d0ee80a6bd6955b7a3940452a1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 May 2018 13:22:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 May 2018 13:22:11 -0400    

Click here for diff

This reverts commit 55e0e458170c76c1a0074cd550a13ec47e38a3fa.  
It's served its purpose of demonstrating what was wrong on  
buildfarm member opossum.  We could consider putting some kind  
of single-purpose hack into ftod() to make the test pass there;  
but I don't think it's worth the trouble, since there are surely  
many other places whether this platform bug could manifest.  

M src/test/regress/expected/float4-exp-three-digits.out
M src/test/regress/expected/float4.out
M src/test/regress/sql/float4.sql

Put in_range_float4_float8's work in-line.

commit   : cb3e9e40bc993128cd51795ea60ff7bed78cebb5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 May 2018 13:21:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 May 2018 13:21:50 -0400    

Click here for diff

In commit 8b29e88cd, I'd dithered about whether to make  
in_range_float4_float8 be a standalone copy of the float in-range logic  
or have it punt to in_range_float8_float8.  I went with the latter, which  
saves code space though at the cost of performance and readability.  
  
However, it emerges that this tickles a compiler or hardware bug on  
buildfarm member opossum.  Test results from commit 55e0e4581 show  
conclusively that widening a float4 NaN to float8 produces Inf, not NaN,  
on that machine; which accounts perfectly for the window RANGE test  
failures it's been showing.  We can dodge this problem by making  
in_range_float4_float8 be an independent function, so that it checks  
for NaN inputs before widening them.  
  
Ordinarily I'd not be very excited about working around such obviously  
broken functionality; but given that this was a judgment call to begin  
with, I don't mind reversing it.  

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

Remove extra newlines after PQerrorMessage()

commit   : 2f52518773bb01384ef20831fd9d8c76dbd59dc5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 5 May 2018 10:51:38 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 5 May 2018 10:51:38 -0400    

Click here for diff

M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_dumpall.c

First-draft release notes for 10.4.

commit   : 488ccfe40a865e3f3c6343e2de026c37ba5a7d50    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 May 2018 18:56:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 May 2018 18:56:50 -0400    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  

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

Fix scenario where streaming standby gets stuck at a continuation record.

commit   : 0668719801838aa6a8bda330ff9b3d20097ea844    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 5 May 2018 01:34:53 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 5 May 2018 01:34:53 +0300    

Click here for diff

If a continuation record is split so that its first half has already been  
removed from the master, and is only present in pg_wal, and there is a  
recycled WAL segment in the standby server that looks like it would  
contain the second half, recovery would get stuck. The code in  
XLogPageRead() incorrectly started streaming at the beginning of the  
WAL record, even if we had already read the first page.  
  
Backpatch to 9.4. In principle, older versions have the same problem, but  
without replication slots, there was no straightforward mechanism to  
prevent the master from recycling old WAL that was still needed by standby.  
Without such a mechanism, I think it's reasonable to assume that there's  
enough slack in how many old segments are kept around to not run into this,  
or you have a WAL archive.  
  
Reported by Jonathon Nelson. Analysis and patch by Kyotaro HORIGUCHI, with  
some extra comments by me.  
  
Discussion: https://www.postgresql.org/message-id/CACJqAM3xVz0JY1XFDKPP%2BJoJAjoGx%3DGNuOAshEDWCext7BFvCQ%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/include/access/xlogreader.h

Don't mark pages all-visible spuriously

commit   : d2599ecfcc74fea9fad1720a70210a740c716730    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 4 May 2018 15:24:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 4 May 2018 15:24:44 -0300    

Click here for diff

Dan Wood diagnosed a long-standing problem that pages containing tuples  
that are locked by multixacts containing live lockers may spuriously end  
up as candidates for getting their all-visible flag set.  This has the  
long-term effect that multixacts remain unfrozen; this may previously  
pass undetected, but since commit XYZ it would be reported as  
  "ERROR: found multixact 134100944 from before relminmxid 192042633"  
because when a later vacuum tries to freeze the page it detects that a  
multixact that should have gotten frozen, wasn't.  
  
Dan proposed a (correct) patch that simply sets a variable to its  
correct value, after a bogus initialization.  But, per discussion, it  
seems better coding to avoid the bogus initializations altogether, since  
they could give rise to more bugs later.  Therefore this fix rewrites  
the logic a little bit to avoid depending on the bogus initializations.  
  
This bug was part of a family introduced in 9.6 by commit a892234f830e;  
later, commit 38e9f90a227d fixed most of them, but this one was  
unnoticed.  
  
Authors: Dan Wood, Pavan Deolasee, Ɓlvaro Herrera  
Reviewed-by: Masahiko Sawada, Pavan Deolasee, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Provide for testing on python3 modules when under MSVC

commit   : 966268c7621c4bca534961440b497a3270395fc2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 4 May 2018 15:22:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 4 May 2018 15:22:48 -0400    

Click here for diff

This should have been done some years ago as promised in commit  
c4dcdd0c2. However, better late than never.  
  
Along the way do a little housekeeping, including using a simpler test  
for the python version being tested, and removing a redundant subroutine  
parameter. These changes only apply back to release 9.5.  
  
Backpatch to all live releases.  

M src/tools/msvc/Install.pm
M src/tools/msvc/vcregress.pl

Allow MSYS as well as MINGW in Msys uname

commit   : 608a710195a4be20ad5f3e97b24db76aebe02808    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 4 May 2018 14:54:04 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 4 May 2018 14:54:04 -0400    

Click here for diff

Msys2's uname -s outputs a string beginning MSYS rather than MINGW as is  
output by Msys. Allow either in pg_upgrade's test.sh.  
  
Backpatch to all live branches.  

M src/bin/pg_upgrade/test.sh

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

commit   : b45f6613e0a475f908d93dbaa8612ccb9395f666    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 May 2018 12:26:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 May 2018 12:26:25 -0400    

Click here for diff

The non-cosmetic changes involve teaching the "zic" tzdata compiler about  
negative DST.  While I'm not currently intending that we start using  
negative-DST data right away, it seems possible that somebody would try  
to use our copy of zic with bleeding-edge IANA data.  So we'd better be  
out in front of this change code-wise, even though it doesn't matter for  
the data file we're shipping.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/README
M src/timezone/localtime.c
M src/timezone/strftime.c
M src/timezone/zic.c

Fix precedence problem in new Perl code.

commit   : 59cb323053f4ed582d4e71acaeb5770603f074db    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 May 2018 09:46:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 May 2018 09:46:31 -0400    

Click here for diff

I think this bit of commit 1f1cd9b5d didn't do quite what I meant :-(  

M src/backend/catalog/Catalog.pm

pg_dump: Use current_database() instead of PQdb()

commit   : 1cd2445c9985719ea1bb9f644373481c8702af64    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Apr 2018 12:32:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Apr 2018 12:32:05 -0400    

Click here for diff

For querying pg_database about information about the database being  
dumped, look up by using current_database() instead of the value  
obtained from PQdb().  When using a connection proxy, the value from  
PQdb() might not be the real name of the database.  

M src/bin/pg_dump/pg_dump.c

Don't truncate away non-key attributes for leftmost downlinks.

commit   : 2a9e04f0a8ada12d4af4f095e4dbe164e2983bce    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 4 May 2018 12:38:23 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 4 May 2018 12:38:23 +0300    

Click here for diff

nbtsort.c does not need to truncate away non-key attributes for the  
minimum key of the leftmost page on a level, since this is only used to  
build a minus infinity downlink for the level's leftmost page.  
Truncating away non-key attributes in advance of truncating away all  
attributes in _bt_sortaddtup() does not affect the correctness of CREATE  
INDEX, but it is misleading.  
  
Author: Peter Geoghegan  
Discussion: https://www.postgresql.org/message-id/CAH2-WzkAS2M3ussHG-s_Av=Zo6dPjOxyu5fNRkYnxQV+YzGQ4w@mail.gmail.com  

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

Re-think predicate locking on GIN indexes.

commit   : 0bef1c0678d94436f80450d562a866bb6fa5e509    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 4 May 2018 11:27:50 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 4 May 2018 11:27:50 +0300    

Click here for diff

The principle behind the locking was not very well thought-out, and not  
documented. Add a section in the README to explain how it's supposed to  
work, and change the code so that it actually works that way.  
  
This fixes two bugs:  
  
1. If fast update was turned on concurrently, subsequent inserts to the  
   pending list would not conflict with predicate locks that were acquired  
   earlier, on entry pages. The included 'predicate-gin-fastupdate' test  
   demonstrates that. To fix, make all scans acquire a predicate lock on  
   the metapage. That lock represents a scan of the pending list, whether  
   or not there is a pending list at the moment. Forget about the  
   optimization to skip locking/checking for locks, when fastupdate=off.  
2. If a scan finds no match, it still needs to lock the entry page. The  
   point of predicate locks is to lock the gabs between values, whether  
   or not there is a match. The included 'predicate-gin-nomatch' test  
   tests that case.  
  
In addition to those two bug fixes, this removes some unnecessary locking,  
following the principle laid out in the README. Because all items in  
a posting tree have the same key value, a lock on the posting tree root is  
enough to cover all the items. (With a very large posting tree, it would  
possibly be better to lock the posting tree leaf pages instead, so that a  
"skip scan" with a query like "A & B", you could avoid unnecessary conflict  
if a new tuple is inserted with A but !B. But let's keep this simple.)  
  
Also, some spelling  fixes.  
  
Author: Heikki Linnakangas with some editorization by me  
Review: Andrey Borodin, Alexander Korotkov  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/gin/README
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gist/gist.c
M src/backend/storage/lmgr/README-SSI
M src/include/access/gin_private.h
A src/test/isolation/expected/predicate-gin-fastupdate.out
A src/test/isolation/expected/predicate-gin-nomatch.out
M src/test/isolation/expected/predicate-gin.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/predicate-gin-fastupdate.spec
A src/test/isolation/specs/predicate-gin-nomatch.spec
M src/test/isolation/specs/predicate-gin.spec

Update expected files for older Python versions

commit   : 7d8679975f650d1150d706c8b6a5f04f08dcdd00    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 May 2018 20:29:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 May 2018 20:29:19 -0400    

Click here for diff

neglected in commit fa03769e4c4bf0911da71fba2501006b05ea195a  

M src/pl/plpython/expected/plpython_subtransaction_0.out
M src/pl/plpython/expected/plpython_subtransaction_5.out

Blindly try to fix MSVC build's use of genbki.pl and Gen_fmgrtab.pl.

commit   : bad51a49a4c0ee2dd87191f8aea5ca839c9dbf15    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 18:47:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 18:47:41 -0400    

Click here for diff

We need to use a stamp file to record the runs of these scripts, as  
is done on the Unix side.  I think I got it right, but can't test.  
  
While at it, extend this handmade dependency logic to also check the  
generating script files, as the makefiles do.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Avoid overwriting unchanged output files in genbki.pl and Gen_fmgrtab.pl.

commit   : 1f1cd9b5ddc6e7464c1c7416bcce7007fe3bc88c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 18:06:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 18:06:45 -0400    

Click here for diff

If a particular output file already exists with the contents it should  
have, leave it alone, so that its mod timestamp is not advanced.  
  
In builds using --enable-depend, this can avoid the need to recompile .c  
files whose included files didn't actually change.  It's not clear whether  
it saves much of anything for users of ccache; but the cost of doing the  
file comparisons seems to be negligible, so we might as well do it.  
  
For developers using the MSVC toolchain, this will create a regression:  
msvc/Solution.pm will sometimes run genbki.pl or Gen_fmgrtab.pl  
unnecessarily.  I'll look into fixing that separately.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm

Rearrange makefile rules for running Gen_fmgrtab.pl.

commit   : 9bf28f96c7eb0c3630ef034679c426c2ee289aca    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 17:54:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 17:54:18 -0400    

Click here for diff

Make these rules look more like the ones associated with genbki.pl,  
to wit:  
  
* Use a stamp file to record when we last ran the script, instead of  
relying on the timestamps of the individual output files.  
  
* Take the knowledge out of backend/Makefile and put it in utils/Makefile  
where it belongs.  I moved down the handling of errcodes.h and probes.h  
too, although those continue to be built by separate processes.  
  
In itself, this is just much-needed cleanup with little practical effect.  
However, by decoupling these makefile rules from the timestamps of the  
generated header files, we open the door to not advancing those timestamps  
unnecessarily, which will be taken advantage of by the next commit.  
  
msvc/Solution.pm should be taught to do things similarly, but I'll leave  
that for another commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile
M src/backend/catalog/Makefile
M src/backend/utils/.gitignore
M src/backend/utils/Makefile
M src/include/Makefile
M src/include/utils/.gitignore

Tweak tests to support Python 3.7

commit   : fa03769e4c4bf0911da71fba2501006b05ea195a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 16:13:20 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 16:13:20 -0500    

Click here for diff

Python 3.7 removes the trailing comma in the repr() of  
BaseException (see <https://bugs.python.org/issue30399>), leading to  
test output differences.  Work around that by composing the equivalent  
test output in a more manual way.  

M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/sql/plpython_subtransaction.sql

Add HOLD_INTERRUPTS section into FinishPreparedTransaction.

commit   : 8f9be261f43772ccee2eae94d971bac6557cbe6a    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 3 May 2018 20:08:29 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 3 May 2018 20:08:29 +0300    

Click here for diff

If an interrupt arrives in the middle of FinishPreparedTransaction  
and any callback decide to call CHECK_FOR_INTERRUPTS (e.g.  
RemoveTwoPhaseFile can write a warning with ereport, which checks for  
interrupts) then it's possible to leave current GXact undeleted.  
  
Backpatch to all supported branches  
  
Stas Kelvich  
  
Discussion: ihttps://www.postgresql.org/message-id/[email protected]  

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

Avoid portability issues in autoprewarm.c.

commit   : cddc4dc6c6c9bc6f9e8e7f81b5264e7265a5c070    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 12:50:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 12:50:27 -0400    

Click here for diff

autoprewarm.c mostly considered the number of blocks it might be dealing  
with as being int64.  This is unnecessary, because NBuffers is declared  
as int, and there's been no suggestion that we might widen it in the  
foreseeable future.  Moreover, using int64 is problematic because the  
code expected INT64_FORMAT to work with fscanf(), something we don't  
guarantee, and which indeed fails on some older buildfarm members.  
  
On top of that, the module randomly used uint32 rather than int64 variables  
to hold block counters in several places, so it would fail anyway if we  
ever did have NBuffers wider than that; and it also supposed that pg_qsort  
could sort an int64 number of elements, which is wrong on 32-bit machines  
(though no doubt a 32-bit machine couldn't actually have that many  
buffers).  
  
Hence, change all these variables to plain int.  
  
In passing, avoid shadowing one variable named i with another,  
and avoid casting away const in apw_compare_blockinfo.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_prewarm/autoprewarm.c

Fix pg_dump support for pre-8.2 versions

commit   : ac7a7e328f3e7eb89874860e554517c24dac9150    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 3 May 2018 18:37:34 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 3 May 2018 18:37:34 +0300    

Click here for diff

Unify indnkeys/indnatts/indnkeyatts usage  for all version of query to get  
index information, remove indnkeys column  from query as unused.  
  
Author: Marina Polyakova  
Noticed by: Peter Eisentraut  

M src/bin/pg_dump/pg_dump.c

Further improve code for probing the availability of ARM CRC instructions.

commit   : a7a7387575b87a7ae551307a24835f549d530d14    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 11:32:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 May 2018 11:32:57 -0400    

Click here for diff

Andrew Gierth pointed out that commit 1c72ec6f4 would yield the wrong  
answer on big-endian ARM systems, because the data being CRC'd would be  
different.  To fix that, and avoid the rather unsightly hard-wired  
constant, simply compare the hardware and software implementations'  
results.  
  
While we're at it, also log the resulting decision at DEBUG1, and error  
out if the hw and sw results unexpectedly differ.  Also, since this  
file must compile for both frontend and backend, avoid incorrect  
dependencies on backend-only headers.  
  
In passing, add a comment to postmaster.c about when the CRC function  
pointer will get initialized.  
  
Thomas Munro, based on complaints from Andrew Gierth and Tom Lane  
  
Discussion: https://postgr.es/m/HE1PR0801MB1323D171938EABC04FFE7FA9E3110@HE1PR0801MB1323.eurprd08.prod.outlook.com  

M src/backend/postmaster/postmaster.c
M src/port/pg_crc32c_armv8_choose.c

Fix SPI error cleanup and memory leak

commit   : 30c66e77be1d890c3cca766259c0bec80bcac1b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 May 2018 16:50:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 May 2018 16:50:03 -0400    

Click here for diff

Since the SPI stack has been moved from TopTransactionContext to  
TopMemoryContext, setting _SPI_stack to NULL in AtEOXact_SPI() leaks  
memory.  In fact, we don't need to do that anymore: We just leave the  
allocated stack around for the next SPI use.  
  
Also, refactor the SPI cleanup so that it is run both at transaction end  
and when returning to the main loop on an exception.  The latter is  
necessary when a procedure calls a COMMIT or ROLLBACK command that  
itself causes an error.  

M src/backend/executor/spi.c
M src/backend/tcop/postgres.c
M src/include/executor/spi.h

Remove now-unnecessary cast.

commit   : a365f52d58317e3b24e06564e1f6474ffa3221d4    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 2 May 2018 20:26:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 2 May 2018 20:26:02 -0400    

Click here for diff

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

M contrib/postgres_fdw/postgres_fdw.c

Improve our method for probing the availability of ARM CRC instructions.

commit   : 1c72ec6f498945eb5981cdedd448aec3977477c8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 18:06:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 18:06:43 -0400    

Click here for diff

Instead of depending on glibc's getauxval() function, just try to execute  
the CRC code, and trap SIGILL if that happens.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/HE1PR0801MB1323D171938EABC04FFE7FA9E3110@HE1PR0801MB1323.eurprd08.prod.outlook.com  

M configure
M configure.in
M src/include/pg_config.h.in
M src/port/pg_crc32c_armv8_choose.c

Prevent NaN in jsonb/plpython transform

commit   : 40f52b16dd31aa9ddc3bd42daa78459562693567    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 May 2018 15:58:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 May 2018 15:58:34 -0400    

Click here for diff

As in e348e7ae5727a6da8678036d748e5c5af7deb6c9 for jsonb/plperl, prevent  
putting a NaN into a jsonb numeric field.  
  
Tests for this had been removed in  
6278a2a262b63faaf47eb2371f6bcb5b6e3ff118, but in case they are ever  
resurrected: This would change the output of the test1nan() function to  
an error.  

M contrib/jsonb_plpython/jsonb_plpython.c

Suppress some compiler warnings in plperl on Windows.

commit   : 0996e4be047fbf476dacea5ffad42cdd3a36b731    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 16:00:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 16:00:54 -0400    

Click here for diff

Perl's XSUB.h header defines macros to replace libc functions.  Our header  
port_win32.h does something similar earlier, so XSUB.h causes compiler  
warnings about macro redefinition.  Undefine our macros before including  
XSUB.h.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm%3D3%3DTDYEXUEcHpEx%2BTwc31wo7PA0oBAiNt6sWmq93MW02A%40mail.gmail.com  

M src/pl/plperl/plperl.h

Fix assorted compiler warnings seen in the buildfarm.

commit   : fbb2e9a030ee7a3fa20ce402e4b1da9809b4eb52    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 15:52:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 15:52:54 -0400    

Click here for diff

Failure to use DatumGetFoo/FooGetDatum macros correctly, or at all,  
causes some warnings about sign conversion.  This is just cosmetic  
at the moment but in principle it's a type violation, so clean up  
the instances I could find.  
  
autoprewarm.c and sharedfileset.c contained code that unportably  
assumed that pid_t is the same size as int.  We've variously dealt  
with this by casting pid_t to int or to unsigned long for printing  
purposes; I went with the latter.  
  
Fix uninitialized-variable warning in RestoreGUCState.  This is  
a live bug in some sense, but of no great significance given that  
nobody is very likely to care what "line number" is associated with  
a GUC that hasn't got a source file recorded.  

M contrib/hstore/hstore_io.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/file/sharedfileset.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c

Fix bogus code for extracting extended-statistics data from syscache.

commit   : 447dbf7aa7909bca76048042d6734ee8f5249d0f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 12:22:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 12:22:48 -0400    

Click here for diff

statext_dependencies_load and statext_ndistinct_load were not up to snuff,  
in addition to being randomly different from each other.  In detail:  
  
* Deserialize the fetched bytea value before releasing the syscache  
entry, not after.  This mistake causes visible regression test failures  
when running with -DCATCACHE_FORCE_RELEASE.  Since it's not exposed by  
-DCLOBBER_CACHE_ALWAYS, I think there may be no production hazard here  
at present, but it's at least a latent bug.  
  
* Use DatumGetByteaPP not DatumGetByteaP to save a detoasting cycle  
for short stats values; the deserialize function has to be, and is,  
prepared for short-header values since its other caller uses PP.  
  
* Use a test-and-elog for null stats values in both functions, rather  
than a test-and-elog in one case and an Assert in the other.  Perhaps  
Asserts would be sufficient in both cases, but I don't see a good  
argument for them being different.  
  
* Minor cosmetic changes to make these functions more visibly alike.  
  
Backpatch to v10 where this code came in.  
  
Amit Langote, minor additional hacking by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Correct update on limitations of partitions

commit   : bcded2609ade6204badde506025b414c8e6ef0cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 May 2018 12:06:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 May 2018 12:06:25 -0400    

Click here for diff

Amit Langote  

M doc/src/sgml/ddl.sgml

Remove remaining references to version-0 calling convention in docs.

commit   : f66912b0a0387aab5f5bbcd9d56ab92200395d2e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 2 May 2018 17:51:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 2 May 2018 17:51:11 +0300    

Click here for diff

Support for version-0 calling convention was removed in PostgreSQL v10.  
Change the SPI example to use version 1 convention, so that it actually  
works.  
  
Author: John Naylor  
Discussion: https://www.postgresql.org/message-id/CAJVSVGVydmhLBdm80Rw3G8Oq5TnA7eCxUv065yoZfNfLbF1tzA@mail.gmail.com  

M doc/src/sgml/plhandler.sgml
M doc/src/sgml/spi.sgml

Fix some sloppiness in the new BufFileSize() and BufFileAppend() functions.

commit   : 445e31bdc749e56376993232e5c2cc4931161322    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 2 May 2018 17:23:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 2 May 2018 17:23:13 +0300    

Click here for diff

There were three related issues:  
  
* BufFileAppend() incorrectly reset the seek position on the 'source' file.  
  As a result, if you had called BufFileRead() on the file before calling  
  BufFileAppend(), it got confused, and subsequent calls would read/write  
  at wrong position.  
  
* BufFileSize() did not work with files opened with BufFileOpenShared().  
  
* FileGetSize() only worked on temporary files.  
  
To fix, change the way BufFileSize() works so that it works on shared  
files. Remove FileGetSize() altogether, as it's no longer needed. Remove  
buffilesize from TapeShare struct, as the leader process can simply call  
BufFileSize() to get the tape's size, there's no need to pass it through  
shared memory anymore.  
  
Discussion: https://www.postgresql.org/message-id/CAH2-WznEDYe_NZXxmnOfsoV54oFkTdMy7YLE2NPBLuttO96vTQ@mail.gmail.com  

M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/include/storage/fd.h
M src/include/utils/logtape.h

docs: Remove tabs recently introduced by me.

commit   : 7f6570b3a8d1aa8e90ab0868eefa5a4236b0ada3    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 2 May 2018 08:33:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 2 May 2018 08:33:36 -0400    

Click here for diff

M doc/src/sgml/release.sgml

Fix compiler warning on Windows.

commit   : fe4ecd08d81cfea7f0512189893cc02cf261ccde    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 00:25:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 00:25:35 -0400    

Click here for diff

Commit 41c912cad caused MSVC to complain that not all control paths  
return a value.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm%3D3%3DTDYEXUEcHpEx%2BTwc31wo7PA0oBAiNt6sWmq93MW02A%40mail.gmail.com  

M src/bin/pgbench/pgbench.c

Change SIZEOF_BOOL to 1 for Windows.

commit   : 6fe25c1358a2a9612f0b4ce841e68d74e408cebe    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 00:21:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 May 2018 00:21:21 -0400    

Click here for diff

For some reason it was previously defined as 0, which is silly.  The only  
effect was to disable use of <stdbool.h>, which commit b2328bf62 intended  
to make possible.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm%3D3%3DTDYEXUEcHpEx%2BTwc31wo7PA0oBAiNt6sWmq93MW02A%40mail.gmail.com  

M src/include/pg_config.h.win32

Further -Wimplicit-fallthrough cleanup.

commit   : 2993435dbae5deb8d2f6c2a715690a5aef4eddb8    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 1 May 2018 19:53:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 1 May 2018 19:53:48 -0700    

Click here for diff

Tom's earlier commit in 41c912cad159 didn't update a few cases that  
are only encountered with the non-standard --with-llvm config  
flag. Additionally there's also one case that appears to be a  
deficiency in gcc's (up to trunk as of a few days ago) detection of  
"fallthrough" comments - changing the placement slightly fixes that.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/llvm/llvmjit_expr.c
M src/interfaces/libpq/fe-secure.c

Fix some assorted compiler warnings on Windows.

commit   : b2328bf62b6465236e318d31a011ced5dccfd580    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 19:38:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 19:38:26 -0400    

Click here for diff

Don't overflow the result type of constant expressions.  Don't negate  
unsigned types.  Define HAVE_STDBOOL_H for Visual C++ 2013 and later.  
  
Thomas Munro  
Reviewed-By: Michael Paquier and Tom Lane  
  
Discussion: https://postgr.es/m/CAEepm%3D3%3DTDYEXUEcHpEx%2BTwc31wo7PA0oBAiNt6sWmq93MW02A%40mail.gmail.com  

M src/backend/replication/basebackup.c
M src/bin/pgbench/pgbench.c
M src/include/pg_config.h.win32

Clean up warnings from -Wimplicit-fallthrough.

commit   : 41c912cad15955b5f9270ef3688a44e91d410d3d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 19:35:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 19:35:08 -0400    

Click here for diff

Recent gcc can warn about switch-case fall throughs that are not  
explicitly labeled as intentional.  This seems like a good thing,  
so clean up the warnings exposed thereby by labeling all such  
cases with comments that gcc will recognize.  
  
In files that already had one or more suitable comments, I generally  
matched the existing style of those.  Otherwise I went with  
/* FALLTHROUGH */, which is one of the spellings approved at the  
more-restrictive-than-default level -Wimplicit-fallthrough=4.  
(At the default level you can also spell it /* FALL ?THRU */,  
and it's not picky about case.  What you can't do is include  
additional text in the same comment, so some existing comments  
containing versions of this aren't good enough.)  
  
Testing with gcc 8.0.1 (Fedora 28's current version), I found that  
I also had to put explicit "break"s after elog(ERROR) or ereport(ERROR);  
apparently, for this purpose gcc doesn't recognize that those don't  
return.  That seems like possibly a gcc bug, but it's fine because  
in most places we did that anyway; so this amounts to a visit from the  
style police.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/btree_gin.c
M contrib/pageinspect/hashfuncs.c
M src/backend/access/hash/hashfunc.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/explain.c
M src/backend/commands/indexcmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/regex/regc_lex.c
M src/backend/regex/regcomp.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/misc/guc.c
M src/backend/utils/sort/tuplestore.c
M src/bin/pgbench/pgbench.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/tcl/pltcl.c

Improve representation of 'moved partitions' indicator on deleted tuples.

commit   : 1667148a4dd98cea28b8b53d57dbc1eece1b0b5c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 1 May 2018 13:30:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 1 May 2018 13:30:12 -0700    

Click here for diff

Previously a tuple that has been moved to a different partition (see  
f16241bef7c), set the block number on the old tuple to an invalid  
value to indicate that fact. But the tuple offset was left  
untouched. That turned out to trigger a wal_consistency_checking  
failure as reported by Peter Geoghegan, as the offset wasn't  
always overwritten during WAL replay.  
  
Heikki observed that we're wasting valuable data by not putting  
information also in the offset. Thus set that to  
MovedPartitionsOffsetNumber when a tuple indicates it has moved.  
  
We continue to set the block number to MovedPartitionsBlockNumber, as  
that seems more likely to cause problems for code not updated to know  
about moved tuples.  
  
As t_ctid's offset number is now always set, this refinement also  
fixes the wal_consistency_checking issue.  
  
This technically is a minor disk format break, with previously created  
moved tuples not being recognized anymore. But since there not even  
has been a beta release since f16241bef7c...  
  
Reported-By: Peter Geoghegan  
Author: Heikki Linnakangas, Amul Sul  
Discussion: https://postgr.es/m/CAH2-Wzm9ty+1BX7-GMNJ=xPRg67oJTVeDNdA9LSyJJtMgRiCMA@mail.gmail.com  

M src/include/access/htup_details.h
M src/include/storage/itemptr.h

Fix interaction of foreign tuple routing with remote triggers.

commit   : 37a3058bc7c8224d4c0d8b36176d821636a1f90e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 May 2018 13:21:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 May 2018 13:21:46 -0400    

Click here for diff

Without these fixes, changes to the inserted tuple made by remote  
triggers are ignored when building local RETURNING tuples.  
  
In the core code, call ExecInitRoutingInfo at a later point from  
within ExecInitPartitionInfo so that the FDW callback gets invoked  
after the returning list has been built.  But move CheckValidResultRel  
out of ExecInitRoutingInfo so that it can happen at an earlier stage.  
  
In postgres_fdw, refactor assorted deparsing functions to work with  
the RTE rather than the PlannerInfo, which saves us having to  
construct a fake PlannerInfo in cases where we don't have a real one.  
Then, we can pass down a constructed RTE that yields the correct  
deparse result when no real one exists.  Unfortunately, this  
necessitates a hack that understands how the core code manages RT  
indexes for update tuple routing, which is ugly, but we don't have a  
better idea right now.  
  
Original report, analysis, and patch by Etsuro Fujita.  Heavily  
refactored by me.  Then worked over some more by Amit Langote.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c

Remove jsonb_plperl test cases for Inf/NaN conversions.

commit   : 6594ee280383b7548b006e7f96c8d06137fced57    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 13:21:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 13:21:16 -0400    

Click here for diff

It turns out that old Perl versions (before about 5.10) don't have any  
very reliable way to generate Inf or NaN numeric values.  Getting around  
that would require way more work than is really justified to test the  
code involved, so let's just drop these new test cases.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove investigative code for can't-reattach-to-shared-memory errors.

commit   : bcbf2346d69f6006f126044864dd9383d50d87b4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 13:06:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 May 2018 13:06:31 -0400    

Click here for diff

Revert commits 23078689a, 73042b8d1, ce07aff48, f7df8043f, 6ba0cc4bd,  
eb16011f4, 68e7e973d, 63ca350ef.  We still have a problem here, but  
somebody who's actually a Windows developer will need to spend time  
on it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Document that subscription tests require hstore

commit   : fa94fa6d8293c3a3cfdf0514f8bbd40b68bf3beb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 May 2018 10:33:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 May 2018 10:33:02 -0400    

Click here for diff

M src/test/subscription/README

doc comments: rendering engines are another UTF8 restriction

commit   : 81ff9ec8f8b12e03f76062000b322da6568bc941    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 1 May 2018 10:17:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 1 May 2018 10:17:55 -0400    

Click here for diff

M doc/src/sgml/release.sgml

docs comments: clarify why not to use UTF8 still in docs

commit   : 3960fa5f6396865ded34d9276324e9a31857cff1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 1 May 2018 09:26:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 1 May 2018 09:26:11 -0400    

Click here for diff

Back branches still are SGML.  

M doc/src/sgml/release.sgml

doc: Update limitations of partitions

commit   : 5a6ab0a1b157a27da7160565ee2f1815e94a6122    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 May 2018 07:48:51 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 May 2018 07:48:51 -0400    

Click here for diff

David Rowley, Amit Langote  

M doc/src/sgml/ddl.sgml

Tweak new jsonb_plperl test cases to work with old Perl versions.

commit   : 827eb4393c8a06de0c8673888a5734170e218a1d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 23:58:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 23:58:48 -0400    

Click here for diff

The previous coding here didn't actually produce Inf or NaN double  
values in Perl versions 5.8.x.  Adopt a suggestion from stackoverflow.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Does it help to wait before reattaching?

commit   : 23078689a9921968ac0873b017be6e7f772f10bc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 20:09:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 20:09:31 -0400    

Click here for diff

Revert the map/unmap dance I tried in commit 73042b8d1; that helps  
not at all.  
  
Instead, speculate that the unwanted allocation is being done on  
another thread, and thus timing variations explain the apparent  
unpredictability.  Temporarily add a 1-second sleep before the  
VirtualFree call, in hopes that any such other threads will  
quiesce and not jog our elbow.  
  
This is obviously not a desirable long-term fix, but as a means of  
investigation it seems useful.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Map and unmap the shared memory block before risking VirtualFree.

commit   : 73042b8d136fe985746dc762fcb2a4356460842d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 17:07:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 17:07:14 -0400    

Click here for diff

The idea here is to get Windows' userspace infrastructure to allocate  
whatever space it needs for MapViewOfFileEx() before we release the  
locked-down space that we want to map the shared memory block into.  
  
This is a fairly brute-force attempt, and would likely (for example)  
fail with large shared memory on 32-bit Windows.  We could perhaps  
ameliorate that by mapping only part of the shared memory block in  
this way, but for the moment I just want to see if this approach  
will fix dory's problem.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Further effort at preventing memory map dump from affecting the results.

commit   : ce07aff48f15a2fa4f91bc67efe1cb3cc9c14bcf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 16:19:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 16:19:51 -0400    

Click here for diff

Rather than elog'ing immediately, push the map data into a preallocated  
StringInfo.  Perhaps this will prevent some of the mid-operation  
allocations that are evidently happening now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Remove plperl isnan hack

commit   : b04ebca6cd845c0a51da71efa3e2c57d32e823cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 14:34:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 14:34:05 -0400    

Click here for diff

The code previously undefined isnan because of a compiler warning on  
MinGW.  Since we now need to use isnan, we can't do that anymore.  
  
We might need a different solution if the compiler warning is too  
annoying.  

M src/pl/plperl/plperl.h

Write error messages about duplicate OIDs to stderr

commit   : c5679256e93d8022b3cdd146a28f6a362a3c79e3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 14:18:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 14:18:46 -0400    

Click here for diff

M src/backend/catalog/genbki.pl

Remove "Generating" output from catalog scripts

commit   : 33a1c2145cd5eba2148e8288997f1d70058fc920    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 14:18:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 14:18:07 -0400    

Click here for diff

So by default, they don't output anything if everything is well.  
  
Discussion: https://www.postgresql.org/message-id/867f8a1a-6cf0-d835-78d8-0844e4936241%402ndquadrant.com  

M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl

Don't do logical replication of TRUNCATE of zero tables

commit   : 92e1583b439ffab1d20419998895932e4fbe32fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 13:49:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 13:49:20 -0400    

Click here for diff

When due to publication configuration, a TRUNCATE change ends up with  
zero tables to be published, don't send the message out, just skip it.  
It's not wrong, but obviously useless overhead.  

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

Prevent infinity and NaN in jsonb/plperl transform

commit   : e348e7ae5727a6da8678036d748e5c5af7deb6c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 12:28:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Apr 2018 12:28:45 -0400    

Click here for diff

jsonb uses numeric internally, and numeric can store NaN, but that is  
not allowed by jsonb on input, so we shouldn't store it.  Also prevent  
infinity to get a consistent error message.  (numeric input would reject  
infinity anyway.)  
  
Reported-by: Dagfinn Ilmari MannsĆ„ker <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

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

Remove Windows module-list-dumping code.

commit   : f7df8043f08a9d00811fb4aa054ed3221f5f9b5e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 13:20:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 13:20:13 -0400    

Click here for diff

This code is evidently allocating memory and thus confusing matters  
even more.  Let's see whether we can learn anything with  
just VirtualQuery.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile
M src/backend/port/win32_shmem.c
M src/makefiles/Makefile.win32
M src/tools/msvc/Mkvcbuild.pm

clean up pg_upgrade tmp_check under MSVC

commit   : bb779006f4e1881de2c80409225e57e3a3e17d40    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 30 Apr 2018 12:43:57 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 30 Apr 2018 12:43:57 -0400    

Click here for diff

M src/tools/msvc/clean.bat

Ignore file generated during pg_upgrade testing

commit   : 0146e32f9f54f8bc556307c4204a404f18c5663b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 30 Apr 2018 12:39:29 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 30 Apr 2018 12:39:29 -0400    

Click here for diff

M src/bin/pg_upgrade/.gitignore

Dump full memory maps around failing Windows reattach code.

commit   : 6ba0cc4bd3a6d738eddf7e8aa2ef7b46cdd9ce8f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 11:16:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Apr 2018 11:16:21 -0400    

Click here for diff

This morning's results from buildfarm member dory make it pretty  
clear that something is getting mapped into the just-freed space,  
but not what that something is.  Replace my minimalistic probes  
with a full dump of the process address space and module space,  
based on Noah's work at  
<20170403065106.GA2624300%40tornado.leadboat.com>  
  
This is all (probably) to get reverted once we have fixed the  
problem, but for now we need information.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile
M src/backend/port/win32_shmem.c
M src/makefiles/Makefile.win32
M src/tools/msvc/Mkvcbuild.pm

Fix bogus list-iteration code in pg_regress.c, affecting ecpg tests only.

commit   : c5e46c7c3b9333616de9946f8e63df1576a19800    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 21:56:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 21:56:27 -0400    

Click here for diff

While looking at a recent buildfarm failure in the ecpg tests, I wondered  
why the pg_regress output claimed the stderr part of the test failed, when  
the regression diffs were clearly for the stdout part.  Looking into it,  
the reason is that pg_regress.c's logic for iterating over three parallel  
lists is wrong, and has been wrong since it was written: it advances the  
"tag" pointer at a different place in the loop than the other two pointers.  
Fix that.  

M src/test/regress/pg_regress.c

Get still more info about Windows can't-reattach-to-shared-memory errors.

commit   : eb16011f4c08a8c2ddfbf0637b862ee1918dd9b2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 20:41:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 20:41:19 -0400    

Click here for diff

After some thought about the info captured so far, it seems possible  
that MapViewOfFileEx is itself causing some DLL to get loaded into  
the space just freed by VirtualFree.  The previous commit here didn't  
capture enough info to really prove the case for that, so let's add  
one more VirtualQuery in between those steps.  Also, be sure to  
capture the post-Map state before we emit any log entries, just in  
case elog() is invoking some code not previously loaded.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Avoid wrong results for power() with NaN input on more platforms.

commit   : 6bdf1303b34bc630e8945ae3407ec7e8395c8fe5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 18:15:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 18:15:16 -0400    

Click here for diff

Buildfarm results show that the modern POSIX rule that 1 ^ NaN = 1 is not  
honored on *BSD until relatively recently, and really old platforms don't  
believe that NaN ^ 0 = 1 either.  (This is unsurprising, perhaps, since  
SUSv2 doesn't require either behavior.)  In hopes of getting to platform  
independent behavior, let's deal with all the NaN-input cases explicitly  
in dpow().  
  
Note that numeric_power() doesn't know either of these special cases.  
But since that behavior is platform-independent, I think it should be  
addressed separately, and probably not back-patched.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/test/regress/expected/float8-exp-three-digits-win32.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8-small-is-zero_1.out
M src/test/regress/expected/float8.out
M src/test/regress/sql/float8.sql

Get more info about Windows can't-reattach-to-shared-memory errors.

commit   : 68e7e973d22274a089ce95200b3782f514f6d2f8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 16:02:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 16:02:45 -0400    

Click here for diff

Commit 63ca350ef neglected to probe the state of things *before*  
the VirtualFree call, which now looks like it might be interesting.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Update time zone data files to tzdata release 2018d.

commit   : df629586e89751498d741f107b418d68bccc616e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 15:50:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 15:50:08 -0400    

Click here for diff

DST law changes in Palestine and Antarctica (Casey Station).  Historical  
corrections for Portugal and its colonies, as well as Enderbury, Jamaica,  
Turks & Caicos Islands, and Uruguay.  

M src/timezone/data/tzdata.zi

Avoid wrong results for power() with NaN input on some platforms.

commit   : 61b200e2f582d0886d9de947e182483339d881fd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 15:21:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 15:21:44 -0400    

Click here for diff

Per spec, the result of power() should be NaN if either input is NaN.  
It appears that on some versions of Windows, the libc function does  
return NaN, but it also sets errno = EDOM, confusing our code that  
attempts to work around shortcomings of other platforms.  Hence, add  
guard tests to avoid substituting a wrong result for the right one.  
  
It's been like this for a long time (and the odd behavior only appears  
in older MSVC releases, too) so back-patch to all supported branches.  
  
Dang Minh Huong, reviewed by David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/test/regress/expected/float8-exp-three-digits-win32.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8-small-is-zero_1.out
M src/test/regress/expected/float8.out
M src/test/regress/sql/float8.sql

Cosmetic improvement: use BKI_DEFAULT and BKI_LOOKUP in pg_language.

commit   : 85475afdb6f4f630f2071235373a986e472a117b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 13:26:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Apr 2018 13:26:26 -0400    

Click here for diff

The point of this is not really to remove redundancy in pg_language.dat;  
with only three entries, it's hardly worth it.  Rather, it is to get  
to a point where there are exactly zero hard-coded numeric pg_proc OID  
references in the catalog .dat files.  The lanvalidator column was the  
only remaining location of such references, and it seems like a good  
thing for future-proofing reasons to make it not be a special case.  
  
There are still a few places in the .dat files with numeric OID references  
to other catalogs, but after review I don't see any that seem worth  
changing at present.  In each case there are just too few entries to make  
it worth the trouble to create lookup infrastructure.  
  
This doesn't change the emitted postgres.bki file, so no catversion bump.  

M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h

In AtEOXact_Files, complain if any files remain unclosed at commit.

commit   : 9cb7db3f0c1f554cdcbbd97f78a119a19756e6ef    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 17:45:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 17:45:02 -0400    

Click here for diff

This change makes this module act more like most of our other low-level  
resource management modules.  It's a caller error if something is not  
explicitly closed by the end of a successful transaction, so issue  
a WARNING about it.  This would not actually have caught the file leak  
bug fixed in commit 231bcd080, because that was in a transaction-abort  
path; but it still seems like a good, and pretty cheap, cross-check.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c
M src/backend/storage/file/fd.c
M src/include/storage/fd.h

Fix incorrect field type for PlannedStmt.jitFlags in outfuncs/readfuncs.

commit   : cfffe83ba82021a1819a656e7ec5c28fb3a99152    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 16:46:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 16:46:24 -0400    

Click here for diff

This field was a bool at one point, but now it's an int.  
Spotted by Hari Babu; trivial patch is by Ashutosh Bapat.  
  
Discussion: https://postgr.es/m/CAJrrPGedKiFE2fqntSauUfhapCksOJzam+QtHfSgx86LhXLeOQ@mail.gmail.com  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Tweak reformat_dat_file.pl to make it more easily hand-invokable.

commit   : 84549ebd4c4d1941006056cfb2455a4983fb15a2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 16:09:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 16:09:03 -0400    

Click here for diff

Use the same code we already applied in duplicate_oids and unused_oids  
to let this script find Catalog.pm without help.  This removes the need  
to supply a -I switch in most cases.  
  
Also, mark the script executable, again to follow the precedent of  
duplicate_oids and unused_oids.  Now you can just do  
"./reformat_dat_file.pl pg_proc.dat"  
if you want to reformat only one or a few .dat files rather than all.  
  
It'd be possible to remove the -I switches in the Makefile's convenience  
targets, but I chose to leave them: they don't hurt anything, and it's  
possible that in weird VPATH situations they might be of value.  

M doc/src/sgml/bki.sgml
M src/include/catalog/reformat_dat_file.pl

Clarify handling of special-case values in bootstrap catalog data.

commit   : 45c6d75f8cd2399181063b4e0ec11c2664ebeda6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 15:27:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 15:27:16 -0400    

Click here for diff

I (tgl) originally coded the special case for pg_proc.pronargs as  
though it were a kind of default value.  It seems better though to  
treat computable columns as an independent concern: this makes the  
code clearer, and probably a bit faster too since we needn't do  
work inside the per-column loop.  
  
Improve related comments, as well, in the expectation that there  
might be more cases like this in future.  
  
John Naylor, some additional comment-hacking by me  
  
Discussion: https://postgr.es/m/CAJVSVGW-D7OobzU=dybVT2JqZAx-4X1yvBJdavBmqQL05Q6CLw@mail.gmail.com  

M src/backend/catalog/Catalog.pm
M src/include/catalog/pg_proc.dat
M src/include/catalog/reformat_dat_file.pl

Un-break contrib install with llvm.

commit   : f2bb32dbd6af8ec3eb99308289a83b1ff3ca6514    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 14:45:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 14:45:39 -0400    

Click here for diff

Apparently $(foreach ... $(call install_llvm_module,...)) doesn't work  
too well without a blank line ending the install_llvm_module macro.  
The previous coding hackishly dodged this problem with some parens,  
but that's not really a good solution because make misunderstands  
where the command boundaries are that way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Minor cleanups for install_llvm_module/uninstall_llvm_module Make macros.

commit   : bc19b7836215b1a847524041a1bd138d7bb5cbef    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 14:02:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 14:02:57 -0400    

Click here for diff

Don't put comments inside the macros, per complaint from Michael Paquier.  
  
Quote target directory path with single quotes, not double; that seems  
to be our project standard.  Not quoting it at all definitely isn't  
per standard.  
  
Remove excess slash in one instance of path.  
  
Remove useless semicolon.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Assorted minor doc/comment fixes.

commit   : 4094031dd3392b2f49b190a5617d0c247167bcf6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 11:46:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Apr 2018 11:46:15 -0400    

Click here for diff

Identify pg_replication_origin as a shared catalog in catalogs.sgml,  
using the same boilerplate wording used for most other shared catalogs  
(and tweak another place where someone had randomly deviated from  
that boilerplate).  
  
Make an example in mmgr/README more consistent with surrounding text.  
  
Update an obsolete cross-reference in a comment in storage/block.h.  
  
Zhuo Ql  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/utils/mmgr/README
M src/include/storage/block.h

Try to get some info about Windows can't-reattach-to-shared-memory errors.

commit   : 63ca350ef9f58d48ac89fd3c68416e319cac0a39    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Apr 2018 21:59:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Apr 2018 21:59:58 -0400    

Click here for diff

Add some debug printouts focused on the idea that MapViewOfFileEx might  
be rounding its virtual memory allocation up more than we expect (and,  
in particular, more than VirtualAllocEx does).  
  
Once we've seen what this reports in one of the failures on buildfarm  
members dory or jacana, we might revert this ... or perhaps just  
decrease the log level.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Adjust hints and docs to suggest CREATE EXTENSION not CREATE LANGUAGE.

commit   : 2e83e6bd74ee8d4d119edf8272406f23e6c546cf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Apr 2018 13:42:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Apr 2018 13:42:03 -0400    

Click here for diff

The core PLs have been extension-ified for seven years now, and we can  
reasonably hope that all out-of-core PLs have been too.  So adjust a few  
places that were still recommending CREATE LANGUAGE as the user-level  
way to install a PL.  
  
Discussion: https://postgr.es/m/CA+TgmoaJTUDMSuSCg4k08Dv8vhbrJq9nP3ZfPbmysVz_616qxw@mail.gmail.com  

M doc/src/sgml/ref/create_transform.sgml
M doc/src/sgml/ref/do.sgml
M src/backend/commands/functioncmds.c

perltidy: Add option --nooutdent-long-comments

commit   : 76ece169746f50652771a9fa9adc66d207e9d6f7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Apr 2018 14:13:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Apr 2018 14:13:46 -0400    

Click here for diff

M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/pl/plperl/plperl_opmask.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/ssl/ServerSetup.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/gendef.pl
M src/tools/pgindent/perltidyrc

perltidy: Add option --nooutdent-long-quotes

commit   : d4f16d50713077e69f8833df6b99d1eab0be1c33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Apr 2018 11:52:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Apr 2018 11:52:52 -0400    

Click here for diff

M contrib/bloom/t/001_wal.pl
M src/backend/parser/check_keywords.pl
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/test/authentication/t/001_password.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/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/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/tools/check_bison_recursion.pl
M src/tools/fix-old-flex-code.pl
M src/tools/git_changelog
M src/tools/msvc/Install.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VCBuildProject.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/build.pl
M src/tools/msvc/builddoc.pl
M src/tools/msvc/vcregress.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/perltidyrc
M src/tools/pgindent/pgindent
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl

perltidy: Don't write backup files

commit   : a2ada08d4c0afa2d1f678ba7fb03ccc065f3a57b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 10:09:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 10:09:37 -0400    

Click here for diff

Newer perltidy versions can just avoid writing backup files, so we don't  
need the old dance of deleting them afterwards.  Supported since 20120619.  
  
https://metacpan.org/source/SHANCOCK/Perl-Tidy-20120619/CHANGES#L61  

M src/tools/pgindent/perltidyrc
M src/tools/pgindent/pgperltidy

Remove outdated comment on how to set logtape's read buffer size.

commit   : 45f87b7710214ea71947ee3678c6b7cb61580797    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 27 Apr 2018 09:31:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 27 Apr 2018 09:31:43 +0300    

Click here for diff

Commit b75f467b6e removed the LogicalTapeAssignReadBufferSize() function,  
but forgot to update this comment. The read buffer size is an argument to  
LogicalTapeRewindForRead() now. Doesn't seem worth going into the details  
in the file header comment, so remove the outdated sentence altogether.  

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

C comment: add description of root_tuple_slot

commit   : 7551d9bc408c2402a8558367ee950ca403e25b37    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 26 Apr 2018 14:54:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 26 Apr 2018 14:54:46 -0400    

Click here for diff

Reported-by: Amit Langote  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/executor/execPartition.h

Post-feature-freeze pgindent run.

commit   : bdf46af748d0f15f257c99bf06e9e25aba6a24f9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 14:47:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 14:47:16 -0400    

Click here for diff

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

M contrib/amcheck/verify_nbtree.c
M contrib/btree_gin/btree_gin.c
M contrib/cube/cube.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/brin/brin.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gist.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_inherits.c
M src/backend/commands/alter.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeValuesscan.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/lib/bloomfilter.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/read.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partprune.c
M src/backend/port/win32_shmem.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/file/buffile.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/tcop/utility.c
M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/sharedtuplestore.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/server.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/common.c
M src/bin/psql/mainloop.c
M src/bin/psql/tab-complete.c
M src/fe_utils/conditional.c
M src/include/access/gin_private.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/spgist_private.h
M src/include/access/twophase.h
M src/include/access/xact.h
M src/include/catalog/pg_class.h
M src/include/commands/tablecmds.h
M src/include/common/int.h
M src/include/common/scram-common.h
M src/include/common/string.h
M src/include/executor/execExpr.h
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/include/executor/instrument.h
M src/include/executor/spi_priv.h
M src/include/executor/tuptable.h
M src/include/fe_utils/conditional.h
M src/include/libpq/libpq.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/parser/parse_func.h
M src/include/replication/logical.h
M src/include/replication/logicalproto.h
M src/include/replication/reorderbuffer.h
M src/include/replication/walreceiver.h
M src/include/storage/reinit.h
M src/include/tcop/utility.h
M src/include/tsearch/ts_utils.h
M src/include/utils/jsonapi.h
M src/include/utils/partcache.h
M src/include/utils/portal.h
M src/include/utils/rel.h
M src/include/utils/resowner_private.h
M src/include/utils/tuplesort.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/plpy_exec.c
M src/pl/tcl/pltcl.c
M src/test/modules/test_bloomfilter/test_bloomfilter.c

Preliminary work for pgindent run.

commit   : f83bf385c1dad4964e0d899174989a1668536182    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 14:45:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 14:45:04 -0400    

Click here for diff

Update typedefs.list from current buildfarm results.  Adjust pgindent's  
typedef blacklist to block some more unfortunate typedef names that have  
snuck in since last time.  Manually tweak a few places where I didn't  
like the initial results of pgindent'ing.  

M contrib/pg_trgm/trgm_op.c
M src/backend/libpq/be-secure-common.c
M src/include/storage/reinit.h
M src/port/pg_crc32c_armv8.c
M src/tools/pgindent/pgindent
M src/tools/pgindent/typedefs.list

Avoid parsing catalog data twice during BKI file construction.

commit   : a0854f10722b20a445f5e67a357bd8809b32f540    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 13:22:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 13:22:27 -0400    

Click here for diff

In the wake of commit 5602265f7, we were doing duplicate-OID detection  
quite inefficiently, by invoking duplicate_oids which does all the same  
parsing of catalog headers and .dat files as genbki.pl does.  That adds  
under half a second on modern machines, but quite a bit more on slow  
buildfarm critters, so it seems worth avoiding.  Let's just extend  
genbki.pl a little so it can also detect duplicate OIDs, and remove  
the duplicate_oids call from the build process.  
  
(This also means that duplicate OID detection will happen during  
Windows builds, which AFAICS it didn't before.)  
  
This makes the use-case for duplicate_oids a bit dubious, but it's  
possible that people will still want to run that check without doing  
a whole build run, so let's keep that script.  
  
In passing, move down genbki.pl's creation of its temp output files  
so that it doesn't happen until after we've done parsing and validation  
of the input.  This avoids leaving a lot of clutter around after a  
failure.  
  
John Naylor and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bki.sgml
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl

Fix duplicate_oids and unused_oids so user needn't cd to catalog dir.

commit   : dd4cc9d7069c04d0ee8ae040511274c6e71b60f7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 11:19:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Apr 2018 11:19:52 -0400    

Click here for diff

Previously, you had to cd into src/include/catalog before running either  
of these scripts.  That's a bit tedious, so let's make the scripts do it  
for you.  
  
In passing, improve the initial comments in both scripts.  Also remove  
unused_oids' code to complain about duplicate oids.  That was added in  
yesterday's commit 5602265f7, but on second thought we shouldn't be  
randomly redefining the script's behavior that way.  
  
John Naylor and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/duplicate_oids
M src/include/catalog/unused_oids

docs: remove "III" version text from pgAdmin link

commit   : 1900365c1e769edd40e67eac2cfa026ef5226a36    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 26 Apr 2018 11:10:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 26 Apr 2018 11:10:43 -0400    

Click here for diff

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

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

Correct pg_recvlogical server version test.

commit   : 6336b6dfc5c5f7ef746fb7b14c720ef0c2c6a1f1    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 25 Apr 2018 18:50:29 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 25 Apr 2018 18:50:29 -0700    

Click here for diff

The predecessor test boiled down to "PQserverVersion(NULL) >= 100000",  
which is always false.  No release includes that, so it could not have  
reintroduced CVE-2018-1058.  Back-patch to 9.4, like the addition of the  
predecessor in commit 8d2814f274def85f39fbe997d454b01628cb5667.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/streamutil.c

Convert unused_oids and duplicate_oids to use Catalog.pm infrastructure.

commit   : 5602265f770f400a03b4a4ca22b3cd530c294bc2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 16:01:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 16:01:47 -0400    

Click here for diff

unused_oids was previously a shell script, which of course didn't work at  
all on Windows.  Also, commit 372728b0d introduced some other portability  
problems, as complained of by Stas Kelvich.  We can improve matters by  
converting it to Perl.  
  
While we're at it, let's future-proof both this script and duplicate_oids  
to use Catalog.pm rather than having a bunch of ad-hoc logic for parsing  
catalog headers and .dat files.  These scripts are thereby a bit slower,  
which doesn't seem like a problem for typical manual use.  It is a little  
annoying for buildfarm purposes, but we should be able to fix that case  
by having genbki.pl make the check instead of parsing the headers twice.  
(That's not done in this commit, though.)  
  
Stas Kelvich, adjusted a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm
M src/include/catalog/duplicate_oids
M src/include/catalog/unused_oids

Make Catalog.pm's representation of toast and index decls more abstract.

commit   : 1eb3a09e93d28765fcf42c703c4c7322ad2686d7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 15:19:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 15:19:44 -0400    

Click here for diff

Instead of immediately constructing the string we need to emit into the  
.BKI file, preserve the items we extracted from the header file in a hash.  
This eases using the info for other purposes.  
  
John Naylor (with cosmetic adjustments by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/catalog/indexing.h

Prevent generation of bogus subquery scan paths.

commit   : dc1057fcd878d5c062c5c4c2b548af2be513b6ab    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 25 Apr 2018 15:14:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 25 Apr 2018 15:14:14 -0400    

Click here for diff

Commit 0927d2f46ddd4cf7d6bf2cc84b3be923e0aedc52 didn't check that  
consider_parallel was set for the target relation or account for  
the possibility that required_outer might be non-empty.  
  
To prevent future bugs of this ilk, add some assertions to  
add_partial_path and do a bit of future-proofing of the code  
recently added to recurse_set_operations.  
  
Report by Andreas Seltenreich.  Patch by Jeevan Chalke.  Review  
by Amit Kapila and by me.  
  
Discussion: http://postgr.es/m/CAM2+6=U+9otsyF2fYB8x_2TBeHTR90itarqW=qAEjN-kHaC7kw@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

commit   : f35f30f74b6abb0a2f47c91c20df606cf166e8ff    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 25 Apr 2018 22:05:53 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 25 Apr 2018 22:05:53 +0300    

Click here for diff

Also use palloc0() for main amcheck state, and adjust a few comments.  
  
Somehow I pushed old version of patch in commit  
4eaf7eaccb291f5d32d9f05284bfca9c5744de9a, so commit the difference.  
  
Peter Geoghegan  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c

Reindent Perl files with perltidy version 20170521.

commit   : f04d4ac919b9ae9b57e977523e4b40979aa8b951    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 14:00:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 14:00:19 -0400    

Click here for diff

Discussion: https://postgr.es/m/CABUevEzK3cNiHZQ18f5tK0guoT+cN_jWeVzhYYxY=r+1Q3SmoA@mail.gmail.com  

M doc/src/sgml/mk_feature_tables.pl
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/catalog/duplicate_oids
M src/include/catalog/reformat_dat_file.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/RecursiveCopy.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/tools/git_changelog
M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/gendef.pl
M src/tools/msvc/vcregress.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent

Change pgindent/README to specify that we use perltidy version 20170521.

commit   : 46cda5bf7bc209554b3c1bbb3040b45735387e0c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 13:58:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Apr 2018 13:58:39 -0400    

Click here for diff

Per discussion, this is now the project's standard version.  
Update the obsolete URL, and explain how to install a specific version.  
  
Discussion: https://postgr.es/m/CABUevEzK3cNiHZQ18f5tK0guoT+cN_jWeVzhYYxY=r+1Q3SmoA@mail.gmail.com  

M src/tools/pgindent/README

commit   : 4eaf7eaccb291f5d32d9f05284bfca9c5744de9a    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 25 Apr 2018 18:02:55 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 25 Apr 2018 18:02:55 +0300    

Click here for diff

When bt_index_parent_check() is called with the heapallindexed option,  
allocate a second Bloom filter to fingerprint block numbers that appear  
in the downlinks of internal pages.  Use Bloom filter probes when  
walking the B-Tree to detect missing downlinks.  This can detect subtle  
problems with page deletion/VACUUM, such as corruption caused by the bug  
just fixed in commit 6db4b499.  
  
The downlink Bloom filter is bound in size by work_mem.  Its optimal  
size is typically far smaller than that of the regular heapallindexed  
Bloom filter, especially when the index has high fan-out.  
  
Author: Peter Geoghegan  
Reviewer: Teodor Sigaev  
Discussion: https://postgr.es/m/CAH2-WznUzY4fWTjm1tBB3JpVz8cCfz7k_qVp5BhuPyhivmWJFg@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml

Fix typo

commit   : 7f58f666cdeee8016fd4ec7aa79629c983ecc3bd    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 25 Apr 2018 09:29:50 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 25 Apr 2018 09:29:50 +0200    

Click here for diff

Author: Michael Paquier  

M doc/src/sgml/jit.sgml

Update ExecInitPartitionInfo comment

commit   : bd4aad32395c1f2c3214657261b32b94475358c8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 24 Apr 2018 23:00:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 24 Apr 2018 23:00:48 -0300    

Click here for diff

Remove the words "if not already done."  This obsolete wording  
corresponds to an early development version of what became edd44738bc8.  
  
Author: Etsuro Fujita  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Initialize ExprStates once in run-time partition pruning

commit   : 1957f8dabf8daa29c78d05f971dd665c9680a754    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 24 Apr 2018 14:03:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 24 Apr 2018 14:03:10 -0300    

Click here for diff

Instead of doing ExecInitExpr every time a Param needs to be evaluated  
in run-time partition pruning, do it once during run-time pruning  
set-up and cache the exprstate in PartitionPruneContext, saving a lot of  
work.  
  
Author: David Rowley  
Reviewed-by: Amit Langote, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f8-x+q-90QAPDu_okhQBV4DPEtPz8CJ=m0940GyT4DA4w@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/partitioning/partprune.c
M src/include/partitioning/partprune.h

Add GUC enable_partition_pruning

commit   : 055fb8d33da6ff9003e3da4b9944bdcd2e2b2a49    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Apr 2018 17:57:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Apr 2018 17:57:43 -0300    

Click here for diff

This controls both plan-time and execution-time new-style partition  
pruning.  While finer-grain control is possible (maybe using an enum GUC  
instead of boolean), there doesn't seem to be much need for that.  
  
This new parameter controls partition pruning for all queries:  
trivially, SELECT queries that affect partitioned tables are naturally  
under its control since they are using the new technology.  However,  
while UPDATE/DELETE queries do not use the new code, we make the new GUC  
control their behavior also (stealing control from  
constraint_exclusion), because it is more natural, and it leads to a  
more natural transition to the future in which those queries will also  
use the new pruning code.  
  
Constraint exclusion still controls pruning for regular inheritance  
situations (those not involving partitioned tables).  
  
Author: David Rowley  
Review: Amit Langote, Ashutosh Bapat, Justin Pryzby, David G. Johnston  
Discussion: https://postgr.es/m/CAKJS1f_0HwsxJG9m+nzU+CizxSdGtfe6iF_ykPYBiYft302DCw@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/partition_prune.sql

Fix handling of partition bounds for boolean partitioning columns.

commit   : 4df58f7ed7f9ddc5a3196fcbad35690d1b3218de    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Apr 2018 15:29:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Apr 2018 15:29:11 -0400    

Click here for diff

Previously, you could partition by a boolean column as long as you  
spelled the bound values as string literals, for instance FOR VALUES  
IN ('t').  The trouble with this is that ruleutils.c printed that as  
FOR VALUES IN (TRUE), which is reasonable syntax but wasn't accepted by  
the grammar.  That results in dump-and-reload failures for such cases.  
  
Apply a minimal fix that just causes TRUE and FALSE to be converted to  
strings 'true' and 'false'.  This is pretty grotty, but it's too late for  
a more principled fix in v11 (to say nothing of v10).  We should revisit  
the whole issue of how partition bound values are parsed for v12.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Fix typo in logical truncate replication

commit   : df044026fcaf60b22291c31f4290a3b09ecf5833    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Apr 2018 13:38:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Apr 2018 13:38:22 -0400    

Click here for diff

This could result in some misbehavior in a cascading replication setup.  

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

Make Emacs settings match perltidy configuration

commit   : 56fb890ace8ac0ca955ae0803c580c2074f876f6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Apr 2018 11:44:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Apr 2018 11:44:31 -0400    

Click here for diff

Set Emacs's perl-continued-statement-offset to match perltidy's  
--continuation-indentation, which is 2 (not overridden in PostgreSQL's  
profile) rather than the 4 that Emacs uses by default.  

M .dir-locals.el
M src/tools/editors/emacs.samples

Add missing pstrdup

commit   : bc972072a3bb77e51a7937b05d25b41ba96aa011    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Apr 2018 11:50:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Apr 2018 11:50:21 -0300    

Click here for diff

Lifetime of the input string is not right, so create a separate copy.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Remove useless default clause in switch

commit   : dfce1f9e4eef3adcccbb23670fa1c432eebb0b90    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Apr 2018 11:46:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Apr 2018 11:46:30 -0300    

Click here for diff

The switch covers all values of the enum driver variable, so having a  
default: clause is useless, even if it's only to do Assert(false).  

M src/backend/partitioning/partprune.c

Make bms_prev_member work correctly with a 64 bit bitmapword

commit   : a5ab8928d7d9e2cf76ed0590efbd9795ea9e5b5e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 23 Apr 2018 17:59:17 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 23 Apr 2018 17:59:17 +0300    

Click here for diff

5c067521 erroneously had coded bms_prev_member assuming that a bitmapword  
would always hold 32 bits and started it's search on what it thought was the  
highest 8-bits of the word.  This was not the case if bitmapwords were 64  
bits.  
  
In passing add a test to exercise this function a little. Previously there was  
no coverage at all.  
  
David Rowly  

M src/backend/nodes/bitmapset.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Update trigram example in docs to correct state

commit   : 9975c128a1d1bd7e7366adf133b21540a2bc2450    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 23 Apr 2018 16:55:13 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 23 Apr 2018 16:55:13 +0300    

Click here for diff

Author: Liudmila Mantrova  

M doc/src/sgml/pgtrgm.sgml

Fix wrong validation of top-parent pointer during page deletion in Btree.

commit   : 6db4b49986be3fe59a1f6ba6fabf9852864efc3e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 23 Apr 2018 15:55:10 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 23 Apr 2018 15:55:10 +0300    

Click here for diff

After introducing usage of t_tid of inner or page high key for storing  
number of attributes of tuple, validation of tuple's ItemPointer with  
ItemPointerIsValid becomes incorrect, it's need to validate only blocknumber of  
ItemPointer. Missing this causes a incorrect page deletion, fix that. Test is  
added.  
  
BTW, current contrib/amcheck doesn't fail on index corrupted by this way.  
  
Also introduce BTreeTupleGetTopParent/BTreeTupleSetTopParent macroses to improve  
code readability and to avoid possible confusion with page high key: high key  
is used to store top-parent link for branch to remove.  
  
Bug found by Michael Paquier, but bug doesn't exist in previous versions because  
t_tid was set to P_HIKEY.  
  
Author: Teodor Sigaev  
Reviewer: Peter Geoghegan  
Discussion: https://www.postgresql.org/message-id/flat/20180419052436.GA16000%40paquier.xyz  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/create_index.sql

Make PGJIT_* macros safer.

commit   : 6a7b2ce2bdb9ab5fd23c98ace4bb2d811231706a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Apr 2018 04:48:08 -0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Apr 2018 04:48:08 -0400    

Click here for diff

Author: David Rowley  
Discussion: https://www.postgresql.org/message-id/CAKJS1f8Ge2y0sDs6RQEJFH-vjb-bWhs86rCX4Fp4FZ+TmxtRkw@mail.gmail.com  

M src/include/jit/jit.h

Add comment explaining BGWORKER_BYPASS_ALLOWCONN

commit   : 43cc4ee6340779f2a17fb5bab27355c2cb2e23a6    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 23 Apr 2018 10:31:22 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 23 Apr 2018 10:31:22 +0200    

Click here for diff

Suggested by Michael Paquier  

M src/include/postmaster/bgworker.h

Add missing documentation for BGWORKER_BYPASS_ALLOWCONN

commit   : 9cad926eb876a30d58a5b39789098da83a6ef91c    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 22 Apr 2018 14:03:36 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 22 Apr 2018 14:03:36 +0200    

Click here for diff

This was missed in eed1ce72e1593d3e8b7461d7744808d4d6bf402b.  
  
Reported by Michael Paquier  

M doc/src/sgml/bgworker.sgml

Add missing "static" marker.

commit   : a66c03f698f876646b9ef9d5d599e8a6d0ff2e88    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Apr 2018 11:21:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Apr 2018 11:21:08 -0400    

Click here for diff

Per pademelon.  

M src/backend/executor/execPartition.c

doc: Restructure authentication methods sections

commit   : 56811e57323faa453947eb82f007e323a952e1a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 20:33:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 20:33:53 -0400    

Click here for diff

Move the authentication methods sections up to sect1, so they are easier  
to navigate in HTML.  

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

Test conversion of NaN between float4 and float8.

commit   : 55e0e458170c76c1a0074cd550a13ec47e38a3fa    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 19:54:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 19:54:58 -0400    

Click here for diff

Results from buildfarm member opossum suggest that this doesn't work  
quite right on that platform.  We've seen issues with NaN support on  
MIPS/NetBSD before ... allegedly they fixed this stuff back in 2010,  
but maybe only for small values of "fixed".  
  
If, in fact, opossum fails this test then I plan to revert it;  
it's mainly for diagnostic purposes rather than something we'd  
necessarily keep long-term.  I think that the failures in window.sql  
could be worked around with some code duplication, but I want to  
verify my theory about the cause first.  

M src/test/regress/expected/float4-exp-three-digits.out
M src/test/regress/expected/float4.out
M src/test/regress/sql/float4.sql

Fix a couple minor typos

commit   : a0fefbcb718fedd8f0198f74c3ae27933c92b090    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 20 Apr 2018 19:04:54 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 20 Apr 2018 19:04:54 -0400    

Click here for diff

In commit f0e4475, GetIndexOpClass was renamed to ResolveOpClass, but  
the comment in typecmds.c didn't get the memo.  
  
In objectaddress.c, missing 'of' in a comment.  
  
Both noticed by Vik Fearing, patch is mine though.  

M src/backend/catalog/objectaddress.c
M src/backend/commands/typecmds.c

Don't run fast_default regression test in parallel with other tests.

commit   : 676858bcb4c4d9d2d5ee63a87dbff01085984ee0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 17:27:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 17:27:56 -0400    

Click here for diff

Since it sets up an event trigger that would fire on DDL done by any  
concurrent test script, the original scheduling is just an invitation  
to irreproducible test failures.  (The fact that we found a bug through  
exactly such irreproducible test failures doesn't really change the  
calculus here: this script is a hazard to anything that runs in parallel  
with it today or might be added to that parallel group in future.  No,  
I don't believe that the trigger is protecting itself sufficiently to  
avoid all possible trouble.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule

Fix race conditions when an event trigger is added concurrently with DDL.

commit   : b1b71f16581fb5385fa9f9a663ffee271cdfaba5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 17:15:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 17:15:31 -0400    

Click here for diff

EventTriggerTableRewrite crashed if there were table_rewrite triggers  
present, but there had not been when the calling command started.  
  
EventTriggerDDLCommandEnd called ddl_command_end triggers if present,  
even if there had been no such triggers when the calling command started,  
which would lead to a failure in pg_event_trigger_ddl_commands.  
  
In both cases, fix by doing nothing; it's better to wait till the next  
command when things will be properly initialized.  
  
In passing, remove an elog(DEBUG1) call that might have seemed interesting  
four years ago but surely isn't today.  
  
We found this because of intermittent failures in the buildfarm.  Thanks  
to Alvaro Herrera and Andrew Gierth for analysis.  
  
Back-patch to 9.5; some of this code exists before that, but the specific  
hazards we need to guard against don't.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/event_trigger.c

Tweak a couple of planner APIs to save recalculating join relids.

commit   : ec38dcd363cd63f2a1f3cc4c47680bb16e8331b4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 16:00:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 16:00:47 -0400    

Click here for diff

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

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/include/optimizer/cost.h
M src/include/optimizer/planmain.h

Change more places to be less trusting of RestrictInfo.is_pushed_down.

commit   : c792c7db41466ff02107e3233ec9d92d8e3df866    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 15:19:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Apr 2018 15:19:16 -0400    

Click here for diff

On further reflection, commit e5d83995e didn't go far enough: pretty much  
everywhere in the planner that examines a clause's is_pushed_down flag  
ought to be changed to use the more complicated behavior where we also  
check the clause's required_relids.  Otherwise we could make incorrect  
decisions about whether, say, a clause is safe to use as a hash clause.  
  
Some (many?) of these places are safe as-is, either because they are  
never reached while considering a parameterized path, or because there  
are additional checks that would reject a pushed-down clause anyway.  
However, it seems smarter to just code them all the same way rather  
than rely on easily-broken reasoning of that sort.  
  
In support of that, invent a new macro RINFO_IS_PUSHED_DOWN that should  
be used in place of direct tests on the is_pushed_down flag.  
  
Like the previous patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/nodes/relation.h
M src/include/optimizer/paths.h

Improve consistency of comments in system catalog headers.

commit   : 68c23cba341a0083afa8e30f0c43bf18cbd01bb7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Apr 2018 17:14:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Apr 2018 17:14:09 -0400    

Click here for diff

Use the term "system catalog" rather than "system relation" in assorted  
places where it's clearly referring to a table rather than, say, an  
index.  Use more natural word order in the header boilerplate, improve  
some of the one-liner catalog descriptions, and fix assorted random  
deviations from the normal boilerplate.  All purely neatnik-ism, but  
why not.  
  
John Naylor, some additional cleanup by me  
  
Discussion: https://postgr.es/m/CAJVSVGUeJmFB3h-NJ18P32NPa+kzC165nm7GSoGHfPaN80Wxcw@mail.gmail.com  

M src/backend/catalog/genbki.pl
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.dat
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h

Fix incorrect handling of join clauses pushed into parameterized paths.

commit   : e5d83995e9f88426b325a7ea8ce0770926dc64de    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Apr 2018 15:49:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Apr 2018 15:49:12 -0400    

Click here for diff

In some cases a clause attached to an outer join can be pushed down into  
the outer join's RHS even though the clause is not degenerate --- this  
can happen if we choose to make a parameterized path for the RHS.  If  
the clause ends up attached to a lower outer join, we'd misclassify it  
as being a "join filter" not a plain "filter" condition at that node,  
leading to wrong query results.  
  
To fix, teach extract_actual_join_clauses to examine each join clause's  
required_relids, not just its is_pushed_down flag.  (The latter now  
seems vestigial, or at least in need of rethinking, but we won't do  
anything so invasive as redefining it in a bug-fix patch.)  
  
This has been wrong since we introduced parameterized paths in 9.2,  
though it's evidently hard to hit given the lack of previous reports.  
The test case used here involves a lateral function call, and I think  
that a lateral reference may be required to get the planner to select  
a broken plan; though I wouldn't swear to that.  In any case, even if  
LATERAL is needed to trigger the bug, it still affects all supported  
branches, so back-patch to all.  
  
Per report from Andreas Karlsson.  Thanks to Andrew Gierth for  
preliminary investigation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/optimizer/restrictinfo.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove quick path in ExecInitPartitionInfo for equal tupdescs

commit   : 79b2e52615faa768d8436c1795e445541460e9d2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 16:46:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 16:46:53 -0300    

Click here for diff

I added this "optimization" on top of Amit Langote's 158b7bc6d779, but  
the quick path is never taken because the partition uses a different  
pg_type oid than its parent table (causing equalTupleDescs to return  
false).  Changing that requires more analysis and is too considered  
dangerous at this point in the cycle, so revert it.  
  
We might make it work someday, but not for pg11.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Plural of modulus is moduli

commit   : 2d625176c013ed185250aab3f8a1d175d81d4f3b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 12:37:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 12:37:23 -0300    

Click here for diff

M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c

Rework code to determine partition pruning procedure

commit   : e5dcbb88a15d445e0ccb3db3194f4a122b792df6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 11:22:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 11:22:31 -0300    

Click here for diff

Amit Langote reported that partition prune was unable to work with  
arrays, enums, etc, which led him to research the appropriate way to  
match query clauses to partition keys: instead of searching for an exact  
match of the expression's type, it is better to rely on the fact that  
the expression qual has already been resolved to a specific operator,  
and that the partition key is linked to a specific operator family.  
With that info, it's possible to figure out the strategy and comparison  
function to use for the pruning clause in a manner that works reliably  
for pseudo-types also.  
  
Include new test cases that demonstrate pruning where pseudotypes are  
involved.  
  
Author: Amit Langote, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Enlarge find_other_exec's meager fgets buffer

commit   : cea5f9aa1244a6a803481f7e21a86e7e7037a9a5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 10:45:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Apr 2018 10:45:15 -0300    

Click here for diff

The buffer was 100 bytes long, which is barely sufficient when the  
version string gets longer (such as by configure --with-extra-version).  
Set it to MAXPGPATH.  
  
Author: Nikhil Sontakke  
Discussion: https://postgr.es/m/CAMGcDxfLfpYU_Jru++L6ARPCOyxr0W+2O3Q54TDi5XdYeU36ow@mail.gmail.com  

M src/common/exec.c

Fix datatype for number of heap tuples during last cleanup

commit   : ff4943042f9761fb4e84432da563f43eb3559a3b    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 11:28:03 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 11:28:03 +0300    

Click here for diff

It appears that new fields introduced in 857f9c36 have inconsistent datatypes:  
BTMetaPageData.btm_last_cleanup_num_heap_tuples is of float4 type,  
while xl_btree_metadata.last_cleanup_num_heap_tuples is of double type.  
IndexVacuumInfo.num_heap_tuples, which is a source of values for  
both former fields is of double type.  So, make both those fields in  
BTMetaPageData and xl_btree_metadata use float8 type in order to match the  
precision of the source.  That shouldn't be double type, because we always  
use types with explicit width in WAL.  
  
Patch introduces incompatibility of on-disk format since 857f9c36 commit, but  
that versions never was released, so just bump catalog version to avoid  
possible confusion.  
  
Author: Alexander Korortkov  

M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/catalog/catversion.h

Adjust _bt_insertonpg() comments

commit   : f97f0c921ae56bb16e466f3c9d6c504f4a96a539    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 11:08:45 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 11:08:45 +0300    

Click here for diff

Remove an obsolete reference to the 'afteritem' argument, which was  
removed by commit bc292937.  Add a comment that clarifies how  
_bt_insertonpg() indirectly handles the insertion of high key items.  
  
Author: Peter Geoghegan  

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

Handle XLOG_BTREE_META_CLEANUP in btree_desc() and btree_identify()

commit   : 3d927961ae1232487796bebb254d92fb6d0d1e03    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 09:27:56 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 09:27:56 +0300    

Click here for diff

New WAL record XLOG_BTREE_META_CLEANUP introduced in 857f9c36 has no handling  
in btree_desc() and btree_identify().  This patch implements corresponding  
handling.  
  
Alexander Korotkov  

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

Adjust INCLUDE index truncation comments and code.

commit   : 075aade4361b9f973172b925ddfb908a012b5796    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 08:45:58 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 19 Apr 2018 08:45:58 +0300    

Click here for diff

Add several assertions that ensure that we're dealing with a pivot tuple  
without non-key attributes where that's expected.  Also, remove the  
assertion within _bt_isequal(), restoring the v10 function signature.  A  
similar check will be performed for the page highkey within  
_bt_moveright() in most cases.  Also avoid dropping all objects within  
regression tests, to increase pg_dump test coverage for INCLUDE indexes.  
  
Rather than using infrastructure that's generally intended to be used  
with reference counted heap tuple descriptors during truncation, use the  
same function that was introduced to store flat TupleDescs in shared  
memory (we use a temp palloc'd buffer).  This isn't strictly necessary,  
but seems more future-proof than the old approach.  It also lets us  
avoid including rel.h within indextuple.c, which was arguably a  
modularity violation.  Also, we now call index_deform_tuple() with the  
truncated TupleDesc, not the source TupleDesc, since that's more robust,  
and saves a few cycles.  
  
In passing, fix a memory leak by pfree'ing truncated pivot tuple memory  
during CREATE INDEX.  Also pfree during a page split, just to be  
consistent.  
  
Refactor _bt_check_natts() to be more readable.  
  
Author: Peter Geoghegan with some editorization by me  
Reviewed by: Alexander Korotkov, Teodor Sigaev  
Discussion: https://www.postgresql.org/message-id/CAH2-Wz%3DkCWuXeMrBCopC-tFs3FbiVxQNjjgNKdG2sHxZ5k2y3w%40mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/common/indextuple.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/itup.h
M src/include/access/nbtree.h
M src/test/regress/expected/index_including.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/index_including.sql

Improve error detection/reporting in Catalog.pm and genbki.pl.

commit   : 5372c2c84135be99e8df921ff228df6e7b4d3c8d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Apr 2018 18:17:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Apr 2018 18:17:02 -0400    

Click here for diff

Clean up error messages relating to mistakes in .dat files: make sure they  
provide the .dat file name and line number, not the place in the Perl  
script that's reporting the problem.  Adopt more uniform message phrasing,  
too.  
  
Make genbki.pl spit up on unrecognized field names in the input hashes.  
Previously, it just silently ignored such fields, which could make a  
misspelled field name into a very hard-to-decipher problem.  (This is in  
genbki.pl, *not* Catalog.pm, because we don't want reformat_dat_file.pl to  
complain about unrecognized fields.  We'd rather it silently dropped them,  
to facilitate removing unwanted fields after a reorganization.)  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl

Better fix for deadlock hazard in CREATE INDEX CONCURRENTLY.

commit   : 1dec82068b3b59b621e6b04040c150241f5060f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Apr 2018 12:07:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Apr 2018 12:07:37 -0400    

Click here for diff

Commit 54eff5311 did not account for the possibility that we'd have  
a transaction snapshot due to default_transaction_isolation being  
set high enough to require one.  The transaction snapshot is enough  
to hold back our advertised xmin and thus risk deadlock anyway.  
The only way to get rid of that snap is to start a new transaction,  
so let's do that instead.  Also throw in an assert checking that we  
really have gotten to a state where no xmin is being advertised.  
  
Back-patch to 9.4, like the previous commit.  
  
Discussion: https://postgr.es/m/CAMkU=1ztk3TpQdcUNbxq93pc80FrXUjpDWLGMeVBDx71GHNwZQ@mail.gmail.com  

M src/backend/commands/indexcmds.c

Improve docs for the new INCLUDE directive in CREATE/ALTER TABLE.

commit   : fe7fc52645678ecb661fde47fe5937b48093f79e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 18 Apr 2018 05:44:29 -0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 18 Apr 2018 05:44:29 -0400    

Click here for diff

Author: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/20180411082020.GD19732%40paquier.xyz  

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

Rationalize handling of single and double quotes in bootstrap data.

commit   : 55d26ff638f063fbccf57843f2c27f9795895a5c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Apr 2018 19:53:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Apr 2018 19:53:50 -0400    

Click here for diff

Change things around so that proper quoting of values interpolated into  
the BKI data by initdb is the responsibility of initdb, not something  
we half-heartedly handle by putting double quotes into the raw BKI data.  
(Note: experimentation shows that it still doesn't work to put a double  
quote into the initial superuser username, but that's the fault of  
inadequate quoting while interpolating the name into SQL scripts;  
the BKI aspect of it works fine now.)  
  
Having done that, we can remove the special-case handling of values  
that look like "something" from genbki.pl, and instead teach it to  
escape double --- and single --- quotes properly.  This removes the  
nowhere-documented need to treat those specially in the BKI source  
data; whatever you write will be passed through unchanged into the  
inserted data value, modulo Perl's rules about single-quoted strings.  
  
Add documentation explaining the (pre-existing) handling of backslashes  
in the BKI data.  
  
Per an earlier discussion with John Naylor.  
  
Discussion: https://postgr.es/m/CAJVSVGUNao=-Q2-vAN3PYcdF5tnL5JAHwGwzZGuYHtq+Mk_9ng@mail.gmail.com  

M doc/src/sgml/bki.sgml
M src/backend/catalog/genbki.pl
M src/bin/initdb/initdb.c
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_proc.dat

Rationalize handling of array type names in bootstrap data.

commit   : 9ffcccdb958d38db5051bf64143330ff445a26cc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Apr 2018 18:29:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Apr 2018 18:29:11 -0400    

Click here for diff

Formerly, Catalog.pm turned a C array type declaration in the catalog  
header files into a SQL type, e.g., 'foo[]'.  Along the way, genbki.pl  
turned this into '_foo' for the purpose of type lookups, but wrote 'foo[]'  
to postgres.bki.  During bootstrap, bootscanner.l had to have a special  
case rule to tokenize this, and then MapArrayTypeName() would turn 'foo[]'  
into '_foo' one more time.  
  
This seems unnecessarily complicated, especially since nobody cares that  
much about the readability of postgres.bki.  Instead, make Catalog.pm  
convert the C declaration into '_foo' to start with, and preserve that  
representation of the type name throughout bootstrap data processing.  
Then rip out the special-case code in bootscanner.l and bootstrap.c.  
  
This changes postgres.bki to the extent that array fields are now  
declared like  
  proconfig = _text ,  
rather than  
  proconfig = text[] ,  
  
No documentation update, since the SGML docs didn't mention any of this  
in the first place, and it's all pretty transparent to writers of  
catalog header files anyway.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGUNao=-Q2-vAN3PYcdF5tnL5JAHwGwzZGuYHtq+Mk_9ng@mail.gmail.com  

M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/bootstrap/bootstrap.h

Simplify genbki.pl's data quoting rules.

commit   : e90d4ddc639aac7a7217ebc670ad6e49eaeddbf9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Apr 2018 18:10:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Apr 2018 18:10:16 -0400    

Click here for diff

During the bootstrap data format conversion, it seemed important for  
verifiability's sake that the generated postgres.bki file stayed the same  
as before.  That resulted in adding a bunch of ad-hoc rules about when to  
quote emitted data values, to match previous manual decisions that had  
often quoted values unnecessarily.  Now that the conversion is complete,  
it seems fine to remove all those ad-hoc rules.  The net actual effect on  
the current contents of postgres.bki is that some fields that had been  
quoted despite containing only digits or only "-" lose their unnecessary  
quotes.  
  
Also, now that genbki.pl will always quote values containing a backslash,  
there's no need for bootscanner.l to allow unquoted octal escapes;  
so simplify its production for "id" by removing that possibility.  
  
John Naylor, slightly modified by me  
  
Discussion: https://postgr.es/m/CAJVSVGUNao=-Q2-vAN3PYcdF5tnL5JAHwGwzZGuYHtq+Mk_9ng@mail.gmail.com  

M src/backend/bootstrap/bootscanner.l
M src/backend/catalog/genbki.pl

Fix confusion on the padding of GIDs in on commit and abort records.

commit   : cf5a1890592bfa2f45d306789533efba97496233    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Apr 2018 16:10:42 -0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Apr 2018 16:10:42 -0400    

Click here for diff

Review of commit 1eb6d652: It's pointless to add padding to the GID fields,  
when the code that follows assumes that there is no alignment, and uses  
memcpy(). Remove the pointless padding.  
  
Update comments to note the new fields in the WAL records.  
  
Reviewed-by: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/33b787bf-dc20-1161-54e9-3f3b607bf59d%40iki.fi  

M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/include/access/xact.h
M src/include/access/xlog_internal.h

Update Append's idea of first_partial_plan

commit   : b7e2cbc5b49fbab5bc286b9e4cd4062a6703e7a7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Apr 2018 16:19:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Apr 2018 16:19:48 -0300    

Click here for diff

It turns out that after runtime partition pruning, Append's  
first_partial_plan does not accurately represent partial plans to run,  
if any of those got pruned.  This could limit participation of workers  
in some partial subplans, if other subplans got pruned.  Fix it by  
keeping an index of the first valid partial subplan in the state node,  
determined at execnode Init time.  
  
Author: David Rowley, with cosmetic changes by me.  
Discussion: https://postgr.es/m/CAKJS1f8o2Yd=rOP=Et3A0FWgF+gSAOkFSU6eNhnGzTPV7nN8sQ@mail.gmail.com  

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

Fix a few typos in comments and variable names.

commit   : 55101549d538c9ed86e761dba0775025726d7310    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Apr 2018 11:54:57 -0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Apr 2018 11:54:57 -0400    

Click here for diff

Author: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/20180411075223.GB19732%40paquier.xyz  

M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtutils.c
M src/bin/pg_dump/pg_dump.c

Improve coverage of nodeAppend runtime partition prune

commit   : 95cdc77b35ece28137b8dec8c6f9b5474b215624    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Apr 2018 12:16:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Apr 2018 12:16:22 -0300    

Click here for diff

coverage report indicated that mark_invalid_subplans_as_finished() and  
nearby code was not getting exercised by any tests.  Add a new one which  
has execution-time Params rather than only external Params to fix this.  
  
In passing, David noticed that ab_q6 tests were not actually required to  
have a generic plan. The tests were testing exec Params not external  
Params, so there was no need for the PREPARE.  Remove the PREPARE,  
making these plain queries.  (The new queries are called from  
explain_parallel_append, which may be unnecessary since they don't  
actually have a Parallel Append node, just an Append.  But it doesn't  
seem to hurt anything, either.)  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f--hopb6JBSDY4wiXTS3ZcDp-wparXjTQ1nzNdBa04Fog@mail.gmail.com  

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

Add more infinite recursion detection while locking a view.

commit   : 03030512d1e4df78dc2543d3fe3b6d13e5cb63f6    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 17 Apr 2018 16:59:17 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 17 Apr 2018 16:59:17 +0900    

Click here for diff

Also add regression test cases for detecting infinite recursion in  
locking view tests.  Some document enhancements. Patch by Yugo Nagata.  

M doc/src/sgml/ref/lock.sgml
M src/backend/commands/lockcmds.c
M src/test/regress/expected/lock.out
M src/test/regress/sql/lock.sql

Restore partition_prune's usage of parallel workers

commit   : 47c91b55991883322fdbc4495ce7fe6b2166e8fe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Apr 2018 18:12:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Apr 2018 18:12:22 -0300    

Click here for diff

This reverts commit 4d0f6d3f207d ("Attempt to stabilize partition_prune  
test output (2)"), and attempts to stabilize the test by using string  
replacement to hide any loop count difference in parallel nodes.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix broken collation-aware searches in SP-GiST text opclass.

commit   : b15e8f71dbf00eb18d9076302f39aa981355eb07    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Apr 2018 16:06:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Apr 2018 16:06:47 -0400    

Click here for diff

spg_text_leaf_consistent() supposed that it should compare only  
Min(querylen, entrylen) bytes of the two strings, and then deal with  
any excess bytes in one string or the other by assuming the longer  
string is greater if the prefixes are equal.  Quite aside from the  
fact that that's just wrong in some locales (e.g., 'ch' is not less  
than 'd' in cs_CZ), it also risked passing incomplete multibyte  
characters to strcoll(), with ensuing bad results.  
  
Instead, just pass the full strings to varstr_cmp, and let it decide  
what to do about unequal-length strings.  
  
Fortunately, this error doesn't imply any index corruption, it's just  
that searches might return the wrong set of entries.  
  
Per report from Emre Hasegeli, though this is not his patch.  
Thanks to Peter Geoghegan for review and discussion.  
  
This code was born broken, so back-patch to all supported branches.  
In HEAD, I failed to resist the temptation to do a bit of cosmetic  
cleanup/pgindent'ing on 710d90da1, too.  
  
Discussion: https://postgr.es/m/CAE2gYzzb6K51VnTq5i5p52z+j9p2duEa-K1T3RrC_GQEynAKEg@mail.gmail.com  

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

Update expected output of new test

commit   : 22ff2b8583b2580d8b423939a658fcd1d38741b4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Apr 2018 16:39:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Apr 2018 16:39:32 -0300    

Click here for diff

Forgot to 'git add' the file after tweaking the test as submitted :-(  
  
Per buildfarm  

M src/test/regress/expected/insert_conflict.out

Ignore whole-rows in INSERT/CONFLICT with partitioned tables

commit   : 158b7bc6d77948d2f474dc9f2777c87f81d1365a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Apr 2018 15:50:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Apr 2018 15:50:57 -0300    

Click here for diff

We had an Assert() preventing whole-row expressions from being used in  
the SET clause of INSERT ON CONFLICT, but it seems unnecessary, given  
some tests, so remove it.  Add a new test to exercise the case.  
  
Still at ExecInitPartitionInfo, we used map_partition_varattnos (which  
constructs an attribute map, then calls map_variable_attnos) using  
the same two relations many times in different expressions and with  
different parameters.  Constructing the map over and over is a waste.  
To avoid this repeated work, construct the map once, and use  
map_variable_attnos() directly instead.  
  
Author: Amit Langote, per comments by me (Ɓlvaro)  
Discussion: https://postgr.es/m/[email protected]  

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

Fix potentially-unportable code in contrib/adminpack.

commit   : 3a2d6365984d2cd98ee03467cd901785941cf772    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Apr 2018 13:02:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Apr 2018 13:02:11 -0400    

Click here for diff

Spelling access(2)'s second argument as "2" is just horrid.  
POSIX makes no promises as to the numeric values of W_OK and related  
macros.  Even if it accidentally works as intended on every supported  
platform, it's still unreadable and inconsistent with adjacent code.  
  
In passing, don't spell "NULL" as "0" either.  Yes, that's legal C;  
no, it's not project style.  
  
Back-patch, just in case the unportability is real and not theoretical.  
(Most likely, even if a platform had different bit assignments for  
access()'s modes, there'd not be an observable behavior difference  
here; but I'm being paranoid today.)  

M contrib/adminpack/adminpack.c

Clean up callers of JsonbIteratorNext().

commit   : f8a187bdbae6e9d3b7407c0c37e3494518496200    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Apr 2018 12:40:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Apr 2018 12:40:01 -0400    

Click here for diff

Coverity complained about the lack of a check on the return value in  
parse_jsonb_index_flags' last call of JsonbIteratorNext.  Seems like  
a reasonable gripe to me, especially since the code is depending on  
that being WJB_DONE to not leak memory, so add a check.  
  
In passing, improve a couple other places where the result was being  
ignored, either by adding an assert or at least a cast to void.  
  
Also, don't spell "WJB_DONE" as "0".  That's horrid coding style,  
and it wasn't consistent either.  

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

Don't attempt to verify checksums on new pages

commit   : 33cedf1474a356fe510d4ad32c040c968ef27307    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 14:05:56 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 14:05:56 +0200    

Click here for diff

Teach both base backups and pg_verify_checksums that if a page is new,  
it does not have a checksum yet, so it shouldn't be verified.  
  
Noted by Tomas Vondra, review by David Steele.  

M src/backend/replication/basebackup.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c

Fix build of pg_verify_checksum docs

commit   : 90372729f4671ad5ad743b53a53e7ccbab92c4f8    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 13:57:02 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 13:57:02 +0200    

Click here for diff

They were accidentally excluded when reverting the backend online  
checksum functionality, and since they weren't built the incorrect  
reference to a removed section also did not trigger a problem.  
  
Author: Christoph Berg  

M doc/src/sgml/ref/pg_verify_checksums.sgml
M doc/src/sgml/reference.sgml

Clarify pg_verify_checksum documentation

commit   : 645387927f83d31b8f1272876c1f8db3bc3b4f45    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 13:51:35 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 13:51:35 +0200    

Click here for diff

Make it clear that a cluster has to be shut down cleanly before  
pg_verify_checksum can be run against it.  
  
Author: Michael Paquier  
Review: Daniel Gustafsson  

M doc/src/sgml/ref/pg_verify_checksums.sgml

Remove -f option from pg_verify_checksums

commit   : 44e2df461fa57d99e3547eab49e48d5150540aab    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 13:49:47 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 15 Apr 2018 13:49:47 +0200    

Click here for diff

This option makes no sense when the cluster checksum state cannot be  
changed, and should have been removed in the revert.  
  
Author: Daniel Gustafsson  
Review: Michael Paquier  

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

Simplify view-expansion code in rewriteHandler.c.

commit   : 49ac4039b28ec04ec0329b13bbb1baa6e94c86b7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 21:00:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 21:00:54 -0400    

Click here for diff

In the wake of commit 50c6bb022, it's not necessary for ApplyRetrieveRule  
to have a forUpdatePushedDown parameter.  By the time control gets here for  
any given view-referencing RTE, we should already have pushed down the  
effects of any FOR UPDATE/SHARE clauses affecting the view from outer query  
levels.  Hence if we don't find a RowMarkClause at the current query level,  
that's sufficient proof that there is no outer one either.  This in turn  
means we need no forUpdatePushedDown parameter for fireRIRrules.  
  
I wonder whether we oughtn't also revert commit cba2d2717, since it now  
seems likely that that was band-aiding around the bad effects of doing  
FOR UPDATE pushdown and view expansion in the wrong order.  However,  
in the absence of evidence that the current coding of markQueryForLocking  
is actually buggy (i.e. missing RTEs it ought to mark), it seems best to  
leave it alone.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteHandler.c

List src/include/partitioning in src/include/Makefile

commit   : 4d64abc2feed10b8a8dd03181dfa3b0f9aa00c33    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 14 Apr 2018 21:33:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 14 Apr 2018 21:33:32 -0300    

Click here for diff

This omission prevented partitioning header files from being installed.  
  
Per buildfarm member crake.  

M src/include/Makefile

Reorganize partitioning code

commit   : da6f3e45ddb68ab3161076e120e7c32cfd46d1db    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 14 Apr 2018 21:12:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 14 Apr 2018 21:12:14 -0300    

Click here for diff

There's been a massive addition of partitioning code in PostgreSQL 11,  
with little oversight on its placement, resulting in a  
catalog/partition.c with poorly defined boundaries and responsibilities.  
This commit tries to set a couple of distinct modules to separate things  
a little bit.  There are no code changes here, only code movement.  
  
There are three new files:  
  src/backend/utils/cache/partcache.c  
  src/include/partitioning/partdefs.h  
  src/include/utils/partcache.h  
  
The previous arrangement of #including catalog/partition.h almost  
everywhere is no more.  
  
Authors: Amit Langote and Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
	https://postgr.es/m/[email protected]  
	https://postgr.es/m/[email protected]  
	https://postgr.es/m/[email protected]  

M contrib/pageinspect/hashfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/Makefile
A src/backend/partitioning/partbounds.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/Makefile
A src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/pg_controldata.c
M src/include/catalog/partition.h
M src/include/commands/tablecmds.h
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/include/nodes/parsenodes.h
M src/include/partitioning/partbounds.h
A src/include/partitioning/partdefs.h
M src/include/partitioning/partprune.h
A src/include/utils/partcache.h
M src/include/utils/rel.h

Improve regression test coverage of expand_tuple().

commit   : b39fd897e0398a6bdc6552daa7cacdf9c0e46d7e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 19:02:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 19:02:30 -0400    

Click here for diff

I was dissatisfied with the code coverage report for expand_tuple() in the  
wake of commit 7c44c46de: while better than no coverage at all, it was  
still not exercising the core function of inserting out-of-line default  
values, nor was the HeapTuple-output path covered.  So far as I can find,  
the only code path that reaches the latter at present is EvalPlanQual  
fetches for non-locked tables.  Hence, extend eval-plan-qual.spec to  
test cases where out-of-line defaults must be inserted into a tuple  
fetched from a non-locked table.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Fix enforcement of SELECT FOR UPDATE permissions with nested views.

commit   : 50c6bb022475bd9ad9c73e3b68b5152db5163b22    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 15:38:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 15:38:09 -0400    

Click here for diff

SELECT FOR UPDATE on a view should require UPDATE (as well as SELECT)  
permissions on the view, and then the view's owner needs those same  
permissions against the relations it references, and so on all the way  
down to base tables.  But ApplyRetrieveRule did things in the wrong order,  
resulting in failure to mark intermediate view levels as needing UPDATE  
permission.  Thus for example, if user A creates a table T and an updatable  
view V1 on T, then grants only SELECT permissions on V1 to user B, B could  
create a second view V2 on V1 and then would be allowed to perform SELECT  
FOR UPDATE via V2 (since V1 wouldn't be checked for UPDATE permissions).  
  
To fix, just switch the order of expanding sub-views and marking referenced  
objects as needing UPDATE permission.  I think additional simplifications  
are now possible, but that's distinct from the bug fix proper.  
  
This is certainly a security issue, but the consequences are pretty minor  
(just the ability to lock rows that shouldn't be lockable).  Against that  
we have a small risk of breaking applications that are working as-desired,  
since nested views have behaved this way since such cases worked at all.  
On balance I'm inclined not to back-patch.  
  
Per report from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Add commentary explaining why MaxIndexTuplesPerPage calculation is safe.

commit   : 2a67d6440db4360efff2078a05bc172ca8f34b2b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 12:33:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Apr 2018 12:33:15 -0400    

Click here for diff

MaxIndexTuplesPerPage ignores the fact that btree indexes sometimes  
store tuples with no data payload.  But it also ignores the possibility  
of "special space" on index pages, which offsets that, so that the  
result isn't an underestimate.  This all seems worth documenting, though.  
  
In passing, remove #define MinIndexTupleSize, which was added by  
commit 2c03216d8 but not used in that commit nor later ones.  
  
Comment text by me; issue noticed by Peter Geoghegan.  
  
Discussion: https://postgr.es/m/CAH2-WzkQmb54Kbx-YHXstRKXcNc+_87jwV3DRb54xcybLR7Oig@mail.gmail.com  

M src/include/access/itup.h

Improve code comments

commit   : e013288a6509549866c5d531257480f159c6900d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 14 Apr 2018 10:04:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 14 Apr 2018 10:04:36 -0400    

Click here for diff

As of 0c2c81b403db420bfce36f168887db72932dbf09, the replication  
parameter in libpq is no longer "deliberately undocumented".  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Support named and default arguments in CALL

commit   : a8677e3ff6bb8ef78a9ba676faa647bba237b1c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Apr 2018 17:06:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Apr 2018 17:06:28 -0400    

Click here for diff

We need to call expand_function_arguments() to expand named and default  
arguments.  
  
In PL/pgSQL, we also need to deal with named and default INOUT arguments  
when receiving the output values into variables.  
  
Author: Pavel Stehule <[email protected]>  

M src/backend/commands/functioncmds.c
M src/backend/optimizer/util/clauses.c
M src/include/optimizer/clauses.h
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Prevent segfault in expand_tuple with no missing values

commit   : 7c44c46deb495a2f3861f402d7f2109263e3d50a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 13 Apr 2018 16:43:33 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 13 Apr 2018 16:43:33 -0400    

Click here for diff

Commit 16828d5c forgot to check that it had a set of missing values  
before trying to retrieve a value from it.  
  
An additional query to add coverage for this code is added to the  
regression test.  
  
Per bug report from Andreas Seltenreich.  

M src/backend/access/common/heaptuple.c
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Improve regression test coverage for src/backend/tsearch/spell.c.

commit   : 8bf358c18ec930ddfb998873369e2fc38608d3e1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Apr 2018 13:49:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Apr 2018 13:49:52 -0400    

Click here for diff

In passing, throw an error if the AF count is too small, rather than  
just silently discarding extra affix entries.  
  
Note that the new regression test cases require installing the  
updated src/backend/tsearch/dicts files.  
  
Arthur Zakirov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/dicts/hunspell_sample_long.affix
M src/backend/tsearch/dicts/hunspell_sample_long.dict
M src/backend/tsearch/dicts/hunspell_sample_num.affix
M src/backend/tsearch/dicts/hunspell_sample_num.dict
M src/backend/tsearch/spell.c
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql

In libpq, free any partial query result before collecting a server error.

commit   : d25c2ee9c038969eca8080177738dddf97a2cade    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Apr 2018 12:53:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Apr 2018 12:53:45 -0400    

Click here for diff

We'd throw away the partial result anyway after parsing the error message.  
Throwing it away beforehand costs nothing and reduces the risk of  
out-of-memory failure.  Also, at least in systems that behave like  
glibc/Linux, if the partial result was very large then the error PGresult  
would get allocated at high heap addresses, preventing the heap storage  
used by the partial result from being released to the OS until the error  
PGresult is freed.  
  
In psql >= 9.6, we hold onto the error PGresult until another error is  
received (for \errverbose), so that this behavior causes a seeming  
memory leak to persist for awhile, as in a recent complaint from  
Darafei Praliaskouski.  This is a potential performance regression from  
older versions, justifying back-patching at least that far.  But similar  
behavior may occur in other client applications, so it seems worth just  
back-patching to all supported branches.  
  
Discussion: https://postgr.es/m/CAC8Q8tJ=7cOkPePyAbJE_Pf691t8nDFhJp0KZxHvnq_uicfyVg@mail.gmail.com  

M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c

Use custom hash opclass for hash partition pruning

commit   : fafec4cce814b9b15991b62520dc5e5e84655a8a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Apr 2018 12:27:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Apr 2018 12:27:22 -0300    

Click here for diff

This custom opclass was already in use in other tests -- defined  
independently in every such file.  Move the definition to the earliest  
test that uses it, and keep it around so that later tests can reuse it.  
Use it in the tests for pruning of hash partitioning, and since this  
makes the second expected file unnecessary, put those tests back in  
partition_prune.sql whence they sprang.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA%2BTgmoZ0D5kJbt8eKXtvVdvTcGGWn6ehWCRSZbWytD-uzH92mQ%40mail.gmail.com  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/hash_part.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/partition_prune.out
D src/test/regress/expected/partition_prune_hash.out
D src/test/regress/expected/partition_prune_hash_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/hash_part.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/partition_prune.sql
D src/test/regress/sql/partition_prune_hash.sql

Attempt to stabilize partition_prune test output (2)

commit   : 4d0f6d3f207d977d3685499263993206b56d425a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Apr 2018 10:46:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Apr 2018 10:46:49 -0300    

Click here for diff

Environmental conditions might cause parallel workers to be scheduled in  
different ways in this test, destabilizing the EXPLAIN output.  Disable  
use of workers in an attempt to make output stable.  
  
Author: David Rowley  
Diagnosed-by: Thomas Munro  
Discussion: https://postgr.es/m/CAKJS1f8j24tUX_nOwACiM=UO5jrMrDz8ca0xbG0vhVgfWph0ZA@mail.gmail.com  

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

Fix bogus affix-merging code.

commit   : 65a69dfa08e212556d11e44a5a8a1861fd826ccd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Apr 2018 18:39:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Apr 2018 18:39:51 -0400    

Click here for diff

NISortAffixes() compared successive compound affixes incorrectly,  
thus possibly failing to merge identical affixes, or (less likely)  
merging ones that shouldn't be merged.  The user-visible effects  
of this are unclear, to me anyway.  
  
Per bug #15150 from Alexander Lakhin.  It's been broken for a long time,  
so back-patch to all supported branches.  
  
Arthur Zakirov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/spell.c

Revert lowering of lock level for ATTACH PARTITION

commit   : b8ca984b2c739e096c08f260f477792495f4dfe4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Apr 2018 16:53:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Apr 2018 16:53:27 -0300    

Click here for diff

I lowered the lock level for partitions being scanned from  
AccessExclusive to ShareLock in the course of 72cf7f310c07, but that was  
bogus, as pointed out by Robert Haas.  Revert that bit.  Doing this is  
possible, but requires more work.  
  
Discussion: https://postgr.es/m/CA+TgmobV7Nfmqv+TZXcdSsb9Bjc-OL-Anv6BNmCbfJVZLYPE4Q@mail.gmail.com  

M src/backend/commands/tablecmds.c

Add comment about default partition in check_new_partition_bound

commit   : 181ccbb5e49cdc628e0c8334a9ed57dbc736efe8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Apr 2018 16:51:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Apr 2018 16:51:55 -0300    

Click here for diff

The intention of the test is not immediately obvious, so we need this  
much.  

M src/backend/catalog/partition.c

YA attempt to stabilize the results of the postgres_fdw regression test.

commit   : 2fe977712c7375ccb1b6ddf7dfb234d0db903f16    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Apr 2018 15:12:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Apr 2018 15:12:06 -0400    

Click here for diff

We've made multiple attempts to stabilize the plans shown by commit  
1bc0100d2, with little success so far.  The reason for the remaining  
instability seems to be that if a transaction (such as auto-analyze)  
is running concurrently with the test, then get_actual_variable_range may  
return a maximum value for "T 1"."C 1" that's far away from the actual max,  
as a result of our having transiently inserted such a value earlier in  
the test.  Because we use a non-MVCC snapshot to fetch the value (for  
performance reasons), the presence of other transactions can cause that  
function to return entries that are actually dead.  
  
To fix, use a less extreme value in the earlier transient insertion, so  
that whether it is visible or not won't affect the selectivity estimate.  
The use of 9999 there seems to have been picked with the aid of a  
dartboard anyway, rather than having a specific reason.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use the right memory context for partkey's FmgrInfo

commit   : a4d56f583e7cff052c2699e62d867ae1c8fda4f3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Apr 2018 15:08:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Apr 2018 15:08:10 -0300    

Click here for diff

We were using CurrentMemoryContext to put the partsupfunc fmgr_info  
into, which isn't right, because we want the PartitionKey as a whole to  
be in the isolated Relation->rd_partkeycxt context.  This can cause a  
crash with user-defined support functions in the operator classes used  
by partitioning keys.  (Maybe this can cause problems with core-supplied  
opclasses too, not sure.)  
  
This is demonstrably broken in Postgres 10, too, but the initial  
proposed fix runs afoul of a problem discussed back when 8a0596cb656e  
("Get rid of copy_partition_key") reorganized that code: namely that it  
is possible to jump out of RelationBuildPartitionKey because of some  
error and leave a dangling memory context child of CacheMemoryContext.  
Also, while reviewing this I noticed that the removed-in-pg11  
copy_partition_key was doing something wrong, unfixed in pg10, namely  
doing memcpy() on the FmgrInfo, which is bogus (should be doing  
fmgr_info_copy).  Therefore, in branch pg10, the sane fix seems to be to  
backpatch both the aforementioned 8a0596cb656e and its followup  
be2343221fb7 ("Protect against hypothetical memory leaks in  
RelationGetPartitionKey"), so do that, then apply the fmgr_info memcxt  
bugfix on top.  
  
Add a test case exercising btree-based custom operator classes, which  
causes a crash prior to this fix.  This is not a security problem,  
because in order to create an operator class you need superuser  
privileges anyway.  
  
Authors: Ɓlvaro Herrera and Amit Langote  
Reported and diagnosed by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/relcache.c
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Fix YA parallel-make hazard, this one in "make check" in plpython.

commit   : 3e110a373b8102221af5436434441cd20eeb68fa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Apr 2018 10:38:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Apr 2018 10:38:48 -0400    

Click here for diff

We have to ensure that submake-generated-headers is finished before  
the topmost make run launches any child makes.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpython/Makefile

Fix interference between covering indexes and partitioned tables

commit   : 524054598fd300c75007f53aebd67f9ced33b7db    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 12 Apr 2018 17:25:13 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 12 Apr 2018 17:25:13 +0300    

Click here for diff

The bug is caused due to the original IndexStmt that DefineIndex receives  
being overwritten when processing the INCLUDE columns. Use separate list of  
index params to propagate to child tables. Add tests covering this case.  
  
Amit Langote and Alexander Korotkov.  
  
Re-commit 5c6110c6a960ad6fe1b0d0fec6ae36ef4eb913f5 because it discovered a bug  
fixed in c266ed31a8a3beed3533e6a78faeca78234cbd43  
  
Discussion: https://www.postgresql.org/message-id/CAJGNTeO%3DBguEyG8wxMpU_Vgvg3nGGzy71zUQ0RpzEn_mb0bSWA%40mail.gmail.com  

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

Cleanup covering infrastructure

commit   : c266ed31a8a3beed3533e6a78faeca78234cbd43    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 12 Apr 2018 16:37:22 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 12 Apr 2018 16:37:22 +0300    

Click here for diff

- Explicitly forbids opclass, collation and indoptions (like DESC/ASC etc) for  
  including columns. Throw an error if user points that.  
- Truncated storage arrays for such attributes to store only key atrributes,  
  added assertion checks.  
- Do not check opfamily and collation for including columns in  
  CompareIndexInfo()  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/relcache.c

Revert MERGE patch

commit   : 08ea7a2291db21a618d19d612c8060cda68f1892    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 12 Apr 2018 11:22:56 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 12 Apr 2018 11:22:56 +0100    

Click here for diff

This reverts commits d204ef63776b8a00ca220adec23979091564e465,  
83454e3c2b28141c0db01c7d2027e01040df5249 and a few more commits thereafter  
(complete list at the end) related to MERGE feature.  
  
While the feature was fully functional, with sufficient test coverage and  
necessary documentation, it was felt that some parts of the executor and  
parse-analyzer can use a different design and it wasn't possible to do that in  
the available time. So it was decided to revert the patch for PG11 and retry  
again in the future.  
  
Thanks again to all reviewers and bug reporters.  
  
List of commits reverted, in reverse chronological order:  
  
 f1464c5380 Improve parse representation for MERGE  
 ddb4158579 MERGE syntax diagram correction  
 530e69e59b Allow cpluspluscheck to pass by renaming variable  
 01b88b4df5 MERGE minor errata  
 3af7b2b0d4 MERGE fix variable warning in non-assert builds  
 a5d86181ec MERGE INSERT allows only one VALUES clause  
 4b2d44031f MERGE post-commit review  
 4923550c20 Tab completion for MERGE  
 aa3faa3c7a WITH support in MERGE  
 83454e3c2b New files for MERGE  
 d204ef6377 MERGE SQL Command following SQL:2016  
  
Author: Pavan Deolasee  
Reviewed-by: Michael Paquier  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/libpq.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/insert.sgml
D doc/src/sgml/ref/merge.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/trigger.sgml
M src/backend/access/heap/heapam.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/backend/commands/trigger.c
M src/backend/executor/Makefile
M src/backend/executor/README
M src/backend/executor/execMain.c
D src/backend/executor/execMerge.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
D src/backend/parser/parse_merge.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.c
M src/include/access/heapam.h
M src/include/commands/trigger.h
D src/include/executor/execMerge.h
M src/include/executor/execPartition.h
M src/include/executor/instrument.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
D src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/rewrite/rewriteHandler.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
D src/test/isolation/expected/merge-delete.out
D src/test/isolation/expected/merge-insert-update.out
D src/test/isolation/expected/merge-match-recheck.out
D src/test/isolation/expected/merge-update.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/merge-delete.spec
D src/test/isolation/specs/merge-insert-update.spec
D src/test/isolation/specs/merge-match-recheck.spec
D src/test/isolation/specs/merge-update.spec
M src/test/regress/expected/identity.out
D src/test/regress/expected/merge.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/triggers.out
M src/test/regress/expected/with.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/identity.sql
D src/test/regress/sql/merge.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/triggers.sql
M src/test/regress/sql/with.sql
M src/tools/pgindent/typedefs.list

Rename IndexInfo.ii_KeyAttrNumbers array

commit   : c9c875a28fa6cbc38c227fb9e656dd7be948166f    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 12 Apr 2018 13:02:45 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 12 Apr 2018 13:02:45 +0300    

Click here for diff

Rename ii_KeyAttrNumbers to ii_IndexAttrNumbers to prevent confusion with  
ii_NumIndexAttrs/ii_NumIndexKeyAttrs. ii_IndexAttrNumbers contains  
all attributes including "including" columns, not only key attribute.  
  
Discussion: https://www.postgresql.org/message-id/13123421-1d52-d0e4-c95c-6d69011e0595%40sigaev.ru  

M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/indexcmds.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/sort/tuplesort.c
M src/include/nodes/execnodes.h

Set relispartition correctly for index partitions

commit   : 9e9befac4a2228ae8a5309900645ecd8ead69f53    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Apr 2018 21:27:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Apr 2018 21:27:12 -0300    

Click here for diff

Oversight in commit 8b08f7d4820f: pg_class.relispartition was not  
being set for index partitions, which is a bit odd, and was also causing  
the code to unnecessarily call has_superclass() when simply checking the  
flag was enough.  
  
Author: Ɓlvaro Herrera  
Reported-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c

Ignore nextOid when replaying an ONLINE checkpoint.

commit   : d1e9079295e9e6fcab8f2ad9c69dd1be8e876d47    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Apr 2018 18:11:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Apr 2018 18:11:29 -0400    

Click here for diff

The nextOid value is from the start of the checkpoint and may well be stale  
compared to values from more recent XLOG_NEXTOID records.  Previously, we  
adopted it anyway, allowing the OID counter to go backwards during a crash.  
While this should be harmless, it contributed to the severity of the bug  
fixed in commit 0408e1ed5, by allowing duplicate TOAST OIDs to be assigned  
immediately following a crash.  Without this error, that issue would only  
have arisen when TOAST objects just younger than a multiple of 2^32 OIDs  
were deleted and then not vacuumed in time to avoid a conflict.  
  
Pavan Deolasee  
  
Discussion: https://postgr.es/m/CABOikdOgWT2hHkYG3Wwo2cyZJq2zfs1FH0FgX-=h4OLosXHf9w@mail.gmail.com  

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

Do not select new object OIDs that match recently-dead entries.

commit   : 0408e1ed599b06d9bca2927a50a4be52c9e74bb9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Apr 2018 17:41:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Apr 2018 17:41:09 -0400    

Click here for diff

When selecting a new OID, we take care to avoid picking one that's already  
in use in the target table, so as not to create duplicates after the OID  
counter has wrapped around.  However, up to now we used SnapshotDirty when  
scanning for pre-existing entries.  That ignores committed-dead rows, so  
that we could select an OID matching a deleted-but-not-yet-vacuumed row.  
While that mostly worked, it has two problems:  
  
* If recently deleted, the dead row might still be visible to MVCC  
snapshots, creating a risk for duplicate OIDs when examining the catalogs  
within our own transaction.  Such duplication couldn't be visible outside  
the object-creating transaction, though, and we've heard few if any field  
reports corresponding to such a symptom.  
  
* When selecting a TOAST OID, deleted toast rows definitely *are* visible  
to SnapshotToast, and will remain so until vacuumed away.  This leads to  
a conflict that will manifest in errors like "unexpected chunk number 0  
(expected 1) for toast value nnnnn".  We've been seeing reports of such  
errors from the field for years, but the cause was unclear before.  
  
The fix is simple: just use SnapshotAny to search for conflicting rows.  
This results in a slightly longer window before object OIDs can be  
recycled, but that seems unlikely to create any large problems.  
  
Pavan Deolasee  
  
Discussion: https://postgr.es/m/CABOikdOgWT2hHkYG3Wwo2cyZJq2zfs1FH0FgX-=h4OLosXHf9w@mail.gmail.com  

M src/backend/access/heap/tuptoaster.c
M src/backend/catalog/catalog.c

Allocate enough shared string memory for stats of auxiliary processes.

commit   : 811969b218ac2e8030dfbbb05873344967461618    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 11 Apr 2018 23:39:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 11 Apr 2018 23:39:49 +0300    

Click here for diff

This fixes a bug whereby the st_appname, st_clienthostname, and  
st_activity_raw fields for auxiliary processes point beyond the end of  
their respective shared memory segments. As a result, the application_name  
of a backend might show up as the client hostname of an auxiliary process.  
  
Backpatch to v10, where this bug was introduced, when the auxiliary  
processes were added to the array.  
  
Author: Edmund Horner  
Reviewed-by: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAMyN-kA7aOJzBmrYFdXcc7Z0NmW%2B5jBaf_m%3D_-77uRNyKC9r%3DA%40mail.gmail.com  

M src/backend/postmaster/pgstat.c

Make local copy of client hostnames in backend status array.

commit   : a820b4c32946c499a2d19846123840a0dad071b5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 11 Apr 2018 23:39:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 11 Apr 2018 23:39:48 +0300    

Click here for diff

The other strings, application_name and query string, were snapshotted to  
local memory in pgstat_read_current_status(), but we forgot to do that for  
client hostnames. As a result, the client hostname would appear to change in  
the local copy, if the client disconnected.  
  
Backpatch to all supported versions.  
  
Author: Edmund Horner  
Reviewed-by: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAMyN-kA7aOJzBmrYFdXcc7Z0NmW%2B5jBaf_m%3D_-77uRNyKC9r%3DA%40mail.gmail.com  

M src/backend/postmaster/pgstat.c

Fix ALTER TABLE .. ATTACH PARTITION ... DEFAULT

commit   : 72cf7f310c0729a331f321fad39835ac886603dc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Apr 2018 15:29:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Apr 2018 15:29:31 -0300    

Click here for diff

If the table being attached contained values that contradict the default  
partition's partition constraint, it would fail to complain, because  
CommandCounterIncrement changes in 4dba331cb3dc coupled with some bogus  
coding in the existing ValidatePartitionConstraints prevented the  
partition constraint from being validated after all -- or rather, it  
caused to constraint to become an empty one, always succeeding.  
  
Fix by not re-reading the OID of the default partition in  
ATExecAttachPartition.  To forestall similar problems, revise the  
existing code:  
* rename routine from ValidatePartitionConstraints() to  
  QueuePartitionConstraintValidation, to better represent what it  
  actually does.  
* add an Assert() to make sure that when queueing a constraint for a  
  partition we're not overwriting a constraint previously queued.  
* add an Assert() that we don't try to invoke the special-purpose  
  validation of the default partition when attaching the default  
  partition itself.  
  
While at it, change some loops to obtain partition OIDs from  
partdesc->oids rather than find_all_inheritors; reduce the lock level  
of partitions being scanned from AccessExclusiveLock to ShareLock;  
rewrite QueuePartitionConstraintValidation in a recursive fashion rather  
than repetitive.  
  
Author: Ɓlvaro Herrera.  Tests written by Amit Langote  
Reported-by: Rushabh Lathia  
Diagnosed-by: Kyotaro HORIGUCHI, who also provided the initial fix.  
Reviewed-by: Kyotaro HORIGUCHI, Amit Langote, Jeevan Ladhe  
Discussion: https://postgr.es/m/CAGPqQf0W+v-Ci_qNV_5R3A=Z9LsK4+jO7LzgddRncpp_rrnJqQ@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

Invoke submake-generated-headers during "make check", too.

commit   : cee83ef4a243c87683a4f472bab0e005b8b56f3c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Apr 2018 13:18:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Apr 2018 13:18:50 -0400    

Click here for diff

The MAKELEVEL hack to prevent submake-generated-headers from doing  
anything in child make runs means that we have to explicitly invoke  
it at top level for "make check", too, in case somebody proceeds  
directly to that without an explicit "make all".  (I think this  
usage had parallel-make hazards even before the addition of more  
generated headers; but it was totally broken as of 3b8f6e75f.)  
  
Out of paranoia, force the submake-libpq target to depend on  
submake-generated-headers, too.  This seems to not be absolutely  
necessary today, but it's not really saving us anything to omit  
the ordering dependency, and it'll likely break someday without it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Temporary revert 5c6110c6a960ad6fe1b0d0fec6ae36ef4eb913f5

commit   : 92899992e13a089fb8915b02e45792998996530e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 11 Apr 2018 19:32:19 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 11 Apr 2018 19:32:19 +0300    

Click here for diff

It discovers one more bug in CompareIndexInfo(), should be fixed first.  

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

Fix clashing function names between jsonb_plperl and jsonb_plperlu

commit   : 651cb9094154ca323e889269d56b94f27afaceca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 10:34:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 10:34:53 -0400    

Click here for diff

This prevented them from being installed at the same time.  
  
Author: Dagfinn Ilmari MannsĆ„ker <[email protected]>  

M contrib/jsonb_plperl/jsonb_plperlu–1.0.sql

Fix interference between cavering indexes and partitioned tables

commit   : 5c6110c6a960ad6fe1b0d0fec6ae36ef4eb913f5    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 11 Apr 2018 16:44:26 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 11 Apr 2018 16:44:26 +0300    

Click here for diff

The bug is caused due to the original IndexStmt that DefineIndex receives  
being overwritten when processing the INCLUDE columns. Use separate list of  
index params to propagate to child tables. Add tests covering this case.  
  
Amit Langote and Alexander Korotkov.  

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

doc: Add more information about logical replication privileges

commit   : f1f537cb46299d81abb08258fd322f72170dff58    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 09:01:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 09:01:57 -0400    

Click here for diff

In particular, the requirement to have SELECT privilege for the initial  
table copy was previously not documented.  
  
Author: Shinoda, Noriyoshi <[email protected]>  

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

doc: Fix typos in pgbench documentation

commit   : 036ca6f7bb186ae8564fb9e3a27852757a9450be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 08:34:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Apr 2018 08:34:30 -0400    

Click here for diff

Author: Fabien COELHO <[email protected]>  
Reviewed-by: Edmund Horner <[email protected]>  

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

minor comment fixes in nbtinsert.c

commit   : 8716b264ed845370e33943da93caf424dc3723b7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 10 Apr 2018 18:35:56 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 10 Apr 2018 18:35:56 -0400    

Click here for diff

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

Fix incorrect close() call in dsm_impl_mmap().

commit   : 231bcd0803eb91c526d4e7522c993fa5ed71bd45    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Apr 2018 18:34:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Apr 2018 18:34:40 -0400    

Click here for diff

One improbable error-exit path in this function used close() where  
it should have used CloseTransientFile().  This is unlikely to be  
hit in the field, and I think the consequences wouldn't be awful  
(just an elog(LOG) bleat later).  But a bug is a bug, so back-patch  
to 9.4 where this code came in.  
  
Pan Bian  
  
Discussion: https://postgr.es/m/[email protected]  

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

Adjustments to the btree fastpath optimization.

commit   : 074251db6740a9abfbd922d13d39b27c4f338a20    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 10 Apr 2018 18:21:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 10 Apr 2018 18:21:03 -0400    

Click here for diff

This optimization was introduced in commit 2b272734. The changes include  
some additional comments and documentation, and also these more  
substantive changes:  
. ensure the optimization is only applied on the leaf node of a tree  
whose root is on level 2 or more. It's of little value on small trees.  
. Delay calling RelationSetTargetBlock() until after the critical  
section of _bt_insertonpg  
. ensure the optimization is also applied to unlogged tables.  
  
Pavan Deolasee and Peter Geoghegan with some very light editing from me.  
  
Discussion: https://postgr.es/m/CABOikdO8jhRarNC60nZLktZYhxt+TK8z_V97+Ny499YQdyAfug@mail.gmail.com  

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

Put back parallel-safety guards in plpython and src/test/regress/.

commit   : 31f1f0bb4fd642643994d35c35ecb5b929711a99    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Apr 2018 16:14:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Apr 2018 16:14:55 -0400    

Click here for diff

I'd hoped that commit 3b8f6e75f was sufficient to ensure parallel safety  
even when a build started in a subdirectory requires rebuilding of  
generated headers.  This isn't so, because making submake-generated-headers  
a prerequisite of "all" isn't enough to ensure it's completed before  
starting on "all"'s other prerequisites.  The explicit dependencies we put  
on the recursive make targets ensure safe ordering before we recurse into  
child directories, but they don't protect targets to be made in the current  
directory.  Hence, put back some ordering dependencies in directories that  
we've traditionally expected to be starting points for "standalone" builds,  
to wit src/pl/plpython and src/test/regress.  (The former needs this in  
order to minimize the work involved in building for both python 2 and  
python 3; the latter to support packagings that make the regression tests  
available for out-of-build-tree execution.)  Adjust some other dependencies  
so that these two cases work correctly even at high -j settings.  
  
I'm not terribly happy with this partial solution, but I don't see a  
way to do better without massive makefile restructuring, which we surely  
aren't doing at this point in the development cycle.  In any case, it's  
little if any worse than what we had in prior releases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/pl/plpython/Makefile
M src/test/regress/GNUmakefile

Fix IndexOnlyScan counter for heap fetches in parallel mode

commit   : 15a8f8caad14c1f85b23d97842d0c27b106cc10e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Apr 2018 15:56:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Apr 2018 15:56:15 -0300    

Click here for diff

The HeapFetches counter was using a simple value in IndexOnlyScanState,  
which fails to propagate values from parallel workers; so the counts are  
wrong when IndexOnlyScan runs in parallel.  Move it to Instrumentation,  
like all the other counters.  
  
While at it, change INSERT ON CONFLICT conflicting tuple counter to use  
the new ntuples2 instead of nfiltered2, which is a blatant misuse.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/instrument.h
M src/include/nodes/execnodes.h

Fix pgxs.mk to not try to build generated headers in external builds.

commit   : 1a40485af6e43be501500a88b1b9765cc0d69c0b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Apr 2018 12:41:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Apr 2018 12:41:51 -0400    

Click here for diff

Per Julien Rouhaud and the buildfarm.  This is not quite Julien's  
patch: there's no need to lobotomize this build rule when building  
contrib modules in-tree, so set NO_GENERATED_HEADERS only if PGXS.  
  
In passing, also set NO_TEMP_INSTALL in external builds.  This doesn't  
seem to be fixing any live bug, because "make check" in an external  
build just produces the expected error message without first trying to  
make a temp install ... but it's far from obvious why it doesn't, so  
this change seems like good future-proofing.  
  
Julien Rouhaud and Tom Lane  
  
Discussion: https://postgr.es/m/CAOBaU_YH=g68opbbMk8is3jNwhoXGa8ckRSre1nx0Obe1C7i-Q@mail.gmail.com  

M src/makefiles/pgxs.mk

Fix comment on B-tree insertion fastpath condition.

commit   : 29d7ebf51ee33e1711fc9681f273f3de2da76ebf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 10 Apr 2018 16:57:19 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 10 Apr 2018 16:57:19 +0300    

Click here for diff

The comment earlier in the function correctly states "and the insertion  
key is strictly greater than the first key in this page". That is what  
we check here, not "greater than or equal".  

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

Fix partial-build problems introduced by having more generated headers.

commit   : 3b8f6e75f3c8c6d192621f21624cc8cee04ec3cb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 16:42:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 16:42:02 -0400    

Click here for diff

Commit 372728b0d created some problems for usages like building a  
subdirectory without having first done "make all" at the top level,  
or for proceeding directly to "make install" without "make all".  
The only reasonably clean way to fix this seems to be to force the  
submake-generated-headers rule to fire in *any* "make all" or "make  
install" command anywhere in the tree.  To avoid lots of redundant work,  
as well as parallel make jobs possibly clobbering each others' output, we  
still need to be sure that the rule fires only once in a recursive build.  
For that, adopt the same MAKELEVEL hack previously used for "temp-install".  
But try to document it a bit better.  
  
The submake-errcodes mechanism previously used in src/port/ and src/common/  
is subsumed by this, so we can get rid of those special cases.  It was  
inadequate for src/common/ anyway after the aforesaid commit, and it always  
risked parallel attempts to build errcodes.h.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/Makefile
M src/Makefile
M src/Makefile.global.in
M src/backend/Makefile
M src/backend/jit/llvm/Makefile
M src/common/Makefile
M src/pl/plpython/Makefile
M src/port/Makefile
M src/test/modules/Makefile
M src/test/regress/GNUmakefile

Fix incorrect logic for choosing the next Parallel Append subplan

commit   : 468abb8f7a69c68341b6fc2797166d1079acb1b1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Apr 2018 17:23:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Apr 2018 17:23:49 -0300    

Click here for diff

In 499be013de support for pruning unneeded Append subnodes was added.  
The logic in that commit was not correctly checking if the next subplan  
was in fact a valid subplan. This could cause parallel workers processes  
to be given a subplan to work on which didn't require any work.  
  
Per code review following an otherwise unexplained regression failure in  
buildfarm member Pademelon.  (We haven't been able to reproduce the  
failure, so this is a bit of a blind fix in terms of whether it'll  
actually fix it; but it is a clear bug nonetheless).  
  
In passing, also add a comment to explain what first_partial_plan means.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f_E5r05hHUVG3UmCQJ49DGKKHtN=SHybD44LdzBn+CJng@mail.gmail.com  

M src/backend/executor/nodeAppend.c
M src/include/nodes/plannodes.h

Silence some warnings in TAP tests

commit   : d7754822c52ccb6dfb1c29607ae352c2028979d2    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 21:45:48 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 21:45:48 +0200    

Click here for diff

Author: Michael Paquier  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/test/perl/PostgresNode.pm

Make sure pg_rewind can't run as root

commit   : 5d5aeddabfe0b6b21f556c72a71e0454833d63e5    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 21:33:33 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 21:33:33 +0200    

Click here for diff

Previously a warning was printed, but the tool actually kept running  
even when running as root. This is something we definitely want to  
prevent, but since this means a behavior change, not backpatching.  
  
Author: Michael Paquier  

M src/bin/pg_rewind/pg_rewind.c

Reduce chattiness of genbki.pl and Gen_fmgrtab.pl.

commit   : a65e17bd6fdac1b11e0c82764955c0b805251937    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 15:01:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 15:01:10 -0400    

Click here for diff

Make these scripts emit just one log message when they run, not one  
per output file.  The latter is way too verbose in the wake of  
commit 372728b0d.  The specific wording used is what already existed  
in the MSVC scripts.  
  
John Naylor  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/tools/msvc/Solution.pm

Make reformat_dat_file.pl preserve all blank lines.

commit   : 2cdf359fc4471c488fbb0dbd31678d78c3c1043b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 14:58:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 14:58:39 -0400    

Click here for diff

In its original form, reformat_dat_file.pl smashed consecutive blank  
lines to a single blank line, which was helpful for mopping up excess  
whitespace during the bootstrap data format conversion.  But going  
forward, there seems little reason to do that; if developers want to  
put in multiple blank lines, let 'em.  This makes it conform to the  
documentation I (tgl) wrote, too.  
  
In passing, clean up some sloppy markup choices in bki.sgml.  
  
John Naylor  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bki.sgml
M src/include/catalog/reformat_dat_file.pl

Further cleanup of client dependencies on src/include/catalog headers.

commit   : af1a949109d8212711df943c053b1038c0afdae1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 14:39:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Apr 2018 14:39:58 -0400    

Click here for diff

In commit 9c0a0de4c, I'd failed to notice that catalog/catalog.h  
should also be considered a frontend-unsafe header, because it includes  
(and needs) the full form of pg_class.h, not to mention relcache.h.  
However, various frontend code was depending on it to get  
TABLESPACE_VERSION_DIRECTORY, so refactoring of some sort is called for.  
  
The cleanest answer seems to be to move TABLESPACE_VERSION_DIRECTORY,  
as well as the OIDCHARS symbol, to common/relpath.h.  Do that, and mop up  
inclusions as necessary.  (I found that quite a few current users of  
catalog/catalog.h don't seem to need it at all anymore, apparently as a  
result of the refactorings that created common/relpath.[hc].  And  
initdb.c needed it only as a route to pg_class_d.h.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/rawpage.c
M contrib/pg_prewarm/pg_prewarm.c
M src/backend/access/index/indexam.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/storage.c
M src/backend/commands/vacuumlazy.c
M src/backend/replication/basebackup.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/smgr/md.c
M src/bin/initdb/initdb.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/common/relpath.c
M src/include/catalog/catalog.h
M src/include/common/relpath.h

catversion bump for online-checksums revert

commit   : f5543d47bcb2fee2ab69220f51e2078c11e19843    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 19:26:58 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 19:26:58 +0200    

Click here for diff

Lack thereof pointed out by Tom Lane.  

M src/include/catalog/catversion.h

Revert "Allow on-line enabling and disabling of data checksums"

commit   : a228cc13aeabff308d6dfc98a1015865f5393fce    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 19:02:42 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 9 Apr 2018 19:02:42 +0200    

Click here for diff

This reverts the backend sides of commit 1fde38beaa0c3e66c340efc7cc0dc272d6254bb0.  
I have, at least for now, left the pg_verify_checksums tool in place, as  
this tool can be very valuable without the rest of the patch as well,  
and since it's a read-only tool that only runs when the cluster is down  
it should be a lot safer.  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/Makefile
M src/backend/postmaster/bgworker.c
D src/backend/postmaster/checksumhelper.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/decode.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/page/README
M src/backend/storage/page/bufpage.c
M src/backend/utils/misc/guc.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
D src/include/postmaster/checksumhelper.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/test/Makefile
D src/test/checksum/.gitignore
D src/test/checksum/Makefile
D src/test/checksum/README
D src/test/checksum/t/001_standby_checksum.pl
D src/test/isolation/expected/checksum_cancel.out
D src/test/isolation/expected/checksum_enable.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/checksum_cancel.spec
D src/test/isolation/specs/checksum_enable.spec

Improve covering index documentation

commit   : 03c11796a95cc20a4559a103019d4d22a116a13c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 9 Apr 2018 17:53:42 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 9 Apr 2018 17:53:42 +0300    

Click here for diff

Add missed description of pg_constraint.conincluding  
  
Shinoda, Noriyoshi and Alexander Korotkov  

M doc/src/sgml/catalogs.sgml

Minor comment updates

commit   : d7a95f06a1a125fd82b87d01d9a9d8cf9c081799    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Apr 2018 11:17:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Apr 2018 11:17:12 -0300    

Click here for diff

Fix a couple of typos, and update a comment about why we set a BMS to  
NULL.  
  
Author: David Rowley  
Discussion: http://postgr.es/m/CAKJS1f-tux=KdUz6ENJ9GHM_V2qgxysadYiOyQS9Ko9PTteVhQ@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/include/partitioning/partprune.h

Add missed bms_copy() in perform_pruning_combine_step

commit   : 7ba6ee815dc90d4fab7226d343bf72aa28c9aa5c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Apr 2018 10:54:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Apr 2018 10:54:28 -0300    

Click here for diff

We were initializing a BMS to merely reference an existing one, which  
would cause a double-free (and a crash) when the recursive algorithm  
tried to intersect it with an empty one.  Fix it by creating a copy at  
initialization time.  
  
Reported-by: sqlsmith (by way of Andreas Seltenreich)  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c

Fix typo in comment.

commit   : 2c19ea863a27303f462485c4046a850864e638b8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Apr 2018 14:20:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Apr 2018 14:20:13 +0300    

Click here for diff

Author: Kyotaro Horiguchi  

M src/backend/rewrite/rewriteManip.c

Remove repeated test in contrib/amcheck

commit   : 1671c01650d2cf9398b2e5ff87be2e2fd03781b7    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 9 Apr 2018 09:19:09 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 9 Apr 2018 09:19:09 +0300    

Click here for diff

Repeating these tests adds unnecessary cycles, since no improvement in  
test coverage is expected.  
  
Cleanup from commit 8224de4f42ccf98e08db07b43d52fed72f962ebb.  
  
Peter Geoghegan  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql

Skip permissions test under MINGW/Windows

commit   : 9d0383c015aabd7565f3df010a5ff56b46aa8756    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 8 Apr 2018 22:50:00 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 8 Apr 2018 22:50:00 -0400    

Click here for diff

We don't support the same kind of permissions tests on Windows/MINGW, so  
these tests really shouldn't be getting run on that platform.  
  
Per buildfarm.  

M src/bin/pg_upgrade/test.sh

Fix additional breakage in covering-index patch.

commit   : b3b7f7898f17009912b3fc16620d042ec8482557    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 17:23:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 17:23:39 -0400    

Click here for diff

CheckIndexCompatible() misused ComputeIndexAttrs() by not bothering  
to fill ii_NumIndexAttrs and ii_NumIndexKeyAttrs in the passed  
IndexInfo.  Omission of ii_NumIndexAttrs was previously unimportant,  
but now this matters because ComputeIndexAttrs depends on  
ii_NumIndexKeyAttrs to decide how many columns it needs to report on.  
  
(BTW, the fact that this oversight wasn't detected earlier implies  
that we have no regression test verifying whether CheckIndexCompatible  
ever succeeds.  Bad dog.  Not the job of this patch to fix it, though.)  
  
Also, change the API of ComputeIndexAttrs so that it fills the opclass  
output array for all column positions, as it does for the options output  
array; positions for non-key index columns are filled with zeroes.  
This isn't directly fixing any bug, but it seems like a good idea.  
  
Per valgrind failure reports from buildfarm.  
  
Alexander Korotkov, tweaked a bit by me  
  
Discussion: https://postgr.es/m/CAPpHfduWrysrT-qAhn+3Ea5+Mg6Vhc-oA6o2Z-hRCPRdvf3tiw@mail.gmail.com  

M src/backend/commands/indexcmds.c

Doc: clarify explanation of pg_dump usage.

commit   : 893e9e65402e79cc5eb865825be32f675d8a72b2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 16:35:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 16:35:42 -0400    

Click here for diff

This section confusingly used both "infile" and "outfile" to refer  
to the same file, i.e. the textual output of pg_dump.  Use "dumpfile"  
for both cases, per suggestion from Jonathan Katz.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/backup.sgml

Cosmetic cleanups in initial catalog data.

commit   : 4f85f66469594996584d50e6a940b5ba873aa713    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 15:55:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 15:55:49 -0400    

Click here for diff

Write ',' and ';' for typdelim values instead of the obscurantist  
ASCII octal equivalents.  Not sure why anybody ever thought the  
latter were better; maybe it had something to do with lack of  
a better quoting convention, twenty-plus years ago?  
  
Reassign a couple of high-numbered OIDs that were left in during  
yesterday's mad rush to commit stuff of uncertain internal  
temperature.  
  
The latter requires a catversion bump, though the former wouldn't  
since the end-result catalog data is unchanged.  

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

Reduce worst-case shell command line length during "make install".

commit   : cca563f38422f2a7c6c56f162efe2689bf1c7697    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 15:08:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 15:08:32 -0400    

Click here for diff

Addition of the catalog/pg_foo_d.h headers seems to have pushed us over  
the brink of the maximum command line length for some older platforms  
during "make install" for our header files.  The main culprit here is  
repetition of the target directory path, which could be long.  
Rearrange so that we don't repeat that once per file, but only once  
per subdirectory.  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/Makefile

Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers.

commit   : cefa3871534d2c467a520820c0ae3f002a46d8e4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 14:35:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 14:35:29 -0400    

Click here for diff

Traditionally, include/catalog/pg_foo.h contains extern declarations  
for functions in backend/catalog/pg_foo.c, in addition to its function  
as the authoritative definition of the pg_foo catalog's rowtype.  
In some cases, we'd been forced to split out those extern declarations  
into separate pg_foo_fn.h headers so that the catalog definitions  
could be #include'd by frontend code.  That problem is gone as of  
commit 9c0a0de4c, so let's undo the splits to make things less  
confusing.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/dml.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/analyze.c
M src/backend/commands/collationcmds.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/execPartition.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/utility.c
M src/include/catalog/pg_aggregate.h
D src/include/catalog/pg_aggregate_fn.h
M src/include/catalog/pg_collation.h
D src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_constraint.h
D src/include/catalog/pg_constraint_fn.h
M src/include/catalog/pg_conversion.h
D src/include/catalog/pg_conversion_fn.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_inherits.h
D src/include/catalog/pg_inherits_fn.h
M src/include/catalog/pg_operator.h
D src/include/catalog/pg_operator_fn.h
M src/include/catalog/pg_proc.h
D src/include/catalog/pg_proc_fn.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_type.h
D src/include/catalog/pg_type_fn.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpython/plpy_procedure.c

Switch client-side code to include catalog/pg_foo_d.h not pg_foo.h.

commit   : 9c0a0de4c91b2dc911220d769cf2c5f754cfcb90    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 13:59:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 13:59:52 -0400    

Click here for diff

Everything of use to frontend code should now appear in the _d.h files,  
and making this change frees us from needing to worry about whether the  
catalog header files proper are frontend-safe.  
  
Remove src/interfaces/ecpg/ecpglib/pg_type.h entirely, as the previous  
commit reduced it to a confusingly-named wrapper around pg_type_d.h.  
  
In passing, make test_rls_hooks.c follow project convention of including  
our own files with #include "" not <>.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/version.c
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/vacuumdb.c
M src/common/relpath.c
M src/fe_utils/print.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
D src/interfaces/ecpg/ecpglib/pg_type.h
M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/tools/findoidjoins/findoidjoins.c

Replace our traditional initial-catalog-data format with a better design.

commit   : 372728b0d49552641f0ea83d9d2e08817de038fa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 13:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 13:16:50 -0400    

Click here for diff

Historically, the initial catalog data to be installed during bootstrap  
has been written in DATA() lines in the catalog header files.  This had  
lots of disadvantages: the format was badly underdocumented, it was  
very difficult to edit the data in any mechanized way, and due to the  
lack of any abstraction the data was verbose, hard to read/understand,  
and easy to get wrong.  
  
Hence, move this data into separate ".dat" files and represent it in a way  
that can easily be read and rewritten by Perl scripts.  The new format is  
essentially "key => value" for each column; while it's a bit repetitive,  
explicit labeling of each value makes the data far more readable and less  
error-prone.  Provide a way to abbreviate entries by omitting field values  
that match a specified default value for their column.  This allows removal  
of a large amount of repetitive boilerplate and also lowers the barrier to  
adding new columns.  
  
Also teach genbki.pl how to translate symbolic OID references into  
numeric OIDs for more cases than just "regproc"-like pg_proc references.  
It can now do that for regprocedure-like references (thus solving the  
problem that regproc is ambiguous for overloaded functions), operators,  
types, opfamilies, opclasses, and access methods.  Use this to turn  
nearly all OID cross-references in the initial data into symbolic form.  
This represents a very large step forward in readability and error  
resistance of the initial catalog data.  It should also reduce the  
difficulty of renumbering OID assignments in uncommitted patches.  
  
Also, solve the longstanding problem that frontend code that would like to  
use OID macros and other information from the catalog headers often had  
difficulty with backend-only code in the headers.  To do this, arrange for  
all generated macros, plus such other declarations as we deem fit, to be  
placed in "derived" header files that are safe for frontend inclusion.  
(Once clients migrate to using these pg_*_d.h headers, it will be possible  
to get rid of the pg_*_fn.h headers, which only exist to quarantine code  
away from clients.  That is left for follow-on patches, however.)  
  
The now-automatically-generated macros include the Anum_xxx and Natts_xxx  
constants that we used to have to update by hand when adding or removing  
catalog columns.  
  
Replace the former manual method of generating OID macros for pg_type  
entries with an automatic method, ensuring that all built-in types have  
OID macros.  (But note that this patch does not change the way that  
OID macros for pg_proc entries are built and used.  It's not clear that  
making that match the other catalogs would be worth extra code churn.)  
  
Add SGML documentation explaining what the new data format is and how to  
work with it.  
  
Despite being a very large change in the catalog headers, there is no  
catversion bump here, because postgres.bki and related output files  
haven't changed at all.  
  
John Naylor, based on ideas from various people; review and minor  
additional coding by me; previous review by Alvaro Herrera  
  
Discussion: https://postgr.es/m/CAJVSVGWO48JbbwXkJz_yBFyGYW-M9YWxnPdxJBUosDC9ou_F0Q@mail.gmail.com  

M doc/src/sgml/bki.sgml
M doc/src/sgml/libpq.sgml
M src/Makefile
M src/backend/Makefile
M src/backend/catalog/.gitignore
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
D src/backend/catalog/README
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/include/Makefile
M src/include/catalog/.gitignore
A src/include/catalog/Makefile
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/indexing.h
A src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
A src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
A src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
A src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
A src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
A src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
A src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
A src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
A src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
A src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
A src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
A src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
A src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
A src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
A src/include/catalog/pg_pltemplate.dat
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
A src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
A src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
A src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
A src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
A src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
A src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
A src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
A src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
A src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
A src/include/catalog/reformat_dat_file.pl
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/interfaces/ecpg/ecpglib/pg_type.h
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat
M src/tools/pgindent/pgindent

match_clause_to_index should check only key columns

commit   : 02f3e558f21c0fbec9f94d5de9ad34f321eb0e57    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sun, 8 Apr 2018 19:58:15 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sun, 8 Apr 2018 19:58:15 +0300    

Click here for diff

Alexander Korotkov per gripe from Tom Lane noticed on valgrind-enabled  
buildfarm members  

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

Remove unused variable in non-assert-enabled build

commit   : 34602b0a1dfd41400d376e73e41ad868ad2d3ce8    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sun, 8 Apr 2018 19:30:38 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sun, 8 Apr 2018 19:30:38 +0300    

Click here for diff

Use field of structure in Assert directly  
  
Jeff Janes  

M src/backend/access/common/indextuple.c

Add missing "static" markers.

commit   : 2fa55f26a0c56f40b71f96859280dc5d11751514    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 10:54:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Apr 2018 10:54:54 -0400    

Click here for diff

Evidently forgotten in commit 11523e860.  Per buildfarm member pademelon.  

M contrib/adminpack/adminpack.c

Attempt to stabilize partition_prune test output.

commit   : b47a86f5008f2674af20dd00bc233e7b74e01bba    
  
author   : Andrew Gierth <[email protected]>    
date     : Sun, 8 Apr 2018 06:35:42 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sun, 8 Apr 2018 06:35:42 +0100    

Click here for diff

Disable index-only scan for tests that might report variable results  
for "Heap Fetches" statistic due to concurrent transactions affecting  
whether all-visible flags can be set.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f_yjtHDJnDzx1uuR_3D7beDVAkNQfWJhRLA1gvPCzkAhg@mail.gmail.com  

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

Support index INCLUDE in the AM properties interface.

commit   : 49b0e300f7dd56b092c0046ee29dc2b15beea9a8    
  
author   : Andrew Gierth <[email protected]>    
date     : Sun, 8 Apr 2018 06:02:05 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sun, 8 Apr 2018 06:02:05 +0100    

Click here for diff

This rectifies an oversight in commit 8224de4f4, by adding a new  
property 'can_include' for pg_indexam_has_property, and adjusting the  
results of pg_index_column_has_property to give more appropriate  
results for INCLUDEd columns.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/amutils.c
M src/include/access/amapi.h
M src/test/regress/expected/amutils.out
M src/test/regress/sql/amutils.sql

Remove overzeleous assertions in pg_atomic_flag code.

commit   : d234602c28e8e1baea342602dbb404cee9fde47e    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 7 Apr 2018 18:27:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 7 Apr 2018 18:27:14 -0700    

Click here for diff

The atomics code asserts proper alignment in various places. That's  
mainly because the alignment of 64bit integers is not sufficient for  
atomic operations on all platforms. Some ABIs only have four byte  
alignment, but don't have atomic behavior when crossing page  
boundaries.  
  
The flags code isn't affected by that however, as the type alignment  
always is sufficient for atomic operations. Nevertheless the code  
asserted alignment requirements. Before 8c3debbb it was only broken on  
hppa, after it probably affect further platforms.  
  
Thus remove the assertions for pg_atomic_flag operators.  
  
Per buildfarm animal pademelon.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

M src/include/port/atomics.h

Fix EXEC BACKEND + Windows builds for group privs

commit   : 2b74022473f0c7a7fbe11a4973f80478226275bd    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 7 Apr 2018 19:01:43 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 7 Apr 2018 19:01:43 -0400    

Click here for diff

Under EXEC BACKEND we also need to be going through the group privileges  
setup since we do support that on Unixy systems, so add that to  
SubPostmasterMain().  
  
Under Windows, we need to simply return true from  
GetDataDirectoryCreatePerm(), but that wasn't happening due to a missing  
 #else clause.  
  
Per buildfarm.  

M src/backend/postmaster/postmaster.c
M src/common/file_perm.c

Allow group access on PGDATA

commit   : c37b3d08ca6873f9d4eaf24c72a90a550970cbb8    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 7 Apr 2018 17:45:39 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 7 Apr 2018 17:45:39 -0400    

Click here for diff

Allow the cluster to be optionally init'd with read access for the  
group.  
  
This means a relatively non-privileged user can perform a backup of the  
cluster without requiring write privileges, which enhances security.  
  
The mode of PGDATA is used to determine whether group permissions are  
enabled for directory and file creates.  This method was chosen as it's  
simple and works well for the various utilities that write into PGDATA.  
  
Changing the mode of PGDATA manually will not automatically change the  
mode of all the files contained therein.  If the user would like to  
enable group access on an existing cluster then changing the mode of all  
the existing files will be required.  Note that pg_upgrade will  
automatically change the mode of all migrated files if the new cluster  
is init'd with the -g option.  
  
Tests are included for the backend and all the utilities which operate  
on the PG data directory to ensure that the correct mode is set based on  
the data directory permissions.  
  
Author: David Steele <[email protected]>  
Reviewed-By: Michael Paquier, with discussion amongst many others.  
Discussion: https://postgr.es/m/ad346fe6-b23e-59f1-ecb7-0e08390ad629%40pgmasters.net  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/runtime.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/test.sh
M src/common/file_perm.c
M src/include/common/file_perm.h
M src/include/miscadmin.h
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm

Refactor dir/file permissions

commit   : da9b580d89903fee871cf54845ffa2b26bda2e11    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 7 Apr 2018 17:45:39 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 7 Apr 2018 17:45:39 -0400    

Click here for diff

Consolidate directory and file create permissions for tools which work  
with the PG data directory by adding a new module (common/file_perm.c)  
that contains variables (pg_file_create_mode, pg_dir_create_mode) and  
constants to initialize them (0600 for files and 0700 for directories).  
  
Convert mkdir() calls in the backend to MakePGDirectory() if the  
original call used default permissions (always the case for regular PG  
directories).  
  
Add tests to make sure permissions in PGDATA are set correctly by the  
tools which modify the PG data directory.  
  
Authors: David Steele <[email protected]>,  
         Adam Brightwell <[email protected]>  
Reviewed-By: Michael Paquier, with discussion amongst many others.  
Discussion: https://postgr.es/m/ad346fe6-b23e-59f1-ecb7-0e08390ad629%40pgmasters.net  

M src/backend/access/transam/xlog.c
M src/backend/commands/tablespace.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/basebackup.c
M src/backend/replication/slot.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/utils/init/miscinit.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/test.sh
M src/common/Makefile
A src/common/file_perm.c
A src/include/common/file_perm.h
M src/include/storage/fd.h
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/tools/msvc/Mkvcbuild.pm

Support partition pruning at execution time

commit   : 499be013de65242235ebdde06adb08db887f0ea5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 7 Apr 2018 17:54:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 7 Apr 2018 17:54:31 -0300    

Click here for diff

Existing partition pruning is only able to work at plan time, for query  
quals that appear in the parsed query.  This is good but limiting, as  
there can be parameters that appear later that can be usefully used to  
further prune partitions.  
  
This commit adds support for pruning subnodes of Append which cannot  
possibly contain any matching tuples, during execution, by evaluating  
Params to determine the minimum set of subnodes that can possibly match.  
We support more than just simple Params in WHERE clauses. Support  
additionally includes:  
  
1. Parameterized Nested Loop Joins: The parameter from the outer side of the  
   join can be used to determine the minimum set of inner side partitions to  
   scan.  
  
2. Initplans: Once an initplan has been executed we can then determine which  
   partitions match the value from the initplan.  
  
Partition pruning is performed in two ways.  When Params external to the plan  
are found to match the partition key we attempt to prune away unneeded Append  
subplans during the initialization of the executor.  This allows us to bypass  
the initialization of non-matching subplans meaning they won't appear in the  
EXPLAIN or EXPLAIN ANALYZE output.  
  
For parameters whose value is only known during the actual execution  
then the pruning of these subplans must wait.  Subplans which are  
eliminated during this stage of pruning are still visible in the EXPLAIN  
output.  In order to determine if pruning has actually taken place, the  
EXPLAIN ANALYZE must be viewed.  If a certain Append subplan was never  
executed due to the elimination of the partition then the execution  
timing area will state "(never executed)".  Whereas, if, for example in  
the case of parameterized nested loops, the number of loops stated in  
the EXPLAIN ANALYZE output for certain subplans may appear lower than  
others due to the subplan having been scanned fewer times.  This is due  
to the list of matching subnodes having to be evaluated whenever a  
parameter which was found to match the partition key changes.  
  
This commit required some additional infrastructure that permits the  
building of a data structure which is able to perform the translation of  
the matching partition IDs, as returned by get_matching_partitions, into  
the list index of a subpaths list, as exist in node types such as  
Append, MergeAppend and ModifyTable.  This allows us to translate a list  
of clauses into a Bitmapset of all the subpath indexes which must be  
included to satisfy the clause list.  
  
Author: David Rowley, based on an earlier effort by Beena Emerson  
Reviewers: Amit Langote, Robert Haas, Amul Sul, Rajkumar Raghuwanshi,  
Jesper Pedersen  
Discussion: https://postgr.es/m/CAOG9ApE16ac-_VVZVvv0gePSgkg_BwYEV1NBqZFqDR2bBE0X0A@mail.gmail.com  

M doc/src/sgml/perform.sgml
M src/backend/commands/explain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/pathnode.h
M src/include/partitioning/partprune.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Add bms_prev_member function

commit   : 5c0675215e153ba1297fd494b34af2fdebd645d1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 7 Apr 2018 12:01:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 7 Apr 2018 12:01:11 -0300    

Click here for diff

This works very much like the existing bms_last_member function, only it  
traverses through the Bitmapset in the opposite direction from the most  
significant bit down to the least significant bit.  A special prevbit value of  
-1 may be used to have the function determine the most significant bit.  This  
is useful for starting a loop.  When there are no members less than prevbit,  
the function returns -2 to indicate there are no more members.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f-K=3d5MDASNYFJpUpc20xcBnAwNC1-AOeunhn0OtkWbQ@mail.gmail.com  

M src/backend/nodes/bitmapset.c
M src/include/nodes/bitmapset.h

Raise error when affecting tuple moved into different partition.

commit   : f16241bef7cc271bff60e23de2f827a10e50dde8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 7 Apr 2018 13:24:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 7 Apr 2018 13:24:10 -0700    

Click here for diff

When an update moves a row between partitions (supported since  
2f178441044b), our normal logic for following update chains in READ  
COMMITTED mode doesn't work anymore. Cross partition updates are  
modeled as an delete from the old and insert into the new  
partition. No ctid chain exists across partitions, and there's no  
convenient space to introduce that link.  
  
Not throwing an error in a partitioned context when one would have  
been thrown without partitioning is obviously problematic. This commit  
introduces infrastructure to detect when a tuple has been moved, not  
just plainly deleted. That allows to throw an error when encountering  
a deletion that's actually a move, while attempting to following a  
ctid chain.  
  
The row deleted as part of a cross partition update is marked by  
pointing it's t_ctid to an invalid block, instead of self as a normal  
update would.  That was deemed to be the least invasive and most  
future proof way to represent the knowledge, given how few infomask  
bits are there to be recycled (there's also some locking issues with  
using infomask bits).  
  
External code following ctid chains should be updated to check for  
moved tuples. The most likely consequence of not doing so is a missed  
error.  
  
Author: Amul Sul, editorialized by me  
Reviewed-By: Amit Kapila, Pavan Deolasee, Andres Freund, Robert Haas  
Discussion: http://postgr.es/m/CAAJ_b95PkwojoYfz0bzXU8OokcTVGzN6vYGCNVUukeUDrnF3dw@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execMerge.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/htup_details.h
M src/include/executor/nodeModifyTable.h
M src/include/storage/itemptr.h
M src/test/isolation/expected/merge-update.out
A src/test/isolation/expected/partition-key-update-1.out
A src/test/isolation/expected/partition-key-update-2.out
A src/test/isolation/expected/partition-key-update-3.out
M src/test/isolation/isolation_schedule
M src/test/isolation/specs/merge-update.spec
A src/test/isolation/specs/partition-key-update-1.spec
A src/test/isolation/specs/partition-key-update-2.spec
A src/test/isolation/specs/partition-key-update-3.spec

Indexes with INCLUDE columns and their support in B-tree

commit   : 8224de4f42ccf98e08db07b43d52fed72f962ebb    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 23:00:39 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 23:00:39 +0300    

Click here for diff

This patch introduces INCLUDE clause to index definition.  This clause  
specifies a list of columns which will be included as a non-key part in  
the index.  The INCLUDE columns exist solely to allow more queries to  
benefit from index-only scans.  Also, such columns don't need to have  
appropriate operator classes.  Expressions are not supported as INCLUDE  
columns since they cannot be used in index-only scans.  
  
Index access methods supporting INCLUDE are indicated by amcaninclude flag  
in IndexAmRoutine.  For now, only B-tree indexes support INCLUDE clause.  
  
In B-tree indexes INCLUDE columns are truncated from pivot index tuples  
(tuples located in non-leaf pages and high keys).  Therefore, B-tree indexes  
now might have variable number of attributes.  This patch also provides  
generic facility to support that: pivot tuples contain number of their  
attributes in t_tid.ip_posid.  Free 13th bit of t_info is used for indicating  
that.  This facility will simplify further support of index suffix truncation.  
The changes of above are backward-compatible, pg_upgrade doesn't need special  
handling of B-tree indexes for that.  
  
Bump catalog version  
  
Author: Anastasia Lubennikova with contribition by Alexander Korotkov and me  
Reviewed by: Peter Geoghegan, Tomas Vondra, Antonin Houska, Jeff Janes,  
			 David Rowley, Alexander Korotkov  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M contrib/bloom/blutils.c
M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql
M contrib/tcn/tcn.c
M doc/src/sgml/btree.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/brin/brin.c
M src/backend/access/common/indextuple.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/spgist/spgutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeIndexscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/sort/tuplesort.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/access/amapi.h
M src/include/access/hash.h
M src/include/access/itup.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_constraint_fn.h
M src/include/catalog/pg_index.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/relation.h
M src/include/parser/kwlist.h
M src/include/utils/rel.h
M src/test/isolation/specs/insert-conflict-do-nothing-2.spec
M src/test/isolation/specs/insert-conflict-do-update-2.spec
M src/test/isolation/specs/lock-committed-keyupdate.spec
M src/test/isolation/specs/lock-update-traversal.spec
M src/test/regress/expected/create_index.out
A src/test/regress/expected/index_including.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/create_index.sql
A src/test/regress/sql/index_including.sql
M src/test/subscription/t/001_rep_changes.pl

Make test of json(b)_to_tsvector language-independ

commit   : 01bb85169afadfe63e2f0e344ff671292080de7e    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 21:29:48 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 21:29:48 +0300    

Click here for diff

Missed in 1c1791e00065f6986f9d44a78ce7c28b2d1322dd commit  

M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Add json(b)_to_tsvector function

commit   : 1c1791e00065f6986f9d44a78ce7c28b2d1322dd    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 20:58:03 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 20:58:03 +0300    

Click here for diff

Jsonb has a complex nature so there isn't best-for-everything way to convert it  
to tsvector for full text search. Current to_tsvector(json(b)) suggests to  
convert only string values, but it's possible to index keys, numerics and even  
booleans value. To solve that json(b)_to_tsvector has a second required  
argument contained a list of desired types of json fields. Second argument is  
a jsonb scalar or array right now with possibility to add new options in a  
future.  
  
Bump catalog version  
  
Author: Dmitry Dolgov with some editorization by me  
Reviewed by: Teodor Sigaev  
Discussion: https://www.postgresql.org/message-id/CA+q6zcXJQbS1b4kJ_HeAOoOc=unfnOrUEL=KGgE32QKDww7d8g@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/jsonapi.h
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Fix timing issue in new subscription truncate test

commit   : 529ab7bd1fb9c836fe5ccd96f79329d407522e20    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Apr 2018 12:57:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Apr 2018 12:57:53 -0400    

Click here for diff

We need to wait for the initial sync of all subscriptions.  On  
some (faster?) machines, this didn't make a difference, but  
the (slower?) buildfarm machines are upset.  

M src/test/subscription/t/010_truncate.pl

Deactive flapping checksum isolation tests.

commit   : bf75fe47e444c01a35992a38a01d32b191f69aca    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 7 Apr 2018 09:23:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 7 Apr 2018 09:23:12 -0700    

Click here for diff

They've been broken for days, and prevent other tests from being  
run. The plan is to revert their addition later.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/isolation_schedule

Logical replication support for TRUNCATE

commit   : 039eb6e92f20499ac36cc74f8a5cef7430b706f6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Apr 2018 11:24:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Apr 2018 11:24:53 -0400    

Click here for diff

Update the built-in logical replication system to make use of the  
previously added logical decoding for TRUNCATE support.  Add the  
required truncate callback to pgoutput and a new logical replication  
protocol message.  
  
Publications get a new attribute to determine whether to replicate  
truncate actions.  When updating a publication via pg_dump from an older  
version, this is not set, thus preserving the previous behavior.  
  
Author: Simon Riggs <[email protected]>  
Author: Marco Nenciarini <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_publication.h
M src/include/replication/logicalproto.h
M src/test/regress/expected/publication.out
A src/test/subscription/t/010_truncate.pl

Logical decoding of TRUNCATE

commit   : 5dfd1e5a6696b271a2cdee54143fbc209c88c02f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Apr 2018 11:17:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Apr 2018 11:17:56 -0400    

Click here for diff

Add a new WAL record type for TRUNCATE, which is only used when  
wal_level >= logical.  (For physical replication, TRUNCATE is already  
replicated via SMGR records.)  Add new callback for logical decoding  
output plugins to receive TRUNCATE actions.  
  
Author: Simon Riggs <[email protected]>  
Author: Marco Nenciarini <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/truncate.out
A contrib/test_decoding/sql/truncate.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/access/heapam_xlog.h
M src/include/commands/tablecmds.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h

Predicate locking in hash indexes.

commit   : b508a56f2f3a2d850e75a14661943d6b4dde8274    
  
author   : Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 16:59:14 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Sat, 7 Apr 2018 16:59:14 +0300    

Click here for diff

Hash index searches acquire predicate locks on the primary  
page of a bucket. It acquires a lock on both the old and new buckets  
for scans that happen concurrently with page splits. During a bucket  
split, a predicate lock is copied from the primary page of an old  
bucket to the primary page of a new bucket.  
  
Author: Shubham Barai, Amit Kapila  
Reviewed by: Amit Kapila, Alexander Korotkov, Thomas Munro  
Discussion: https://www.postgresql.org/message-id/flat/CALxAEPvNsM2GTiXdRgaaZ1Pjd1bs+sxfFsf7Ytr+iq+5JJoYXA@mail.gmail.com  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/storage/lmgr/README-SSI
A src/test/isolation/expected/predicate-hash.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/predicate-hash.spec

Document partprune.c a little better

commit   : 971d7ddbe19ad9525457e65d01b8b6504ab57cc4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 7 Apr 2018 10:35:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 7 Apr 2018 10:35:38 -0300    

Click here for diff

Author: Amit Langote  
Reviewed-by: Ɓlvaro Herrera, David Rowley  
Discussion: https://postgr.es/m/CA+HiwqGzq4D6z=8R0AP+XhbTFCQ-4Ct+t2ekqjE9Fpm84_JUGg@mail.gmail.com  

M src/backend/partitioning/partprune.c

Blindly attempt to fix sepgsql tests broken due to 9fdb675fc5.

commit   : 4f813c7203e0c08395833b2bd75ac9ccf63c6264    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 6 Apr 2018 20:54:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 6 Apr 2018 20:54:22 -0700    

Click here for diff

The failure appears to solely be caused by the changed partition  
pruning logic.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/misc.out

Attempt to fix endianess issues in new hash partition test.

commit   : 40e42e1024c580a50483d788b3f68668da750c64    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 6 Apr 2018 20:17:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 6 Apr 2018 20:17:50 -0700    

Click here for diff

The tests added as part of 9fdb675fc5 yield differing results  
depending on endianess, causing buildfarm failures. As the differences  
are expected, split the hash partitioning tests into a different file  
and maintain alternative output. The separate file is so the amount of  
duplicated output is reduced.  
  
David produced the alternative output without a machine to test on, so  
it's possible this'll require a buildfarm cycle or two to get right.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f-6f4c2Qhuipe-GY7BKmFd0FMBobRnLS7hVCoAmTszsBg@mail.gmail.com  

M src/test/regress/expected/partition_prune.out
A src/test/regress/expected/partition_prune_hash.out
A src/test/regress/expected/partition_prune_hash_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/partition_prune.sql
A src/test/regress/sql/partition_prune_hash.sql

Fix and improve pg_atomic_flag fallback implementation.

commit   : 8c3debbbf61892dabd8b6f3f8d55e600a7901f2b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 6 Apr 2018 19:55:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 6 Apr 2018 19:55:32 -0700    

Click here for diff

The atomics fallback implementation for pg_atomic_flag was broken,  
returning the inverted value from pg_atomic_test_set_flag().  This was  
unnoticed because a) atomic flags were unused until recently b) the  
test code wasn't run when the fallback implementation was in  
use (because it didn't allow to test for some edge cases).  
  
Fix the bug, and improve the fallback so it has the same behaviour as  
the non-fallback implementation in the problematic edge cases. That  
breaks ABI compatibility in the back branches when fallbacks are in  
use, but given they were broken until now...  
  
Author: Andres Freund  
Reported-by: Daniel Gustafsson  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
Backpatch: 9.5-, where the atomics abstraction was introduced.  

M src/backend/port/atomics.c
M src/include/port/atomics/fallback.h
M src/test/regress/regress.c

Doc: fix broken markup.

commit   : eb2a0e00b18aedabd76f5442e38f4bf5d1b94974    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Apr 2018 20:54:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Apr 2018 20:54:52 -0400    

Click here for diff

Commit 3d956d956 was apparently not checked against HEAD's doc toolchain.  
Per buildfarm.  

M doc/src/sgml/ddl.sgml

Fix possible failure in parallel index build.

commit   : 47cb9ca49a611fa518e1a0fe46526507c96a5612    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 19:28:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 19:28:48 -0400    

Click here for diff

Report and proposed fix by David Rowley, put in patch form by  
Peter Geoghegan.  
  
Discussion: http://postgr.es/m/CAKJS1f91kq1wfYR8rnRRfKtxyhU2woEA+=whd640UxMyU+O0EQ@mail.gmail.com  

M src/backend/catalog/index.c

Allow insert and update tuple routing and COPY for foreign tables.

commit   : 3d956d9562aa4811b5eaaaf5314d361c61be2ae0    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 19:16:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 19:16:11 -0400    

Click here for diff

Also enable this for postgres_fdw.  
  
Etsuro Fujita, based on an earlier patch by Amit Langote. The larger  
patch series of which this is a part has been reviewed by Amit  
Langote, David Fetter, Maksim Milyutin, Ɓlvaro Herrera, Stephen Frost,  
and me.  Minor documentation changes to the final version by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ddl.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/update.sgml
M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/execPartition.h
M src/include/foreign/fdwapi.h
M src/include/nodes/execnodes.h

Remove some unnecessary quote marks from catalog DATA lines.

commit   : cb1ff1e5af83f2c548fcb15596d474c198a021c5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Apr 2018 18:58:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Apr 2018 18:58:38 -0400    

Click here for diff

This has no functional impact whatsoever.  However, it causes  
these unnecessary quote marks to disappear from the generated  
postgres.bki file, making it easier to verify that the upcoming  
bootstrap data conversion patch doesn't change the generated file.  

M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h

Fix badly edited doc sentence

commit   : 3cabe3863015efc72d513d3aa3b47d03eed96f49    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Apr 2018 17:41:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Apr 2018 17:41:44 -0300    

Click here for diff

Noted by Vik Fearing and Robert Haas  

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

Clean up intermetiate state in pg_basebackup tests

commit   : 032429701e477116dae9482cc1bf0df8d5ac8f77    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 6 Apr 2018 22:26:31 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 6 Apr 2018 22:26:31 +0200    

Click here for diff

These tests accummulated almost a gigabyte of data during the test which  
was then removed at the end. Instead, remove output that's no longer  
needed between the individual tests, to keep the total disk usage down  
lower.  
  
Author: Michael Banck  

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

Fix typo

commit   : f66c37b2f7b99d1216da9b6267793cfbdc2e58c4    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 6 Apr 2018 22:23:23 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 6 Apr 2018 22:23:23 +0200    

Click here for diff

Author: Michael Banck  

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

Faster partition pruning

commit   : 9fdb675fc5d2de825414e05939727de8b120ae81    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Apr 2018 16:23:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Apr 2018 16:23:04 -0300    

Click here for diff

Add a new module backend/partitioning/partprune.c, implementing a more  
sophisticated algorithm for partition pruning.  The new module uses each  
partition's "boundinfo" for pruning instead of constraint exclusion,  
based on an idea proposed by Robert Haas of a "pruning program": a list  
of steps generated from the query quals which are run iteratively to  
obtain a list of partitions that must be scanned in order to satisfy  
those quals.  
  
At present, this targets planner-time partition pruning, but there exist  
further patches to apply partition pruning at execution time as well.  
  
This commit also moves some definitions from include/catalog/partition.h  
to a new file include/partitioning/partbounds.h, in an attempt to  
rationalize partitioning related code.  
  
Authors: Amit Langote, David Rowley, Dilip Kumar  
Reviewers: Robert Haas, Kyotaro Horiguchi, Ashutosh Bapat, Jesper Pedersen.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile
M src/backend/catalog/partition.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
A src/backend/partitioning/Makefile
A src/backend/partitioning/partprune.c
M src/include/catalog/catversion.h
M src/include/catalog/partition.h
M src/include/catalog/pg_opfamily.h
M src/include/nodes/nodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/planner.h
A src/include/partitioning/partbounds.h
A src/include/partitioning/partprune.h
M src/test/regress/expected/inherit.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Support new default roles with adminpack

commit   : 11523e860f8fe29f9142fb63c44e01cd0d5e7375    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Apr 2018 14:47:10 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Apr 2018 14:47:10 -0400    

Click here for diff

This provides a newer version of adminpack which works with the newly  
added default roles to support GRANT'ing to non-superusers access to  
read and write files, along with related functions (unlinking files,  
getting file length, renaming/removing files, scanning the log file  
directory) which are supported through adminpack.  
  
Note that new versions of the functions are required because an  
environment might have an updated version of the library but still have  
the old adminpack 1.0 catalog definitions (where EXECUTE is GRANT'd to  
PUBLIC for the functions).  
  
This patch also removes the long-deprecated alternative names for  
functions that adminpack used to include and which are now included in  
the backend, in adminpack v1.1.  Applications using the deprecated names  
should be updated to use the backend functions instead.  Existing  
installations which continue to use adminpack v1.0 should continue to  
function until/unless adminpack is upgraded.  
  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/20171231191939.GR2416%40tamriel.snowman.net  

M contrib/adminpack/Makefile
A contrib/adminpack/adminpack–1.0–1.1.sql
M contrib/adminpack/adminpack.c
M contrib/adminpack/adminpack.control
M contrib/adminpack/expected/adminpack.out
M contrib/adminpack/sql/adminpack.sql
M doc/src/sgml/adminpack.sgml
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/misc.c
M src/include/catalog/pg_proc.h

Add default roles for file/program access

commit   : 0fdc8495bff02684142a44ab3bc5b18a8ca1863a    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Apr 2018 14:47:10 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Apr 2018 14:47:10 -0400    

Click here for diff

This patch adds new default roles named 'pg_read_server_files',  
'pg_write_server_files', 'pg_execute_server_program' which  
allow an administrator to GRANT to a non-superuser role the ability to  
access server-side files or run programs through PostgreSQL (as the user  
the database is running as).  Having one of these roles allows a  
non-superuser to use server-side COPY to read, write, or with a program,  
and to use file_fdw (if installed by a superuser and GRANT'd USAGE on  
it) to read from files or run a program.  
  
The existing misc file functions are also changed to allow a user with  
the 'pg_read_server_files' default role to read any files on the  
filesystem, matching the privileges given to that role through COPY and  
file_fdw from above.  
  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/20171231191939.GR2416%40tamriel.snowman.net  

M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/output/file_fdw.source
M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/commands/copy.c
M src/backend/utils/adt/genfile.c
M src/include/catalog/pg_authid.h

Remove explicit superuser checks in favor of ACLs

commit   : e79350fef2917522571add750e3e21af293b50fe    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Apr 2018 14:47:10 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Apr 2018 14:47:10 -0400    

Click here for diff

This removes the explicit superuser checks in the various file-access  
functions in the backend, specifically pg_ls_dir(), pg_read_file(),  
pg_read_binary_file(), and pg_stat_file().  Instead, EXECUTE is REVOKE'd  
from public for these, meaning that only a superuser is able to run them  
by default, but access to them can be GRANT'd to other roles.  
  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/20171231191939.GR2416%40tamriel.snowman.net  

M src/backend/catalog/system_views.sql
M src/backend/utils/adt/genfile.c

Add memory context identifier to portal context

commit   : 94c1f9ba11d1241a2b3b2be7177604b26b08bc3d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 12:34:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 12:34:15 -0400    

Click here for diff

Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Rename MemoryContextCopySetIdentifier() for clarity

commit   : bbca77623fb5e60f5aa5f226998f0f5c7a66bbf0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 12:10:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 12:10:00 -0400    

Click here for diff

MemoryContextCopySetIdentifier -> MemoryContextCopyAndSetIdentifier  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/partition.c
M src/backend/commands/policy.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/ts_cache.c
M src/include/utils/memutils.h

Enforce child constraints during COPY TO a partitioned table.

commit   : cfbecf8100ecb83c07c2017f843b0642580416bf    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 11:42:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 11:42:28 -0400    

Click here for diff

The previous coding inadvertently checked the constraints for the  
partitioned table rather than the target partition, which could  
lead to data in a partition that fails to satisfy some constraint  
on that partition.  This problem seems to date back to when  
table partitioning was introduced; prior to that, there was only  
one target table for a COPY, so the problem didn't occur, and the  
code just didn't get updated.  
  
Etsuro Fujita, reviewed by Amit Langote and Ashutosh Bapat  
  
Discussion: https://postgr.es/message-id/5ABA4074.1090500%40lab.ntt.co.jp  

M src/backend/commands/copy.c

Refactor PgFdwModifyState creation/destruction into separate functions.

commit   : 870d89608e5f891275d0b752560c827dbce3d7b4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 11:29:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Apr 2018 11:29:43 -0400    

Click here for diff

Etsuro Fujita.  The larger patch series of which this is a part has  
been reviewed by Amit Langote, David Fetter, Maksim Milyutin,  
Ɓlvaro Herrera, Stephen Frost, and me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

Split the SetSubscriptionRelState function into two

commit   : bcf79b5bb648d30696406034a61ce0ca3dcb0dea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 10:00:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 10:00:26 -0400    

Click here for diff

We don't actually need the insert-or-update logic, so it's clearer to  
have separate functions for the inserting and updating.  
  
Author: Petr Jelinek <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/include/catalog/pg_subscription_rel.h

Improve messaging during logical replication worker startup

commit   : c25304a945467f6edfcca10d7931b913776d066b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 09:07:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 09:07:09 -0400    

Click here for diff

In case the subscription is removed before the worker is fully started,  
give a specific error message instead of the generic "cache lookup"  
error.  
  
Author: Petr Jelinek <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  

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

Fix compiler warning about format truncation

commit   : 2cd6520e78fe8bbb4ba38f6c7624c002aa8cc481    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 08:43:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Apr 2018 08:43:50 -0400    

Click here for diff

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Improve parse representation for MERGE

commit   : f1464c53804fa7280a7942f6ac08038440f73b11    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 6 Apr 2018 09:38:59 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 6 Apr 2018 09:38:59 +0100    

Click here for diff

Separation of parser data structures from executor, as  
requested by Tom Lane. Further improvements possible.  
  
While there, implement error for multiple VALUES clauses via parser  
to allow line number of error, as requested by Andres Freund.  
  
Author: Pavan Deolasee  
  
Discussion: https://www.postgresql.org/message-id/CABOikdPpqjectFchg0FyTOpsGXyPoqwgC==OLKWuxgBOsrDDZw@mail.gmail.com  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_merge.c
M src/backend/rewrite/rewriteHandler.c
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/merge.out

Attempt to fix win32 build of pg_verify_checksums

commit   : 3b0b4f31f73a5f45f8e122d826211c13cd2412f7    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 22:38:03 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 22:38:03 +0200    

Click here for diff

S_ISLNK doesn't exist on Win32, instead we should use  
pgwin32_is_junction().  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Allow on-line enabling and disabling of data checksums

commit   : 1fde38beaa0c3e66c340efc7cc0dc272d6254bb0    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 21:57:26 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 21:57:26 +0200    

Click here for diff

This makes it possible to turn checksums on in a live cluster, without  
the previous need for dump/reload or logical replication (and to turn it  
off).  
  
Enabling checkusm starts a background process in the form of a  
launcher/worker combination that goes through the entire database and  
recalculates checksums on each and every page. Only when all pages have  
been checksummed are they fully enabled in the cluster. Any failure of  
the process will revert to checksums off and the process has to be  
started.  
  
This adds a new WAL record that indicates the state of checksums, so  
the process works across replicated clusters.  
  
Authors: Magnus Hagander and Daniel Gustafsson  
Review: Tomas Vondra, Michael Banck, Heikki Linnakangas, Andrey Borodin  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/initdb.sgml
A doc/src/sgml/ref/pg_verify_checksums.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/Makefile
M src/backend/postmaster/bgworker.c
A src/backend/postmaster/checksumhelper.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/decode.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/page/README
M src/backend/storage/page/bufpage.c
M src/backend/utils/misc/guc.c
M src/bin/Makefile
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.h
A src/bin/pg_verify_checksums/.gitignore
A src/bin/pg_verify_checksums/Makefile
A src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.h
M src/include/pgstat.h
A src/include/postmaster/checksumhelper.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/test/Makefile
A src/test/checksum/.gitignore
A src/test/checksum/Makefile
A src/test/checksum/README
A src/test/checksum/t/001_standby_checksum.pl
A src/test/isolation/expected/checksum_cancel.out
A src/test/isolation/expected/checksum_enable.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/checksum_cancel.spec
A src/test/isolation/specs/checksum_enable.spec

doc: remove mention of the DMOZ catalog in ltree docs

commit   : c39e903d510064e4415bbadb43e34f6998351cca    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 5 Apr 2018 15:55:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 5 Apr 2018 15:55:41 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAF4Au4xYem_W3KOuxcKct7=G4j8Z3uO9j3DUKTFJqUsfp_9pQg@mail.gmail.com  
  
Author: Oleg Bartunov  
  
Backpatch-through: 9.3  

M doc/src/sgml/ltree.sgml

MERGE syntax diagram correction

commit   : ddb4158579e052ee35313c333256cb1f16ee65fa    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 20:36:23 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 20:36:23 +0100    

Click here for diff

Reported-by: Andrew Gierth  

M doc/src/sgml/ref/merge.sgml

PL/pgSQL: Add support for SET TRANSACTION

commit   : b981275b6531df5a4c4f069571bcb39fc4dee770    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Mar 2018 12:00:51 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Mar 2018 12:00:51 -0400    

Click here for diff

A normal SQL command run inside PL/pgSQL acquires a snapshot, but SET  
TRANSACTION does not work anymore if a snapshot is set.  So we have to  
handle this separately.  
  
Reviewed-by: Alexander Korotkov <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  

M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Allow cpluspluscheck to pass by renaming variable

commit   : 530e69e59b07cf94a65cfde7dd1a8b1c62b44228    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 20:06:02 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 20:06:02 +0100    

Click here for diff

Use of a C++ keyword as a function name caused problems  
  
Reported-by: Ɓlvaro Herrera  

M src/backend/parser/parse_clause.c
M src/include/parser/parse_clause.h

Fix plan cache issue in PL/pgSQL CALL

commit   : b9986551e0c6129300b9d7a387baf2006724b297    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Apr 2018 14:51:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Apr 2018 14:51:56 -0400    

Click here for diff

If we are not going to save the plan, then we need to unset expr->plan  
after we are done, also in error cases.  Otherwise, we get a dangling  
pointer next time around.  
  
This is not the ideal solution.  It would be better if we could convince  
SPI not to associate a cached plan with a resource owner, and then we  
could just save the plan in all cases.  But that would require bigger  
surgery.  
  
Reported-by: Pavel Stehule <[email protected]>  

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

Fix worker_spi for new parameter to initialize connection

commit   : 6a5f796b48b0e9808fef9731da8aea17f56de999    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 19:14:14 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 19:14:14 +0200    

Click here for diff

Missed in previous commit.  
  
Spotted by Teodor and the buildfarm  

M src/test/modules/worker_spi/worker_spi.c

Remove tsearch test contained russian characters, missed in 1664ae1978bf0f5ee940dc2fc8313e6400a7e7da

commit   : 1a8c95365e01c37ff5f51eb803e8ce926fbb0238    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 20:05:04 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 20:05:04 +0300    

Click here for diff

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

Allow background workers to bypass datallowconn

commit   : eed1ce72e1593d3e8b7461d7744808d4d6bf402b    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 18:59:32 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 5 Apr 2018 18:59:32 +0200    

Click here for diff

THis adds a "flags" field to the BackgroundWorkerInitializeConnection()  
and BackgroundWorkerInitializeConnectionByOid(). For now only one flag,  
BGWORKER_BYPASS_ALLOWCONN, is defined, which allows the worker to ignore  
datallowconn.  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/access/transam/parallel.c
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h
M src/include/postmaster/bgworker.h

Add websearch_to_tsquery

commit   : 1664ae1978bf0f5ee940dc2fc8313e6400a7e7da    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 19:55:11 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 19:55:11 +0300    

Click here for diff

Error-tolerant conversion function with web-like syntax for search query,  
it simplifies  constraining search engine with close to habitual interface for  
users.  
  
Bump catalog version  
  
Authors: Victor Drobny, Dmitry Ivanov with editorization by me  
Reviewed by: Aleksander Alekseev, Tomas Vondra, Thomas Munro, Aleksandr Parfenov  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/textsearch.sgml
M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_parser.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/tsearch/ts_utils.h
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

Add missing include

commit   : fbc27330b8f8693d8fa9b1f8cb450567c3d81640    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Apr 2018 12:15:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Apr 2018 12:15:28 -0300    

Click here for diff

Newly added prototype broke cpluspluscheck.  
  
Minor buglet in commit 8694cc96b52a.  

M src/include/storage/reinit.h

Add support of bool, bpchar, name and uuid to btree_gin

commit   : f4cd7102b5a6097fb603c789728fbfd5d6fd43c5    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 18:19:10 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 18:19:10 +0300    

Click here for diff

Mostly for completeness, but I believe there are cases to use that in  
multicolumn GIN indexes.  
  
Bump btree_gin module version  
  
Author: Matheus Oliveira  
Reviewed by: Tomas Vondra  
Discussion: https://www.postgresql.org/message-id/flat/CAJghg4LMJf6Z13fnZD-MBNiGxzd0cA2=F3TDjNkX3eQH58hktQ@mail.gmail.com  

M contrib/btree_gin/Makefile
A contrib/btree_gin/btree_gin–1.2–1.3.sql
M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/btree_gin.control
A contrib/btree_gin/expected/bool.out
A contrib/btree_gin/expected/bpchar.out
A contrib/btree_gin/expected/name.out
A contrib/btree_gin/expected/uuid.out
A contrib/btree_gin/sql/bool.sql
A contrib/btree_gin/sql/bpchar.sql
A contrib/btree_gin/sql/name.sql
A contrib/btree_gin/sql/uuid.sql
M doc/src/sgml/btree-gin.sgml

Fix handling of non-upgraded B-tree metapages

commit   : 0a64b45152b593c5eb95f2e88fbce7fbfe84ae7b    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 17:56:00 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 17:56:00 +0300    

Click here for diff

857f9c36 bumps B-tree metapage version while upgrade is performed "on the fly"  
when needed. However, some asserts fired when old version metapage was  
cached to rel->rd_amcache. Despite new metadata fields are never used from  
rel->rd_amcache, that needs to be fixed. This patch introduces metadata  
upgrade during its caching, which fills unavailable fields with their default  
values. contrib/pageinspect is also patched to handle non-upgraded metapages  
in the same way.  
  
Author: Alexander Korotkov  

M contrib/pageinspect/btreefuncs.c
M src/backend/access/nbtree/nbtpage.c

MERGE minor errata

commit   : 01b88b4df5e2df0365cceaf79a039214d9f05273    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 13:19:13 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 13:19:13 +0100    

Click here for diff

M src/backend/executor/README
M src/backend/executor/execMerge.c
M src/backend/executor/execPartition.c

MERGE fix variable warning in non-assert builds

commit   : 3af7b2b0d497cfc240ffc8098ef068adb30048a2    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 13:02:29 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 13:02:29 +0100    

Click here for diff

Author: Jesper Pedersen  

M src/backend/executor/execMerge.c

MERGE INSERT allows only one VALUES clause

commit   : a5d86181ecc9c441d4c327771c43134de59549cd    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 12:03:42 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 12:03:42 +0100    

Click here for diff

Doc syntax and brief mention of restriction  

M doc/src/sgml/ref/merge.sgml

Remove unused vars and mark assert-only vars

commit   : 17d8beb4f52599805283b1f2f49e02491656f7e1    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 13:16:15 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 13:16:15 +0300    

Click here for diff

Kyotaro HORIGUCHI  

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

Fix misprint in documentation

commit   : a02d51c0d3c0c25d99d2a1cd84f3321640294fa9    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 13:06:05 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 13:06:05 +0300    

Click here for diff

Masahiko Sawada  

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

Fix typo

commit   : 51e6562324f8f03909f1ad1754720e95ae238fad    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 13:04:18 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 5 Apr 2018 13:04:18 +0300    

Click here for diff

Masahiko Sawada  

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

MERGE post-commit review

commit   : 4b2d44031f8c005f6f86364d7663858b6b5bdd14    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 09:54:07 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 5 Apr 2018 09:54:07 +0100    

Click here for diff

Review comments from Andres Freund  
  
* Consolidate code into AfterTriggerGetTransitionTable()  
* Rename nodeMerge.c to execMerge.c  
* Rename nodeMerge.h to execMerge.h  
* Move MERGE handling in ExecInitModifyTable()  
  into a execMerge.c ExecInitMerge()  
* Move mt_merge_subcommands flags into execMerge.h  
* Rename opt_and_condition to opt_merge_when_and_condition  
* Wordsmith various comments  
  
Author: Pavan Deolasee  
Reviewer: Simon Riggs  

M src/backend/commands/trigger.c
M src/backend/executor/Makefile
M src/backend/executor/README
R082 src/backend/executor/nodeMerge.c src/backend/executor/execMerge.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/gram.y
A src/include/executor/execMerge.h
D src/include/executor/nodeMerge.h
M src/include/executor/nodeModifyTable.h

Install errcodes.txt for use by extensions.

commit   : 1fd8690668635bab9dfa16b2885e6e474f8451ba    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 5 Apr 2018 04:05:40 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 5 Apr 2018 04:05:40 +0100    

Click here for diff

Maintainers of out-of-tree PLs typically need access to the set of  
error codes. To avoid the need to duplicate that information in some  
form in PL source trees, provide errcodes.txt as part of a server  
installation.  
  
Thomas Munro, based on a suggestion from Andrew Gierth  
Discussion: https://postgr.es/m/87woykk7mu.fsf%40news-spur.riddles.org.uk  

M src/backend/Makefile
M src/backend/utils/Makefile
M src/tools/msvc/Install.pm

doc: Improve indentation of SQL examples

commit   : a56e26784d7f418015a5be471eb500614a2f24ee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Apr 2018 20:57:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Apr 2018 20:57:26 -0400    

Click here for diff

Some of these were indented using 8 spaces whereas the rest uses 4  
spaces.  Probably originally some difference in tab size.  

M doc/src/sgml/queries.sgml

Restore erroneously removed ONLY from PK check

commit   : 7d7c99790b2a7e6f4e5287a3fb29f73cedbb2105    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 4 Apr 2018 16:36:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 4 Apr 2018 16:36:21 -0300    

Click here for diff

This is a blind fix, since I don't have SE-Linux to verify it.  
  
Per unwanted change in rhinoceros, running sepgsql tests.  Noted by Tom  
Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rewrite pg_dump TAP tests

commit   : 446f7f5d789fe9ecfacd998407b5bee70aaa64f7    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 4 Apr 2018 15:26:51 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 4 Apr 2018 15:26:51 -0400    

Click here for diff

This reworks how the tests to run are defined.  Instead of having to  
define all runs for all tests, we define those tests which should pass  
(generally using one of the defined broad hashes), add in any which  
should be specific for this test, and exclude any specific runs that  
shouldn't pass for this test.  This ends up removing some 4k+ lines  
(more than half the file) but, more importantly, greatly simplifies the  
way runs-to-be-tested are defined.  
  
As discussed in the updated comments, for example, take the test which  
does CREATE TABLE test_table.  That CREATE TABLE should show up in all  
'full' runs of pg_dump, except those cases where 'test_table' is  
excluded, of course, and that's exactly how the test gets defined now  
(modulo a few other related cases, like where we dump only that table,  
or we dump the schema it's in, or we exclude the schema it's in):  
  
like => {  
    %full_runs,  
    %dump_test_schema_runs,  
    only_dump_test_table    => 1,  
    section_pre_data        => 1, },  
unlike => {  
    exclude_dump_test_schema => 1,  
    exclude_test_table => 1, }, },  
  
Next, we no longer expect every run to be listed for every test.  If a  
run is listed in 'like' (directly or through a hash) then it's a 'like',  
unless it's listed in 'unlike' in which case it's an 'unlike'.  If it  
isn't listed in either, then it's considered an 'unlike' automatically.  
  
Lastly, this changes the code to no longer use like/unlike but rather to  
use 'ok()' with 'diag()' which allows much more control over what gets  
spit out to the screen.  Gone are the days of the entire dump being sent  
to the console, now you'll just get a couple of lines for each failing  
test which say the test that failed and the run that it failed on.  
  
This covers both the pg_dump TAP tests in src/bin/pg_dump and those in  
src/test/modules/test_pg_dump.  

M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/modules/test_pg_dump/t/001_base.pl

docs: update ltree URL for the DMOZ catalog

commit   : cd1661bbcc7c20a5c4d00dd114263ea9afe36063    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 4 Apr 2018 15:06:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 4 Apr 2018 15:06:21 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Oleg Bartunov  
  
Backpatch-through: 9.3  

M doc/src/sgml/ltree.sgml

Improve FSM management for BRIN indexes.

commit   : 1383e2a1a937116e1367c9584984f0730f9ef4d5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Apr 2018 14:26:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Apr 2018 14:26:04 -0400    

Click here for diff

BRIN indexes like to propagate additions of free space into the upper pages  
of their free space maps as soon as the new space is known, even when it's  
just on one individual index page.  Previously this required calling  
FreeSpaceMapVacuum, which is quite an expensive thing if the map is large.  
Use the FreeSpaceMapVacuumRange function recently added by commit c79f6df75  
to reduce the amount of work done for this purpose.  
  
Fix a couple of places that neglected to do the upper-page vacuuming at all  
after recording new free space.  If the policy is to be that BRIN should do  
that, it should do it everywhere.  
  
Do RecordPageWithFreeSpace unconditionally in brin_page_cleanup, and do  
FreeSpaceMapVacuum unconditionally in brin_vacuum_scan.  Because of the  
FSM's imprecise storage of free space, the old complications here seldom  
bought anything, they just slowed things down.  This approach also  
provides a predictable path for FSM corruption to be repaired.  
  
Remove premature RecordPageWithFreeSpace call in brin_getinsertbuffer  
where it's about to return an extended page to the caller.  The caller  
should do that, instead, after it's inserted its new tuple.  Fix the  
one caller that forgot to do so.  
  
Simplify logic in brin_doupdate's same-page-update case by postponing  
brin_initialize_empty_new_buffer to after the critical section; I see  
little point in doing it before.  
  
Avoid repeat calls of RelationGetNumberOfBlocks in brin_vacuum_scan.  
Avoid duplicate BufferGetBlockNumber and BufferGetPage calls in  
a couple of places where we already had the right values.  
  
Move a BRIN_elog debug logging call out of a critical section; that's  
pretty unsafe and I don't think it buys us anything to not wait till  
after the critical section.  
  
Move the "*extended = false" step in brin_getinsertbuffer into the  
routine's main loop.  There's no actual bug there, since the loop can't  
iterate with *extended still true, but it doesn't seem very future-proof  
as coded; and it's certainly not documented as a loop invariant.  
  
This is all from follow-on investigation inspired by commit c79f6df75.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/include/access/brin_pageops.h

Foreign keys on partitioned tables

commit   : 3de241dba86f3dd000434f70aebba725fb928032    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 4 Apr 2018 14:02:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 4 Apr 2018 14:02:31 -0300    

Click here for diff

Author: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ri_triggers.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/pg_constraint_fn.h
M src/include/commands/tablecmds.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/foreign_key.sql
M src/test/regress/sql/inherit.sql

Skip full index scan during cleanup of B-tree indexes when possible

commit   : 857f9c36cda520030381bd8c2af20adf0ce0e1d4    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 4 Apr 2018 19:29:00 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 4 Apr 2018 19:29:00 +0300    

Click here for diff

Vacuum of index consists from two stages: multiple (zero of more) ambulkdelete  
calls and one amvacuumcleanup call. When workload on particular table  
is append-only, then autovacuum isn't intended to touch this table. However,  
user may run vacuum manually in order to fill visibility map and get benefits  
of index-only scans. Then ambulkdelete wouldn't be called for indexes  
of such table (because no heap tuples were deleted), only amvacuumcleanup would  
be called In this case, amvacuumcleanup would perform full index scan for  
two objectives: put recyclable pages into free space map and update index  
statistics.  
  
This patch allows btvacuumclanup to skip full index scan when two conditions  
are satisfied: no pages are going to be put into free space map and index  
statistics isn't stalled. In order to check first condition, we store  
oldest btpo_xact in the meta-page. When it's precedes RecentGlobalXmin, then  
there are some recyclable pages. In order to check second condition we store  
number of heap tuples observed during previous full index scan by cleanup.  
If fraction of newly inserted tuples is less than  
vacuum_cleanup_index_scale_factor, then statistics isn't considered to be  
stalled. vacuum_cleanup_index_scale_factor can be defined as both reloption and GUC (default).  
  
This patch bumps B-tree meta-page version. Upgrade of meta-page is performed  
"on the fly": during VACUUM meta-page is rewritten with new version. No special  
handling in pg_upgrade is required.  
  
Author: Masahiko Sawada, Alexander Korotkov  
Review by: Peter Geoghegan, Kyotaro Horiguchi, Alexander Korotkov, Yura Sokolov  
Discussion: https://www.postgresql.org/message-id/flat/CAD21AoAX+d2oD_nrd9O2YkpzHaFr=uQeGr9s1rKC3O4ENc568g@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/pageinspect/Makefile
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/btree.out
A contrib/pageinspect/pageinspect–1.6–1.7.sql
M contrib/pageinspect/pageinspect.control
M contrib/pgstattuple/expected/pgstattuple.out
M doc/src/sgml/config.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/miscadmin.h
M src/include/utils/rel.h
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql

Remove less-portable-than-believed test case.

commit   : eac93e20afe434a79e81558c17a7a1408cf9d74a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Apr 2018 11:51:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Apr 2018 11:51:36 -0400    

Click here for diff

In commit 331b2369c I added a test to see what jsonb_plperl would do  
with a qr{} result.  Turns out the answer is Perl version dependent.  
That fact doesn't bother me particularly, but coping with multiple  
result possibilities is way more work than this test seems worth.  
So remove it again.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix platform and Perl-version dependencies in new jsonb_plperl code.

commit   : 331b2369c0ad1e51d5e50bf5dd75232e0160553a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Apr 2018 11:28:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Apr 2018 11:28:33 -0400    

Click here for diff

Testing SvTYPE() directly is more fraught with problems than one might  
think, because depending on context Perl might be storing a scalar value  
in one of several forms, eg both numeric and string values.  This resulted  
in Perl-version-dependent buildfarm test failures.  Instead use the SvTYPE  
test only to distinguish non-scalar cases (AV, HV, NULL).  Disambiguate  
scalars by testing SvIOK, SvNOK, then SvPOK.  This creates a preference  
order for how we will resolve cases where the value is available in more  
than one form, which seems fine to me.  
  
Furthermore, because we're now dealing directly with a "double" value  
in the SvNOK case, we can get rid of an inadequate and unportable  
string-comparison test for infinities, and use isinf() instead.  
(We do need some additional #include and "-lm" infrastructure to use  
that in a contrib module, per prior experiences.)  
  
In passing, prevent the regression test results from depending on DROP  
CASCADE order; I've not seen that malfunction, but it's trouble waiting  
to happen.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix the new ARMv8 CRC code for short and unaligned input.

commit   : 3a5e0a91bb324ad2b2b1a0623a3f2e37772b43fc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 14:40:20 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 14:40:20 +0300    

Click here for diff

The code before the main loop, to handle the possible 1-7 unaligned bytes  
at the beginning of the input, was broken, and read past the input, if the  
the input was very short.  

M src/port/pg_crc32c_armv8.c

Fix pg_bsaebackup checksum tests

commit   : ee9e1455310ec57774ca67158571bec5d3288cdf    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 4 Apr 2018 11:35:48 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 4 Apr 2018 11:35:48 +0200    

Click here for diff

Hopefully fix the fact that these checks are unstable, by introducing  
the corruption in a separate table from pg_class, and also explicitly  
disable autovacuum on those tables. Also make sure PostgreSQL is  
stopped while the corruption is introduced to avoid possible caching  
effects.  
  
Author: Michael Banck  

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

Use ARMv8 CRC instructions where available.

commit   : f044d71e331d77a0039cec0a11859b5a3c72bc95    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 12:22:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 12:22:45 +0300    

Click here for diff

ARMv8 introduced special CPU instructions for calculating CRC-32C. Use  
them, when available, for speed.  
  
Like with the similar Intel CRC instructions, several factors affect  
whether the instructions can be used. The compiler intrinsics for them must  
be supported by the compiler, and the instructions must be supported by the  
target architecture. If the compilation target architecture does not  
support the instructions, but adding "-march=armv8-a+crc" makes them  
available, then we compile the code with a runtime check to determine if  
the host we're running on supports them or not.  
  
For the runtime check, use glibc getauxval() function. Unfortunately,  
that's not very portable, but I couldn't find any more portable way to do  
it. If getauxval() is not available, the CRC instructions will still be  
used if the target architecture supports them without any additional  
compiler flags, but the runtime check will not be available.  
  
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres  
Freund, Thomas Munro.  
  
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com  

M config/c-compiler.m4
M configure
M configure.in
M src/Makefile.global.in
M src/include/pg_config.h.in
M src/include/port/pg_crc32c.h
M src/port/Makefile
A src/port/pg_crc32c_armv8.c
A src/port/pg_crc32c_armv8_choose.c
R078 src/port/pg_crc32c_choose.c src/port/pg_crc32c_sse42_choose.c
M src/tools/msvc/Mkvcbuild.pm

Also fix the descriptions in pg_config.h.win32.

commit   : 638a199fa9459dac42b588ccfcf7003539f37416    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 11:33:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 11:33:39 +0300    

Click here for diff

I missed pg_config.h.win32 in the previous commit that fixed these in  
pg_config.h.in.  

M src/include/pg_config.h.win32

Fix incorrect description of USE_SLICING_BY_8_CRC32C.

commit   : 8989f52b1b0636969545e6c8f6c813bc563ebcf5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 11:20:53 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Apr 2018 11:20:53 +0300    

Click here for diff

And a typo in the description of USE_SSE42_CRC32C_WITH_RUNTIME_CHECK,  
spotted by Daniel Gustafsson.  

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

Don't clone internal triggers to partitions

commit   : 851f4b4e143063719553bccc73119a0d29fb1afc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Apr 2018 19:01:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Apr 2018 19:01:34 -0300    

Click here for diff

Trigger cloning to partitions was supposed to occur for user-visible  
triggers only, but during development the protection that prevented it  
from occurring to internal triggers was lost.  Reinstate it, as well as  
add a test case to ensure internal triggers (in the tested case,  
triggers implementing a deferred unique constraint) are not cloned.  
Without the code fix, the partitions in the test end up with different  
numbers of triggers, which is clearly wrong ...  
  
Bug in 86f575948c77.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix GCC 7 snprintf() compiler warning.

commit   : 2b3031559a607833e4e265bb9726d52f398661e0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Apr 2018 14:08:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Apr 2018 14:08:41 -0700    

Click here for diff

Make buffer 1 byte larger to fit a sign.  It's actually impossible for  
there to be a sign in practice, but this is still required to keep GCC 7  
happy.  
  
Cleanup from commit 51bc271790eb234a1ba4d14d3e6530f70de92ab5.  
  
Based on a suggestion from Peter Eisentraut.  
  
Author: Peter Geoghegan  
Reported-By: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_bloomfilter/test_bloomfilter.c

Pass correct TupDesc to ri_NullCheck() in Assert

commit   : cd5005bc12d0f9a15fe7dddd3e1ac92496608114    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Apr 2018 18:01:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Apr 2018 18:01:22 -0300    

Click here for diff

Previous coding was passing the wrong table's tuple descriptor, which  
accidentally fails to fail because no existing test case exercises a  
foreign key in which the referenced attributes are further to the right  
of the referencing attributes.  
  
Add a test so that further breakage is visible.  
  
This got broken in 16828d5c0273.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent accidental linking of system-supplied copies of libpq.so etc.

commit   : dddfc4cb2edcfa5497f5d50190a7fb046c51da16    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Apr 2018 16:26:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Apr 2018 16:26:05 -0400    

Click here for diff

We were being careless in some places about the order of -L switches in  
link command lines, such that -L switches referring to external directories  
could come before those referring to directories within the build tree.  
This made it possible to accidentally link a system-supplied library, for  
example /usr/lib/libpq.so, in place of the one built in the build tree.  
Hilarity ensued, the more so the older the system-supplied library is.  
  
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL  
and the main LDFLAGS variable, both of which are "recursively expanded"  
so that they can be incrementally adjusted by different makefiles.  
Establish a policy that -L switches for directories in the build tree  
must always be added to LDFLAGS_INTERNAL, while -L switches for external  
directories must always be added to LDFLAGS.  This is sufficient to  
ensure a safe search order.  For simplicity, we typically also put -l  
switches for the respective libraries into those same variables.  
(Traditional make usage would have us put -l switches into LIBS, but  
cleaning that up is a project for another day, as there's no clear  
need for it.)  
  
This turns out to also require separating SHLIB_LINK into two variables,  
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which  
switches go into which variable.  And likewise for PG_LIBS.  
  
Although this change might appear to affect external users of pgxs.mk,  
I think it doesn't; they shouldn't have any need to touch the _INTERNAL  
variables.  
  
In passing, tweak src/common/Makefile so that the value of CPPFLAGS  
recorded in pg_config lacks "-DFRONTEND" and the recorded value of  
LDFLAGS lacks "-L../../../src/common".  Both of those things are  
mistakes, apparently introduced during prior code rearrangements,  
as old versions of pg_config don't print them.  In general we don't  
want anything that's specific to the src/common subdirectory to  
appear in those outputs.  
  
This is certainly a bug fix, but in view of the lack of field  
complaints, I'm unsure whether it's worth the risk of back-patching.  
In any case it seems wise to see what the buildfarm makes of it first.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/Makefile
M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/jsonb_plperl/Makefile
M contrib/jsonb_plpython/Makefile
M contrib/ltree_plpython/Makefile
M contrib/oid2name/Makefile
M contrib/postgres_fdw/Makefile
M contrib/spi/Makefile
M contrib/vacuumlo/Makefile
M src/Makefile.global.in
M src/Makefile.shlib
M src/backend/replication/libpqwalreceiver/Makefile
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/common/Makefile
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/test/Makefile.regress
M src/interfaces/ecpg/test/compat_informix/Makefile
M src/interfaces/libpq/test/Makefile
M src/makefiles/pgxs.mk
M src/test/examples/Makefile
M src/tools/findoidjoins/Makefile

Suppress compiler warning in new jsonb_plperl code.

commit   : d4a4c3d5b433513fc38ce60e454d2c86e8bd0ed4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Apr 2018 14:47:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Apr 2018 14:47:26 -0400    

Click here for diff

Some compilers are evidently pickier than others about whether Perl's  
I32 typedef should be considered equivalent to int.  Dodge the problem  
by using a separate variable; the prior coding was a bit confusing anyway.  
  
Per buildfarm.  Note this does nothing to fix the test failures due to  
SV_to_JsonbValue not covering enough variable types.  

M contrib/jsonb_plperl/jsonb_plperl.c

C comment: mention null handling in BuildTupleFromCStrings()

commit   : 242408dbef283ff148a3a671a7f4ebbad6118b22    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Apr 2018 14:01:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Apr 2018 14:01:14 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAFjFpRcF-wNbe0w-m3NpkEwr9shmOZ=GoESOzd2Wog9h55J8sA@mail.gmail.com  
  
Author: Ashutosh Bapat  

M src/backend/executor/execTuples.c

Add prefix operator for TEXT type.

commit   : 710d90da1fd8c1d028215ecaf7402062079e99e9    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 3 Apr 2018 19:46:45 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 3 Apr 2018 19:46:45 +0300    

Click here for diff

The prefix operator along with SP-GiST indexes can be used as an alternative  
for LIKE 'word%' commands  and it doesn't have a limitation of string/prefix  
length as B-Tree has.  
  
Bump catalog version  
  
Author: Ildus Kurbangaliev with some editorization by me  
Review by: Arthur Zakirov, Alexander Korotkov, and me  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/spgist.sgml
M src/backend/access/spgist/spgtextproc.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varlena.c
M src/include/access/stratnum.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/create_index.sql

Attempt to fix jsonb_plperl build on Windows

commit   : 4ab299981576ca0f3dbb879b5e2b704e743d87f3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Apr 2018 10:43:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Apr 2018 10:43:16 -0400    

Click here for diff

M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/vcregress.pl

Properly use INT64_FORMAT in output

commit   : 10d62d1065290469ae79518f8166550b2760dc26    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 3 Apr 2018 16:38:46 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 3 Apr 2018 16:38:46 +0200    

Click here for diff

Per buildfarm animal prairiedog, suggestion solution from Tom.  

M src/backend/replication/basebackup.c

Transforms for jsonb to PL/Perl

commit   : 341e1661805879db958dde0a9ed1dc44b1bb10c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Apr 2018 09:47:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Apr 2018 09:47:18 -0400    

Click here for diff

Add a new contrib module jsonb_plperl that provides a transform between  
jsonb and PL/Perl.  jsonb values are converted to appropriate Perl types  
such as arrays and hashes, and vice versa.  
  
Author: Anthony Bykov <[email protected]>  
Reviewed-by: Pavel Stehule <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Nikita Glukhov <[email protected]>  

M contrib/Makefile
A contrib/jsonb_plperl/.gitignore
A contrib/jsonb_plperl/Makefile
A contrib/jsonb_plperl/expected/jsonb_plperl.out
A contrib/jsonb_plperl/expected/jsonb_plperlu.out
A contrib/jsonb_plperl/jsonb_plperl–1.0.sql
A contrib/jsonb_plperl/jsonb_plperl.c
A contrib/jsonb_plperl/jsonb_plperl.control
A contrib/jsonb_plperl/jsonb_plperlu–1.0.sql
A contrib/jsonb_plperl/jsonb_plperlu.control
A contrib/jsonb_plperl/sql/jsonb_plperl.sql
A contrib/jsonb_plperl/sql/jsonb_plperlu.sql
M doc/src/sgml/json.sgml

Fix for checksum validation patch

commit   : a08dc711952081d63577fc182fcf955958f70add    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 3 Apr 2018 13:57:49 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 3 Apr 2018 13:57:49 +0200    

Click here for diff

Reorder the check for non-BLCKSZ size reads to make sure we don't abort  
sending the file in this case.  
  
Missed in the previous commit.  

M src/backend/replication/basebackup.c

Validate page level checksums in base backups

commit   : 4eb77d50c21ddd35b77421c27e0d7853eb4f9202    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 3 Apr 2018 13:47:16 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 3 Apr 2018 13:47:16 +0200    

Click here for diff

When base backups are run over the replication protocol (for example  
using pg_basebackup), verify the checksums of all data blocks if  
checksums are enabled. If checksum failures are encountered, log them  
as warnings but don't abort the backup.  
  
This becomes the default behaviour in pg_basebackup (provided checksums  
are enabled on the server), so add a switch (-k) to disable the checks  
if necessary.  
  
Author: Michael Banck  
Reviewed-By: Magnus Hagander, David Steele  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Tab completion for MERGE

commit   : 4923550c20ae6d122ae0867480a7de8b040f7d80    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 12:18:25 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 12:18:25 +0100    

Click here for diff

Author: Pavan Deolasee  

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

WITH support in MERGE

commit   : aa3faa3c7a7a49b3318059ccaf79bc1886a64707    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 12:13:59 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 12:13:59 +0100    

Click here for diff

Author: Peter Geoghegan  
Recursive support removed, no tests  
Docs added by me  

M doc/src/sgml/ref/merge.sgml
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_merge.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/merge.out
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

New files for MERGE

commit   : 83454e3c2b28141c0db01c7d2027e01040df5249    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 10:22:21 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 10:22:21 +0100    

Click here for diff

A doc/src/sgml/ref/merge.sgml
A src/backend/executor/nodeMerge.c
A src/backend/parser/parse_merge.c
A src/include/executor/nodeMerge.h
A src/include/parser/parse_merge.h
A src/test/isolation/expected/merge-delete.out
A src/test/isolation/expected/merge-insert-update.out
A src/test/isolation/expected/merge-match-recheck.out
A src/test/isolation/expected/merge-update.out
A src/test/isolation/specs/merge-delete.spec
A src/test/isolation/specs/merge-insert-update.spec
A src/test/isolation/specs/merge-match-recheck.spec
A src/test/isolation/specs/merge-update.spec
A src/test/regress/expected/merge.out
A src/test/regress/sql/merge.sql

MERGE SQL Command following SQL:2016

commit   : d204ef63776b8a00ca220adec23979091564e465    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 09:28:16 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 3 Apr 2018 09:28:16 +0100    

Click here for diff

MERGE performs actions that modify rows in the target table  
using a source table or query. MERGE provides a single SQL  
statement that can conditionally INSERT/UPDATE/DELETE rows  
a task that would other require multiple PL statements.  
e.g.  
  
MERGE INTO target AS t  
USING source AS s  
ON t.tid = s.sid  
WHEN MATCHED AND t.balance > s.delta THEN  
  UPDATE SET balance = t.balance - s.delta  
WHEN MATCHED THEN  
  DELETE  
WHEN NOT MATCHED AND s.delta > 0 THEN  
  INSERT VALUES (s.sid, s.delta)  
WHEN NOT MATCHED THEN  
  DO NOTHING;  
  
MERGE works with regular and partitioned tables, including  
column and row security enforcement, as well as support for  
row, statement and transition triggers.  
  
MERGE is optimized for OLTP and is parameterizable, though  
also useful for large scale ETL/ELT. MERGE is not intended  
to be used in preference to existing single SQL commands  
for INSERT, UPDATE or DELETE since there is some overhead.  
MERGE can be used statically from PL/pgSQL.  
  
MERGE does not yet support inheritance, write rules,  
RETURNING clauses, updatable views or foreign tables.  
MERGE follows SQL Standard per the most recent SQL:2016.  
  
Includes full tests and documentation, including full  
isolation tests to demonstrate the concurrent behavior.  
  
This version written from scratch in 2017 by Simon Riggs,  
using docs and tests originally written in 2009. Later work  
from Pavan Deolasee has been both complex and deep, leaving  
the lead author credit now in his hands.  
Extensive discussion of concurrency from Peter Geoghegan,  
with thanks for the time and effort contributed.  
  
Various issues reported via sqlsmith by Andreas Seltenreich  
  
Authors: Pavan Deolasee, Simon Riggs  
Reviewer: Peter Geoghegan, Amit Langote, Tomas Vondra, Simon Riggs  
  
Discussion:  
https://postgr.es/m/CANP8+jKitBSrB7oTgT9CY2i1ObfOt36z0XMraQc+Xrz8QB0nXA@mail.gmail.com  
https://postgr.es/m/CAH2-WzkJdBuxj9PO=2QaO9-3h3xGbQPZ34kJH=HukRekwM-GZg@mail.gmail.com  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/libpq.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/trigger.sgml
M src/backend/access/heap/heapam.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/backend/commands/trigger.c
M src/backend/executor/Makefile
M src/backend/executor/README
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/include/access/heapam.h
M src/include/commands/trigger.h
M src/include/executor/execPartition.h
M src/include/executor/instrument.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_node.h
M src/include/rewrite/rewriteHandler.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/isolation/isolation_schedule
M src/test/regress/expected/identity.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/triggers.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/identity.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/triggers.sql
M src/tools/pgindent/typedefs.list

Revert "MERGE SQL Command following SQL:2016"

commit   : aa5877bb26347c58a34aee4e460eb1e1123bb096    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:36:38 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:36:38 +0100    

Click here for diff

This reverts commit e6597dc3533946b98acba7871bd4ca1f7a3d4c1d.  

D doc/src/sgml/ref/merge.sgml
D src/backend/executor/nodeMerge.c
D src/backend/parser/parse_merge.c
D src/include/executor/nodeMerge.h
D src/include/parser/parse_merge.h
D src/test/isolation/expected/merge-delete.out
D src/test/isolation/expected/merge-insert-update.out
D src/test/isolation/expected/merge-match-recheck.out
D src/test/isolation/expected/merge-update.out
D src/test/isolation/specs/merge-delete.spec
D src/test/isolation/specs/merge-insert-update.spec
D src/test/isolation/specs/merge-match-recheck.spec
D src/test/isolation/specs/merge-update.spec
D src/test/regress/expected/merge.out
D src/test/regress/sql/merge.sql

Revert "Modified files for MERGE"

commit   : 7cf8a5c302735d193dcf901b87e03e324903c632    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:34:15 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:34:15 +0100    

Click here for diff

This reverts commit 354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb.  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/libpq.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/trigger.sgml
M src/backend/access/heap/heapam.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/backend/commands/trigger.c
M src/backend/executor/Makefile
M src/backend/executor/README
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/include/access/heapam.h
M src/include/commands/trigger.h
M src/include/executor/execPartition.h
M src/include/executor/instrument.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_node.h
M src/include/rewrite/rewriteHandler.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/isolation/isolation_schedule
M src/test/regress/expected/identity.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/triggers.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/identity.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/triggers.sql
M src/tools/pgindent/typedefs.list

Modified files for MERGE

commit   : 354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:12:47 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:12:47 +0100    

Click here for diff

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/libpq.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/trigger.sgml
M src/backend/access/heap/heapam.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/backend/commands/trigger.c
M src/backend/executor/Makefile
M src/backend/executor/README
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/include/access/heapam.h
M src/include/commands/trigger.h
M src/include/executor/execPartition.h
M src/include/executor/instrument.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_node.h
M src/include/rewrite/rewriteHandler.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/isolation/isolation_schedule
M src/test/regress/expected/identity.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/triggers.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/identity.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/triggers.sql
M src/tools/pgindent/typedefs.list

MERGE SQL Command following SQL:2016

commit   : e6597dc3533946b98acba7871bd4ca1f7a3d4c1d    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:04:35 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 2 Apr 2018 21:04:35 +0100    

Click here for diff

MERGE performs actions that modify rows in the target table  
using a source table or query. MERGE provides a single SQL  
statement that can conditionally INSERT/UPDATE/DELETE rows  
a task that would other require multiple PL statements.  
e.g.  
  
MERGE INTO target AS t  
USING source AS s  
ON t.tid = s.sid  
WHEN MATCHED AND t.balance > s.delta THEN  
  UPDATE SET balance = t.balance - s.delta  
WHEN MATCHED THEN  
  DELETE  
WHEN NOT MATCHED AND s.delta > 0 THEN  
  INSERT VALUES (s.sid, s.delta)  
WHEN NOT MATCHED THEN  
  DO NOTHING;  
  
MERGE works with regular and partitioned tables, including  
column and row security enforcement, as well as support for  
row, statement and transition triggers.  
  
MERGE is optimized for OLTP and is parameterizable, though  
also useful for large scale ETL/ELT. MERGE is not intended  
to be used in preference to existing single SQL commands  
for INSERT, UPDATE or DELETE since there is some overhead.  
MERGE can be used statically from PL/pgSQL.  
  
MERGE does not yet support inheritance, write rules,  
RETURNING clauses, updatable views or foreign tables.  
MERGE follows SQL Standard per the most recent SQL:2016.  
  
Includes full tests and documentation, including full  
isolation tests to demonstrate the concurrent behavior.  
  
This version written from scratch in 2017 by Simon Riggs,  
using docs and tests originally written in 2009. Later work  
from Pavan Deolasee has been both complex and deep, leaving  
the lead author credit now in his hands.  
Extensive discussion of concurrency from Peter Geoghegan,  
with thanks for the time and effort contributed.  
  
Various issues reported via sqlsmith by Andreas Seltenreich  
  
Authors: Pavan Deolasee, Simon Riggs  
Reviewers: Peter Geoghegan, Amit Langote, Tomas Vondra, Simon Riggs  
  
Discussion:  
https://postgr.es/m/CANP8+jKitBSrB7oTgT9CY2i1ObfOt36z0XMraQc+Xrz8QB0nXA@mail.gmail.com  
https://postgr.es/m/CAH2-WzkJdBuxj9PO=2QaO9-3h3xGbQPZ34kJH=HukRekwM-GZg@mail.gmail.com  

A doc/src/sgml/ref/merge.sgml
A src/backend/executor/nodeMerge.c
A src/backend/parser/parse_merge.c
A src/include/executor/nodeMerge.h
A src/include/parser/parse_merge.h
A src/test/isolation/expected/merge-delete.out
A src/test/isolation/expected/merge-insert-update.out
A src/test/isolation/expected/merge-match-recheck.out
A src/test/isolation/expected/merge-update.out
A src/test/isolation/specs/merge-delete.spec
A src/test/isolation/specs/merge-insert-update.spec
A src/test/isolation/specs/merge-match-recheck.spec
A src/test/isolation/specs/merge-update.spec
A src/test/regress/expected/merge.out
A src/test/regress/sql/merge.sql

Fix XML syntax in documentation

commit   : a92f24fc53a83ed6f3b2188bdc298f1c8a4a91ee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Apr 2018 13:56:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Apr 2018 13:56:40 -0400    

Click here for diff

M doc/src/sgml/fdwhandler.sgml

Fix some dubious WAL-parsing code.

commit   : b01f32c313f00846b6f06cf871d0d9ce7c3ad5e5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Apr 2018 13:46:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Apr 2018 13:46:13 -0400    

Click here for diff

Coverity complained about possible buffer overrun in two places added by  
commit 1eb6d6527, and AFAICS it's reasonable to worry: even granting that  
the WAL originator properly truncated the commit GID to GIDSIZE, we should  
not really bet our lives on that having the same value as it does in the  
current build.  Hence, use strlcpy() not strcpy(), and adjust the pointer  
advancement logic to be sure we skip over the whole source string even if  
strlcpy() truncated it.  

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

psql: Fix \ef, \sf tab completion

commit   : 05e85d35afb0a58080d6a1a0b582bf8a6471c7f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Apr 2018 12:46:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Apr 2018 12:46:24 -0400    

Click here for diff

\ef and \sf take any kind of routine, not just normal functions.  
  
Author: Pavel Stehule <[email protected]>  

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

Remove contrib/jsonb_plpython's tests for infinity and NaN conversions.

commit   : 6278a2a262b63faaf47eb2371f6bcb5b6e3ff118    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Apr 2018 12:36:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Apr 2018 12:36:21 -0400    

Click here for diff

These tests don't work reliably with pre-2.6 Python versions, since  
Python code like float('inf') was not guaranteed to work before that,  
even granting an IEEE-compliant platform.  
  
Since there's no explicit handling of these cases in jsonb_plpython,  
we're not adding any real code coverage by testing them, and thus  
it doesn't seem to make sense to go to any great lengths to work  
around the test instability.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/jsonb_plpython/expected/jsonb_plpython.out
M contrib/jsonb_plpython/sql/jsonb_plpython.sql

Teach configure --with-python to report the Python version number.

commit   : beff4bb9c7411cfd973e192df05c0c1f5c796d22    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Apr 2018 12:26:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Apr 2018 12:26:09 -0400    

Click here for diff

We already do this for Perl and some other interesting tools, so it  
seems sensible to do it for Python as well, especially since the  
sub-release number is never determinable from other configure output  
and even the major/minor numbers may not be clear without excavation  
in config.log.  
  
While at it, get rid of the code's assumption that both the major and  
minor numbers contain exactly one digit.  That will foreseeably be  
broken by Python 3.10 in perhaps four or five years.  That's far enough  
out that we probably don't need to back-patch this.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/python.m4
M configure

Make be-secure-common.c more consistent for future SSL implementations

commit   : 2764d5dcfa84d240c901c20ec6e194f72d82b78a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Apr 2018 11:34:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Apr 2018 11:34:52 -0400    

Click here for diff

Recent commit 8a3d9425 has introduced be-secure-common.c, which is aimed  
at including backend-side APIs that can be used by any SSL  
implementation.  The purpose is similar to fe-secure-common.c for the  
frontend-side APIs.  
  
However, this has forgotten to include check_ssl_key_file_permissions()  
in the move, which causes a double dependency between be-secure.c and  
be-secure-openssl.c.  
  
Refactor the code in a more logical way.  This also puts into light an  
API which is usable by future SSL implementations for permissions on SSL  
key files.  
  
Author: Michael Paquier <[email protected]>  

M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure.c
M src/include/libpq/libpq.h

postgres_fdw: Push down partition-wise aggregation.

commit   : 7e0d64c7a57e28fbcf093b6da9310a38367c1d75    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 Apr 2018 10:51:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 Apr 2018 10:51:50 -0400    

Click here for diff

Since commit 7012b132d07c2b4ea15b0b3cb1ea9f3278801d98, postgres_fdw  
has been able to push down the toplevel aggregation operation to the  
remote server.  Commit e2f1eb0ee30d144628ab523432320f174a2c8966 made  
it possible to break down the toplevel aggregation into one  
aggregate per partition.  This commit lets postgres_fdw push down  
aggregation in that case just as it does at the top level.  
  
In order to make this work, this commit adds an additional argument  
to the GetForeignUpperPaths FDW API.  A matching argument is added  
to the signature for create_upper_paths_hook.  Third-party code using  
either of these will need to be updated.  
  
Also adjust create_foreignscan_plan() so that it picks up the correct  
set of relids in this case.  
  
Jeevan Chalke, reviewed by Ashutosh Bapat and by me and with some  
adjustments by me.  The larger patch series of which this patch is a  
part was also reviewed and tested by Antonin Houska, Rajkumar  
Raghuwanshi, David Rowley, Dilip Kumar, Konstantin Knizhnik, Pascal  
Legrand, and Rafia Sabih.  
  
Discussion: http://postgr.es/m/CAM2+6=V64_xhstVHie0Rz=KPEQnLJMZt_e314P0jaT_oJ9MR8A@mail.gmail.com  
Discussion: http://postgr.es/m/CAM2+6=XPWujjmj5zUaBTGDoB38CemwcPmjkRy0qOcsQj_V+2sQ@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/include/foreign/fdwapi.h
M src/include/optimizer/planner.h

Fix a boatload of typos in C comments.

commit   : 0b11a674fb11cc1571326c861ecdd7773d9e587f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Apr 2018 15:01:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Apr 2018 15:01:28 -0400    

Click here for diff

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

M contrib/pgcrypto/rijndael.c
M src/backend/access/common/session.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/executor/execProcnode.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/plan/planner.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/storage/ipc/ipc.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/sort/sharedtuplestore.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/crosstabview.h
M src/include/access/hash.h
M src/include/executor/hashjoin.h
M src/include/executor/nodeAgg.h
M src/include/executor/tablefunc.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/lib/dshash.h
M src/include/mb/pg_wchar.h
M src/include/nodes/relation.h
M src/include/port.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/pl/plpython/plpy_util.c

Fix non-portable use of round().

commit   : 686d399f2be6eea4b74d59cdadd427d09cb0e246    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 31 Mar 2018 20:26:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 31 Mar 2018 20:26:47 -0700    

Click here for diff

round() is from C99.  Use rint() instead.  There are behavioral  
differences between round() and rint(), but they should not matter to  
the Bloom filter optimal_k() function.  We already assume POSIX  
behavior for rint(), so there is no question of rint() not using  
"rounds towards nearest" as its rounding mode.  
  
Cleanup from commit 51bc271790eb234a1ba4d14d3e6530f70de92ab5.  
  
Per buildfarm member thrips.  
  
Author: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzn76eCGUonARy-wrVtMHsf+4cvbK_oJAWTLfORTU5ki0w@mail.gmail.com  

M src/backend/lib/bloomfilter.c

Add amcheck verification of heap relations belonging to btree indexes.

commit   : 7f563c09f8901f6acd72cb8fba7b1bd3cf3aca8e    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 31 Mar 2018 19:52:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 31 Mar 2018 19:52:01 -0700    

Click here for diff

Add a new, optional, capability to bt_index_check() and  
bt_index_parent_check():  check that each heap tuple that should have an  
index entry does in fact have one.  The extra checking is performed at  
the end of the existing nbtree checks.  
  
This is implemented by using a Bloom filter data structure.  The  
implementation performs set membership tests within a callback (the same  
type of callback that each index AM registers for CREATE INDEX).  The  
Bloom filter is populated during the initial index verification scan.  
  
Reusing the CREATE INDEX infrastructure allows the new verification  
option to automatically benefit from the heap consistency checks that  
CREATE INDEX already performs.  CREATE INDEX does thorough sanity  
checking of HOT chains, so the new check actually manages to detect  
problems in heap-only tuples.  
  
Author: Peter Geoghegan  
Reviewed-By: Pavan Deolasee, Andres Freund  
Discussion: https://postgr.es/m/CAH2-Wzm5VmG7cu1N-H=nnS57wZThoSDQU+F5dewx3o84M+jY=g@mail.gmail.com  

M contrib/amcheck/Makefile
A contrib/amcheck/amcheck–1.0–1.1.sql
M contrib/amcheck/amcheck.control
M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml

Add Bloom filter implementation.

commit   : 51bc271790eb234a1ba4d14d3e6530f70de92ab5    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 31 Mar 2018 17:49:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 31 Mar 2018 17:49:41 -0700    

Click here for diff

A Bloom filter is a space-efficient, probabilistic data structure that  
can be used to test set membership.  Callers will sometimes incur false  
positives, but never false negatives.  The rate of false positives is a  
function of the total number of elements and the amount of memory  
available for the Bloom filter.  
  
Two classic applications of Bloom filters are cache filtering, and data  
synchronization testing.  Any user of Bloom filters must accept the  
possibility of false positives as a cost worth paying for the benefit in  
space efficiency.  
  
This commit adds a test harness extension module, test_bloomfilter.  It  
can be used to get a sense of how the Bloom filter implementation  
performs under varying conditions.  
  
This is infrastructure for the upcoming "heapallindexed" amcheck patch,  
which verifies the consistency of a heap relation against one of its  
indexes.  
  
Author: Peter Geoghegan  
Reviewed-By: Andrey Borodin, Michael Paquier, Thomas Munro, Andres Freund  
Discussion: https://postgr.es/m/CAH2-Wzm5VmG7cu1N-H=nnS57wZThoSDQU+F5dewx3o84M+jY=g@mail.gmail.com  

M src/backend/lib/Makefile
M src/backend/lib/README
A src/backend/lib/bloomfilter.c
A src/include/lib/bloomfilter.h
M src/test/modules/Makefile
A src/test/modules/test_bloomfilter/.gitignore
A src/test/modules/test_bloomfilter/Makefile
A src/test/modules/test_bloomfilter/README
A src/test/modules/test_bloomfilter/expected/test_bloomfilter.out
A src/test/modules/test_bloomfilter/sql/test_bloomfilter.sql
A src/test/modules/test_bloomfilter/test_bloomfilter–1.0.sql
A src/test/modules/test_bloomfilter/test_bloomfilter.c
A src/test/modules/test_bloomfilter/test_bloomfilter.control
M src/tools/pgindent/typedefs.list

Small cleanups in fast default code.

commit   : ed69864350a59c51c8570900601ebd335956b638    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 1 Apr 2018 08:16:18 +0930    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 1 Apr 2018 08:16:18 +0930    

Click here for diff

Problems identified by Andres Freund and Haribabu Kommi  

M src/backend/access/common/heaptuple.c
M src/backend/executor/execTuples.c

Fix assorted issues in parallel vacuumdb.

commit   : 94173d3eeb445ae49020c5e2d9e166856d923eaf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Mar 2018 16:28:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Mar 2018 16:28:52 -0400    

Click here for diff

Avoid storing the result of PQsocket() in a pgsocket variable; it's  
declared as int, and the no-socket test is properly written as "x < 0"  
not "x == PGINVALID_SOCKET".  This accidentally had no bad effect  
because we never got to init_slot() with a bad connection, but it's  
still wrong.  
  
Actually, it seems like we should avoid storing the result for a long  
period at all.  The function's not so expensive that it's worth avoiding,  
and the existing coding technique here would fail if anyone tried to  
PQreset the connection during the life of the program.  Hence, just  
re-call PQsocket every time we construct a select(2) mask.  
  
Speaking of select(), GetIdleSlot imagined that it could compute the  
select mask once and continue to use it over multiple calls to  
select_loop(), which is pretty bogus since that would stomp on the  
mask on return.  This could only matter if the function's outer loop  
iterated more than once, which is unlikely (it'd take some connection  
receiving data, but not enough to complete its command).  But if it  
did happen, we'd acquire "tunnel vision" and stop watching the other  
connections for query termination, with the effect of losing parallelism.  
  
Another way in which GetIdleSlot could lose parallelism is that once  
PQisBusy returns false, it would lock in on that connection and do  
PQgetResult until that returns NULL; in some cases that could result  
in blocking.  (Perhaps this can never happen in vacuumdb due to the  
limited set of commands that it can issue, but I'm not quite sure  
of that, and even if true today it's not a future-proof assumption.)  
Refactor the code to do that properly, so that it risks blocking in  
PQgetResult only in cases where we need to wait anyway.  
  
Another loss-of-parallelism problem, which *is* easily demonstrable,  
is that any setup queries issued during prepare_vacuum_command() were  
always issued on the last-to-be-created connection, whether or not  
that was idle.  Long-running operations on that connection thus  
prevented issuance of additional operations on the other ones, except  
in the limited cases where no preparatory query was needed.  Instead,  
wait till we've identified a free connection and use that one.  
  
Also, avoid core dump due to undersized malloc request in the case  
that no tables are identified to be vacuumed.  
  
The bogus no-socket test was noted by CharSyam, the other problems  
identified in my own code review.  Back-patch to 9.5 where parallel  
vacuumdb was introduced.  
  
Discussion: https://postgr.es/m/CAMrLSE6etb33-192DTEUGkV-TsvEcxtBDxGWG1tgNOMnQHwgDA@mail.gmail.com  

M src/bin/scripts/vacuumdb.c

Fix portability and translatability issues in commit 64f85894a.

commit   : 5635c7aa678804292fe47bceab5b3f4dae5f39f9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Mar 2018 12:32:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Mar 2018 12:32:35 -0400    

Click here for diff

Compilation failed for lack of an #ifdef on builds without  
pg_strong_random().  Also fix relevant error messages to meet  
project style guidelines.  
  
Fabien Coelho, further adjusted by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/002_pgbench_no_server.pl

Portability fix for commit 9a895462d.

commit   : b0c90c85fc93f37107365dd8c7f47ba5e00544de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 20:52:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 20:52:05 -0400    

Click here for diff

So far as I can find, NI_MAXHOST isn't actually required anywhere by  
POSIX.  Nonetheless, commit 9a895462d supposed that it could rely on  
having that symbol without any ceremony at all.  We do have a hack  
for providing it if the platform doesn't, in getaddrinfo.h, so fix  
the problem by #including that file.  Per buildfarm.  

M src/include/replication/walreceiver.h

Remove PARTIAL_LINKING build mode.

commit   : a4ebbd27527087fcf3ade36f4e0072033e5b2f78    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 30 Mar 2018 17:24:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 30 Mar 2018 17:24:07 -0700    

Click here for diff

In 9956ddc19164b02dc1925fb389a1af77472eba5e, ten years ago, the  
current objfile.txt based linking model was introduced.  It's time to  
retire the old SUBSYS.o based model.  
  
This primarily is pertinent because the bitcode files for LLVM based  
inlining are not produced when using PARTIAL_LINKING. It does not seem  
worth to fix PARTIAL_LINKING to support that.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/common.mk

Fix bug with view locking code.

commit   : 1b26bd4089a388929c644ffea2832f3841c25969    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sat, 31 Mar 2018 09:26:43 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sat, 31 Mar 2018 09:26:43 +0900    

Click here for diff

LockViewRecurese() obtains view relation using heap_open() and passes  
it to get_view_query() to get view info. It immediately closes the  
relation then uses the returned view info by calling  
LockViewRecurse_walker().  Since get_view_query() returns a pointer  
within the relcache, the relcache should be kept until  
LockViewRecurse_walker() returns. Otherwise the relation could point  
to a garbage memory area.  
  
Fix is moving the heap_close() call after LockViewRecurse_walker().  
  
Problem reported by Tom Lane (buildfarm is unhappy, especially prion  
since it enables -DRELCACHE_FORCE_RELEASE cpp flag), fix by me.  

M src/backend/commands/lockcmds.c

Add SKIP_LOCKED option to RangeVarGetRelidExtended().

commit   : 3e256e550672657375fc3058b2b8ff6568d65cef    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 30 Mar 2018 16:56:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 30 Mar 2018 16:56:41 -0700    

Click here for diff

This will be used for VACUUM (SKIP LOCKED).  
  
Author: Nathan Bossart  
Reviewed-By: Michael Paquier and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c
M src/include/catalog/namespace.h

Combine options for RangeVarGetRelidExtended() into a flags argument.

commit   : d87510a524f36a630cfb34cc392e95e959a1b0dc    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 30 Mar 2018 16:33:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 30 Mar 2018 16:33:42 -0700    

Click here for diff

A followup patch will add a SKIP_LOCKED option. To avoid introducing  
evermore arguments, breaking existing callers each time, introduce a  
flags argument. This'll no doubt break a few external users...  
  
Also change the MISSING_OK behaviour so a DEBUG1 debug message is  
emitted when a relation is not found.  
  
Author: Nathan Bossart  
Reviewed-By: Michael Paquier and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/policy.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/tcop/utility.c
M src/include/catalog/namespace.h

Enhance pg_stat_wal_receiver view to display host and port of sender server.

commit   : 9a895462d940c0694042059f90e5f63a0a517ded    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 31 Mar 2018 07:51:22 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 31 Mar 2018 07:51:22 +0900    

Click here for diff

Previously there was no way in the standby side to find out the host and port  
of the sender server that the walreceiver was currently connected to when  
multiple hosts and ports were specified in primary_conninfo. For that purpose,  
this patch adds sender_host and sender_port columns into pg_stat_wal_receiver  
view. They report the host and port that the active replication connection  
currently uses.  
  
Bump catalog version.  
  
Author: Haribabu Kommi  
Reviewed-by: Michael Paquier and me  
  
Discussion: https://postgr.es/m/CAJrrPGcV_aq8=cdqkFhVDJKEnDQ70yRTTdY9RODzMnXNrCz2Ow@mail.gmail.com  

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

Fix bogus provolatile/proparallel markings on a few built-in functions.

commit   : 11002f8afa551f4673aa6a7b62c1872c233e6052    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 18:14:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 18:14:51 -0400    

Click here for diff

Richard Yen reported that pg_upgrade failed if the target cluster had  
force_parallel_mode = on, because binary_upgrade_create_empty_extension()  
is marked parallel restricted, allowing it to be executed in parallel  
mode, which complains because it tries to acquire an XID.  
  
In general, no function that might try to modify database data should  
be considered parallel safe or restricted, since execution of it might  
force XID acquisition.  We found several other examples of this mistake.  
  
Furthermore, functions that execute user-supplied SQL queries or query  
fragments, or pull data from user-supplied cursors, had better be marked  
both volatile and parallel unsafe, because we don't know what the supplied  
query or cursor might try to do.  There were several tsquery and XML  
functions that had the wrong proparallel marking for this, and some of  
them were even mislabeled as to volatility.  
  
All these bugs are old, dating back to 9.6 for the proparallel mistakes  
and much further for the provolatile mistakes.  We can't force a  
catversion bump in the back branches, but we can at least ensure that  
installations initdb'd in future have the right values.  
  
Thomas Munro and Tom Lane  
  
Discussion: https://postgr.es/m/CAEepm=2sNDScSLTfyMYu32Q=ob98ZGW-vM_2oLxinzSABGQ6VA@mail.gmail.com  

M src/include/catalog/pg_proc.h

Ensure that WAL pages skipped by a forced WAL switch are zero-filled.

commit   : 4a33bb59dfc33566f04e18ab5e1f90b8e7461052    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 16:18:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 16:18:18 -0400    

Click here for diff

In the previous coding, skipped pages were mostly zeroes, but they still  
had valid WAL page headers.  That makes them very much less compressible  
than an unbroken string of zeroes would be --- about 10X worse for bzip2  
compression, for instance.  We don't need those headers, so tweak the logic  
so that we zero them out.  
  
Chapman Flack, reviewed by Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete SLRU wrapping and warnings from predicate.c.

commit   : e5eb4fa87331821423b362be5ea4b18e873d5b27    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 15:11:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 15:11:39 -0400    

Click here for diff

When SSI was developed, slru.c was limited to segment files with names in  
the range 0000-FFFF.  This didn't allow enough space for predicate.c to  
store every possible XID when spilling old transactions to disk, so it  
would wrap around sooner and print warnings.  Since commits 638cf09e and  
73c986ad increased the number of segment files slru.c could manage, that  
behavior is unnecessary.  Therefore remove that code.  
  
Also remove the macro OldSerXidSegment, which has been unused since  
4cd3fb6e.  
  
Thomas Munro, reviewed by Anastasia Lubennikova  
  
Discussion: https://postgr.es/m/CAEepm=3XfsTSxgEbEOmxu0QDiXy0o18NUg2nC89JZcCGE+XFPA@mail.gmail.com  

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

Improve out-of-memory error reports by including memory context name.

commit   : 1bb9e731e17b79f5b1c6713159812adfcf4f6495    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 13:53:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 13:53:33 -0400    

Click here for diff

Add the target context's name to the errdetail field of "out of memory"  
errors in mcxt.c.  Per discussion, this seems likely to be useful to  
help narrow down the cause of a reported failure, and it costs little.  
Also, now that context names are required to be compile-time constants  
in all cases, there's little reason to be concerned about security  
issues from exposing these names to users.  (Because of such concerns,  
we are *not* including the context "ident" field.)  
  
In passing, add unlikely() markers to the allocation-failed tests,  
just to be sure the compiler is on the right page about that.  
Also, in palloc and friends, copy CurrentMemoryContext into a local  
variable, as that's almost surely cheaper to reference than a global.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Do index FSM vacuuming sooner.

commit   : c79f6df75dd381dbc387326f8155402992524124    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 11:48:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Mar 2018 11:48:17 -0400    

Click here for diff

In btree and SP-GiST indexes, move the responsibility for calling  
IndexFreeSpaceMapVacuum from the vacuumcleanup phase to the bulkdelete  
phase, and do it if and only if we found some pages that could be put into  
FSM.  As in commit 851a26e26, the idea is to make free pages visible to FSM  
searchers sooner when vacuuming very large tables (large enough to need  
multiple bulkdelete scans).  This adds more redundant work than that commit  
did, since we have to scan the entire index FSM each time rather than being  
able to localize what needs to be updated; but it still seems worthwhile.  
However, we can buy something back by not touching the FSM at all when  
there are no pages that can be put in it.  That will result in slower  
recovery from corrupt upper FSM pages in such a scenario, but it doesn't  
seem like that's a case we need to optimize for.  
  
Hash indexes don't use FSM at all.  GIN, GiST, and bloom indexes update  
FSM during the vacuumcleanup phase not bulkdelete, so that doing something  
comparable to this would be a much more invasive change, and it's not clear  
it's worth it.  BRIN indexes do things sufficiently differently that this  
change doesn't apply to them, either.  
  
Claudio Freire, reviewed by Masahiko Sawada and Jing Wang, some additional  
tweaks by me  
  
Discussion: https://postgr.es/m/CAGTBQpYR0uJCNTt3M5GOzBRHo+-GccNO1nCaQ8yEJmZKSW5q1A@mail.gmail.com  

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

Don't call IS_DUMMY_REL() when cheapest_total_path might be junk.

commit   : 96030f9a481a78483945447e122a387902a4549b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Mar 2018 11:37:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Mar 2018 11:37:48 -0400    

Click here for diff

Unlike the previous coding, this might result in a Gather per Append  
subplan when the target list is parallel-restricted, but such a plan  
is probably worth considering in that case, since a single Gather  
on top of the entire Append is impossible.  
  
Per Andres Freund and the buildfarm.  
  
Discussion: http://postgr.es/m/[email protected]  

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

docs: add parameter with brackets around varbit()

commit   : 681673e0c6c21a876e6ef7680e2116de60cf6286    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 30 Mar 2018 11:18:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 30 Mar 2018 11:18:08 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Euler Taveira  
  
Backpatch-through: 10  

M doc/src/sgml/datatype.sgml

doc: document "IS NOT DOCUMENT"

commit   : 756dca8e7f65edb479b7e94b024840011f07565c    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 30 Mar 2018 10:39:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 30 Mar 2018 10:39:48 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Euler Taveira  
  
Backpatch-through: 10  

M doc/src/sgml/func.sgml

Predicate locking in GIN index

commit   : 43d1ed60fdd96027f044e152176c0d45cd6bf443    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 30 Mar 2018 14:23:17 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 30 Mar 2018 14:23:17 +0300    

Click here for diff

Predicate locks are used on per page basis only if fastupdate = off, in  
opposite case predicate lock on pending list will effectively lock whole index,  
to reduce locking overhead, just lock a relation. Entry and posting trees are  
essentially B-tree, so locks are acquired on leaf pages only.  
  
Author: Shubham Barai with some editorization by me and Dmitry Ivanov  
Review by: Alexander Korotkov, Dmitry Ivanov, Fedor Sigaev  
Discussion: https://www.postgresql.org/message-id/flat/CALxAEPt5sWW+EwTaKUGFL5_XFcZ0MuGBcyJ70oqbWqr42YKR8Q@mail.gmail.com  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/storage/lmgr/README-SSI
M src/include/access/gin_private.h
A src/test/isolation/expected/predicate-gin.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/predicate-gin.spec

Fix typo in comment

commit   : 019fa576ca8298ecb7b8ded6e0c857840b57a4ae    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 30 Mar 2018 12:35:13 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 30 Mar 2018 12:35:13 +0200    

Click here for diff

Author: Michael Paquier <[email protected]>  

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

docs: fix spacing around "if not exists" brackets

commit   : 3da7502cd00ddf8228c9a4a7e4a08725decff99c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 21:25:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 21:25:32 -0400    

Click here for diff

Reported-by: FabrĆ­zio de Royes Mello  
  
Discussion: https://postgr.es/m/CAFcNs+qDD+QKcF8YCPQnjAxoWN61qY_YdFLB3iQqbWCLSCyY0g@mail.gmail.com  
  
Author: FabrĆ­zio de Royes Mello  

M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_user_mapping.sgml

Allow to lock views.

commit   : 34c20de4d0b0ea8f96d0c518724d876c7b984cf5    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Fri, 30 Mar 2018 09:18:02 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Fri, 30 Mar 2018 09:18:02 +0900    

Click here for diff

Now all tables used in view definitions can be recursively locked by a  
LOCK command.  
  
Author: Yugo Nagata  
Reviewed by Robert Haas, Thomas Munro and me.  
  
Discussion: https://postgr.es/m/20171011183629.eb2817b3.nagata%40sraoss.co.jp  

M doc/src/sgml/ref/lock.sgml
M src/backend/commands/lockcmds.c
M src/test/regress/expected/lock.out
M src/test/regress/sql/lock.sql

Improve JIT docs.

commit   : fb604780114cea6a83f3f6a60e7f51a7185c932b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 29 Mar 2018 16:13:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 29 Mar 2018 16:13:40 -0700    

Click here for diff

Author: John Naylor and Andres Freund  
Discussion: https://postgr.es/m/CAJVSVGUs-VcwSY7-Kx-GQe__8hvWuA4Uhyf3gxoMXeiZqebE9g@mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/jit.sgml
M src/backend/jit/README

Remove 'target' from GroupPathExtraData.

commit   : c1de1a3a8b93a61e8264484a10a482156026d12c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 29 Mar 2018 16:17:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 29 Mar 2018 16:17:18 -0400    

Click here for diff

It's not needed.  
  
Jeevan Chalke  
  
Discussion: http://postgr.es/m/CAM2+6=XPWujjmj5zUaBTGDoB38CemwcPmjkRy0qOcsQj_V+2sQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/include/nodes/relation.h

Rewrite the code that applies scan/join targets to paths.

commit   : 11cf92f6e2e13c0a6e3f98be3e629e6bd90b74d5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 29 Mar 2018 15:47:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 29 Mar 2018 15:47:57 -0400    

Click here for diff

If the toplevel scan/join target list is parallel-safe, postpone  
generating Gather (or Gather Merge) paths until after the toplevel has  
been adjusted to return it.  This (correctly) makes queries with  
expensive functions in the target list more likely to choose a  
parallel plan, since the cost of the plan now reflects the fact that  
the evaluation will happen in the workers rather than the leader.  
The original complaint about this problem was from Jeff Janes.  
  
If the toplevel scan/join relation is partitioned, recursively apply  
the changes to all partitions.  This sometimes allows us to get rid of  
Result nodes, because Append is not projection-capable but its  
children may be.  It also cleans up what appears to be incorrect SRF  
handling from commit e2f1eb0ee30d144628ab523432320f174a2c8966: the old  
code had no knowledge of SRFs for child scan/join rels.  
  
Because we now use create_projection_path() in some cases where we  
formerly used apply_projection_to_path(), this changes the ordering  
of columns in some queries generated by postgres_fdw.  Update  
regression outputs accordingly.  
  
Patch by me, reviewed by Amit Kapila and by Ashutosh Bapat.  Other  
fixes for this problem (substantially different from this version)  
were reviewed by Dilip Kumar, Amit Khandekar, and Marina Polyakova.  
  
Discussion: http://postgr.es/m/CAMkU=1ycXNipvhWuweUVpKuyu6SpNjF=yHWu4c4US5JgVGxtZQ@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/partition_join.out

Postpone generate_gather_paths for topmost scan/join rel.

commit   : 3f90ec8597c3515e0d3190613b31491686027e4b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 12 Mar 2018 16:45:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 12 Mar 2018 16:45:15 -0400    

Click here for diff

Don't call generate_gather_paths for the topmost scan/join relation  
when it is initially populated with paths.  Instead, do the work in  
grouping_planner.  By itself, this gains nothing; in fact it loses  
slightly because we end up calling set_cheapest() for the topmost  
scan/join rel twice rather than once.  However, it paves the way for  
a future commit which will postpone generate_gather_paths for the  
topmost scan/join relation even further, allowing more accurate  
costing of parallel paths.  
  
Amit Kapila and Robert Haas.  Earlier versions of this patch (which  
different substantially) were reviewed by Dilip Kumar, Amit  
Khandekar, Marina Polyakova, and Ashutosh Bapat.  

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

Teach create_projection_plan to omit projection where possible.

commit   : d7c19e62a8e0a634eb6b29f8f1111d944e57081f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 29 Mar 2018 15:37:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 29 Mar 2018 15:37:39 -0400    

Click here for diff

We sometimes insert a ProjectionPath into a plan tree when projection  
is not strictly required. The existing code already arranges to avoid  
emitting a Result node when the ProjectionPath's subpath can perform  
the projection itself, but previously it didn't consider the  
possibility that the parent node might not actually require the  
projection to be performed at all.  
  
Skipping projection when it's not required can not only avoid Result  
nodes that aren't needed, but also avoid losing the "physical tlist"  
optimization unneccessarily.  
  
Patch by me, reviewed by Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoakT5gmahbPWGqrR2nAdFOMAOnOXYoWHRdVfGWs34t6_A@mail.gmail.com  

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

C comments: "a" <--> "an" corrections

commit   : 20b4323bd107920a3c3e60452442e8e2cee302d2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 15:18:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 15:18:53 -0400    

Click here for diff

Reported-by: Michael Paquier, Abhijit Menon-Sen  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Michael Paquier, Abhijit Menon-Sen, me  

M config/c-library.m4
M src/backend/access/gin/ginvacuum.c
M src/backend/catalog/aclchk.c
M src/backend/commands/cluster.c
M src/backend/executor/instrument.c
M src/backend/libpq/pqformat.c
M src/backend/nodes/readfuncs.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/cache/relcache.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

README change: update for hash access method

commit   : 3282c4c136e4e5ad22d57dbe7a98fbac2962500a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 14:38:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 14:38:32 -0400    

Click here for diff

Reported-by: Thomas Munro, Justin Pryzby  
  
Discussion: https://postgr.es/m/CAEepm=1_682z-09DNHj4GkCJAqWK-D6h9Oq5ea84T1oqq1-Utg@mail.gmail.com  

M src/backend/access/hash/README

Fix incorrect copy/paste in comment

commit   : 8cdc834647b8b1558c10a7d27a3580a32e04c500    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 29 Mar 2018 19:11:05 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 29 Mar 2018 19:11:05 +0200    

Click here for diff

Author: Alexander Korotkov <[email protected]>  

M src/test/subscription/t/003_constraints.pl

Fix typo in comment

commit   : 9778d5c180c06998c315a4ae4753b927e3bc4ea8    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 29 Mar 2018 19:10:04 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 29 Mar 2018 19:10:04 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/bin/pg_dump/pg_backup_custom.c

Remove unnecessary BufferGetPage() calls in fsm_vacuum_page().

commit   : 2b1759e2675fc01d6945c9a5fa65c7d7121212f7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Mar 2018 12:44:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Mar 2018 12:44:19 -0400    

Click here for diff

Just noticed that these were quite redundant, since we're holding the  
page address in a local variable anyway, and we have pin on the buffer  
throughout.  
  
Also improve a comment.  

M src/backend/storage/freespace/freespace.c

Remove UpdateFreeSpaceMap(), use FreeSpaceMapVacuumRange() instead.

commit   : a063baaced273e955e088ba5979dcc6ec5cd92e6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Mar 2018 12:22:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Mar 2018 12:22:37 -0400    

Click here for diff

FreeSpaceMapVacuumRange has the same effect, is more efficient if many  
pages are involved, and makes fewer assumptions about how it's used.  
Notably, Claudio Freire pointed out that UpdateFreeSpaceMap could fail  
if the specified freespace value isn't the maximum possible.  This isn't  
a problem for the single existing user, but the function represents an  
attractive nuisance IMO, because it's named as though it were a  
general-purpose update function and its limitations are undocumented.  
In any case we don't need multiple ways to get the same result.  
  
In passing, do some code review and cleanup in RelationAddExtraBlocks.  
In particular, I see no excuse for it to omit the PageIsNew safety check  
that's done in the mainline extension path in RelationGetBufferForTuple.  
  
Discussion: https://postgr.es/m/CAGTBQpYR0uJCNTt3M5GOzBRHo+-GccNO1nCaQ8yEJmZKSW5q1A@mail.gmail.com  

M src/backend/access/heap/hio.c
M src/backend/storage/freespace/freespace.c
M src/include/storage/freespace.h

C comment: fix wording about shared memory message queue

commit   : bc0021ef09ec709fa20309228ea30ccf07f8b4e6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 12:18:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 12:18:34 -0400    

Click here for diff

Reported-by: Tels  
  
Discussion: https://postgr.es/m/[email protected]  

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

While vacuuming a large table, update upper-level FSM data every so often.

commit   : 851a26e26637aac60d6e974acbadb31748b12f86    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Mar 2018 11:29:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Mar 2018 11:29:54 -0400    

Click here for diff

VACUUM updates leaf-level FSM entries immediately after cleaning the  
corresponding heap blocks.  fsmpage.c updates the intra-page search trees  
on the leaf-level FSM pages when this happens, but it does not touch the  
upper-level FSM pages, so that the released space might not actually be  
findable by searchers.  Previously, updating the upper-level pages happened  
only at the conclusion of the VACUUM run, in a single FreeSpaceMapVacuum()  
call.  This is bad because the VACUUM might get canceled before ever  
reaching that point, so that from the point of view of searchers no space  
has been freed at all, leading to table bloat.  
  
We can improve matters by updating the upper pages immediately after each  
cycle of index-cleaning and heap-cleaning, processing just the FSM pages  
corresponding to the range of heap blocks we have now fully cleaned.  
This adds a small amount of extra work, since the FSM pages leading down  
to each range boundary will be touched twice, but it's pretty negligible  
compared to everything else going on in a large VACUUM.  
  
If there are no indexes, VACUUM doesn't work in cycles but just cleans  
each heap page on first visit.  In that case we just arbitrarily update  
upper FSM pages after each 8GB of heap.  That maintains the goal of not  
letting all this work slide until the very end, and it doesn't seem worth  
expending extra complexity on a case that so seldom occurs in practice.  
  
In either case, the FSM is fully up to date before any attempt is made  
to truncate the relation, so that the most likely scenario for VACUUM  
cancellation no longer results in out-of-date upper FSM pages.  When  
we do successfully truncate, adjusting the FSM to reflect that is now  
fully handled within FreeSpaceMapTruncateRel.  
  
Claudio Freire, reviewed by Masahiko Sawada and Jing Wang, some additional  
tweaks by me  
  
Discussion: https://postgr.es/m/CAGTBQpYR0uJCNTt3M5GOzBRHo+-GccNO1nCaQ8yEJmZKSW5q1A@mail.gmail.com  

M src/backend/commands/vacuumlazy.c
M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/include/storage/freespace.h

Add casts from jsonb

commit   : c0cbe00fee6d0a5e0ec72c6d68a035e674edc4cc    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 29 Mar 2018 16:33:56 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 29 Mar 2018 16:33:56 +0300    

Click here for diff

Add explicit cast from scalar jsonb to all numeric and bool types. It would be  
better to have cast from scalar jsonb to text too but there is already a cast  
from jsonb to text as just text representation of json. There is no way to have  
two different casts for the same type's pair.  
  
Bump catalog version  
  
Author: Anastasia Lubennikova with editorization by Nikita Glukhov and me  
Review by: Aleksander Alekseev, Nikita Glukhov, Darafei Praliaskouski  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/jsonb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

docs: fix INSTALL.xml build by using "standalone-ignore"

commit   : 7fe04ce9203cb0c5332614ec091aab28cf6aeaa8    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 07:53:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 29 Mar 2018 07:53:57 -0400    

Click here for diff

Was broken by "jit" link.  

M doc/src/sgml/installation.sgml

Fix typo in comment

commit   : 669820a3d9c359e8d44a26035cb4d675dc542cb4    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 29 Mar 2018 11:42:32 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 29 Mar 2018 11:42:32 +0200    

Click here for diff

Arthur Zakirov, confirmed by Thomas Munro  

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

Allow committing inside cursor loop

commit   : 056a5a3f63f1a29d9266165ee6e25c6a51ddd63c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 18:57:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 18:57:10 -0400    

Click here for diff

Previously, committing or aborting inside a cursor loop was prohibited  
because that would close and remove the cursor.  To allow that,  
automatically convert such cursors to holdable cursors so they survive  
commits or rollbacks.  Portals now have a new state "auto-held", which  
means they have been converted automatically from pinned.  An auto-held  
portal is kept on transaction commit or rollback, but is still removed  
when returning to the main loop on error.  
  
This supports all languages that have cursor loop constructs: PL/pgSQL,  
PL/Python, PL/Perl.  
  
Reviewed-by: Ildus Kurbangaliev <[email protected]>  

M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/mmgr/portalmem.c
M src/include/utils/portal.h
M src/pl/plperl/expected/plperl_transaction.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl_transaction.sql
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql
M src/pl/plpython/expected/plpython_transaction.out
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/sql/plpython_transaction.sql

C comment: fix typo, log -> lag

commit   : a2894cce544d120199a1a90469073796d055bb60    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 28 Mar 2018 18:23:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 28 Mar 2018 18:23:39 -0400    

Click here for diff

Reported-by: atorikoshi  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: atorikoshi  

M src/backend/replication/walsender.c

Fix mistakes in the just added JIT docs.

commit   : a0a08c1d85dae3c332e7d72a56df0636be9c5d0a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 15:07:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 15:07:08 -0700    

Click here for diff

Reported-By: Lukas Fittl  
Author: Andres Freund  

M doc/src/sgml/config.sgml
M doc/src/sgml/jit.sgml
M src/backend/jit/README

Add documentation for the JIT feature.

commit   : e6c039d13e16a3a2dec5ba479d9d1fb3229c03a3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 14:22:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 14:22:42 -0700    

Click here for diff

As promised in earlier commits, this adds documentation about the new  
build options, the new GUCs, about the planner logic when JIT is used,  
and the benefits of JIT in general.  
  
Also adds a more implementation oriented README.  
  
I'm sure we're going to want to expand this further, but I think this  
is a reasonable start.  
  
Author: Andres Freund, with contributions by Thomas Munro  
Reviewed-By: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/installation.sgml
A doc/src/sgml/jit.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/storage.sgml
A src/backend/jit/README

Add EXPLAIN support for JIT.

commit   : 1f0c6a9e7dca70ba7d2c949e42298d764ca457c0    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 13:26:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 13:26:51 -0700    

Click here for diff

This just shows a few details about JITing, e.g. how many functions  
have been JITed, and how long that took.  To avoid noise in regression  
tests with functions sometimes being JITed in --with-llvm builds,  
disable display when COSTS OFF is specified.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Add inlining support to LLVM JIT provider.

commit   : 9370462e9a79755aea367c62eb0fef96f0c42258    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 13:19:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 13:19:08 -0700    

Click here for diff

This provides infrastructure to allow JITed code to inline code  
implemented in C. This e.g. can be postgres internal functions or  
extension code.  
  
This already speeds up long running queries, by allowing the LLVM  
optimizer to optimize across function boundaries. The optimization  
potential currently doesn't reach its full potential because LLVM  
cannot optimize the FunctionCallInfoData argument fully away, because  
it's allocated on the heap rather than the stack. Fixing that is  
beyond what's realistic for v11.  
  
To be able to do that, use CLANG to convert C code to LLVM bitcode,  
and have LLVM build a summary for it. That bitcode can then be used to  
to inline functions at runtime. For that the bitcode needs to be  
installed. Postgres bitcode goes into $pkglibdir/bitcode/postgres,  
extensions go into equivalent directories.  PGXS has been modified so  
that happens automatically if postgres has been compiled with LLVM  
support.  
  
Currently this isn't the fastest inline implementation, modules are  
reloaded from disk during inlining. That's to work around an apparent  
LLVM bug, triggering an apparently spurious error in LLVM assertion  
enabled builds.  Once that is resolved we can remove the superfluous  
read from disk.  
  
Docs will follow in a later commit containing docs for the whole JIT  
feature.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/backend/Makefile
M src/backend/common.mk
M src/backend/jit/jit.c
M src/backend/jit/llvm/Makefile
M src/backend/jit/llvm/llvmjit.c
A src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/makefiles/pgxs.mk

Use isinf builtin for clang, for performance.

commit   : 8a934d6778331f2ac04a40f4f22178a56a232315    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 12:45:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Mar 2018 12:45:32 -0700    

Click here for diff

When compiling with clang glibc's definition of isinf() ends up  
leading to and external libc function call. That's because there was a  
bug in the builtin in an old gcc version, and clang claims  
compatibility with an older version.  That causes clang to be  
measurably slower for floating point heavy workloads than gcc.  
  
To fix simply redirect isinf when using clang and clang confirms it  
has __builtin_isinf().  

M src/include/port.h

Make pg_rewind skip files and directories that are removed during server start.

commit   : 266b6acb312fc440c1c1a2036aa9da94916beac6    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 29 Mar 2018 04:56:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 29 Mar 2018 04:56:52 +0900    

Click here for diff

The target cluster that was rewound needs to perform recovery from  
the checkpoint created at failover, which leads it to remove or recreate  
some files and directories that may have been copied from the source  
cluster. So pg_rewind can skip synchronizing such files and directories,  
and which reduces the amount of data transferred during a rewind  
without changing the usefulness of the operation.  
  
Author: Michael Paquier  
Reviewed-by: Anastasia Lubennikova, Stephen Frost and me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_rewind.sgml
M src/backend/replication/basebackup.c
M src/bin/pg_rewind/filemap.c

Fix handling of files that source server removes during pg_rewind is running.

commit   : 09e96b3f35627a2939e2effd8b98aaa934f59b32    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 29 Mar 2018 04:00:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 29 Mar 2018 04:00:21 +0900    

Click here for diff

After processing the filemap to build the list of chunks that will be  
fetched from the source to rewing the target server, it is possible that  
a file which was previously processed is removed from the source.  A  
simple example of such an occurence is a WAL segment which gets recycled  
on the target in-between.  When the filemap is processed, files not  
categorized as relation files are first truncated to prepare for its  
full copy of which is going to be taken from the source, divided into a  
set of junks.  However, for a recycled WAL segment, this would result in  
a segment which has a zero-byte size.  With such an empty file,  
post-rewind recovery thinks that records are saved but they are actually  
not because of the truncation which happened when processing the  
filemap, resulting in data loss.  
  
In order to fix the problem, make sure that files which are found as  
removed on the source when receiving chunks of them are as well deleted  
on the target server for consistency.  
  
Back-patch to 9.5 where pg_rewind was added.  
  
Author: Tsunakawa Takayuki  
Reviewed-by: Michael Paquier  
Reported-by: Tsunakawa Takayuki  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT05  

M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/libpq_fetch.c

PL/pgSQL: Nested CALL with transactions

commit   : d92bc83c48bdea9888e64cf1e2edbac9693099c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 10:05:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 10:05:06 -0400    

Click here for diff

So far, a nested CALL or DO in PL/pgSQL would not establish a context  
where transaction control statements were allowed.  This fixes that by  
handling CALL and DO specially in PL/pgSQL, passing the atomic/nonatomic  
execution context through and doing the required management around  
transaction boundaries.  
  
Reviewed-by: Tomas Vondra <[email protected]>  

M doc/src/sgml/plpgsql.sgml
M src/backend/executor/spi.c
M src/backend/tcop/utility.c
M src/include/executor/spi_priv.h
M src/include/tcop/utility.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Fix actual and potential double-frees around tuplesort usage.

commit   : c2d4eb1b1fa252fd8c407e1519308017a18afed1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Mar 2018 13:26:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Mar 2018 13:26:43 -0400    

Click here for diff

tuplesort_gettupleslot() passed back tuples allocated in the tuplesort's  
own memory context, even when the caller was responsible to free them.  
This created a double-free hazard, because some callers might destroy  
the tuplesort object (via tuplesort_end) before trying to clean up the  
last returned tuple.  To avoid this, change the API to specify that the  
tuple is allocated in the caller's memory context.  v10 and HEAD already  
did things that way, but in 9.5 and 9.6 this is a live bug that can  
demonstrably cause crashes with some grouping-set usages.  
  
In 9.5 and 9.6, this requires doing an extra tuple copy in some cases,  
which is unfortunate.  But the amount of refactoring needed to avoid it  
seems excessive for a back-patched change, especially since the cases  
where an extra copy happens are less performance-critical.  
  
Likewise change tuplesort_getdatum() to return pass-by-reference Datums  
in the caller's context not the tuplesort's context.  There seem to be  
no live bugs among its callers, but clearly the same sort of situation  
could happen in future.  
  
For other tuplesort fetch routines, continue to allocate the memory in  
the tuplesort's context.  This is a little inconsistent with what we now  
do for tuplesort_gettupleslot() and tuplesort_getdatum(), but that's  
preferable to adding new copy overhead in the back branches where it's  
clearly unnecessary.  These other fetch routines provide the weakest  
possible guarantees about tuple memory lifespan from v10 on, anyway,  
so this actually seems more consistent overall.  
  
Adjust relevant comments to reflect these API redefinitions.  
  
Arguably, we should change the pre-9.5 branches as well, but since  
there are no known failure cases there, it seems not worth the risk.  
  
Peter Geoghegan, per report from Bernd Helmle.  Reviewed by Kyotaro  
Horiguchi; thanks also to Andreas Seltenreich for extracting a  
self-contained test case.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Store 2PC GID in commit/abort WAL recs for logical decoding

commit   : 1eb6d6527aae264b3e0b9c95aa70bb7a594ad1cf    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 28 Mar 2018 17:42:50 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 28 Mar 2018 17:42:50 +0100    

Click here for diff

Store GID of 2PC in commit/abort WAL records when wal_level = logical.  
This allows logical decoding to send the SAME gid to subscribers  
across restarts of logical replication.  
  
Track relica origin replay progress for 2PC.  
  
(Edited from patch 0003 in the logical decoding 2PC series.)  
  
Authors: Nikhil Sontakke, Stas Kelvich  
Reviewed-by: Simon Riggs, Andres Freund  

M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/include/access/twophase.h
M src/include/access/xact.h

Attempt to fix jsonb_plpython build on Windows

commit   : 75e95dd79ba22e18687a069d2ff2fd29afab5798    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 11:49:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 11:49:23 -0400    

Click here for diff

M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/vcregress.pl

Fix jsonb_plpython tests on older Python versions

commit   : e81fc9b9dbf9d744dcc9fb210e4353a350be1e22    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 11:01:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 11:01:40 -0400    

Click here for diff

Rewrite one test to avoid a case where some Python versions have output  
format differences (Decimal('1') vs Decimal("1")).  

M contrib/jsonb_plpython/expected/jsonb_plpython.out
M contrib/jsonb_plpython/sql/jsonb_plpython.sql

Transforms for jsonb to PL/Python

commit   : 3f44e3db72ad4097aae078c075a9b3cb3d6b761b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 08:32:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Mar 2018 08:32:43 -0400    

Click here for diff

Add a new contrib module jsonb_plpython that provide a transform between  
jsonb and PL/Python.  jsonb values are converted to appropriate Python  
types such as dicts and lists, and vice versa.  
  
Author: Anthony Bykov <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Nikita Glukhov <[email protected]>  

M contrib/Makefile
A contrib/jsonb_plpython/.gitignore
A contrib/jsonb_plpython/Makefile
A contrib/jsonb_plpython/expected/jsonb_plpython.out
A contrib/jsonb_plpython/jsonb_plpython.c
A contrib/jsonb_plpython/jsonb_plpython2u–1.0.sql
A contrib/jsonb_plpython/jsonb_plpython2u.control
A contrib/jsonb_plpython/jsonb_plpython3u–1.0.sql
A contrib/jsonb_plpython/jsonb_plpython3u.control
A contrib/jsonb_plpython/jsonb_plpythonu–1.0.sql
A contrib/jsonb_plpython/jsonb_plpythonu.control
A contrib/jsonb_plpython/sql/jsonb_plpython.sql
M doc/src/sgml/json.sgml

Make fast_default regression tests locale independent

commit   : a437551a228a5099c305d1376188d6926c043724    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 28 Mar 2018 17:06:45 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 28 Mar 2018 17:06:45 +1030    

Click here for diff

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

Use pg_stat_get_xact* functions within xacts

commit   : 5b0d7f6996abfc1e3e51bac62af6076903635dc8    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 28 Mar 2018 05:21:00 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 28 Mar 2018 05:21:00 +0100    

Click here for diff

Resolve build farm failures from c203d6cf81b4d7e43,  
diagnosed by Tom Lane.  
  
The output of pg_stat_get_xact_tuples_hot_updated() and friends  
is not guaranteed to show anything after the transaction completes.  
Data is flushed slowly to stats collector, so using them can  
give timing issues.  

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

Quick adaption of JIT tuple deforming to the fast default patch.

commit   : f4f5845b3182ab930e525b1419bca47ac611604e    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 27 Mar 2018 21:03:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 27 Mar 2018 21:03:10 -0700    

Click here for diff

Instead using memset to set tts_isnull, call the new  
slot_getmissingattrs().  
  
Also fix a bug (= instead of >=) in the code generation. Normally = is  
correct, but when repeatedly deforming fields not in a  
tuple (e.g. deform up to natts + 1 and then natts + 2) >= is needed.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/tuptable.h
M src/include/jit/llvmjit.h

Add catversion bump missed in 16828d5c0.

commit   : b4013b8e4a271816ba87aa56f46dbc04a083d962    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 27 Mar 2018 19:07:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 27 Mar 2018 19:07:39 -0700    

Click here for diff

Given that pg_attribute changed its layout...  

M src/include/catalog/catversion.h

Fast ALTER TABLE ADD COLUMN with a non-NULL default

commit   : 16828d5c0273b4fe5f10f42588005f16b415b2d8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 28 Mar 2018 10:43:52 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 28 Mar 2018 10:43:52 +1030    

Click here for diff

Currently adding a column to a table with a non-NULL default results in  
a rewrite of the table. For large tables this can be both expensive and  
disruptive. This patch removes the need for the rewrite as long as the  
default value is not volatile. The default expression is evaluated at  
the time of the ALTER TABLE and the result stored in a new column  
(attmissingval) in pg_attribute, and a new column (atthasmissing) is set  
to true. Any existing row when fetched will be supplied with the  
attmissingval. New rows will have the supplied value or the default and  
so will never need the attmissingval.  
  
Any time the table is rewritten all the atthasmissing and attmissingval  
settings for the attributes are cleared, as they are no longer needed.  
  
The most visible code change from this is in heap_attisnull, which  
acquires a third TupleDesc argument, allowing it to detect a missing  
value if there is one. In many cases where it is known that there will  
not be any (e.g.  catalog relations) NULL can be passed for this  
argument.  
  
Andrew Dunstan, heavily modified from an original patch from Serge  
Rielau.  
Reviewed by Tom Lane, Andres Freund, Tomas Vondra and David Rowley.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/access/common/heaptuple.c
M src/backend/access/common/tupdesc.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/include/access/htup_details.h
M src/include/access/tupdesc.h
A src/include/access/tupdesc_details.h
M src/include/catalog/heap.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_class.h
M src/test/regress/expected/event_trigger.out
A src/test/regress/expected/fast_default.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/fast_default.sql

Update pgindent's typedefs blacklist, and make it easier to adjust.

commit   : ef1978d6ed1e4defe18d250226460409e6cd5447    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Mar 2018 18:15:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Mar 2018 18:15:39 -0400    

Click here for diff

It seems that all buildfarm members are now using the <stdbool.h> code  
path, so that none of them report "bool" as a typedef.  We still need it  
to be treated that way, so adjust pgindent to force that whether or not  
it's in the given list.  
  
Also, the recent introduction of LLVM infrastructure has caused the  
appearance of some typedef names that we definitely *don't* want  
treated as typedefs, such as "string" and "abs".  Extend the existing  
blacklist to include these.  (Additions based on comparing v10's  
typedefs list to what the buildfarm is currently emitting.)  
  
Rearrange the code so that the lists of whitelisted/blacklisted  
names are a bit easier to find and modify.  
  
Andrew Dunstan and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/pgindent

Allow memory contexts to have both fixed and variable ident strings.

commit   : 442accc3fe0cd556de40d9d6c776449e82254763    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Mar 2018 16:46:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Mar 2018 16:46:47 -0400    

Click here for diff

Originally, we treated memory context names as potentially variable in  
all cases, and therefore always copied them into the context header.  
Commit 9fa6f00b1 rethought this a little bit and invented a distinction  
between fixed and variable names, skipping the copy step for the former.  
But we can make things both simpler and more useful by instead allowing  
there to be two parts to a context's identification, a fixed "name" and  
an optional, variable "ident".  The name supplied in the context create  
call is now required to be a compile-time-constant string in all cases,  
as it is never copied but just pointed to.  The "ident" string, if  
wanted, is supplied later.  This is needed because typically we want  
the ident to be stored inside the context so that it's cleaned up  
automatically on context deletion; that means it has to be copied into  
the context before we can set the pointer.  
  
The cost of this approach is basically just an additional pointer field  
in struct MemoryContextData, which isn't much overhead, and is bought  
back entirely in the AllocSet case by not needing a headerSize field  
anymore, since we no longer have to cope with variable header length.  
In addition, we can simplify the internal interfaces for memory context  
creation still further, saving a few cycles there.  And it's no longer  
true that a custom identifier disqualifies a context from participating  
in aset.c's freelist scheme, so possibly there's some win on that end.  
  
All the places that were using non-compile-time-constant context names  
are adjusted to put the variable info into the "ident" instead.  This  
allows more effective identification of those contexts in many cases;  
for example, subsidary contexts of relcache entries are now identified  
by both type (e.g. "index info") and relname, where before you got only  
one or the other.  Contexts associated with PL function cache entries  
are now identified more fully and uniformly, too.  
  
I also arranged for plancache contexts to use the query source string  
as their identifier.  This is basically free for CachedPlanSources, as  
they contained a copy of that string already.  We pay an extra pstrdup  
to do it for CachedPlans.  That could perhaps be avoided, but it would  
make things more fragile (since the CachedPlanSource is sometimes  
destroyed first).  I suspect future improvements in error reporting will  
require CachedPlans to have a copy of that string anyway, so it's not  
clear that it's worth moving mountains to avoid it now.  
  
This also changes the APIs for context statistics routines so that the  
context-specific routines no longer assume that output goes straight  
to stderr, nor do they know all details of the output format.  This  
is useful immediately to reduce code duplication, and it also allows  
for external code to do something with stats output that's different  
from printing to stderr.  
  
The reason for pushing this now rather than waiting for v12 is that  
it rethinks some of the API changes made by commit 9fa6f00b1.  Seems  
better for extension authors to endure just one round of API changes  
not two.  
  
Discussion: https://postgr.es/m/CAB=Je-FdtmFZ9y9REHD7VsSrnCkiBhsA4mdsLKSPauwXtQBeNA@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/catalog/partition.c
M src/backend/commands/policy.c
M src/backend/executor/functions.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpython/plpy_procedure.c
M src/pl/tcl/pltcl.c

Allow HOT updates for some expression indexes

commit   : c203d6cf81b4d7e43edb2b75ec1b741ba48e04e0    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 27 Mar 2018 19:57:02 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 27 Mar 2018 19:57:02 +0100    

Click here for diff

If the value of an index expression is unchanged after UPDATE,  
allow HOT updates where previously we disallowed them, giving  
a significant performance boost in those cases.  
  
Particularly useful for indexes such as JSON->>field where the  
JSON value changes but the indexed value does not.  
  
Submitted as "surjective indexes" patch, now enabled by use  
of new "recheck_on_update" parameter.  
  
Author: Konstantin Knizhnik  
Reviewer: Simon Riggs, with much wordsmithing and some cleanup  

M doc/src/sgml/ref/create_index.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/backend/utils/cache/relcache.c
M src/bin/psql/tab-complete.c
M src/include/access/reloptions.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
A src/test/regress/expected/func_index.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/func_index.sql

libpq: PQhost to return active connected host or hostaddr

commit   : 1944cdc98273dbb8439ad9b387ca2858531afcf0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 27 Mar 2018 12:31:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 27 Mar 2018 12:31:34 -0400    

Click here for diff

Previously, PQhost didn't return the connected host details when the  
connection type was CHT_HOST_ADDRESS (i.e., via hostaddr).  Instead, it  
returned the complete host connection parameter (which could contain  
multiple hosts) or the default host details, which was confusing and  
arguably incorrect.  
  
Change this to return the actually connected host or hostaddr  
irrespective of the connection type.  When hostaddr but no host was  
specified, hostaddr is now returned.  Never return the original host  
connection parameter, and document that PQhost cannot be relied on  
before the connection is established.  
  
PQport is similarly changed to always return the active connection port  
and never the original connection parameter.  
  
Author: Hari Babu <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Kyotaro HORIGUCHI <[email protected]>  
Reviewed-by: David G. Johnston <[email protected]>  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c

Fix count of skipped test of basebackup on Windows

commit   : 44bd95846a526dd1f69bdc78b3832f2d2de77dd4    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 27 Mar 2018 17:40:56 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 27 Mar 2018 17:40:56 +0300    

Click here for diff

Commit 920a5e500a119b03356fb1fb64a677eb1aa5fc6f add tests which should be  
skipped on Windows boxes, but patch doesn't contain right count of them.  
  
David Steel  

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

Skip temp tables from basebackup.

commit   : 920a5e500a119b03356fb1fb64a677eb1aa5fc6f    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 27 Mar 2018 16:14:40 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 27 Mar 2018 16:14:40 +0300    

Click here for diff

Do not store temp tables in basebackup, they will not be visible anyway, so,  
there are not reasons to store them.  
  
Author: David Steel  
Reviewed by: me  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/replication/basebackup.c
M src/backend/storage/file/fd.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/include/storage/fd.h

Add predicate locking for GiST

commit   : 3ad55863e9392bff73377911ebbf9760027ed405    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 27 Mar 2018 15:43:19 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 27 Mar 2018 15:43:19 +0300    

Click here for diff

Add page-level predicate locking, due to gist's code organization, patch seems  
close to trivial: add check before page changing, add predicate lock before page  
scanning.  Although choosing right place to check is not simple: it should not  
be called during index build, it should support insertion of new downlink and so  
on.  
  
Author: Shubham Barai with editorization by me and Alexander Korotkov  
Reviewed by: Alexander Korotkov, Andrey Borodin, me  
Discussion: https://www.postgresql.org/message-id/flat/CALxAEPtdcANpw5ePU3LvnTP8HCENFw6wygupQAyNBgD-sG3h0g@mail.gmail.com  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/storage/lmgr/README-SSI
A src/test/isolation/expected/predicate-gist.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/predicate-gist.spec

Adapt to LLVM 7+ Orc API changes.

commit   : 4b9094eb6e14dfdbed61278ea8e51cc846e43579    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 15:55:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 15:55:16 -0700    

Click here for diff

This is mostly done to be able to validate features and fixes  
submitted to LLVM. Given the size of these changes that seems  
acceptable.  
  
Author: Andres Freund  

M src/backend/jit/llvm/llvmjit.c

LLVMJIT: Free created module in LLVM < 5.

commit   : 071371bc43c89d6db923a7f858933f655b150655    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 16:04:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 16:04:39 -0700    

Click here for diff

Due to the differing APIs between versions, I forgot to deallocate the  
generated module in older LLVM versions, leading to a memory leak.  
  
Author: Andres Freund  

M src/backend/jit/llvm/llvmjit.c

Make new regression indpendent of max_parallel_workers_per_gather.

commit   : 0976c4ddd4c98d64b2f3140ee96b92367b763a44    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 14:59:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 14:59:37 -0700    

Click here for diff

The tests in e2f1eb0ee30d1 ("Implement partition-wise  
grouping/aggregation.") weren't independent of the server's  
max_parallel_workers_per_gather setting.  I (Andres) find it useful to  
locally run with that disabled, and the aforementioned patch broke  
this.  
  
Author: Jeevan Chalke  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/CAM2+6=UNWGKTgh9aOn4=SQ72HfFzbVFseh9=5N54bD6KB+D9OQ@mail.gmail.com  

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

Correct some typos in the new JIT code.

commit   : 96b5eac9186e033c67944124803ef5aa8f246afc    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 12:58:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 12:58:17 -0700    

Click here for diff

Author: Thomas Munro  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c

JIT tuple deforming in LLVM JIT provider.

commit   : 32af96b2b118cd204ca809d7c48c7f8ea7f879cf    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 12:57:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Mar 2018 12:57:19 -0700    

Click here for diff

Performing JIT compilation for deforming gains performance benefits  
over unJITed deforming from compile-time knowledge of the tuple  
descriptor. Fixed column widths, NOT NULLness, etc can be taken  
advantage of.  
  
Right now the JITed deforming is only used when deforming tuples as  
part of expression evaluation (and obviously only if the descriptor is  
known). It's likely to be beneficial in other cases, too.  
  
By default tuple deforming is JITed whenever an expression is JIT  
compiled. There's a separate boolean GUC controlling it, but that's  
expected to be primarily useful for development and benchmarking.  
  
Docs will follow in a later commit containing docs for the whole JIT  
feature.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/executor/execExpr.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeForeignscan.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/Makefile
M src/backend/jit/llvm/llvmjit.c
A src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/include/access/htup_details.h
M src/include/executor/execExpr.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/nodes/execnodes.h

Set random seed for pgbench.

commit   : 64f85894ad2730fb1449a8e81dd8026604e9a546    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 26 Mar 2018 18:26:27 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 26 Mar 2018 18:26:27 +0300    

Click here for diff

Setting random could increase reproducibility of test in some cases. Patch  
suggests three providers for seed: time (default), strong random  
generator (if available) and unsigned constant. Seed could be set from  
command line or enviroment variable.  
  
Author: Fabien Coelho  
Reviewed by: Chapman Flack  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

Fix thinko in comment

commit   : 530bcf7581574d5b0f26c2eaeef1c32bbcd37907    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 12:00:25 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 12:00:25 -0300    

Click here for diff

The listed numbers disagreed with the ones being used in the symbols;  
but instead of just fixing the numbers in the comment, use the symbolic  
name instead, which seems clearer.  
  
This has been wrong all along, so apply back to 9.5 where BRIN was  
introduced.  
  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_inclusion.c

Fix test impredictability

commit   : 186b6df2e62251e5e1f3cae8a3257c7226f4188c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 11:45:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 11:45:58 -0300    

Click here for diff

Test 'triggers' fails when another one creates triggers concurrently at  
some precise time, because of a missing WHERE clause.  
  
Per buildfarm members snapper, desmoxytes.  

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

Handle INSERT .. ON CONFLICT with partitioned tables

commit   : 555ee77a9668e3f1b03307055b5027e13bf1a715    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 10:43:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 10:43:54 -0300    

Click here for diff

Commit eb7ed3f30634 enabled unique constraints on partitioned tables,  
but one thing that was not working properly is INSERT/ON CONFLICT.  
This commit introduces a new node keeps state related to the ON CONFLICT  
clause per partition, and fills it when that partition is about to be  
used for tuple routing.  
  
Author: Amit Langote, Ɓlvaro Herrera  
Reviewed-by: Etsuro Fujita, Pavan Deolasee  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/insert.sgml
M src/backend/catalog/partition.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/parser/analyze.c
M src/include/catalog/partition.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/triggers.sql

Fix typo

commit   : 1b89c2188bd38eac68251f16051859996128f2d0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 09:55:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Mar 2018 09:55:42 -0300    

Click here for diff

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

Remove two tests inadvertently added in 2b27273435

commit   : 1d494b622fa9dfdbd7213f357cd38def0125a322    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 26 Mar 2018 22:53:02 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 26 Mar 2018 22:53:02 +1030    

Click here for diff

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

Optimize btree insertions for common case of increasing values

commit   : 2b27273435392d1606f0ffc95d73a439a457f08e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 26 Mar 2018 22:39:24 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 26 Mar 2018 22:39:24 +1030    

Click here for diff

Remember the last page of an index insert if it's the rightmost leaf  
page. If the next entry belongs on and can fit in the remembered page,  
insert the new entry there as long as we can get a lock on the page.  
Otherwise, fall back on the more expensive method of searching for  
the right place to insert the entry.  
  
This provides a performance improvement for the common case where an  
index entry is for monotonically increasing or nearly monotonically  
increasing value such as an identity field or a current timestamp.  
  
Pavan Deolasee  
Reviewed by Claudio Freire, Simon Riggs and Peter Geoghegan  
  
Discussion: https://postgr.es/m/CABOikdM9DrupjyKZZFM5k8-0RCDs1wk6JzEkg7UgSW6QzOwMZw@mail.gmail.com  

M src/backend/access/nbtree/nbtinsert.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Doc: add example of type resolution in nested UNIONs.

commit   : c515ff8d0a979fb553136a71388017c97785acda    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 16:15:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 16:15:15 -0400    

Click here for diff

Section 10.5 didn't say explicitly that multiple UNIONs are resolved  
pairwise.  Since the resolution algorithm is described as taking any  
number of inputs, readers might well think that a query like  
"select x union select y union select z" would be resolved by  
considering x, y, and z in one resolution step.  But that's not what  
happens (and I think that behavior is per SQL spec).  Add an example  
clarifying this point.  
  
Per bug #15129 from Philippe Beaudoin.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/typeconv.sgml

Fix unsafe extraction of the OID part of a relation filename.

commit   : d0c0c894533f906b13b79813f02b2982ac675074    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 15:15:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 15:15:32 -0400    

Click here for diff

Commit 8694cc96b did this randomly differently from other callers of  
parse_filename_for_nontemp_relation().  Perhaps unsurprisingly,  
the randomly different way is wrong; it fails to ensure the  
extracted string is null-terminated.  Per buildfarm member skink.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/basebackup.c

pg_resetwal: Allow users to change the WAL segment size

commit   : bf4a8676c316c177f395b54d3305ea4ccc838a66    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 25 Mar 2018 14:58:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 25 Mar 2018 14:58:49 -0400    

Click here for diff

This adds a new option --wal-segsize (analogous to initdb) that changes  
the WAL segment size in pg_control.  
  
Author: Nathan Bossart <[email protected]>  

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

initdb: Further polishing of --wal-segsize option

commit   : 8ad8d916f99d19e0be7800992c828c3c1a01b693    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 25 Mar 2018 09:17:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 25 Mar 2018 09:17:07 -0400    

Click here for diff

Extend documentation.  Improve option parsing in case no argument was  
specified.  

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

Remove useless if-test.

commit   : 3a2cb59887421a04b5ee158580198d731d115c61    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 14:54:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 14:54:16 -0400    

Click here for diff

Coverity complained that this check is pointless, and it's right.  
There is no case where we'd call ExecutorStart with a null plannedstmt,  
and if we did, it'd have crashed before here.  Thinko in commit cc415a56d.  

M src/backend/executor/execMain.c

Doc: remove extra comma in syntax summary for array_fill().

commit   : ee4a2c4a0345f2589ce32b64493b1b14e87f0465    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 12:38:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 12:38:21 -0400    

Click here for diff

Noted by Scott Ure.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

pg_resetwal: Fix logical typo in code

commit   : cc547cf08fe62e90f34a780a6b4fe428336ab3ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 25 Mar 2018 09:09:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 25 Mar 2018 09:09:04 -0400    

Click here for diff

introduced in f1a074b146c900bd439b6ef1953866f41b61a669  

M src/bin/pg_resetwal/pg_resetwal.c

Add #includes missed in commit e22b27f0cb3ee03ee300d431997f5944ccf2d7b3.

commit   : 2dd3f969f5f2de92182038d1e33b11c798688bc9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 00:46:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 00:46:43 -0400    

Click here for diff

Leaving out getopt_long.h works on some platforms, but not all.  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c

Stabilize regression test result.

commit   : 038a2ed1392363a59adeee4e86d848ca74ce39c5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 00:09:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Mar 2018 00:09:26 -0400    

Click here for diff

If random() returns a result sufficiently close to zero, float8out  
switches to scientific notation, breaking this test case's expectation  
that the output should look like '0.xxxxxxxxx'.  Casting to numeric  
should fix that.  Per buildfarm member pogona.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Mop-up for commit feb8254518752b2cb4a8964c374dd82d49ef0e0d.

commit   : da616950cee395919f835b5cbec3d23c4844015a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Mar 2018 23:44:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Mar 2018 23:44:01 -0400    

Click here for diff

Missed these occurrences of some of the adjusted error messages.  
Per buildfarm member pademelon.  

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

Add long options to pg_resetwal and pg_controldata

commit   : e22b27f0cb3ee03ee300d431997f5944ccf2d7b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 21:14:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 21:14:20 -0400    

Click here for diff

We were running out of good single-letter options for some upcoming  
pg_resetwal functionality, so add long options to create more  
possibilities.  Add to pg_controldata as well for symmetry.  
  
based on patch by Bossart, Nathan <[email protected]>  

M doc/src/sgml/ref/pg_controldata.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c

initdb: Improve --wal-segsize handling

commit   : 496d56670af44a2a578c15195c36f797e29cff24    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 15:40:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 15:40:21 -0400    

Click here for diff

Give separate error messages for when the argument is not a number and  
when it is not the right kind of number.  
  
Fix wording in the help message.  

M src/bin/initdb/initdb.c

Improve pg_resetwal documentation

commit   : 4644a1170f0ad88f92d2835f589fffb6aa38c129    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 15:38:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Mar 2018 15:38:57 -0400    

Click here for diff

Clarify that the -l option takes a file name, not an "address", and that  
that might be different from the LSN if nondefault WAL segment sizes are  
used.  

M doc/src/sgml/ref/pg_resetwal.sgml

Don't qualify type pg_catalog.text in extend-extensions-example.

commit   : c92f7c62232c67b1a35ca5524a41a5cddfe66746    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 23 Mar 2018 20:31:03 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 23 Mar 2018 20:31:03 -0700    

Click here for diff

Extension scripts begin execution with pg_catalog at the front of the  
search path, so type names reliably refer to pg_catalog.  Remove these  
superfluous qualifications.  Earlier <programlisting> of this <sect1>  
already omitted them.  Back-patch to 9.3 (all supported versions).  

M doc/src/sgml/extend.sgml

Small refactoring

commit   : 52f3a9d6a32c0c070a15486c3aecbc4405d2da88    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 17:18:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 17:18:22 -0400    

Click here for diff

Put the "atomic" argument of ExecuteDoStmt() and ExecuteCallStmt() into  
a variable instead of repeating the formula.  

M src/backend/tcop/utility.c

Further fix interaction of Perl and stdbool.h

commit   : 66ee8513d10fb207907d61dd6cf42db7d703af5d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 16:31:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 16:31:49 -0400    

Click here for diff

In the case that PostgreSQL uses stdbool.h but Perl doesn't, we need to  
prevent Perl from defining bool, to prevent compiler warnings about  
redefinition.  

M src/pl/plperl/plperl.h

Fix make rules that generate multiple output files.

commit   : 4b538727e2a0e5eae228650c1c145c90471aa521    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Mar 2018 13:45:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Mar 2018 13:45:37 -0400    

Click here for diff

For years, our makefiles have correctly observed that "there is no correct  
way to write a rule that generates two files".  However, what we did is to  
provide empty rules that "generate" the secondary output files from the  
primary one, and that's not right either.  Depending on the details of  
the creating process, the primary file might end up timestamped later than  
one or more secondary files, causing subsequent make runs to consider the  
secondary file(s) out of date.  That's harmless in a plain build, since  
make will just re-execute the empty rule and nothing happens.  But it's  
fatal in a VPATH build, since make will expect the secondary file to be  
rebuilt in the build directory.  This would manifest as "file not found"  
failures during VPATH builds from tarballs, if we were ever unlucky enough  
to ship a tarball with apparently out-of-date secondary files.  (It's not  
clear whether that has ever actually happened, but it definitely could.)  
  
To ensure that secondary output files have timestamps >= their primary's,  
change our makefile convention to be that we provide a "touch $@" action  
not an empty rule.  Also, make sure that this rule actually gets invoked  
during a distprep run, else the hazard remains.  
  
It's been like this a long time, so back-patch to all supported branches.  
  
In HEAD, I skipped the changes in src/backend/catalog/Makefile, because  
those rules are due to get replaced soon in the bootstrap data format  
patch, and there seems no need to create a merge issue for that patch.  
If for some reason we fail to land that patch in v11, we'll need to  
back-fill the changes in that one makefile from v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib
M src/backend/Makefile
M src/backend/parser/Makefile
M src/backend/storage/lmgr/Makefile
M src/backend/utils/Makefile
M src/bin/psql/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/pl/plpgsql/src/Makefile
M src/test/isolation/Makefile

Exclude unlogged tables from base backups

commit   : 8694cc96b52a967a49725f32be7aa77fd3b6ac25    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 23 Mar 2018 19:14:12 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 23 Mar 2018 19:14:12 +0300    

Click here for diff

Exclude unlogged tables from base backup entirely except init fork which marks  
created unlogged table. The next question is do not backup temp table but  
it's a story for separate patch.  
  
Author: David Steele  
Review by: Adam Brightwell, Masahiko Sawada  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/replication/basebackup.c
M src/backend/storage/file/reinit.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/include/storage/reinit.h

Fix interaction of Perl and stdbool.h

commit   : 7ba7986fb4364e889a705c9973fefa138650091c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 10:31:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 10:31:10 -0400    

Click here for diff

Revert the PL/Perl-specific change in  
9a95a77d9d5d3003d2d67121f2731b6e5fc37336.  We must not prevent Perl from  
using stdbool.h when it has been built to do so, even if it uses an  
incompatible size.  Otherwise, we would be imposing our bool on Perl,  
which will lead to crashes because of the size mismatch.  
  
Instead, we undef bool after including the Perl headers, as we did  
previously, but now only if we are not using stdbool.h ourselves.  
Record that choice in c.h as USE_STDBOOL.  This will also make it easier  
to apply that coding pattern elsewhere if necessary.  

M src/include/c.h
M src/pl/plperl/plperl.h

pg_resetwal: Prevent division-by-zero errors

commit   : f1a074b146c900bd439b6ef1953866f41b61a669    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 10:10:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 10:10:49 -0400    

Click here for diff

Handle the case where the pg_control file specifies a WAL segment size  
of 0 bytes.  This would previously have led to a division by zero error.  
Change this to assume the whole file is corrupt and go to guess  
everything.  
  
Discussion: https://www.postgresql.org/message-id/a6163ad7-cc99-fdd1-dfad-25df73032ab8%402ndquadrant.com  

M src/bin/pg_resetwal/pg_resetwal.c
A src/bin/pg_resetwal/t/002_corrupted.pl

Allow FOR EACH ROW triggers on partitioned tables

commit   : 86f575948c773b0ec5b0f27066e37dd93a7f0a96    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Mar 2018 10:48:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Mar 2018 10:48:22 -0300    

Click here for diff

Previously, FOR EACH ROW triggers were not allowed in partitioned  
tables.  Now we allow AFTER triggers on them, and on trigger creation we  
cascade to create an identical trigger in each partition.  We also clone  
the triggers to each partition that is created or attached later.  
  
This means that deferred unique keys are allowed on partitioned tables,  
too.  
  
Author: Ɓlvaro Herrera  
Reviewed-by: Peter Eisentraut, Simon Riggs, Amit Langote, Robert Haas,  
	Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_trigger.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/tcop/utility.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_constraint_fn.h
M src/include/commands/trigger.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/triggers.out
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source
M src/test/regress/sql/oidjoins.sql
M src/test/regress/sql/triggers.sql

pg_resetwal: Add simple test suite

commit   : 5700aa130186e0b5d600806645b051bfd9067f09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 08:42:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Mar 2018 08:42:25 -0400    

Click here for diff

Some subsequent patches will add to this, but to avoid conflicts, set up  
the basics separately.  

M src/bin/pg_resetwal/.gitignore
M src/bin/pg_resetwal/Makefile
A src/bin/pg_resetwal/t/001_basic.pl

Adapt expression JIT to stdbool.h introduction.

commit   : 2111a48a0c5e5198a68cba0c8fb82c4f61be5928    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 22:15:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 22:15:51 -0700    

Click here for diff

The LLVM JIT provider uses clang to synchronize types between normal C  
code and runtime generated code. Clang represents stdbool.h style  
booleans in return values & parameters differently from booleans  
stored in variables.  
  
Thus the expression compilation code from 2a0faed9d needs to be  
adapted to 9a95a77d9. Instead of hardcoding i8 as the type for  
booleans (which already was wrong on some edge case platforms!), use  
postgres' notion of a boolean as used for storage and for parameters.  
  
Per buildfarm animal xenodermus.  
  
Author: Andres Freund  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h

Fix whitespace

commit   : fdb78948d89b5cc018e3dbf851fafd1652cb5921    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Mar 2018 22:36:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Mar 2018 22:36:17 -0400    

Click here for diff

M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c

Remove stdbool workaround in sepgsql

commit   : 5c4920be303e0ab894c9a3a48e780b7e0e56240b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Mar 2018 21:59:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Mar 2018 21:59:28 -0400    

Click here for diff

Since we now use stdbool.h in c.h, this workaround breaks the build and  
is no longer necessary, so remove it.  (Technically, there could be  
platforms with a 4-byte bool in stdbool.h, in which case we would not  
include stdbool.h in c.h, and so the old problem that caused this  
workaround would reappear.  But this combination is not known to happen  
on the range of platforms where sepgsql can be built.)  

M contrib/sepgsql/label.c

Use stdbool.h if suitable

commit   : 9a95a77d9d5d3003d2d67121f2731b6e5fc37336    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Mar 2018 20:42:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Mar 2018 20:42:25 -0400    

Click here for diff

Using the standard bool type provided by C allows some recent compilers  
and debuggers to give better diagnostics.  Also, some extension code and  
third-party headers are increasingly pulling in stdbool.h, so it's  
probably saner if everyone uses the same definition.  
  
But PostgreSQL code is not prepared to handle bool of a size other than  
1, so we keep our own old definition if we encounter a stdbool.h with a  
bool of a different size.  (Among current build farm members, this only  
applies to old macOS versions on PowerPC.)  
  
To check that the used bool is of the right size, add a static  
assertions about size of GinTernaryValue vs bool.  This is currently the  
only place that assumes that bool and char are of the same size.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/tsginidx.c
M src/include/access/gin.h
M src/include/c.h
M src/include/pg_config.h.win32
M src/pl/plperl/plperl.h

Add expression compilation support to LLVM JIT provider.

commit   : 2a0faed9d7028e3830998bd6ca900be651274e27    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 02:20:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 02:20:46 -0700    

Click here for diff

In addition to the interpretation of expressions (which back  
evaluation of WHERE clauses, target list projection, aggregates  
transition values etc) support compiling expressions to native code,  
using the infrastructure added in earlier commits.  
  
To avoid duplicating a lot of code, only support emitting code for  
cases that are likely to be performance critical. For expression steps  
that aren't deemed that, use the existing interpreter.  
  
The generated code isn't great - some architectural changes are  
required to address that. But this already yields a significant  
speedup for some analytics queries, particularly with WHERE clauses  
filtering a lot, or computing multiple aggregates.  
  
Author: Andres Freund  
Tested-By: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  
  
Disable JITing for VALUES() nodes.  
  
VALUES() nodes are only ever executed once. This is primarily helpful  
for debugging, when forcing JITing even for cheap queries.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/nodeValuesscan.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/Makefile
M src/backend/jit/llvm/llvmjit.c
A src/backend/jit/llvm/llvmjit_expr.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/include/fmgr.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/tools/pgindent/typedefs.list

Add FIELDNO_* macro designating offset into structs required for JIT.

commit   : 7ced1d1247286399df53823eb76cacaf6d7fdb22    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 23 Jan 2018 23:20:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 23 Jan 2018 23:20:02 -0800    

Click here for diff

For any interesting JIT target, fields inside structs need to be  
accessed. b96d550e contains infrastructure for syncing the definition  
of types between postgres C code and runtime code generation with  
LLVM. But that doesn't sync the number or names of fields inside  
structs, just the types (including padding etc).  
  
One option would be to hardcode the offset numbers in the JIT code,  
but that'd be hard to keep in sync. Instead add macros indicating the  
field offset to the fields that need to be accessed. Not pretty, but  
manageable.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/executor/nodeAgg.h
M src/include/executor/tuptable.h
M src/include/fmgr.h
M src/include/nodes/execnodes.h

Expand list of synchronized types and functions in LLVM JIT provider.

commit   : fb46ac26fe493839d6cf3ab8d20bc62a285f7649    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Feb 2018 09:09:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Feb 2018 09:09:28 -0800    

Click here for diff

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

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/jit/llvmjit.h

Improve style guideline compliance of assorted error-report messages.

commit   : feb8254518752b2cb4a8964c374dd82d49ef0e0d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 17:33:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 17:33:10 -0400    

Click here for diff

Per the project style guide, details and hints should have leading  
capitalization and end with a period.  On the other hand, errcontext should  
not be capitalized and should not end with a period.  To support well  
formatted error contexts in dblink, extend dblink_res_error() to take a  
format+arguments rather than a hardcoded string.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/file_fdw/file_fdw.c
M contrib/pgcrypto/px.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M src/backend/access/transam/xlog.c
M src/backend/replication/logical/logical.c

Consider Parallel Append of partial paths for UNION [ALL].

commit   : 88ba0ae2aa4aaba8ea0d85c0ff81cc46912d9308    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 16:09:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 16:09:28 -0400    

Click here for diff

Without this patch, we can implement a UNION or UNION ALL as an  
Append where Gather appears beneath one or more of the Append  
branches, but this lets us put the Gather node on top, with  
a partial path for each relation underneath.  
  
There is considerably more work that could be done to improve  
planning in this area, but that will probably need to wait  
for a future release.  
  
Patch by me, reviewed and tested by Ashutosh Bapat and Rajkumar  
Raghuwanshi.  
  
Discussion: http://postgr.es/m/CA+TgmoaLRAOqHmMZx=ESM3VDEPceg+-XXZsRXQ8GtFJO_zbMSw@mail.gmail.com  

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

Sync up our various ways of estimating pg_class.reltuples.

commit   : 7c91a0364fcf5d739a09cc87e7adb1d4a33ed112    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 15:47:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 15:47:29 -0400    

Click here for diff

VACUUM thought that reltuples represents the total number of tuples in  
the relation, while ANALYZE counted only live tuples.  This can cause  
"flapping" in the value when background vacuums and analyzes happen  
separately.  The planner's use of reltuples essentially assumes that  
it's the count of live (visible) tuples, so let's standardize on having  
it mean live tuples.  
  
Another issue is that the definition of "live tuple" isn't totally clear;  
what should be done with INSERT_IN_PROGRESS or DELETE_IN_PROGRESS tuples?  
ANALYZE's choices in this regard are made on the assumption that if the  
originating transaction commits at all, it will happen after ANALYZE  
finishes, so we should ignore the effects of the in-progress transaction  
--- unless it is our own transaction, and then we should count it.  
Let's propagate this definition into VACUUM, too.  
  
Likewise propagate this definition into CREATE INDEX, and into  
contrib/pgstattuple's pgstattuple_approx() function.  
  
Tomas Vondra, reviewed by Haribabu Kommi, some corrections by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgstattuple/pgstatapprox.c
M doc/src/sgml/catalogs.sgml
M src/backend/catalog/index.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c

Basic planner and executor integration for JIT.

commit   : cc415a56d09a8da7c919088036b6097b70f10791    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:45:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:45:07 -0700    

Click here for diff

This adds simple cost based plan time decision about whether JIT  
should be performed. jit_above_cost, jit_optimize_above_cost are  
compared with the total cost of a plan, and if the cost is above them  
JIT is performed / optimization is performed respectively.  
  
For that PlannedStmt and EState have a jitFlags (es_jit_flags) field  
that stores information about what JIT operations should be performed.  
  
EState now also has a new es_jit field, which can store a  
JitContext. When there are no errors the context is released in  
standard_ExecutorEnd().  
  
It is likely that the default values for jit_[optimize_]above_cost  
will need to be adapted further, but in my test these values seem to  
work reasonably.  
  
Author: Andres Freund, with feedback by Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execUtils.c
M src/backend/jit/jit.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/jit/jit.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h

Add helpers for emitting LLVM IR.

commit   : 7ec0d80c0508eae35ac8e19d041f9ba1276de08e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:10:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:10:33 -0700    

Click here for diff

These basically just help to make code a bit more concise and pgindent  
proof.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

A src/include/jit/llvmjit_emit.h
M src/tools/pgindent/typedefs.list

Debugging and profiling support for LLVM JIT provider.

commit   : 250bca7fc145b143d5e9aeeca66f0bb36cf4d5ef    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:07:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:07:55 -0700    

Click here for diff

This currently requires patches to the LLVM codebase to be  
effective (submitted upstream), the GUCs are available without those  
patches however.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/utils/misc/guc.c
M src/include/jit/jit.h

Support for optimizing and emitting code in LLVM JIT provider.

commit   : b96d550eb03cfdb000def70912ec840dbe7f67da    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:05:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Mar 2018 11:05:22 -0700    

Click here for diff

This commit introduces the ability to actually generate code using  
LLVM. In particular, this adds:  
  
- Ability to emit code both in heavily optimized and largely  
  unoptimized fashion  
- Batching facility to allow functions to be defined in small  
  increments, but optimized and emitted in executable form in larger  
  batches (for performance and memory efficiency)  
- Type and function declaration synchronization between runtime  
  generated code and normal postgres code. This is critical to be able  
  to access struct fields etc.  
- Developer oriented jit_dump_bitcode GUC, for inspecting / debugging  
  the generated code.  
- per JitContext statistics of number of functions, time spent  
  generating code, optimizing, and emitting it.  This will later be  
  employed for EXPLAIN support.  
  
This commit doesn't yet contain any code actually generating  
functions. That'll follow in later commits.  
  
Documentation for GUCs added, and for JIT in general, will be added in  
later commits.  
  
Author: Andres Freund, with contributions by Pierre Ducroquet  
Testing-By: Thomas Munro, Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M .gitignore
M src/Makefile.global.in
M src/backend/common.mk
M src/backend/jit/jit.c
M src/backend/jit/llvm/Makefile
M src/backend/jit/llvm/llvmjit.c
A src/backend/jit/llvm/llvmjit_types.c
M src/backend/utils/misc/guc.c
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/tools/pgindent/typedefs.list

Avoid creating a TOAST table for a partitioned table.

commit   : 2fe6336e2d48d77fca6d0849f03c0faa06725159    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:49:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:49:38 -0400    

Click here for diff

It's useless.  
  
Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/toasting.c

Fix typo in comment.

commit   : 8a8c4f3b325ea00cc4ffb106a71e65e79c5d7af9    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:36:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:36:14 -0400    

Click here for diff

Michael Paquier  
  
Discussion: http://postgr.es/m/[email protected]  

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

doc: Update parallel join documentation for Parallel Shared Hash.

commit   : f644c3b386acc9e1bfef2c4fbe738706d3ccf3a3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:25:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:25:59 -0400    

Click here for diff

Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=3XdL=+bn3=WQVCCT5wwfAEv-4onKpk+XQZdwDXv6etzA@mail.gmail.com  

M doc/src/sgml/parallel.sgml

Fix tuple counting in SP-GiST index build.

commit   : 649f1792508fb040a9b70c68dfedd6b93897e087    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 13:23:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 13:23:47 -0400    

Click here for diff

Count the number of tuples in the index honestly, instead of assuming  
that it's the same as the number of tuples in the heap.  (It might be  
different if the index is partial.)  
  
Back-patch to all supported versions.  
  
Tomas Vondra  
  
Discussion: https://postgr.es/m/[email protected]  

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

Call pgstat_report_activity() in parallel CREATE INDEX workers.

commit   : 7de4a1bcc56f494acbd0d6e70781df877dc8ecb5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:15:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 13:15:03 -0400    

Click here for diff

Also set debug_query_string.  
  
Oversight in commit 9da0cc35284bdbe8d442d732963303ff0e0a40bc  
  
Peter Geoghegan, per a report by Phil Florent.  
  
Discussion: https://postgr.es/m/CAH2-Wzmf-34hD4n40uTuE-ZY9P5c%2BmvhFbCdQfN%3DKrKiVm3j3A%40mail.gmail.com  

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

Fix errors in contrib/bloom index build.

commit   : c35b47286960d2c7885dce162ddfe26939d0d373    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 13:13:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Mar 2018 13:13:58 -0400    

Click here for diff

Count the number of tuples in the index honestly, instead of assuming  
that it's the same as the number of tuples in the heap.  (It might be  
different if the index is partial.)  
  
Fix counting of tuples in current index page, too.  This error would  
have led to failing to write out the final page of the index if it  
contained exactly one tuple, so that the last tuple of the relation  
would not get indexed.  
  
Back-patch to 9.6 where contrib/bloom was added.  
  
Tomas Vondra and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c

Implement partition-wise grouping/aggregation.

commit   : e2f1eb0ee30d144628ab523432320f174a2c8966    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 12:49:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Mar 2018 12:49:48 -0400    

Click here for diff

If the partition keys of input relation are part of the GROUP BY  
clause, all the rows belonging to a given group come from a single  
partition.  This allows aggregation/grouping over a partitioned  
relation to be broken down * into aggregation/grouping on each  
partition.  This should be no worse, and often better, than the normal  
approach.  
  
If the GROUP BY clause does not contain all the partition keys, we can  
still perform partial aggregation for each partition and then finalize  
aggregation after appending the partial results.  This is less certain  
to be a win, but it's still useful.  
  
Jeevan Chalke, Ashutosh Bapat, Robert Haas.  The larger patch series  
of which this patch is a part was also reviewed and tested by Antonin  
Houska, Rajkumar Raghuwanshi, David Rowley, Dilip Kumar, Konstantin  
Knizhnik, Pascal Legrand, and Rafia Sabih.  
  
Discussion: http://postgr.es/m/CAM2+6=V64_xhstVHie0Rz=KPEQnLJMZt_e314P0jaT_oJ9MR8A@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
A src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/sysviews.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/partition_aggregate.sql
M src/tools/pgindent/typedefs.list

Add conditional.c to libpgfeutils for MSVC build

commit   : 2058d6a22b43a97d1069a51bd95ad56759b3c7bc    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 22 Mar 2018 19:45:34 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 22 Mar 2018 19:45:34 +0300    

Click here for diff

conditional.c was moved in f67b113ac62777d18cd20d3c4d05be964301b936 commit  
but forgotten to add to Windows build system.  
  
I don't have a Windows box, so blind attempt.  

M src/tools/msvc/Mkvcbuild.pm

UINT64CONST'fy long constants in pgbench

commit   : 2216fded1ebc9940f3e4c9454cb2f5c937794f1c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 22 Mar 2018 19:38:54 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 22 Mar 2018 19:38:54 +0300    

Click here for diff

In commit e51a04840a1c45db101686bef0b7025d5014c74b it was missed 64-bit  
constants, wrap them with UINT64CONST().  
  
Per buildfarm member dromedary and gripe from Tom Lane  

M src/bin/pgbench/pgbench.c

Add \if support to pgbench

commit   : f67b113ac62777d18cd20d3c4d05be964301b936    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 22 Mar 2018 17:42:03 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 22 Mar 2018 17:42:03 +0300    

Click here for diff

Patch adds \if to pgbench as it done for psql. Implementation shares condition  
stack code with psql, so, this code is moved to fe_utils directory.  
  
Author: Fabien COELHO with minor editorization by me  
Review by: Vik Fearing, Fedor Sigaev  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.20.1711252200190.28523@lancre  

M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/Makefile
M src/bin/psql/command.h
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.l
M src/fe_utils/Makefile
R083 src/bin/psql/conditional.c src/fe_utils/conditional.c
R076 src/bin/psql/conditional.h src/include/fe_utils/conditional.h

Improve ANALYZE's strategy for finding MCVs.

commit   : b5db1d93d2a6e2d3186f8798a5d06e07b7536a1d    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 22 Mar 2018 09:37:36 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 22 Mar 2018 09:37:36 +0000    

Click here for diff

Previously, a value was included in the MCV list if its frequency was  
25% larger than the estimated average frequency of all nonnull values  
in the table.  For uniform distributions, that can lead to values  
being included in the MCV list and significantly overestimated on the  
basis of relatively few (sometimes just 2) instances being seen in the  
sample.  For non-uniform distributions, it can lead to too few values  
being included in the MCV list, since the overall average frequency  
may be dominated by a small number of very common values, while the  
remaining values may still have a large spread of frequencies, causing  
both substantial overestimation and underestimation of the remaining  
values.  Furthermore, increasing the statistics target may have little  
effect because the overall average frequency will remain relatively  
unchanged.  
  
Instead, populate the MCV list with the largest set of common values  
that are statistically significantly more common than the average  
frequency of the remaining values.  This takes into account the  
variance of the sample counts, which depends on the counts themselves  
and on the proportion of the table that was sampled.  As a result, it  
constrains the relative standard error of estimates based on the  
frequencies of values in the list, reducing the chances of too many  
values being included.  At the same time, it allows more values to be  
included, since the MCVs need only be more common than the remaining  
non-MCVs, rather than the overall average.  Thus it tends to produce  
fewer MCVs than the previous code for uniform distributions, and more  
for non-uniform distributions, reducing estimation errors in both  
cases.  In addition, the algorithm responds better to increasing the  
statistics target, allowing more values to be included in the MCV list  
when more of the table is sampled.  
  
Jeff Janes, substantially modified by me. Reviewed by John Naylor and  
Tomas Vondra.  
  
Discussion: https://postgr.es/m/CAMkU=1yvdGvW9TmiLAhz2erFnvnPFYHbOZuO+a=4DVkzpuQ2tw@mail.gmail.com  

M src/backend/commands/analyze.c

Add file containing extensions of the LLVM C API.

commit   : 31bc604e0b74805ff9e84a2d549ca82be665d0a6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 19:44:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 19:44:17 -0700    

Click here for diff

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

M src/backend/jit/llvm/Makefile
A src/backend/jit/llvm/llvmjit_wrap.cpp
M src/include/jit/llvmjit.h

Basic JIT provider and error handling infrastructure.

commit   : 432bb9e04da4d4a1799b1fe7c723b975cb070c43    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 19:28:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 19:28:28 -0700    

Click here for diff

This commit introduces:  
  
1) JIT provider abstraction, which allows JIT functionality to be  
   implemented in separate shared libraries. That's desirable because  
   it allows to install JIT support as a separate package, and because  
   it allows experimentation with different forms of JITing.  
2) JITContexts which can be, using functions introduced in follow up  
   commits, used to emit JITed functions, and have them be cleaned up  
   on error.  
3) The outline of a LLVM JIT provider, which will be fleshed out in  
   subsequent commits.  
  
Documentation for GUCs added, and for JIT in general, will be added in  
later commits.  
  
Author: Andres Freund, with architectural input from Jeff Davis  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile
M src/backend/Makefile
A src/backend/jit/Makefile
A src/backend/jit/jit.c
A src/backend/jit/llvm/Makefile
A src/backend/jit/llvm/llvmjit.c
A src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/resowner/resowner.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
A src/include/jit/jit.h
A src/include/jit/llvmjit.h
M src/include/utils/resowner_private.h
M src/tools/pgindent/exclude_file_patterns
M src/tools/pgindent/typedefs.list

Fix typo in BITCODE_CXXFLAGS assignment.

commit   : 4317cc68a284f041abc583ced4ef7ede2f73fb51    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 18:41:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 18:41:08 -0700    

Click here for diff

Typoed-In: 5b2526c83832e  
Reported-By: Catalin Iacob  

M configure
M configure.in

Empty CXXFLAGS inherited from autoconf.

commit   : a02671cfdeac3bb86ebf8f8577faf69730c4f80e    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 18:40:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Mar 2018 18:40:23 -0700    

Click here for diff

We do the same for CFLAGS.  This was an omission in 6869b4f25.  
  
Reported-By: Catalin Iacob  

M configure
M configure.in

Prevent extensions from creating custom GUCs that are GUC_LIST_QUOTE.

commit   : 846b5a525746b83813771ec4720d664408c47c43    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 20:11:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 20:11:07 -0400    

Click here for diff

Pending some solution for the problems noted in commit 742869946,  
disallow dynamic creation of GUC_LIST_QUOTE variables.  
  
If there are any extensions out there using this feature, they'd not  
be happy for us to start enforcing this rule in minor releases, so  
this is a HEAD-only change.  The previous commit didn't make things  
any worse than they already were for such cases.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c.

commit   : 742869946f4ff121778c2e5923ab51a451b16497    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 20:03:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 20:03:28 -0400    

Click here for diff

Code that prints out the contents of setconfig or proconfig arrays in  
SQL format needs to handle GUC_LIST_QUOTE variables differently from  
other ones, because for those variables, flatten_set_variable_args()  
already applied a layer of quoting.  The value can therefore safely  
be printed as-is, and indeed must be, or flatten_set_variable_args()  
will muck it up completely on reload.  For all other GUC variables,  
it's necessary and sufficient to quote the value as a SQL literal.  
  
We'd recognized the need for this long ago, but mis-analyzed the  
need slightly, thinking that all GUC_LIST_INPUT variables needed  
the special treatment.  That's actually wrong, since a valid value  
of a LIST variable might include characters that need quoting,  
although no existing variables accept such values.  
  
More to the point, we hadn't made any particular effort to keep the  
various places that deal with this up-to-date with the set of variables  
that actually need special treatment, meaning that we'd do the wrong  
thing with, for example, temp_tablespaces values.  This affects dumping  
of SET clauses attached to functions, as well as ALTER DATABASE/ROLE SET  
commands.  
  
In ruleutils.c we can fix it reasonably honestly by exporting a guc.c  
function that allows discovering the flags for a given GUC variable.  
But pg_dump doesn't have easy access to that, so continue the old method  
of having a hard-wired list of affected variable names.  At least we can  
fix it to have just one list not two, and update the list to match  
current reality.  
  
A remaining problem with this is that it only works for built-in  
GUC variables.  pg_dump's list obvious knows nothing of third-party  
extensions, and even the "ask guc.c" method isn't bulletproof since  
the relevant extension might not be loaded.  There's no obvious  
solution to that, so for now, we'll just have to discourage extension  
authors from inventing custom GUCs that need GUC_LIST_QUOTE.  
  
This has been busted for a long time, so back-patch to all supported  
branches.  
  
Michael Paquier and Tom Lane, reviewed by Kyotaro Horiguchi and  
Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/include/utils/guc.h
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Improve predtest.c's handling of cases with NULL-constant inputs.

commit   : 0f0deb71948321efc89cf4e3e8cbd9750cc9e566    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 18:30:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 18:30:46 -0400    

Click here for diff

Currently, if operator_predicate_proof() is given an operator clause like  
"something op NULL", it just throws up its hands and reports it can't prove  
anything.  But we can often do better than that, if the operator is strict,  
because then we know that the clause returns NULL overall.  Depending on  
whether we're trying to prove or refute something, and whether we need  
weak or strong semantics for NULL, this may be enough to prove the  
implication, especially when we rely on the standard rule that "false  
implies anything".  In particular, this lets us do something useful with  
questions like "does X IN (1,3,5,NULL) imply X <= 5?"  The null entry  
in the IN list can effectively be ignored for this purpose, but the  
proof rules were not previously smart enough to deduce that.  
  
This patch is by me, but it owes something to previous work by  
Amit Langote to try to solve problems of the form mentioned.  
Thanks also to Emre Hasegeli and Ashutosh Bapat for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/predtest.c
M src/test/modules/test_predtest/expected/test_predtest.out
M src/test/modules/test_predtest/sql/test_predtest.sql
M src/test/regress/expected/inherit.out

Change oddly-chosen OID allocation.

commit   : 27ba260c739e4e10e28688993208c3ffa1b469ab    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 14:57:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Mar 2018 14:57:12 -0400    

Click here for diff

I noticed while fooling with John Naylor's bootstrap-data patch that we had  
one high-numbered manually assigned OID, 8888, which evidently came from a  
submission that the committer didn't bother to bring into line with usual  
OID allocation practices before committing.  That's a bad idea, because it  
creates a hazard for other patches that may be temporarily using high OID  
numbers.  Change it to something more in line with what we usually do.  
  
This evidently dates to commit abb173392.  It's too late to change it  
in released branches, but we can fix it in HEAD.  

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

pg_controldata: Prevent division-by-zero errors

commit   : 4731d848f23e08a9396b4831d13fbb6dd460faf2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 12:14:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 12:14:53 -0400    

Click here for diff

If the control file is corrupted and specifies the WAL segment size  
to be 0 bytes, calculating the latest checkpoint's REDO WAL file  
will fail with a division-by-zero error.  Show it as "???" instead.  
  
Also reword the warning message a bit and send it to stdout, like the  
other pre-existing warning messages.  
  
Add some tests for dealing with a corrupted pg_control file.  
  
Author: Nathan Bossart <[email protected]>, tests by me  

M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_controldata/t/001_pg_controldata.pl

Fix relcache handling of the 'default' partition

commit   : 56163004b8b2151db279744b77138d4d90e2d5cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Mar 2018 12:03:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Mar 2018 12:03:35 -0300    

Click here for diff

My commit 4dba331cb3dc that moved around CommandCounterIncrement calls  
in partitioning DDL code unearthed a problem with the relcache handling  
for the 'default' partition: the construction of a correct relcache  
entry for the partitioned table was at the mercy of lack of CCI calls in  
non-trivial amounts of code.  This was prone to creating problems later  
on, as the code develops.  This was visible as a test failure in a  
compile with RELCACHE_FORCE_RELASE (buildfarm member prion).  
  
The problem is that after the mentioned commit it was possible to create  
a relcache entry that had incomplete information regarding the default  
partition because I introduced a CCI between adding the catalog entries  
for the default partition (StorePartitionBound) and the update of  
pg_partitioned_table entry for its parent partitioned table  
(update_default_partition_oid).  It seems the best fix is to move the  
latter so that it occurs inside the former; the purposeful lack of  
intervening CCI should be more obvious, and harder to break.  
  
I also remove a check in RelationBuildPartitionDesc that returns NULL if  
the key is not set.  I couldn't find any place that needs this hack  
anymore; probably it was required because of bugs that have since been  
fixed.  
  
Fix a few typos I noticed while reviewing the code involved.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c

Add general purpose hasing functions to pgbench.

commit   : e51a04840a1c45db101686bef0b7025d5014c74b    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 21 Mar 2018 18:01:23 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 21 Mar 2018 18:01:23 +0300    

Click here for diff

Hashing function is useful for simulating real-world workload in test like  
WEB workload, as an example - YCSB benchmarks.  
  
Author: Ildar Musin with minor editorization by me  
Reviewed by: Fabien Coelho, me  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix typo.

commit   : 8bb3c7d347f0c74aa12beeef3599984021323e7d    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 21 Mar 2018 23:08:43 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 21 Mar 2018 23:08:43 +0900    

Click here for diff

Patch by me.  

M doc/src/sgml/protocol.sgml

Handle heap rewrites even better in logical decoding

commit   : 325f2ec5557fd1c9156c910102522e04cb42d99c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 09:13:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 09:13:24 -0400    

Click here for diff

Logical decoding should not publish anything about tables created as  
part of a heap rewrite during DDL.  Those tables don't exist externally,  
so consumers of logical decoding cannot do anything sensible with that  
information.  In ab28feae2bd3d4629bd73ae3548e671c57d785f0, we worked  
around this for built-in logical replication, but that was hack.  
  
This is a more proper fix: We mark such transient heaps using the new  
field pg_class.relwrite, linking to the original relation OID.  By  
default, we ignore them in logical decoding before they get to the  
output plugin.  Optionally, a plugin can register their interest in  
getting such changes, if they handle DDL specially, in which case the  
new field will help them get information about the actual table.  
  
Reviewed-by: Craig Ringer <[email protected]>  

M contrib/test_decoding/expected/concurrent_ddl_dml.out
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/specs/concurrent_ddl_dml.spec
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/heap.c
M src/backend/catalog/toasting.c
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_class.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h

Add strict_word_similarity to pg_trgm module

commit   : be8a7a6866276b228b4ffaa3003e1dc2dd1d140a    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 21 Mar 2018 14:57:42 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 21 Mar 2018 14:57:42 +0300    

Click here for diff

strict_word_similarity is similar to existing word_similarity function but  
it takes into account word boundaries to compute similarity.  
  
Author: Alexander Korotkov  
Review by: David Steele, Liudmila Mantrova, me  
Discussion: https://www.postgresql.org/message-id/flat/CY4PR17MB13207ED8310F847CF117EED0D85A0@CY4PR17MB1320.namprd17.prod.outlook.com  

M contrib/pg_trgm/Makefile
A contrib/pg_trgm/expected/pg_strict_word_trgm.out
A contrib/pg_trgm/pg_trgm–1.3–1.4.sql
M contrib/pg_trgm/pg_trgm.control
A contrib/pg_trgm/sql/pg_strict_word_trgm.sql
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M doc/src/sgml/pgtrgm.sgml

Add configure tests for stdbool.h and sizeof bool

commit   : f20b3285340cc0576ab8445f483700983cf2ba9f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 07:43:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 07:43:29 -0400    

Click here for diff

This will allow us to assess how many platforms have bool with a size  
other than 1, which will help us decide how to go forward with using  
stdbool.h.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Repair crash with unsortable grouping sets.

commit   : d2d79887eadff72c339a072ef693bb6016651d30    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 21 Mar 2018 10:42:04 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 21 Mar 2018 10:42:04 +0000    

Click here for diff

If there were multiple grouping sets, none of them empty, all of which  
were unsortable, then an oversight in consider_groupingsets_paths led  
to a null pointer dereference. Fix, and add a regression test for this  
case.  
  
Per report from Dang Minh Huong, though I didn't use their patch.  
  
Backpatch to 10.x where hashed grouping sets were added.  

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

Rework word_similarity documentation, make it close to actual algorithm.

commit   : aea7c17e86e99a7ed4da489b3df2b5493b5e5e95    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 21 Mar 2018 14:35:56 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 21 Mar 2018 14:35:56 +0300    

Click here for diff

word_similarity before claimed as returning similarity of closest word in  
string, but, actually it returns similarity of substring. Also fix mistyped  
comments.  
  
Author: Alexander Korotkov  
Review by: David Steele, Liudmila Mantrova  
Discussionis:  
https://www.postgresql.org/message-id/flat/CY4PR17MB13207ED8310F847CF117EED0D85A0@CY4PR17MB1320.namprd17.prod.outlook.com  
https://www.postgresql.org/message-id/flat/f43b242d-000c-f4c8-cb8b-d37e9752cd93%40postgrespro.ru  

M contrib/pg_trgm/trgm_op.c
M doc/src/sgml/pgtrgm.sgml

doc: Small wording improvement

commit   : d652e3525b8ff988db717ed66c467b6fd78a32bc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 07:27:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Mar 2018 07:27:26 -0400    

Click here for diff

M doc/src/sgml/config.sgml

Handle EEOP_FUNCEXPR_[STRICT_]FUSAGE out of line.

commit   : 4c0000b839e6d4593e63439879b0c2abea14f426    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 17:32:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 17:32:21 -0700    

Click here for diff

This isn't a very common op, and it doesn't seem worth duplicating for  
JIT.  
  
Author: Andres Freund  

M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h

Add configure infrastructure (--with-llvm) to enable LLVM support.

commit   : 5b2526c83832e4e8a9f8db0389904ed2fb50ed37    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 17:26:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 17:26:25 -0700    

Click here for diff

LLVM will be used for *optional* Just-in-time compilation  
support. This commit just adds the configure infrastructure that  
detects LLVM.  
  
No documentation has been added for the --with-llvm flag, that'll be  
added after the actual supporting code has been added.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M aclocal.m4
A config/llvm.m4
M configure
M configure.in
M src/Makefile.global.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Add C++ support to configure.

commit   : 6869b4f2584787d9e4cefaab8a4bae1ecbe63766    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 15:41:15 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 15:41:15 -0700    

Click here for diff

This is an optional dependency. It'll be used for the upcoming LLVM  
based just in time compilation support, which needs to wrap a few LLVM  
C++ APIs so they're accessible from C..  
  
For now test for C++ compilers unconditionally, without failing if not  
present, to ensure wide buildfarm coverage. If we're bothered by the  
additional test times (which are quite short) or verbosity, we can  
later make the tests conditional on --with-llvm.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M doc/src/sgml/installation.sgml
M src/Makefile.global.in
M src/Makefile.shlib

Attempt to fix build with unusual OpenSSL versions

commit   : a364dfa4ac7337743050256c6eb17b5db5430173    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Mar 2018 16:44:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Mar 2018 16:44:52 -0400    

Click here for diff

Since e3bdb2d92600ed45bd46aaf48309a436a9628218, libpq failed to build on  
some platforms because they did not have SSL_clear_options().  Although  
mainline OpenSSL introduced SSL_clear_options() after  
SSL_OP_NO_COMPRESSION, so the code should have built fine, at least an  
old NetBSD version (build farm "coypu" NetBSD 5.1 gcc 4.1.3 PR-20080704  
powerpc) has SSL_OP_NO_COMPRESSION but no SSL_clear_options().  
  
So add a configure check for SSL_clear_options().  If we don't find it,  
skip the call.  That means on such a platform one cannot *enable* SSL  
compression if the built-in default is off, but that seems an unlikely  
combination anyway and not very interesting in practice.  

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

Add PGAC_PROG_VARCC_VARFLAGS_OPT autoconf macro.

commit   : 3de04e4ed12d0794e87e1db2e729d126cf183a58    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 12:58:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Mar 2018 12:58:08 -0700    

Click here for diff

The new macro allows to test flags for different compilers and to  
store them in different CFLAG like variables.  The existing  
PGAC_PROG_CC_CFLAGS_OPT and PGAC_PROG_CC_VAR_OPT are changed to be  
just wrappers around the new function.  
  
This'll be used by the upcoming LLVM support, to separately detect  
capabilities used by clang, when generating bitcode.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure

Make configure check for a couple more Perl modules for --enable-tap-tests.

commit   : 264eb03aab067da6db2a0de907a8421ce6865d60    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Mar 2018 15:16:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Mar 2018 15:16:16 -0400    

Click here for diff

Red Hat's notion of a basic Perl installation doesn't include Test::More  
or Time::HiRes, and reportedly some Debian installs also omit Time::HiRes.  
Check for those during configure to spare the user the pain of digging  
through check-world output to find out what went wrong.  While we're at it,  
we should also check the version of Test::More, since TestLib.pm requires  
at least 0.87.  
  
In principle this could be back-patched, but it's probably not necessary.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Don't pass the grouping target around unnecessarily.

commit   : 94150513ec12c13eb7c98430fc34f477896d38c9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Mar 2018 11:33:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Mar 2018 11:33:44 -0400    

Click here for diff

Since commit 4f15e5d09de276fb77326be5567dd9796008ca2e made grouped_rel  
set reltarget, a variety of other functions can just get it from  
grouped_rel instead of having to pass it around explicitly.  Simplify  
accordingly.  
  
Patch by me, reviewed by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/CA+TgmoZ+ZJTVad-=vEq393N99KTooxv9k7M+z73qnTAqkb49BQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h

Doc: typo fix, "PG_" should be "TG_" here.

commit   : b6cbe9ea1a6e6879926318158d73d430c14aca90    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Mar 2018 11:34:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Mar 2018 11:34:12 -0400    

Click here for diff

Too much PG on the brain in commit 769159fd3, evidently.  
Noted by [email protected].  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

Determine grouping strategies in create_grouping_paths.

commit   : b5996c2791f36a79332e3cb7130e9125a0372730    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Mar 2018 11:31:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Mar 2018 11:31:06 -0400    

Click here for diff

Partition-wise aggregate will call create_ordinary_grouping_paths  
multiple times and we don't want to redo this work every time; have  
the caller do it instead and pass the details down.  
  
Patch by me, reviewed by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/CA+TgmoY7VYYn9a7YHj1nJL6zj6BkHmt4K-un9LRmXkyqRZyynA@mail.gmail.com  

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

Defer creation of partially-grouped relation until it's needed.

commit   : 4f15e5d09de276fb77326be5567dd9796008ca2e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Mar 2018 11:18:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Mar 2018 11:18:04 -0400    

Click here for diff

This avoids unnecessarily creating a RelOptInfo for which we have no  
actual need.  This idea is from Ashutosh Bapat, who wrote a very  
different patch to accomplish a similar goal.  It will be more  
important if and when we get partition-wise aggregate, since then  
there could be many partially grouped relations all of which could  
potentially be unnecessary.  In passing, this sets the grouping  
relation's reltarget, which wasn't done previously but makes things  
simpler for this refactoring.  
  
Along the way, adjust things so that add_paths_to_partial_grouping_rel,  
now renamed create_partial_grouping_paths, does not perform the Gather  
or Gather Merge steps to generate non-partial paths from partial  
paths; have the caller do it instead.  This is again for the  
convenience of partition-wise aggregate, which wants to inject  
additional partial paths are created and before we decide which ones  
to Gather/Gather Merge.  This might seem like a separate change, but  
it's actually pretty closely entangled; I couldn't really see much  
value in separating it and having to change some things twice.  
  
Patch by me, reviewed by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/CA+TgmoZ+ZJTVad-=vEq393N99KTooxv9k7M+z73qnTAqkb49BQ@mail.gmail.com  

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

commit   : 4dba331cb3dc1b5ffb0680ed8efae847de216796    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Mar 2018 11:19:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Mar 2018 11:19:41 -0300    

Click here for diff

It makes sense to do the CCIs in the places that do catalog updates,  
rather than before the places that error out because the former ones  
fail to do it.  In particular, it looks like StorePartitionBound() and  
IndexSetParentIndex() ought to make their own CCIs.  
  
Per review comments from Peter Eisentraut for row-level triggers on  
partitioned tables.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c

Prevent query-lifespan memory leakage of SP-GiST traversal values.

commit   : 467963c3e9c5ba9a953959f8aebcdd7206188a18    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Mar 2018 23:59:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Mar 2018 23:59:17 -0400    

Click here for diff

The original coding of the SP-GiST scan traversalValue feature (commit  
ccd6eb49a) arranged for traversal values to be stored in the query's main  
executor context.  That's fine if there's only one index scan per query,  
but if there are many, we have a memory leak as successive scans create  
new traversal values.  Fix it by creating a separate memory context for  
traversal values, which we can reset during spgrescan().  Back-patch  
to 9.6 where this code was introduced.  
  
In principle, adding the traversalCxt field to SpGistScanOpaqueData  
creates an ABI break in the back branches.  But I (tgl) have little  
sympathy for extensions including spgist_private.h, so I'm not very  
worried about that.  Alternatively we could stick the new field at the  
end of the struct in back branches, but that has its own downsides.  
  
Anton Dignƶs, reviewed by Alexander Kuzmenkov  
  
Discussion: https://postgr.es/m/CALNdv1jb6y2Te-m8xHLxLX12RsBmZJ1f4hESX7J0HjgyOhA9eA@mail.gmail.com  

M src/backend/access/spgist/spgscan.c
M src/include/access/spgist_private.h

Add missing break

commit   : 13c7c65ec900a30bcddcb27f5fd138dcdbc2ca2e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Mar 2018 19:45:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Mar 2018 19:45:25 -0400    

Click here for diff

M src/backend/parser/analyze.c

Fix some corner-case issues in REFRESH MATERIALIZED VIEW CONCURRENTLY.

commit   : 6497a18e6c1b5874566a77737ec3d381fded3ec2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Mar 2018 18:49:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Mar 2018 18:49:53 -0400    

Click here for diff

refresh_by_match_merge() has some issues in the way it builds a SQL  
query to construct the "diff" table:  
  
1. It doesn't require the selected unique index(es) to be indimmediate.  
2. It doesn't pay attention to the particular equality semantics enforced  
by a given index, but just assumes that they must be those of the column  
datatype's default btree opclass.  
3. It doesn't check that the indexes are btrees.  
4. It's insufficiently careful to ensure that the parser will pick the  
intended operator when parsing the query.  (This would have been a  
security bug before CVE-2018-1058.)  
5. It's not careful about indexes on system columns.  
  
The way to fix #4 is to make use of the existing code in ri_triggers.c  
for generating an arbitrary binary operator clause.  I chose to move  
that to ruleutils.c, since that seems a more reasonable place to be  
exporting such functionality from than ri_triggers.c.  
  
While #1, #3, and #5 are just latent given existing feature restrictions,  
and #2 doesn't arise in the core system for lack of alternate opclasses  
with different equality behaviors, #4 seems like an issue worth  
back-patching.  That's the bulk of the change anyway, so just back-patch  
the whole thing to 9.4 where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/matview.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/include/utils/builtins.h

Don't use an Msys virtual path to create a tablespace

commit   : 9ad21a6957ff2d8743e9a59ba062d3c009b24ec4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 20 Mar 2018 08:25:36 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 20 Mar 2018 08:25:36 +1030    

Click here for diff

The new unlogged_reinit recovery tests create a new tablespace using  
TestLib.pm's tempdir. However, on msys that function returns a virtual  
path that isn't understood by Postgres. Here we add a new function to  
TestLib.pm to turn such a path into a real path on the underlying file  
system, and use it in the new test to create the tablespace. The new  
function is essentially a NOOP everywhere but msys.  

M src/test/perl/TestLib.pm
M src/test/recovery/t/014_unlogged_reinit.pl

Fix performance hazard in REFRESH MATERIALIZED VIEW CONCURRENTLY.

commit   : 6fbd5cce22ebd2203d99cd7dcd179d0e1138599e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Mar 2018 17:23:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Mar 2018 17:23:07 -0400    

Click here for diff

Jeff Janes discovered that commit 7ca25b7de made one of the queries run by  
REFRESH MATERIALIZED VIEW CONCURRENTLY perform badly.  The root cause is  
bad cardinality estimation for correlated quals, but a principled solution  
to that problem is some way off, especially since the planner lacks any  
statistics about whole-row variables.  Moreover, in non-error cases this  
query produces no rows, meaning it must be run to completion; but use of  
LIMIT 1 encourages the planner to pick a fast-start, slow-completion plan,  
exactly not what we want.  Remove the LIMIT clause, and instead rely on  
the count parameter we pass to SPI_execute() to prevent excess work if the  
query does return some rows.  
  
While we've heard no field reports of planner misbehavior with this query,  
it could be that people are having performance issues that haven't reached  
the level of pain needed to cause a bug report.  In any case, that LIMIT  
clause can't possibly do anything helpful with any existing version of the  
planner, and it demonstrably can cause bad choices in some cases, so  
back-patch to 9.4 where the code was introduced.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAMkU=1z-JoGymHneGHar1cru4F1XDfHqJDzxP_CtK5cL3DOfmg@mail.gmail.com  

M src/backend/commands/matview.c

Remove unnecessary members from ModifyTableState and ExecInsert

commit   : ee0a1fc84eb29c916687dc5bd26909401d3aa8cd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Mar 2018 18:09:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Mar 2018 18:09:43 -0300    

Click here for diff

These values can be obtained from the ModifyTable node which is already  
a part of both the ModifyTableState and ExecInsert.  
  
Author: Ɓlvaro Herrera, Amit Langote  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h

Expand comment a little bit

commit   : 839a8eb2b3df68e105fb4f7a72e71652d6becc7a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Mar 2018 18:01:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Mar 2018 18:01:14 -0300    

Click here for diff

The previous commit removed a comment that was a bit more verbose than  
its replacement.  

M src/backend/executor/nodeModifyTable.c

Fix state reversal after partition tuple routing

commit   : 6666ee49f49c4a6b008591aea457becffa0df041    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Mar 2018 17:43:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Mar 2018 17:43:57 -0300    

Click here for diff

We make some changes to ModifyTableState and the EState it uses whenever  
we route tuples to partitions; but we weren't restoring properly in all  
cases, possibly causing crashes when partitions with different tuple  
descriptors are targeted by tuples inserted in the same command.  
Refactor some code, creating ExecPrepareTupleRouting, to encapsulate the  
needed state changing logic, and have it invoked one level above its  
current place (ie. put it in ExecModifyTable instead of ExecInsert);  
this makes it all more readable.  
  
Add a test case to exercise this.  
  
We don't support having views as partitions; and since only views can  
have INSTEAD OF triggers, there is no point in testing for INSTEAD OF  
when processing insertions into a partitioned table.  Remove code that  
appears to support this (but which is actually never relevant.)  
  
In passing, fix location of some very confusing comments in  
ModifyTableState.  
  
Reported-by: Amit Langote  
Author: Etsuro Fujita, Amit Langote  
Discussion: https://postgr/es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Generate a separate upper relation for each stage of setop planning.

commit   : c596fadbfe20ff50a8e5f4bc4b4ff5b7c302ecc0    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Mar 2018 11:55:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Mar 2018 11:55:38 -0400    

Click here for diff

Commit 3fc6e2d7f5b652b417fa6937c34de2438d60fa9f made setop planning  
stages return paths rather than plans, but all such paths were loosely  
associated with a single RelOptInfo, and only the final path was added  
to the RelOptInfo.  Even at the time, it was foreseen that this should  
be changed, because there is otherwise no good way for a single stage  
of setop planning to return multiple paths.  With this patch, each  
stage of set operation planning now creates a separate RelOptInfo;  
these are distinguished by using appropriate relid sets.  Note that  
this patch does nothing whatsoever about actually returning multiple  
paths for the same set operation; it just makes it possible for a  
future patch to do so.  
  
Along the way, adjust things so that create_upper_paths_hook is called  
for each of these new RelOptInfos rather than just once, since that  
might be useful to extensions using that hook.  It might be a good  
to provide an FDW API here as well, but I didn't try to do that for  
now.  
  
Patch by me, reviewed and tested by Ashutosh Bapat and Rajkumar  
Raghuwanshi.  
  
Discussion: http://postgr.es/m/CA+TgmoaLRAOqHmMZx=ESM3VDEPceg+-XXZsRXQ8GtFJO_zbMSw@mail.gmail.com  

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

Rewrite recurse_union_children to iterate, rather than recurse.

commit   : 49525c46309828b3024fe8040fa99c7dcc83933d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Mar 2018 11:54:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Mar 2018 11:54:56 -0400    

Click here for diff

Also, rename it to plan_union_chidren, so the old name wasn't  
very descriptive.  This results in a small net reduction in code,  
seems at least to me to be easier to understand, and saves  
space on the process stack.  
  
Patch by me, reviewed and tested by Ashutosh Bapat and Rajkumar  
Raghuwanshi.  
  
Discussion: http://postgr.es/m/CA+TgmoaLRAOqHmMZx=ESM3VDEPceg+-XXZsRXQ8GtFJO_zbMSw@mail.gmail.com  

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

Fix typo in comment

commit   : 71cce90ee99098f52e65278b96662e32ca005771    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 19 Mar 2018 10:45:44 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 19 Mar 2018 10:45:44 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

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

Doc: note that statement-level view triggers require an INSTEAD OF trigger.

commit   : a4678320471380e5159a8d6e89466d74d6ee1739    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Mar 2018 15:10:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Mar 2018 15:10:28 -0400    

Click here for diff

If a view lacks an INSTEAD OF trigger, DML on it can only work by rewriting  
the command into a command on the underlying base table(s).  Then we will  
fire triggers attached to those table(s), not those for the view.  This  
seems appropriate from a consistency standpoint, but nowhere was the  
behavior explicitly documented, so let's do that.  
  
There was some discussion of throwing an error or warning if a statement  
trigger is created on a view without creating a row INSTEAD OF trigger.  
But a simple implementation of that would result in dump/restore ordering  
hazards.  Given that it's been like this all along, and we hadn't heard  
a complaint till now, a documentation improvement seems sufficient.  
  
Per bug #15106 from Pu Qun.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/trigger.sgml

Fix pg_recvlogical for pre-10 versions

commit   : 8d2814f274def85f39fbe997d454b01628cb5667    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 18 Mar 2018 13:08:25 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 18 Mar 2018 13:08:25 +0100    

Click here for diff

In e170b8c8, protection against modified search_path was added. However,  
PostgreSQL versions prior to 10 does not accept SQL commands over a  
replication connection, so the protection would generate a syntax error.  
  
Since we cannot run SQL commands on it, we are also not vulnerable to  
the issue that e170b8c8 fixes, so we can just skip this command for  
older versions.  
  
Author: Michael Paquier <[email protected]>  

M src/bin/pg_basebackup/streamutil.c

Fix overflow handling in plpgsql's integer FOR loops.

commit   : 2dbee9f19f6c6ac6c013f668611492486e623807    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Mar 2018 15:38:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Mar 2018 15:38:15 -0400    

Click here for diff

The test to exit the loop if the integer control value would overflow  
an int32 turns out not to work on some ICC versions, as it's dependent  
on the assumption that the compiler will execute the code as written  
rather than "optimize" it.  ICC lacks any equivalent of gcc's -fwrapv  
switch, so it was optimizing on the assumption of no integer overflow,  
and that breaks this.  Rewrite into a form that in fact does not  
do any overflowing computations.  
  
Per Tomas Vondra and buildfarm member fulmar.  It's been like this  
for a long time, although it was not till we added a regression test  
case covering the behavior (in commit dd2243f2a) that the problem  
became apparent.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_exec.c

Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.

commit   : 8f5ac440430ab1d4b0309a76df278caa87018beb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Mar 2018 14:59:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Mar 2018 14:59:31 -0400    

Click here for diff

"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message  
like "cannot extract system attribute from virtual tuple", if the cursor  
was using a index-only scan for the target table.  Fix it by digging the  
current TID out of the indexscan state.  
  
It seems likely that the same failure could occur for CustomScan plans  
and perhaps some FDW plan types, so that leaving this to be treated as an  
internal error with an obscure message isn't as good an idea as it first  
seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver  
a more on-topic message.  I chose to make the message match what you get  
for the case where execCurrentOf can't identify the target scan node at  
all, "cursor "foo" is not a simply updatable scan of table "bar"".  
Perhaps it should be different, but we can always adjust that later.  
  
In the future, it might be nice to provide hooks that would let custom  
scan providers and/or FDWs deal with this in other ways; but that's  
not a suitable topic for a back-patchable bug fix.  
  
It's been like this all along, so back-patch to all supported branches.  
  
Yugo Nagata and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/executor/execCurrent.c
M src/include/executor/tuptable.h
M src/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

Fix closing of incorrectly named cursor.

commit   : e400840b1d92cb6a654c30a6aca68ba31eb8afbb    
  
author   : Michael Meskes <[email protected]>    
date     : Sat, 17 Mar 2018 17:24:32 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Sat, 17 Mar 2018 17:24:32 +0100    

Click here for diff

Patch by "Shinoda, Noriyoshi" <[email protected]>  

M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr

Set libpq sslcompression to off by default

commit   : e3bdb2d92600ed45bd46aaf48309a436a9628218    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Mar 2018 08:56:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Mar 2018 08:56:50 -0400    

Click here for diff

Since SSL compression is no longer recommended, turn the default in  
libpq from on to off.  
  
OpenSSL 1.1.0 and many distribution packages already turn compression  
off by default, so such a server won't accept compression anyway.  So  
this will mainly affect users of older OpenSSL installations.  
  
Also update the documentation to make clear that this setting is no  
longer recommended.  
  
Discussion: https://www.postgresql.org/message-id/flat/595cf3b1-4ffe-7f05-6f72-f72b7afa7993%402ndquadrant.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c

Add ssl_passphrase_command setting

commit   : 8a3d9425290ff5f6434990349886afae9e1c6008    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2018 13:28:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2018 13:28:38 -0500    

Click here for diff

This allows specifying an external command for prompting for or  
otherwise obtaining passphrases for SSL key files.  This is useful  
because in many cases there is no TTY easily available during service  
startup.  
  
Also add a setting ssl_passphrase_command_supports_reload, which allows  
supporting SSL configuration reload even if SSL files need passphrases.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/libpq/Makefile
A src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/libpq.h
M src/test/ssl/Makefile
M src/test/ssl/README
A src/test/ssl/ssl/server-password.key
M src/test/ssl/t/001_ssltests.pl
M src/tools/msvc/Mkvcbuild.pm

Add 'unit' parameter to ExplainProperty{Integer,Float}.

commit   : 7a50bb690b4837d29e715293c156cff2fc72885c    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Mar 2018 23:13:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Mar 2018 23:13:12 -0700    

Click here for diff

This allows to deduplicate some existing code, but mainly avoids some  
duplication in upcoming commits.  
  
In passing, fix variable names indicating wrong unit (seconds instead  
of ms).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Make ExplainPropertyInteger accept 64bit input, remove *Long variant.

commit   : f3e4b95edb6cbf0cd41dc9ff0c884bfdc425e6fb    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Mar 2018 23:13:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Mar 2018 23:13:12 -0700    

Click here for diff

'long' is not useful type across platforms, as it's 32bit on 32 bit  
platforms, and even on some 64bit platforms (e.g. windows) it's still  
only 32bits wide.  
  
As ExplainPropertyInteger should never be performance critical, change  
it to accept a 64bit argument and remove ExplainPropertyLong.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Fix query-lifespan memory leakage in repeatedly executed hash joins.

commit   : 9e17bdb8a525ff89c4535cd153dc0f2fa813ea59    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Mar 2018 16:03:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Mar 2018 16:03:45 -0400    

Click here for diff

ExecHashTableCreate allocated some memory that wasn't freed by  
ExecHashTableDestroy, specifically the per-hash-key function information.  
That's not a huge amount of data, but if one runs a query that repeats  
a hash join enough times, it builds up.  Fix by arranging for the data  
in question to be kept in the hashtable's hashCxt instead of leaving it  
"loose" in the query-lifespan executor context.  (This ensures that we'll  
also clean up anything that the hash functions allocate in fn_mcxt.)  
  
Per report from Amit Khandekar.  It's been like this forever, so back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/CAJ3gD9cFofAWGvcxLOxDHC=B0hjtW8yGmUsF2hdGh97CM38=7g@mail.gmail.com  

M src/backend/executor/nodeHash.c

Doc: explicitly point out that enum values can't be dropped.

commit   : 013c0baaddd9df7e1f940184a8ab8e478214b46c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Mar 2018 13:44:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Mar 2018 13:44:34 -0400    

Click here for diff

This was not stated in so many words anywhere.  Document it to make  
clear that it's a design limitation and not just an oversight or  
documentation omission.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Change transaction state debug strings to match enum symbols

commit   : 4120864b9e0a2a119786a1839d7c0988d0523ec0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 10:19:21 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 10:19:21 -0500    

Click here for diff

In some cases, these were different for no apparent reason, making  
debugging unnecessarily mysterious.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  

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

Improve savepoint error messages

commit   : 81148856b0310e7b0e578508ace44c0aefcbee07    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 20:29:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 20:29:27 -0500    

Click here for diff

Include the savepoint name in the error message and rephrase it a bit to  
match common style.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  

M src/backend/access/transam/xact.c
M src/test/regress/expected/transactions.out

Simplify parse representation of savepoint commands

commit   : ec87efde8dbc670467468860c5d577dc805dae5e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 20:57:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 20:57:06 -0500    

Click here for diff

Instead of embedding the savepoint name in a list and then requiring  
complex code to unpack it, just add another struct field to store it  
directly.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  

M src/backend/access/transam/xact.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/access/xact.h
M src/include/nodes/parsenodes.h

Rename TransactionChain functions

commit   : 04700b685f31508036456bea4d92533e5ceee9d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 20:44:15 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 20:44:15 -0500    

Click here for diff

We call this thing a "transaction block" everywhere except in a few  
functions, where it is mysteriously called a "transaction chain".  In  
the SQL standard, a transaction chain is something different.  So rename  
these functions to match the common terminology.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  

M src/backend/access/transam/xact.c
M src/backend/commands/cluster.c
M src/backend/commands/dbcommands.c
M src/backend/commands/discard.c
M src/backend/commands/portalcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/vacuum.c
M src/backend/replication/walsender.c
M src/backend/tcop/utility.c
M src/backend/utils/misc/guc.c
M src/backend/utils/time/snapmgr.c
M src/bin/psql/common.c
M src/include/access/xact.h

Update function comments

commit   : 8d47a908626bf0800dc6a01f4ff2b2bc15cdaf86    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 20:29:20 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 20:29:20 -0500    

Click here for diff

After a6542a4b6870a019cd952d055d2e7af2da2fe102, some function comments  
were misplaced.  Fix that.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  

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

Mop-up for letting VOID-returning SQL functions end with a SELECT.

commit   : 877cdf11eaa9cabcb9b1e3c1bef0760fe08efdc3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Mar 2018 12:48:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Mar 2018 12:48:13 -0400    

Click here for diff

Part of the intent in commit fd1a421fe was to allow SQL functions that are  
declared to return VOID to contain anything, including an unrelated final  
SELECT, the same as SQL-language procedures can.  However, the planner's  
inlining logic didn't get that memo.  Fix it, and add some regression tests  
covering this area, since evidently we had none.  
  
In passing, clean up some typos in comments in create_function_3.sql,  
and get rid of its none-too-safe assumption that DROP CASCADE notice  
output is immutably ordered.  
  
Per report from Prabhat Sahu.  
  
Discussion: https://postgr.es/m/CANEvxPqxAj6nNHVcaXxpTeEFPmh24Whu+23emgjiuKrhJSct0A@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/create_function_3.out
M src/test/regress/sql/create_function_3.sql

Fix msvc/ecpg_regression.proj for recent ECPG test additions.

commit   : 84a3611cccfa41f29d14a5b1ab4bcc58fba9b25b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Mar 2018 22:36:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Mar 2018 22:36:19 -0400    

Click here for diff

Commit 3b7ab4380 added some tests that require ecpg to be given the  
new "-C ORACLE" switch.  Teach the MSVC build infrastructure about  
that.  
  
Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/ecpg_regression.proj

Clean up duplicate table and function names in regression tests.

commit   : 2cf8c7aa48559699f0607f5cb77b661156ad9750    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Mar 2018 17:08:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Mar 2018 17:08:51 -0400    

Click here for diff

Many of the objects we create during the regression tests are put in the  
public schema, so that using the same names in different regression tests  
creates a hazard of test failures if any two such scripts run concurrently.  
This patch cleans up a bunch of latent hazards of that sort, as well as two  
live hazards.  
  
The current situation in this regard is far worse than it was a year or two  
back, because practically all of the partitioning-related test cases have  
reused table names with enthusiasm.  I despaired of cleaning up that mess  
within the five most-affected tests (create_table, alter_table, insert,  
update, inherit); fortunately those don't run concurrently.  
  
Other than partitioning problems, most of the issues boil down to using  
names like "foo", "bar", "tmp", etc, without thought for the fact that  
other test scripts might use similar names concurrently.  I've made an  
effort to make all such names more specific.  
  
One of the live hazards was that commit 7421f4b8 caused with.sql to  
create a table named "test", conflicting with a similarly-named table  
in alter_table.sql; this was exposed in the buildfarm recently.  
The other one was that join.sql and transactions.sql both create tables  
named "foo" and "bar"; but join.sql's uses of those names date back  
only to December or so.  
  
Since commit 7421f4b8 was back-patched to v10, back-patch a minimal  
fix for that problem.  The rest of this is just future-proofing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_procedure.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/indirect_toast.out
M src/test/regress/expected/join.out
M src/test/regress/expected/plancache.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/select_into.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/transactions.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/with.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_procedure.sql
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/indirect_toast.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/plancache.sql
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/polymorphism.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rangefuncs.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/select_into.sql
M src/test/regress/sql/select_parallel.sql
M src/test/regress/sql/transactions.sql
M src/test/regress/sql/updatable_views.sql
M src/test/regress/sql/with.sql

Split create_grouping_paths into degenerate and non-degenerate cases.

commit   : 1466bcfa4a83ba88b55cfcebb99080800627613a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Mar 2018 14:43:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Mar 2018 14:43:58 -0400    

Click here for diff

There's no functional change here, or at least I hope there isn't,  
just code rearrangement.  The rearrangement is motivated by  
partition-wise aggregate, which doesn't need to consider the  
degenerate case but wants to reuse the logic for the ordinary case.  
  
Based loosely on a patch from Ashutosh Bapat and Jeevan Chalke, but I  
whacked it around pretty heavily. The larger patch series of which  
this patch is a part was also reviewed and tested by Antonin Houska,  
Rajkumar Raghuwanshi, David Rowley, Dilip Kumar, Konstantin Knizhnik,  
Pascal Legrand, Rafia Sabih, and me.  
  
Discussion: http://postgr.es/m/CAFjFpRewpqCmVkwvq6qrRjmbMDpN0CZvRRzjd8UvncczA3Oz1Q@mail.gmail.com  

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

test_ddl_deparse: rename matview

commit   : a446a1c70f65c6c68598c2160b530606fa1b5c38    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Mar 2018 15:14:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Mar 2018 15:14:15 -0300    

Click here for diff

Should have done this in e69f5e0efca ...  
Per note from Tom Lane.  

M src/test/modules/test_ddl_deparse/expected/matviews.out
M src/test/modules/test_ddl_deparse/sql/matviews.sql

Clean up duplicate role and schema names in regression tests.

commit   : fb7db40ad26c3384f81d471442743076ade3f82a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Mar 2018 14:00:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Mar 2018 14:00:31 -0400    

Click here for diff

Since these names are global, using the same ones in different regression  
tests creates a hazard of test failures if any two such scripts run  
concurrently.  Let's establish a policy of not doing that.  In the cases  
where a conflict existed, I chose to rename both sides: in principle one  
script or the other could've been left in possession of the common name,  
but that seems to just invite more trouble of the same sort.  
  
There are a number of places where scripts are using names that seem  
unduly generic, but in the absence of actual conflicts I left them alone.  
  
In addition, fix insert.sql's use of "someone_else" as a role name.  
That's a flat out violation of longstanding project policy, so back-patch  
that change to v10 where the usage appeared.  The rest of this is just  
future-proofing, as no two of these scripts are actually run concurrently  
in the existing parallel_schedule.  
  
Conflicts of schema-qualified names also exist, but will be dealt with  
separately.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_procedure.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/identity.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/namespace.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rolenames.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_procedure.sql
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/identity.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/namespace.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rolenames.sql

Fix more format truncation issues

commit   : 3a4b891964a531aa7d242a48fcd9e41379863ead    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Mar 2018 11:10:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Mar 2018 11:10:41 -0400    

Click here for diff

Fix the warnings created by the compiler warning options  
-Wformat-overflow=2 -Wformat-truncation=2, supported since GCC 7.  This  
is a more aggressive variant of the fixes in  
6275f5d28a1577563f53f2171689d4f890a46881, which GCC 7 warned about by  
default.  
  
The issues are all harmless, but some dubious coding patterns are  
cleaned up.  
  
One issue that is of external interest is that BGW_MAXLEN is increased  
from 64 to 96.  Apparently, the old value would cause the bgw_name of  
logical replication workers to be truncated in some circumstances.  
  
But this doesn't actually add those warning options.  It appears that  
the warnings depend a bit on compilation and optimization options, so it  
would be annoying to have to keep up with that.  This is more of a  
once-in-a-while cleanup.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M contrib/pgstattuple/pgstattuple.c
M src/backend/commands/explain.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pgbench/pgbench.c
M src/include/postmaster/bgworker.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/pl/tcl/pltcl.c

commit   : 648a6c7bd815f98b35709bd56f9f1ca276b33ae6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Mar 2018 11:33:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Mar 2018 11:33:52 -0400    

Click here for diff

get_number_of_groups() and make_partial_grouping_target() currently  
fish information directly out of the PlannerInfo; in the former case,  
the target list, and in the latter case, the HAVING qual.  This works  
fine if there's only one grouping relation, but if the pending patch  
for partition-wise aggregate gets committed, we'll have multiple  
grouping relations and must therefore use appropriately translated  
versions of these values for each one.  To make that simpler, pass the  
values to be used as arguments.  
  
Jeevan Chalke.  The larger patch series of which this patch is a part  
was also reviewed and tested by Antonin Houska, Rajkumar Raghuwanshi,  
David Rowley, Dilip Kumar, Konstantin Knizhnik, Pascal Legrand, Rafia  
Sabih, and me.  
  
Discussion: http://postgr.es/m/CAM2+6=UqFnFUypOvLdm5TgC+2M=-E0Q7_LOh0VDFFzmk2BBPzQ@mail.gmail.com  
Discussion: http://postgr.es/m/CAM2+6=W+L=C4yBqMrgrfTfNtbtmr4T53-hZhwbA2kvbZ9VMrrw@mail.gmail.com  

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

restrict -> pg_restrict

commit   : 8d1b805fcc57be47d3269a13eb01d993fe768295    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Mar 2018 10:02:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Mar 2018 10:02:51 -0300    

Click here for diff

So that it works on MSVC, too.  
  
Author: Michaƫl Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/common/string.c
M src/include/common/string.h

test_ddl_deparse: Don't use pg_class as source for a matview

commit   : e69f5e0efcaf3f26381e56a1507cdf401bf1bdfd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Mar 2018 09:51:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Mar 2018 09:51:12 -0300    

Click here for diff

Doing so causes a pg_upgrade of a database containing these objects to  
fail whenever pg_class changes.  And it's pointless anyway: we have more  
interesting tables anyhow.  
  
Discussion: https://postgr.es/m/CAD5tBc+s8pW9WvH2+_z=B4x95FD4QuzZKcaMpff_9H4rS0VU1A@mail.gmail.com  

M src/test/modules/test_ddl_deparse/expected/matviews.out
M src/test/modules/test_ddl_deparse/sql/matviews.sql

logical replication: fix OID type mapping mechanism

commit   : 24c0a6c649768f428929e76dd7f5012ec9b93ce1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 14 Mar 2018 21:34:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 14 Mar 2018 21:34:26 -0300    

Click here for diff

The logical replication type map seems to have been misused by its only  
caller -- it would try to use the remote OID as input for local type  
routines, which unsurprisingly could result in bogus "cache lookup  
failed for type XYZ" errors, or random other type names being picked up  
if they happened to use the right OID.  Fix that, changing  
Oid logicalrep_typmap_getid(Oid remoteid) to  
char *logicalrep_typmap_gettypname(Oid remoteid)  
which is more useful.  If the remote type is not part of the typmap,  
this simply prints "unrecognized type" instead of choking trying to  
figure out -- a pointless exercise (because the only input for that  
comes from replication messages, which are not under the local node's  
control) and dangerous to boot, when called from within an error context  
callback.  
  
Once that is done, it comes to light that the local OID in the typmap  
entry was not being used for anything; the type/schema names are what we  
need, so remove local type OID from that struct.  
  
Once you do that, it becomes pointless to attach a callback to regular  
syscache invalidation.  So remove that also.  
  
Reported-by: Dang Minh Huong  
Author: Masahiko Sawada  
Reviewed-by: Ɓlvaro Herrera, Petr Jelƭnek, Dang Minh Huong, Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h

Fix compiler warning

commit   : 8df5a1c868cc28f89ac6221cff8e2b5c952d0eb6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 16:43:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 16:43:40 -0400    

Click here for diff

M src/pl/plpgsql/src/pl_exec.c

Remove pg_class.relhaspkey

commit   : f66e8bf875f691db4c5d0173fc39b5a9c3ec969c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 14:59:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 14:59:40 -0400    

Click here for diff

It is not used for anything internally, and it cannot be relied on for  
external uses, so it can just be removed.  To correct recommended way to  
check for a primary key is in pg_index.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/vacuum.c
M src/backend/rewrite/rewriteDefine.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h

Fix function-header comments in planner.c

commit   : 6b960aae90164cf85cf629e0af9286f97a9e51df    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 14 Mar 2018 13:51:15 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 14 Mar 2018 13:51:15 -0400    

Click here for diff

In b5635948ab1, a couple of function header comments weren't changed, or  
weren't changed correctly, to reflect the arguments being passed into  
the functions.  Specifically, get_number_of_groups() had the wrong  
argument name in the commit and create_grouping_paths() wasn't  
updated even though the arguments had been changed.  
  
The issue with create_grouping_paths() was noticed by Ashutosh Bapat,  
while I discovered the issue with get_number_of_groups() by looking to  
see if there were any similar issues from that commit.  
  
Discussion: https://postgr.es/m/CAFjFpRcbp4702jcp387PExt3fNCt62QJN8++DQGwBhsW6wRHWA@mail.gmail.com  

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

Fix typo in add_paths_to_append_rel()

commit   : 1f7b8967ef192fad75f72dd5eb12b188647b3670    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 14 Mar 2018 13:51:14 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 14 Mar 2018 13:51:14 -0400    

Click here for diff

The comment should have been referring to the number of workers, not the  
number of paths.  
  
Author: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAFjFpRcbp4702jcp387PExt3fNCt62QJN8++DQGwBhsW6wRHWA@mail.gmail.com  

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

Fixed compiler warnings in test case.

commit   : 20ba33dadedc46bad2eba5ca3c42bc500c36ade0    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 14 Mar 2018 17:17:53 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 14 Mar 2018 17:17:53 +0100    

Click here for diff

M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr

Support INOUT arguments in procedures

commit   : 33803f67f1c4cb88733cce61207bbf2bd5b599cc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 11:47:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 11:47:21 -0400    

Click here for diff

In a top-level CALL, the values of INOUT arguments will be returned as a  
result row.  In PL/pgSQL, the values are assigned back to the input  
arguments.  In other languages, the same convention as for return a  
record from a function is used.  That does not require any code changes  
in the PL implementations.  
  
Reviewed-by: Pavel Stehule <[email protected]>  

M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/call.sgml
M doc/src/sgml/ref/create_procedure.sgml
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/executor/functions.c
M src/backend/tcop/utility.c
M src/backend/utils/fmgr/funcapi.c
M src/include/commands/defrem.h
M src/include/executor/functions.h
M src/include/funcapi.h
M src/pl/plperl/expected/plperl_call.out
M src/pl/plperl/sql/plperl_call.sql
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/pl/plpython/expected/plpython_call.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/sql/plpython_call.sql
M src/pl/tcl/expected/pltcl_call.out
M src/pl/tcl/sql/pltcl_call.sql
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Log when a BRIN autosummarization request fails

commit   : 484a4a08abe316212d67d84bb8705b06e44f862d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 14 Mar 2018 11:53:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 14 Mar 2018 11:53:56 -0300    

Click here for diff

Autovacuum's 'workitem' request queue is of limited size, so requests  
can fail if they arrive more quickly than autovacuum can process them.  
Emit a log message when this happens, to provide better visibility of  
this.  
  
Backpatch to 10.  While this represents an API change for  
AutoVacuumRequestWork, that function is not yet prepared to deal with  
external modules calling it, so there doesn't seem to be any risk (other  
than log spam, that is.)  
  
Author: Masahiko Sawada  
Reviewed-by: Fabrƭzio Mello, Ildar Musin, Ɓlvaro Herrera  
Discussion: https://postgr.es/m/CAD21AoB1HrQhp6_4rTyHN5kWEJCEsG8YzsjZNt-ctoXSn5Uisw@mail.gmail.com  

M doc/src/sgml/brin.sgml
M src/backend/access/brin/brin.c
M src/backend/postmaster/autovacuum.c
M src/include/postmaster/autovacuum.h

Fix comment for ExecProcessReturning

commit   : 97d18ce27da47de2de60de8dfca8e364e71ff6fe    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 14 Mar 2018 09:28:08 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 14 Mar 2018 09:28:08 -0400    

Click here for diff

resultRelInfo is the argument for the function, not projectReturning.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Add tests for reinit.c

commit   : df411e7c664ee9a2395eb8c7a74ceddea818d489    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 09:03:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Mar 2018 09:03:44 -0400    

Click here for diff

This tests how the different forks of unlogged tables behave in crash  
recovery.  
  
Author: David Steele <[email protected]>  

A src/test/recovery/t/014_unlogged_reinit.pl

Add Oracle like handling of char arrays.

commit   : 3b7ab4380440d7b14ee390fabf39f6d87d7491e2    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 14 Mar 2018 00:54:13 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 14 Mar 2018 00:54:13 +0100    

Click here for diff

In some cases Oracle Pro*C handles char array differently than ECPG. This patch  
adds a Oracle compatibility mode to make ECPG behave like Pro*C.  
  
Patch by David Rader <[email protected]>  

M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/test/Makefile
A src/interfaces/ecpg/test/compat_oracle/.gitignore
A src/interfaces/ecpg/test/compat_oracle/Makefile
A src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
A src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr
A src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout

Fix double frees in ecpg.

commit   : db2fc801f66a70969cbdd5673ed9d02025c70695    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 14 Mar 2018 00:47:49 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 14 Mar 2018 00:47:49 +0100    

Click here for diff

Patch by Patrick Krecker <[email protected]>  

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

Expand AND/OR regression tests around NULL handling.

commit   : 1e22166e5ebbc3df7684209657ea58ba880546d6    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Mar 2018 17:07:16 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Mar 2018 17:07:16 -0800    

Click here for diff

Previously there were no tests verifying that NULL handling in AND/OR  
was correct (i.e. that NULL rather than false is returned if  
expression doesn't return true).  
  
Author: Andres Freund  

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

Add COSTS off to two EXPLAIN using tests.

commit   : 4f63e85eb149792492a703f01a3a5b89bf5509a7    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 12 Mar 2018 23:09:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 12 Mar 2018 23:09:58 -0700    

Click here for diff

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

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

Let Parallel Append over simple UNION ALL have partial subpaths.

commit   : 0927d2f46ddd4cf7d6bf2cc84b3be923e0aedc52    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Mar 2018 16:34:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Mar 2018 16:34:08 -0400    

Click here for diff

A simple UNION ALL gets flattened into an appendrel of subquery  
RTEs, but up until now it's been impossible for the appendrel to use  
the partial paths for the subqueries, so we can implement the  
appendrel as a Parallel Append but only one with non-partial paths  
as children.  
  
There are three separate obstacles to removing that limitation.  
First, when planning a subquery, propagate any partial paths to the  
final_rel so that they are potentially visible to outer query levels  
(but not if they have initPlans attached, because that wouldn't be  
safe).  Second, after planning a subquery, propagate any partial paths  
for the final_rel to the subquery RTE in the outer query level in the  
same way we do for non-partial paths.  Third, teach finalize_plan() to  
account for the possibility that the fake parameter we use for rescan  
signalling when the plan contains a Gather (Merge) node may be  
propagated from an outer query level.  
  
Patch by me, reviewed and tested by Amit Khandekar, Rajkumar  
Raghuwanshi, and Ashutosh Bapat.  Test cases based on examples by  
Rajkumar Raghuwanshi.  
  
Discussion: http://postgr.es/m/CA+Tgmoa6L9A1nNCk3aTDVZLZ4KkHDn1+tm7mFyFvP+uQPS7bAg@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

When updating reltuples after ANALYZE, just extrapolate from our sample.

commit   : d04900de7d0cb5b6ecb6d5bf9fdb6f3105824f81    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Mar 2018 13:24:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Mar 2018 13:24:27 -0400    

Click here for diff

The existing logic for updating pg_class.reltuples trusted the sampling  
results only for the pages ANALYZE actually visited, preferring to  
believe the previous tuple density estimate for all the unvisited pages.  
While there's some rationale for doing that for VACUUM (first that  
VACUUM is likely to visit a very nonrandom subset of pages, and second  
that we know for sure that the unvisited pages did not change), there's  
no such rationale for ANALYZE: by assumption, it's looked at an unbiased  
random sample of the table's pages.  Furthermore, in a very large table  
ANALYZE will have examined only a tiny fraction of the table's pages,  
meaning it cannot slew the overall density estimate very far at all.  
In a table that is physically growing, this causes reltuples to increase  
nearly proportionally to the change in relpages, regardless of what is  
actually happening in the table.  This has been observed to cause reltuples  
to become so much larger than reality that it effectively shuts off  
autovacuum, whose threshold for doing anything is a fraction of reltuples.  
(Getting to the point where that would happen seems to require some  
additional, not well understood, conditions.  But it's undeniable that if  
reltuples is seriously off in a large table, ANALYZE alone will not fix it  
in any reasonable number of iterations, especially not if the table is  
continuing to grow.)  
  
Hence, restrict the use of vac_estimate_reltuples() to VACUUM alone,  
and in ANALYZE, just extrapolate from the sample pages on the assumption  
that they provide an accurate model of the whole table.  If, by very bad  
luck, they don't, at least another ANALYZE will fix it; in the old logic  
a single bad estimate could cause problems indefinitely.  
  
In HEAD, let's remove vac_estimate_reltuples' is_analyze argument  
altogether; it was never used for anything and now it's totally pointless.  
But keep it in the back branches, in case any third-party code is calling  
this function.  
  
Per bug #15005.  Back-patch to all supported branches.  
  
David Gould, reviewed by Alexander Kuzmenkov, cosmetic changes by me  
  
Discussion: https://postgr.es/m/20180117164916.3fdcf2e9@engels  

M contrib/pgstattuple/pgstatapprox.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/include/commands/vacuum.h

Avoid holding AutovacuumScheduleLock while rechecking table statistics.

commit   : 38f7831d703be98aaece8af6625faeab5123a02c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Mar 2018 12:28:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Mar 2018 12:28:15 -0400    

Click here for diff

In databases with many tables, re-fetching the statistics takes some time,  
so that this behavior seriously decreases the available concurrency for  
multiple autovac workers.  There's discussion afoot about more complete  
fixes, but a simple and back-patchable amelioration is to claim the table  
and release the lock before rechecking stats.  If we find out there's no  
longer a reason to process the table, re-taking the lock to un-claim the  
table is cheap enough.  
  
(This patch is quite old, but got lost amongst a discussion of more  
aggressive fixes.  It's not clear when or if such a fix will be  
accepted, but in any case it'd be unlikely to get back-patched.  
Let's do this now so we have some improvement for the back branches.)  
  
In passing, make the normal un-claim step take AutovacuumScheduleLock  
not AutovacuumLock, since that is what is documented to protect the  
wi_tableoid field.  This wasn't an actual bug in view of the fact that  
readers of that field hold both locks, but it creates some concurrency  
penalty against operations that need only AutovacuumLock.  
  
Back-patch to all supported versions.  
  
Jeff Janes  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Set connection back to NULL after freeing it.

commit   : b32fad52e94307261471d05a79c70f8382d71657    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 12 Mar 2018 23:52:08 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 12 Mar 2018 23:52:08 +0100    

Click here for diff

Patch by Jeevan Ladhe <[email protected]>  

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

Move strtoint() to common

commit   : 17bb62501787c56e0518e61db13a523d47afd724    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Mar 2018 10:21:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Mar 2018 10:21:09 -0400    

Click here for diff

Several places used similar code to convert a string to an int, so take  
the function that we already had and make it globally available.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/nodes/read.c
M src/backend/parser/scan.l
M src/backend/utils/adt/datetime.c
M src/common/string.c
M src/include/common/string.h
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/preproc/pgc.l

Change internal integer representation of Value node

commit   : 6cf86f435472b27bbc5e22c713bca08aa2d94af7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Mar 2018 12:17:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Mar 2018 12:17:58 -0400    

Click here for diff

A Value node would store an integer as a long.  This causes needless  
portability risks, as long can be of varying sizes.  Change it to use  
int instead.  All code using this was already careful to only store  
32-bit values anyway.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c
M src/backend/nodes/value.c
M src/backend/parser/scan.l
M src/backend/utils/misc/guc.c
M src/include/nodes/value.h
M src/interfaces/ecpg/preproc/pgc.l

Fix CREATE TABLE / LIKE with bigint identity column

commit   : 377b5ac4845c5ffbf992ee95c32d7d16d38b9081    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Mar 2018 14:38:35 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Mar 2018 14:38:35 -0500    

Click here for diff

CREATE TABLE / LIKE with a bigint identity column would fail on  
platforms where long is 32 bits.  Copying the sequence values used  
makeInteger(), which would truncate the 64-bit sequence data to 32 bits.  
To fix, use makeFloat() instead, like the parser.  (This does not  
actually make use of floats, but stores the values as strings.)  
  
Bug: #15096  
Reviewed-by: Michael Paquier <[email protected]>  

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

Avoid having two PKs in a partition

commit   : 1f8a3327a9db9a8a662fb39fdcde2337acffa68c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 19:42:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 19:42:32 -0300    

Click here for diff

If a table containing a primary key is attach as partition to a  
partitioned table which has a primary key with a different definition,  
we would happily create a second one in the new partition.  Oops.  It  
turns out that this is because an error check in DefineIndex is executed  
only if you tell it that it's being run by ALTER TABLE, and the original  
code here wasn't.  Change it so that it does.  
  
Added a couple of test cases for this, also.  A previously working test  
started to fail in a different way than before patch because the new  
check is called earlier; change the PK to plain UNIQUE so that the new  
behavior isn't invoked, so that the test continues to verify what we  
want it to verify.  
  
Reported by: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/DF4PR8401MB102060EC2615EC9227CC73F7EEDF0@DF4PR8401MB1020.NAMPRD84.PROD.OUTLOOK.COM  

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

doc: Reword restriction on partition keys in unique indexes

commit   : 63cbee6a786028790abc6ae9b9606366bae5e01d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 13:28:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 13:28:52 -0300    

Click here for diff

New wording from David G. Johnston, who noticed the unreadable original  
also.  Include his suggested test case as well.  
  
Fix a typo I noticed elsewhere while doing this.  
  
Discussion: https://postgr.es/m/CAKFQuwY4Ld7ecxL_KAmaxwt0FUu5VcPPN2L4dh+3BeYbrdBa5g@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/indexing.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/indexing.sql

docs: Fix typo: a -> an

commit   : 3beb46ae8118f64d94518ba105b5e5c79e2ce194    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 12:58:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 12:58:35 -0300    

Click here for diff

David Rowley  

M doc/src/sgml/ddl.sgml

Remove doc sentence no longer applicable

commit   : c4af6960e3d82968c51995937c12bd4885183caa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 11:38:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Mar 2018 11:38:20 -0300    

Click here for diff

Amit Langote  

M doc/src/sgml/ddl.sgml

Fix improper uses of canonicalize_qual().

commit   : 4a4e2442a7f7c1434e86dd290cdb3704cfebb24c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Mar 2018 18:10:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Mar 2018 18:10:42 -0400    

Click here for diff

One of the things canonicalize_qual() does is to remove constant-NULL  
subexpressions of top-level AND/OR clauses.  It does that on the assumption  
that what it's given is a top-level WHERE clause, so that NULL can be  
treated like FALSE.  Although this is documented down inside a subroutine  
of canonicalize_qual(), it wasn't mentioned in the documentation of that  
function itself, and some callers hadn't gotten that memo.  
  
Notably, commit d007a9505 caused get_relation_constraints() to apply  
canonicalize_qual() to CHECK constraints.  That allowed constraint  
exclusion to misoptimize situations in which a CHECK constraint had a  
provably-NULL subclause, as seen in the regression test case added here,  
in which a child table that should be scanned is not.  (Although this  
thinko is ancient, the test case doesn't fail before 9.2, for reasons  
I've not bothered to track down in detail.  There may be related cases  
that do fail before that.)  
  
More recently, commit f0e44751d added an independent bug by applying  
canonicalize_qual() to index expressions, which is even sillier since  
those might not even be boolean.  If they are, though, I think this  
could lead to making incorrect index entries for affected index  
expressions in v10.  I haven't attempted to prove that though.  
  
To fix, add an "is_check" parameter to canonicalize_qual() to specify  
whether it should assume WHERE or CHECK semantics, and make it perform  
NULL-elimination accordingly.  Adjust the callers to apply the right  
semantics, or remove the call entirely in cases where it's not known  
that the expression has one or the other semantics.  I also removed  
the call in some cases involving partition expressions, where it should  
be a no-op because such expressions should be canonical already ...  
and was a no-op, independently of whether it could in principle have  
done something, because it was being handed the qual in implicit-AND  
format which isn't what it expects.  In HEAD, add an Assert to catch  
that type of mistake in future.  
  
This represents an API break for external callers of canonicalize_qual().  
While that's intentional in HEAD to make such callers think about which  
case applies to them, it seems like something we probably wouldn't be  
thanked for in released branches.  Hence, in released branches, the  
extra parameter is added to a new function canonicalize_qual_ext(),  
and canonicalize_qual() is a wrapper that retains its old behavior.  
  
Patch by me with suggestions from Dean Rasheed.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/cache/relcache.c
M src/include/optimizer/prep.h
M src/test/modules/test_predtest/test_predtest.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Clarify initdb --help message for --wal-segsize

commit   : fedabe1f64467b777b1d5ef53b5b0015acc7b999    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 11 Mar 2018 14:12:36 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 11 Mar 2018 14:12:36 +0100    

Click here for diff

Specify that the value is in megabytes. This aligns the message with  
what's in the documentation.  

M src/bin/initdb/initdb.c

In psql, restore old behavior of Query_for_list_of_functions.

commit   : b6e132ddc8601c99ac5466792f6128ee859f4128    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Mar 2018 13:18:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Mar 2018 13:18:21 -0500    

Click here for diff

Historically, tab completion for functions has offered the names of  
aggregates as well.  This is essential in at least one context, namely  
GRANT/REVOKE, because there is no GRANT ON AGGREGATE syntax.  There  
are other cases where a command that nominally is for functions will  
allow aggregates as well, though not all do.  
  
Commit fd1a421fe changed this query to disallow aggregates, but that  
doesn't seem to have been thought through very carefully.  Change it  
to allow aggregates (but still ignore procedures).  
  
We might at some point tighten this up, but it'd require sorting through  
all the uses of this query to see which ones should offer aggregate  
names and which shouldn't.  Given the lack of field complaints about  
the historical laxity here, that's work I'm not eager to do right now.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve predtest.c's internal docs, and enhance its functionality a bit.

commit   : 5748f3a0aa7cf78ac6979010273bd9d50869bb8e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Mar 2018 16:58:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Mar 2018 16:58:26 -0500    

Click here for diff

Commit b08df9cab left things rather poorly documented as far as the  
exact semantics of "clause_is_check" mode went.  Also, that mode did  
not really work correctly for predicate_refuted_by; although given the  
lack of specification as to what it should do, as well as the lack  
of any actual use-case, that's perhaps not surprising.  
  
Rename "clause_is_check" to "weak" proof mode, and provide specifications  
for what it should do.  I defined weak refutation as meaning "truth of A  
implies non-truth of B", which makes it possible to use the mode in the  
part of relation_excluded_by_constraints that checks for mutually  
contradictory WHERE clauses.  Fix up several places that did things wrong  
for that definition.  (As far as I can see, these errors would only lead  
to failure-to-prove, not incorrect claims of proof, making them not  
serious bugs even aside from the fact that v10 contains no use of this  
mode.  So there seems no need for back-patching.)  
  
In addition, teach predicate_refuted_by_recurse that it can use  
predicate_implied_by_recurse after all when processing a strong NOT-clause,  
so long as it asks for the correct proof strength.  This is an optimization  
that could have been included in commit b08df9cab, but wasn't.  
  
Also, simplify and generalize the logic that checks for whether nullness of  
the argument of IS [NOT] NULL would force overall nullness of the predicate  
or clause.  (This results in a change in the partition_prune test's output,  
as it is now able to prune an all-nulls partition that it did not recognize  
before.)  
  
In passing, in PartConstraintImpliedByRelConstraint, remove bogus  
conversion of the constraint list to explicit-AND form and then right back  
again; that accomplished nothing except forcing a useless extra level of  
recursion inside predicate_implied_by.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/include/optimizer/predtest.h
M src/test/modules/test_predtest/expected/test_predtest.out
M src/test/modules/test_predtest/sql/test_predtest.sql
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix test_predtest's idea of what weak refutation means.

commit   : a63c3274a68832182f84ca5d2b8cc5a7462bdacb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 19:44:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 19:44:14 -0500    

Click here for diff

I'd initially supposed that predicate_refuted_by(..., true) ought to  
say that "A refutes B" means "non-falsity of A implies non-truth of B".  
But it seems better to define it as "truth of A implies non-truth of B".  
This is more useful in the current system, slightly easier to prove,  
and in closer correspondence to the existing code behavior.  
  
With this change, test_predtest no longer claims that any existing  
test cases show false proof reports, though there still are cases  
where we could prove something and fail to.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_predtest/expected/test_predtest.out
M src/test/modules/test_predtest/test_predtest.c

Correctly assess parallel-safety of tlists when SRFs are used.

commit   : 960df2a9715c5c232b0f6f3effd40a3323eed6b0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Mar 2018 14:25:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Mar 2018 14:25:31 -0500    

Click here for diff

Since commit 69f4b9c85f168ae006929eec44fc44d569e846b9, the existing  
code was no longer assessing the parallel-safety of the real tlist  
for each upper rel, but rather the first of possibly several tlists  
created by split_pathtarget_at_srfs().  Repair.  
  
Even though this is clearly wrong, it's not clear that it has any  
user-visible consequences at the moment, so no back-patch for now.  If  
we discover later that it does have user-visible consequences, we  
might need to back-patch this to v10.  
  
Patch by me, per a report from Rajkumar Raghuwanshi.  
  
Discussion: http://postgr.es/m/CA+Tgmoaob_Strkg4Dcx=VyxnyXtrmkV=ofj=pX7gH9hSre-g0Q@mail.gmail.com  

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

Add test scaffolding for exercising optimizer's predicate-proof logic.

commit   : 44468f49bbe7e47e5a27a1ccbf13549ff85149f2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 13:25:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 13:25:26 -0500    

Click here for diff

The predicate-proof code in predtest.c is a bit hard to test as-is:  
you have to construct a query whose plan changes depending on the success  
of a test, and in tests that have been around for awhile, it's always  
possible that the plan shape is now being determined by some other factor.  
Our existing regression tests aren't doing real well at providing full  
code coverage of predtest.c, either.  So, let's add a small test module  
that allows directly inspecting the results of predicate_implied_by()  
and predicate_refuted_by() for arbitrary boolean expressions.  
  
I chose the set of tests committed here in order to get reasonably  
complete code coverage of predtest.c just from running this test  
module, and to cover some cases called out as being interesting in  
the existing comments.  We might want to add more later.  But this  
set already shows a few cases where perhaps things could be improved.  
  
Indeed, this exercise proves that predicate_refuted_by() is buggy for  
the case of clause_is_check = true, though fortunately we aren't using  
that case anywhere yet.  I'll look into doing something about that in  
a separate commit.  For now, just memorialize the current behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/Makefile
A src/test/modules/test_predtest/.gitignore
A src/test/modules/test_predtest/Makefile
A src/test/modules/test_predtest/README
A src/test/modules/test_predtest/expected/test_predtest.out
A src/test/modules/test_predtest/sql/test_predtest.sql
A src/test/modules/test_predtest/test_predtest–1.0.sql
A src/test/modules/test_predtest/test_predtest.c
A src/test/modules/test_predtest/test_predtest.control

Revert "Temporarily instrument postgres_fdw test to look for statistics changes."

commit   : 04e7ecadf64d18f67ca1d0632d8ab71f120ca5e3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 11:33:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 11:33:27 -0500    

Click here for diff

This reverts commit c2c537c56dc30ec3cdc12051f4ea5363aa66d73c.  
It's now clear that whatever is going on there, it can't be blamed  
on unexpected ANALYZE runs, because the statistics are the same  
just before the failing query as they were at the start of the test.  

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

In initdb, don't bother trying max_connections = 10.

commit   : 6a0b30f0401a76b3a972e366ba30aa7e49ffbf87    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 11:26:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 11:26:20 -0500    

Click here for diff

The server won't actually start with that setting anymore, not since  
we raised the default max_wal_senders to 10.  Per discussion, we don't  
wish to back down on that default, so instead raise the effective floor  
for max_connections (to 20).  It's still possible to configure a smaller  
setting manually, but initdb won't set it that way.  
  
Since that change happened in v10, back-patch to v10.  
  
Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c

Fix cross-checking of ReservedBackends/max_wal_senders/MaxConnections.

commit   : 4e0c743c18bf5435a4850510c5c74b3521c3e1e5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 11:25:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Mar 2018 11:25:26 -0500    

Click here for diff

We were independently checking ReservedBackends < MaxConnections and  
max_wal_senders < MaxConnections, but because walsenders aren't allowed  
to use superuser-reserved connections, that's really the wrong thing.  
Correct behavior is to insist on ReservedBackends + max_wal_senders being  
less than MaxConnections.  Fix the code and associated documentation.  
  
This has been wrong for a long time, but since the situation probably  
hardly ever arises in the field (especially pre-v10, when the default  
for max_wal_senders was zero), no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c

test_decoding: Remove unused #include directives.

commit   : f9f8784c8b3050aaec52da88a6e41b3e3f576b96    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Mar 2018 17:09:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Mar 2018 17:09:39 -0500    

Click here for diff

Euler Taveira  
  
Discussion: http://postgr.es/m/CAHE3wghBwKoCmK_sRu4xUL7f-q3dVOSwqjnOkaGmvWAqWUKaSQ@mail.gmail.com  

M contrib/test_decoding/test_decoding.c

doc: Add more substructure to SSL documentation

commit   : d40c7cd00422ac9a1284a1ecb5d6c0671c5ec6e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Mar 2018 11:32:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Mar 2018 11:32:51 -0500    

Click here for diff

The SSL documentation text has gotten a bit long, so add some  
subsections and reorder for better flow.  

M doc/src/sgml/runtime.sgml

Add missing debug lines during bootstrap

commit   : f9d34ce4e798ca768e28aea3703464db3179adcf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Mar 2018 11:47:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Mar 2018 11:47:35 -0300    

Click here for diff

Noticed while playing with changes that mess with the bootstrap  
sequence; the operations patched here failed to emit anything, leading  
the developer to think that the bug was in the previous operation that  
did emit a message.  

M src/backend/bootstrap/bootparse.y

Fix typo

commit   : bcdd40538a11a39fee55ef1c4b79085717a5fb76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Mar 2018 09:02:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Mar 2018 09:02:57 -0500    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/include/catalog/objectaccess.h

Fix typo

commit   : f4a2842ac37f6fffe793ac7a30f8141bf42faae8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Mar 2018 07:07:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Mar 2018 07:07:41 -0300    

Click here for diff

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

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

Fix test counting in SSL tests

commit   : 2dadd061b3a8d259ec352512dfaf340a85ffa827    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 14:49:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 14:49:07 -0500    

Click here for diff

The branch that does not support tls-server-end-point runs more tests,  
so we need to structure the test counting dynamically.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/test/ssl/t/002_scram.pl

Fix typo for RangeVarGetRelidExtended

commit   : 06ca148430e45a68ad20172fc8a5bd353b6351e0    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 6 Mar 2018 23:36:26 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 6 Mar 2018 23:36:26 -0500    

Click here for diff

The function is actually RangeVarGetRelidExtended, so the comment should  
reflect that.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/namespace.c

Fix costing of parallel hash joins.

commit   : 5b804cc168a52039be02f392780b9e8c8db74412    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 21:54:37 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 21:54:37 -0500    

Click here for diff

Commit 1804284042e659e7d16904e7bbb0ad546394b6a3 established that single-batch  
parallel-aware hash joins could create one large shared hash table using the  
combined work_mem budget of all participants.  The costing accidentally  
assumed that parallel-oblivious hash joins could also do that.  The  
documentation for initial_cost_hashjoin() also failed to mention the new  
argument.  Repair.  
  
Author: Thomas Munro  
Reported-By: Antonin Houska  
Reviewed-By: Antonin Houska  
Discussion: https://postgr.es/m/12441.1513935950%40localhost  

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

doc: Improve calculation of vm.nr_hugepages

commit   : a3739e376fbc9d6e332ce33d42426b1d8b59f20b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 21:45:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 21:45:28 -0500    

Click here for diff

The previous method worked off the full virtual address space, not just  
the shared memory usage.  
  
Author: Tsunakawa, Takayuki <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Vasundhar Boddapati <[email protected]>  

M doc/src/sgml/runtime.sgml

doc: Add replication parameter to libpq documentation

commit   : 0c2c81b403db420bfce36f168887db72932dbf09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 21:00:10 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 21:00:10 -0500    

Click here for diff

Author: Michael Paquier <[email protected]>  
Reported-by: Şahap AÅŸĆ§Ä± <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml

Refrain from duplicating data in reorderbuffers

commit   : 8aa75e1384b1c62e302db02e6006fc6a2885afeb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Mar 2018 16:22:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Mar 2018 16:22:03 -0300    

Click here for diff

If a walsender exits leaving data in reorderbuffers, the next walsender  
that tries to decode the same transaction would append its decoded data  
in the same spill files without truncating it first, which effectively  
duplicate the data.  Avoid that by removing any leftover reorderbuffer  
spill files when a walsender starts.  
  
Backpatch to 9.4; this bug has been there from the very beginning of  
logical decoding.  
  
Author: Craig Ringer, revised by me  
Reviewed by: Ɓlvaro Herrera, Petr Jelƭnek, Masahiko Sawada  

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

Fix expected error message in test

commit   : 286c0ab257f8dde8e5494426b86c38f3877ae5c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 14:45:05 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 14:45:05 -0500    

Click here for diff

M src/test/ssl/t/002_scram.pl

Raise Test::More version requirement

commit   : f0ae2fa88bb97eaab2b6df7a0e7e503f392d3181    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 14:42:10 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Mar 2018 14:42:10 -0500    

Click here for diff

Since ed8a7c6fcf92b6b57ed8003bbd4a4eb92a6039bc, version 0.87 is  
required.  

M src/test/perl/TestLib.pm

Fix bogus Name assignment in CreateStatistics

commit   : 1ffb63a2a1767c3dd0c7611bed6383bd37bfbce6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Mar 2018 13:17:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Mar 2018 13:17:13 -0300    

Click here for diff

Apparently, it doesn't work to use a plain cstring as a Name datum: you  
may end up having random bytes because of failing to zero the bytes  
after the terminating \0, as indicated by valgrind.  I introduced this  
bug in 5564c1181548, so backpatch this fix to REL_10_STABLE, like that  
commit.  
  
While at it, fix a slightly misleading comment, pointed out by David  
Rowley.  

M src/backend/commands/statscmds.c
M src/backend/parser/parse_utilcmd.c

Tests for Kerberos/GSSAPI authentication

commit   : 4c831aeaa7bd837c5462df0bf54dc69d3683237a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Mar 2018 14:42:11 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Mar 2018 14:42:11 -0500    

Click here for diff

Like the LDAP and SSL tests, these are not run by default but can be  
selected via PG_TEST_EXTRA.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M configure
M configure.in
M doc/src/sgml/regress.sgml
M src/Makefile.global.in
M src/test/Makefile
A src/test/kerberos/.gitignore
A src/test/kerberos/Makefile
A src/test/kerberos/README
A src/test/kerberos/t/001_auth.pl

Fix parent node of WCO expressions in partitioned tables.

commit   : d06aba240d24c499cdd5e77695b3cd28a094e648    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Mar 2018 17:49:59 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Mar 2018 17:49:59 -0800    

Click here for diff

Since edd44738bc8814 WCO expressions of partitioned tables are  
initialized with the first subplan as parent. That's not correct, as  
the correct context is the ModifyTableState node. That's also what is  
used for RETURNING processing, initialized nearby.  
  
This appears not to cause any visible problems for in core code, but  
is problematic for in development patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Add parenthesized options syntax for ANALYZE.

commit   : 854dd8cff523bc17972d34772b0e39ad3d6d46a4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Mar 2018 16:21:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Mar 2018 16:21:05 -0800    

Click here for diff

This is analogous to the syntax allowed for VACUUM. This allows us to  
avoid making new options reserved keywords and makes it easier to  
allow arbitrary argument order. Oh, and it's consistent with the other  
commands, too.  
  
Author: Nathan Bossart  
Reviewed-By: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/analyze.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Fix HEAP_INSERT_IS_SPECULATIVE to HEAP_INSERT_SPECULATIVE in comments.

commit   : b2a177bff10e86016a53bb7f06f7d5e63649e27d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Mar 2018 15:28:03 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Mar 2018 15:28:03 -0800    

Click here for diff

This was wrong since 168d5805e4c08bed7b95d351bf097cff7c07dd65, which  
introduced speculative inserts.  
  
Author: Andres Freund  

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

Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)

commit   : 5564c11815486bdfe87eb46ebc7c070293fa6956    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 5 Mar 2018 19:37:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 5 Mar 2018 19:37:19 -0300    

Click here for diff

The LIKE INCLUDING ALL clause to CREATE TABLE intuitively indicates  
cloning of extended statistics on the source table, but it failed to do  
so.  Patch it up so that it does.  Also include an INCLUDING STATISTICS  
option to the LIKE clause, so that the behavior can be requested  
individually, or excluded individually.  
  
While at it, reorder the INCLUDING options, both in code and in docs, in  
alphabetical order which makes more sense than feature-implementation  
order that was previously used.  
  
Backpatch this to Postgres 10, where extended statistics were  
introduced, because this is seen as an oversight in a fresh feature  
which is better to get consistent from the get-go instead of changing  
only in pg11.  
  
In pg11, comments on statistics objects are cloned too.  In pg10 they  
are not, because I (Ɓlvaro) was too coward to change the parse node as  
required to support it.  Also, in pg10 I chose not to renumber the  
parser symbols for the various INCLUDING options in LIKE, for the same  
reason.  Any corresponding user-visible changes (docs) are backpatched,  
though.  
  
Reported-by: Stephen Froehlich  
Author: David Rowley  
Reviewed-by: Ɓlvaro Herrera, Tomas Vondra  
Discussion: https://postgr.es/m/CY1PR0601MB1927315B45667A1B679D0FD5E5EF0@CY1PR0601MB1927.namprd06.prod.outlook.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/indexcmds.c
M src/backend/commands/statscmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

Temporarily instrument postgres_fdw test to look for statistics changes.

commit   : c2c537c56dc30ec3cdc12051f4ea5363aa66d73c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Mar 2018 16:20:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Mar 2018 16:20:06 -0500    

Click here for diff

It seems fairly hard to explain recent buildfarm failures without the  
theory that something is doing an ANALYZE behind our backs.  Probe  
for this directly to see if it's true.  
  
In principle the outputs of these queries should be stable, since the table  
in question is small enough that ANALYZE's sample will include all rows.  
But even if that turns out to be wrong, we can put up with some failures  
for a bit.  I don't intend to leave this here indefinitely.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add infrastructure to support server-version-dependent tab completion.

commit   : 722408bcd1bde0b007f73b41135382af11b0282d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Mar 2018 15:37:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Mar 2018 15:37:23 -0500    

Click here for diff

Up to now we've not worried about whether psql's tab completion queries  
would work against prior server versions.  But since we support older  
server versions in describe.c, we really ought to do so here as well.  
Failing to take care of this not only leads to loss of tab-completion  
service when using an older server, but risks aborting a user's open  
transaction when we send an incompatible query to the server.  
  
The recent changes in pg_proc.prokind are one reason to take this more  
seriously now than before, and the proposed patch for completion after  
SELECT needs some such capability as well.  
  
Hence, create some infrastructure to allow selection of one of several  
versions of a query depending on server version.  For cases where we  
just need to select one of several query strings, introduce VersionedQuery  
and COMPLETE_WITH_VERSIONED_QUERY().  Likewise extend the SchemaQuery  
infrastructure to allow versioning of those.  
  
I went ahead and fixed the prokind issues, to serve as an illustration  
of how to use versioned SchemaQuery.  To have some illustration of  
VersionedQuery, change the support for completion of publication and  
subscription names so that psql will not send sure-to-fail queries to  
pre-v10 servers.  There is much more that should be done to make tab  
completion more friendly to older servers, but this commit is mainly  
meant to get the infrastructure in place, so I stopped here.  
  
Discussion: https://postgr.es/m/[email protected]  

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

shm_mq: Fix detach race condition.

commit   : 42d7074ebb832e511d1edec8091cd474d169eef1    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Mar 2018 15:12:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Mar 2018 15:12:49 -0500    

Click here for diff

Commit 34db06ef9a1d7f36391c64293bf1e0ce44a33915 adopted a lock-free  
design for shm_mq.c, but it introduced a race condition that could  
lose messages.  When shm_mq_receive_bytes() detects that the other end  
has detached, it must make sure that it has seen the final version of  
mq_bytes_written, or it might miss a message sent before detaching.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm%3D2myZ4qxpt1a%3DC%2BwEv3o188K13K3UvD-44FK0SdAzHy%2Bw%40mail.gmail.com  

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

Fix pg_rewind to handle relation data files in tablespaces properly.

commit   : 2f3e2340cd1b67e91cefdf45e4c915297d1034e2    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 6 Mar 2018 02:08:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 6 Mar 2018 02:08:18 +0900    

Click here for diff

pg_rewind checks whether each file is a relation data file, from its path.  
Previously this check logic had the bug which made pg_rewind fail to  
recognize any relation data files in tablespaces. Which also caused  
an assertion failure in pg_rewind.  
  
Back-patch to 9.5 where pg_rewind was added.  
  
Author: Takayuki Tsunakawa  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8D6C7A@G01JPEXMBYT05  

M src/bin/pg_rewind/filemap.c

Remove some obsolete procedure-specific code from PLs

commit   : 09230e54fb39e8cd8add3f119d03afd72adc72b9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Mar 2018 11:51:15 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Mar 2018 11:51:15 -0500    

Click here for diff

Since procedures are now declared to return void, code that handled  
return values for procedures separately is no longer necessary.  

M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_procedure.c
M src/pl/tcl/pltcl.c

doc: Tiny whitespace fix

commit   : dd9ed0bf7039eb2b97d9afa198409c0e9798f4ac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Mar 2018 11:27:08 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Mar 2018 11:27:08 -0500    

Click here for diff

M doc/src/sgml/ref/call.sgml

Actually pick .lib file when multiple perl libs are present

commit   : 6946280cded903b6f5269fcce105f8ab1d455d33    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 4 Mar 2018 18:00:16 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 4 Mar 2018 18:00:16 +0100    

Click here for diff

7240962f8626ff09bb8f9e71ecdb074775bdd035 got it right in the comment,  
but the code did not actually do what the comment said. Fix that.  
  
Issue pointed out by Noah Misch.  

M src/tools/msvc/Mkvcbuild.pm

PL/pgSQL: Simplify RETURN checking for procedures

commit   : f7c7f67fecc40170a2fad2d1cff24dd1ddd22d7f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 4 Mar 2018 10:35:23 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 4 Mar 2018 10:35:23 -0500    

Click here for diff

Check at compile time that RETURN in a procedure does not specify a  
parameter, rather than at run time.  

M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Fix assorted issues in convert_to_scalar().

commit   : 58d9acc18d38899ebc30812b4984778c7069f42c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Mar 2018 20:31:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Mar 2018 20:31:35 -0500    

Click here for diff

If convert_to_scalar is passed a pair of datatypes it can't cope with,  
its former behavior was just to elog(ERROR).  While this is OK so far as  
the core code is concerned, there's extension code that would like to use  
scalarltsel/scalargtsel/etc as selectivity estimators for operators that  
work on non-core datatypes, and this behavior is a show-stopper for that  
use-case.  If we simply allow convert_to_scalar to return FALSE instead of  
outright failing, then the main logic of scalarltsel/scalargtsel will work  
fine for any operator that behaves like a scalar inequality comparison.  
The lack of conversion capability will mean that we can't estimate to  
better than histogram-bin-width precision, since the code will effectively  
assume that the comparison constant falls at the middle of its bin.  But  
that's still a lot better than nothing.  (Someday we should provide a way  
for extension code to supply a custom version of convert_to_scalar, but  
today is not that day.)  
  
While poking at this issue, we noted that the existing code for handling  
type bytea in convert_to_scalar is several bricks shy of a load.  
It assumes without checking that if the comparison value is type bytea,  
the bounds values are too; in the worst case this could lead to a crash.  
It also fails to detoast the input values, so that the comparison result is  
complete garbage if any input is toasted out-of-line, compressed, or even  
just short-header.  I'm not sure how often such cases actually occur ---  
the bounds values, at least, are probably safe since they are elements of  
an array and hence can't be toasted.  But that doesn't make this code OK.  
  
Back-patch to all supported branches, partly because author requested that,  
but mostly because of the bytea bugs.  The change in API for the exposed  
routine convert_network_to_scalar() is theoretically a back-patch hazard,  
but it seems pretty unlikely that any third-party code is calling that  
function directly.  
  
Tomas Vondra, with some adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/btree_inet.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/builtins.h

doc: Small wording improvement

commit   : 7726147f5368e04d0b7c1ab1849a6be47391ff24    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 14:23:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 14:23:13 -0500    

Click here for diff

Replace "checkpoint segment" with "WAL segment".  
  
Reported-by: Maksim Milyutin <[email protected]>  

M doc/src/sgml/config.sgml

commit   : e568eed2fce7c50f40e0dcdec0f6d1e88b42a15b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 14:11:39 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 14:11:39 -0500    

Click here for diff

In PostgreSQL 9.5, the documentation for pg_stat_replication was moved,  
so some of the links pointed to an appropriate location.  
  
Author: Maksim Milyutin <[email protected]>  

M doc/src/sgml/config.sgml
M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.5.sgml

Minor fixes for reloptions tests

commit   : 39314efa4dd9101c18ef37067c3e114968a600a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 12:50:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 12:50:51 -0500    

Click here for diff

Follow-up to 4b95cc1dc36c9d1971f757e9b519fcc442833f0e  
  
Author: Nikolay Shaplov <[email protected]>  

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

Minor cleanup in genbki.pl.

commit   : 8d90b4d01a6120aeaf61ede22dbdda0dd714b7dd    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Mar 2018 12:05:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Mar 2018 12:05:28 -0500    

Click here for diff

Separate out the pg_attribute logic of genbki.pl into its own function.  
Drop unnecessary "defined $catalog->{data}" check.  This both narrows  
and shortens the data writing loop of the script.  There is no functional  
change (the emitted files are the same as before).  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGXnLH=BSo0x-aA818f=MyQqGS5nM-GDCWAMdnvQJTRC1A@mail.gmail.com  

M src/backend/catalog/genbki.pl

Trivial adjustments in preparation for bootstrap data conversion.

commit   : a351679c806ec9591ef4aaf5534d642e35140b9d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Mar 2018 11:23:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Mar 2018 11:23:33 -0500    

Click here for diff

Rationalize a couple of macro names:  
* In catalog/pg_init_privs.h, rename Anum_pg_init_privs_privs to  
  Anum_pg_init_privs_initprivs to match the column's actual name.  
* In ecpg, rename ZPBITOID to BITOID to match catalog/pg_type.h.  
This reduces reader confusion, and will allow us to generate these  
macros automatically in future.  
  
In catalog/pg_tablespace.h, fix the ordering of related DATA and  
#define lines to agree with how it's done elsewhere.  This has no  
impact today, but simplifies life for the bootstrap data conversion  
scripts.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGXnLH=BSo0x-aA818f=MyQqGS5nM-GDCWAMdnvQJTRC1A@mail.gmail.com  

M src/backend/catalog/aclchk.c
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_tablespace.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/pg_type.h

doc: Improve wording

commit   : 506652bcaea74a23d6f0a33923a7f558126b472d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 09:56:17 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 09:56:17 -0500    

Click here for diff

M doc/src/sgml/bgworker.sgml

In SSL tests, restart after pg_hba.conf changes

commit   : f96f48113f97a45fe95d016e7b1afef4953616f0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 08:54:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 08:54:46 -0500    

Click here for diff

This prevents silently using a wrong configuration, similar to  
b4e2ada347bd8ae941171bd0761462e5b11b765d.  

M src/test/ssl/ServerSetup.pm

Prevent LDAP and SSL tests from running without support in build

commit   : ff18115ae9dc2f2e54f5feb8cd9c493bd963a641    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 08:52:21 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 08:52:21 -0500    

Click here for diff

Add checks in each test file that the build supports the feature,  
otherwise skip all the tests.  Before, if someone were to (accidentally)  
invoke these tests without build support, they would fail in confusing  
ways.  
  
based on patch from Michael Paquier <[email protected]>  

M src/test/ldap/Makefile
M src/test/ldap/t/001_auth.pl
M src/test/ssl/Makefile
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl

Add PG_TEST_EXTRA to control optional test suites

commit   : fdb34824e01d14e21566806ea37e974ac61ef1a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 01:29:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Mar 2018 01:29:51 -0500    

Click here for diff

The SSL and LDAP test suites are not run by default, as they are not  
secure for multi-user environments.  This commit adds an extra make  
variable to optionally enable them, for example:  
  
make check-world PG_TEST_EXTRA='ldap ssl'  
  
Author: Michael Paquier <[email protected]>  

M configure
M configure.in
M doc/src/sgml/regress.sgml
M src/Makefile.global.in
M src/test/Makefile

Fix VM buffer pin management in heap_lock_updated_tuple_rec().

commit   : 0b1d1a038babff4aadf0862c28e7b667f1b12a30    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Mar 2018 17:40:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Mar 2018 17:40:48 -0500    

Click here for diff

Sloppy coding in this function could lead to leaking a VM buffer pin,  
or to attempting to free the same pin twice.  Repair.  While at it,  
reduce the code's tendency to free and reacquire the same page pin.  
  
Back-patch to 9.6; before that, this routine did not concern itself  
with VM pages.  
  
Amit Kapila and Tom Lane  
  
Discussion: https://postgr.es/m/CAA4eK1KJKwhc=isgTQHjM76CAdVswzNeAuZkh_cx-6QgGkSEgA@mail.gmail.com  

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

Fix pgbench TAP test to work in VPATH builds.

commit   : e94f2bc809a0c684185666f19d81f6496e732a3a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Mar 2018 14:48:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Mar 2018 14:48:26 -0500    

Click here for diff

Previously, it'd try to create log files under the source directory  
not the build directory.  This fell over if the source isn't writable  
by the building user.  
  
Fabien Coelho  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1801101038340.2283@lancre  

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

Add prokind column, replacing proisagg and proiswindow

commit   : fd1a421fe66173fb9b85d3fe150afde8e812cbe4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Mar 2018 08:57:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Mar 2018 08:57:38 -0500    

Click here for diff

The new column distinguishes normal functions, procedures, aggregates,  
and window functions.  This replaces the existing columns proisagg and  
proiswindow, and replaces the convention that procedures are indicated  
by prorettype == 0.  Also change prorettype to be VOIDOID for procedures.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/system_views.sql
M src/backend/commands/dropcmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/typecmds.c
M src/backend/executor/functions.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
M src/include/utils/lsyscache.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_procedure.c
M src/pl/tcl/pltcl.c
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/create_function_3.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/create_function_3.sql
M src/test/regress/sql/opr_sanity.sql

postgres_fdw: Fourth attempt to stabilize regression tests.

commit   : 1733460f0205fc6d6bbe4c14911049a918c6e073    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Mar 2018 13:16:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Mar 2018 13:16:01 -0500    

Click here for diff

Commit 1bc0100d270e5bcc980a0629b8726a32a497e788 added this test, and  
commits 882ea509fe7a4711fe25463427a33262b873dfa1,  
958e20e42d6c346ab89f6c72e4262230161d1663,  
4fa396464e5fe238b7994535182f28318c61c78e tried to stabilize it.  It's  
still not stable, so keep trying.  
  
The latest comment from Tom Lane is that disabling autovacuum seems  
like a good strategy, but we might need to do it on more tables, hence  
this patch.  
  
Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

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

shm_mq: Have the receiver set the sender's less frequently.

commit   : 497171d3e2aaeea3b30d710b4e368645ad07ae43    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Mar 2018 12:20:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Mar 2018 12:20:30 -0500    

Click here for diff

Instead of marking data from the ringer buffer consumed and setting the  
sender's latch for every message, do it only when the amount of data we  
can consume is at least 1/4 of the size of the ring buffer, or when no  
data remains in the ring buffer.  This is dramatically faster in my  
testing; apparently, the savings from sending signals less frequently  
outweighs the benefit of letting the sender know about available buffer  
space sooner.  
  
Patch by me, reviewed by Andres Freund and tested by Rafia Sabih.  
  
Discussion: http://postgr.es/m/CA+TgmoYK7RFj6r7KLEfSGtYZCi3zqTRhAz8mcsDbUAjEmLOZ3Q@mail.gmail.com  

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

shm_mq: Reduce spinlock usage.

commit   : 34db06ef9a1d7f36391c64293bf1e0ce44a33915    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Mar 2018 12:16:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Mar 2018 12:16:59 -0500    

Click here for diff

Previously, mq_bytes_read and mq_bytes_written were protected by the  
spinlock, but that turns out to cause pretty serious spinlock  
contention on queries which send many tuples through a Gather or  
Gather Merge node.  This patches changes things so that we instead  
read and write those values using 8-byte atomics.  Since mq_bytes_read  
can only be changed by the receiver and mq_bytes_written can only be  
changed by the sender, the only purpose of the spinlock is to prevent  
reads and writes of these values from being torn on platforms where  
8-byte memory access is not atomic, making the conversion fairly  
straightforward.  
  
Testing shows that this produces some slowdown if we're using emulated  
64-bit atomics, but since they should be available on any platform  
where performance is a primary concern, that seems OK.  It's faster,  
sometimes a lot faster, on platforms where such atomics are available.  
  
Patch by me, reviewed by Andres Freund, who also suggested the  
design.  Also tested by Rafia Sabih.  
  
Discussion: http://postgr.es/m/CA+TgmoYuK0XXxmUNTFT9TSNiBtWnRwasBcHHRCOK9iYmDLQVPg@mail.gmail.com  

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

Improve tab-completion for ALTER INDEX RESET/SET.

commit   : 2b8c94e1b4a86907fceef87840c32d3703f7e161    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 3 Mar 2018 01:41:01 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 3 Mar 2018 01:41:01 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDSGfB0G4egOy2UvBT=uihojuh-syxgSipj+XNkpWdVzQ@mail.gmail.com  

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

Make gistvacuumcleanup() count the actual number of index tuples.

commit   : 81b9b5ce490a645bde8df203ec4a3b2903d88f31    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Mar 2018 11:22:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Mar 2018 11:22:42 -0500    

Click here for diff

Previously, it just returned the heap tuple count, which might be only an  
estimate, and would be completely the wrong thing if the index is partial.  
Since this function scans every index page anyway to find free pages,  
it's practically free to count the surviving index tuples.  Let's do that  
and return an accurate count.  
  
This is easily visible as a wrong reltuples value for a partial GiST  
index following VACUUM, so back-patch to all supported branches.  
  
Andrey Borodin, reviewed by Michail Nikolaev  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix msvc builds for ActivePerl > 5.24

commit   : 7240962f8626ff09bb8f9e71ecdb074775bdd035    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 2 Mar 2018 12:40:49 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 2 Mar 2018 12:40:49 +0100    

Click here for diff

From this version ActivePerl ships both a .lib and a .a file for the  
perl library, which our code would detect as there being no library  
available. Instead, we should pick the .lib version and use that.  
  
Report and suggested fix in bug #15065  
  
Author: Heath Lord  

M src/tools/msvc/Mkvcbuild.pm

Minor clean-up in dshash.{c,h}.

commit   : 17b340abf83d1b5f67808c45c63b9e0439569cef    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 16:25:46 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 16:25:46 -0800    

Click here for diff

For consistency with other code that deals in numbers of buckets, the  
macro BUCKETS_PER_PARTITION should produce a value of type size_t.  
Also, fix a mention of an obsolete proposed name for dshash.c that  
appeared in a comment.  
  
Author: Thomas Munro, based on an observation from Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1%2BBOp5aaW3aHEkg5Bptf8Ga_BkBnmA-%3DXcAXShs0yCiYQ%40mail.gmail.com  

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

Remove volatile qualifiers from shm_mq.c.

commit   : 07c6e5163e1f4ae12a3a6478788dd969f8f38cc9    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 16:21:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 16:21:52 -0800    

Click here for diff

Since commit 0709b7ee, spinlock primitives include a compiler barrier  
so it is no longer necessary to access either spinlocks or the memory  
they protect through pointer-to-volatile.  Like earlier commits  
e93b6298, d53e3d5f, 430008b5, 8f6bb851, df4077cd.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CAEepm=204T37SxcHo4=xw5btho9jQ-=ZYYrVdcKyz82XYzMoqg@mail.gmail.com  

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

Use ereport not elog for some corrupt-HOT-chain reports.

commit   : 8ecdc2ffe3da3a84d01e51c784ec3510157c893b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 16:23:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 16:23:29 -0500    

Click here for diff

These errors have been seen in the field in corrupted-data situations.  
It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather  
than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring  
and tools like amcheck.  However, use errmsg_internal so that the text  
strings still aren't translated; it seems unlikely to be worth  
translators' time to do so.  
  
Back-patch to 9.3, like the predecessor commit d70cf811f that introduced  
these elog calls originally (replacing Asserts).  
  
Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-Wzmn4-Pg-UGFwyuyK-wiTih9j32pwg_7T9iwqXpAUZr=Mg@mail.gmail.com  

M src/backend/catalog/index.c

Relax overly strict sanity check for upgraded ancient databases

commit   : 477ad05e165c15dc9241376f0fce9664063cff46    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Mar 2018 18:07:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Mar 2018 18:07:46 -0300    

Click here for diff

Commit 4800f16a7ad0 added some sanity checks to ensure we don't  
accidentally corrupt data, but in one of them we failed to consider the  
effects of a database upgraded from 9.2 or earlier, where a tuple  
exclusively locked prior to the upgrade has a slightly different bit  
pattern.  Fix that by using the macro that we fixed in commit  
74ebba84aeb6 for similar situations.  
  
Reported-by: Alexandre Garcia  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CAPYLKR6yxV4=pfW0Gwij7aPNiiPx+3ib4USVYnbuQdUtmkMaEA@mail.gmail.com  
  
Andres suspects that this bug may have wider ranging consequences, but I  
couldn't find anything.  

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

Fix IOS planning when only some index columns can return an attribute.

commit   : b5febc1d125cac37c626cb7c96936db6839ec733    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 15:35:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 15:35:03 -0500    

Click here for diff

Since 9.5, it's possible that some but not all columns of an index  
support returning the indexed value for index-only scans.  If the  
same indexed column appears in index columns that behave both ways,  
check_index_only() supposed that it'd be OK to do an index-only scan  
testing that column; but that fails if we have to recheck the indexed  
condition on one of the columns that doesn't support this.  
  
In principle we could make this work by remapping the recheck expressions  
to pull the value from a column that does support returning the indexed  
value.  But such cases are so weird and rare that, at least for now,  
it doesn't seem worth the trouble.  Instead, just teach check_index_only  
that a value is returnable only if all the index columns containing it  
are returnable, rather than any of them.  
  
Per report from David Pereiro Lagares.  Back-patch to 9.5 where the  
possibility of this situation appeared.  
  
Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/expected/inet.out
M contrib/btree_gist/sql/inet.sql
M src/backend/optimizer/path/indxpath.c

Remove out-of-date comment about formrdesc().

commit   : 6452b098c018a8aa9fbcf28d6be22d92493301fd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 12:03:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 12:03:29 -0500    

Click here for diff

formrdesc's comment listed the specific catalogs it is called for,  
but the list was out of date.  Rather than jumping back onto that  
maintenance treadmill, let's just remove the list.  It tells the  
reader nothing that can't be learned quickly and more reliably by  
searching relcache.c for callers of formrdesc().  
  
Oversight noted by Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix format_type() to restore its old behavior.

commit   : 8f72a5704854d292065886eb47ba18fbd504113e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 11:37:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Mar 2018 11:37:46 -0500    

Click here for diff

Commit a26116c6c accidentally changed the behavior of the SQL format_type()  
function while refactoring.  For the reasons explained in that function's  
comment, a NULL typemod argument should behave differently from a -1  
argument.  Since we've managed to break this, add a regression test  
memorializing the intended behavior.  
  
In passing, be consistent about the type of the "flags" parameter.  
  
Noted by Rushabh Lathia, though I revised the patch some more.  
  
Discussion: https://postgr.es/m/CAGPqQf3RB2q-d2Awp_-x-Ur6aOxTUwnApt-vm-iTtceZxYnePg@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M src/backend/utils/adt/format_type.c
M src/test/regress/expected/create_type.out
M src/test/regress/sql/create_type.sql

pg_regress: Increase space available for test names.

commit   : 1437824564f47e8e7641e98958a08c1544b6b8f4    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 02:45:41 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 02:45:41 -0800    

Click here for diff

A few isolationtester tests with reasonable names are too wide to  
nicely align. Increase space.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CAEepm=2v7+EHs6zsJzFn+zJOT4F4Kb69Z1xJ7Zf5kgwLr1n=VA@mail.gmail.com  

M src/test/regress/pg_regress.c

doc: mention PROVE_TESTS in section of TAP tests.

commit   : 9c4968469abe01a030307f49837fa2cf51fcdb4b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:50:27 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:50:27 -0800    

Click here for diff

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

M doc/src/sgml/regress.sgml

doc: Add WaitForBackgroundWorkerShutdown() to bgw docs.

commit   : a88609089ab84fc9f2a925bee31ec2e0c776d166    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:46:04 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:46:04 -0800    

Click here for diff

Commit 924bcf4f16d added WaitForBackgroundWorkerShutdown, but didn't  
add it to the documentation. Fix that and two small spelling errors in  
the WaitForBackgroundWorkerStartup paragraph.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bgworker.sgml

doc: Add random_zipfian to list of random functions with argument.

commit   : 8c438fcc9f19273b884b0c7498c74391c7546014    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:40:00 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:40:00 -0800    

Click here for diff

Author: Ildar Musin  
Reviewed-By: Fabian Coelho  
Discussion: https://postgr.es/m/[email protected]  

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

pgbench: consolidate a few PQfinish calls.

commit   : 337be37da34fd6ccfb63350c3d5b1b284fc58084    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:02:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Mar 2018 01:02:57 -0800    

Click here for diff

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

M src/bin/pgbench/pgbench.c

Remove redundant IndexTupleDSize macro.

commit   : d79e7e92bf2a44415e1dcbd74274eb79852fc885    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 19:25:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 19:25:54 -0500    

Click here for diff

Use IndexTupleSize everywhere, instead.  Also, remove IndexTupleSize's  
internal typecast, as that's not really needed and might mask coding  
errors.  Change some pointer variable datatypes in the call sites  
to compensate for that and make it clearer what we're assuming.  
  
Ildar Musin, Robert Haas, Stephen Frost  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/hio.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/itup.h

Doc: remove duplicate poly_ops row from SP-GiST opclass table.

commit   : d3b851e9a3c9f994e78ba9ec4e11e4eae0c72ec7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 18:54:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 18:54:57 -0500    

Click here for diff

Commit ff963b393 added two identical copies of this row.  
  
Dagfinn Ilmari MannsƄker  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/spgist.sgml

Rename base64 routines to avoid conflict with Solaris built-in functions.

commit   : 43e9490866386ba57c5457c6dbeedb04a51c2086    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 18:33:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 18:33:45 -0500    

Click here for diff

Solaris 11.4 has built-in functions named b64_encode and b64_decode.  
Rename ours to something else to avoid the conflict (fortunately,  
ours are static so the impact is limited).  
  
One could wish for less duplication of code in this area, but that  
would be a larger patch and not very suitable for back-patching.  
Since this is a portability fix, we want to put it into all supported  
branches.  
  
Report and initial patch by Rainer Orth, reviewed and adjusted a bit  
by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/pgp-armor.c
M src/backend/utils/adt/encode.c

Remove restriction on SQL block length in isolationtester scanner.

commit   : 38a1144a91d207997dd68a8c2af759f88547016f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 16:57:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2018 16:57:37 -0500    

Click here for diff

specscanner.l had a fixed limit of 1024 bytes on the length of  
individual SQL stanzas in an isolation test script.  People are  
starting to run into that, so fix it by making the buffer resizable.  
  
Once we allow this in HEAD, it seems inevitable that somebody will  
try to back-patch a test that exceeds the old limit, so back-patch  
this change as a preventive measure.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/specscanner.l

For partitionwise join, match on partcollation, not parttypcoll.

commit   : 2af28e603319224e87fd35ab62f36ef6de45eaac    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 12:16:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 12:16:09 -0500    

Click here for diff

The previous code considered two tables to have the partition scheme  
if the underlying columns had the same collation, but what we  
actually need to compare is not the collations associated with the  
column but the collation used for partitioning.  Fix that.  
  
Robert Haas and Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/optimizer/util/plancat.c
M src/include/nodes/relation.h

Document LWTRANCHE_PARALLEL_HASH_JOIN.

commit   : 73797b7884ee1722127f27ecfcede99367139dc0    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 11:46:26 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 11:46:26 -0500    

Click here for diff

Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=3g1hhbFzYkR_QT9RmBvsGX4UaeCtX-4Js8OOEMmFeaSQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/lmgr/lwlock.c

Fix assertion failure when Parallel Append is run serially.

commit   : ce1663cdcdbd9bf15c81570277f70571b3727dd3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 10:56:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 10:56:06 -0500    

Click here for diff

Parallel-aware plan nodes must be prepared to run without parallelism  
if it's not possible at execution time for whatever reason.  Commit  
ab72716778128fb63d54ac256adf7fe6820a1185, which introduced Parallel  
Append, overlooked this.  
  
Rajkumar Raghuwanshi reported this problem, and I included his test  
case in this patch.  The code changes are by me.  
  
Discussion: http://postgr.es/m/CAKcux6=WqkUudLg1GLZZ7fc5ScWC1+Y9qD=pAHeqy32WoeJQvw@mail.gmail.com  

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

postgres_fdw: Third attempt to stabilize regression tests.

commit   : 4fa396464e5fe238b7994535182f28318c61c78e    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 10:15:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 10:15:17 -0500    

Click here for diff

Commit 1bc0100d270e5bcc980a0629b8726a32a497e788 added this test,  
and commit 882ea509fe7a4711fe25463427a33262b873dfa1 tried to  
stabilize it.  There were still failures, so commit  
958e20e42d6c346ab89f6c72e4262230161d1663 tried again to stabilize  
it.  That approach is still failing on jaguarundi, though, so  
back it out and try something else.  Specifically, instead of  
disabling remote estimates for the table in question, let's tell  
autovacuum to leave it alone.  
  
Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

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

Update and improve comments.

commit   : c161ea138fe123ad266ed22d153c9539f20c1325    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 10:09:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Feb 2018 10:09:31 -0500    

Click here for diff

Commits 6f6b99d1335be8ea1b74581fc489a97b109dd08a and  
f3b0897a1213f46b4d3a99a7f8ef3a4b32e03572 didn't properly update  
these comments.  
  
Etsuro Fujita, reviewed by Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c

doc: Improve man build speed

commit   : 6d933da306c993ab52a28dba9f4f5b80c80f9681    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2018 19:52:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2018 19:52:30 -0500    

Click here for diff

Turn off man.endnotes.are.numbered parameter, which we don't need, but  
which increases performance vastly if off.  Also turn on  
man.output.quietly, which also makes things a bit faster, but which is  
also less useful now as a progress indicator because the build is so  
fast now.  

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

Fix warnings in man page build

commit   : d21ddc220fc735da84c9fa7bae1968f6953a6c8c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Feb 2018 08:22:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Feb 2018 08:22:51 -0500    

Click here for diff

The changes in the CREATE POLICY man page from commit  
87c2a17fee784c7e1004ba3d3c5d8147da676783 triggered a stylesheet bug that  
created some warning messages and incorrect output.  This installs a  
workaround.  
  
Also improve the whitespace a bit so it looks better.  

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

Fix up ecpg's configuration so it handles "long long int" in MSVC builds.

commit   : 51057feaa6bd24b51e6a4715c2090491ef037534    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 16:46:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 16:46:52 -0500    

Click here for diff

Although configure-based builds correctly define HAVE_LONG_LONG_INT when  
appropriate (in both pg_config.h and ecpg_config.h), builds using the MSVC  
scripts failed to do so.  This currently has no impact on the backend,  
since it uses that symbol nowhere; but it does prevent ecpg from  
supporting "long long int".  Fix that.  
  
Also, adjust Solution.pm so that in the constructed ecpg_config.h file,  
the "#if (_MSC_VER > 1200)" covers only the LONG_LONG_INT-related  
#defines, not the whole file.  AFAICS this was a thinko on somebody's  
part: ENABLE_THREAD_SAFETY should always be defined in Windows builds,  
and in branches using USE_INTEGER_DATETIMES, the setting of that shouldn't  
depend on the compiler version either.  If I'm wrong, I imagine the  
buildfarm will say so.  
  
Per bug #15080 from Jonathan Allen; issue diagnosed by Michael Meskes  
and Andrew Gierth.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pg_config.h.win32
M src/tools/msvc/Solution.pm

Use the correct tuplestore read pointer in a NamedTuplestoreScan.

commit   : e98a4de7d23a54a6c861795ad8e920a59613e08b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 15:56:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 15:56:51 -0500    

Click here for diff

Tom Kazimiers reported that transition tables don't work correctly when  
they are scanned by more than one executor node.  That's because commit  
18ce3a4ab allocated separate read pointers for each executor node, as it  
must, but failed to make them active at the appropriate times.  Repair.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/20180224034748.bixarv6632vbxgeb%40dewberry.localdomain  

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

Revert renaming of int44in/int44out.

commit   : c40e20a83ce521b5b5403b08dde05b0f0641d77f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 15:15:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 15:15:35 -0500    

Click here for diff

This seemed like a good idea in commit be42eb9d6, but it causes more  
trouble than it's worth for cross-branch upgrade testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/create_type.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/regress.c
M src/test/regress/sql/create_type.sql

doc: Fix grammar.

commit   : 6614aaa699bcff77fbcbc349fc678b8bfb060b9a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Feb 2018 14:41:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Feb 2018 14:41:10 -0500    

Click here for diff

Michael Paquier  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Prevent dangling-pointer access when update trigger returns old tuple.

commit   : 25b692568f429436f89ff203c1413e9670d0ad67    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 13:27:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 13:27:38 -0500    

Click here for diff

A before-update row trigger may choose to return the "new" or "old" tuple  
unmodified.  ExecBRUpdateTriggers failed to consider the second  
possibility, and would proceed to free the "old" tuple even if it was the  
one returned, leading to subsequent access to already-deallocated memory.  
In debug builds this reliably leads to an "invalid memory alloc request  
size" failure; in production builds it might accidentally work, but data  
corruption is also possible.  
  
This is a very old bug.  There are probably a couple of reasons it hasn't  
been noticed up to now.  It would be more usual to return NULL if one  
wanted to suppress the update action; returning "old" is significantly less  
efficient since the update will occur anyway.  Also, none of the standard  
PLs would ever cause this because they all returned freshly-manufactured  
tuples even if they were just copying "old".  But commit 4b93f5799 changed  
that for plpgsql, making it possible to see the bug with a plpgsql trigger.  
Still, this is certainly legal behavior for a trigger function, so it's  
ExecBRUpdateTriggers's fault not plpgsql's.  
  
It seems worth creating a test case that exercises returning "old" directly  
with a C-language trigger; testing this through plpgsql seems unreliable  
because its behavior might change again.  
  
Report and fix by Rushabh Lathia; regression test case by me.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAGPqQf1P4pjiNPrMof=P_16E-DFjt457j+nH2ex3=nBTew7tXw@mail.gmail.com  

M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/regress.c
M src/test/regress/sql/triggers.sql

commit   : 5e6a63c0d1028b9950c9cbcd7aaf9f2a67880a8d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Feb 2018 13:22:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Feb 2018 13:22:36 -0500    

Click here for diff

Jeevan Chalke  
  
Discussion: http://postgr.es/m/CAM2+6=X9kxQoL2ZqZ00E6asBt9z+rfyWbOmhXJ0+8fPAyMZ9Jg@mail.gmail.com  

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

Fix logic error in add_paths_to_partial_grouping_rel.

commit   : 3bfe957761ace9290072690a6298fc0eb996d857    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Feb 2018 13:18:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Feb 2018 13:18:59 -0500    

Click here for diff

Commit 3bf05e096b9f8375e640c5d7996aa57efd7f240c sometimes uses the  
cheapest_partial_path variable in this function to mean the cheapest  
one from the input rel and at other times the cheapest one from the  
partially grouped rel, but it never resets it, so we can end up with  
bad plans, leading to "ERROR: Aggref found in non-Agg plan node".  
  
Jeevan Chalke, per a report from Andreas Joseph Krogh and a separate  
off-list report from Rajkumar Raghuwanshi  
  
Discussion: http://postgr.es/m/CAM2+6=X9kxQoL2ZqZ00E6asBt9z+rfyWbOmhXJ0+8fPAyMZ9Jg@mail.gmail.com  

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

Improve regression test coverage of regress.c.

commit   : be42eb9d624cc14a9326e21ec75fdc571a7cb188    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 12:13:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 12:13:14 -0500    

Click here for diff

It's a bit silly to have test functions that aren't tested, so test  
them.  
  
In passing, rename int44in/int44out to city_budget_in/_out so that they  
match how the regression tests use them.  Also, fix city_budget_out  
so that it emits the format city_budget_in expects to read; otherwise  
we'd have dump/reload failures when testing pg_dump against the  
regression database.  (We avoided that in the past only because no  
data of type city_budget was actually stored anywhere.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/create_misc.out
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/create_type.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/regress.c
M src/test/regress/sql/create_misc.sql
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/create_type.sql

Remove unused functions in regress.c.

commit   : db3af9feb19f39827e916145f88fa5eca3130cb2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 11:11:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Feb 2018 11:11:25 -0500    

Click here for diff

This patch removes five functions that presumably were once used in the  
regression tests, but haven't been so used in many years.  Nonetheless  
we've been wasting maintenance effort on them (e.g., by converting them  
to V1 function protocol).  I see no reason to think that reviving them  
would add any useful test coverage, so drop 'em.  
  
In passing, mark regress_lseg_construct static, since it's not called  
from outside this file.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/triggers.out
M src/test/regress/input/create_function_1.source
M src/test/regress/input/create_function_2.source
M src/test/regress/output/create_function_1.source
M src/test/regress/output/create_function_2.source
M src/test/regress/regress.c
M src/test/regress/sql/triggers.sql

Update PartitionTupleRouting struct comment

commit   : 364de256651458f2442811bae10b0c808bc00a98    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2018 17:05:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2018 17:05:46 -0300    

Click here for diff

Small review on edd44738bc88.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Robert Haas, Amit Langote  

M src/include/executor/execPartition.h

Schema-qualify references in test_ddl_deparse test script.

commit   : fb533e45f91796875939a63e7554efff0da3c8e5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Feb 2018 12:22:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Feb 2018 12:22:39 -0500    

Click here for diff

This omission seems to be what is causing buildfarm failures on crake.  
  
Security: CVE-2018-1058  

M src/test/modules/test_ddl_deparse/expected/test_ddl_deparse.out
M src/test/modules/test_ddl_deparse/sql/test_ddl_deparse.sql

Last-minute updates for release notes.

commit   : 8af3855699aa6fa97b7d0d39e0bc7d3279d3fe47    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Feb 2018 12:14:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Feb 2018 12:14:05 -0500    

Click here for diff

Security: CVE-2018-1058  

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

Fix typo in internal error message

commit   : 964bddf1e87a42bbaaa989be0aabee94dbac9432    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2018 11:54:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2018 11:54:00 -0500    

Click here for diff

M src/pl/plpgsql/src/pl_exec.c

Document security implications of search_path and the public schema.

commit   : 5770172cb0c9df9e6ce27c507b449557e5b45124    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 26 Feb 2018 07:39:44 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 26 Feb 2018 07:39:44 -0800    

Click here for diff

The ability to create like-named objects in different schemas opens up  
the potential for users to change the behavior of other users' queries,  
maliciously or accidentally.  When you connect to a PostgreSQL server,  
you should remove from your search_path any schema for which a user  
other than yourself or superusers holds the CREATE privilege.  If you do  
not, other users holding CREATE privilege can redefine the behavior of  
your commands, causing them to perform arbitrary SQL statements under  
your identity.  "SET search_path = ..." and "SELECT  
pg_catalog.set_config(...)" are not vulnerable to such hijacking, so one  
can use either as the first command of a session.  As special  
exceptions, the following client applications behave as documented  
regardless of search_path settings and schema privileges: clusterdb  
createdb createlang createuser dropdb droplang dropuser ecpg (not  
programs it generates) initdb oid2name pg_archivecleanup pg_basebackup  
pg_config pg_controldata pg_ctl pg_dump pg_dumpall pg_isready  
pg_receivewal pg_recvlogical pg_resetwal pg_restore pg_rewind pg_standby  
pg_test_fsync pg_test_timing pg_upgrade pg_waldump reindexdb vacuumdb  
vacuumlo.  Not included are core client programs that run user-specified  
SQL commands, namely psql and pgbench.  PostgreSQL encourages non-core  
client applications to do likewise.  
  
Document this in the context of libpq connections, psql connections,  
dblink connections, ECPG connections, extension packaging, and schema  
usage patterns.  The principal defense for applications is "SELECT  
pg_catalog.set_config('search_path', '', false)", and the principal  
defense for databases is "REVOKE CREATE ON SCHEMA public FROM PUBLIC".  
Either one is sufficient to prevent attack.  After a REVOKE, consider  
auditing the public schema for objects named like pg_catalog objects.  
  
Authors of SECURITY DEFINER functions use some of the same defenses, and  
the CREATE FUNCTION reference page already covered them thoroughly.  
This is a good opportunity to audit SECURITY DEFINER functions for  
robust security practice.  
  
Back-patch to 9.3 (all supported versions).  
  
Reviewed by Michael Paquier and Jonathan S. Katz.  Reported by Arseniy  
Sharoglazov.  
  
Security: CVE-2018-1058  

M doc/src/sgml/config.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/user-manag.sgml
M src/test/examples/testlibpq.c
M src/test/examples/testlibpq2.c
M src/test/examples/testlibpq2.sql
M src/test/examples/testlibpq3.c
M src/test/examples/testlibpq3.sql
M src/test/examples/testlibpq4.c
M src/test/examples/testlo.c
M src/test/examples/testlo64.c

Empty search_path in Autovacuum and non-psql/pgbench clients.

commit   : 582edc369cdbd348d68441fc50fa26a84afd0c1a    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 26 Feb 2018 07:39:44 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 26 Feb 2018 07:39:44 -0800    

Click here for diff

This makes the client programs behave as documented regardless of the  
connect-time search_path and regardless of user-created objects.  Today,  
a malicious user with CREATE permission on a search_path schema can take  
control of certain of these clients' queries and invoke arbitrary SQL  
functions under the client identity, often a superuser.  This is  
exploitable in the default configuration, where all users have CREATE  
privilege on schema "public".  
  
This changes behavior of user-defined code stored in the database, like  
pg_index.indexprs and pg_extension_config_dump().  If they reach code  
bearing unqualified names, "does not exist" or "no schema has been  
selected to create in" errors might appear.  Users may fix such errors  
by schema-qualifying affected names.  After upgrading, consider watching  
server logs for these errors.  
  
The --table arguments of src/bin/scripts clients have been lax; for  
example, "vacuumdb -Zt pg_am\;CHECKPOINT" performed a checkpoint.  That  
now fails, but for now, "vacuumdb -Zt 'pg_am(amname);CHECKPOINT'" still  
performs a checkpoint.  
  
Back-patch to 9.3 (all supported versions).  
  
Reviewed by Tom Lane, though this fix strategy was not his first choice.  
Reported by Arseniy Sharoglazov.  
  
Security: CVE-2018-1058  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c
M src/backend/postmaster/autovacuum.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_upgrade/server.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
M src/fe_utils/string_utils.c
A src/include/fe_utils/connect.h
M src/tools/findoidjoins/findoidjoins.c

Avoid using unsafe search_path settings during dump and restore.

commit   : 3d2aed664ee8271fd6c721ed0aa10168cda112ea    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Feb 2018 10:18:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Feb 2018 10:18:21 -0500    

Click here for diff

Historically, pg_dump has "set search_path = foo, pg_catalog" when  
dumping an object in schema "foo", and has also caused that setting  
to be used while restoring the object.  This is problematic because  
functions and operators in schema "foo" could capture references meant  
to refer to pg_catalog entries, both in the queries issued by pg_dump  
and those issued during the subsequent restore run.  That could  
result in dump/restore misbehavior, or in privilege escalation if a  
nefarious user installs trojan-horse functions or operators.  
  
This patch changes pg_dump so that it does not change the search_path  
dynamically.  The emitted restore script sets the search_path to what  
was used at dump time, and then leaves it alone thereafter.  Created  
objects are placed in the correct schema, regardless of the active  
search_path, by dint of schema-qualifying their names in the CREATE  
commands, as well as in subsequent ALTER and ALTER-like commands.  
  
Since this change requires a change in the behavior of pg_restore  
when processing an archive file made according to this new convention,  
bump the archive file version number; old versions of pg_restore will  
therefore refuse to process files made with new versions of pg_dump.  
  
Security: CVE-2018-1058  

M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/triggers.out

Add a new upper planner relation for partially-aggregated results.

commit   : 3bf05e096b9f8375e640c5d7996aa57efd7f240c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 26 Feb 2018 09:30:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 26 Feb 2018 09:30:12 -0500    

Click here for diff

Up until now, we've abused grouped_rel->partial_pathlist as a place to  
store partial paths that have been partially aggregate, but that's  
really not correct, because a partial path for a relation is supposed  
to be one which produces the correct results with the addition of only  
a Gather or Gather Merge node, and these paths also require a Finalize  
Aggregate step.  Instead, add a new partially_group_rel which can hold  
either partial paths (which need to be gathered and then have  
aggregation finalized) or non-partial paths (which only need to have  
aggregation finalized).  This allows us to reuse generate_gather_paths  
for partially_grouped_rel instead of writing new code, so that this  
patch actually basically no net new code while making things cleaner,  
simplifying things for pending patches for partition-wise aggregate.  
  
Robert Haas and Jeevan Chalke.  The larger patch series of which this  
patch is a part was also reviewed and tested by Antonin Houska,  
Rajkumar Raghuwanshi, David Rowley, Dilip Kumar, Konstantin Knizhnik,  
Pascal Legrand, Rafia Sabih, and me.  
  
Discussion: http://postgr.es/m/CA+TgmobrzFYS3+U8a_BCy3-hOvh5UyJbC18rEcYehxhpw5=ETA@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoZyQEjdBNuoG9-wC5GQ5GrO4544Myo13dVptvx+uLg9uQ@mail.gmail.com  

M src/backend/optimizer/README
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/relation.h
M src/include/optimizer/paths.h

Un-break parallel pg_upgrade.

commit   : 5b570d771b80aadc98755208f8f1b81e9a5eb366    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2018 17:27:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2018 17:27:20 -0500    

Click here for diff

Commit b3f840120 changed pg_upgrade so that it'd actually drop and  
re-create the template1 and postgres databases in the new cluster.  
That works fine, serially.  With the -j option it's not so fine, because  
other per-database jobs might be launched while the template1 database is  
dropped.  Since they attempt to connect there to start up, kaboom.  
  
This is the cause of the intermittent failures buildfarm member jacana  
has been showing for the last month; evidently it is the only BF member  
configured to run the pg_upgrade test with parallelism enabled.  
  
Fix by processing template1 separately before we get into the parallel  
sub-job launch loop.  (We could alternatively have made the postgres DB  
be the special case, but it seems likely that template1 will contain  
less stuff and so we lose less parallelism with this choice.)  

M src/bin/pg_upgrade/pg_upgrade.c

Release notes for 10.3, 9.6.8, 9.5.12, 9.4.17, 9.3.22.

commit   : 1316417bbab0821f99eb21c0b654e33f5f6f90a4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2018 14:52:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2018 14:52:51 -0500    

Click here for diff

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

Update headers of generated files

commit   : c4ba1bee68abe217e441fb81343e5f9e9e2a5353    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Feb 2018 14:44:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Feb 2018 14:44:32 -0500    

Click here for diff

The scripts were changed in c98c35cd084a25c6cf9b08c76de8b89facd75fe7,  
but the output files were not updated to reflect the script changes.  

M src/backend/utils/mb/Unicode/big5_to_utf8.map
M src/backend/utils/mb/Unicode/euc_cn_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
M src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
M src/backend/utils/mb/Unicode/euc_tw_to_utf8.map
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/gbk_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map
M src/backend/utils/mb/Unicode/johab_to_utf8.map
M src/backend/utils/mb/Unicode/koi8r_to_utf8.map
M src/backend/utils/mb/Unicode/koi8u_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/sjis_to_utf8.map
M src/backend/utils/mb/Unicode/uhc_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_big5.map
M src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
M src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
M src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.map
M src/backend/utils/mb/Unicode/utf8_to_gbk.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_10.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_13.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_14.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_15.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_16.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_2.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_3.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_4.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_5.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_6.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_7.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_8.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_9.map
M src/backend/utils/mb/Unicode/utf8_to_johab.map
M src/backend/utils/mb/Unicode/utf8_to_koi8r.map
M src/backend/utils/mb/Unicode/utf8_to_koi8u.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_sjis.map
M src/backend/utils/mb/Unicode/utf8_to_uhc.map
M src/backend/utils/mb/Unicode/utf8_to_win1250.map
M src/backend/utils/mb/Unicode/utf8_to_win1251.map
M src/backend/utils/mb/Unicode/utf8_to_win1252.map
M src/backend/utils/mb/Unicode/utf8_to_win1253.map
M src/backend/utils/mb/Unicode/utf8_to_win1254.map
M src/backend/utils/mb/Unicode/utf8_to_win1255.map
M src/backend/utils/mb/Unicode/utf8_to_win1256.map
M src/backend/utils/mb/Unicode/utf8_to_win1257.map
M src/backend/utils/mb/Unicode/utf8_to_win1258.map
M src/backend/utils/mb/Unicode/utf8_to_win866.map
M src/backend/utils/mb/Unicode/utf8_to_win874.map
M src/backend/utils/mb/Unicode/win1250_to_utf8.map
M src/backend/utils/mb/Unicode/win1251_to_utf8.map
M src/backend/utils/mb/Unicode/win1252_to_utf8.map
M src/backend/utils/mb/Unicode/win1253_to_utf8.map
M src/backend/utils/mb/Unicode/win1254_to_utf8.map
M src/backend/utils/mb/Unicode/win1255_to_utf8.map
M src/backend/utils/mb/Unicode/win1256_to_utf8.map
M src/backend/utils/mb/Unicode/win1257_to_utf8.map
M src/backend/utils/mb/Unicode/win1258_to_utf8.map
M src/backend/utils/mb/Unicode/win866_to_utf8.map
M src/backend/utils/mb/Unicode/win874_to_utf8.map

Add current directory to Perl include path

commit   : 9ee0573ef146ab37d7b85951f83e00bcbd305ff3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Feb 2018 14:38:23 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Feb 2018 14:38:23 -0500    

Click here for diff

Recent Perl versions don't have the current directory in the module  
include path anymore, so we need to add it here explicitly to make these  
scripts continue to work.  

M src/backend/utils/mb/Unicode/Makefile

Use croak instead of die in Perl code when appropriate

commit   : fde03e8b559d0e00bf4acd8cea3bb49411099c34    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Feb 2018 14:35:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Feb 2018 14:35:54 -0500    

Click here for diff

M src/backend/utils/mb/Unicode/convutils.pm
M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/PostgresNode.pm
M src/test/perl/RecursiveCopy.pm

Fix thinko in in_range_float4_float8.

commit   : 32291aed494d425a548e45b3b6ad95f9d5c94e67    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Feb 2018 14:46:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Feb 2018 14:46:37 -0500    

Click here for diff

I forgot the coding rule for correct use of Float8GetDatumFast.  
Per buildfarm.  

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

Add window RANGE support for float4, float8, numeric.

commit   : 8b29e88cdce17705f0b2c43e50219ce1d7d2f603    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Feb 2018 13:23:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Feb 2018 13:23:38 -0500    

Click here for diff

Commit 0a459cec9 left this for later, but since time's running out,  
I went ahead and took care of it.  There are more data types that  
somebody might someday want RANGE support for, but this is enough  
to satisfy all expectations of the SQL standard, which just says that  
"numeric, datetime, and interval" types should have RANGE support.  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/numeric.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Check error messages in SSL tests

commit   : 081bfc19b3b7914b78eb44e00af9dd45325dda3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2018 13:54:45 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2018 13:54:45 -0500    

Click here for diff

In tests that check whether a connection fails, also check the error  
message.  That makes sure that the connection was rejected for the right  
reason.  
  
This discovered that two tests had their connection failing for the  
wrong reason.  One test failed because pg_hba.conf was not set up to  
allow that user, one test failed because the client key file did not  
have the right permissions.  Fix those tests and add a new one that is  
really supposed to check the file permission issue.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/test/ssl/ServerSetup.pm
M src/test/ssl/ssl/.gitignore
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl

Fix filtering of unsupported relations in logical replication

commit   : bc1adc651b8e60680aea144d51ae8bc78ea6b2fb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2018 22:13:21 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2018 22:13:21 -0500    

Click here for diff

In the pgoutput plugin, skip changes for relations that are not  
publishable, per is_publishable_class().  This concerns in particular  
materialized views and information_schema tables.  While those relations  
cannot be part of a publication, per existing checks, they will be  
considered by a FOR ALL TABLES publication.  A subscription would not  
actually apply changes for those relations, again per existing checks,  
but trying to match incoming changes to local tables on the subscriber  
would lead to errors if no matching local table exists.  Skipping those  
changes on the publisher avoids sending useless changes and eliminates  
the error.  
  
Bug: #15044  
Reported-by: Chad Trabant <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  

M src/backend/catalog/pg_publication.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/catalog/pg_publication.h
A src/test/subscription/t/009_matviews.pl

First-draft release notes for 10.3.

commit   : eec1a8cb6cbc6ea44cf58cfaeaa01ad8ee2bc8e8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 17:20:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 17:20:26 -0500    

Click here for diff

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

Fix brown-paper-bag bug in commit 0a459cec96d3856f476c2db298c6b52f592894e8.

commit   : 9fe802c8185e9a53158b6797d0f6fd8bfbb01af1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 15:11:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 15:11:40 -0500    

Click here for diff

RANGE_OFFSET comparisons need to examine the first ORDER BY column,  
which isn't necessarily the first column in the incoming tuples.  
No idea how this slipped through initial testing.  
  
Per bug #15082 from Zhou Digoal.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeWindowAgg.c

Allow auto_explain.log_min_duration to go up to INT_MAX.

commit   : 8af87f411c151537b6e3315c2a191110c3fec494    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 14:38:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 14:38:19 -0500    

Click here for diff

The previous limit of INT_MAX / 1000 seems to have been cargo-culted in  
from somewhere else.  Or possibly the value was converted to microseconds  
at some point; but in all supported releases, it's just compared to other  
values, so there's no need for the restriction.  This change raises the  
effective limit from ~35 minutes to ~24 days, which conceivably is useful  
to somebody, and anyway it's more consistent with the range of the core  
log_min_duration_statement GUC.  
  
Per complaint from Kevin Bloch.  Back-patch to all supported releases.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/auto_explain.c

Synchronize doc/ copies of src/test/examples/.

commit   : fe35cea7cf896574d765edf86a293fbc67c74365    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 23 Feb 2018 11:24:04 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 23 Feb 2018 11:24:04 -0800    

Click here for diff

This is mostly cosmetic, but it might fix build failures, on some  
platform, when copying from the documentation.  
  
Back-patch to 9.3 (all supported versions).  

M doc/src/sgml/libpq.sgml
M src/test/examples/testlibpq2.sql

Fix planner failures with overlapping mergejoin clauses in an outer join.

commit   : 9afd513df042b22b98bb9b55f27265e95d34f9e6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 13:47:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2018 13:47:33 -0500    

Click here for diff

Given overlapping or partially redundant join clauses, for example  
	t1 JOIN t2 ON t1.a = t2.x AND t1.b = t2.x  
the planner's EquivalenceClass machinery will ordinarily refactor the  
clauses as "t1.a = t1.b AND t1.a = t2.x", so that join processing doesn't  
see multiple references to the same EquivalenceClass in a list of join  
equality clauses.  However, if the join is outer, it's incorrect to derive  
a restriction clause on the outer side from the join conditions, so the  
clause refactoring does not happen and we end up with overlapping join  
conditions.  The code that attempted to deal with such cases had several  
subtle bugs, which could result in "left and right pathkeys do not match in  
mergejoin" or "outer pathkeys do not match mergeclauses" planner errors,  
if the selected join plan type was a mergejoin.  (It does not appear that  
any actually incorrect plan could have been emitted.)  
  
The core of the problem really was failure to recognize that the outer and  
inner relations' pathkeys have different relationships to the mergeclause  
list.  A join's mergeclause list is constructed by reference to the outer  
pathkeys, so it will always be ordered the same as the outer pathkeys, but  
this cannot be presumed true for the inner pathkeys.  If the inner sides of  
the mergeclauses contain multiple references to the same EquivalenceClass  
({t2.x} in the above example) then a simplistic rendering of the required  
inner sort order is like "ORDER BY t2.x, t2.x", but the pathkey machinery  
recognizes that the second sort column is redundant and throws it away.  
The mergejoin planning code failed to account for that behavior properly.  
One error was to try to generate cut-down versions of the mergeclause list  
from cut-down versions of the inner pathkeys in the same way as the initial  
construction of the mergeclause list from the outer pathkeys was done; this  
could lead to choosing a mergeclause list that fails to match the outer  
pathkeys.  The other problem was that the pathkey cross-checking code in  
create_mergejoin_plan treated the inner and outer pathkey lists  
identically, whereas actually the expectations for them must be different.  
That led to false "pathkeys do not match" failures in some cases, and in  
principle could have led to failure to detect bogus plans in other cases,  
though there is no indication that such bogus plans could be generated.  
  
Reported by Alexander Kuzmenkov, who also reviewed this patch.  This has  
been broken for years (back to around 8.3 according to my testing), so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Revise API for partition bound search functions.

commit   : f724022d0ae04e687c309f99df27b7ce64d19761    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Feb 2018 09:08:43 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Feb 2018 09:08:43 -0500    

Click here for diff

Similar to what commit b0229235564fbe3a9b1cc115ea738a07e274bf30 for a  
different set of functions, pass the required bits of the PartitionKey  
instead of the whole thing.  This allows these functions to be used  
without needing the PartitionKey to be available.  
  
Amit Langote.  The larger patch series of which this patch is a part  
has been reviewed and tested by Ashutosh Bapat, David Rowley, Dilip  
Kumar, Jesper Pedersen, Rajkumar Raghuwanshi, Beena Emerson, Kyotaro  
Horiguchi, Ɓlvaro Herrera, and me, but especially and in great detail  
by David Rowley.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c

Revise API for partition_rbound_cmp/partition_rbound_datum_cmp.

commit   : b0229235564fbe3a9b1cc115ea738a07e274bf30    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Feb 2018 08:43:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Feb 2018 08:43:52 -0500    

Click here for diff

Instead of passing the PartitionKey, pass just the required bits of  
it.  This allows these functions to be used without needing the  
PartitionKey to be available, which is important for several  
pending patches.  
  
Ashutosh Bapat, reviewed by Amit Langote, with a comment tweak  
by me.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c

Support parameters in CALL

commit   : 76b6aa41f41db66004b1c430f17a546d4102fbe7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2018 18:03:31 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2018 18:03:31 -0500    

Click here for diff

To support parameters in CALL, move the parse analysis of the procedure  
and arguments into the global transformation phase, so that the parser  
hooks can be applied.  And then at execution time pass the parameters  
from ProcessUtility on to ExecuteCallStmt.  

M src/backend/commands/functioncmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/analyze.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Remove extra words.

commit   : a6a80134e3bffa0678a82ed7477d9d46dea07d3a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 18:05:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 18:05:30 -0500    

Click here for diff

Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=2x3NUSPed6=-wDYs39KtUU5Dw3mK_NAMWps+18FmkApQ@mail.gmail.com  

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

Fix perlcritic warnings

commit   : abcba7001e481a565b8fba2393666dc54e90db61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2018 15:13:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2018 15:13:57 -0500    

Click here for diff

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

Update gratuitous use of MD5 in documentation

commit   : 0db2fc98cdf4135f9dcfa3740db6f2548682fe7e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Feb 2018 21:59:40 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Feb 2018 21:59:40 -0500    

Click here for diff

It seems some people are bothered by the outdated MD5 appearing in  
example code.  So replace it with more modern alternatives or by  
a different example function.  
  
Reported-by: Jon Wolski <[email protected]>  

M doc/src/sgml/citext.sgml
M doc/src/sgml/sepgsql.sgml

Add user-callable SHA-2 functions

commit   : 10cfce34c0fe20d2caed5750bbc5c315c0e4cc63    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Feb 2018 21:46:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Feb 2018 21:46:46 -0500    

Click here for diff

Add the user-callable functions sha224, sha256, sha384, sha512.  We  
already had these in the C code to support SCRAM, but there was no test  
coverage outside of the SCRAM tests.  Adding these as user-callable  
functions allows writing some tests.  Also, we have a user-callable md5  
function but no more modern alternative, which led to wide use of md5 as  
a general-purpose hash function, which leads to occasional complaints  
about using md5.  
  
Also mark the existing md5 functions as leak-proof.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/cryptohashes.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/pg_proc.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Be lazier about partition tuple routing.

commit   : edd44738bc88148784899a8949519364d81d9ea8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 10:55:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 10:55:54 -0500    

Click here for diff

It's not necessary to fully initialize the executor data structures  
for partitions to which no tuples are ever routed.  Consider, for  
example, an INSERT statement that inserts only one row: it only cares  
about the partition to which that one row is routed.  The new function  
ExecInitPartitionInfo performs the initialization in question only  
when a particular partition is about to receive a tuple. This includes  
creating, validating, and saving a pointer to the ResultRelInfo,  
setting up for speculative insertions, translating WCOs and  
initializing the resulting expressions, translating returning lists  
and building the appropriate projection information, and setting up a  
tuple conversion map.  
  
One thing that's not deferred is locking the child partitions; that  
seems desirable but would need more thought.  Still, testing shows  
that this makes single-row inserts significantly faster on a table  
with many partitions without harming the bulk-insert case.  
  
Amit Langote, reviewed by Etsuro Fujita, with a few changes by me  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/execPartition.h

Remove extra word from comment.

commit   : 810e7e264ab547c404e32dba4f8733db53912084    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 10:08:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 10:08:03 -0500    

Click here for diff

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

M src/backend/executor/execPartition.c

postgres_fdw: Fix interaction of PHVs with child joins.

commit   : 84cb51b4e24b4e3a7057105971d0d385e179d978    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 10:03:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 10:03:14 -0500    

Click here for diff

Commit f49842d1ee31b976c681322f76025d7732e860f3 introduced the  
concept of a child join, but did not update this code accordingly.  
  
Ashutosh Bapat, with cosmetic changes by me  
  
Discussion: http://postgr.es/m/CAFjFpRf=J_KPOtw+bhZeURYkbizr8ufSaXg6gPEF6DKpgH-t6g@mail.gmail.com  

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

Avoid another valgrind complaint about write() of uninitalized bytes.

commit   : de6428afe13bb6eb1c99a70aada1a105966bc27e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 09:28:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 09:28:12 -0500    

Click here for diff

Peter Geoghegan, per buildfarm member skink and Andres Freund  
  
Discussion: http://postgr.es/m/[email protected]  

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

Try to stabilize EXPLAIN output in partition_check test.

commit   : 9a5c4f58f36dc7c87619602a7a2ec7de5a287068    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 08:51:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Feb 2018 08:51:00 -0500    

Click here for diff

Commit 7d8ac9814bc9bb6df2d845dbabed38d7284c7c2c adjusted these  
tests in the hope of preserving the plan shape, but I failed to  
notice that the three partitions were, on my local machine, choosing  
two different plan shapes.  This is probably related to the fact  
that all three tables have exactly the same row count.  Try to  
improve the situation by making pht1_e about half as large as  
the other two.  
  
Per Tom Lane and the buildfarm.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Charge cpu_tuple_cost * 0.5 for Append and MergeAppend nodes.

commit   : 7d8ac9814bc9bb6df2d845dbabed38d7284c7c2c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 21 Feb 2018 23:09:27 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 21 Feb 2018 23:09:27 -0500    

Click here for diff

Previously, Append didn't charge anything at all, and MergeAppend  
charged only cpu_operator_cost, about half the value used here.  This  
change might make MergeAppend plans slightly more likely to be chosen  
than before, since this commit increases the assumed cost for Append  
-- with default values -- by 0.005 per tuple but MergeAppend by only  
0.0025 per tuple.  Since the comparisons required by MergeAppend are  
costed separately, it's not clear why MergeAppend needs to be  
otherwise more expensive than Append, so hopefully this is OK.  
  
Prior to partition-wise join, it didn't really matter whether or not  
an Append node had any cost of its own, because every plan had to use  
the same number of Append or MergeAppend nodes and in the same places.  
Only the relative cost of Append vs. MergeAppend made a difference.  
Now, however, it is possible to avoid some of the Append nodes using a  
partition-wise join, so it's worth making an effort.  Pending patches  
for partition-wise aggregate care too, because an Append of Aggregate  
nodes will incur the Append overhead fewer times than an Aggregate  
over an Append.  Although in most cases this change will favor the use  
of partition-wise techniques, it does the opposite when the join  
cardinality is greater than the sum of the input cardinalities.  Since  
this situation arises in an existing regression test, I [rhaas]  
adjusted it to keep the overall plan shape approximately the same.  
  
Jeevan Chalke, per a suggestion from David Rowley.  Reviewed by  
Ashutosh Bapat.  Some changes by me.  The larger patch series of which  
this patch is a part was also reviewed and tested by Antonin Houska,  
Rajkumar Raghuwanshi, David Rowley, Dilip Kumar, Konstantin Knizhnik,  
Pascal Legrand, Rafia Sabih, and me.  
  
Discussion: http://postgr.es/m/CAKJS1f9UXdk6ZYyqbJnjFO9a9hyHKGW7B=ZRh-rxy9qxfPA5Gw@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/partition_join.sql

Repair pg_upgrade's failure to preserve relfrozenxid for matviews.

commit   : 38b41f182a66b67e36e2adf53d078599b1b65483    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Feb 2018 18:40:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Feb 2018 18:40:24 -0500    

Click here for diff

This oversight led to data corruption in matviews, manifesting as  
"could not access status of transaction" before our most recent releases,  
and "found xmin from before relfrozenxid" errors since then.  
  
The proximate cause of the problem seems to have been confusion between  
the task of preserving dropped-column status and the task of preserving  
frozenxid status.  Those are required for distinct sets of relkinds,  
and the reasoning was entirely undocumented in the source code.  In hopes  
of forestalling future errors of the same kind, try to improve the  
commentary in this area.  
  
In passing, also improve the remarkably unhelpful comments around  
pg_upgrade's set_frozenxids().  That's not actually buggy AFAICS,  
but good luck figuring out what it does from the old comments.  
  
Per report from Claudio Freire.  It appears that bug #14852 from Alexey  
Ermakov is an earlier report of the same issue, and there may be other  
cases that we failed to identify at the time.  
  
Patch by me based on analysis by Andres Freund.  The bug dates back  
to the introduction of matviews, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAGTBQpbrY9CdRGGhyBZ9yqY4jWaGC85rUF4X+R7d-aim=mBNsw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/pg_upgrade.c

Blindly attempt to adapt sepgsql regression tests.

commit   : 29d432e477a99f4c1e18820c5fc820a6b178c695    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Feb 2018 18:24:00 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Feb 2018 18:24:00 -0800    

Click here for diff

Commit bf6c614a2f2c58312b3be34a47e7fb7362e07bcb broke the sepgsql test  
due to a new invocation of the function access hook during grouping  
equal initialization.  
  
The new behaviour seems at least as correct as the old one, so try  
adapt the tests. As I've no working sepgsql setup here, this is just  
going from buildfarm results.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/misc.out

Use platform independent type for TupleTableSlot->tts_off.

commit   : 4c0ec9ee28279cc6a610cde8470fc8b606267b68    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Feb 2018 15:12:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Feb 2018 15:12:52 -0800    

Click here for diff

Previously tts_off was, for unknown reasons, of type long. For one  
that's unnecessary as tuples are restricted in length, for another  
long would be a bad choice of type even if that weren't the case, as  
it's not reliably wider than an int. Also HeapTupleHeader->t_len is a  
uint32.  
  
This is split off from a larger patch implementing JITed tuple  
deforming. Seems like an independent improvement, as tiny as it is.  
  
Author: Andres Freund  

M src/backend/access/common/heaptuple.c
M src/include/executor/tuptable.h

Error message improvement

commit   : c2ff42c6c1631c6c67d09fc8574186a984566a0d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2018 17:58:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2018 17:58:27 -0500    

Click here for diff

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

Fix pg_dump's logic for eliding sequence limits that match the defaults.

commit   : 3486bcf9e89d87b59d0e370af098fda38be97209    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Feb 2018 11:23:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Feb 2018 11:23:33 -0500    

Click here for diff

The previous coding here applied atoi() to strings that could represent  
values too large to fit in an int.  If the overflowed value happened to  
match one of the cases it was looking for, it would drop that limit  
value from the output, leading to incorrect restoration of the sequence.  
  
Avoid the unsafe behavior, and also make the logic cleaner by explicitly  
calculating the default min/max values for the appropriate kind of  
sequence.  
  
Reported and patched by Alexey Bashtanov, though I whacked his patch  
around a bit.  Back-patch to v10 where the faulty logic was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Adjust ALTER TABLE docs on partitioned constraints

commit   : 9a89f6d85467be362f4d426c76439cea70cd327f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Feb 2018 12:08:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Feb 2018 12:08:55 -0300    

Click here for diff

Move the "additional restrictions" comment to ALTER TABLE ADD  
CONSTRAINT instead of ADD CONSTRAINT USING INDEX; and in the latter  
instead indicate that partitioned tables are unsupported  
  
Noted by David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwY4Ld7ecxL_KAmaxwt0FUu5VcPPN2L4dh+3BeYbrdBa5g@mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml

Fix typo

commit   : 9a44a26b65d3d36867267624b76d3dea3dc4f6f6    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 20 Feb 2018 12:03:18 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 20 Feb 2018 12:03:18 +0100    

Click here for diff

Author: Masahiko Sawada  

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

Fix crash in pg_replication_slot_advance

commit   : 6f1d723b6359507ef55a81617167507bc25e3e2b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Feb 2018 18:00:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Feb 2018 18:00:53 -0300    

Click here for diff

We were trying to use a LSN variable after releasing its containing slot  
structure.  
  
Reported by: tushar  
Author: amul sul  
Reviewed-by: Petr Jelinek, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slotfuncs.c

Fix misbehavior of CTE-used-in-a-subplan during EPQ rechecks.

commit   : 159efe4af4509741c25d6b95ddd9fda86facce42    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2018 16:00:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2018 16:00:18 -0500    

Click here for diff

An updating query that reads a CTE within an InitPlan or SubPlan could get  
incorrect results if it updates rows that are concurrently being modified.  
This is caused by CteScanNext supposing that nothing inside its recursive  
ExecProcNode call could change which read pointer is selected in the CTE's  
shared tuplestore.  While that's normally true because of scoping  
considerations, it can break down if an EPQ plan tree gets built during the  
call, because EvalPlanQualStart builds execution trees for all subplans  
whether they're going to be used during the recheck or not.  And it seems  
like a pretty shaky assumption anyway, so let's just reselect our own read  
pointer here.  
  
Per bug #14870 from Andrei Gorita.  This has been broken since CTEs were  
implemented, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix expected output

commit   : 4108a28d3a02c4226b0f558cf00738e00e8ea2a1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Feb 2018 17:56:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Feb 2018 17:56:43 -0300    

Click here for diff

M src/test/regress/expected/indexing.out

Allow UNIQUE indexes on partitioned tables

commit   : eb7ed3f3063401496e4aa4bd68fa33f0be31a72f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Feb 2018 16:59:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Feb 2018 16:59:37 -0300    

Click here for diff

If we restrict unique constraints on partitioned tables so that they  
must always include the partition key, then our standard approach to  
unique indexes already works --- each unique key is forced to exist  
within a single partition, so enforcing the unique restriction in each  
index individually is enough to have it enforced globally.  Therefore we  
can implement unique indexes on partitions by simply removing a few  
restrictions (and adding others.)  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Simon Riggs, Jesper Pedersen, Peter Eisentraut, Jaime  
	Casanova, Amit Langote  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/index.h
M src/include/catalog/pg_constraint_fn.h
M src/include/commands/defrem.h
M src/include/parser/parse_utilcmd.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql

Remove bogus "extern" annotations on function definitions.

commit   : 524d64ea8e3e49b4fda41ff9b2f048b697384058    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2018 12:07:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2018 12:07:44 -0500    

Click here for diff

While this is not illegal C, project style is to put "extern" only on  
declarations not definitions.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f9RKLWXcMBQhvDYhmsMEo+ALuNgA-NE+AX5Uoke9DJ2Xg@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/foreign/foreign.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/utils/adt/json.c

Remove redundant initialization of a local variable.

commit   : 8c44802b6ed4846accb08e2ffe93040b8b42aae9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Feb 2018 23:32:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Feb 2018 23:32:56 -0500    

Click here for diff

In what was doubtless a typo, commit bf6c614a2 introduced a duplicate  
initialization of a local variable.  This made Coverity unhappy, as well  
as pretty much anybody reading the code.  We don't even have a real use  
for the local variable, so just remove it.  

M src/backend/executor/nodeGroup.c

Fix StaticAssertExpr() under C++

commit   : ebf6049ebea19e4123fefce7b542189e84084cd1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 18 Feb 2018 22:20:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 18 Feb 2018 22:20:54 -0500    

Click here for diff

The previous code didn't compile, because static_assert() must end with  
a semicolon.  To fix, wrap it in a block, similar to the C code.  

M src/include/c.h

Remove redundant function declaration

commit   : 2e1d1ebdffa2c69779573c2e561056cd08541e74    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 18 Feb 2018 22:20:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 18 Feb 2018 22:20:27 -0500    

Click here for diff

M src/backend/catalog/partition.c

Message style fix

commit   : 97a804cb2bba49d5ff04795cf500722977e5af9a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 18 Feb 2018 17:16:11 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 18 Feb 2018 17:16:11 -0500    

Click here for diff

M src/backend/commands/dbcommands.c

Move function comment to the right place

commit   : 1a1adb215c69bbf64fd8e01cc1706812dc8ba15b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 20:45:28 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 20:45:28 -0500    

Click here for diff

M src/backend/commands/tablecmds.c

Minor comment fix

commit   : 7923118c16aa3408a994f297d8bdd68292f45324    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 20:45:02 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Feb 2018 20:45:02 -0500    

Click here for diff

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

Refactor format_type APIs to be more modular

commit   : a26116c6cbf4117e8efaa7cfc5bacc887f01517f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 17 Feb 2018 19:02:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 17 Feb 2018 19:02:15 -0300    

Click here for diff

Introduce a new format_type_extended, with a flags bitmask argument that  
can modify the default behavior.  A few compatibility and readability  
wrappers remain:  
	format_type_be  
	format_type_be_qualified  
	format_type_with_typemod  
while format_type_with_typemod_qualified, which had a single caller, is  
removed.  
  
Author: Michael Paquier, some revisions by me  
Discussion: [email protected]  

M contrib/postgres_fdw/deparse.c
M src/backend/utils/adt/format_type.c
M src/include/utils/builtins.h

Mention trigger name in trigger test

commit   : cef60043dd27c47a1a4a220158836ccff20be07a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 13 Feb 2018 19:47:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 13 Feb 2018 19:47:16 -0300    

Click here for diff

This makes it more explicit exactly what is going on, for further  
proposed behavior changes.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow tupleslots to have a fixed tupledesc, use in executor nodes.

commit   : ad7dbee368a7cd9e595d2a957be784326b08c943    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Feb 2018 21:17:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Feb 2018 21:17:38 -0800    

Click here for diff

The reason for doing so is that it will allow expression evaluation to  
optimize based on the underlying tupledesc. In particular it will  
allow to JIT tuple deforming together with the expression itself.  
  
For that expression initialization needs to be moved after the  
relevant slots are initialized - mostly unproblematic, except in the  
case of nodeWorktablescan.c.  
  
After doing so there's no need for ExecAssignResultType() and  
ExecAssignResultTypeFromTL() anymore, as all former callers have been  
converted to create a slot with a fixed descriptor.  
  
When creating a slot with a fixed descriptor, tts_values/isnull can be  
allocated together with the main slot, reducing allocation overhead  
and increasing cache density a bit.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/README
M src/backend/executor/execExpr.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/replication/logical/worker.c
M src/include/executor/executor.h
M src/include/executor/tuptable.h

Do execGrouping.c via expression eval machinery, take two.

commit   : bf6c614a2f2c58312b3be34a47e7fb7362e07bcb    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Feb 2018 21:55:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Feb 2018 21:55:31 -0800    

Click here for diff

This has a performance benefit on own, although not hugely so. The  
primary benefit is that it will allow for to JIT tuple deforming and  
comparator invocations.  
  
Large parts of this were previously committed (773aec7aa), but the  
commit contained an omission around cross-type comparisons and was  
thus reverted.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/utils/adt/orderedsetaggs.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h

Fix crash when canceling parallel query

commit   : ad9a274778d2d88c46b90309212b92ee7fdf9afe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Feb 2018 17:07:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Feb 2018 17:07:38 -0500    

Click here for diff

elog(FATAL) would end up calling PortalCleanup(), which would call  
executor shutdown code, which could fail and crash, especially under  
parallel query.  This was introduced by  
8561e4840c81f7e345be2df170839846814fa004, which did not want to mark an  
active portal as failed by a normal transaction abort anymore.  But we  
do need to do that for an elog(FATAL) exit.  Introduce a variable  
shmem_exit_inprogress similar to the existing proc_exit_inprogress, so  
we can tell whether we are in the FATAL exit scenario.  
  
Reported-by: Andres Freund <[email protected]>  

M src/backend/storage/ipc/ipc.c
M src/backend/utils/mmgr/portalmem.c
M src/include/storage/ipc.h

Remove some inappropriate #includes.

commit   : 49bff412edd9eb226e146f6e4db7b5a8e843bd1f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Feb 2018 12:14:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Feb 2018 12:14:08 -0500    

Click here for diff

Other header files should never #include postgres.h (nor postgres_fe.h,  
nor c.h), per project policy.  Also, there's no need for any backend .c  
file to explicitly include elog.h or palloc.h, because postgres.h pulls  
those in already.  
  
Extracted from a larger patch by Kyotaro Horiguchi.  The rest of the  
removals he suggests require more study, but these are no-brainers.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/knapsack.c
M src/backend/replication/basebackup.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/rls.c
M src/include/lib/knapsack.h
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/plpy_util.c

Rename enable_partition_wise_join to enable_partitionwise_join

commit   : 2fb1abaeb016aeb45b9e6d0b81b7a7e92bb251b9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 10:33:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2018 10:33:59 -0500    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/ad24e4f4-6481-066e-e3fb-6ef4a3121882%402ndquadrant.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M src/backend/optimizer/README
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/partition_join.sql

Fix typo in comment

commit   : f8437c819acc37b43bd2d5b19a6b7609b4ea1292    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 16 Feb 2018 12:46:41 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 16 Feb 2018 12:46:41 +0100    

Click here for diff

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

Revert "Do execGrouping.c via expression eval machinery."

commit   : 2a41507dab0f293ff241fe8ae326065998668af8    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Feb 2018 22:39:18 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Feb 2018 22:39:18 -0800    

Click here for diff

This reverts commit 773aec7aa98abd38d6d9435913bb8e14e392c274.  
  
There's an unresolved issue in the reverted commit: It only creates  
one comparator function, but in for the nodeSubplan.c case we need  
more (c.f. FindTupleHashEntry vs LookupTupleHashEntry calls in  
nodeSubplan.c).  
  
This isn't too difficult to fix, but it's not entirely trivial  
either. The fact that the issue only causes breakage on 32bit systems  
shows that the current test coverage isn't that great.  To avoid  
turning half the buildfarm red till those two issues are addressed,  
revert.  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/utils/adt/orderedsetaggs.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h

Do execGrouping.c via expression eval machinery.

commit   : 773aec7aa98abd38d6d9435913bb8e14e392c274    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Feb 2018 21:55:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Feb 2018 21:55:31 -0800    

Click here for diff

This has a performance benefit on own, although not hugely so. The  
primary benefit is that it will allow for to JIT tuple deforming and  
comparator invocations.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/utils/adt/orderedsetaggs.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h

Fix plpgsql to enforce domain checks when returning a NULL domain value.

commit   : 51db0d18fbf58b0c2e5ebc2b5b2c48daf45c8d93    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2018 16:25:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2018 16:25:19 -0500    

Click here for diff

If a plpgsql function is declared to return a domain type, and the domain's  
constraints forbid a null value, it was nonetheless possible to return  
NULL, because we didn't bother to check the constraints for a null result.  
I'd noticed this while fooling with domains-over-composite, but had not  
gotten around to fixing it immediately.  
  
Add a regression test script exercising this and various other domain  
cases, largely borrowed from the plpython_types test.  
  
Although this is clearly a bug fix, I'm not sure whether anyone would  
thank us for changing the behavior in stable branches, so I'm inclined  
not to back-patch.  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_domain.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
A src/pl/plpgsql/src/sql/plpgsql_domain.sql

Doc: fix minor bug in CREATE TABLE example.

commit   : 439c7bc1a070d746fab69d8696fca78673e64ba9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2018 13:56:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2018 13:56:38 -0500    

Click here for diff

One example in create_table.sgml claimed to be showing table constraint  
syntax, but it was really column constraint syntax due to the omission  
of a comma.  This is both wrong and confusing, so fix it in all  
supported branches.  
  
Per report from [email protected].  
  
Discussion: https://postgr.es/m/[email protected]  

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

Cast to void in StaticAssertExpr, not its callers.

commit   : 51940f97607b7cb4d03bdd99e43abb1a1c6a0c47    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2018 13:41:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2018 13:41:30 -0500    

Click here for diff

Seems a bit silly that many (in fact all, as of today) uses of  
StaticAssertExpr would need to cast it to void to avoid warnings from  
pickier compilers.  Let's just do the cast right in the macro, instead.  
  
In passing, change StaticAssertExpr to StaticAssertStmt in one  
place where that seems more apropos.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/lwlock.c
M src/include/c.h

Move the extern declaration for ExceptionalCondition into c.h.

commit   : 03c5a00ea3867f5736da6cedce73b1eea88a98af    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 19:43:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 19:43:33 -0500    

Click here for diff

This is the logical conclusion of our decision to support Assert()  
in both frontend and backend code: it should be possible to use that  
after including just c.h.  But as things were arranged before, if  
you wanted to use Assert() in code that might be compiled for either  
environment, you had to include postgres.h for the backend case.  
Let's simplify that.  
  
Per buildfarm, some of whose members started throwing warnings after  
commit 0c62356cc added an Assert in src/port/snprintf.c.  
  
It's possible that some other src/port files that use the stanza  
  
#ifndef FRONTEND  
#include "postgres.h"  
#else  
#include "postgres_fe.h"  
#endif  
  
could now be simplified to just say '#include "c.h"'.  I have not  
tested for that, though, and it'd be unlikely to apply for more  
than a small number of them.  

M src/include/c.h
M src/include/postgres.h

Revert "Stabilize output of new regression test case".

commit   : cbadba8dd632fc0d4162f7d686fec631bce7dfd0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 18:42:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 18:42:14 -0500    

Click here for diff

This effectively reverts commit 9edc97b71 (although the test is now  
in a different place and has different contents).  We don't need that  
hack anymore, because since commit 4b93f5799, this test case no longer  
throws an error and so there's no displayed CONTEXT that could vary  
depending on CLOBBER_CACHE_ALWAYS.  The underlying unstable-output  
problem isn't really gone, of course, but it no longer manifests here.  

M src/pl/plpgsql/src/expected/plpgsql_varprops.out
M src/pl/plpgsql/src/sql/plpgsql_varprops.sql

Stabilize new plpgsql_record regression tests.

commit   : feb1cc5593a5188796c2f52241f407500209fff2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 18:17:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 18:17:22 -0500    

Click here for diff

The buildfarm's CLOBBER_CACHE_ALWAYS animals aren't happy with some  
of the test cases added in commit 4b93f5799.  There are two different  
problems:  
  
* In two places, a different CONTEXT stack is shown because the error  
is detected in a different place, due to recompiling an expression  
from scratch rather than re-using a previously cached plan for it.  
I fixed these via the expedient of hiding the CONTEXT stack altogether.  
  
* In one place, a test expected to fail (because a cached plan hadn't  
been updated) actually succeeds (because the forced recompile makes  
it good).  I couldn't think of a simple workaround for this, so I've  
just commented out that test step altogether.  
  
I have hopes of improving things enough that both of these kluges can  
be reverted eventually.  The first one is the same kind of problem  
previously discussed at  
https://postgr.es/m/[email protected]  
but there was insufficient agreement about how to fix it, so we  
just hacked around the output instability (commit 9edc97b71).  
The second issue should be fixed by allowing the plan to be rebuilt  
when a type conflict is detected.  But for today, let's just make the  
buildfarm green again.  

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

Return implementation defined value if pg_$op_s$bit_overflow overflows.

commit   : 6d7dc5350042697bbb141a7362649db7fa67bd55    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 14 Feb 2018 14:17:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 14 Feb 2018 14:17:28 -0800    

Click here for diff

Some older compilers otherwise sometimes complain about undefined  
values, even though the return value should not be used in the  
overflow case.  We assume that any decent compiler will optimize away  
the unnecessary assignment in performance critical cases.  
  
We do not want to restrain the returned value to a specific value,  
e.g. 0 or the wrapped-around value, because some fast ways to  
implement overflow detecting math do not easily allow for  
that (e.g. msvc intrinsics).  As the function documentation already  
documents the returned value in case of intrinsics to be  
implementation defined, no documentation has to be updated.  
  
Per complaint from Tom Lane and his buildfarm member prairiedog.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/int.h

Silence assorted "variable may be used uninitialized" warnings.

commit   : 9a725f7b5cb7e8c8894ef121b49eff9c265245c8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 16:06:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 16:06:49 -0500    

Click here for diff

All of these are false positives, but in each case a fair amount of  
analysis is needed to see that, and it's not too surprising that not all  
compilers are smart enough.  (In particular, in the logtape.c case, a  
compiler lacking the knowledge provided by the Assert would almost surely  
complain, so that this warning will be seen in any non-assert build.)  
  
Some of these are of long standing while others are pretty recent,  
but it only seems worth fixing them in HEAD.  
  
Jaime Casanova, tweaked a bit by me  
  
Discussion: https://postgr.es/m/CAJGNTeMcYAMJdPAom52dppLMtF-UnEZi0dooj==75OEv1EoBZA@mail.gmail.com  

M src/backend/access/transam/xloginsert.c
M src/backend/catalog/objectaddress.c
M src/backend/utils/sort/logtape.c
M src/bin/pgbench/pgbench.c

Add an assertion that we don't pass NULL to snprintf("%s").

commit   : 0c62356cc8777961221a643fa77f62e1c7361085    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 15:06:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 15:06:01 -0500    

Click here for diff

Per commit e748e902d, we appear to have little or no coverage in the  
buildfarm of machines that will dump core when asked to printf a  
null string pointer.  Let's try to improve that situation by adding  
an assertion that will make src/port/snprintf.c behave that way.  
Since it's just an assertion, it won't break anything in production  
builds, but it will help developers find this type of oversight.  
  
Note that while our buildfarm coverage of machines that use that  
snprintf implementation is pretty thin on the Unix side (apparently  
amounting only to gaur/pademelon), all of the MSVC critters use it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Fix broken logic for reporting PL/Python function names in errcontext.

commit   : e748e902def40ee52d1ef0b770fd24aa0835e304    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 14:47:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2018 14:47:18 -0500    

Click here for diff

plpython_error_callback() reported the name of the function associated  
with the topmost PL/Python execution context.  This was not merely  
wrong if there were nested PL/Python contexts, but it risked a core  
dump if the topmost one is an inline code block rather than a named  
function.  That will have proname = NULL, and so we were passing a NULL  
pointer to snprintf("%s").  It seems that none of the PL/Python-testing  
machines in the buildfarm will dump core for that, but some platforms do,  
as reported by Marina Polyakova.  
  
Investigation finds that there actually is an existing regression test  
that used to prove that the behavior was wrong, though apparently no one  
had noticed that it was printing the wrong function name.  It stopped  
showing the problem in 9.6 when we adjusted psql to not print CONTEXT  
by default for NOTICE messages.  The problem is masked (if your platform  
avoids the core dump) in error cases, because PL/Python will throw away  
the originally generated error info in favor of a new traceback produced  
at the outer level.  
  
Repair by using ErrorContextCallback.arg to pass the correct context to  
the error callback.  Add a regression test illustrating correct behavior.  
  
Back-patch to all supported branches, since they're all broken this way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpython/expected/plpython_error.out
M src/pl/plpython/expected/plpython_error_0.out
M src/pl/plpython/expected/plpython_error_5.out
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/sql/plpython_error.sql

Support CONSTANT/NOT NULL/initial value for plpgsql composite variables.

commit   : f9263006d871d127794a402a7bef713fdd882156    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 22:15:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 22:15:08 -0500    

Click here for diff

These features were never implemented previously for composite or record  
variables ... not that the documentation admitted it, so there's no doc  
updates here.  
  
This also fixes some issues concerning enforcing DOMAIN NOT NULL  
constraints against plpgsql variables, although I'm not sure that  
that topic is completely dealt with.  
  
I created a new plpgsql test file for these features, and moved the  
one relevant existing test case into that file.  
  
Tom Lane, reviewed by Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_varprops.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
A src/pl/plpgsql/src/sql/plpgsql_varprops.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Speed up plpgsql trigger startup by introducing "promises".

commit   : fd333bc763ea104f2a2c10c6b0061c996d4a2f5a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 19:20:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 19:20:37 -0500    

Click here for diff

Over the years we've accreted quite a few special variables that are  
predefined in plpgsql trigger functions.  The cost of initializing these  
variables to their defined values turns out to be a significant part of  
the runtime of simple triggers; but, undoubtedly, most real-world triggers  
never examine the values of most of these variables.  
  
To improve matters, invent the notion of a variable that has a "promise"  
attached to it, specifying which of the predetermined values should be  
assigned to the variable if anything ever reads it.  This eliminates all  
the unneeded startup overhead, in return for a small penalty on accesses  
to these variables.  
  
Tom Lane, reviewed by Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Speed up plpgsql function startup by doing fewer pallocs.

commit   : 40301c1c8bcbe92a9ba9bf017da03e83476ae0e5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 19:10:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 19:10:43 -0500    

Click here for diff

Previously, copy_plpgsql_datum did a separate palloc for each variable  
needing instance-local storage.  In simple benchmarks this made for a  
noticeable fraction of the total runtime.  Improve it by precalculating  
the space needed for all of a function's variables and doing just one  
palloc for all of them.  
  
In passing, remove PLPGSQL_DTYPE_EXPR from the list of plpgsql "datum"  
types, since in fact it has nothing in common with the others, and there  
is noplace that needs to discriminate on the basis of dtype between an  
expression and any type of datum.  And add comments clarifying which  
datum struct fields are generic and which aren't.  
  
Tom Lane, reviewed by Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Make plpgsql use its DTYPE_REC code paths for composite-type variables.

commit   : 4b93f57999a2ca9b9c9e573ea32ab1aeaa8bf496    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 18:52:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2018 18:52:21 -0500    

Click here for diff

Formerly, DTYPE_REC was used only for variables declared as "record";  
variables of named composite types used DTYPE_ROW, which is faster for  
some purposes but much less flexible.  In particular, the ROW code paths  
are entirely incapable of dealing with DDL-caused changes to the number  
or data types of the columns of a row variable, once a particular plpgsql  
function has been parsed for the first time in a session.  And, since the  
stored representation of a ROW isn't a tuple, there wasn't any easy way  
to deal with variables of domain-over-composite types, since the domain  
constraint checking code would expect the value to be checked to be a  
tuple.  A lesser, but still real, annoyance is that ROW format cannot  
represent a true NULL composite value, only a row of per-field NULL  
values, which is not exactly the same thing.  
  
Hence, switch to using DTYPE_REC for all composite-typed variables,  
whether "record", named composite type, or domain over named composite  
type.  DTYPE_ROW remains but is used only for its native purpose, to  
represent a fixed-at-compile-time list of variables, for instance the  
targets of an INTO clause.  
  
To accomplish this without taking significant performance losses, introduce  
infrastructure that allows storing composite-type variables as "expanded  
objects", similar to the "expanded array" infrastructure introduced in  
commit 1dc5ebc90.  A composite variable's value is thereby kept (most of  
the time) in the form of separate Datums, so that field accesses and  
updates are not much more expensive than they were in the ROW format.  
This holds the line, more or less, on performance of variables of named  
composite types in field-access-intensive microbenchmarks, and makes  
variables declared "record" perform much better than before in similar  
tests.  In addition, the logic involved with enforcing composite-domain  
constraints against updates of individual fields is in the expanded  
record infrastructure not plpgsql proper, so that it might be reusable  
for other purposes.  
  
In further support of this, introduce a typcache feature for assigning a  
unique-within-process identifier to each distinct tuple descriptor of  
interest; in particular, DDL alterations on composite types result in a new  
identifier for that type.  This allows very cheap detection of the need to  
refresh tupdesc-dependent data.  This improves on the "tupDescSeqNo" idea  
I had in commit 687f096ea: that assigned identifying sequence numbers to  
successive versions of individual composite types, but the numbers were not  
unique across different types, nor was there support for assigning numbers  
to registered record types.  
  
In passing, allow plpgsql functions to accept as well as return type  
"record".  There was no good reason for the old restriction, and it  
was out of step with most of the other PLs.  
  
Tom Lane, reviewed by Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml
M src/backend/executor/execExprInterp.c
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/expandedrecord.c
M src/backend/utils/cache/typcache.c
A src/include/utils/expandedrecord.h
M src/include/utils/typcache.h
M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/plpgsql.h
A src/pl/plpgsql/src/sql/plpgsql_record.sql
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

doc: pg_function_is_visible also applies to aggregates and procedures

commit   : 2ac3e6acc228e4b99022019379c6d5c4b61b231c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 10:39:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 10:39:51 -0500    

Click here for diff

M doc/src/sgml/func.sgml

Add procedure support to pg_get_functiondef

commit   : 7a32ac8a66903de8c352735f2a26f610f5e47090    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 10:34:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 10:34:04 -0500    

Click here for diff

This also makes procedures work in psql's \ef and \sf commands.  
  
Reported-by: Pavel Stehule <[email protected]>  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Add tests for pg_get_functiondef

commit   : 7cd56f218d0f8953999b944bc558cd6684b15cdc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Feb 2018 14:03:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Feb 2018 14:03:04 -0500    

Click here for diff

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

Fix typo

commit   : a7b8f0661d9ca9656ba58546ed871b36dbf8504d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Feb 2018 13:47:18 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Feb 2018 13:47:18 -0500    

Click here for diff

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

In LDAP test, restart after pg_hba.conf changes

commit   : b4e2ada347bd8ae941171bd0761462e5b11b765d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 09:12:45 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2018 09:12:45 -0500    

Click here for diff

Instead of issuing a reload after pg_hba.conf changes between test  
cases, run a full restart.  With a reload, an error in the new  
pg_hba.conf is ignored and the tests will continue to run with the old  
settings, invalidating the subsequent test cases.  With a restart, a  
faulty pg_hba.conf will lead to the test being aborted, which is what  
we'd rather want.  

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

Fix typo

commit   : ebdb42a0d6a61b93a5bb9f4204408edf5959332c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Feb 2018 22:39:52 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Feb 2018 22:39:52 -0500    

Click here for diff

Author: Masahiko Sawada <[email protected]>  

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

get_relid_attribute_name is dead, long live get_attname

commit   : 8237f27b504ff1d1e2da7ae4c81a7f72ea0e0e3e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Feb 2018 19:30:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Feb 2018 19:30:30 -0300    

Click here for diff

The modern way is to use a missing_ok argument instead of two separate  
almost-identical routines, so do that.  
  
Author: Michaƫl Paquier  
Reviewed-by: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/dml.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/include/utils/lsyscache.h

Fix parallel index builds for dynamic_shared_memory_type=none.

commit   : 88ef48c1ccee6a2200e01318180cf521413b3012    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 12 Feb 2018 12:55:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 12 Feb 2018 12:55:12 -0500    

Click here for diff

The previous code failed to realize that this setting effectively  
disables parallelism, and would crash if it decided to attempt  
parallelism anyway.  Instead, treat it as a disabling condition.  
  
Kyotaro Horiguchi, who also reported the issue. Reviewed by Michael  
Paquier and Peter Geoghegan.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Add missing article

commit   : 80f021ef139affdb219ccef71fff283e8f91f112    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Feb 2018 11:38:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Feb 2018 11:38:06 -0300    

Click here for diff

Noticed while reviewing nearby text  

M doc/src/sgml/ddl.sgml

psql: give ^D hint for \q in place where \q is ignored

commit   : 91389228a1007fa3845e29e17568e52ab1726d5d    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 12 Feb 2018 01:27:06 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 12 Feb 2018 01:27:06 -0500    

Click here for diff

Also add comment on why exit/quit are not documented.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/mainloop.c

Fix assorted errors in pg_dump's handling of extended statistics objects.

commit   : 5c9f2564fabbc770ead3bd92136fdafc43654f27    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Feb 2018 13:24:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Feb 2018 13:24:15 -0500    

Click here for diff

pg_dump supposed that a stats object necessarily shares the same schema  
as its underlying table, and that it doesn't have a separate owner.  
These things may have been true during early development of the feature,  
but they are not true as of v10 release.  
  
Failure to track the object's schema separately turns out to have only  
limited consequences, because pg_get_statisticsobjdef() always schema-  
qualifies the target object name in the generated CREATE STATISTICS command  
(a decision out of step with the rest of ruleutils.c, but I digress).  
Therefore the restored object would be in the right schema, so that the  
only problem is that the TOC entry would be mislabeled as to schema.  That  
could lead to wrong decisions for schema-selective restores, for example.  
  
The ownership issue is a bit more serious: not only was the TOC entry  
potentially mislabeled as to owner, but pg_dump didn't bother to issue an  
ALTER OWNER command at all, so that after restore the stats object would  
continue to be owned by the restoring superuser.  
  
A final point is that decisions as to whether to dump a stats object or  
not were driven by whether the underlying table was dumped or not.  While  
that's not wrong on its face, it won't scale nicely to the planned future  
extension to cross-table statistics.  Moreover, that design decision comes  
out of the view of stats objects as being auxiliary to a particular table,  
like a rule or trigger, which is exactly where the above problems came  
from.  Since we're now treating stats objects more like independent objects  
in their own right, they ought to behave like standalone objects for this  
purpose too.  So change to using the generic selectDumpableObject() logic  
for them (which presently amounts to "dump if containing schema is to be  
dumped").  
  
Along the way to fixing this, restructure so that getExtendedStatistics  
collects the identity info (only) for all extended stats objects in one  
query, and then for each object actually being dumped, we retrieve the  
definition in dumpStatisticsExt.  This is necessary to ensure that  
schema-qualification in the generated CREATE STATISTICS command happens  
with respect to the search path that pg_dump will now be using at restore  
time (ie, the schema the stats object is in, not that of the underlying  
table).  It's probably also significantly faster in the typical scenario  
where only a minority of tables have extended stats.  
  
Back-patch to v10 where extended stats were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid premature free of pass-by-reference CALL arguments.

commit   : d02d4a6d4f27c223f48b03a5e651a22c8460b3c4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Feb 2018 13:37:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Feb 2018 13:37:12 -0500    

Click here for diff

Prematurely freeing the EState used to evaluate CALL arguments led, in some  
cases, to passing dangling pointers to the procedure.  This was masked in  
trivial cases because the argument pointers would point to Const nodes in  
the original expression tree, and in some other cases because the result  
value would end up in the standalone ExprContext rather than in memory  
belonging to the EState --- but that wasn't exactly high quality  
programming either, because the standalone ExprContext was never  
explicitly freed, breaking assorted API contracts.  
  
In addition, using a separate EState for each argument was just silly.  
  
So let's use just one EState, and one ExprContext, and make the latter  
belong to the former rather than be standalone, and clean up the EState  
(and hence the ExprContext) post-call.  
  
While at it, improve the function's commentary a bit.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix oversight in CALL argument handling, and do some minor cleanup.

commit   : 65b1d767856d96c7d6f952f30890dd5b7d4b66bb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Feb 2018 13:05:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Feb 2018 13:05:14 -0500    

Click here for diff

CALL statements cannot support sub-SELECTs in the arguments of the called  
procedure, since they just use ExecEvalExpr to evaluate such arguments.  
Teach transformSubLink() to reject the case, as it already does for other  
contexts in which subqueries are not supported.  
  
In passing, s/EXPR_KIND_CALL/EXPR_KIND_CALL_ARGUMENT/ to make that enum  
symbol line up more closely with the phrasing of the error messages it is  
associated with.  And fix someone's weak grasp of English grammar in the  
preceding EXPR_KIND_PARTITION_EXPRESSION addition.  Also update an  
incorrect comment in resolve_unique_index_expr (possibly it was correct  
when written, but nowadays transformExpr definitely does reject SRFs here).  
  
Per report from Pavel Stehule --- but this resolves only one of the bugs  
he mentions.  
  
Discussion: https://postgr.es/m/CAFj8pRDxOwPPzpA8i+AQeDQFj7bhVw-dR2==rfWZ3zMGkm568Q@mail.gmail.com  

M src/backend/commands/functioncmds.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/include/parser/parse_node.h
M src/test/regress/expected/create_table.out

Mention partitioned indexes in "Data Definition" chapter

commit   : fad15f4a547ad433a28c370bd071b08df9e65f10    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 10 Feb 2018 10:01:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 10 Feb 2018 10:01:37 -0300    

Click here for diff

We can now create indexes more easily than before, so update this  
chapter to use the simpler instructions.  
  
After an idea of Amit Langote.  I (Ɓlvaro) opted to do more invasive  
surgery and remove the previous suggestion to create per-partition  
indexes, which his patch left in place.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Amit Langote, Ɓlvaro Herrera  

M doc/src/sgml/ddl.sgml

Mark assorted GUC variables as PGDLLIMPORT.

commit   : 935dee9ad5a8d12f4d3b772a6e6c99d245e5ad44    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 9 Feb 2018 15:54:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 9 Feb 2018 15:54:45 -0500    

Click here for diff

This makes life easier for extension authors.  
  
Metin Doslu  
  
Discussion: http://postgr.es/m/CAL1dPcfa45o1dC-c4t-48v0OZE6oy4ChJhObrtkK8mzNfXqDTA@mail.gmail.com  

M src/include/miscadmin.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/utils/guc.h

Clear stmt_timeout_active if we disable_all_timeouts.

commit   : be42015fcc7f91574775a53df9923a36fabddc60    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 9 Feb 2018 15:48:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 9 Feb 2018 15:48:18 -0500    

Click here for diff

Otherwise, we can end up with the flag set when the timeout is  
actually disabled, leading to misbehavior.  Commit  
f8e5f156b30efee5d0038b03e38735773abcb7ed introduced this bug.  
  
Reported by Peter Eisentraut.  Analysis and fix by Thomas Munro,  
tweaked by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c

postgres_fdw: Attmempt to stabilize regression tests.

commit   : 958e20e42d6c346ab89f6c72e4262230161d1663    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 9 Feb 2018 15:24:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 9 Feb 2018 15:24:35 -0500    

Click here for diff

Even after commit 882ea509fe7a4711fe25463427a33262b873dfa1, some  
buildfarm members are still failing in the postgres_fdw tests.  
Try to fix that by disabling use of remote statistics for some  
test cases.  
  
Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix incorrect method name in comment.

commit   : b78d0160da13109c69acfd0caded3f920bff2f3b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Feb 2018 14:35:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Feb 2018 14:35:54 -0500    

Click here for diff

Atsushi Torikoshi  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Avoid listing the same ResultRelInfo in more than one EState list.

commit   : e44dd84325c277fd031b9ef486c51a0946c7d3a0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Feb 2018 14:29:05 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Feb 2018 14:29:05 -0500    

Click here for diff

Doing so causes EXPLAIN ANALYZE to show trigger statistics multiple  
times.  Commit 2f178441044be430f6b4d626e4dae68a9a6f6cec seems to  
be to blame for this.  
  
Amit Langote, revieed by Amit Khandekar, Etsuro Fujita, and me.  

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

Fix possible infinite loop with Parallel Append.

commit   : 88fdc7006018b92d6ec92c54b3819764703daaba    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Feb 2018 12:31:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Feb 2018 12:31:48 -0500    

Click here for diff

When the previously-chosen plan was non-partial, all pa_finished  
flags for partial plans are now set, and pa_next_plan has not yet  
been set to INVALID_SUBPLAN_INDEX, the previous code could go into  
an infinite loop.  
  
Report by Rajkumar Raghuwanshi.  Patch by Amit Khandekar and me.  
Review by Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/CAJ3gD9cf43z78qY=U=H0HvOEN341qfRO-vLpnKPSviHeWgJQ5w@mail.gmail.com  

M src/backend/executor/nodeAppend.c

Refine SSL tests test name reporting

commit   : b3a101eff0fd3747bebf547b1769e28f820f4515    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2018 09:12:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2018 09:12:30 -0500    

Click here for diff

Instead of using the psql/libpq connection string as the displayed test  
name and relying on "notes" and source code comments to explain the  
tests, give the tests self-explanatory names, like we do elsewhere.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  

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

postgres_fdw: Remove CTID output from some tests.

commit   : 882ea509fe7a4711fe25463427a33262b873dfa1    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 20:38:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 20:38:08 -0500    

Click here for diff

Commit 1bc0100d270e5bcc980a0629b8726a32a497e788 added these tests,  
but they're not stable enough to survive in the buildfarm.  Remove  
CTIDs from the output in the hopes of fixing that.  

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

postgres_fdw: Push down UPDATE/DELETE joins to remote servers.

commit   : 1bc0100d270e5bcc980a0629b8726a32a497e788    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 15:34:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 15:34:30 -0500    

Click here for diff

Commit 0bf3ae88af330496517722e391e7c975e6bad219 allowed direct  
foreign table modification; instead of fetching each row, updating  
it locally, and then pushing the modification back to the remote  
side, we would instead do all the work on the remote server via a  
single remote UPDATE or DELETE command.  However, that commit only  
enabled this optimization when join tree consisted only of the  
target table.  
  
This change allows the same optimization when an UPDATE statement  
has a FROM clause or a DELETE statement has a USING clause.  This  
works much like ordinary foreign join pushdown, in that the tables  
must be on the same remote server, relevant parts of the query  
must be pushdown-safe, and so forth.  
  
Etsuro Fujita, reviewed by Ashutosh Bapat, Rushabh Lathia, and me.  
Some formatting corrections by me.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/[email protected]  

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

Make new triggers tests more robust

commit   : 7c44b75a2a0705bf17d0e7ef02b1a0a769306fa5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Feb 2018 14:57:19 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Feb 2018 14:57:19 -0500    

Click here for diff

Add explicit collation on the trigger name to avoid locale dependencies.  
Also restrict the tables selected, to avoid interference from  
concurrently running tests.  

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

Add more information_schema columns

commit   : 32ff2691173559e5f0ca3ea9cd5db134af6ee37d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Feb 2018 22:43:21 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Feb 2018 22:43:21 -0500    

Click here for diff

- table_constraints.enforced  
- triggers.action_order  
- triggers.action_reference_old_table  
- triggers.action_reference_new_table  
  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/information_schema.sgml
M src/backend/catalog/information_schema.sql
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Update out-of-date comment in StartupXLOG.

commit   : b98a7cd58f6189833e6ad6ac7e7ad5b6412409fd    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 08:48:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 08:48:04 -0500    

Click here for diff

Commit 4b0d28de06b28e57c540fca458e4853854fbeaf8 should have updated  
this comment, but did not.  
  
Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=0iJ8aqQcF9ij2KerAkuHF3SwrVTzjMdm1H4w++nfBf9A@mail.gmail.com  

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

Remove prototype for fmgr() function, which no longer exists.

commit   : 4815dfa10f4db8835b7424da22a4011b53040606    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 08:41:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Feb 2018 08:41:14 -0500    

Click here for diff

Commit 5ded4bd21403e143dd3eb66b92d52732fdac1945 removed the code  
for this function, but neglected to remove the prototype and  
associated comments.  
  
Dagfinn Ilmari MannsƄker  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/fmgr.h

Change default git repo URL to https

commit   : 9e039015501ad4033c093dee8dfc8b414634e953    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 7 Feb 2018 10:53:56 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 7 Feb 2018 10:53:56 +0100    

Click here for diff

Since we now support the server side handler for git over https (so  
we're no longer using the "dumb protocol"), make https the primary  
choice for cloning the repository, and the git protocol the secondary  
choice.  
  
In passing, also change the links to git-scm.com from http to https.  
  
Reviewed by Stefan Kaltenbrunner and David G. Johnston  

M doc/src/sgml/sourcerepo.sgml

Support all SQL:2011 options for window frame clauses.

commit   : 0a459cec96d3856f476c2db298c6b52f592894e8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Feb 2018 00:06:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Feb 2018 00:06:50 -0500    

Click here for diff

This patch adds the ability to use "RANGE offset PRECEDING/FOLLOWING"  
frame boundaries in window functions.  We'd punted on that back in the  
original patch to add window functions, because it was not clear how to  
do it in a reasonably data-type-extensible fashion.  That problem is  
resolved here by adding the ability for btree operator classes to provide  
an "in_range" support function that defines how to add or subtract the  
RANGE offset value.  Factoring it this way also allows the operator class  
to avoid overflow problems near the ends of the datatype's range, if it  
wishes to expend effort on that.  (In the committed patch, the integer  
opclasses handle that issue, but it did not seem worth the trouble to  
avoid overflow failures for datetime types.)  
  
The patch includes in_range support for the integer_ops opfamily  
(int2/int4/int8) as well as the standard datetime types.  Support for  
other numeric types has been requested, but that seems like suitable  
material for a follow-on patch.  
  
In addition, the patch adds GROUPS mode which counts the offset in  
ORDER-BY peer groups rather than rows, and it adds the frame_exclusion  
options specified by SQL:2011.  As far as I can see, we are now fully  
up to spec on window framing options.  
  
Existing behaviors remain unchanged, except that I changed the errcode  
for a couple of existing error reports to meet the SQL spec's expectation  
that negative "offset" values should be reported as SQLSTATE 22013.  
  
Internally and in relevant parts of the documentation, we now consistently  
use the terminology "offset PRECEDING/FOLLOWING" rather than "value  
PRECEDING/FOLLOWING", since the term "value" is confusingly vague.  
  
Oliver Ford, reviewed and whacked around some by me  
  
Discussion: https://postgr.es/m/CAGMVOdu9sivPAxbNN0X+q19Sfv9edEPv=HibOJhB14TJv_RCQg@mail.gmail.com  

M doc/src/sgml/btree.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/catalog/dependency.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/opclasscmds.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/errcodes.txt
M src/include/access/nbtree.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_node.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Fix incorrect grammar.

commit   : 23209457314f6fd89fcd251a8173b0129aaa95a2    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Feb 2018 15:50:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Feb 2018 15:50:13 -0500    

Click here for diff

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

M src/backend/executor/execPartition.c

Avoid valgrind complaint about write() of uninitalized bytes.

commit   : 9fafa413ac602624e10f61ef44a20c17029d43d8    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 6 Feb 2018 14:24:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 6 Feb 2018 14:24:57 -0500    

Click here for diff

LogicalTapeFreeze() may write out its first block when it is dirty but  
not full, and then immediately read the first block back in from its  
BufFile as a BLCKSZ-width block.  This can only occur in rare cases  
where very few tuples were written out, which is currently only  
possible with parallel external tuplesorts.  To avoid valgrind  
complaints, tell it to treat the tail of logtape.c's buffer as  
defined.  
  
Commit 9da0cc35284bdbe8d442d732963303ff0e0a40bc exposed this problem  
but did not create it.  LogicalTapeFreeze() has always tended to write  
out some amount of garbage bytes, but previously never wrote less than  
one block of data in total, so the problem was masked.  
  
Per buildfarm members lousyjack and skink.  
  
Peter Geoghegan, based on a suggestion from Tom Lane and me.  Some  
comment revisions by me.  

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

Doc: move info for btree opclass implementors into main documentation.

commit   : 3785f7eee3d98bc0a7ac2576aac9c0be974217d4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Feb 2018 13:52:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Feb 2018 13:52:27 -0500    

Click here for diff

Up to now, useful info for writing a new btree opclass has been buried  
in the backend's nbtree/README file.  Let's move it into the SGML docs,  
in preparation for extending it with info about "in_range" functions  
in the upcoming window RANGE patch.  
  
To do this, I chose to create a new chapter for btree indexes in Part VII  
(Internals), parallel to the chapters that exist for the newer index AMs.  
This is a pretty short chapter as-is.  At some point somebody might care  
to flesh it out with more detail about btree internals, but that is  
beyond the scope of my ambition for today.  
  
Discussion: https://postgr.es/m/[email protected]  

A doc/src/sgml/btree.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/nbtree/README

Fix possible crash in partition-wise join.

commit   : f069c91a5793ff6b7884120de748b2005ee7756f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 5 Feb 2018 17:31:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 5 Feb 2018 17:31:57 -0500    

Click here for diff

The previous code assumed that we'd always succeed in creating  
child-joins for a joinrel for which partition-wise join was considered,  
but that's not guaranteed, at least in the case where dummy rels  
are involved.  
  
Ashutosh Bapat, with some wordsmithing by me.  
  
Discussion: http://postgr.es/m/CAFjFpRf8=uyMYYfeTBjWDMs1tR5t--FgOe2vKZPULxxdYQ4RNw@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Last-minute updates for release notes.

commit   : 1eb5d43beed9d8cdc61377867f0a53eb2cfba0c4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Feb 2018 14:43:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Feb 2018 14:43:40 -0500    

Click here for diff

Security: CVE-2018-1052, CVE-2018-1053  

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

Ensure that all temp files made during pg_upgrade are non-world-readable.

commit   : a926eb84e07a604da6d059eca1fd87f919bb5d7a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Feb 2018 10:58:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Feb 2018 10:58:27 -0500    

Click here for diff

pg_upgrade has always attempted to ensure that the transient dump files  
it creates are inaccessible except to the owner.  However, refactoring  
in commit 76a7650c4 broke that for the file containing "pg_dumpall -g"  
output; since then, that file was protected according to the process's  
default umask.  Since that file may contain role passwords (hopefully  
encrypted, but passwords nonetheless), this is a particularly unfortunate  
oversight.  Prudent users of pg_upgrade on multiuser systems would  
probably run it under a umask tight enough that the issue is moot, but  
perhaps some users are depending only on pg_upgrade's umask changes to  
protect their data.  
  
To fix this in a future-proof way, let's just tighten the umask at  
process start.  There are no files pg_upgrade needs to write at a  
weaker security level; and if there were, transiently relaxing the  
umask around where they're created would be a safer approach.  
  
Report and patch by Tom Lane; the idea for the fix is due to Noah Misch.  
Back-patch to all supported branches.  
  
Security: CVE-2018-1053  

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

Fix RelationBuildPartitionKey's processing of partition key expressions.

commit   : 3492a0af0bd37e7f23e27fd3f5537f414ee9ab9b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Feb 2018 10:37:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Feb 2018 10:37:30 -0500    

Click here for diff

Failure to advance the list pointer while reading partition expressions  
from a list results in invoking an input function with inappropriate data,  
possibly leading to crashes or, with carefully crafted input, disclosure  
of arbitrary backend memory.  
  
Bug discovered independently by Ɓlvaro Herrera and David Rowley.  
This patch is by Ɓlvaro but owes something to David's proposed fix.  
Back-patch to v10 where the issue was introduced.  
  
Security: CVE-2018-1052  

M src/backend/utils/cache/relcache.c
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Skip setting up shared instrumentation for Hash node if not needed.

commit   : 05d0f13f0701d84e4e6784da336aabcc2dfc8ade    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Feb 2018 22:14:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Feb 2018 22:14:07 -0500    

Click here for diff

We don't need to set up the shared space for hash join instrumentation data  
if instrumentation hasn't been requested.  Let's follow the example of the  
similar Sort node code and save a few cycles by skipping that when we can.  
  
This reverts commit d59ff4ab3 and instead allows us to use the safer choice  
of passing noError = false to shm_toc_lookup in ExecHashInitializeWorker,  
since if we reach that call there should be a TOC entry to be found.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/E1ehkoZ-0005uW-43%40gemulon.postgresql.org  

M src/backend/executor/nodeHash.c

doc: Update mentions of MD5 in the documentation

commit   : ad14919ac901e9703d81a5bf8a6b608719c85b60    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Feb 2018 11:29:23 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Feb 2018 11:29:23 -0500    

Click here for diff

Reported-by: Shay Rojansky <[email protected]>  

M doc/src/sgml/runtime.sgml

Release notes for 10.2, 9.6.7, 9.5.11, 9.4.16, 9.3.21.

commit   : cf1cba3110f339eddecd66cdf7d8f9b4370f34c2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Feb 2018 15:13:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Feb 2018 15:13:44 -0500    

Click here for diff

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: minor clarifications in xindex.sgml.

commit   : 64fb645914741ffc3aee646308416c209c6ff06b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Feb 2018 11:46:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Feb 2018 11:46:28 -0500    

Click here for diff

I noticed some slightly confusing or out-of-date verbiage here  
while working on the window RANGE patch.  Seems worth committing  
separately.  

M doc/src/sgml/xindex.sgml

doc: Fix name in release notes

commit   : 4ac583f36a0c5452047531f56703b8ea51e718ad    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Feb 2018 11:09:24 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Feb 2018 11:09:24 -0500    

Click here for diff

Author: Alexander Lakhin <[email protected]>  

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

doc: Clarify psql --list documentation a bit more

commit   : 1d81c093db81f63727436c736d9d27b7bedb4b66    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 3 Feb 2018 10:19:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 3 Feb 2018 10:19:57 -0500    

Click here for diff

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

Minor copy-editing for 10.2 release notes.

commit   : 794eb3a8f00519fac561831dee35f4ee557bd08b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 22:33:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 22:33:38 -0500    

Click here for diff

Second pass after taking a break ...  

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

doc: Fix index link

commit   : bc38bdba04d75f7c39d57f3eba9c01958d8d2f7c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Feb 2018 21:10:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Feb 2018 21:10:59 -0500    

Click here for diff

The index entry was pointing to a slightly wrong location.  

M doc/src/sgml/logicaldecoding.sgml

Fix another instance of unsafe coding for shm_toc_lookup failure.

commit   : d59ff4ab3111f20054425d82dab1393101dcfe8e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 18:32:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 18:32:05 -0500    

Click here for diff

One or another author of commit 5bcf389ec seems to have thought that  
computing an offset from a NULL pointer would yield another NULL pointer.  
There may possibly be architectures where that works, but common machines  
don't work like that.  Per a quick code review of places calling  
shm_toc_lookup and not using noError = false.  

M src/backend/executor/nodeHash.c

Be more wary about shm_toc_lookup failure.

commit   : 957ff087c822c95f63df956e1a91c15614ecb2b4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 18:26:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 18:26:07 -0500    

Click here for diff

Commit 445dbd82a basically missed the point of commit d46633506,  
which was that we shouldn't allow shm_toc_lookup() failure to lead  
to a core dump or assertion crash, because the odds of such a  
failure should never be considered negligible.  It's correct that  
we can't expect the PARALLEL_KEY_ERROR_QUEUE TOC entry to be there  
if we have no workers.  But if we have no workers, we're not going  
to do anything in this function with the lookup result anyway,  
so let's just skip it.  That lets the code use the easy-to-prove-safe  
noError=false case, rather than anything requiring effort to review.  
  
Back-patch to v10, like the previous commit.  
  
Discussion: https://postgr.es/m/[email protected]  

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

First-draft release notes for 10.2.

commit   : bf641d3376018c40860f26167a60febff5bc1f51    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 17:10:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2018 17:10:46 -0500    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  

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

Fix application of identity values in some cases

commit   : 533c5d8bddf0feb1785b3da17c0d17feeaac76d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Feb 2018 14:20:50 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Feb 2018 14:20:50 -0500    

Click here for diff

Investigation of 2d2d06b7e27e3177d5bef0061801c75946871db3 revealed that  
identity values were not applied in some further cases, including  
logical replication subscribers, VALUES RTEs, and ALTER TABLE ... ADD  
COLUMN.  To fix all that, apply the identity column expression in  
build_column_default() instead of repeating the same logic at each call  
site.  
  
For ALTER TABLE ... ADD COLUMN ... IDENTITY, the previous coding  
completely ignored that existing rows for the new column should have  
values filled in from the identity sequence.  The coding using  
build_column_default() fails for this because the sequence ownership  
isn't registered until after ALTER TABLE, and we can't do it before  
because we don't have the column in the catalog yet.  So we specially  
remember in ColumnDef the sequence name that we decided on and build a  
custom NextValueExpr using that.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql
M src/test/subscription/t/008_diff_schema.pl

Support parallel btree index builds.

commit   : 9da0cc35284bdbe8d442d732963303ff0e0a40bc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Feb 2018 13:25:55 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Feb 2018 13:25:55 -0500    

Click here for diff

To make this work, tuplesort.c and logtape.c must also support  
parallelism, so this patch adds that infrastructure and then applies  
it to the particular case of parallel btree index builds.  Testing  
to date shows that this can often be 2-3x faster than a serial  
index build.  
  
The model for deciding how many workers to use is fairly primitive  
at present, but it's better than not having the feature.  We can  
refine it as we get more experience.  
  
Peter Geoghegan with some help from Rushabh Lathia.  While Heikki  
Linnakangas is not an author of this patch, he wrote other patches  
without which this feature would not have been possible, and  
therefore the release notes should possibly credit him as an author  
of this feature.  Reviewed by Claudio Freire, Heikki Linnakangas,  
Thomas Munro, Tels, Amit Kapila, me.  
  
Discussion: http://postgr.es/m/CAM3SWZQKM=Pzc=CAHzRixKjp2eO5Q0Jg1SoFQqeXFQ647JiwqQ@mail.gmail.com  
Discussion: http://postgr.es/m/CAH2-Wz=AxWqDoVvGU7dq856S4r6sJAj6DBn7VMtigkB33N5eyg@mail.gmail.com  

M contrib/bloom/blinsert.c
M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/transam/parallel.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeSort.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/probes.d
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/nbtree.h
M src/include/access/parallel.h
M src/include/access/relscan.h
M src/include/catalog/index.h
M src/include/miscadmin.h
M src/include/nodes/execnodes.h
M src/include/optimizer/paths.h
M src/include/optimizer/planner.h
M src/include/pgstat.h
M src/include/storage/buffile.h
M src/include/storage/fd.h
M src/include/utils/logtape.h
M src/include/utils/tuplesort.h
M src/tools/pgindent/typedefs.list

Refactor code for partition bound searching

commit   : 9aef173163ae68c6b241e4c9bbb375c6baa71c60    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Feb 2018 09:23:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Feb 2018 09:23:42 -0500    

Click here for diff

Remove partition_bound_cmp() and partition_bound_bsearch(), whose  
void * argument could be, depending on the situation, of any of  
three different types: PartitionBoundSpec *, PartitionRangeBound *,  
Datum *.  
  
Instead, introduce separate bound-searching functions for each  
situation: partition_list_bsearch, partition_range_bsearch,  
partition_range_datum_bsearch, and partition_hash_bsearch.  This  
requires duplicating the code for binary search, but it makes the  
code much more type safe, involves fewer branches at runtime, and  
at least in my opinion, is much easier to understand.  
  
Along the way, add an option to partition_range_datum_bsearch  
allowing the number of keys to be specified, so that we can search  
for partitions based on a prefix of the full list of partition  
keys.  This is important for pending work to improve partition  
pruning.  
  
Amit Langote, per a suggestion from me.  
  
Discussion: http://postgr.es/m/CA+TgmoaVLDLc8=YESRwD32gPhodU_ELmXyKs77gveiYp+JE4vQ@mail.gmail.com  

M src/backend/catalog/partition.c

Add new function WaitForParallelWorkersToAttach.

commit   : 9222c0d9ed9794d54fc3f5101498829eaec9e799    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Feb 2018 09:00:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Feb 2018 09:00:59 -0500    

Click here for diff

Once this function has been called, we know that all workers have  
started and attached to their error queues -- so if any of them  
subsequently exit uncleanly, we'll be sure to throw an ERROR promptly.  
Otherwise, users of the ParallelContext machinery must be careful not  
to wait forever for a worker that has failed to start.  Parallel query  
manages to work without needing this for reasons explained in new  
comments added by this patch, but it's a useful primitive for other  
parallel operations, such as the pending patch to make creating a  
btree index run in parallel.  
  
Amit Kapila, revised by me.  Additional review by Peter Geoghegan.  
  
Discussion: http://postgr.es/m/CAA4eK1+e2MzyouF5bg=OtyhDSX+=Ao=3htN=T-r_6s3gCtKFiw@mail.gmail.com  

M src/backend/access/transam/parallel.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/include/access/parallel.h

Improve ALTER TABLE synopsis

commit   : a2a22057617dc84b500f85938947c125183f1289    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 2 Feb 2018 05:30:04 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 2 Feb 2018 05:30:04 -0500    

Click here for diff

Add into the ALTER TABLE synopsis the definition of  
partition_bound_spec, column_constraint, index_parameters and  
exclude_element.  
  
Initial patch by LƦtitia Avrot, with further improvements by Amit  
Langote and Thomas Munro.  
  
Discussion: https://postgr.es/m/flat/27ec4df3-d1ab-3411-f87f-647f944897e1%40lab.ntt.co.jp  

M doc/src/sgml/ref/alter_table.sgml

Fix possible failure to mark hash metapage dirty.

commit   : ad25a6b1f25baf09c869c903c9c8e26d390875f5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 1 Feb 2018 15:21:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 1 Feb 2018 15:21:13 -0500    

Click here for diff

Report and suggested fix by Lixian Zou.  Amit Kapila put it  
in the form of a patch and reviewed.  
  
Discussion: http://postgr.es/m/[email protected]  

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

psql: Add quit/help behavior/hint, for other tool portability

commit   : df9f599bc6f14307252ac75ea1dc997310da5ba6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 1 Feb 2018 08:30:43 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 1 Feb 2018 08:30:43 -0500    

Click here for diff

Issuing 'quit'/'exit' in an empty psql buffer exits psql.  Issuing  
'quit'/'exit' in a non-empty psql buffer alone on a line with no prefix  
whitespace issues a hint on how to exit.  
  
Also add similar 'help' hints for 'help' in a non-empty psql buffer.  
  
Reported-by: Everaldo Canuto  
  
Discussion: https://postgr.es/m/flat/CALVFHFb-C_5_94hueWg6Dd0zu7TfbpT7hzsh9Zf0DEDOSaAnfA%40mail.gmail.com  
  
Author: original author Robert Haas, modified by me  

M src/bin/psql/mainloop.c

doc: fix trigger inheritance wording

commit   : eab30cc6b55dc03589bda13bc76b12d7142d5686    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 17:52:47 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 17:52:47 -0500    

Click here for diff

Fix wording from commit 1cf1112990cff432b53a74a0ac9ca897ce8a7688  
  
Reported-by: Robert Haas  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_trigger.sgml

doc: clarify major/minor pg_upgrade versions with examples

commit   : 59ad2463507622a1244740c4b527610f590dc473    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 17:09:59 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 17:09:59 -0500    

Click here for diff

The previous docs added in PG 10 were not clear enough for someone who  
didn't understand the PG 10 version change, so give more specific  
examples.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

doc: clearify trigger behavior for inheritance

commit   : 1cf1112990cff432b53a74a0ac9ca897ce8a7688    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 17:00:17 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 17:00:17 -0500    

Click here for diff

The previous wording added in PG 10 wasn't specific enough about the  
behavior of statement and row triggers when using inheritance.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_trigger.sgml

commit   : 3b15255912af3fa428fbc296d830292ffc8c9803    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 16:54:33 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 16:54:33 -0500    

Click here for diff

Also remove outdated comment about SPI subtransactions.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/contrib-spi.sgml
M doc/src/sgml/spi.sgml

Fix typo: colums -> columns.

commit   : 22757960bb3b2a6fa331bad132998c53b3e744a9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 16:45:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 16:45:37 -0500    

Click here for diff

Along the way, also fix code indentation.  
  
Alexander Lakhin, reviewed by Michael Paquier  
  
Discussion: http://postgr.es/m/[email protected]  

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

doc: Improve pg_upgrade rsync examples to use clusterdir

commit   : de715414608846ce1ae44b79a39d61c48e25dce7    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 16:43:32 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 16:43:32 -0500    

Click here for diff

Commit 9521ce4a7a1125385fb4de9689f345db594c516a from Sep 13, 2017 and  
backpatched through 9.5 used rsync examples with datadir.  The reporter  
has pointed out, and testing has verified, that clusterdir must be used,  
so update the docs accordingly.  
  
Reported-by: Don Seiler  
  
Discussion: https://postgr.es/m/CAHJZqBD0u9dCERpYzK6BkRv=663AmH==DFJpVC=M4Xg_rq2=CQ@mail.gmail.com  
  
Backpatch-through: 9.5  

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

pgcrypto's encrypt() supports AES-128, AES-192, and AES-256

commit   : d40d97d6c74496a35111b29f8eef2a09cb43bc58    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 16:28:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 16:28:11 -0500    

Click here for diff

Previously, only 128 was mentioned, but the others are also supported.  
  
Thomas Munro, reviewed by Michael Paquier and extended a bit by me.  
  
Discussion: http://postgr.es/m/CAEepm=1XbBHXYJKofGjnM2Qfz-ZBVqhGU4AqvtgR+Hegy4fdKg@mail.gmail.com  

M contrib/pgcrypto/expected/rijndael.out
M contrib/pgcrypto/sql/rijndael.sql
M doc/src/sgml/pgcrypto.sgml

doc: mention datadir locations are actually config locations

commit   : e5dede90971d2ddbb7bca72ffc329c043bf717db    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 16:25:21 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Jan 2018 16:25:21 -0500    

Click here for diff

Technically, pg_upgrade's --old-datadir and --new-datadir are  
configuration directories, not necessarily data directories.  This is  
reflected in the 'postgres' manual page, so do the same for pg_upgrade.  
  
Reported-by: Yves Goergen  
  
Bug: 14898  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

Fix list partition constraints for partition keys of array type.

commit   : 3ccdc6f9a5876d0953912fd589989387764ed9a3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 15:43:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 15:43:11 -0500    

Click here for diff

The old code generated always generated a constraint of the form  
col = ANY(ARRAY[val1, val2, ...]), but that's invalid when col is an  
array type.  Instead, generate col = val when there's only one value,  
col = val1 OR col = val2 OR ... when there are multiple values and  
col is of array type, and the old form when there are multiple values  
and col is not of an array type.  
  
As a side benefit, this makes constraint exclusion able to prune  
a list partition declared to accept a single Boolean value, which  
didn't work before.  
  
Amit Langote, reviewed by Etsuro Fujita  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/create_table.sql

pg_prewarm: Add missing LWLockRegisterTranche call.

commit   : 0ff5bd7b47377a6b5939d6fbbb67c8d42f9170dc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 15:12:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2018 15:12:33 -0500    

Click here for diff

Commit 79ccd7cbd5ca44bee0191d12e9e65abf702899e7, which added automatic  
prewarming, neglected this.  
  
Kyotaro Horiguchi, reviewed by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/pg_prewarm/autoprewarm.c

Refactor client-side SSL certificate checking code

commit   : f75a95915528646cbfaf238fb48b3ffa17969383    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jan 2018 13:47:52 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jan 2018 13:47:52 -0500    

Click here for diff

Separate the parts specific to the SSL library from the general logic.  
  
The previous code structure was  
  
open_client_SSL()  
calls verify_peer_name_matches_certificate()  
calls verify_peer_name_matches_certificate_name()  
calls wildcard_certificate_match()  
  
and was completely in fe-secure-openssl.c.  The new structure is  
  
open_client_SSL() [openssl]  
calls pq_verify_peer_name_matches_certificate() [generic]  
calls pgtls_verify_peer_name_matches_certificate_guts() [openssl]  
calls openssl_verify_peer_name_matches_certificate_name() [openssl]  
calls pq_verify_peer_name_matches_certificate_name() [generic]  
calls wildcard_certificate_match() [generic]  
  
Move the generic functions into a new file fe-secure-common.c, so the  
calls generally go fe-connect.c -> fe-secure.c -> fe-secure-${impl}.c ->  
fe-secure-common.c, although there is a bit of back-and-forth between  
the last two.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/interfaces/libpq/Makefile
A src/interfaces/libpq/fe-secure-common.c
A src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/nls.mk
M src/tools/msvc/Mkvcbuild.pm

Fix up references to scram-sha-256

commit   : 38d485fdaa5739627b642303cc172acc1487b90a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jan 2018 16:50:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jan 2018 16:50:30 -0500    

Click here for diff

pg_hba_file_rules erroneously reported this as scram-sha256.  Fix that.  
  
To avoid future errors and confusion, also adjust documentation links  
and internal symbols to have a separator between "sha" and "256".  
  
Reported-by: Christophe Courtois <[email protected]>  
Author: Michael Paquier <[email protected]>  

M doc/src/sgml/protocol.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/common/scram-common.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c

Fix test case for 'outer pathkeys do not match mergeclauses' fix.

commit   : 99f6a17dd62aa5ed92df7e5c03077ddfc85381c8    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 30 Jan 2018 14:27:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 30 Jan 2018 14:27:38 -0500    

Click here for diff

Commit 4bbf6edfbd5d03743ff82dda2f00c738fb3208f5 added a test case,  
but it turns out that the test case doesn't reliably test for the  
bug, and in the context of the regression test suite did not because  
ANALYZE had not been run.  
  
Report and patch by Etsuro Fujita.  I added a comment along lines  
previously suggested by Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Add some noreturn attributes to help static analyzers

commit   : a044378ce2f6268a996c8cce2b7bfb5d82b05c90    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 20:44:35 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 20:44:35 -0500    

Click here for diff

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

Silence complaint about dead assignment

commit   : 07e524d3e955a79b94918d076642b3ac8e84b65f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 20:42:15 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 20:42:15 -0500    

Click here for diff

The preferred place for "placate compiler" assignments is after  
elog(ERROR), not before it.  Otherwise, scan-build complains about a  
dead assignment.  

M src/backend/commands/tablecmds.c

Remove dead assignment

commit   : 6ad3611e1ea6fef6ac0c746d1565b3f6a856b593    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 20:41:36 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 20:41:36 -0500    

Click here for diff

per scan-build  

M contrib/spi/refint.c

Introduce ExecQualAndReset() helper.

commit   : c12693d8f3bbbffcb79f6af476cc647402e1145e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Jan 2018 12:16:53 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Jan 2018 12:16:53 -0800    

Click here for diff

It's a common task to evaluate a qual and reset the corresponding  
expression context. Currently that requires storing the result of the  
qual eval, resetting the context, and then reacting on the result. As  
that's awkward several places only reset the context next time through  
a node. That's not great, so introduce a helper that evaluates and  
resets.  
  
It's a bit ugly that it currently uses MemoryContextReset() instead of  
ResetExprContext(), but that seems easier than reordering all of  
executor.h.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/include/executor/executor.h

Save a few bytes by removing useless last argument to SearchCatCacheList.

commit   : 97d4445a033f1cc02784d42561b52b3441c8eddd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2018 15:13:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2018 15:13:07 -0500    

Click here for diff

There's never any value in giving a fully specified cache key to  
SearchCatCacheList: you might as well call SearchCatCache instead,  
since there could be only one match.  So the maximum useful number of  
key arguments is one less than the supported number of key columns.  
We might as well remove the useless extra argument and save some few  
bytes per call site, as well as a cycle or so per call.  
  
I believe the reason it was coded like this is that originally, callers  
had to write out all the dummy arguments in each call, and so it seemed  
less confusing if SearchCatCache and SearchCatCacheList took the same  
number of key arguments.  But since commit e26c539e9, callers only write  
their live arguments explicitly, making that a non-factor; and there's  
surely been enough time for third-party modules to adapt to that coding  
style.  So this is only an ABI break not an API break for callers.  
  
Per discussion with Oliver Ford, this might also make it less confusing  
how to use SearchCatCacheList correctly.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/syscache.c
M src/include/utils/catcache.h
M src/include/utils/syscache.h

Initialize unused ExprEvalStep fields.

commit   : fc96c6942551dafa6cb2a6000cbc9b20643e5db3    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 23 Jan 2018 23:20:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 23 Jan 2018 23:20:02 -0800    

Click here for diff

ExecPushExprSlots didn't initialize ExprEvalStep's resvalue/resnull  
steps as it didn't use them. That caused wrong valgrind warnings for  
an upcoming patch, so zero-intialize.  
  
Also zero-initialize all scratch ExprEvalStep's allocated on the  
stack, to avoid issues with similar future omissions of non-critial  
data.  

M src/backend/executor/execExpr.c

doc: Clarify pg_upgrade documentation

commit   : 1e1e599d6663c4a65388b40f84b2ea6b7c6e381b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 14:26:17 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2018 14:26:17 -0500    

Click here for diff

Clarify that the restriction against reg* types only applies to table  
columns using these types, not to the type appearing in any other way,  
for example as a function argument.  

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

Prevent growth of simplehash tables when they're "too empty".

commit   : ab9f2c429d8fbd3580cd2ae5f2054ba6956b1f60    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Jan 2018 11:02:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Jan 2018 11:02:09 -0800    

Click here for diff

In cases where simplehash tables where filled with either a lot of  
conflicting hash-values, or values that hash to consecutive  
values (i.e. build "chains") the growth heuristics in  
d4c62a6b623d6eef88218158e9fa3cf974c6c7e5 could trigger rather  
explosively.  
  
To fix that, address some of the reasons (see previous commit) of why  
the growth heuristics where needed, and only allow growth when the  
table isn't too empty. While that means there's a few cases of bad  
input that can be slower, that seems a lot better than running very  
quickly out of memory.  
  
Author: Tomas Vondra and Andres Freund, with additional input by  
    Thomas Munro, Tom Lane Todd A. Cook  
Reported-By: Todd A. Cook, Tomas Vondra, Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10, where simplehash was introduced  

M src/include/lib/simplehash.h

Improve bit perturbation in TupleHashTableHash.

commit   : c068f87723ca9cded1f2aceb956ede49de651690    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Jan 2018 11:02:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Jan 2018 11:02:09 -0800    

Click here for diff

The changes in b81b5a96f424531b97cdd1dba97d9d1b9c9d372e did not fully  
address the issue, because the bit-mixing of the IV into the final  
hash-key didn't prevent clustering in the input-data survive in the  
output data.  
  
This didn't cause a lot of problems because of the additional growth  
conditions added d4c62a6b623d6eef88218158e9fa3cf974c6c7e5. But as we  
want to rein those in due to explosive growth in some edges, this  
needs to be fixed.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10, where simplehash was introduced  

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

Avoid misleading psql password prompt when username is multiply specified.

commit   : 15be27460191a9ffb149cc98f6fbf97c369a6b1e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2018 12:57:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2018 12:57:09 -0500    

Click here for diff

When a password is needed, cases such as  
	psql -d "postgresql://alice@localhost/testdb" -U bob  
would incorrectly prompt for "Password for user bob: ", when actually the  
connection will be attempted with username alice.  The priority order of  
which name to use isn't that important here, but the misleading prompt is.  
  
When we are prompting for a password after initial connection failure,  
we can fix this reliably by looking at PQuser(conn) to see how libpq  
interpreted the connection arguments.  But when we're doing a forced  
password prompt because of a -W switch, we can't use that solution.  
Fortunately, because the main use of -W is for noninteractive situations,  
it's less critical to produce a helpful prompt in such cases.  I made  
the startup prompt for -W just say "Password: " all the time, rather  
than expending extra code on trying to identify which username to use.  
In the case of a \c command (after -W has been given), there's already  
logic in do_connect that determines whether the "dbname" is a connstring  
or URI, so we can avoid lobotomizing the prompt except in cases that  
are actually dubious.  (We could do similarly in startup.c if anyone  
complains, but for now it seems not worthwhile, especially since that  
would still be only a partial solution.)  
  
Per bug #15025 from Akos Vandra.  Although this is arguably a bug fix,  
it doesn't seem worth back-patching.  The case where it matters seems  
like a very corner-case usage, and someone might complain that we'd  
changed the behavior of -W in a minor release.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add stack-overflow guards in set-operation planning.

commit   : 35a528062cc8ccdb51bde6c672991ae64e970847    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Jan 2018 13:39:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Jan 2018 13:39:07 -0500    

Click here for diff

create_plan_recurse lacked any stack depth check.  This is not per  
our normal coding rules, but I'd supposed it was safe because earlier  
planner processing is more complex and presumably should eat more  
stack.  But bug #15033 from Andrew Grossman shows this isn't true,  
at least not for queries having the form of a many-thousand-way  
INTERSECT stack.  
  
Further testing showed that recurse_set_operations is also capable  
of being crashed in this way, since it likewise will recurse to the  
bottom of a parsetree before calling any support functions that  
might themselves contain any stack checks.  However, its stack  
consumption is only perhaps a third of create_plan_recurse's.  
  
It's possible that this particular problem with create_plan_recurse can  
only manifest in 9.6 and later, since before that we didn't build a Path  
tree for set operations.  But having seen this example, I now have no  
faith in the proposition that create_plan_recurse doesn't need a stack  
check, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

C includes: Reorder C includes in partition.c

commit   : 010123e144a5a5d395a15067f301a2c2443f49cf    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 27 Jan 2018 23:05:52 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 27 Jan 2018 23:05:52 -0500    

Click here for diff

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

M src/backend/catalog/partition.c

Update time zone data files to tzdata release 2018c.

commit   : 41fc04ff913de6e0ffdbffff25298b39cd4ba42d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jan 2018 16:42:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jan 2018 16:42:28 -0500    

Click here for diff

DST law changes in Brazil, Sao Tome and Principe.  Historical corrections  
for Bolivia, Japan, and South Sudan.  The "US/Pacific-New" zone has been  
removed (it was only a link to America/Los_Angeles anyway).  

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

Avoid crash during EvalPlanQual recheck of an inner indexscan.

commit   : 2e668c522e58854ae19b7fdc5ac23f9b8a1275f5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jan 2018 13:52:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jan 2018 13:52:24 -0500    

Click here for diff

Commit 09529a70b changed nodeIndexscan.c and nodeIndexonlyscan.c to  
postpone initialization of the indexscan proper until the first tuple  
fetch.  It overlooked the question of mark/restore behavior, which means  
that if some caller attempts to mark the scan before the first tuple fetch,  
you get a null pointer dereference.  
  
The only existing user of mark/restore is nodeMergejoin.c, which (somewhat  
accidentally) will never attempt to set a mark before the first inner tuple  
unless the inner child node is a Material node.  Hence the case can't arise  
normally, so it seems sufficient to document the assumption at both ends.  
However, during an EvalPlanQual recheck, ExecScanFetch doesn't call  
IndexNext but just returns the jammed-in test tuple.  Therefore, if we're  
doing a recheck in a plan tree with a mergejoin with inner indexscan,  
it's possible to reach ExecIndexMarkPos with iss_ScanDesc still null,  
as reported by Guo Xiang Tan in bug #15032.  
  
Really, when there's a test tuple supplied during an EPQ recheck, touching  
the index at all is the wrong thing: rather, the behavior of mark/restore  
ought to amount to saving and restoring the es_epqScanDone flag.  We can  
avoid finding a place to actually save the flag, for the moment, because  
given the assumption that no caller will set a mark before fetching a  
tuple, es_epqScanDone must always be set by the time we try to mark.  
So the actual behavior change required is just to not reach the index  
access if a test tuple is supplied.  
  
The set of plan node types that need to consider this issue are those  
that support EPQ test tuples (i.e., call ExecScan()) and also support  
mark/restore; which is to say, IndexScan, IndexOnlyScan, and perhaps  
CustomScan.  It's tempting to try to fix the problem in one place by  
teaching ExecMarkPos() itself about EPQ; but ExecMarkPos supports some  
plan types that aren't Scans, and also it seems risky to make assumptions  
about what a CustomScan wants to do here.  Also, the most likely future  
change here is to decide that we do need to support marks placed before  
the first tuple, which would require additional work in IndexScan and  
IndexOnlyScan in any case.  Hence, fix the EPQ issue in nodeIndexscan.c  
and nodeIndexonlyscan.c, accepting the small amount of code duplicated  
thereby, and leave it to CustomScan providers to fix this bug if they  
have it.  
  
Back-patch to v10 where commit 09529a70b came in.  In earlier branches,  
the index_markpos() call is a waste of cycles when EPQ is active, but  
no more than that, so it doesn't seem appropriate to back-patch further.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add missing semicolons in documentation examples

commit   : ba8c2dfffd8e018fa0fae554fee69a7b7e93472e    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 27 Jan 2018 13:13:52 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 27 Jan 2018 13:13:52 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/ddl.sgml

Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers.

commit   : fb8697b31aaeebe6170c572739867dcaa01053c6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2018 18:25:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2018 18:25:02 -0500    

Click here for diff

We have a lot of code in which option names, which from the user's  
viewpoint are logically keywords, are passed through the grammar as plain  
identifiers, and then matched to string literals during command execution.  
This approach avoids making words into lexer keywords unnecessarily.  Some  
places matched these strings using plain strcmp, some using pg_strcasecmp.  
But the latter should be unnecessary since identifiers would have been  
downcased on their way through the parser.  Aside from any efficiency  
concerns (probably not a big factor), the lack of consistency in this area  
creates a hazard of subtle bugs due to different places coming to different  
conclusions about whether two option names are the same or different.  
Hence, standardize on using strcmp() to match any option names that are  
expected to have been fed through the parser.  
  
This does create a user-visible behavioral change, which is that while  
formerly all of these would work:  
	alter table foo set (fillfactor = 50);  
	alter table foo set (FillFactor = 50);  
	alter table foo set ("fillfactor" = 50);  
	alter table foo set ("FillFactor" = 50);  
now the last case will fail because that double-quoted identifier is  
different from the others.  However, none of our documentation says that  
you can use a quoted identifier in such contexts at all, and we should  
discourage doing so since it would break if we ever decide to parse such  
constructs as true lexer keywords rather than poor man's substitutes.  
So this shouldn't create a significant compatibility issue for users.  
  
Daniel Gustafsson, reviewed by Michael Paquier, small changes by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/unaccent/unaccent.c
M doc/src/sgml/textsearch.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/collationcmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/view.c
M src/backend/parser/parse_clause.c
M src/backend/snowball/dict_snowball.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/include/access/reloptions.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/alter_operator.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/create_aggregate.out
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_type.out
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/alter_operator.sql
M src/test/regress/sql/collate.sql
M src/test/regress/sql/create_aggregate.sql
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/create_type.sql
M src/test/regress/sql/tsdicts.sql

Factor some code out of create_grouping_paths.

commit   : 9fd8b7d632570af90a0b374816f604f59bba11ad    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2018 15:03:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2018 15:03:12 -0500    

Click here for diff

This is preparatory refactoring to prepare the way for partition-wise  
aggregate, which will reuse the new subroutines for child grouping  
rels.  It also does not seem like a bad idea on general principle,  
as the function was getting pretty long.  
  
Jeevan Chalke.  The larger patch series of which this patch is a part  
was reviewed and tested by Antonin Houska, Rajkumar Raghuwanshi,  
Ashutosh Bapat, David Rowley, Dilip Kumar, Konstantin Knizhnik,  
Pascal Legrand, and me.  Some cosmetic changes by me.  
  
Discussion: http://postgr.es/m/CAM2+6=V64_xhstVHie0Rz=KPEQnLJMZt_e314P0jaT_oJ9MR8A@mail.gmail.com  

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

Remove the obsolete WITH clause of CREATE FUNCTION.

commit   : 4971d2a32209118ebbdc6611341b89901e340902    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2018 12:25:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2018 12:25:44 -0500    

Click here for diff

This clause was superseded by SQL-standard syntax back in 7.3.  
We've kept it around for backwards-compatibility purposes ever since;  
but 15 years seems like long enough for that, especially seeing that  
there are undocumented weirdnesses in how it interacts with the  
SQL-standard syntax for specifying the same options.  
  
Michael Paquier, per an observation by Daniel Gustafsson;  
some small cosmetic adjustments to nearby code by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_function.sgml
M src/backend/commands/functioncmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

pageinspect: Fix use of wrong memory context by hash_page_items.

commit   : b0313f9cc8f54d6a5c12f8987c9b6afa0a5bbced    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2018 09:51:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2018 09:51:15 -0500    

Click here for diff

This can cause it to produce incorrect output.  
  
Report and patch by Masahiko Sawada.  
  
Discussion: http://postgr.es/m/CAD21AoBc5Asx7pXdUWu6NqU_g=Ysn95EGL9SMeYhLLduYoO_OA@mail.gmail.com  

M contrib/pageinspect/hashfuncs.c

Use abstracted SSL API in server connection log messages

commit   : c1869542b3a4da4b12cace2253ef177da761c00d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2018 08:58:00 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2018 08:58:00 -0500    

Click here for diff

The existing "connection authorized" server log messages used OpenSSL  
API calls directly, even though similar abstracted API calls exist.  
Change to use the latter instead.  
  
Change the function prototype for the functions that return the TLS  
version and the cipher to return const char * directly instead of  
copying into a buffer.  That makes them slightly easier to use.  
  
Add bits= to the message.  psql shows that, so we might as well show the  
same information on the client and server.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/libpq/be-secure-openssl.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/init/postinit.c
M src/include/libpq/libpq-be.h

Remove byte-masking macros for Datum conversion macros

commit   : a6ef00b5c3c4a287e03b634d328529b69cc1e770    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 11:19:12 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 11:19:12 -0500    

Click here for diff

As the comment there stated, these were needed for old-style  
user-defined functions, but since we removed support for those, we don't  
need this anymore.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/include/postgres.h

Fix C comment typo

commit   : 6588a43bcacca872fafba10363d346b806964d90    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 25 Jan 2018 20:13:25 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 25 Jan 2018 20:13:25 -0500    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoBgnHy2YKAUuB6iVG4ibvLYepHr+RDRkr1arqWwc1AHCw@mail.gmail.com  
  
Author: Masahiko Sawada  

M contrib/pg_prewarm/autoprewarm.c

Support --no-comments in pg_dump, pg_dumpall, pg_restore.

commit   : 1368e92e16a098338e39c8e540bdf9f6cf35ebf4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 15:27:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 15:27:24 -0500    

Click here for diff

We have switches already to suppress other subsidiary object properties,  
such as ACLs, security labels, ownership, and tablespaces, so just on  
the grounds of symmetry we should allow suppressing comments as well.  
Also, commit 0d4e6ed30 added a positive reason to have this feature,  
i.e. to allow obtaining the old behavior of selective pg_restore should  
anyone desire that.  
  
Recent commits have removed the cases where pg_dump emitted comments on  
built-in objects that the restoring user might not have privileges to  
comment on, so the original primary motivation for this feature is gone,  
but it still seems at least somewhat useful in its own right.  
  
Robins Tharakan, reviewed by FabrĆ­zio Mello  
  
Discussion: https://postgr.es/m/CAEP4nAx22Z4ch74oJGzr5RyyjcyUSbpiFLyeYXX8pehfou92ug@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c

Add missing "static" markers.

commit   : bb415675d8ab6e776321a96f9c0e77c12fda96ea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 14:32:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 14:32:28 -0500    

Click here for diff

Per buildfarm.  

M src/backend/executor/nodeModifyTable.c
M src/bin/pg_dump/pg_dump.c

Clean up some aspects of pg_dump/pg_restore item-selection logic.

commit   : 0d4e6ed3085828edb68f516067d45761c0a89ac5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 14:26:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 14:26:07 -0500    

Click here for diff

Ensure that CREATE DATABASE and related commands are issued when, and  
only when, --create is specified.  Previously there were scenarios  
where using selective-dump switches would prevent --create from having  
any effect.  For example, it would fail to do anything in pg_restore  
if the archive file had been made by a selective dump, because there  
would be no TOC entry for the database.  
  
Since we don't issue \connect either if we don't issue CREATE DATABASE,  
this could result in unexpectedly restoring objects into the wrong  
database.  
  
Also fix pg_restore's selective restore logic so that when an object is  
selected to be restored, we also restore its ACL, comment, and security  
label if any.  Previously there was no way to get the latter properties  
except through tedious mucking about with a -L file.  If, for some  
reason, you don't want these properties, you can match the old behavior  
by adding --no-acl etc.  
  
While at it, try to make _tocEntryRequired() a little better organized  
and better documented.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Ignore partitioned indexes where appropriate

commit   : 05fb5d661925f00106373f1a594be5aca24d9a94    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2018 16:11:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2018 16:11:51 -0300    

Click here for diff

get_relation_info() was too optimistic about opening indexes in  
partitioned tables, which would raise errors when any queries were  
planned on such tables.  Fix by ignoring any indexes of the partitioned  
kind.  
  
CLUSTER (and ALTER TABLE CLUSTER ON) had a similar problem.  Fix by  
disallowing these commands in partitioned tables.  
  
Fallout from 8b08f7d4820f.  

M src/backend/commands/cluster.c
M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/cluster.out
M src/test/regress/expected/indexing.out
M src/test/regress/sql/cluster.sql
M src/test/regress/sql/indexing.sql

Improve pg_dump's handling of "special" built-in objects.

commit   : 5955d934194c3888f30318209ade71b53d29777f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 13:54:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2018 13:54:42 -0500    

Click here for diff

We had some pretty ad-hoc handling of the public schema and the plpgsql  
extension, which are both presumed to exist in template0 but might be  
modified or deleted in the database being dumped.  
  
Up to now, by default pg_dump would emit a CREATE EXTENSION IF NOT EXISTS  
command as well as a COMMENT command for plpgsql.  The usefulness of the  
former is questionable, and the latter caused annoying errors in  
non-superuser dump/restore scenarios.  Let's instead install a rule that  
built-in extensions (identified by having low-numbered OIDs) are not to be  
dumped.  We were doing it that way already in binary-upgrade mode, so this  
just makes regular mode behave the same.  It remains true that if someone  
has installed a non-default ACL on the plpgsql language, that will get  
dumped thanks to the pg_init_privs mechanism.  This is more consistent with  
the handling of built-in objects of other kinds.  
  
Also, change the very ad-hoc mechanism that was used to avoid dumping  
creation and comment commands for the public schema.  Instead of hardwiring  
a test in _printTocEntry(), make use of the DUMP_COMPONENT_ infrastructure  
to mark that schema up-front about what we want to do with it.  This has  
the visible effect that the public schema won't be mentioned in the output  
at all, except for updating its ACL if it has a non-default ACL.  
Previously, while it was normally not mentioned, --clean mode would drop  
and recreate it, again causing headaches for non-superuser usage.  This  
change likewise makes the public schema less special and more like other  
built-in objects.  
  
If plpgsql, or the public schema, has been removed entirely in the source  
DB, that situation won't be reproduced in the destination ... but that  
was true before.  
  
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

Update documentation to mention huge pages on other OSes

commit   : 2a5ecb56d22340a00393fa60e7b910c472071875    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2018 11:14:24 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2018 11:14:24 -0500    

Click here for diff

Previously, the docs implied that only Linux and Windows could use huge  
pages.  That's not quite true: it's just that we only know how to  
request them explicitly on those OSes.  Be more explicit about what  
huge_pages really does and mention that some OSes may use huge pages  
automatically.  
  
Author: Thomas Munro and Catalin Iacob  
Reviewed-By: Justin Pryzby, Peter Eisentraut  
Discussion: https://postgr.es/m/CAEepm=3qzR-hfjepymohuC4XO5phxoSoipOjm6BEhnJHjNR+jg@mail.gmail.com  

M doc/src/sgml/config.sgml

Remove use of byte-masking macros in record_image_cmp

commit   : 0b5e33f667a2042d7022da8bef31a8be5937aad1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 10:55:40 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 10:55:40 -0500    

Click here for diff

These were introduced in 4cbb646334b3b998a29abef0d57608d42097e6c9, but  
after further analysis and testing, they should not be necessary and  
probably weren't the part of that commit that fixed anything.  
  
Reviewed-by: Michael Paquier <[email protected]>  

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

Allow spaces in connection strings in SSL tests

commit   : 4a3fdbdf766d80b21271e32da865801ab005d786    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2018 09:14:24 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2018 09:14:24 -0500    

Click here for diff

Connection strings can have items with spaces in them, wrapped in  
quotes.  The tests however ran a SELECT '$connstr' upon connection which  
broke on the embedded quotes.  Use dollar quotes on the connstr to  
protect against this.  This was hit during the development of the macOS  
Secure Transport patch, but is independent of it.  
  
Author: Daniel Gustafsson <[email protected]>  

M src/test/ssl/ServerSetup.pm

Avoid referencing off the end of subplan_partition_offsets.

commit   : 945f71db845262e7491b5fe4403b01147027576b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 24 Jan 2018 16:34:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 24 Jan 2018 16:34:51 -0500    

Click here for diff

Report by buildfarm member skink and Tom Lane.  Analysis by me.  
Patch by Amit Khandekar.  
  
Discussion: http://postgr.es/m/CAJ3gD9fVA1iXQYhfqHP5n_TEd4U9=V8TL_cc-oKRnRmxgdvJrQ@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/execPartition.h

doc: properly indent CREATE TRIGGER paragraph

commit   : d6ab7203607a3f43fe41d384f46c15bdac68d745    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 24 Jan 2018 15:13:04 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 24 Jan 2018 15:13:04 -0500    

Click here for diff

This was done to match the surrounding indentation.  Text added in PG  
10.  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_trigger.sgml

Add tests for record_image_eq and record_image_cmp

commit   : a61116da8b99c4ff4b8c5757697abda7ac36b022    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 10:13:45 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 10:13:45 -0500    

Click here for diff

record_image_eq was covered a bit by the materialized view code that it  
is meant to support, but record_image_cmp was not tested at all.  
  
While we're here, add more tests to record_eq and record_cmp as well,  
for symmetry.  
  
Reviewed-by: Michael Paquier <[email protected]>  

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

doc: clarify use of RegisterDynamicBackgroundWorker

commit   : 5b2a8cf96f6fa4f2c98c9a4c32a5a387b4f69d6c    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 24 Jan 2018 13:20:37 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 24 Jan 2018 13:20:37 -0500    

Click here for diff

Document likely use of RegisterDynamicBackgroundWorker by another  
background worker.  
  
Reported-by: Chapman Flack  
  
Discussion: https://postgr.es/m/CAB7nPqTdi=J9HH8PPPiEOohebdd+xkgbbhdY7=VbGnZ3CkZXxA@mail.gmail.com  
  
Author: Chapman Flack  

M doc/src/sgml/bgworker.sgml

Improve implementation of pg_attribute_always_inline.

commit   : 434e6e1484418c55561914600de9e180fc408378    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 23:07:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 23:07:13 -0500    

Click here for diff

Avoid compiler warnings on MSVC (which doesn't want to see both  
__forceinline and inline) and ancient GCC (which doesn't have  
__attribute__((always_inline))).  
  
Don't force inline-ing when building at -O0, as the programmer is probably  
hoping for exact source-to-object-line correspondence in that case.  
(For the moment this only works for GCC; maybe we can extend it later.)  
  
Make pg_attribute_always_inline be syntactically a drop-in replacement  
for inline, rather than an additional wart.  
  
And improve the comments.  
  
Thomas Munro and Michail Nikolaev, small tweaks by me  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CANtu0oiYp74brgntKOxgg1FK5+t8uQ05guSiFU6FYz_5KUhr6Q@mail.gmail.com  

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

doc: mention psql -l uses the 'postgres' database by default

commit   : e0a0deca389849383ff6337a488300eb22f31cef    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 23 Jan 2018 18:22:56 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 23 Jan 2018 18:22:56 -0500    

Click here for diff

Reported-by: Mark Wood  
  
Bug: 14912  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: David G. Johnston  
  
Backpatch-through: 10  

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

Teach reparameterize_path() to handle AppendPaths.

commit   : bb94ce4d26c3b011c01bf44ab200334fea52b600    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 16:50:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 16:50:34 -0500    

Click here for diff

If we're inside a lateral subquery, there may be no unparameterized paths  
for a particular child relation of an appendrel, in which case we *must*  
be able to create similarly-parameterized paths for each other child  
relation, else the planner will fail with "could not devise a query plan  
for the given query".  This means that there are situations where we'd  
better be able to reparameterize at least one path for each child.  
  
This calls into question the assumption in reparameterize_path() that  
it can just punt if it feels like it.  However, the only case that is  
known broken right now is where the child is itself an appendrel so that  
all its paths are AppendPaths.  (I think possibly I disregarded that in  
the original coding on the theory that nested appendrels would get folded  
together --- but that only happens *after* reparameterize_path(), so it's  
not excused from handling a child AppendPath.)  Given that this code's been  
like this since 9.3 when LATERAL was introduced, it seems likely we'd have  
heard of other cases by now if there were a larger problem.  
  
Per report from Elvis Pranskevichus.  Back-patch to 9.3.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove unnecessary include

commit   : 95be5ce1bce3fdcf3ca0638baa12508e5b67ec17    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Jan 2018 15:22:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Jan 2018 15:22:13 -0300    

Click here for diff

autovacuum.c no longer needs dsa.h, since commit 31ae1638ce3.  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoCWvYyXrvdANSHWWWEWJH5TeAWAkJ_2gqrHhukG+OBo1g@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Documentation fix: pg_ctl no longer makes connection attempts.

commit   : c9707d9413b171a6f017db1ea7832d797d3abc0d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 12:41:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 12:41:35 -0500    

Click here for diff

Overlooked in commit f13ea95f9.  Noted by Nick Barnes.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pgbench: Remove accidental garbage in test file

commit   : f9bbd46adbf350ba9e99a808f2c759e4aab9ea70    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 12:31:01 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2018 12:31:01 -0500    

Click here for diff

Author: Fabien COELHO <[email protected]>  

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

Update obsolete sentence in README.parallel.

commit   : 28e04155f17cabda7a18aee31d130aa10e25ee86    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Jan 2018 11:20:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Jan 2018 11:20:18 -0500    

Click here for diff

Since 9.6, heavyweight locking is not an abstract and unhandled  
concern of the parallel machinery, but rather something to which  
we have a specific approach.  

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

Report an ERROR if a parallel worker fails to start properly.

commit   : 2badb5afb89cd569500ef7c3b23c7a9d11718f2f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Jan 2018 11:03:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Jan 2018 11:03:03 -0500    

Click here for diff

Commit 28724fd90d2f85a0573a8107b48abad062a86d83 fixed things so that  
if a background worker fails to start due to fork() failure or because  
it is terminated before startup succeeds, BGWH_STOPPED will be  
reported.  However, that only helps if the code that uses the  
background worker machinery notices the change in status, and the code  
in parallel.c did not.  
  
To fix that, do two things.  First, make sure that when a worker  
exits, it triggers the leader to read from error queues.  That way, if  
a worker which has attached to an error queue exits uncleanly, the  
leader is sure to throw some error, either the contents of the  
ErrorResponse sent by the worker, or "lost connection to parallel  
worker" if it exited without sending one.  To cover the case where  
the worker never starts up in the first place or exits before  
attaching to the error queue, the ParallelContext now keeps track  
of which workers have sent at least one message via the error  
queue.  A worker which sends no messages by the time the parallel  
operation finishes will be checked to see whether it exited before  
attaching to the error queue; if so, a new error message, "parallel  
worker failed to initialize", will be reported.  If not, we'll  
continue to wait until it either starts up and exits cleanly, starts  
up and exits uncleanly, or fails to start, and then take the  
appropriate action.  
  
Patch by me, reviewed by Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoYnBgXgdTu6wk5YPdWhmgabYc9nY_pFLq=tB=FSLYkD8Q@mail.gmail.com  

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

In pg_dump, force reconnection after issuing ALTER DATABASE SET command(s).

commit   : 160a4f62ee7b8a96984f8bef19c90488aa6c8045    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 10:55:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Jan 2018 10:55:08 -0500    

Click here for diff

The folly of not doing this was exposed by the buildfarm: in some cases,  
the GUC settings applied through ALTER DATABASE SET may be essential to  
interpreting the reloaded data correctly.  Another argument why we can't  
really get away with the scheme proposed in commit b3f840120 is that it  
cannot work for parallel restore: even if the parent process manages to  
hang onto the previous GUC state, worker processes would see the state  
post-ALTER-DATABASE.  (Perhaps we could have dodged that bullet by  
delaying DATABASE PROPERTIES restoration to the end of the run, but  
that does nothing for the data semantics problem.)  
  
This leaves us with no solution for the default_transaction_read_only issue  
that commit 4bd371f6f intended to work around, other than "you gotta remove  
such settings before dumping/upgrading".  However, in view of the fact that  
parallel restore broke that hack years ago and no one has noticed, it's  
fair to question how many people care.  I'm unexcited about adding a large  
dollop of new complexity to handle that corner case.  
  
This would be a one-liner fix, except it turns out that ReconnectToServer  
tries to optimize away "redundant" reconnections.  While that may have been  
valuable when coded, a quick survey of current callers shows that there are  
no cases where that's actually useful, so just remove that check.  While at  
it, remove the function's useless return value.  
  
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
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dump.c

doc: simplify intermediate certificate mention in libpq docs

commit   : a541dbb6fa389bb0ffdd24a403bc6d276d77a074    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 23 Jan 2018 10:18:21 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 23 Jan 2018 10:18:21 -0500    

Click here for diff

Backpatch-through: 9.3  

M doc/src/sgml/libpq.sgml

Extract common bits from OpenSSL implementation

commit   : 1c2183403b958422c27782329ba19f9a3e0874ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 10:17:56 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 10:17:56 -0500    

Click here for diff

Some things in be-secure-openssl.c and fe-secure-openssl.c were not  
actually specific to OpenSSL but could also be used by other  
implementations.  In order to avoid copy-and-pasting, move some of that  
code to common files.  

M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/include/libpq/libpq.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c

Move SSL API comments to header files

commit   : f966101d19fcef6441e43da417467b3ed5ad3074    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 19:53:22 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 19:53:22 -0500    

Click here for diff

Move the documentation of the SSL API calls are supposed to do into the  
headers files, instead of keeping them in the files for the OpenSSL  
implementation.  That way, they don't have to be duplicated or be  
inconsistent when other implementations are added.  

M src/backend/libpq/be-secure-openssl.c
M src/include/libpq/libpq-be.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h

Move EDH support to common files

commit   : 573bd08b99e277026e87bb55ae69c489fab321b8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 12:18:42 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 12:18:42 -0500    

Click here for diff

The EDH support is not really specific to the OpenSSL implementation, so  
move the support and documentation comments to common files.  

M src/backend/libpq/README.SSL
M src/backend/libpq/be-secure-openssl.c
M src/include/libpq/libpq-be.h

Split out documentation of SSL parameters into their own section

commit   : 7404e77cc1192855afef28ae557993ba6f35c16e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 19:12:05 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 19:12:05 -0500    

Click here for diff

Split the "Authentication and Security" section into two separate  
sections "Authentication" and "SSL".  The latter part has gotten much  
longer over time, and doesn't primarily have to do with authentication.  
  
Also, the row_security parameter was inconsistently categorized, so  
clean that up while we're here.  

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

Add installcheck support to more test suites

commit   : f5da5683a86e9fc42fdf3eae2da8b096bda76a8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 12:17:35 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 12:17:35 -0500    

Click here for diff

Several of the test suites under src/test/ were missing an installcheck  
target.  

M src/test/authentication/Makefile
M src/test/authentication/README
M src/test/ldap/Makefile
M src/test/ldap/README
M src/test/recovery/Makefile
M src/test/recovery/README
M src/test/ssl/Makefile
M src/test/ssl/README
M src/test/subscription/Makefile
M src/test/subscription/README

Move handling of database properties from pg_dumpall into pg_dump.

commit   : b3f8401205afdaf63cb20dc316d44644c933d5a1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jan 2018 14:09:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jan 2018 14:09:09 -0500    

Click here for diff

This patch rearranges the division of labor between pg_dump and pg_dumpall  
so that pg_dump itself handles all properties attached to a single  
database.  Notably, a database's ACL (GRANT/REVOKE status) and local GUC  
settings established by ALTER DATABASE SET and ALTER ROLE IN DATABASE SET  
can be dumped and restored by pg_dump.  This is a long-requested  
improvement.  
  
"pg_dumpall -g" will now produce only role- and tablespace-related output,  
nothing about individual databases.  The total output of a regular  
pg_dumpall run remains the same.  
  
pg_dump (or pg_restore) will restore database-level properties only when  
creating the target database with --create.  This applies not only to  
ACLs and GUCs but to the other database properties it already handled,  
that is database comments and security labels.  This is more consistent  
and useful, but does represent an incompatibility in the behavior seen  
without --create.  
  
(This change makes the proposed patch to have pg_dump use "COMMENT ON  
DATABASE CURRENT_DATABASE" unnecessary, since there is no case where  
the command is issued that we won't know the true name of the database.  
We might still want that patch as a feature in its own right, but pg_dump  
no longer needs it.)  
  
pg_dumpall with --clean will now drop and recreate the "postgres" and  
"template1" databases in the target cluster, allowing their locale and  
encoding settings to be changed if necessary, and providing a cleaner  
way to set nondefault tablespaces for them than we had before.  This  
means that such a script must now always be started in the "postgres"  
database; the order of drops and reconnects will not work otherwise.  
Without --clean, the script will not adjust any database-level properties  
of those two databases (including their comments, ACLs, and security  
labels, which it formerly would try to set).  
  
Another minor incompatibility is that the CREATE DATABASE commands in a  
pg_dumpall script will now always specify locale and encoding settings.  
Formerly those would be omitted if they matched the cluster's default.  
While that behavior had some usefulness in some migration scenarios,  
it also posed a significant hazard of unwanted locale/encoding changes.  
To migrate to another locale/encoding, it's now necessary to use pg_dump  
without --create to restore into a database with the desired settings.  
  
Commit 4bd371f6f's hack to emit "SET default_transaction_read_only = off"  
is gone: we now dodge that problem by the expedient of not issuing ALTER  
DATABASE SET commands until after reconnecting to the target database.  
Therefore, such settings won't apply during the restore session.  
  
In passing, improve some shaky grammar in the docs, and add a note pointing  
out that pg_dumpall's output can't be expected to load without any errors.  
(Someday we might want to fix that, but this is not that patch.)  
  
Haribabu Kommi, reviewed at various times by Andreas Karlsson,  
Vaishnavi Prabakaran, and Robert Haas; further hacking by me.  
  
Discussion: https://postgr.es/m/CAJrrPGcUurV0eWTeXODwsOYFN=Ekq36t1s0YnFYUNzsmRfdAyA@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_upgrade/pg_upgrade.c

Reorder code in pg_dump to dump comments etc in a uniform order.

commit   : d6c84667d130f19efdf0f04f7d52a6b37df0f21b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jan 2018 12:37:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jan 2018 12:37:11 -0500    

Click here for diff

Most of the code in pg_dump dumps an object's comment, security label,  
and ACL auxiliary TOC entries, in that order, immediately after the  
object's main TOC entry, and at least dumpComment's API spec says this  
isn't optional.  dumpDatabase was significantly violating that when  
in binary-upgrade mode, by inserting totally unrelated stuff between.  
Also, dumpForeignDataWrapper and dumpForeignServer were being randomly  
inconsistent.  Reorder code so everybody does it the same.  
  
This may be future-proofing us against some code growing a requirement for  
such auxiliary entries to be adjacent to their main entry.  But for now  
it's just neatnik-ism, so I see no need for back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

PL/Python: Fix tests for older Python versions

commit   : f498704346a4ce4953fc5f837cacb545b3166ee1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2018 12:09:52 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2018 12:09:52 -0500    

Click here for diff

Commit 8561e4840c81f7e345be2df170839846814fa004 neglected to handle  
older Python versions that don't support the "with" statement.  So write  
the tests in a way that older versions can handle as well.  

M src/pl/plpython/expected/plpython_transaction.out
M src/pl/plpython/sql/plpython_transaction.sql

Make pg_dump's ACL, sec label, and comment entries reliably identifiable.

commit   : 2b792ab094415f351abd5854de5cefb023931a85    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jan 2018 12:06:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jan 2018 12:06:18 -0500    

Click here for diff

_tocEntryRequired() expects that it can identify ACL, SECURITY LABEL,  
and COMMENT TOC entries that are for large objects by seeing whether  
the tag for them starts with "LARGE OBJECT ".  While that works fine  
for actual large objects, which are indeed tagged that way, it's  
subject to false positives unless every such entry's tag starts with an  
appropriate type ID.  And in fact it does not work for ACLs, because  
up to now we customarily tagged those entries with just the bare name  
of the object.  This means that an ACL for an object named  
"LARGE OBJECT something" would be misclassified as data not schema,  
with undesirable results in a schema-only or data-only dump ---  
although pg_upgrade seems unaffected, due to the special case for  
binary-upgrade mode further down in _tocEntryRequired().  
  
We can fix this by changing all the dumpACL calls to use the label  
strings already in use for comments and security labels, which do  
follow the convention of starting with an object type indicator.  
  
Well, mostly they follow it.  dumpDatabase() got it wrong, using  
just the bare database name for those purposes, so that a database  
named "LARGE OBJECT something" would similarly be subject to having  
its comment or security label dropped or included when not wanted.  
Bring that into line too.  (Note that up to now, database ACLs have  
not been processed by pg_dump, so that this issue doesn't affect them.)  
  
_tocEntryRequired() itself is not free of fault: it was overly liberal  
about matching object tags to "LARGE OBJECT " in binary-upgrade mode.  
This looks like it is probably harmless because there would be no data  
component to strip anyway in that mode, but at best it's trouble  
waiting to happen, so tighten that up too.  
  
The possible misclassification of SECURITY LABEL entries for databases is  
in principle a security problem, but the opportunities for actual exploits  
seem too narrow to be interesting.  The other cases seem like just bugs,  
since an object owner can change its ACL or comment for himself, he needn't  
try to trick someone else into doing it by choosing a strange name.  
  
This has been broken since per-large-object TOC entries were introduced  
in 9.0, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Transaction control in PL procedures

commit   : 8561e4840c81f7e345be2df170839846814fa004    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2018 08:30:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2018 08:30:16 -0500    

Click here for diff

In each of the supplied procedural languages (PL/pgSQL, PL/Perl,  
PL/Python, PL/Tcl), add language-specific commit and rollback  
functions/commands to control transactions in procedures in that  
language.  Add similar underlying functions to SPI.  Some additional  
cleanup so that transaction commit or abort doesn't blow away data  
structures still used by the procedure call.  Add execution context  
tracking to CALL and DO statements so that transaction control commands  
can only be issued in top-level procedure and block calls, not function  
calls or other procedure or block calls.  
  
- SPI  
  
Add a new function SPI_connect_ext() that is like SPI_connect() but  
allows passing option flags.  The only option flag right now is  
SPI_OPT_NONATOMIC.  A nonatomic SPI connection can execute transaction  
control commands, otherwise it's not allowed.  This is meant to be  
passed down from CALL and DO statements which themselves know in which  
context they are called.  A nonatomic SPI connection uses different  
memory management.  A normal SPI connection allocates its memory in  
TopTransactionContext.  For nonatomic connections we use PortalContext  
instead.  As the comment in SPI_connect_ext() (previously SPI_connect())  
indicates, one could potentially use PortalContext in all cases, but it  
seems safest to leave the existing uses alone, because this stuff is  
complicated enough already.  
  
SPI also gets new functions SPI_start_transaction(), SPI_commit(), and  
SPI_rollback(), which can be used by PLs to implement their transaction  
control logic.  
  
- portalmem.c  
  
Some adjustments were made in the code that cleans up portals at  
transaction abort.  The portal code could already handle a command  
*committing* a transaction and continuing (e.g., VACUUM), but it was not  
quite prepared for a command *aborting* a transaction and continuing.  
  
In AtAbort_Portals(), remove the code that marks an active portal as  
failed.  As the comment there already predicted, this doesn't work if  
the running command wants to keep running after transaction abort.  And  
it's actually not necessary, because pquery.c is careful to run all  
portal code in a PG_TRY block and explicitly runs MarkPortalFailed() if  
there is an exception.  So the code in AtAbort_Portals() is never used  
anyway.  
  
In AtAbort_Portals() and AtCleanup_Portals(), we need to be careful not  
to clean up active portals too much.  This mirrors similar code in  
PreCommit_Portals().  
  
- PL/Perl  
  
Gets new functions spi_commit() and spi_rollback()  
  
- PL/pgSQL  
  
Gets new commands COMMIT and ROLLBACK.  
  
Update the PL/SQL porting example in the documentation to reflect that  
transactions are now possible in procedures.  
  
- PL/Python  
  
Gets new functions plpy.commit and plpy.rollback.  
  
- PL/Tcl  
  
Gets new commands commit and rollback.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  

M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/call.sgml
M doc/src/sgml/ref/create_procedure.sgml
M doc/src/sgml/ref/do.sgml
M doc/src/sgml/spi.sgml
M src/backend/commands/functioncmds.c
M src/backend/executor/spi.c
M src/backend/tcop/utility.c
M src/backend/utils/mmgr/portalmem.c
M src/include/commands/defrem.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/utils/portal.h
M src/pl/plperl/GNUmakefile
M src/pl/plperl/SPI.xs
A src/pl/plperl/expected/plperl_transaction.out
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h
A src/pl/plperl/sql/plperl_transaction.sql
M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
A src/pl/plpgsql/src/sql/plpgsql_transaction.sql
M src/pl/plpython/Makefile
M src/pl/plpython/expected/plpython_test.out
A src/pl/plpython/expected/plpython_transaction.out
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_plpymodule.c
A src/pl/plpython/sql/plpython_transaction.sql
M src/pl/tcl/Makefile
A src/pl/tcl/expected/pltcl_transaction.out
M src/pl/tcl/pltcl.c
A src/pl/tcl/sql/pltcl_transaction.sql

Fix docs typo

commit   : b9ff79b8f17697f3df492017d454caa9920a7183    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 22 Jan 2018 10:18:09 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 22 Jan 2018 10:18:09 +0100    

Click here for diff

Spotted by Thomas Munro  

M doc/src/sgml/config.sgml

Support huge pages on Windows

commit   : 1cc4f536ef86928a241126ca70d121873594630e    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 21 Jan 2018 15:40:46 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 21 Jan 2018 15:40:46 +0100    

Click here for diff

Add support for huge pages (called large pages on Windows) to the  
Windows build.  
  
This (probably) breaks compatibility with Windows versions prior to  
Windows 2003 or Windows Vista.  
  
Authors: Takayuki Tsunakawa and Thomas Munro  
Reviewed by: Magnus Hagander, Amit Kapila  

M doc/src/sgml/config.sgml
M src/backend/port/win32_shmem.c
M src/backend/utils/misc/guc.c
M src/bin/pg_ctl/pg_ctl.c

Fix wording of "hostaddrs"

commit   : 5c15a54e851ecdd2b53e6d6a84f8ec0802ffc3cb    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 21 Jan 2018 13:40:55 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 21 Jan 2018 13:40:55 +0100    

Click here for diff

The field is still called "hostaddr", so make sure references use  
"hostaddr values" instead.  
  
Author: Michael Paquier <[email protected]>  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c

doc: update intermediate certificate instructions

commit   : 815f84aa166de294b80e80cc456b79128592720e    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 20 Jan 2018 21:47:02 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 20 Jan 2018 21:47:02 -0500    

Click here for diff

Document how to properly create root and intermediate certificates using  
v3_ca extensions and where to place intermediate certificates so they  
are properly transferred to the remote side with the leaf certificate to  
link to the remote root certificate.  This corrects docs that used to  
say that intermediate certificates must be stored with the root  
certificate.  
  
Also add instructions on how to create root, intermediate, and leaf  
certificates.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed-by: Michael Paquier  
  
Backpatch-through: 9.3  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml

Improve type conversion of SPI_processed in Python

commit   : 918e02a221db1ee40d545cb05dc9d8d392b4b743    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 20 Jan 2018 08:02:01 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 20 Jan 2018 08:02:01 -0500    

Click here for diff

The previous code converted SPI_processed to a Python float if it didn't  
fit into a Python int.  But Python longs have unlimited precision, so  
use that instead in all cases.  
  
As in eee50a8d4c389171ad5180568a7221f7e9b28f09, we use the Python  
LongLong API unconditionally for simplicity.  
  
Reviewed-by: Tom Lane <[email protected]>  

M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_spi.c

Suppress possibly-uninitialized-variable warnings.

commit   : 96102a32a374c3b81ba9c2b24bcf1943a87a9ef6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Jan 2018 22:16:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Jan 2018 22:16:25 -0500    

Click here for diff

Apparently, Peter's compiler has faith that the switch test values here  
could never not be valid values of their enums.  Mine does not, and  
I tend to agree with it.  

M src/backend/catalog/aclchk.c

PL/Python: Simplify PLyLong_FromInt64

commit   : eee50a8d4c389171ad5180568a7221f7e9b28f09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 17:22:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2018 17:22:38 -0500    

Click here for diff

We don't actually need two code paths, one for 32 bits and one for 64  
bits.  Since the existing code already assumed that "long long" is  
available, we can just use PyLong_FromLongLong() for 64 bits as well.  
In Python 2.5 and later, PyLong_FromLong() and PyLong_FromLongLong() use  
the same code, so there will be no difference for 64-bit platforms.  In  
Python 2.4, the code is different, but performance testing showed no  
noticeable difference in PL/Python, and that Python version is ancient  
anyway.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/pl/plpython/plpy_typeio.c

Allow UPDATE to move rows between partitions.

commit   : 2f178441044be430f6b4d626e4dae68a9a6f6cec    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Jan 2018 15:33:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Jan 2018 15:33:06 -0500    

Click here for diff

When an UPDATE causes a row to no longer match the partition  
constraint, try to move it to a different partition where it does  
match the partition constraint.  In essence, the UPDATE is split into  
a DELETE from the old partition and an INSERT into the new one.  This  
can lead to surprising behavior in concurrency scenarios because  
EvalPlanQual rechecks won't work as they normally did; the known  
problems are documented.  (There is a pending patch to improve the  
situation further, but it needs more review.)  
  
Amit Khandekar, reviewed and tested by Amit Langote, David Rowley,  
Rajkumar Raghuwanshi, Dilip Kumar, Amul Sul, Thomas Munro, Ɓlvaro  
Herrera, Amit Kapila, and me.  A few final revisions by me.  
  
Discussion: http://postgr.es/m/CAJ3gD9do9o2ccQ7j7+tSgiE1REY65XRiMb=yJO3u3QhyP8EEPQ@mail.gmail.com  

M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/trigger.sgml
M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planner.h
M src/test/regress/expected/update.out
M src/test/regress/sql/update.sql
M src/tools/pgindent/typedefs.list

Fix CompareIndexInfo's attnum comparisons

commit   : 7f17fd6fc7125b41218bc99ccfa8165e2d730cd9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 16:34:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 16:34:44 -0300    

Click here for diff

When an index column is an expression, it makes no sense to compare its  
attribute numbers.  
  
This seems to account for remaining buildfarm fallout from 8b08f7d4820f.  
At least, it solves the issue in my local 32bit VM -- let's see what the  
rest thinks.  

M src/backend/catalog/index.c

Replace AclObjectKind with ObjectType

commit   : 8b9e9644dc6a9bd4b7a97950e6212f63880cf18b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 Dec 2017 09:26:34 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 Dec 2017 09:26:34 -0500    

Click here for diff

AclObjectKind was basically just another enumeration for object types,  
and we already have a preferred one for that.  It's only used in  
aclcheck_error.  By using ObjectType instead, we can also give some more  
precise error messages, for example "index" instead of "relation".  
  
Reviewed-by: Michael Paquier <[email protected]>  

M contrib/dblink/dblink.c
M contrib/file_fdw/output/file_fdw.source
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/test_decoding/expected/permissions.out
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginfast.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/collationcmds.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/executor/execExpr.c
M src/backend/executor/execMain.c
M src/backend/executor/execSRF.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/tcop/fastpath.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/tid.c
M src/backend/utils/fmgr/fmgr.c
M src/include/catalog/objectaddress.h
M src/include/utils/acl.h
M src/pl/tcl/pltcl.c
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_procedure.out
M src/test/regress/expected/lock.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/select_into.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/alter_table.sql

Replace GrantObjectType with ObjectType

commit   : 2c6f37ed62114bd5a092c20fe721bd11b3bcb91e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Oct 2017 18:35:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Oct 2017 18:35:19 -0400    

Click here for diff

There used to be a lot of different *Type and *Kind symbol groups to  
address objects within different commands, most of which have been  
replaced by ObjectType, starting with  
b256f2426433c56b4bea3a8102757749885b81ba.  But this conversion was never  
done for the ACL commands until now.  
  
This change ends up being just a plain replacement of the types and  
symbols, without any code restructuring needed, except deleting some now  
redundant code.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Stephen Frost <[email protected]>  

M src/backend/catalog/aclchk.c
M src/backend/catalog/heap.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/commands/event_trigger.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/adt/acl.c
M src/include/commands/event_trigger.h
M src/include/nodes/parsenodes.h
M src/include/tcop/deparse_utility.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h

Fix pg_dump version comparison

commit   : 42b5856038a5af6bb4ec3c09b62d9d9a3ab43172    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 13:23:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 13:23:49 -0300    

Click here for diff

I missed a '0' in the version number string ...  
  
Per buildfarm member crake.  

M src/bin/pg_dump/pg_dump.c

Fix regression tests for better stability

commit   : 189d0ff588f54b9641c6684d7c668ef85ea4dfbd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 12:31:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 12:31:34 -0300    

Click here for diff

Per buildfarm  

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

Local partitioned indexes

commit   : 8b08f7d4820fd7a8ef6152a9dd8c6e3cb01e5f99    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 11:49:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 11:49:22 -0300    

Click here for diff

When CREATE INDEX is run on a partitioned table, create catalog entries  
for an index on the partitioned table (which is just a placeholder since  
the table proper has no data of its own), and recurse to create actual  
indexes on the existing partitions; create them in future partitions  
also.  
  
As a convenience gadget, if the new index definition matches some  
existing index in partitions, these are picked up and used instead of  
creating new ones.  Whichever way these indexes come about, they become  
attached to the index on the parent table and are dropped alongside it,  
and cannot be dropped on isolation unless they are detached first.  
  
To support pg_dump'ing these indexes, add commands  
    CREATE INDEX ON ONLY <table>  
(which creates the index on the parent partitioned table, without  
recursing) and  
    ALTER INDEX ATTACH PARTITION  
(which is used after the indexes have been created individually on each  
partition, to attach them to the parent index).  These reconstruct prior  
database state exactly.  
  
Reviewed-by: (in alphabetical order) Peter Eisentraut, Robert Haas, Amit  
	Langote, Jesper Pedersen, Simon Riggs, David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/reindex.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/index/indexam.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/dependency.h
M src/include/catalog/index.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_inherits_fn.h
M src/include/commands/defrem.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/test/regress/expected/alter_table.out
A src/test/regress/expected/indexing.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/alter_table.sql
A src/test/regress/sql/indexing.sql

Fix StoreCatalogInheritance1 to use 32bit inhseqno

commit   : 1ef61ddce9086c30a18a6ecc48bc3ce0ef62cb39    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 10:15:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jan 2018 10:15:08 -0300    

Click here for diff

For no apparent reason, this function was using a 16bit-wide inhseqno  
value, rather than the correct 32 bit width which is what is stored in  
the pg_inherits catalog.  This becomes evident if you try to create a  
table with more than 65535 parents, because this error appears:  
  
ERROR:  duplicate key value violates unique constraint Ā«pg_inherits_relid_seqno_indexĀ»  
DETAIL:  Key (inhrelid, inhseqno)=(329371, 0) already exists.  
  
Needless to say, having so many parents is an uncommon situations, which  
explains why this error has never been reported despite being having  
been introduced with the Postgres95 1.01 sources in commit d31084e9d111:  
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/commands/creatinh.c;hb=d31084e9d111#l349  
  
Backpatch all the way back.  
  
David Rowley noticed this while reviewing a patch of mine.  
Discussion: https://postgr.es/m/CAKJS1f8Dn7swSEhOWwzZzssW7747YB=2Hi+T7uGud40dur69-g@mail.gmail.com  

M src/backend/commands/tablecmds.c

Transfer state pertaining to pending REINDEX operations to workers.

commit   : 29d58fd3adae9057c3fd502393b2f131bc96eaf9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Jan 2018 07:48:44 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Jan 2018 07:48:44 -0500    

Click here for diff

This will allow the pending patch for parallel CREATE INDEX to work  
on system catalogs, and to provide the same level of protection  
against use of user indexes while they are being rebuilt that we  
have for non-parallel CREATE INDEX.  
  
Patch by me, reviewed by Peter Geoghegan.  
  
Discussion: http://postgr.es/m/CA+TgmoYN-YQU9JsGQcqFLovZ-C+Xgp1_xhJQad=cunGG-_p5gg@mail.gmail.com  
Discussion: http://postgr.es/m/CAH2-Wzkv4UNkXYhqQRqk-u9rS7h5c-4cCW+EqQ8K_WSeS43aZg@mail.gmail.com  

M src/backend/access/transam/README.parallel
M src/backend/access/transam/parallel.c
M src/backend/catalog/index.c
M src/include/catalog/index.h

Fix typo in recent commit

commit   : 4e54dd2e0a750352ce2a5c45d1cc9183e887eec3    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 19 Jan 2018 06:36:17 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 19 Jan 2018 06:36:17 +0000    

Click here for diff

Typo in 9c7d06d60680c7f00d931233873dee81fdb311c6  
  
Reported-by: Masahiko Sawada  

M src/backend/replication/slotfuncs.c

Update comment

commit   : a228e44ce4a2bfd1de3764763039cfcb009d7864    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 19:36:34 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 19:36:34 -0500    

Click here for diff

The "callback" that this comment was referring to was removed by commit  
c0a15e07cd718cb6e455e68328f522ac076a0e4b, so update to match the current  
code.  

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

Fix typo and improve punctuation

commit   : 958c7ae0b7ca4ee9d422271c2ffbef4e3a6d1c47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 13:00:49 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 13:00:49 -0500    

Click here for diff

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

Add tests for session_replication_role

commit   : 77216cae47e3ded13f36361f60ce04ec0a709e2a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 11:24:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 11:24:07 -0500    

Click here for diff

This was hardly tested at all.  The trigger case was lightly tested by  
the logical replication tests, but rules and event triggers were not  
tested at all.  

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

Extend configure's __int128 test to check for a known gcc bug.

commit   : 2082b3745a7165d10788d55c5b6c609a8d39d729    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Jan 2018 11:09:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Jan 2018 11:09:44 -0500    

Click here for diff

On Sparc64, use of __attribute__(aligned(8)) with __int128 causes faulty  
code generation in gcc versions at least through 5.5.0.  We can work around  
that by disabling use of __int128, so teach configure to test for the bug.  
  
This solution doesn't fix things for the case of cross-compiling with a  
buggy compiler; to support that nicely, we'd need to add a manual disable  
switch.  Unless more such cases turn up, it doesn't seem worth the work.  
Affected users could always edit pg_config.h manually.  
  
In passing, fix some typos in the existing configure test for __int128.  
They're harmless because we only compile that code not run it, but  
they're still confusing for anyone looking at it closely.  
  
This is needed in support of commit 751804998, so back-patch to 9.5  
as that was.  
  
Marina Polyakova, Victor Wagner, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure

doc: Expand documentation of session_replication_role

commit   : a063d842f8f48e197f5a9bfb892210ce219c5556    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 09:34:51 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2018 09:34:51 -0500    

Click here for diff

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

Reorder C includes

commit   : f033462d8f77c40b7d6b33c5116e50118fb4699d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 Jan 2018 18:09:57 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 Jan 2018 18:09:57 -0500    

Click here for diff

Reorder header files in joinrels.c and pathnode.c in alphabetical order,  
removing unnecessary ones.  
  
Author: Etsuro Fujita  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/pathnode.c

postgres_fdw: Avoid 'outer pathkeys do not match mergeclauses' error.

commit   : 4bbf6edfbd5d03743ff82dda2f00c738fb3208f5    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 17 Jan 2018 16:18:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 17 Jan 2018 16:18:39 -0500    

Click here for diff

When pushing down a join to a foreign server, postgres_fdw constructs  
an alternative plan to be used for any EvalPlanQual rechecks that  
prove to be necessary.  This plan is stored as the outer subplan of  
the Foreign Scan implementing the pushed-down join.  Previously, this  
alternative plan could have a different nominal sort ordering than its  
parent, which seemed OK since there will only be one tuple per base  
table anyway in the case of an EvalPlanQual recheck.  Actually,  
though, it caused a problem if that path was used as a building block  
for the EvalPlanQual recheck plan of a higher-level foreign join,  
because we could end up with a merge join one of whose inputs was not  
labelled with the correct sort order.  Repair by injecting an extra  
Sort node into the EvalPlanQual recheck plan whenever it would  
otherwise fail to be sorted at least as well as its parent Foreign  
Scan.  
  
Report by Jeff Janes.  Patch by me, reviewed by Tom Lane, who also  
provided the test case and comment text.  
  
Discussion: http://postgr.es/m/CAMkU=1y2G8VOVBHv3iXU2TMAj7-RyBFFW1uhkr5sm9LQ2=X35g@mail.gmail.com  

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

Remove useless lookup of root partitioned rel in ExecInitModifyTable().

commit   : dca48d145e0e757f0549430ec48687d12c6b6751    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jan 2018 14:44:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jan 2018 14:44:15 -0500    

Click here for diff

node->partitioned_rels is only set in UPDATE/DELETE cases, but  
ExecInitModifyTable only uses its "rel" variable in INSERT cases,  
so the extra logic to find the root rel is just a waste of complexity  
and cycles.  
  
Etsuro Fujita, reviewed by Amit Langote  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Ability to advance replication slots

commit   : 9c7d06d60680c7f00d931233873dee81fdb311c6    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 17 Jan 2018 11:38:34 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 17 Jan 2018 11:38:34 +0000    

Click here for diff

Ability to advance both physical and logical replication slots using a  
new user function pg_replication_slot_advance().  
  
For logical advance that means records are consumed as fast as possible  
and changes are not given to output plugin for sending. Makes 2nd phase  
(after we reached SNAPBUILD_FULL_SNAPSHOT) of replication slot creation  
faster, especially when there are big transactions as the reorder buffer  
does not have to deal with data changes and does not have to spill to  
disk.  
  
Author: Petr Jelinek  
Reviewed-by: Simon Riggs  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/func.sgml
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/include/catalog/pg_proc.h
M src/include/replication/logical.h

Fix compiler warnings due to commit cc4feded

commit   : 585e166e46a1572b59eb9fdaffc2d4b785000f9e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 17 Jan 2018 03:33:02 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 17 Jan 2018 03:33:02 -0500    

Click here for diff

M src/include/utils/date.h

Centralize json and jsonb handling of datetime types

commit   : cc4feded0a31d2b732d4ea68613115cb720e624e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 16 Jan 2018 19:07:13 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 16 Jan 2018 19:07:13 -0500    

Click here for diff

The creates a single function JsonEncodeDateTime which will format these  
data types in an efficient and consistent manner. This will be all the  
more important when we come to jsonpath so we don't have to implement yet  
more code doing the same thing in two more places.  
  
This also extends the code to handle time and timetz types which were  
not previously handled specially. This requires exposing the time2tm and  
timetz2tm functions.  
  
Patch from Nikita Glukhov  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/include/utils/date.h
M src/include/utils/jsonapi.h

Remove useless use of bit-masking macros

commit   : d91da5ecedc8f8965bd35de66b09feb79c26e5ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2018 17:12:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2018 17:12:16 -0500    

Click here for diff

In this case, the macros SET_8_BYTES(), GET_8_BYTES(), SET_4_BYTES(),  
GET_4_BYTES() are no-ops, so we can just remove them.  
  
The plan is to perhaps remove them from the source code altogether, so  
we'll start here.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Cope with indicator arrays that do not have the correct length.

commit   : 649aeb123f73e69cf78c52b534c15c51a229d63d    
  
author   : Michael Meskes <[email protected]>    
date     : Sat, 13 Jan 2018 14:56:49 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Sat, 13 Jan 2018 14:56:49 +0100    

Click here for diff

Patch by: "Rader, David" <[email protected]>  

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

commit   : 255f14183ac7bc6a83a5bb00d67d5ac7e8b645f1    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jan 2018 16:53:25 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jan 2018 16:53:25 -0500    

Click here for diff

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

M doc/src/sgml/textsearch.sgml

Fix postgres_fdw to cope with duplicate GROUP BY entries.

commit   : e9f2703ab7b29f7e9100807cfbd19ddebbaa0b12    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jan 2018 16:52:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jan 2018 16:52:49 -0500    

Click here for diff

Commit 7012b132d, which added the ability to push down aggregates and  
grouping to the remote server, wasn't careful to ensure that the remote  
server would have the same idea we do about which columns are the grouping  
columns, in cases where there are textually identical GROUP BY expressions.  
Such cases typically led to "targetlist item has multiple sortgroupref  
labels" errors.  
  
To fix this reliably, switch over to using "GROUP BY column-number" syntax  
rather than "GROUP BY expression" in transmitted queries, and adjust  
foreign_grouping_ok() to be more careful about duplicating the sortgroupref  
labeling of the local pathtarget.  
  
Per bug #14890 from Sean Johnston.  Back-patch to v10 where the buggy code  
was introduced.  
  
Jeevan Chalke, reviewed by Ashutosh Bapat  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT.

commit   : 680d540502609b422d378a1b8e0c10cac3c60084    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jan 2018 15:46:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jan 2018 15:46:37 -0500    

Click here for diff

If a query against an inheritance tree runs concurrently with an ALTER  
TABLE that's disinheriting one of the tree members, it's possible to get  
a "could not find inherited attribute" error because after obtaining lock  
on the removed member, make_inh_translation_list sees that its columns  
have attinhcount=0 and decides they aren't the columns it's looking for.  
  
An ideal fix, perhaps, would avoid including such a just-removed member  
table in the query at all; but there seems no way to accomplish that  
without adding expensive catalog rechecks or creating a likelihood of  
deadlocks.  Instead, let's just drop the check on attinhcount.  In this  
way, a query that's included a just-disinherited child will still  
succeed, which is not a completely unreasonable behavior.  
  
This problem has existed for a long time, so back-patch to all supported  
branches.  Also add an isolation test verifying related behaviors.  
  
Patch by me; the new isolation test is based on Kyotaro Horiguchi's work.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepunion.c
A src/test/isolation/expected/alter-table-4.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/alter-table-4.spec

Fix incorrect handling of subquery pullup in the presence of grouping sets.

commit   : 90947674fc984f5639e3b1bf013435a023aa713b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jan 2018 12:24:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jan 2018 12:24:50 -0500    

Click here for diff

If we flatten a subquery whose target list contains constants or  
expressions, when those output columns are used in GROUPING SET columns,  
the planner was capable of doing the wrong thing by merging a pulled-up  
expression into the surrounding expression during const-simplification.  
Then the late processing that attempts to match subexpressions to grouping  
sets would fail to match those subexpressions to grouping sets, with the  
effect that they'd not go to null when expected.  
  
To fix, wrap such subquery outputs in PlaceHolderVars, ensuring that  
they preserve their separate identity throughout the planner's expression  
processing.  This is a bit of a band-aid, because the wrapper defeats  
const-simplification even in places where it would be safe to allow.  
But a nicer fix would likely be too invasive to back-patch, and the  
consequences of the missed optimizations probably aren't large in most  
cases.  
  
Back-patch to 9.5 where grouping sets were introduced.  
  
Heikki Linnakangas, with small mods and better test cases by me;  
additional review by Andrew Gierth  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Fix parsing of compatibility mode argument.

commit   : ca4587f3f94f5c33da6543535f666a9f20f3ef33    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 12 Jan 2018 15:59:43 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 12 Jan 2018 15:59:43 +0100    

Click here for diff

Patch by Ashutosh Sharma <[email protected]>  

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

Remove hard-coded schema knowledge about pg_attribute from genbki.pl

commit   : 49c784ece766781250224a371be14af71e7eda93    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2018 11:21:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2018 11:21:42 -0300    

Click here for diff

Add the ability to label a column's default value in the catalog header,  
and implement this for pg_attribute.  A new function in Catalog.pm is  
used to fill in a tuple with defaults.  The build process will complain  
loudly if a catalog entry is incomplete,  
  
Commit 8137f2c3232 labeled variable length columns for the C preprocessor.  
Expose that label to genbki.pl so we can exclude those columns from schema  
macros in a general fashion. Also, format schema macro entries according  
to their types.  
  
This means slightly less code maintenance, but more importantly it's a  
proving ground for mechanisms intended to be used in later commits.  
  
While at it, I (Ɓlvaro) couldn't resist making some changes in  
genbki.pl: rename some functions to actually indicate their purpose  
instead of actively misleading onlookers; and don't iterate on the whole  
of pg_type to find the entry for each catalog row, using a hash instead  
of an array.  
  
Author: John Naylor, some changes by Ɓlvaro Herrera  
Discussion: https://postgr.es/m/CAJVSVGVJHwD8sfDfZW9TbCHWKf=C1YDRM-rF=2JenRU_y+VcFg@mail.gmail.com  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/catalog/genbki.h
M src/include/catalog/pg_attribute.h

C comment: fix "the the" mentions in C comments

commit   : bdb70c12b3a2e69eec6e51411df60d9f43ecc841    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jan 2018 21:50:21 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jan 2018 21:50:21 -0500    

Click here for diff

Reported-by: Christoph Dreis  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Christoph Dreis  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Refactor subscription tests to use PostgresNode's wait_for_catchup

commit   : bbd3363e128daec0e70952c1bb2f12ab1f6f1292    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Jan 2018 17:32:09 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Jan 2018 17:32:09 -0500    

Click here for diff

This was nearly the same code.  Extend wait_for_catchup to allow waiting  
for pg_current_wal_lsn() and use that in the subscription tests.  Also  
change one use in the pg_rewind tests to use this.  
  
Also remove some broken code in wait_for_catchup and  
wait_for_slot_catchup.  The error message in case the waiting failed  
wanted to show the current LSN, but the way it was written never  
worked.  So since nobody ever cared, just remove it.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/PostgresNode.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl

Add QueryEnvironment to ExplainOneQuery_hook's parameter list.

commit   : 4d41b2e0926548e338d20875729a55d41289f867    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2018 12:16:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2018 12:16:18 -0500    

Click here for diff

This should have been done in commit 18ce3a4ab, which added that parameter  
to ExplainOneQuery, but it was overlooked.  This makes it impossible for  
a user of the hook to pass the queryEnv down to ExplainOnePlan.  
  
It's too late to change this API in v10, I suppose, but fortunately  
passing NULL to ExplainOnePlan will work in nearly all interesting  
cases in v10.  That might not be true forever, so we'd better fix it.  
  
Tatsuro Yamada, reviewed by Thomas Munro  
  
Discussion: https://postgr.es/m/[email protected]  

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

Cosmetic fix in postgres_fdw.c.

commit   : 9ff4f758ee430dbce0be13ab5da315be52cb6f55    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2018 11:53:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2018 11:53:59 -0500    

Click here for diff

Make the forward declaration of estimate_path_cost_size match its  
actual definition.  
  
Tatsuro Yamada  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

doc: add JSON acronym

commit   : ca454b9bd34c75995eda4d07c9858f7c22890c2b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jan 2018 11:21:24 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jan 2018 11:21:24 -0500    

Click here for diff

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

M doc/src/sgml/acronyms.sgml

Fix Latin spelling

commit   : 9e945f862633882cae3183d465f321bd8dd591f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2018 08:31:11 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2018 08:31:11 -0500    

Click here for diff

"c.f." should be "cf.".  

M src/backend/catalog/catalog.c
M src/backend/optimizer/util/clauses.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/cache/relcache.c
M src/bin/psql/describe.c

llow negative coordinate for ~> (cube, int) operator

commit   : f50c80dbb17efa39c169f6c510e9464486ff5edc    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 11 Jan 2018 14:49:36 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 11 Jan 2018 14:49:36 +0300    

Click here for diff

~> (cube, int) operator was especially designed for knn-gist search.  
However, knn-gist supports only ascending ordering of results. Nevertheless  
it would be useful to support descending ordering by ~> (cube, int) operator.  
We provide workaround for that: negative coordinate give us inversed value  
of corresponding cube bound. Therefore, knn search using negative coordinate  
gives us an effect of descending ordering by cube bound.  
  
Author: Alexander Korotkov  
Reviewed by: Tomas Vondra, Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/cube/cube.c
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_2.out
M contrib/cube/sql/cube.sql
M doc/src/sgml/cube.sgml

Fix behavior of ~> (cube, int) operator

commit   : 563a053bdd4b91c5e5560f4bf91220e562326f7d    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 11 Jan 2018 14:41:14 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 11 Jan 2018 14:41:14 +0300    

Click here for diff

~> (cube, int) operator was especially designed for knn-gist search.  
However, it appears that knn-gist search can't work correctly with current  
behavior of this operator when dataset contains cubes of variable  
dimensionality. In this case, the same value of second operator argument  
can point to different dimension depending on dimensionality of particular cube.  
Such behavior is incompatible with gist indexing of cubes, and knn-gist doesn't  
work correctly for it.  
  
This patch changes behavior of ~> (cube, int) operator by introducing dimension  
numbering where value of second argument unambiguously identifies number of  
dimension. With new behavior, this operator can be correctly supported by  
knn-gist. Relevant changes to cube operator class are also included.  
  
Backpatch to v9.6 where operator was introduced.  
  
Since behavior of ~> (cube, int) operator is changed, depending entities  
must be refreshed after upgrade. Such as, expression indexes using this  
operator must be reindexed, materialized views must be rebuilt, stored  
procedures and client code must be revised to correctly use new behavior.  
That should be mentioned in release notes.  
  
Noticed by: Tomas Vondra  
Author: Alexander Korotkov  
Reviewed by: Tomas Vondra, Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/cube/cube.c
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_2.out
M contrib/cube/sql/cube.sql
M doc/src/sgml/cube.sgml

Fix sample INSTR() functions in the plpgsql documentation.

commit   : 3c1e9fd23269849e32c73683a8457fb3095309e3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2018 17:13:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2018 17:13:29 -0500    

Click here for diff

These functions are stated to be Oracle-compatible, but they weren't.  
Yugo Nagata noticed that while our code returns zero for a zero or  
negative fourth parameter (occur_index), Oracle throws an error.  
Further testing by me showed that there was also a discrepancy in the  
interpretation of a negative third parameter (beg_index): Oracle thinks  
that a negative beg_index indicates the last place where the target  
substring can *begin*, whereas our code thinks it is the last place  
where the target can *end*.  
  
Adjust the sample code to behave like Oracle in both these respects.  
Also change it to be a CDATA[] section, simplifying copying-and-pasting  
out of the documentation source file.  And fix minor problems in the  
introductory comment, which wasn't very complete or accurate.  
  
Back-patch to all supported branches.  Although this patch only touches  
documentation, we should probably call it out as a bug fix in the next  
minor release notes, since users who have adopted the functions will  
likely want to update their versions.  
  
Yugo Nagata and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

Use portal pinning in PL/Perl and PL/Python

commit   : 70d6226e4fba26765877fc3c2ec6c468d3ff4084    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Dec 2017 10:26:47 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Dec 2017 10:26:47 -0500    

Click here for diff

PL/pgSQL "pins" internally generated portals so that user code cannot  
close them by guessing their names.  Add this functionality to PL/Perl  
and PL/Python as well, preventing users from manually closing cursors  
created by spi_query and plpy.cursor, respectively.  (PL/Tcl does not  
currently offer any cursor functionality.)  

M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_cursorobject.c

Add tests for PL/pgSQL returning unnamed portals as refcursor

commit   : 511585417079b7d52211e09b20de0e0981b6eaa6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jan 2018 16:39:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jan 2018 16:39:13 -0500    

Click here for diff

Existing tests only covered returning explicitly named portals as  
refcursor.  The unnamed cursor case was recently broken without a test  
failing.  

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

Revert "Move portal pinning from PL/pgSQL to SPI"

commit   : b48b2f8793ef256d19274b4ef6ff587fd47ab553    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jan 2018 16:01:17 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jan 2018 16:01:17 -0500    

Click here for diff

This reverts commit b3617cdfbba1b5381e9d1c6bc0839500e8eb7273.  
  
This broke returning unnamed cursors from PL/pgSQL functions.  
Apparently, there are no test cases for this.  

M src/backend/executor/spi.c
M src/pl/plpgsql/src/pl_exec.c

Remove dubious micro-optimization in ckpt_buforder_comparator().

commit   : 3afd75eaac8aaccf5aeebc52548c396b84d85516    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2018 15:50:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jan 2018 15:50:54 -0500    

Click here for diff

It seems incorrect to assume that the list of CkptSortItems can never  
contain duplicate page numbers: concurrent activity could result in some  
page getting dropped from a low-numbered buffer and later loaded into a  
high-numbered buffer while BufferSync is scanning the buffer pool.  
If that happened, the comparator would give self-inconsistent results,  
potentially confusing qsort().  Saving one comparison step is not worth  
possibly getting the sort wrong.  
  
So far as I can tell, nothing would actually go wrong given our current  
implementation of qsort().  It might get a bit slower than expected  
if there were a large number of duplicates of one value, but that's  
surely a probability-epsilon case.  Still, the comment is wrong,  
and if we ever switched to another sort implementation it might be  
less forgiving.  
  
In passing, avoid casting away const-ness of the argument pointers;  
I've not seen any compiler complaints from that, but it seems likely  
that some compilers would not like it.  
  
Back-patch to 9.6 where this code came in, just in case I've underestimated  
the possible consequences.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add missing "return" statement to accumulate_append_subpath.

commit   : 2fd58096f02777c38edb392f78cb5b4ebd90e9d2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Jan 2018 11:18:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Jan 2018 11:18:40 -0500    

Click here for diff

Without this, Parallel Append can end up with extra children.  
  
Report by Rajkumar Raghuwanshi.  Fix by Amit Khandekar.  Brown  
paper bag bug by me.  
  
Discussion: http://postgr.es/m/CAKcux6mBF-NiddyEe9LwymoUC5+wh8bQJ=uk2gGkOE+L8cv=LA@mail.gmail.com  

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

Move portal pinning from PL/pgSQL to SPI

commit   : b3617cdfbba1b5381e9d1c6bc0839500e8eb7273    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Dec 2017 15:24:10 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Dec 2017 15:24:10 -0500    

Click here for diff

PL/pgSQL "pins" internally generated (unnamed) portals so that user code  
cannot close them by guessing their names.  This logic is also useful in  
other languages and really for any code.  So move that logic into SPI.  
An unnamed portal obtained through SPI_cursor_open() and related  
functions is now automatically pinned, and SPI_cursor_close()  
automatically unpins a portal that is pinned.  
  
In the core distribution, this affects PL/Perl and PL/Python, preventing  
users from manually closing cursors created by spi_query and  
plpy.cursor, respectively.  (PL/Tcl does not currently offer any cursor  
functionality.)  
  
Reviewed-by: Andrew Dunstan <[email protected]>  

M src/backend/executor/spi.c
M src/pl/plpgsql/src/pl_exec.c

Give more accurate error message for dropping pinned portal

commit   : acc67ffd0a8c728b928958e75b76ee544b64c2d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jan 2018 09:22:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jan 2018 09:22:07 -0500    

Click here for diff

The previous code gave the same error message for attempting to drop  
pinned and active portals, but those are separate states, so give  
separate error messages.  

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

Fix allowing of leading zero on exponents in pgbench test results

commit   : d16c2de6244f3b71c0c77a3d63905227fdc78428    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 10 Jan 2018 11:33:37 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 10 Jan 2018 11:33:37 +0300    

Click here for diff

Commit bc7fa0c15c590ddf4872e426abd76c2634f22aca accidentally lost fixes of  
0aa1d489ea756b96b6d5573692ae9cd5d143c2a5 commit.  
  
Thanks to Thomas Munro  

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

Remove outdated/removed Win32 URLs in C comments

commit   : fccaea45496d721012ce8fbbebae82e4dbfc1ef4    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 9 Jan 2018 18:33:11 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 9 Jan 2018 18:33:11 -0500    

Click here for diff

Reported-by: Ashutosh Sharma  

M src/include/port/win32.h

Expression evaluation based aggregate transition invocation.

commit   : 69c3936a1499b772a749ae629fc59b2d72722332    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 9 Jan 2018 13:25:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 9 Jan 2018 13:25:38 -0800    

Click here for diff

Previously aggregate transition and combination functions were invoked  
by special case code in nodeAgg.c, evaluating input and filters  
separately using the expression evaluation machinery. That turns out  
to not be great for performance for several reasons:  
  
- repeated expression evaluations have some cost  
- the transition functions invocations are poorly predicted, as  
  commonly there are multiple aggregates in a query, resulting in the  
  same call-stack invoking different functions.  
- filter and input computation had to be done separately  
- the special case code made it hard to implement JITing of the whole  
  transition function invocation  
  
Address this by building one large expression that computes input,  
evaluates filters, and invokes transition functions.  
  
This leads to moderate speedups in queries bottlenecked by aggregate  
computations, and enables large speedups for similar cases once JITing  
is done.  
  
There's potential for further improvement:  
- It'd be nice if we could simplify the somewhat expensive  
  aggstate->all_pergroups lookups.  
- right now there's still an advance_transition_function invocation in  
  nodeAgg.c, leading to some code duplication.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

Change some bogus PageGetLSN calls to BufferGetLSNAtomic

commit   : 272c2ab9fd0a604e3200030b1ea26fd464c44935    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 Jan 2018 15:54:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 Jan 2018 15:54:39 -0300    

Click here for diff

As src/backend/access/transam/README says, PageGetLSN may only be called  
by processes holding either exclusive lock on buffer, or a shared lock  
on buffer plus buffer header lock.  Therefore any place that only holds  
a shared buffer lock must use BufferGetLSNAtomic instead of PageGetLSN,  
which internally obtains buffer header lock prior to reading the LSN.  
  
A few callsites failed to comply with this rule.  This was detected by  
running all tests under a new (not committed) assertion that verifies  
PageGetLSN locking contract.  All but one of the callsites that failed  
the assertion are fixed by this patch.  Remaining callsites were  
inspected manually and determined not to need any change.  
  
The exception (unfixed callsite) is in TestForOldSnapshot, which only  
has a Page argument, making it impossible to access the corresponding  
Buffer from it.  Fixing that seems a much larger patch that will have to  
be done separately; and that's just as well, since it was only  
introduced in 9.6 and other bugs are much older.  
  
Some of these bugs are ancient; backpatch all the way back to 9.3.  
  
Authors: Jacob Champion, Asim Praveen, Ashwin Agrawal  
Reviewed-by: Michaƫl Paquier  
Discussion: https://postgr.es/m/CABAq_6GXgQDVu3u12mK9O5Xt5abBZWQ0V40LZCE+oUf95XyNFg@mail.gmail.com  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c

Implement TZH and TZM timestamp format patterns

commit   : 11b623dd0a2c385719ebbbdd42dd4ec395dcdc9d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 9 Jan 2018 14:25:05 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 9 Jan 2018 14:25:05 -0500    

Click here for diff

These are compatible with Oracle and required for the datetime template  
language for jsonpath in an upcoming patch.  
  
Nikita Glukhov and Andrew Dunstan, reviewed by Pavel Stehule.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/formatting.c
M src/test/regress/expected/horology.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/horology.sql
M src/test/regress/sql/timestamptz.sql

Remove PortalGetQueryDesc()

commit   : a77dd53f3089a3d6bf74966bfd3ab7e27537183b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Dec 2017 17:43:41 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Dec 2017 17:43:41 -0500    

Click here for diff

After having gotten rid of PortalGetHeapMemory(), there seems little  
reason to keep one Portal access macro around that offers no actual  
abstraction and isn't consistently used anyway.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  

M src/backend/commands/portalcmds.c
M src/backend/executor/execCurrent.c
M src/backend/tcop/pquery.c
M src/include/utils/portal.h

commit   : 0f7c49e85518dd846ccd0a044d49a922b9132983    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Dec 2017 17:26:26 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Dec 2017 17:26:26 -0500    

Click here for diff

Rename PortalMemory to TopPortalContext, to avoid confusion with  
PortalContext and align naming with similar top-level memory contexts.  
  
Rename PortalData's "heap" field to portalContext.  The "heap" naming  
seems quite antiquated and confusing.  Also get rid of the  
PortalGetHeapMemory() macro and access the field directly, which we do  
for other portal fields, so this abstraction doesn't buy anything.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  

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

Rewrite list_qsort() to avoid trashing its input list.

commit   : 3cb1b2a8804da8365fe17f687d96b720df4a583d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 13:25:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 13:25:53 -0500    

Click here for diff

The initial implementation of list_qsort(), from commit ab7271677,  
re-used the ListCells of the input list while not touching the List  
header.  This meant that anybody who still had a pointer to the  
original header would now be in possession of a corrupted list,  
a problem that seems sure to bite us eventually.  
  
One possible solution is to re-use the original List header as well,  
giving the function the semantics of update-in-place.  However, that  
doesn't seem like a very good idea either given the way that the  
function is used in the planner: create_path functions aren't normally  
supposed to modify their input lists.  It doesn't look like there would  
be a problem today, but it's not hard to foresee a time when modifying  
a list of Paths in-place could have side-effects on some other append  
path.  
  
On the whole, and in view of the likelihood that this function might  
be used in other contexts in the future, it seems best to get rid of  
the micro-optimization of re-using the input list cells.  Just build  
a new list.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/list.c

Improve the heuristic for ordering child paths of a parallel append.

commit   : 624e440a474420fa0d6cf26c19bfb256547ab71d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 13:07:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 13:07:52 -0500    

Click here for diff

Commit ab7271677 introduced code that attempts to order the child  
scans of a Parallel Append node in a way that will minimize execution  
time, based on total cost and startup cost.  However, it failed to  
think hard about what to do when estimated costs are exactly equal;  
a case that's particularly likely to occur when comparing on startup  
cost.  In such a case the ordering of the child paths would be left  
to the whims of qsort, an algorithm that isn't even stable.  
  
We can improve matters by applying the rule used elsewhere in the  
planner: if total costs are equal, sort on startup cost, and  
vice versa.  When both cost estimates are exactly equal, rather  
than letting qsort do something unpredictable, sort based on the  
child paths' relids, which should typically result in sorting in  
inheritance order.  (The latter provision requires inventing a  
qsort-style comparator for bitmapsets, but maybe we'll have use  
for that for other reasons in future.)  
  
This results in a few plan changes in the select_parallel test,  
but those all look more reasonable than before, when the actual  
underlying cost numbers are taken into account.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/bitmapset.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/bitmapset.h
M src/test/regress/expected/select_parallel.out

While waiting for a condition variable, detect postmaster death.

commit   : 80259d4dbf47d13ef4c105e06c4ea084639d9466    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 12:34:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 12:34:46 -0500    

Click here for diff

The general assumption for postmaster child processes is that they  
should just exit(1), reasonably promptly, if the postmaster disappears.  
condition_variable.c neglected this consideration and could be left  
waiting forever, if the counterpart process it is waiting for has  
done the right thing and exited.  
  
We had some discussion of adjusting the WaitEventSet API to make it  
harder to make this type of mistake in future; but for the moment,  
and for v10, let's make this narrow fix.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix ssl tests for when tls-server-end-point is not supported

commit   : c3d41ccf5931a2e587d114d9886717df76459a9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jan 2018 12:28:49 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jan 2018 12:28:49 -0500    

Click here for diff

Add a function to TestLib that allows us to check pg_config.h and then  
decide the expected test outcome based on that.  
  
Author: Michael Paquier <[email protected]>  

M src/test/perl/TestLib.pm
M src/test/ssl/t/002_scram.pl

Fix race condition during replication origin drop.

commit   : 8a906204aec44de6d8a1514082870f25085d9431    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 12:09:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 12:09:30 -0500    

Click here for diff

replorigin_drop() misunderstood the API for condition variables: it  
had ConditionVariablePrepareToSleep and ConditionVariableCancelSleep  
inside its test-and-sleep loop, rather than outside the loop as  
intended.  The net effect is a narrow race-condition window wherein,  
if the process using a replication slot releases it immediately after  
replorigin_drop() releases the ReplicationOriginLock, replorigin_drop()  
would get into the condition variable's wait list too late and then  
wait indefinitely for a signal that won't come.  
  
Because there's a different CV for each replication slot, we can't  
just move the ConditionVariablePrepareToSleep call to above the  
test-and-sleep loop.  What we can do, in the wake of commit 13db3b936,  
is drop the ConditionVariablePrepareToSleep call entirely.  This fix  
depends on that commit because (at least in principle) the slot matching  
the target replication origin might move around, so that once in a blue  
moon successive loop iterations might involve different CVs.  We can now  
cope with such a scenario, at the cost of an extra trip through the  
retry loop.  
  
(There are ways we could fix this bug without depending on that commit,  
but they're all a lot more complicated than this way.)  
  
While at it, upgrade the rather skimpy comments in this function.  
  
Back-patch to v10 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow ConditionVariable[PrepareTo]Sleep to auto-switch between CVs.

commit   : 13db3b936359eebf02a768db3a1959af880b6cc6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 11:39:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jan 2018 11:39:10 -0500    

Click here for diff

The original coding here insisted that callers manually cancel any prepared  
sleep for one condition variable before starting a sleep on another one.  
While that's not a huge burden today, it seems like a gotcha that will bite  
us in future if the use of condition variables increases; anything we can  
do to make the use of this API simpler and more robust is attractive.  
Hence, allow these functions to automatically switch their attention to  
a different CV when required.  This is safe for the same reason it was OK  
for commit aced5a92b to let a broadcast operation cancel any prepared CV  
sleep: whenever we return to the other test-and-sleep loop, we will  
automatically re-prepare that CV, paying at most an extra test of that  
loop's exit condition.  
  
Back-patch to v10 where condition variables were introduced.  Ordinarily  
we would probably not back-patch a change like this, but since it does not  
invalidate any coding pattern that was legal before, it seems safe enough.  
Furthermore, there's an open bug in replorigin_drop() for which the  
simplest fix requires this.  Even if we chose to fix that in some more  
complicated way, the hazard would remain that we might back-patch some  
other bug fix that requires this behavior.  
  
Patch by me, reviewed by Thomas Munro.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/condition_variable.c
M src/include/storage/condition_variable.h

Don't allow VACUUM VERBOSE ANALYZE VERBOSE.

commit   : 921059bd66c7fb1230c705d3b1a65940800c4cbb    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Jan 2018 10:12:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Jan 2018 10:12:58 -0500    

Click here for diff

There are plans to extend the syntax for ANALYZE, so we need to break  
the link between VacuumStmt and AnalyzeStmt.  But apart from that, the  
syntax above is undocumented and, if discovered by users, might give  
the impression that the VERBOSE option for VACUUM differs from the  
verbose option from ANALYZE, which it does not.  
  
Nathan Bossart, reviewed by Michael Paquier and Masahiko Sawada  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/parser/gram.y

Improve scripting language in pgbench

commit   : bc7fa0c15c590ddf4872e426abd76c2634f22aca    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 9 Jan 2018 18:02:04 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 9 Jan 2018 18:02:04 +0300    

Click here for diff

Added:  
 - variable now might contain integer, double, boolean and null values  
 - functions ln, exp  
 - logical AND/OR/NOT  
 - bitwise AND/OR/NOT/XOR  
 - bit right/left shift  
 - comparison operators  
 - IS [NOT] (NULL|TRUE|FALSE)  
 - conditional choice (in form of when/case/then)  
  
New operations and functions allow to implement more complicated test scenario.  
  
Author: Fabien Coelho with minor editorization by me  
Reviewed-By: Pavel Stehule, Jeevan Ladhe, me  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.10.1604030742390.31618@sto  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix comment.

commit   : 63008b19ee67270231694500832b031868d34428    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Jan 2018 09:39:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Jan 2018 09:39:31 -0500    

Click here for diff

RELATION_IS_OTHER_TEMP is tested in the caller, not here.  
  
Discussion: http://postgr.es/m/[email protected]  

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

pg_upgrade: prevent check on live cluster from generating error

commit   : d25ee30031b08ad1348a090914c2af6bc640a832    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 Jan 2018 22:43:51 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 Jan 2018 22:43:51 -0500    

Click here for diff

Previously an inaccurate but harmless error was generated when running  
--check on a live server before reporting the servers as compatible.  
The fix is to split error reporting and exit control in the exec_prog()  
API.  
  
Reported-by: Daniel Westermann  
  
Backpatch-through: 10  

M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c

Cosmetic improvements in condition_variable.[hc].

commit   : e35dba475a440f73dccf9ed1fd61e3abc6ee61db    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Jan 2018 18:28:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Jan 2018 18:28:03 -0500    

Click here for diff

Clarify a bunch of comments.  
  
Discussion: https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com  

M src/backend/storage/lmgr/condition_variable.c
M src/include/storage/condition_variable.h

Improve error detection capability in proclists.

commit   : ea8e1bbc538444d373cf712a0f5188c906b71a9d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Jan 2018 18:07:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Jan 2018 18:07:04 -0500    

Click here for diff

Previously, although the initial state of a proclist_node is expected  
to be next == prev == 0, proclist_delete_offset would reset nodes to  
next == prev == INVALID_PGPROCNO when removing them from a list.  
This is the same state that a node in a singleton list has, so that  
it's impossible to distinguish not-in-a-list from in-a-list.  Change  
proclist_delete_offset to reset removed nodes to next == prev == 0,  
making it possible to distinguish those cases, and then add Asserts  
to the list add and delete functions that the supplied node isn't  
or is in a list at entry.  Also tighten assertions about the node  
being in the particular list (not some other one) where it is possible  
to check that in O(1) time.  
  
In ConditionVariablePrepareToSleep, since we don't expect the process's  
cvWaitLink to already be in a list, remove the more-or-less-useless  
proclist_contains check; we'd rather have proclist_push_tail's new  
assertion fire if that happens.  
  
Improve various comments related to proclists, too.  
  
Patch by me, reviewed by Thomas Munro.  This isn't back-patchable, since  
there could theoretically be inlined copies of proclist_delete_offset in  
third-party modules.  But it's only improving debuggability anyway.  
  
Discussion: https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com  

M src/backend/storage/lmgr/condition_variable.c
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h

Back off chattiness in RemovePgTempFiles().

commit   : eeb3c2df429c943b2f8d028d110b55ac0a53dc75    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Jan 2018 20:40:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Jan 2018 20:40:40 -0500    

Click here for diff

In commit 561885db0, as part of normalizing RemovePgTempFiles's error  
handling, I removed its behavior of silently ignoring ENOENT failures  
during directory opens.  Thomas Munro points out that this is a bad idea at  
the top level, because we don't create pgsql_tmp directories until needed.  
Thus this coding could produce LOG messages in perfectly normal situations,  
which isn't what I intended.  Restore the suppression of ENOENT logging,  
but only at top level --- it would still be unexpected for a nested temp  
directory to disappear between seeing it in the parent directory and  
opening it.  
  
Discussion: https://postgr.es/m/CAEepm=2y06SehAkTnd5sU_eVqdv5P-=Srt1y5vYNQk6yVDVaPw@mail.gmail.com  

M src/backend/storage/file/fd.c

Add TIMELINE to backup_label file

commit   : 6271fceb8a4f07dafe9d67dcf7e849b319bb2647    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 6 Jan 2018 12:24:19 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 6 Jan 2018 12:24:19 +0000    

Click here for diff

Allows new test to confirm timelines match  
  
Author: Michael Paquier  
Reviewed-by: David Steele  

M src/backend/access/transam/xlog.c
M src/test/perl/PostgresNode.pm

Default monitoring roles - errata

commit   : 6668a54eb8ef639a3182ae9e37e4e67982c44292    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 6 Jan 2018 11:48:21 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 6 Jan 2018 11:48:21 +0000    

Click here for diff

25fff40798fc4ac11a241bfd9ab0c45c085e2212 introduced  
default monitoring roles. Apply these corrections:  
  
* Allow access to pg_stat_get_wal_senders()  
  by role pg_read_all_stats  
  
* Correct comment in pg_stat_get_wal_receiver()  
  to show it is no longer superuser-only.  
  
Author: Feike Steenbergen  
Reviewed-by: Michael Paquier  
  
Apply to HEAD, then later backpatch to 10  

M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c

Remove return values of ConditionVariableSignal/Broadcast.

commit   : ccf312a4488ab8bb38dfd87168bf8915045d1a82    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2018 20:33:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2018 20:33:26 -0500    

Click here for diff

In the wake of commit aced5a92b, the semantics of these results are  
a bit squishy: we can tell whether we signaled some other process(es),  
but we do not know which ones were real waiters versus mere sentinels  
for ConditionVariableBroadcast operations.  It does not help much that  
ConditionVariableBroadcast will attempt to pass on the signal to the  
next real waiter, because (a) there might not be one, and (b) that will  
only happen awhile later, anyway.  So these results could overstate how  
much effect the calls really had.  
  
However, no existing caller of either function pays any attention to its  
result value, so it seems reasonable to just define that as a required  
property of a correct algorithm.  To encourage correctness and save some  
tiny number of cycles, change both functions to return void.  
  
Patch by me, per an observation by Thomas Munro.  No back-patch, since  
if any third parties happen to be using these functions, they might not  
appreciate an API break in a minor release.  
  
Discussion: https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com  

M src/backend/storage/lmgr/condition_variable.c
M src/include/storage/condition_variable.h

Reorder steps in ConditionVariablePrepareToSleep for more safety.

commit   : 3cac0ec85992829c160bdd8a370dd4676d42f58c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2018 19:42:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2018 19:42:49 -0500    

Click here for diff

In the admittedly-very-unlikely case that AddWaitEventToSet fails,  
ConditionVariablePrepareToSleep would error out after already having  
set cv_sleep_target, which is probably bad, and after having already  
set cv_wait_event_set, which is very bad.  Transaction abort might or  
might not clean up cv_sleep_target properly; but there is nothing  
that would be aware that the WaitEventSet wasn't fully constructed,  
so that all future condition variable sleeps would be broken.  
We can easily guard against these hazards with slight restructuring.  
  
Back-patch to v10 where condition_variable.c was introduced.  
  
Discussion: https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com  

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

Rewrite ConditionVariableBroadcast() to avoid live-lock.

commit   : aced5a92bf46532466417ab485bc94006cf60d91    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2018 19:21:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jan 2018 19:21:30 -0500    

Click here for diff

The original implementation of ConditionVariableBroadcast was, per its  
self-description, "the dumbest way possible".  Thomas Munro found out  
it was a bit too dumb.  An awakened process may immediately re-queue  
itself, if the specific condition it's waiting for is not yet satisfied.  
If this happens before ConditionVariableBroadcast is able to see the wait  
queue as empty, then ConditionVariableBroadcast will re-awaken the same  
process, repeating the cycle.  Given unlucky timing this back-and-forth  
can repeat indefinitely; loops lasting thousands of seconds have been  
seen in testing.  
  
To fix, add our own process to the end of the wait queue to serve as a  
sentinel, and exit the broadcast loop once our process is not there  
anymore.  There are various special considerations described in the  
comments, the principal disadvantage being that wakers can no longer  
be sure whether they awakened a real waiter or just a sentinel.  But in  
practice nobody pays attention to the result of ConditionVariableSignal  
or ConditionVariableBroadcast anyway, so that problem seems hypothetical.  
  
Back-patch to v10 where condition_variable.c was introduced.  
  
Tom Lane and Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com  

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

Factor error generation out of ExecPartitionCheck.

commit   : 19c47e7c820241e1befd975cb4411af7d43e1309    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Jan 2018 15:18:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Jan 2018 15:18:03 -0500    

Click here for diff

At present, we always raise an ERROR if the partition constraint  
is violated, but a pending patch for UPDATE tuple routing will  
consider instead moving the tuple to the correct partition.  
Refactor to make that simpler.  
  
Amit Khandekar, reviewed by Amit Langote, David Rowley, and me.  
  
Discussion: http://postgr.es/m/CAJ3gD9cue54GbEzfV-61nyGpijvjZgCcghvLsB0_nL8Nm8HzCA@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h

pg_upgrade: remove C comment

commit   : 84a6f63e32dbefe3dc76cbe628fab6cbfc26141e    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Jan 2018 14:49:36 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Jan 2018 14:49:36 -0500    

Click here for diff

Revert another part of 959ee6d267fb24e667fc64e9837a376e236e84a5 .  
  
Backpatch-through: 10  

M src/bin/pg_upgrade/server.c

pg_upgrade: revert part of patch for ease of translation

commit   : 3e6f01fd7d9b01b17626a6bc38cf664354eede71    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Jan 2018 14:46:27 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Jan 2018 14:46:27 -0500    

Click here for diff

Revert part of 959ee6d267fb24e667fc64e9837a376e236e84a5 .  
  
Backpatch-through: 10  

M src/bin/pg_upgrade/server.c

pg_upgrade: simplify code layout in a few places

commit   : 959ee6d267fb24e667fc64e9837a376e236e84a5    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Jan 2018 14:11:15 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Jan 2018 14:11:15 -0500    

Click here for diff

Backpatch-through: 9.4 (9.3 didn't need improving)  

M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/server.c

Fix failure to delete spill files of aborted transactions

commit   : df9f682c7bf81674b6ae3900fd0146f35df0ae2e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Jan 2018 12:17:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Jan 2018 12:17:10 -0300    

Click here for diff

Logical decoding's reorderbuffer.c may spill transaction files to disk  
when transactions are large.  These are supposed to be removed when they  
become "too old" by xid; but file removal requires the boundary LSNs of  
the transaction to be known.  The final_lsn is only set when we see the  
commit or abort record for the transaction, but nothing sets the value  
for transactions that crash, so the removal code misbehaves -- in  
assertion-enabled builds, it crashes by a failed assertion.  
  
To fix, modify the final_lsn of transactions that don't have a value  
set, to the LSN of the very latest change in the transaction.  This  
causes the spilled files to be removed appropriately.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Kyotaro HORIGUCHI, Craig Ringer, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

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

Another attempt at fixing build with various OpenSSL versions

commit   : 054e8c6cdb7f4261869e49d3ed7705cca475182e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 19:09:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 19:09:27 -0500    

Click here for diff

It seems we can't easily work around the lack of  
X509_get_signature_nid(), so revert the previous attempts and just  
disable the tls-server-end-point feature if we don't have it.  

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

Add missing includes

commit   : 1834c1e432d22f9e186950c7dd8598958776e016    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 17:55:14 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 17:55:14 -0500    

Click here for diff

<openssl/x509.h> is necessary to look into the X509 struct, used by  
ac3ff8b1d8f98da38c53a701e6397931080a39cf.  

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

Minor preparatory refactoring for UPDATE row movement.

commit   : ef6087ee5fa84206dc24ba1339e229354b05cf2a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Jan 2018 16:25:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Jan 2018 16:25:49 -0500    

Click here for diff

Generalize is_partition_attr to has_partition_attrs and make it  
accessible from outside tablecmds.c.  Change map_partition_varattnos  
to clarify that it can be used for mapping between any two relations  
in a partitioning hierarchy, not just parent -> child.  
  
Amit Khandekar, reviewed by Amit Langote, David Rowley, and me.  
Some comment changes by me.  
  
Discussion: http://postgr.es/m/CAJ3gD9fWfxgKC+PfJZF3hkgAcNOy-LpfPxVYitDEXKHjeieWQQ@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/include/catalog/partition.h

Fix build with older OpenSSL versions

commit   : ac3ff8b1d8f98da38c53a701e6397931080a39cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 16:22:06 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 16:22:06 -0500    

Click here for diff

Apparently, X509_get_signature_nid() is only in fairly new OpenSSL  
versions, so use the lower-level interface it is built on instead.  

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

Fix new test case to not be endian-dependent.

commit   : 18869e202b74f36d504c5c3c7d9db9c186039eba    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2018 15:59:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2018 15:59:29 -0500    

Click here for diff

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

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql

Simplify and encapsulate tuple routing support code.

commit   : cc6337d2fed598d4b5ac54d9a62708182b83a81e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Jan 2018 15:48:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Jan 2018 15:48:15 -0500    

Click here for diff

Instead of having ExecSetupPartitionTupleRouting return multiple out  
parameters, have it return a pointer to a structure containing all of  
those different things.  Also, provide and use a cleanup function,  
ExecCleanupTupleRouting, instead of cleaning up all of the resources  
allocated by ExecSetupPartitionTupleRouting individually.  
  
Amit Khandekar, reviewed by Amit Langote, David Rowley, and me  
  
Discussion: http://postgr.es/m/CAJ3gD9fWfxgKC+PfJZF3hkgAcNOy-LpfPxVYitDEXKHjeieWQQ@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h

Implement channel binding tls-server-end-point for SCRAM

commit   : d3fb72ea6de58d285e278459bca9d7cdf7f6a38b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 15:18:39 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 15:18:39 -0500    

Click here for diff

This adds a second standard channel binding type for SCRAM.  It is  
mainly intended for third-party clients that cannot implement  
tls-unique, for example JDBC.  
  
Author: Michael Paquier <[email protected]>  

M doc/src/sgml/protocol.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/be-secure-openssl.c
M src/include/common/scram-common.h
M src/include/libpq/libpq-be.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/002_scram.pl

Fix incorrect computations of length of null bitmap in pageinspect.

commit   : 39cfe86195f0b5cbc5fbe8d4e3aa6e2b0e322d0b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2018 14:59:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2018 14:59:00 -0500    

Click here for diff

Instead of using our standard macro for this calculation, this code  
did it itself ... and got it wrong, leading to incorrect display of  
the null bitmap in some cases.  Noted and fixed by Maksim Milyutin.  
  
In passing, remove a uselessly duplicative error check.  
  
Errors were introduced in commit d6061f83a; back-patch to 9.6  
where that came in.  
  
Maksim Milyutin, reviewed by Andrey Borodin  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/sql/page.sql

Refactor channel binding code to fetch cbind_data only when necessary

commit   : f3049a603a7950f313b33ab214f11563c66dc069    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 13:53:09 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 13:53:09 -0500    

Click here for diff

As things stand now, channel binding data is fetched from OpenSSL and  
saved into the SCRAM exchange context for any SSL connection attempted  
for a SCRAM authentication, resulting in data fetched but not used if no  
channel binding is used or if a different channel binding type is used  
than what the data is here for.  
  
Refactor the code in such a way that binding data is fetched from the  
SSL stack only when a specific channel binding is used for both the  
frontend and the backend.  In order to achieve that, save the libpq  
connection context directly in the SCRAM exchange state, and add a  
dependency to SSL in the low-level SCRAM routines.  
  
This makes the interface in charge of initializing the SCRAM context  
cleaner as all its data comes from either PGconn* (for frontend) or  
Port* (for the backend).  
  
Author: Michael Paquier <[email protected]>  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h

Define LDAPS_PORT if it's missing and disable implicit LDAPS on Windows

commit   : 3ad2afc2e98fc85d5cf9529d84265b70acc0b13d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 10:34:41 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jan 2018 10:34:41 -0500    

Click here for diff

Some versions of Windows don't define LDAPS_PORT.  
  
Also, Windows' ldap_sslinit() is documented to use LDAPS even if you  
said secure=0 when the port number happens to be 636 or 3269.  Let's  
avoid using the port number to imply that you want LDAPS, so that  
connection strings have the same meaning on Windows and Unix.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CAEepm%3D23B7GV4AUz3MYH1TKpTv030VHxD2Sn%2BLYWDv8d-qWxww%40mail.gmail.com  

M src/backend/libpq/auth.c

Code review for Parallel Append.

commit   : c759395617765c5bc21db149cf8c3df52f41ccff    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Jan 2018 07:56:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Jan 2018 07:56:09 -0500    

Click here for diff

- Remove unnecessary #include mistakenly added in execnodes.h.  
- Fix mistake in comment in choose_next_subplan_for_leader.  
- Adjust row estimates in cost_append for a possibly-different  
  parallel divisor.  
- Clamp row estimates in cost_append after operations that may  
  not produce integers.  
  
Amit Kapila, with cosmetic adjustments by me.  
  
Discussion: http://postgr.es/m/CAA4eK1+qcbeai3coPpRW=GFCzFeLUsuY4T-AKHqMjxpEGZBPQg@mail.gmail.com  

M src/backend/executor/nodeAppend.c
M src/backend/optimizer/path/costsize.c
M src/include/nodes/execnodes.h

Tweak parallel hash join test case in hopes of improving stability.

commit   : 934c7986f4a0a6a3b606301d84b784a27c0c324b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2018 01:06:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jan 2018 01:06:58 -0500    

Click here for diff

This seems to make things better on gaur, let's see what the rest  
of the buildfarm thinks.  
  
Thomas Munro  
  
Discussion: https://postgr.es/m/CAEepm=1uuT8iJxMEsR=jL+3zEi87DB2v0+0H9o_rUXXCZPZT3A@mail.gmail.com  

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

Clean up tupdesc.c for recent changes.

commit   : 47c6772eb7222dbfa200db4bbeba8002b96b7976    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2018 17:53:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2018 17:53:06 -0500    

Click here for diff

TupleDescCopy needs to have the same effects as CreateTupleDescCopy in  
that, since it doesn't copy constraints, it should clear the per-attribute  
fields associated with them.  Oversight in commit cc5f81366.  
  
Since TupleDescCopy has already established the presumption that it  
can just flat-copy the entire attribute array in one go, propagate  
that approach into CreateTupleDescCopy and CreateTupleDescCopyConstr.  
(I'm suspicious that this would lead to valgrind complaints if we  
had any trailing padding in the struct, but we do not, and anyway  
fixing that seems like a job for a separate commit.)  
  
Add some better comments.  
  
Thomas Munro, reviewed by Vik Fearing, some additional hacking by me  
  
Discussion: https://postgr.es/m/CAEepm=0NvOGZ8B6GbQyQe2C_c2m3LKJ9w=8OMBaYRLgZ_Gw6Nw@mail.gmail.com  

M src/backend/access/common/tupdesc.c

Fix typo

commit   : bab2969867fbba6a6d12730f36a20d13542aea5a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 19:12:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 19:12:06 -0300    

Click here for diff

Author: Dagfinn Ilmari MannsƄker  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Fix isolation test to be less timing-dependent"

commit   : 6c8be5962aea2eee8c366c01bbbcf5bf5ddf5294    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 11:16:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 11:16:34 -0300    

Click here for diff

This reverts commit 2268e6afd596.  It turned out that inconsistency in  
the report is still possible, so go back to the simpler formulation of  
the test and instead add an alternate expected output.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/multiple-cic.out
A src/test/isolation/expected/multiple-cic_1.out
M src/test/isolation/specs/multiple-cic.spec

Rename pg_rewind's copy_file_range() to avoid conflict with new linux syscall.

commit   : 3e68686e2c55799234ecd020bd1621f913d65475    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Jan 2018 12:00:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Jan 2018 12:00:11 -0800    

Click here for diff

Upcoming versions of glibc will contain copy_file_range(2), a wrapper  
around a new linux syscall for in-kernel copying of data ranges. This  
conflicts with pg_rewinds function of the same name.  
  
Therefore rename pg_rewinds version. As our version isn't a generic  
copying facility we decided to choose a rewind specific function name.  
  
Per buildfarm animal caiman and subsequent discussion with Tom Lane.  
  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
Backpatch: 9.5-, where pg_rewind was introduced  

M src/bin/pg_rewind/copy_fetch.c

Fix use of config-specific libraries for Windows OpenSSL

commit   : 99d5a3ffb9fe61a5a8b01a4759d93c627f018923    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 3 Jan 2018 15:26:39 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 3 Jan 2018 15:26:39 -0500    

Click here for diff

Commit 614350a3 allowed for an different builds of OpenSSL libraries on  
Windows, but ignored the fact that the alternative builds don't have  
config-specific libraries. This patch fixes the Solution file to ask for  
the correct libraries.  
  
per offline discussions with Leonardo Cecchi and Marco Nenciarini,  
  
Backpatch to all live branches.  

M src/tools/msvc/Solution.pm

Make XactLockTableWait work for transactions that are not yet self-locked

commit   : 3c27944fb2141d8bd3942cb57e872174c6e1db97    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 17:26:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 17:26:20 -0300    

Click here for diff

XactLockTableWait assumed that its xid argument has already added itself  
to the lock table.  That assumption led to another assumption that if  
locking the xid has succeeded but the xid is reported as still in  
progress, then the input xid must have been a subtransaction.  
  
These assumptions hold true for the original uses of this code in  
locking related to on-disk tuples, but they break down in logical  
replication slot snapshot building -- in particular, when a standby  
snapshot logged contains an xid that's already in ProcArray but not yet  
in the lock table.  This leads to assertion failures that can be  
reproduced all the way back to 9.4, when logical decoding was  
introduced.  
  
To fix, change SubTransGetParent to SubTransGetTopmostTransaction which  
has a slightly different API: it returns the argument Xid if there is no  
parent, and it goes all the way to the top instead of moving up the  
levels one by one.  Also, to avoid busy-waiting, add a 1ms sleep to give  
the other process time to register itself in the lock table.  
  
For consistency, change ConditionalXactLockTableWait the same way.  
  
Author: Petr JelĆ­nek  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Konstantin Knizhnik  
Diagnosed-by: Stas Kelvich, Petr JelĆ­nek  
Reviewed-by: Andres Freund, Robert Haas  

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

Fix some minor errors in new PHJ code.

commit   : 6fcde24063047c1195d023dfa08309302987cdcf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2018 12:53:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2018 12:53:49 -0500    

Click here for diff

Correct ExecParallelHashTuplePrealloc's estimate of whether the  
space_allowed limit is exceeded.  Be more consistent about tuples that  
are exactly HASH_CHUNK_THRESHOLD in size (they're "small", not "large").  
Neither of these things explain the current buildfarm unhappiness, but  
they're still bugs.  
  
Thomas Munro, per gripe by me  
  
Discussion: https://postgr.es/m/CAEepm=34PDuR69kfYVhmZPgMdy8pSA-MYbpesEN1SR+2oj3Y+w@mail.gmail.com  

M src/backend/executor/nodeHash.c

Teach eval_const_expressions() to handle some more cases.

commit   : 3decd150a2d5a8f8d43010dd0c207746ba946303    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2018 12:35:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jan 2018 12:35:09 -0500    

Click here for diff

Add some infrastructure (mostly macros) to make it easier to write  
typical cases for constant-expression simplification.  Add simplification  
processing for ArrayRef, RowExpr, and ScalarArrayOpExpr node types,  
which formerly went unsimplified even if all their inputs were constants.  
Also teach it to simplify FieldSelect from a composite constant.  
Make use of the new infrastructure to reduce the amount of code needed  
for the existing ArrayExpr and ArrayCoerceExpr cases.  
  
One existing test case changes output as a result of the fact that  
RowExpr can now be folded to a constant.  All the new code is exercised  
by existing test cases according to gcov, so I feel no need to add  
additional tests.  
  
Tom Lane, reviewed by Dmitry Dolgov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rowtypes.out

Allow ldaps when using ldap authentication

commit   : 35c0754fadca8010955f6b10cb47af00bdbe1286    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2018 10:00:08 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jan 2018 10:00:08 -0500    

Click here for diff

While ldaptls=1 provides an RFC 4513 conforming way to do LDAP  
authentication with TLS encryption, there was an earlier de facto  
standard way to do LDAP over SSL called LDAPS.  Even though it's not  
enshrined in a standard, it's still widely used and sometimes required  
by organizations' network policies.  There seems to be no reason not to  
support it when available in the client library.  Therefore, add support  
when using OpenLDAP 2.4+ or Windows.  It can be configured with  
ldapscheme=ldaps or ldapurl=ldaps://...  
  
Add tests for both ways of requesting LDAPS and a test for the  
pre-existing ldaptls=1.  Modify the 001_auth.pl test for "diagnostic  
messages", which was previously relying on the server rejecting  
ldaptls=1.  
  
Author: Thomas Munro  
Reviewed-By: Peter Eisentraut  
Discussion: https://postgr.es/m/CAEepm=1s+pA-LZUjQ-9GQz0Z4rX_eK=DFXAF1nBQ+ROPimuOYQ@mail.gmail.com  

M configure
M configure.in
M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h
M src/include/pg_config.h.in
M src/test/ldap/t/001_auth.pl

Fix isolation test to be less timing-dependent

commit   : 2268e6afd59649d6bf6d114a19e9c492d59b43fc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 11:16:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Jan 2018 11:16:42 -0300    

Click here for diff

I did this by adding another locking process, which makes the other two  
wait.  This way the output should be stable enough.  
  
Per buildfarm and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/multiple-cic.out
M src/test/isolation/specs/multiple-cic.spec

commit   : 9d4649ca49416111aee2c84b7e4441a0b7aa2fac    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 2 Jan 2018 23:30:12 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 2 Jan 2018 23:30:12 -0500    

Click here for diff

Backpatch-through: certain files through 9.3  

M COPYRIGHT
M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/dblink/dblink.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_selfuncs.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/knapsack.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/lib/stringinfo.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/port/atomics.c
M src/backend/port/dynloader/aix.h
M src/backend/port/dynloader/cygwin.h
M src/backend/port/dynloader/freebsd.c
M src/backend/port/dynloader/freebsd.h
M src/backend/port/dynloader/hpux.c
M src/backend/port/dynloader/hpux.h
M src/backend/port/dynloader/linux.c
M src/backend/port/dynloader/linux.h
M src/backend/port/dynloader/netbsd.c
M src/backend/port/dynloader/netbsd.h
M src/backend/port/dynloader/openbsd.c
M src/backend/port/dynloader/openbsd.h
M src/backend/port/dynloader/solaris.h
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/mingwcompat.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/smgr/smgrtype.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/backend_random.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/logging.c
M src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/conditional.c
M src/bin/psql/conditional.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/base64.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/exec.c
M src/common/fe_memutils.c
M src/common/file_utils.c
M src/common/ip.c
M src/common/keywords.c
M src/common/md5.c
M src/common/pg_lzcompress.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha2.c
M src/common/sha2_openssl.c
M src/common/string.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/fe_utils/Makefile
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupmacs.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/opfam_internal.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_aggregate_fn.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_constraint_fn.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_conversion_fn.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_inherits_fn.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_operator_fn.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_type_fn.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/base64.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/fe_memutils.h
M src/include/common/file_utils.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/keywords.h
M src/include/common/md5.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/relation.h
M src/include/nodes/replnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/win32_port.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/basebackup.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_random.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/dynamic_loader.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hashutils.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/nabstime.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tqual.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/pg_type.h
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq.rc.in
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/pl/tcl/generate-pltclerrcodes.pl
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/fls.c
M src/port/fseeko.c
M src/port/getaddrinfo.c
M src/port/getpeereid.c
M src/port/getrusage.c
M src/port/isinf.c
M src/port/kill.c
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_crc32c_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pqsignal.c
M src/port/quotes.c
M src/port/random.c
M src/port/sprompt.c
M src/port/srandom.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/ldap/Makefile
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
M src/test/recovery/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/subscription/Makefile
M src/test/thread/Makefile
M src/test/thread/thread_test.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/findoidjoins/Makefile
M src/tools/findoidjoins/findoidjoins.c
M src/tools/fix-old-flex-code.pl
M src/tools/ifaddrs/Makefile
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Simplify representation of aggregate transition values a bit.

commit   : f9ccf92e16fc4d831d324c7f7ef347a0acdaef0a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 2 Jan 2018 18:02:37 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 2 Jan 2018 18:02:37 -0800    

Click here for diff

Previously aggregate transition values for hash and other forms of  
aggregation (i.e. sort and no group by) were represented  
differently. Hash based aggregation used a grouping set indexed array  
pointing to an array of transition values, whereas other forms of  
aggregation used one flattened array with the index being computed out  
of grouping set and transition offsets.  
  
That made upcoming changes hard, so represent both as grouping set  
indexed array of per-group data.  
  
As a nice side-effect this also makes aggregation slightly faster,  
because computing offsets with `transno + (setno * numTrans)` turns  
out not to be that cheap (too big for x86 lea for example).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Ensure proper alignment of tuples in HashMemoryChunkData buffers.

commit   : 5dc692f78d3bee1e86d095a9e8d9242b44f78b01    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jan 2018 21:23:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jan 2018 21:23:02 -0500    

Click here for diff

The previous coding relied (without any documentation) on the data[]  
member of HashMemoryChunkData being at a MAXALIGN'ed offset.  If it  
was not, the tuples would not be maxaligned either, leading to failures  
on alignment-picky machines.  While there seems to be no live bug on any  
platform we support, this is clearly pretty fragile: any addition to or  
rearrangement of the fields in HashMemoryChunkData could break it.  
Let's remove the hazard by getting rid of the data[] member and instead  
using pointer arithmetic with an explicitly maxalign'ed offset.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeHash.c
M src/include/executor/hashjoin.h

Fix deadlock hazard in CREATE INDEX CONCURRENTLY

commit   : 54eff5311d7c8e3d309774713b91e78067d2ad42    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Jan 2018 19:16:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Jan 2018 19:16:16 -0300    

Click here for diff

Multiple sessions doing CREATE INDEX CONCURRENTLY simultaneously are  
supposed to be able to work in parallel, as evidenced by fixes in commit  
c3d09b3bd23f specifically to support this case.  In reality, one of the  
sessions would be aborted by a misterious "deadlock detected" error.  
  
Jeff Janes diagnosed that this is because of leftover snapshots used for  
system catalog scans -- this was broken by 8aa3e47510b9 keeping track of  
(registering) the catalog snapshot.  To fix the deadlocks, it's enough  
to de-register that snapshot prior to waiting.  
  
Backpatch to 9.4, which introduced MVCC catalog scans.  
  
Include an isolationtester spec that 8 out of 10 times reproduces the  
deadlock with the unpatched code for me (Ɓlvaro).  
  
Author: Jeff Janes  
Diagnosed-by: Jeff Janes  
Reported-by: Jeremy Finzel  
Discussion: https://postgr.es/m/CAMa1XUhHjCv8Qkx0WOr1Mpm_R4qxN26EibwCrj0Oor2YBUFUTg%40mail.gmail.com  

M src/backend/commands/indexcmds.c
A src/test/isolation/expected/multiple-cic.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/multiple-cic.spec

Don't cast between GinNullCategory and bool

commit   : 438036264a3b71eaf39b2d2eeca67237ed38ca51    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2017 13:47:18 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2017 13:47:18 -0500    

Click here for diff

The original idea was that we could use an isNull-style bool array  
directly as a GinNullCategory array.  However, the existing code already  
acknowledges that that doesn't really work, because of the possibility  
that bool as currently defined can have arbitrary bit patterns for true  
values.  So it has to loop through the nullFlags array to set each bool  
value to an acceptable value.  But if we are looping through the whole  
array anyway, we might as well build a proper GinNullCategory array  
instead and abandon the type casting.  That makes the code much safer in  
case bool is ever changed to something else.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/include/access/ginblock.h

Fix EXPLAIN ANALYZE output for Parallel Hash.

commit   : 93ea78b17c4743c2b63edb5998fb5796ae57e289    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Jan 2018 14:38:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Jan 2018 14:38:23 -0800    

Click here for diff

In a race case, EXPLAIN ANALYZE could fail to display correct nbatch  
and size information.  Refactor so that participants report only on  
batches they worked on rather than trying to report on all of them,  
and teach explain.c to consider the HashInstrumentation object from  
all participants instead of picking the first one it can find.  This  
should fix an occasional build farm failure in the "join" regression  
test.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/30219.1514428346%40sss.pgh.pa.us  

M src/backend/commands/explain.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/include/executor/nodeHash.h

In tests, await an LSN no later than the recovery target.

commit   : 6078770c1a6c247bb74742cb1b82733cce8afcab    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 31 Dec 2017 21:58:29 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 31 Dec 2017 21:58:29 -0800    

Click here for diff

Otherwise, the test fails with "Timed out while waiting for standby to  
catch up".  This happened rarely, perhaps only when autovacuum wrote WAL  
between our choosing the recovery target and choosing the LSN to await.  
Commit b26f7fa6ae2b4e5d64525b3d5bc66a0ddccd9e24 fixed one case of this.  
Fix two more.  Back-patch to 9.6, which introduced the affected test.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Merge coding of return/exit/continue cases in plpgsql's loop statements.

commit   : 3e724aac74e8325fe48dac8a30c2a7974eff7a14    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Dec 2017 17:20:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Dec 2017 17:20:17 -0500    

Click here for diff

plpgsql's five different loop control statements contained three distinct  
implementations of the same (or what ought to be the same, at least)  
logic for handling return/exit/continue result codes from their child  
statements.  At best, that's trouble waiting to happen, and there seems  
no very good reason for the coding to be so different.  Refactor so that  
all the common logic is expressed in a single macro.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_exec.c

Improve regression tests' code coverage for plpgsql control structures.

commit   : dd2243f2ade43bcad8e615e6cf4286be250e374a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Dec 2017 17:04:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Dec 2017 17:04:11 -0500    

Click here for diff

I noticed that our code coverage report showed considerable deficiency  
in test coverage for PL/pgSQL control statements.  Notably, both  
exec_stmt_block and most of the loop control statements had very poor  
coverage of handling of return/exit/continue result codes from their  
child statements; and exec_stmt_fori was seriously lacking in feature  
coverage, having no test that exercised its BY or REVERSE features,  
nor verification that its overflow defenses work.  
  
Now that we have some infrastructure for plpgsql-specific test scripts,  
the natural thing to do is make a new script rather than further extend  
plpgsql.sql.  So I created a new script plpgsql_control.sql with the  
charter to test plpgsql control structures, and moved a few existing  
tests there because they fell entirely under that charter.  I then  
added new test cases that exercise the bits of code complained of above.  
  
Of the five kinds of loop statements, only exec_stmt_while's result code  
handling is fully exercised by these tests.  That would be a deficiency  
as things stand, but a follow-on commit will merge the loop statements'  
result code handling into one implementation.  So testing each usage of  
that implementation separately seems redundant.  
  
In passing, also add a couple test cases to plpgsql.sql to more fully  
exercise plpgsql's code related to expanded arrays --- I had thought  
that area was sufficiently covered already, but the coverage report  
showed a couple of un-executed code paths.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_control.out
A src/pl/plpgsql/src/sql/plpgsql_control.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Fix typo

commit   : 5303ffe71b4d28663e0881199bb1a5ea26217ce4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 29 Dec 2017 18:32:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 29 Dec 2017 18:32:32 -0300    

Click here for diff

M src/bin/pg_basebackup/pg_recvlogical.c

Perform slot validity checks in a separate pass over expression.

commit   : b40933101ca622aa8a35b6fe07ace36effadf1c7    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Dec 2017 12:38:15 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Dec 2017 12:38:15 -0800    

Click here for diff

This reduces code duplication a bit, but the primary benefit that it  
makes JITing expression evaluation easier. When doing so we can't, as  
previously done in the interpreted case, really change opcode without  
recompiling. Nor dow we just carry around unnecessary branches to  
avoid re-checking over and over.  
  
As a minor side-effect this makes ExecEvalStepOp() O(log(N)) rather  
than O(N).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h
M src/include/nodes/execnodes.h

Rely on executor utils to build targetlist for DML RETURNING.

commit   : 4717fdb14cf0a62ffe1b1023e1c5ea8866e34fa0    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Dec 2017 12:26:29 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Dec 2017 12:26:29 -0800    

Click here for diff

This is useful because it gets rid of the sole direct user of  
ExecAssignResultType(). A future commit will likely make use of that  
and combine creating the targetlist with the initialization of the  
result slot. But it seems like good code hygiene anyway.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Properly set base backup backends to active in pg_stat_activity

commit   : d02974e32e028fc078d8f5eca1d6a4516efb0aa6    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 29 Dec 2017 16:19:51 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 29 Dec 2017 16:19:51 +0100    

Click here for diff

When walsenders were included in pg_stat_activity, only the ones  
actually streaming WAL were listed as active when they were active. In  
particular, the connections sending base backups were listed as being  
idle. Which means that a regular pg_basebackup would show up with one  
active and one idle connection, when both were active.  
  
This patch updates to set all walsenders to active when they are  
(including those doing very fast things like IDENTIFY_SYSTEM), and then  
back to idle. Details about exactly what they are doing is available in  
pg_stat_replication.  
  
Patch by me, review by Michael Paquier and David Steele.  

M src/backend/replication/walsender.c

Fix race condition when changing synchronous_standby_names

commit   : 48c9f4926562278a2fd2b85e7486c6d11705f177    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 29 Dec 2017 14:30:33 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 29 Dec 2017 14:30:33 +0000    

Click here for diff

A momentary window exists when synchronous_standby_names  
changes that allows commands issued after the change to  
continue to act as async until the change becomes visible.  
Remove the race by using more appropriate test in syncrep.c  
  
Author: Asim Rama Praveen and Ashwin Agrawal  
Reported-by: Xin Zhang, Ashwin Agrawal, and Asim Rama Praveen  
Reviewed-by: Michael Paquier, Masahiko Sawada  

M src/backend/replication/syncrep.c

Extend near-wraparound hints to include replication slots

commit   : 2958a672b1fed35403b23c2b453aede9f7ef4b39    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 29 Dec 2017 14:01:25 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 29 Dec 2017 14:01:25 +0000    

Click here for diff

Author: Feike Steenbergen  
Reviewed-by: Michael Paquier  

M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/transam/multixact.c
M src/backend/access/transam/varsup.c
M src/backend/commands/vacuum.c

Allow leading zero on exponents in pgbench test results

commit   : 0aa1d489ea756b96b6d5573692ae9cd5d143c2a5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Dec 2017 08:40:18 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Dec 2017 08:40:18 -0500    

Click here for diff

Following commit 7a727c18 this is found to be necessary on at least some  
Windows platforms.  
  
per buildfarm.  

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

Fix rare assertion failure in parallel hash join.

commit   : f83040c62a78e784e6e33a6382a55925bfd66634    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Dec 2017 02:41:53 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Dec 2017 02:41:53 -0800    

Click here for diff

When a backend runs out of inner tuples to hash, it should detach from  
grow_batch_barrier only after it has flushed all batches to disk and  
merged counters, not before.  Otherwise a concurrent backend in  
ExecParallelHashIncreaseNumBatches() could stop waiting for this  
backend and try to read tuples before they have been written.  This  
commit reorders those operations and should fix the assertion failures  
seen occasionally on the build farm since commit  
1804284042e659e7d16904e7bbb0ad546394b6a3.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/E1eRwXy-0004IK-TO%40gemulon.postgresql.org  

M src/backend/executor/nodeHash.c

Protect against hypothetical memory leaks in RelationGetPartitionKey

commit   : be2343221fb74bde6b7445feeef32f7ea5cf2618    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 27 Dec 2017 18:01:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 27 Dec 2017 18:01:37 -0300    

Click here for diff

Also, fix a comment that commit 8a0596cb656e made obsolete.  
  
Reported-by: Robert Haas  
Discussion: http://postgr.es/m/CA+TgmoYbpuUUUp2GhYNwWm0qkah39spiU7uOiNXLz20ASfKYoA@mail.gmail.com  

M src/backend/utils/cache/relcache.c
M src/include/access/hash.h

Remove incorrect apostrophe.

commit   : b726eaa37a59d0cae0be56457c9522db7288255d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2017 11:01:47 -0800    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2017 11:01:47 -0800    

Click here for diff

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

M contrib/postgres_fdw/postgres_fdw.c

Fix race-under-concurrency in PathNameCreateTemporaryDir.

commit   : 62d02f39e72a2c030711a772f00f47f51262803c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2017 10:56:14 -0800    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2017 10:56:14 -0800    

Click here for diff

Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=1Vp1e3KtftLtw4B60ZV9teNeKu6HxoaaBptQMsRWjJbQ@mail.gmail.com  

M src/backend/storage/file/fd.c

Add pow(), aka power(), function to pgbench.

commit   : 7a727c180aa3c3baba12957d4cbec7b022ba4be5    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2017 10:24:33 -0800    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Dec 2017 10:24:33 -0800    

Click here for diff

RaĆŗl MarĆ­n RodrĆ­guez, reviewed by Fabien Coelho and Michael Paquier,  
with a minor fix by me.  
  
Discussion: http://postgr.es/m/CAM6_UM4XiA14y9HnDqu9kAAOtwMhHZxW--q_ZACZW9Hsrsf-tg@mail.gmail.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl

Update relation's stats in pg_class during vacuum full.

commit   : ad337c76b6f454157982309089c3302fe77c9cbc    
  
author   : Teodor Sigaev <[email protected]>    
date     : Wed, 27 Dec 2017 18:25:37 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Wed, 27 Dec 2017 18:25:37 +0300    

Click here for diff

Hash index depends on estimation of numbers of tuples and pages of relations,  
incorrect value could be a reason of significantly growing of index. Vacuum  
full recreates heap and reindex all indexes before renewal stats. The patch  
fixes that, so indexes will see correct values.  
  
Backpatch to v10 only because earlier versions haven't usable hash index and  
growing of hash index is a single user-visible symptom.  
  
Author: Amit Kapila  
Reviewed-by: Ashutosh Sharma, me  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/cluster.c

Add support for static assertions in C++

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

Click here for diff

This allows modules written in C++ to use or include header files that  
use StaticAssertStmt() etc.  
  
Reviewed-by: Tom Lane <[email protected]>  

M src/include/c.h

Add includes to make header files self-contained

commit   : 0689dc3a235a12c58910fba325f0150979d0c81f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2017 10:21:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Dec 2017 10:21:27 -0500    

Click here for diff

M src/include/executor/nodeHashjoin.h
M src/include/utils/sharedtuplestore.h

Add polygon opclass for SP-GiST

commit   : ff963b393ca93a71d2f398c4c584b322cd351c2c    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 25 Dec 2017 18:59:38 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 25 Dec 2017 18:59:38 +0300    

Click here for diff

Polygon opclass uses compress method feature of SP-GiST added earlier. For now  
it's a single operator class which uses this feature. SP-GiST actually indexes  
a bounding boxes of input polygons, so part of supported operations are lossy.  
Opclass uses most methods of corresponding opclass over boxes of SP-GiST and  
treats bounding boxes as point in 4D-space.  
  
Bump catalog version.  
  
Authors: Nikita Glukhov, Alexander Korotkov with minor editorization by me  
Reviewed-By: all authors + Darafei Praliaskouski  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/spgist.sgml
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_proc.h
M src/include/utils/geo_decls.h
M src/test/regress/expected/polygon.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/polygon.sql

Fix assert with side effects in the new PHJ code.

commit   : 4e2970f8807f1ccfc8029979a70dc80ee102ce48    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 24 Dec 2017 02:57:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 24 Dec 2017 02:57:55 -0800    

Click here for diff

Instead of asserting the assert just set the value to what it was  
supposed to test...  
  
Per coverity.  

M src/backend/executor/nodeHash.c

Fix UNION/INTERSECT/EXCEPT over no columns.

commit   : c4c2885cbb1803f772e58f6db4c8951d8cd672cd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Dec 2017 12:08:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Dec 2017 12:08:06 -0500    

Click here for diff

Since 9.4, we've allowed the syntax "select union select" and variants  
of that.  However, the planner wasn't expecting a no-column set operation  
and ended up treating the set operation as if it were UNION ALL.  
  
Turns out it's trivial to fix in v10 and later; we just need to be careful  
about not generating a Sort node with no sort keys.  However, since a weird  
corner case like this is never going to be exercised by developers, we'd  
better have thorough regression tests if we want to consider it supported.  
  
Per report from Victor Yegorov.  
  
Discussion: https://postgr.es/m/CAGnEbojGJrRSOgJwNGM7JSJZpVAf8xXcVPbVrGdhbVEHZ-BUMw@mail.gmail.com  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Add optional compression method to SP-GiST

commit   : 854823fa334cb826eed50da751801d0693b10173    
  
author   : Teodor Sigaev <[email protected]>    
date     : Fri, 22 Dec 2017 13:33:16 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Fri, 22 Dec 2017 13:33:16 +0300    

Click here for diff

Patch allows to have different types of column and value stored in leaf tuples  
of SP-GiST. The main application of feature is to transform complex column type  
to simple indexed type or for truncating too long value, transformation could  
be lossy.  Simple example: polygons are converted to their bounding boxes,  
this opclass follows.  
  
Authors: me, Heikki Linnakangas, Alexander Korotkov, Nikita Glukhov  
Reviewed-By: all authors + Darafei Praliaskouski  
Discussions:  
https://www.postgresql.org/message-id/[email protected]  
https://www.postgresql.org/message-id/flat/[email protected]#[email protected]  

M doc/src/sgml/spgist.sgml
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvalidate.c
M src/include/access/spgist.h
M src/include/access/spgist_private.h

Minor edits to catalog files and scripts

commit   : 9373baa0f764392c504df034afd2f6b178c29491    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Dec 2017 19:07:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Dec 2017 19:07:32 -0300    

Click here for diff

This fixes a few typos and small mistakes; it also cleans a few  
minor stylistic issues.  The biggest functional change is that  
Gen_fmgrtab.pl no longer knows the OID of language 'internal'.  
  
Author: John Naylor  
Discussion: https://postgr.es/m/CAJVSVGXAkwbk-A9QHHHf00N905kKisyQbaYwKqaRpze_gPXGfg@mail.gmail.com  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_subscription_rel.h

Adjust assertion in GetCurrentCommandId.

commit   : cce1ecfc77385233664de661d6a1b8b3c5d3d3f5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2017 13:10:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2017 13:10:51 -0500    

Click here for diff

currentCommandIdUsed is only used to skip redundant increments of the  
command counter, and CommandCounterIncrement() is categorically denied  
under parallelism anyway.  Therefore, it's OK for  
GetCurrentCommandId() to mark the counter value used, as long as it  
happens in the leader, not a worker.  
  
Prior to commit e9baa5e9fa147e00a2466ab2c40eb99c8a700824, the slightly  
incorrect check didn't matter, but now it does.  A test case added by  
commit 1804284042e659e7d16904e7bbb0ad546394b6a3 uncovered the problem  
by accident; it caused failures with force_parallel_mode=on/regress.  
  
Report and review by Andres Freund.  Patch by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Rearrange execution of PARAM_EXTERN Params for plpgsql's benefit.

commit   : 6719b238e8f0ea83c39d2b1728c7670cdaa34e06    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2017 12:57:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2017 12:57:41 -0500    

Click here for diff

This patch does three interrelated things:  
  
* Create a new expression execution step type EEOP_PARAM_CALLBACK  
and add the infrastructure needed for add-on modules to generate that.  
As discussed, the best control mechanism for that seems to be to add  
another hook function to ParamListInfo, which will be called by  
ExecInitExpr if it's supplied and a PARAM_EXTERN Param is found.  
For stand-alone expressions, we add a new entry point to allow the  
ParamListInfo to be specified directly, since it can't be retrieved  
from the parent plan node's EState.  
  
* Redesign the API for the ParamListInfo paramFetch hook so that the  
ParamExternData array can be entirely virtual.  This also lets us get rid  
of ParamListInfo.paramMask, instead leaving it to the paramFetch hook to  
decide which param IDs should be accessible or not.  plpgsql_param_fetch  
was already doing the identical masking check, so having callers do it too  
seemed redundant.  While I was at it, I added a "speculative" flag to  
paramFetch that the planner can specify as TRUE to avoid unwanted failures.  
This solves an ancient problem for plpgsql that it couldn't provide values  
of non-DTYPE_VAR variables to the planner for fear of triggering premature  
"record not assigned yet" or "field not found" errors during planning.  
  
* Rework plpgsql to get rid of the need for "unshared" parameter lists,  
by dint of turning the single ParamListInfo per estate into a nearly  
read-only data structure that doesn't instantiate any per-variable data.  
Instead, the paramFetch hook controls access to per-variable data and can  
make the right decisions on the fly, replacing the cases that we used to  
need multiple ParamListInfos for.  This might perhaps have been a  
performance loss on its own, but by using a paramCompile hook we can  
bypass plpgsql_param_fetch entirely during normal query execution.  
(It's now only called when, eg, we copy the ParamListInfo into a cursor  
portal.  copyParamList() or SerializeParamList() effectively instantiate  
the virtual parameter array as a simple physical array without a  
paramFetch hook, which is what we want in those cases.)  This allows  
reverting most of commit 6c82d8d1f, though I kept the cosmetic  
code-consolidation aspects of that (eg the assign_simple_var function).  
  
Performance testing shows this to be at worst a break-even change,  
and it can provide wins ranging up to 20% in test cases involving  
accesses to fields of "record" variables.  The fact that values of  
such variables can now be exposed to the planner might produce wins  
in some situations, too, but I've not pursued that angle.  
  
In passing, remove the "parent" pointer from the arguments to  
ExecInitExprRec and related functions, instead storing that pointer in a  
transient field in ExprState.  The ParamListInfo pointer for a stand-alone  
expression is handled the same way; we'd otherwise have had to add  
yet another recursively-passed-down argument in expression compilation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/prepare.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/nodes/params.c
M src/backend/optimizer/util/clauses.c
M src/backend/tcop/postgres.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/params.h
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Get rid of copy_partition_key

commit   : 8a0596cb656e357c391cccf12854beb2e05f3901    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Dec 2017 14:21:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Dec 2017 14:21:39 -0300    

Click here for diff

That function currently exists to avoid leaking memory in  
CacheMemoryContext in case of trouble while the partition key is being  
built, but there's a better way: allocate everything in a memcxt that  
goes away if the current (sub)transaction fails, and once the partition  
key is built and no further errors can occur, make the memcxt permanent  
by making it a child of CacheMemoryContext.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo

commit   : 9ef6aba1d3513829d9f77a4a91ca52f2e5719aef    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Dec 2017 13:36:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Dec 2017 13:36:52 -0300    

Click here for diff

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

Avoid putting build-location-dependent strings into generated files.

commit   : c98c35cd084a25c6cf9b08c76de8b89facd75fe7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2017 10:56:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Dec 2017 10:56:57 -0500    

Click here for diff

Various Perl scripts we use to generate files were in the habit of  
printing things like "generated by $0" into their output files.  
That looks like a fine idea at first glance, but it results in  
non-reproducible output, because in VPATH builds $0 won't be just  
the name of the script file, but a full path for it.  We'd prefer  
that you get identical results whether using VPATH or not, so this  
is a bad thing.  
  
Some of these places also printed their input file name(s), causing  
an additional hazard of the same type.  
  
Hence, establish a policy that thou shalt not print $0, nor input file  
pathnames, into output files (they're still allowed in error messages,  
though).  Instead just write the script name verbatim.  While we are at  
it, we can make these annotations more useful by giving the script's  
full relative path name within the PG source tree, eg instead of  
Gen_fmgrtab.pl let's print src/backend/utils/Gen_fmgrtab.pl.  
  
Not all of the changes made here actually affect any files shipped  
in finished tarballs today, but it seems best to apply the policy  
everyplace so that nobody copies unsafe code into places where it  
could matter.  
  
Christoph Berg and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/bin/psql/create_help.pl
M src/pl/plperl/text2macro.pl
M src/test/perl/TestLib.pm

Cancel CV sleep during subtransaction abort.

commit   : 59d1e2b95a826869e2789ffe01e9e552148eefde    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2017 09:09:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Dec 2017 09:09:04 -0500    

Click here for diff

Generally, error recovery paths that need to do things like  
LWLockReleaseAll and pgstat_report_wait_end also need to call  
ConditionVariableCancelSleep, but AbortSubTransaction was missed.  
  
Since subtransaction abort might destroy up the DSM segment that  
contains the ConditionVariable stored in cv_sleep_target, this  
can result in a crash for anything using condition variables.  
  
Reported and diagnosed by Andres Freund.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Add parallel-aware hash joins.

commit   : 1804284042e659e7d16904e7bbb0ad546394b6a3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 20 Dec 2017 23:39:21 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 20 Dec 2017 23:39:21 -0800    

Click here for diff

Introduce parallel-aware hash joins that appear in EXPLAIN plans as Parallel  
Hash Join with Parallel Hash.  While hash joins could already appear in  
parallel queries, they were previously always parallel-oblivious and had a  
partial subplan only on the outer side, meaning that the work of the inner  
subplan was duplicated in every worker.  
  
After this commit, the planner will consider using a partial subplan on the  
inner side too, using the Parallel Hash node to divide the work over the  
available CPU cores and combine its results in shared memory.  If the join  
needs to be split into multiple batches in order to respect work_mem, then  
workers process different batches as much as possible and then work together  
on the remaining batches.  
  
The advantages of a parallel-aware hash join over a parallel-oblivious hash  
join used in a parallel query are that it:  
  
 * avoids wasting memory on duplicated hash tables  
 * avoids wasting disk space on duplicated batch files  
 * divides the work of building the hash table over the CPUs  
  
One disadvantage is that there is some communication between the participating  
CPUs which might outweigh the benefits of parallelism in the case of small  
hash tables.  This is avoided by the planner's existing reluctance to supply  
partial plans for small scans, but it may be necessary to estimate  
synchronization costs in future if that situation changes.  Another is that  
outer batch 0 must be written to disk if multiple batches are required.  
  
A potential future advantage of parallel-aware hash joins is that right and  
full outer joins could be supported, since there is a single set of matched  
bits for each hashtable, but that is not yet implemented.  
  
A new GUC enable_parallel_hash is defined to control the feature, defaulting  
to on.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund, Robert Haas  
Tested-By: Rafia Sabih, Prabhat Sahu  
Discussion:  
    https://postgr.es/m/CAEepm=2W=cOkiZxcg6qiFQP-dHUe09aqTrEMM7yJDrHMhDv_RA@mail.gmail.com  
    https://postgr.es/m/CAEepm=37HKyJ4U6XOLi=JgfSHM3o6B-GaeO-6hkOmneTDkH+Uw@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/executor/hashjoin.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/pgstat.h
M src/include/storage/lwlock.h
M src/test/regress/expected/join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/join.sql
M src/tools/pgindent/typedefs.list

When passing query strings to workers, pass the terminating \0.

commit   : f94eec490b2671399c102b89c9fa0311aea3a39f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Dec 2017 17:21:55 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Dec 2017 17:21:55 -0500    

Click here for diff

Otherwise, when the query string is read, we might trailing garbage  
beyond the end, unless there happens to be a \0 there by good luck.  
  
Report and patch by Thomas Munro. Reviewed by Rafia Sabih.  
  
Discussion: http://postgr.es/m/CAEepm=2SJs7X+_vx8QoDu8d1SMEOxtLhxxLNzZun_BvNkuNhrw@mail.gmail.com  

M src/backend/executor/execParallel.c

Test instrumentation of Hash nodes with parallel query.

commit   : 7d3583ad9ae54b44119973a9d6d731c9cc74c86e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 15:26:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 15:26:09 -0500    

Click here for diff

Commit 8526bcb2df76d5171b4f4d6dc7a97560a73a5eff fixed bugs related  
to both Sort and Hash, but only added a test case for Sort.  This  
adds a test case for Hash to match.  
  
Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=2-LRnfwUBZDqQt+XAcd0af_ykNyyVvP3h1uB1AQ=e-eA@mail.gmail.com  

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

Try again to fix accumulation of parallel worker instrumentation.

commit   : 8526bcb2df76d5171b4f4d6dc7a97560a73a5eff    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 12:21:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 12:21:56 -0500    

Click here for diff

When a Gather or Gather Merge node is started and stopped multiple  
times, accumulate instrumentation data only once, at the end, instead  
of after each execution, to avoid recording inflated totals.  
  
Commit 778e78ae9fa51e58f41cbdc72b293291d02d8984, the previous attempt  
at a fix, instead reset the state after every execution, which worked  
for the general instrumentation data but had problems for the additional  
instrumentation specific to Sort and Hash nodes.  
  
Report by hubert depesz lubaczewski.  Analysis and fix by Amit Kapila,  
following a design proposal from Thomas Munro, with a comment tweak  
by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/executor/execParallel.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeSort.c
M src/include/executor/nodeHash.h
M src/include/executor/nodeSort.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Re-fix wrong costing of Sort under Gather Merge.

commit   : 38fc54703ea4203a537c58332f697c546eaa4bcf    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 10:34:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 10:34:35 -0500    

Click here for diff

Commit dc02c7bca4dccf7de278cdc6b3325a829e75b252 changed this call  
to create_sort_path() to take -1 rather than limit_tuples because,  
at that time, there was no way for a Sort beneath a Gather Merge  
to become a top-N sort.  
  
Later, commit 3452dc5240da43e833118484e1e9b4894d04431c provided  
a way for a Sort beneath a Gather Merge to become a top-N sort,  
but failed to revert the previous commit in the process.  Do that.  
  
Report and analysis by Jeff Janes; patch by Thomas Munro; review by  
Amit Kapila and by me.  
  
Discussion: http://postgr.es/m/CAEepm=1BWtC34vUroA0Uqjw02MaqdUrW+d6WD85_k8SLyPiKHQ@mail.gmail.com  

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

commit   : 09a65f5a284491d865f3f2ca5a996e597b9cf696    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 10:21:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 19 Dec 2017 10:21:54 -0500    

Click here for diff

Discussion: http://postgr.es/m/CAEepm=2HzxAOKU6eCWTyvMwBy=fhGvbwDPM_fVps759tkyQSYQ@mail.gmail.com  

M src/include/access/parallel.h

Add libpq connection parameter "scram_channel_binding"

commit   : 4bbf110d2fb4f74b9385bd5a521f824dfa5f15ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Dec 2017 18:05:24 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Dec 2017 18:05:24 -0500    

Click here for diff

This parameter can be used to enforce the channel binding type used  
during a SCRAM authentication.  This can be useful to check code paths  
where an invalid channel binding type is used by a client and will be  
even more useful to allow testing other channel binding types when they  
are added.  
  
The default value is tls-unique, which is what RFC 5802 specifies.  
Clients can optionally specify an empty value, which has as effect to  
not use channel binding and use SCRAM-SHA-256 as chosen SASL mechanism.  
  
More tests for SCRAM and channel binding are added to the SSL test  
suite.  
  
Author: Author: Michael Paquier <[email protected]>  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/002_scram.pl

Add shared tuplestores.

commit   : ab9e0e718acb9ded7e4c4b5cedc1d410690ea6ba    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Dec 2017 14:23:19 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Dec 2017 14:23:19 -0800    

Click here for diff

SharedTuplestore allows multiple participants to write into it and  
then read the tuples back from it in parallel.  Each reader receives  
partial results.  
  
For now it always uses disk files, but other buffering policies and  
other kinds of scans (ie each reader receives complete results) may be  
useful in future.  
  
The upcoming parallel hash join feature will use this facility.  
  
Author: Thomas Munro  
Reviewed-By: Peter Geoghegan, Andres Freund, Robert Haas  
Discussion: https://postgr.es/m/CAEepm=2W=cOkiZxcg6qiFQP-dHUe09aqTrEMM7yJDrHMhDv_RA@mail.gmail.com  

M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/sort/Makefile
A src/backend/utils/sort/sharedtuplestore.c
M src/include/storage/lwlock.h
A src/include/utils/sharedtuplestore.h
M src/tools/pgindent/typedefs.list

commit   : 25d532698d74f4adb34f013f1a287a0029e31fb1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Dec 2017 16:59:10 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Dec 2017 16:59:10 -0500    

Click here for diff

Mechanism names for SCRAM and channel binding names have been included  
in scram.h by the libpq frontend code, and this header references a set  
of routines which are only used by the backend.  scram-common.h is on  
the contrary usable by both the backend and libpq, so getting those  
names from there seems more reasonable.  
  
Author: Michael Paquier <[email protected]>  

M src/backend/libpq/auth.c
M src/include/common/scram-common.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c

doc: Fix figures in example description

commit   : 53cba77b53f98255bfbba9d2612d1a5685feec52    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Dec 2017 16:00:35 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Dec 2017 16:00:35 -0500    

Click here for diff

oversight in 244c8b466a743d1ec18a7d841bf42669699b3b56  
  
Reported-by: Blaz Merela <[email protected]>  

M doc/src/sgml/perform.sgml

Fix bug in cancellation of non-exclusive backup to avoid assertion failure.

commit   : 56a95ee5118bf6d46e261b8d352f7dafac10587d    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 19 Dec 2017 03:46:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 19 Dec 2017 03:46:14 +0900    

Click here for diff

Previously an assertion failure occurred when pg_stop_backup() for  
non-exclusive backup was aborted while it's waiting for WAL files to  
be archived. This assertion failure happened in do_pg_abort_backup()  
which was called when a non-exclusive backup was canceled.  
do_pg_abort_backup() assumes that there is at least one non-exclusive  
backup running when it's called. But pg_stop_backup() can be canceled  
even after it marks the end of non-exclusive backup (e.g.,  
during waiting for WAL archiving). This broke the assumption that  
do_pg_abort_backup() relies on, and which caused an assertion failure.  
  
This commit changes do_pg_abort_backup() so that it does nothing  
when non-exclusive backup has been already marked as completed.  
That is, the asssumption is also changed, and do_pg_abort_backup()  
now can handle even the case where it's called when there is  
no running backup.  
  
Backpatch to 9.6 where SQL-callable non-exclusive backup was added.  
  
Author: Masahiko Sawada and Michael Paquier  
Reviewed-By: Robert Haas and Fujii Masao  
Discussion: https://www.postgresql.org/message-id/CAD21AoD2L1Fu2c==gnVASMyFAAaq3y-AQ2uEVj-zTCGFFjvmDg@mail.gmail.com  

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

Fix crashes on plans with multiple Gather (Merge) nodes.

commit   : fd7c0fa732d97a4b4ebb58730e6244ea30d0a618    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 18 Dec 2017 12:17:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 18 Dec 2017 12:17:37 -0500    

Click here for diff

es_query_dsa turns out to be broken by design, because it supposes  
that there is only one DSA for the whole query, whereas there is  
actually one per Gather (Merge) node.  For now, work around that  
problem by setting and clearing the pointer around the sections of  
code that might need it.  It's probably a better idea to get rid of  
es_query_dsa altogether in favor of having each node keep track  
individually of which DSA is relevant, but that seems like more than  
we would want to back-patch.  
  
Thomas Munro, reviewed and tested by Andreas Seltenreich, Amit  
Kapila, and by me.  
  
Discussion: http://postgr.es/m/CAEepm=1U6as=brnVvMNixEV2tpi8NuyQoTmO8Qef0-VV+=7MDA@mail.gmail.com  

M src/backend/executor/execParallel.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c

Fix typo on comment

commit   : 7731c32087faf498db0562cc7e40d256ffc1750f    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 18 Dec 2017 11:24:55 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 18 Dec 2017 11:24:55 +0100    

Click here for diff

Author: David Rowley  

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

Try harder to detect unavailability of __builtin_mul_overflow(int64).

commit   : c6d21d56f1a92b4762a22cbbb694b1e853165e70    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Dec 2017 11:52:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Dec 2017 11:52:22 -0500    

Click here for diff

Commit c04d35f44 didn't quite do the job here, because it still allowed  
the compiler to deduce that the function call could be optimized away.  
Prevent that by putting the arguments and results in global variables.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure

Suppress compiler warning about no function return value.

commit   : b31a9d7dd3bf8435fddf404c4b75236d0ea76d78    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Dec 2017 00:41:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Dec 2017 00:41:41 -0500    

Click here for diff

Compilers that don't know that ereport(ERROR) doesn't return  
complained about the new coding in scanint8() introduced by  
commit 101c7ee3e.  Tweak coding to avoid the warning.  
Per buildfarm.  

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

Try to detect runtime unavailability of __builtin_mul_overflow(int64).

commit   : c04d35f442a8c4fd5a20103b31839ec52fce3046    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 16 Dec 2017 12:49:41 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 16 Dec 2017 12:49:41 -0800    

Click here for diff

On some systems the results of 64 bit __builtin_mul_overflow()  
operations can be computed at compile time, but not at runtime. The  
known cases are arm buildfar animals using clang where the runtime  
operation is implemented in a unavailable function.  
  
Try to avoid compile-time computation by using volatile arguments to  
__builtin_mul_overflow(). In that case we hopefully will get a link  
error when unavailable, similar to what buildfarm animals dangomushi  
and gull are reporting.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure

Avoid and detect SIGPIPE race in TAP tests.

commit   : c757a3da0af0e5eb636eeee2af6602d279162b0a    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 16 Dec 2017 10:03:35 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 16 Dec 2017 10:03:35 -0800    

Click here for diff

Don't write to stdin of a psql process that could have already exited  
with an authentication failure.  Buildfarm members crake and mandrill  
have failed once by doing so.  Ignore SIGPIPE in all TAP tests.  
Back-patch to v10, where these tests were introduced.  
  
Reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/perl/TestLib.pm

Fix oversights in new plpgsql test suite infrastructure.

commit   : 997071691f66dfe92e97e6b4e3d29d153317be31    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Dec 2017 11:32:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Dec 2017 11:32:49 -0500    

Click here for diff

Fix a couple of minor oversights in commit 632b03da3: the tests  
should be run in database "pl_regression" like the other PLs do,  
and we should clean up the tests' output cruft during "make clean".  

M src/pl/plpgsql/src/Makefile

Perform a lot more sanity checks when freezing tuples.

commit   : 699bf7d05c68734f800052829427c20674eb2c6b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Nov 2017 18:45:47 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Nov 2017 18:45:47 -0800    

Click here for diff

The previous commit has shown that the sanity checks around freezing  
aren't strong enough. Strengthening them seems especially important  
because the existance of the bug has caused corruption that we don't  
want to make even worse during future vacuum cycles.  
  
The errors are emitted with ereport rather than elog, despite being  
"should never happen" messages, so a proper error code is emitted. To  
avoid superflous translations, mark messages as internal.  
  
Author: Andres Freund and Alvaro Herrera  
Reviewed-By: Alvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.3-  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/commands/vacuumlazy.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h

Fix pruning of locked and updated tuples.

commit   : 9c2f0a6c3cc8bb85b78191579760dbe9fb7814ec    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 3 Nov 2017 07:52:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 3 Nov 2017 07:52:29 -0700    

Click here for diff

Previously it was possible that a tuple was not pruned during vacuum,  
even though its update xmax (i.e. the updating xid in a multixact with  
both key share lockers and an updater) was below the cutoff horizon.  
  
As the freezing code assumed, rightly so, that that's not supposed to  
happen, xmax would be preserved (as a member of a new multixact or  
xmax directly). That causes two problems: For one the tuple is below  
the xmin horizon, which can cause problems if the clog is truncated or  
once there's an xid wraparound. The bigger problem is that that will  
break HOT chains, which in turn can lead two to breakages: First,  
failing index lookups, which in turn can e.g lead to constraints being  
violated. Second, future hot prunes / vacuums can end up making  
invisible tuples visible again. There's other harmful scenarios.  
  
Fix the problem by recognizing that tuples can be DEAD instead of  
RECENTLY_DEAD, even if the multixactid has alive members, if the  
update_xid is below the xmin horizon. That's safe because newer  
versions of the tuple will contain the locking xids.  
  
A followup commit will harden the code somewhat against future similar  
bugs and already corrupted data.  
  
Author: Andres Freund, with changes by Alvaro Herrera  
Reported-By: Daniel Wood  
Analyzed-By: Andres Freund, Alvaro Herrera, Robert Haas, Peter  
   Geoghegan, Daniel Wood, Yi Wen Wong, Michael Paquier  
Reviewed-By: Alvaro Herrera, Robert Haas, Michael Paquier  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
Backpatch: 9.3-  

M src/backend/utils/time/tqual.c
M src/test/isolation/expected/freeze-the-dead.out
M src/test/isolation/isolation_schedule
M src/test/isolation/specs/freeze-the-dead.spec

Tighten configure's test for __builtin_constant_p().

commit   : 9220b00e57352fda988b187940f5d5ac4851a8bb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Dec 2017 17:19:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Dec 2017 17:19:27 -0500    

Click here for diff

Commit 9fa6f00b1 assumed that __builtin_constant_p("string literal")  
is TRUE, if the compiler has that function at all.  Buildfarm results  
show that Sun Studio 12, at least, breaks that assumption.  Removing  
that usage would leave us with no mechanical check for a very fragile  
coding requirement, so instead teach configure to ignore  
__builtin_constant_p() if it doesn't behave that way.  We could  
complicate matters by distinguishing three cases (no such function,  
vs does, vs doesn't work for string literals); but for now, that seems  
unnecessary because our other existing uses of this function are just  
fairly minor optimizations of non-returning elog/ereport.  We can live  
without that on the small population of compilers that act this way.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure

Fix a number of copy & paste comment errors in common/int.h.

commit   : 11b8f076c02b4ff0230430fb8d82c80acc450c90    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Dec 2017 12:33:48 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Dec 2017 12:33:48 -0800    

Click here for diff

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

M src/include/common/int.h

Fix walsender timeouts when decoding a large transaction

commit   : 0fedb4ea6946e72c5c51130446b59b083ba3dd21    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 14 Dec 2017 11:13:14 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 14 Dec 2017 11:13:14 -0500    

Click here for diff

The logical slots have a fast code path for sending data so as not to  
impose too high a per message overhead. The fast path skips checks for  
interrupts and timeouts. However, the existing coding failed to consider  
the fact that a transaction with a large number of changes may take a  
very long time to be processed and sent to the client. This causes the  
walsender to ignore interrupts for potentially a long time and more  
importantly it will result in the walsender being killed due to  
timeout at the end of such a transaction.  
  
This commit changes the fast path to also check for interrupts and only  
allows calling the fast path when the last keepalive check happened less  
than half the walsender timeout ago. Otherwise the slower code path will  
be taken.  
  
Backpatched to 9.4  
  
Petr Jelinek, reviewed by  Kyotaro HORIGUCHI, Yura Sokolov,  Craig  
Ringer and Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Add approximated Zipfian-distributed random generator to pgbench.

commit   : 1fcd0adeb38d6ef36066134bb3b44acc5a249a98    
  
author   : Teodor Sigaev <[email protected]>    
date     : Thu, 14 Dec 2017 14:30:22 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Thu, 14 Dec 2017 14:30:22 +0300    

Click here for diff

Generator helps to make close to real-world tests.  
  
Author: Alik Khilazhev  
Reviewed-By: Fabien COELHO  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl

Allow executor nodes to change their ExecProcNode function.

commit   : 538d114f6d72cbc94122ab522e002e63359cff5b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Dec 2017 15:47:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Dec 2017 15:47:01 -0800    

Click here for diff

In order for executor nodes to be able to change their ExecProcNode function  
after ExecInitNode() has finished, provide ExecSetExecProcNode().  This allows  
any wrappers functions that only execProcnode.c knows about to be reinstalled.  
The motivation for wanting to change ExecProcNode after ExecInitNode() has  
finished is that it is not known until later whether parallel query is  
available, so if a parallel variant is to be installed then ExecInitNode()  
is too soon to decide.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=09rr65VN+cAV5FgyM_z=D77Xy8Fuc9CDDDYbq3pQUezg@mail.gmail.com  

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

Add pg_attribute_always_inline.

commit   : dbb3d6f0102e0aca7575ff864450fca57ac85517    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Dec 2017 15:34:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Dec 2017 15:34:20 -0800    

Click here for diff

Sometimes it is useful to be able to insist that the compiler inline a  
function that its normal cost analysis would not normally choose to inline.  
This can be useful for instantiating different variants of a function that  
remove branches of code by constant folding.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=09rr65VN+cAV5FgyM_z=D77Xy8Fuc9CDDDYbq3pQUezg@mail.gmail.com  

M src/include/c.h

Add defenses against pre-crash files to BufFileOpenShared().

commit   : 923e8dee88ada071fe41541e83f121ead4baf7f8    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Dec 2017 12:51:32 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Dec 2017 12:51:32 -0800    

Click here for diff

Crash restarts currently don't clean up temporary files, as a debugging aid.  
If a left-over file happens to have the same name as a segment file we're  
trying to create, we'll just truncate and reuse it, but there is a problem:  
BufFileOpenShared() determines how many segment files exist by trying to open  
.0, .1, .2, ... until it finds no more files.  It might be confused by a junk  
file that has the next segment number.  To defend against that, make sure we  
always create a gap after the end file by unlinking the following name if it  
exists.  Also make it an error to try to open a BufFile that doesn't exist  
(has no segment 0), so as not to encourage the development of client code  
that depends on an interface that we can't reliably provide.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm%3D2jhCbC_GFQJaaDhWxLB4EXtT3vVd5czuRNaqF5CWSTog%40mail.gmail.com  

M src/backend/storage/file/buffile.c

Fix parallel index scan hang with deleted or half-dead pages.

commit   : 884a60840cd684dd7925e7a4f9bf10288c37694d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Dec 2017 16:09:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Dec 2017 16:09:00 -0500    

Click here for diff

The previous coding forgot to release the scan before seizing  
it again, leading to a lockup.  
  
Report by Patrick Hemmer.  Diagnosis by Thomas Munro.  Patch by  
Amit Kapila.  
  
Discussion: http://postgr.es/m/CAEepm=2xZUcOGP9V0O_G0=2P2wwXwPrkF=upWTCJSisUxMnuSg@mail.gmail.com  

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

Revert "Fix accumulation of parallel worker instrumentation."

commit   : 1d6fb35ad62968c8678d0321887e2b9ca8fe1a84    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Dec 2017 15:19:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Dec 2017 15:19:28 -0500    

Click here for diff

This reverts commit 2c09a5c12a66087218c7f8cba269cd3de51b9b82.  Per  
further discussion, that doesn't seem to be the best possible fix.  
  
Discussion: http://postgr.es/m/CAA4eK1LW2aFKzY3=vwvc=t-juzPPVWP2uT1bpx_MeyEqnM+p8g@mail.gmail.com  

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

Rethink MemoryContext creation to improve performance.

commit   : 9fa6f00b1308dd10da4eca2f31ccbfc7b35bb461    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Dec 2017 13:55:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Dec 2017 13:55:12 -0500    

Click here for diff

This patch makes a number of interrelated changes to reduce the overhead  
involved in creating/deleting memory contexts.  The key ideas are:  
  
* Include the AllocSetContext header of an aset.c context in its first  
malloc request, rather than allocating it separately in TopMemoryContext.  
This means that we now always create an initial or "keeper" block in an  
aset, even if it never receives any allocation requests.  
  
* Create freelists in which we can save and recycle recently-destroyed  
asets (this idea is due to Robert Haas).  
  
* In the common case where the name of a context is a constant string,  
just store a pointer to it in the context header, rather than copying  
the string.  
  
The first change eliminates a palloc/pfree cycle per context, and  
also avoids bloat in TopMemoryContext, at the price that creating  
a context now involves a malloc/free cycle even if the context never  
receives any allocations.  That would be a loser for some common  
usage patterns, but recycling short-lived contexts via the freelist  
eliminates that pain.  
  
Avoiding copying constant strings not only saves strlen() and strcpy()  
overhead, but is an essential part of the freelist optimization because  
it makes the context header size constant.  Currently we make no  
attempt to use the freelist for contexts with non-constant names.  
(Perhaps someday we'll need to think harder about that, but in current  
usage, most contexts with custom names are long-lived anyway.)  
  
The freelist management in this initial commit is pretty simplistic,  
and we might want to refine it later --- but in common workloads that  
will never matter because the freelists will never get full anyway.  
  
To create a context with a non-constant name, one is now required to  
call AllocSetContextCreateExtended and specify the MEMCONTEXT_COPY_NAME  
option.  AllocSetContextCreate becomes a wrapper macro, and it includes  
a test that will complain about non-string-literal context name  
parameters on gcc and similar compilers.  
  
An unfortunate side effect of making AllocSetContextCreate a macro is  
that one is now *required* to use the size parameter abstraction macros  
(ALLOCSET_DEFAULT_SIZES and friends) with it; the pre-9.6 habit of  
writing out individual size parameters no longer works unless you  
switch to AllocSetContextCreateExtended.  
  
Internally to the memory-context-related modules, the context creation  
APIs are simplified, removing the rather baroque original design whereby  
a context-type module called mcxt.c which then called back into the  
context-type module.  That saved a bit of code duplication, but not much,  
and it prevented context-type modules from exercising control over the  
allocation of context headers.  
  
In passing, I converted the test-and-elog validation of aset size  
parameters into Asserts to save a few more cycles.  The original thought  
was that callers might compute size parameters on the fly, but in practice  
nobody does that, so it's useless to expend cycles on checking those  
numbers in production builds.  
  
Also, mark the memory context method-pointer structs "const",  
just for cleanliness.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/transam/xact.c
M src/backend/catalog/partition.c
M src/backend/commands/subscriptioncmds.c
M src/backend/lib/knapsack.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_procedure.c
M src/pl/tcl/pltcl.c

Start a separate test suite for plpgsql

commit   : 632b03da31cbbf4d32193d35031d301bd50d2679    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Dec 2017 14:03:29 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Dec 2017 14:03:29 -0500    

Click here for diff

The plpgsql.sql test file in the main regression tests is now by far the  
largest after numeric_big, making editing and managing the test cases  
very cumbersome.  The other PLs have their own test suites split up into  
smaller files by topic.  It would be nice to have that for plpgsql as  
well.  So, to get that started, set up test infrastructure in  
src/pl/plpgsql/src/ and split out the recently added procedure test  
cases into a new file there.  That file now mirrors the test cases added  
to the other PLs, making managing those matching tests a bit easier too.  
  
msvc build system changes with help from Michael Paquier  

M src/pl/plpgsql/src/.gitignore
M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_call.out
A src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql
M src/tools/msvc/vcregress.pl

Fix crash when using CALL on an aggregate

commit   : 3d8874224ff25de3ca4f9da8ce3118391bd6609e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Dec 2017 10:37:48 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Dec 2017 10:37:48 -0500    

Click here for diff

Author: Ashutosh Bapat <[email protected]>  
Reported-by: Rushabh Lathia <[email protected]>  

M src/backend/parser/parse_func.c
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Add float.h include to int8.c, for isnan().

commit   : 8e211f5391465bddda79e17e63c79dbc8c70e6d1    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 23:32:43 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 23:32:43 -0800    

Click here for diff

port.h redirects isnan() to _isnan() on windows, which in turn is  
provided by float.h rather than math.h. Therefore include the latter  
as well.  
  
Per buildfarm.  

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

Consistently use PG_INT(16|32|64)_(MIN|MAX).

commit   : f512a6e1323eefa843a063e466babb96d7bfb4ce    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 18:15:22 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 18:15:22 -0800    

Click here for diff

Per buildfarm animal woodlouse.  

M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numeric.c

PL/Python: Fix potential NULL pointer dereference

commit   : 4c6744ed705df6f388371d044b87d1b4a60e9f80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Dec 2017 14:14:55 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Dec 2017 14:14:55 -0500    

Click here for diff

After d0aa965c0a0ac2ff7906ae1b1dad50a7952efa56, one error path in  
PLy_spi_execute_fetch_result() could result in the variable "result"  
being dereferenced after being set to NULL.  Rearrange the code a bit to  
fix that.  
  
Also add another SPI_freetuptable() call so that that is cleared in all  
error paths.  
  
discovered by John Naylor <[email protected]> via scan-build  
  
ideas and review by Tom Lane  

M src/pl/plpython/plpy_spi.c

commit   : 85abb5b297c5b318738f09345ae226f780b88e92    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 17:19:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 17:19:44 -0800    

Click here for diff

Otherwise the detection can spuriously detect symbol as available,  
because the compiler may just emits reference to non-existant symbol.  

M config/c-compiler.m4
M configure

Use new overflow aware integer operations.

commit   : 101c7ee3ee847bac970c74b73b4f2858484383e5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 16:32:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Dec 2017 16:32:31 -0800    

Click here for diff

A previous commit added inline functions that provide fast(er) and  
correct overflow checks for signed integer math. Use them in a  
significant portion of backend code.  There's more to touch in both  
backend and frontend code, but these were the easily identifiable  
cases.  
  
The old overflow checks are noticeable in integer heavy workloads.  
  
A secondary benefit is that getting rid of overflow checks that rely  
on signed integer overflow wrapping around, will allow us to get rid  
of -fwrapv in the future. Which in turn slows down other code.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_utils_num.h
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.c

Provide overflow safe integer math inline functions.

commit   : 4d6ad31257adaf8a51e1c4377d96afa656d9165f    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Oct 2017 22:13:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Oct 2017 22:13:54 -0700    

Click here for diff

It's not easy to get signed integer overflow checks correct and  
fast. Therefore abstract the necessary infrastructure into a common  
header providing addition, subtraction and multiplication for 16, 32,  
64 bit signed integers.  
  
The new macros aren't yet used, but a followup commit will convert  
several open coded overflow checks.  
  
Author: Andres Freund, with some code stolen from Greg Stark  
Reviewed-By: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
A src/include/common/int.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Remove obsolete comment.

commit   : 95b52351fe966c93791462274dfa7af7e50d2da1    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 12 Dec 2017 19:33:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 12 Dec 2017 19:33:50 -0500    

Click here for diff

Commit 8b304b8b72b0a60f1968d39f01cf817c8df863ec removed replacement  
selection, but left behind this comment text.  The optimization to  
which the comment refers is not relevant without replacement  
selection, because if we had so few tuples as to require only one  
tape, we would have just completed the sort in memory.  
  
Peter Geoghegan  
  
Discussion: http://postgr.es/m/CAH2-WznqupLA8CMjp+vqzoe0yXu0DYYbQSNZxmgN76tLnAOZ_w@mail.gmail.com  

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

Remove bug from OPTIMIZER_DEBUG code for partition-wise join.

commit   : d329dc2ea4bfac84ec60ba14b96561a7508bb37b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 12 Dec 2017 10:52:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 12 Dec 2017 10:52:15 -0500    

Click here for diff

Etsuro Fujita, reviewed by Ashutosh Bapat  
  
Discussion: http://postgr.es/m/[email protected]  

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

Make pg_trgm tests independ from standard_conforming_string. Tests uses regular expression which contains backslash.

commit   : c28aa157b86f756d53f2a6b715e23ca56f219b4f    
  
author   : Teodor Sigaev <[email protected]>    
date     : Tue, 12 Dec 2017 14:59:27 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Tue, 12 Dec 2017 14:59:27 +0300    

Click here for diff

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql

Fix comment

commit   : 4034db215b92c68ce55cf1c658d4ef7599ccc45a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Dec 2017 16:37:39 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Dec 2017 16:37:39 -0500    

Click here for diff

Reported-by: Noah Misch <[email protected]>  

M src/backend/executor/execReplication.c

Fix corner-case coredump in _SPI_error_callback().

commit   : 7eb16ab17d5c01b293aad35f0843e5f3a9a64080    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Dec 2017 16:33:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Dec 2017 16:33:20 -0500    

Click here for diff

I noticed that _SPI_execute_plan initially sets spierrcontext.arg = NULL,  
and only fills it in some time later.  If an error were to happen in  
between, _SPI_error_callback would try to dereference the null pointer.  
This is unlikely --- there's not much between those points except  
push-snapshot calls --- but it's clearly not impossible.  Tweak the  
callback to do nothing if the pointer isn't set yet.  
  
It's been like this for awhile, so back-patch to all supported branches.  

M src/backend/executor/spi.c

Improve comment about PartitionBoundInfoData.

commit   : 01a0ca1bed02d6a375c6565a529555eefd2b4fe8    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 11 Dec 2017 12:48:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 11 Dec 2017 12:48:40 -0500    

Click here for diff

Ashutosh Bapat, per discussion with Julien Rouhaund, who also  
reviewed this patch.  
  
Discussion: http://postgr.es/m/CAFjFpReBR3ftK9C23LLCZY_TDXhhjB_dgE-L9+mfTnA=gkvdvQ@mail.gmail.com  

M src/backend/catalog/partition.c

Stabilize output of new regression test case.

commit   : 9edc97b712e2f0ba041b40b4b2e2285d229f4fb0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Dec 2017 12:44:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Dec 2017 12:44:03 -0500    

Click here for diff

The test added by commit 390d58135 turns out to have different output  
in CLOBBER_CACHE_ALWAYS builds: there's an extra CONTEXT line in the  
error message as a result of detecting the error at a different place.  
Possibly we should do something to make that more consistent.  But as  
a stopgap measure to make the buildfarm green again, adjust the test  
to suppress CONTEXT entirely.  We can revert this if we do something  
in the backend to eliminate the inconsistency.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix plpgsql to reinitialize record variables at block re-entry.

commit   : 390d58135b22bc25229b524a60f69682182201d8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Dec 2017 12:03:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Dec 2017 12:03:00 -0500    

Click here for diff

If one exits and re-enters a DECLARE ... BEGIN ... END block within a  
single execution of a plpgsql function, perhaps due to a surrounding loop,  
the declared variables are supposed to get re-initialized to null (or  
whatever their initializer is).  But this failed to happen for variables  
of type "record", because while exec_stmt_block() expected such variables  
to be included in the block's initvarnos list, plpgsql_add_initdatums()  
only adds DTYPE_VAR variables to that list.  This bug appears to have  
been there since the aboriginal addition of plpgsql to our tree.  
  
Fix by teaching plpgsql_add_initdatums() to include DTYPE_REC variables  
as well.  (We don't need to consider other DTYPEs because they don't  
represent separately-stored values.)  I failed to resist the temptation  
to make some nearby cosmetic adjustments, too.  
  
No back-patch, because there have not been field complaints, and it  
seems possible that somewhere out there someone has code depending  
on the incorrect behavior.  In any case this change would have no  
impact on correctly-written code.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Fix regression test output

commit   : ce1468d02bdbbe3aa710463fa9faaf8cf865ad72    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 9 Dec 2017 13:45:06 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 9 Dec 2017 13:45:06 +0100    

Click here for diff

Missed this in the last commit.  

M src/test/regress/expected/identity.out

Fix typo

commit   : d8f632caec3fcc5eece9d53d7510322f11489fe4    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 9 Dec 2017 11:40:31 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 9 Dec 2017 11:40:31 +0100    

Click here for diff

Reported by Robins Tharakan  

M src/backend/parser/parse_utilcmd.c

MSVC 2012+: Permit linking to 32-bit, MinGW-built libraries.

commit   : 7e0c574ee26ce0308b76166312788e909b555c23    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 9 Dec 2017 00:58:55 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 9 Dec 2017 00:58:55 -0800    

Click here for diff

Notably, this permits linking to the 32-bit Perl binaries advertised on  
perl.org, namely Strawberry Perl and ActivePerl.  This has a side effect  
of permitting linking to binaries built with obsolete MSVC versions.  
  
By default, MSVC 2012 and later require a "safe exception handler table"  
in each binary.  MinGW-built, 32-bit DLLs lack the relevant exception  
handler metadata, so linking to them failed with error LNK2026.  Restore  
the semantics of MSVC 2010, which omits the table from a given binary if  
some linker input lacks metadata.  This has no effect on 64-bit builds  
or on MSVC 2010 and earlier.  Back-patch to 9.3 (all supported  
versions).  
  
Reported by Victor Wagner.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/MSBuildProject.pm

MSVC: Test whether 32-bit Perl needs -D_USE_32BIT_TIME_T.

commit   : 65a00f30352a3c0ab5615fac008735b103cfa5bb    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 8 Dec 2017 18:06:05 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 8 Dec 2017 18:06:05 -0800    

Click here for diff

Commits 5a5c2feca3fd858e70ea348822595547e6fa6c15 and  
b5178c5d08ca59e30f9d9428fa6fdb2741794e65 introduced support for modern  
MSVC-built, 32-bit Perl, but they broke use of MinGW-built, 32-bit Perl  
distributions like Strawberry Perl and modern ActivePerl.  Perl has no  
robust means to report whether it expects a -D_USE_32BIT_TIME_T ABI, so  
test this.  Back-patch to 9.3 (all supported versions).  
  
The chief alternative was a heuristic of adding -D_USE_32BIT_TIME_T when  
$Config{gccversion} is nonempty.  That banks on every gcc-built Perl  
using the same ABI.  gcc could change its default ABI the way MSVC once  
did, and one could build Perl with gcc and the non-default ABI.  
  
The GNU make build system could benefit from a similar test, without  
which it does not support MSVC-built Perl.  For now, just add a comment.  
Most users taking the special step of building Perl with MSVC probably  
build PostgreSQL with MSVC.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/perl.m4
M src/tools/msvc/Mkvcbuild.pm

Prohibit identity columns on typed tables and partitions

commit   : 005ac298b1bdc3e9bd19e5ee2bcf7e320ebe4130    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Dec 2017 12:13:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Dec 2017 12:13:04 -0500    

Click here for diff

Those cases currently crash and supporting them is more work then  
originally thought, so we'll just prohibit these scenarios for now.  
  
Author: Michael Paquier <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Reported-by: ŠœŠ°Š½ŃŃƒŃ€ Š“Š°Š»ŠøŠµŠ² <[email protected]>  
Bug: #14866  

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

Fix mistake in comment

commit   : af9f8b7ca343eefa33b693d7919d8f945aeee3e7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Dec 2017 11:16:23 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Dec 2017 11:16:23 -0500    

Click here for diff

Reported-by: Masahiko Sawada <[email protected]>  

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

In plpgsql, unify duplicate variables for record and row cases.

commit   : dd759b96ea8fa41b48541dd321c07d9a947f8de9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Dec 2017 11:20:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Dec 2017 11:20:50 -0500    

Click here for diff

plpgsql's function exec_move_row() handles assignment of a composite  
source value to either a PLpgSQL_rec or PLpgSQL_row target variable.  
Oddly, rather than taking a single target argument which it could do  
run-time type detection on, it was coded to take two separate arguments  
(only one of which is allowed to be non-NULL).  This choice had then  
back-propagated into storing two separate target variables in various  
plpgsql statement nodes, with lots of duplicative coding and awkward  
interface logic to support that.  Simplify matters by folding those  
pairs down to single variables, distinguishing the two cases only  
where we must ... which turns out to be only in exec_move_row itself.  
This is purely refactoring and should not change any behavior.  
  
In passing, remove unused field PLpgSQL_stmt_open.returntype.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Apply identity sequence values on COPY

commit   : 2d2d06b7e27e3177d5bef0061801c75946871db3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Dec 2017 09:18:18 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Dec 2017 09:18:18 -0500    

Click here for diff

A COPY into a table should apply identity sequence values just like it  
does for ordinary defaults.  This was previously forgotten, leading to  
null values being inserted, which in turn would fail because identity  
columns have not-null constraints.  
  
Author: Michael Paquier <[email protected]>  
Reported-by: Steven Winfield <[email protected]>  
Bug: #14952  

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

Speed up isolation test for concurrent VACUUM/ANALYZE behavior.

commit   : 0a3edbb3302173f8ac465570b6273392aa6e20b1    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Dec 2017 11:09:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Dec 2017 11:09:49 -0500    

Click here for diff

Per Tom Lane, the old test sometimes times out with CLOBBER_CACHE_ALWAYS.  
  
Nathan Bossart  
  
Discussion: http://postgr.es/m/[email protected]  

M src/test/isolation/expected/vacuum-concurrent-drop.out
M src/test/isolation/specs/vacuum-concurrent-drop.spec

Report failure to start a background worker.

commit   : 28724fd90d2f85a0573a8107b48abad062a86d83    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Dec 2017 08:49:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Dec 2017 08:49:30 -0500    

Click here for diff

When a worker is flagged as BGW_NEVER_RESTART and we fail to start it,  
or if it is not marked BGW_NEVER_RESTART but is terminated before  
startup succeeds, what BgwHandleStatus should be reported?  The  
previous code really hadn't considered this possibility (as indicated  
by the comments which ignore it completely) and would typically return  
BGWH_NOT_YET_STARTED, but that's not a good answer, because then  
there's no way for code using GetBackgroundWorkerPid() to tell the  
difference between a worker that has not started but will start  
later and a worker that has not started and will never be started.  
So, when this case happens, return BGWH_STOPPED instead.  Update the  
comments to reflect this.  
  
The preceding fix by itself is insufficient to fix the problem,  
because the old code also didn't send a notification to the process  
identified in bgw_notify_pid when startup failed.  That might've  
been technically correct under the theory that the status of the  
worker was BGWH_NOT_YET_STARTED, because the status would indeed not  
change when the worker failed to start, but now that we're more  
usefully reporting BGWH_STOPPED, a notification is needed.  
  
Without these fixes, code which starts background workers and then  
uses the recommended APIs to wait for those background workers to  
start would hang indefinitely if the postmaster failed to fork a  
worker.  
  
Amit Kapila and Robert Haas  
  
Discussion: http://postgr.es/m/CAA4eK1KDfKkvrjxsKJi3WPyceVi3dH1VCkbTJji2fuwKuB=3uw@mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c

Fix Parallel Append crash.

commit   : 9c64ddd414855fb10e0355e887745270a4464c50    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Dec 2017 08:42:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Dec 2017 08:42:50 -0500    

Click here for diff

Reported by Tom Lane and the buildfarm.  
  
Amul Sul and Amit Khandekar  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CAJ3gD9cJQ4d-XhmZ6BqM9rMM2KDBfpkdgOAb4+psz56uBuMQ_A@mail.gmail.com  

M src/backend/executor/nodeAppend.c

Adjust regression test cases added by commit ab7271677.

commit   : 979a36c3894db0a4b0d6b4b20fc861a0bbe3271c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Dec 2017 22:40:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Dec 2017 22:40:05 -0500    

Click here for diff

I suppose it is a copy-and-paste error that this test doesn't actually  
test the "Parallel Append with both partial and non-partial subplans"  
case (EXPLAIN alone surely doesn't qualify as a test of executor  
behavior).  Fix that.  
  
Also, add cosmetic aliases to make it possible to tell apart these  
otherwise-identical test cases in log_statement output.  

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

doc: Flex is not a GNU package

commit   : 51cff91c905e3b32c1f9b56d82d5c802b257b157    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Dec 2017 21:02:47 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Dec 2017 21:02:47 -0500    

Click here for diff

Remove the designation that Flex is a GNU package.  Even though Bison is  
a GNU package, leave out the designation to not make the sentence  
unnecessarily complicated.  
  
Author: Pavan Maddamsetti <[email protected]>  

M doc/src/sgml/installation.sgml

Fix broken markup.

commit   : 7404704a0c5abf0510a9cd889bd867ce46bdfc4c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Dec 2017 18:53:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Dec 2017 18:53:32 -0500    

Click here for diff

M doc/src/sgml/config.sgml

Support Parallel Append plan nodes.

commit   : ab72716778128fb63d54ac256adf7fe6820a1185    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 17:28:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 17:28:39 -0500    

Click here for diff

When we create an Append node, we can spread out the workers over the  
subplans instead of piling on to each subplan one at a time, which  
should typically be a bit more efficient, both because the startup  
cost of any plan executed entirely by one worker is paid only once and  
also because of reduced contention.  We can also construct Append  
plans using a mix of partial and non-partial subplans, which may allow  
for parallelism in places that otherwise couldn't support it.  
Unfortunately, this patch doesn't handle the important case of  
parallelizing UNION ALL by running each branch in a separate worker;  
the executor infrastructure is added here, but more planner work is  
needed.  
  
Amit Khandekar, Robert Haas, Amul Sul, reviewed and tested by  
Ashutosh Bapat, Amit Langote, Rafia Sabih, Amit Kapila, and  
Rajkumar Raghuwanshi.  
  
Discussion: http://postgr.es/m/CAJ3gD9dy0K_E8r727heqXoBmWZ83HwLFwdcaSSmBQ1+S+vRuUQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAppend.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/list.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/executor/nodeAppend.h
M src/include/nodes/execnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/storage/lwlock.h
M src/test/regress/expected/inherit.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/select_parallel.sql

doc: Update memory requirements for FOP

commit   : 8097d189ccc2cd55a8bf189bd21cb196e3cfc385    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Dec 2017 15:29:24 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Dec 2017 15:29:24 -0500    

Click here for diff

Reported-by: Dave Page <[email protected]>  

M doc/src/sgml/docguide.sgml

Fix accumulation of parallel worker instrumentation.

commit   : 2c09a5c12a66087218c7f8cba269cd3de51b9b82    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 14:35:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 14:35:33 -0500    

Click here for diff

When a Gather or Gather Merge node is started and stopped multiple  
times, the old code wouldn't reset the shared state between executions,  
potentially resulting in dramatically inflated instrumentation data  
for nodes beneath it.  (The per-worker instrumentation ended up OK,  
I think, but the overall totals were inflated.)  
  
Report by hubert depesz lubaczewski.  Analysis and fix by Amit Kapila,  
reviewed and tweaked a bit by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix EXPLAIN ANALYZE of hash join when the leader doesn't participate.

commit   : 5bcf389ecfd40daf92238e1abbff4fc4d3f18b33    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 5 Dec 2017 10:55:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 5 Dec 2017 10:55:56 -0800    

Click here for diff

If a hash join appears in a parallel query, there may be no hash table  
available for explain.c to inspect even though a hash table may have  
been built in other processes.  This could happen either because  
parallel_leader_participation was set to off or because the leader  
happened to hit the end of the outer relation immediately (even though  
the complete relation is not empty) and decided not to build the hash  
table.  
  
Commit bf11e7ee introduced a way for workers to exchange  
instrumentation via the DSM segment for Sort nodes even though they  
are not parallel-aware.  This commit does the same for Hash nodes, so  
that explain.c has a way to find instrumentation data from an  
arbitrary participant that actually built the hash table.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm%3D3DUQC2-z252N55eOcZBer6DPdM%3DFzrxH9dZc5vYLsjaA%40mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/nodeHash.c
M src/include/executor/nodeHash.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

postgres_fdw: Fix failing regression test.

commit   : 82c5c533d1f55dfbf3eacc61aff64fedc8915d78    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 13:12:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 13:12:00 -0500    

Click here for diff

Commit ab3f008a2dc364cf7fb75de0a691fb0c61586c8e broke this.  
  
Report by Stephen Frost.  
  
Discussion: http://postgr.es/m/[email protected]  

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

postgres_fdw: Judge password use by run-as user, not session user.

commit   : ab3f008a2dc364cf7fb75de0a691fb0c61586c8e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 11:19:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 11:19:45 -0500    

Click here for diff

This is a backward incompatibility which should be noted in the  
release notes for PostgreSQL 11.  
  
For security reasons, we require that a postgres_fdw foreign table use  
password authentication when accessing a remote server, so that an  
unprivileged user cannot usurp the server's credentials.  Superusers  
are exempt from this requirement, because we assume they are entitled  
to usurp the server's credentials or, at least, can find some other  
way to do it.  
  
But what should happen when the foreign table is accessed by a view  
owned by a user different from the session user?  Is it the view owner  
that must be a superuser in order to avoid the requirement of using a  
password, or the session user?  Historically it was the latter, but  
this requirement makes it the former instead.  This allows superusers  
to delegate to other users the right to select from a foreign table  
that doesn't use password authentication by creating a view over the  
foreign table and handing out rights to the view.  It is also more  
consistent with the idea that access to a view should use the view  
owner's privileges rather than the session user's privileges.  
  
The upshot of this change is that a superuser selecting from a view  
created by a non-superuser may now get an error complaining that no  
password was used, while a non-superuser selecting from a view  
created by a superuser will no longer receive such an error.  
  
No documentation changes are present in this patch because the  
wording of the documentation already suggests that it works this  
way.  We should perhaps adjust the documentation in the back-branches,  
but that's a task for another patch.  
  
Originally proposed by Jeff Janes, but with different semantics;  
adjusted to work like this by me per discussion.  
  
Discussion: http://postgr.es/m/CA+TgmoaY4HsVZJv5SqEjCKLDwtCTSwXzKpRftgj50wmMMBwciA@mail.gmail.com  

M contrib/postgres_fdw/connection.c

Mark assorted variables PGDLLIMPORT.

commit   : c572599c65bfe0387563233faabecd2845073538    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 09:23:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Dec 2017 09:23:57 -0500    

Click here for diff

This makes life easier for extension authors who wish to support  
Windows.  
  
Brian Cloutier, slightly amended by me.  
  
Discussion: http://postgr.es/m/CAJCy68fscdNhmzFPS4kyO00CADkvXvEa-28H-OtENk-pa2OTWw@mail.gmail.com  

M src/include/access/twophase.h
M src/include/commands/extension.h
M src/include/miscadmin.h
M src/include/pgtime.h
M src/include/postmaster/postmaster.h
M src/include/storage/fd.h
M src/include/storage/proc.h
M src/include/tcop/dest.h
M src/include/tcop/tcopprot.h
M src/include/utils/guc.h
M src/include/utils/snapmgr.h

doc: Turn on generate.consistent.ids parameter

commit   : 28f8896af0765a05447f605c55fa9f1ab3b41150    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2017 13:30:21 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2017 13:30:21 -0500    

Click here for diff

This ensures that automatically generated HTML anchors don't change in  
every build.  

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

Treat directory open failures as hard errors in ResetUnloggedRelations().

commit   : 8dc3c971a9d6db5ddc9f0a3c11a70308412d66c3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 20:52:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 20:52:48 -0500    

Click here for diff

Previously, this code just reported such problems at LOG level and kept  
going.  The problem with this approach is that transient failures (e.g.,  
ENFILE) could prevent us from resetting unlogged relations to empty,  
yet allow recovery to appear to complete successfully.  That seems like  
a data corruption hazard large enough to treat such problems as reasons  
to fail startup.  
  
For the same reason, treat unlink failures for unlogged files as hard  
errors not just LOG messages.  It's a little odd that we did it like that  
when file-level errors in other steps (copy_file, fsync_fname) are ERRORs.  
  
The sole case that I left alone is that ENOENT failure on a tablespace  
(not database) directory is not an error, though it will now be logged  
rather than just silently ignored.  This is to cover the scenario where  
a previous DROP TABLESPACE removed the tablespace directory but failed  
before removing the pg_tblspc symlink.  I'm not sure that that's very  
likely in practice, but that seems like the only real excuse for the  
old behavior here, so let's allow for it.  (As coded, this will also  
allow ENOENT on $PGDATA/base/.  But since we'll fail soon enough if  
that's gone, I don't think we need to complicate this code by  
distinguishing that from a true tablespace case.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/reinit.c

Fix warnings from cpluspluscheck

commit   : e7cfb26fbc11ea94e93e443e2260e106b6daabdd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2017 14:46:22 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2017 14:46:22 -0500    

Click here for diff

Fix warnings about "comparison between signed and unsigned integer  
expressions" in inline functions in header files by adding some casts.  

M src/include/libpq/pqformat.h

Simplify do_pg_start_backup's API by opening pg_tblspc internally.

commit   : 066bc21c0e085e2642ff25cc665c4efad3669d6f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 18:37:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 18:37:54 -0500    

Click here for diff

do_pg_start_backup() expects its callers to pass in an open DIR pointer  
for the pg_tblspc directory, but there's no apparent advantage in that.  
It complicates the callers without adding any flexibility, and there's no  
robustness advantage, since we surely have to be prepared for errors during  
the scan of pg_tblspc anyway.  In fact, by holding an extra kernel resource  
during operations like the preliminary checkpoint, we might be making  
things a fraction more failure-prone not less.  Hence, remove that argument  
and open the directory just for the duration of the actual scan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/replication/basebackup.c
M src/include/access/xlog.h

Improve error handling in RemovePgTempFiles().

commit   : 561885db05d3296082ce8750805b8ec322cf9aa1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 17:59:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 17:59:35 -0500    

Click here for diff

Modify this function and its subsidiaries so that syscall failures are  
reported via ereport(LOG), rather than silently ignored as before.  
We don't want to throw a hard ERROR, as that would prevent database  
startup, and getting rid of leftover temporary files is not important  
enough for that.  On the other hand, not reporting trouble at all  
seems like an odd choice not in line with current project norms,  
especially since any failure here is quite unexpected.  
  
On the same reasoning, adjust these functions' AllocateDir/ReadDir calls  
so that failure to scan a directory results in LOG not ERROR.  I also  
removed the previous practice of silently ignoring ENOENT failures during  
directory opens --- there are some corner cases where that could happen  
given a previous database crash, but that seems like a bad excuse for  
ignoring a condition that isn't expected in most cases.  A LOG message  
during postmaster start seems OK in such situations, and better than  
no output at all.  
  
In passing, make RemovePgTempRelationFiles' test for "is the file name  
all digits" look more like the way it's done elsewhere.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/fd.c

Clean up assorted messiness around AllocateDir() usage.

commit   : 2069e6faa0f72eba968714b2260cd65436d0ef3a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 17:02:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 17:02:52 -0500    

Click here for diff

This patch fixes a couple of low-probability bugs that could lead to  
reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE)  
concerning directory-open or file-open failures.  It also fixes places  
where we took shortcuts in reporting such errors, either by using elog  
instead of ereport or by using ereport but forgetting to specify an  
errcode.  And it eliminates a lot of just plain redundant error-handling  
code.  
  
In service of all this, export fd.c's formerly-static function  
ReadDirExtended, so that external callers can make use of the coding  
pattern  
  
	dir = AllocateDir(path);  
	while ((de = ReadDirExtended(dir, path, LOG)) != NULL)  
  
if they'd like to treat directory-open failures as mere LOG conditions  
rather than errors.  Also fix FreeDir to be a no-op if we reach it  
with dir == NULL, as such a coding pattern would cause.  
  
Then, remove code at many call sites that was throwing an error or log  
message for AllocateDir failure, as ReadDir or ReadDirExtended can handle  
that job just fine.  Aside from being a net code savings, this gets rid of  
a lot of not-quite-up-to-snuff reports, as mentioned above.  (In some  
places these changes result in replacing a custom error message such as  
"could not open tablespace directory" with more generic wording "could not  
open directory", but it was agreed that the custom wording buys little as  
long as we report the directory name.)  In some other call sites where we  
can't just remove code, change the error reports to be fully  
project-style-compliant.  
  
Also reorder code in restoreTwoPhaseData that was acquiring a lock  
between AllocateDir and ReadDir; in the unlikely but surely not  
impossible case that LWLockAcquire changes errno, AllocateDir failures  
would be misreported.  There is no great value in opening the directory  
before acquiring TwoPhaseStateLock, so just do it in the other order.  
  
Also fix CheckXLogRemoved to guarantee that it preserves errno,  
as quite a number of call sites are implicitly assuming.  (Again,  
it's unlikely but I think not impossible that errno could change  
during a SpinLockAcquire.  If so, this function was broken for its  
own purposes as well as breaking callers.)  
  
And change a few places that were using not-per-project-style messages,  
such as "could not read directory" when "could not open directory" is  
more correct.  
  
Back-patch the exporting of ReadDirExtended, in case we have occasion  
to back-patch some fix that makes use of it; it's not needed right now  
but surely making it global is pretty harmless.  Also back-patch the  
restoreTwoPhaseData and CheckXLogRemoved fixes.  The rest of this is  
essentially cosmetic and need not get back-patched.  
  
Michael Paquier, with a bit of additional work by me  
  
Discussion: https://postgr.es/m/CAB7nPqRpOCxjiirHmebEFhXVTK7V5Jvw4bz82p7Oimtsm3TyZA@mail.gmail.com  

M contrib/adminpack/adminpack.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/basebackup.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/ipc/dsm.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/misc.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/time/snapmgr.c
M src/include/storage/fd.h
M src/timezone/pgtz.c

When VACUUM or ANALYZE skips a concurrently dropped table, log it.

commit   : ab6eaee88420db58a948849d5a735997728d73a9    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Dec 2017 15:23:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Dec 2017 15:23:36 -0500    

Click here for diff

Hopefully, the additional logging will help avoid confusion that  
could otherwise result.  
  
Nathan Bossart, reviewed by Michael Paquier, FabrĆ­zio Mello, and me  

M doc/src/sgml/config.sgml
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
A src/test/isolation/expected/vacuum-concurrent-drop.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/vacuum-concurrent-drop.spec

Support boolean columns in functional-dependency statistics.

commit   : ecc27d55f4c37a8485a7d0e1dae0eb5ef2bc886e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 11:51:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Dec 2017 11:51:43 -0500    

Click here for diff

There's no good reason that the multicolumn stats stuff shouldn't work on  
booleans.  But it looked only for "Var = pseudoconstant" clauses, and it  
will seldom find those for boolean Vars, since earlier phases of planning  
will fold "boolvar = true" or "boolvar = false" to just "boolvar" or  
"NOT boolvar" respectively.  Improve dependencies_clauselist_selectivity()  
to recognize such clauses as equivalent to equality restrictions.  
  
This fixes a failure of the extended stats mechanism to apply in a case  
reported by Vitaliy Garnashevich.  It's not a complete solution to his  
problem because the bitmap-scan costing code isn't consulting extended  
stats where it should, but that's surely an independent issue.  
  
In passing, improve some comments, get rid of a NumRelids() test that's  
redundant with the preceding bms_membership() test, and fix  
dependencies_clauselist_selectivity() so that estimatedclauses actually  
is a pure output argument as stated by its API contract.  
  
Back-patch to v10 where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/dependencies.c

Remove memory leak protection from Gather and Gather Merge nodes.

commit   : 9f4992e2a9939a4c3d560c2ac58067861ee0029a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Dec 2017 10:33:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Dec 2017 10:33:09 -0500    

Click here for diff

Before commit 6b65a7fe62e129d5c2b85cd74d6a91d8f7564608, tqueue.c could  
perform tuple remapping and thus leak memory, which is why commit  
af33039317ddc4a0e38a02e2255c2bf453115fd2 made TupleQueueReaderNext  
run in a short-lived context.  Now, however, tqueue.c has been reduced  
to a shadow of its former self, and there shouldn't be any chance of  
leaks any more.  Accordingly, remove some tuple copying and memory  
context manipulation to speed up processing.  
  
Patch by me, reviewed by Amit Kapila.  Some testing by Rafia Sabih.  
  
Discussion: http://postgr.es/m/CAA4eK1LSDydwrNjmYSNkfJ3ZivGSWH9SVswh6QpNzsMdj_oOQA@mail.gmail.com  

M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/tqueue.c

Fix uninitialized-variable compiler warning induced by commit e4128ee76.

commit   : a852cfe96752b25c2deaa2653cffd60c0ec82ead    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Dec 2017 11:25:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Dec 2017 11:25:17 -0500    

Click here for diff

I'm a little bit astonished that anyone's compiler would have failed to  
complain about this.  The compiler surely does not know that is_procedure  
means the function return value will be ignored.  

M src/pl/plpython/plpy_exec.c

Adjust #ifdef EXEC_BACKEND RemovePgTempFilesInDir() call.

commit   : ec6a04005618c206163761e5739a8b90debd6b1e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 Dec 2017 17:28:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 Dec 2017 17:28:05 -0800    

Click here for diff

Other callers were adjusted in the course of  
dc6c4c9dc2a111519b76b22daaaac86c5608223b.  
  
Per buildfarm.  

M src/backend/storage/file/fd.c

Add infrastructure for sharing temporary files between backends.

commit   : dc6c4c9dc2a111519b76b22daaaac86c5608223b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 Dec 2017 16:30:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 Dec 2017 16:30:56 -0800    

Click here for diff

SharedFileSet allows temporary files to be created by one backend and  
then exported for read-only access by other backends, with clean-up  
managed by reference counting associated with a DSM segment.  This  
includes changes to fd.c and buffile.c to support the new kind of  
temporary file.  
  
This will be used by an upcoming patch adding support for parallel  
hash joins.  
  
Author: Thomas Munro  
Reviewed-By: Peter Geoghegan, Andres Freund, Robert Haas, Rushabh Lathia  
Discussion:  
    https://postgr.es/m/CAEepm=2W=cOkiZxcg6qiFQP-dHUe09aqTrEMM7yJDrHMhDv_RA@mail.gmail.com  
    https://postgr.es/m/CAH2-WznJ_UgLux=_jTgCQ4yFz0iBntudsNKa1we3kN1BAG=88w@mail.gmail.com  

M src/backend/storage/file/Makefile
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
A src/backend/storage/file/sharedfileset.c
M src/include/storage/buffile.h
M src/include/storage/fd.h
A src/include/storage/sharedfileset.h
M src/tools/pgindent/typedefs.list

Minor code beautification in partition_bounds_equal.

commit   : 35438e5763c3021e579472e4b0c4a4d6038570b4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 13:52:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 13:52:59 -0500    

Click here for diff

Use get_greatest_modulus more consistently, instead of doing the  
same thing in an ad-hoc manner in this one place.  
  
Ashutosh Bapat  
  
Discussion: http://postgr.es/m/CAFjFpReT9L4RCiJBKOyWC2=i02kv9uG2fx=4Fv7kFY2t0SPCgw@mail.gmail.com  

M src/backend/catalog/partition.c

postgres_fdw: Fix test that didn't test what it claimed.

commit   : 950222780535e6d2ea560cd8b3db5308652ddd42    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 13:47:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 13:47:00 -0500    

Click here for diff

Antonin Houska reported that the planner does consider pushing  
postgres_fdw_abs() to the remote side, which happens because we make  
it shippable earlier in the test case file.  
  
Jeevan Chalke provided this patch, which changes the join  
condition to use random(), which is not shippable, instead.  
Antonin reviewed the patch.  
  
Discussion: http://postgr.es/m/15265.1511985971@localhost  

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

Re-allow INSERT .. ON CONFLICT DO NOTHING on partitioned tables.

commit   : 87c37e3291cb75273ccdf4645b9472dd805c4493    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 12:53:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 12:53:21 -0500    

Click here for diff

Commit 8355a011a0124bdf7ccbada206a967d427039553 was reverted in  
f05230752d53c4aa74cffa9b699983bbb6bcb118, but this attempt is  
hopefully better-considered: we now pass the correct value to  
ExecOpenIndices, which should avoid the crash that we hit before.  
  
Amit Langote, reviewed by Simon Riggs and by me.  Some final  
editing by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M src/backend/commands/copy.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/parser/analyze.c
M src/include/executor/execPartition.h
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Try to exclude partitioned tables in toto.

commit   : 1cbc17aaca82b2e262912da96c49b2e1d2f492e7    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 10:58:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 10:58:08 -0500    

Click here for diff

Ashutosh Bapat, reviewed by Jeevan Chalke.  Comment by me.  
  
Discussion: http://postgr.es/m/CAFjFpRcuRaydz88CY_aQekmuvmN2A9ax5z0k=ppT+s8KS8xMRA@mail.gmail.com  

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

Fix uninitialized memory reference.

commit   : 59c8078744b5febf549c8b53171242cf667b87a1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 10:01:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Dec 2017 10:01:50 -0500    

Click here for diff

Without this, when partdesc->nparts == 0, we end up calling  
ExecBuildSlotPartitionKeyDescription without initializing values  
and isnull.  
  
Reported by Coverity via Michael Paquier.  Patch by Michael Paquier,  
reviewed and revised by Amit Langote.  
  
Discussion: http://postgr.es/m/CAB7nPqQ3mwkdMoPY-ocgTpPnjd8TKOadMxdTtMLvEzF8480Zfg@mail.gmail.com  

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

Check channel binding flag at end of SCRAM exchange

commit   : 86ab28fbd19a6a0742a7f66e69a595b61eb13d00    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Nov 2017 14:02:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Nov 2017 14:02:57 -0500    

Click here for diff

We need to check whether the channel-binding flag encoded in the  
client-final-message is the same one sent in the client-first-message.  
  
Reviewed-by: Michael Paquier <[email protected]>  

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

pg_basebackup: Fix progress messages when writing to a file

commit   : 143b54d21d37804707c27edebdbd4410891da133    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2017 09:21:34 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Dec 2017 09:21:34 -0500    

Click here for diff

The progress messages print out \r to keep overwriting the same line on  
the screen.  But this does not yield useful results when writing the  
output to a file.  So in that case, print out \n instead.  
  
Author: MartĆ­n MarquĆ©s <[email protected]>  
Reviewed-by: Arthur Zakirov <[email protected]>  

M src/bin/pg_basebackup/pg_basebackup.c

Remove extra word from comment.

commit   : 06ae669c9229270663d6c4953ceb3621e4bc2d5b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Nov 2017 16:22:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Nov 2017 16:22:38 -0500    

Click here for diff

David Rowley, who also was the primary author of the patch that  
added this function; the attribution in my previous commit,  
84940644de931f331433b35e3a391822671f8c9c, was incorrect due to  
sloppiness on my part.  
  
Discussion: http://postgr.es/m/CAKJS1f_0iSiLQsf_c06AzOWAc3eS6ePjjVQFpcFv3W-O5aktnQ@mail.gmail.com  

M src/backend/nodes/bitmapset.c

SQL procedures

commit   : e4128ee767df3c8c715eb08f8977647ae49dfb59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2017 08:46:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Nov 2017 08:46:13 -0500    

Click here for diff

This adds a new object type "procedure" that is similar to a function  
but does not have a return type and is invoked by the new CALL statement  
instead of SELECT or similar.  This implementation is aligned with the  
SQL standard and compatible with or similar to other SQL implementations.  
  
This commit adds new commands CALL, CREATE/ALTER/DROP PROCEDURE, as well  
as ALTER/DROP ROUTINE that can refer to either a function or a  
procedure (or an aggregate function, as an extension to SQL).  There is  
also support for procedures in various utility commands such as COMMENT  
and GRANT, as well as support in pg_dump and psql.  Support for defining  
procedures is available in all the languages supplied by the core  
distribution.  
  
While this commit is mainly syntax sugar around existing functionality,  
future features will rely on having procedures as a separate object  
type.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/alter_function.sgml
A doc/src/sgml/ref/alter_procedure.sgml
A doc/src/sgml/ref/alter_routine.sgml
A doc/src/sgml/ref/call.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_function.sgml
A doc/src/sgml/ref/create_procedure.sgml
M doc/src/sgml/ref/drop_function.sgml
A doc/src/sgml/ref/drop_procedure.sgml
A doc/src/sgml/ref/drop_routine.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/opclasscmds.c
M src/backend/executor/functions.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/commands/defrem.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/utils/lsyscache.h
M src/interfaces/ecpg/preproc/ecpg.tokens
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg_keywords.c
M src/pl/plperl/GNUmakefile
A src/pl/plperl/expected/plperl_call.out
M src/pl/plperl/plperl.c
A src/pl/plperl/sql/plperl_call.sql
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/Makefile
A src/pl/plpython/expected/plpython_call.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_procedure.h
A src/pl/plpython/sql/plpython_call.sql
M src/pl/tcl/Makefile
A src/pl/tcl/expected/pltcl_call.out
M src/pl/tcl/pltcl.c
A src/pl/tcl/sql/pltcl_call.sql
A src/test/regress/expected/create_procedure.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/privileges.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/create_procedure.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/privileges.sql

Make create_unique_path manage memory like mark_dummy_rel.

commit   : 1761653bbb17447906c812c347b3fe284ce699cf    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Nov 2017 09:50:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Nov 2017 09:50:10 -0500    

Click here for diff

Put the unique path in the same context as the owning RelOptInfo, rather  
than the toplevel planner context.  This is how this function worked  
originally, but commit f41803bb39bc2949db200116a609fd242d0ec221  
changed it without explanation.  mark_dummy_rel adopted the older (or  
newer?) technique in commit eca75a12a27d28b972fc269c1c8813cd8eb15441,  
which also featured a much better explanation of why it is correct.  
So, switch back to that technique here, with the same explanation  
given there.  
  
Although this fixes a possible memory leak when GEQO is in use, the  
leak is minor and probably nobody cares, so no back-patch.  
  
Ashutosh Bapat, reviewed by Tom Lane and by me  
  
Discussion: http://postgr.es/m/CAFjFpRcXkHHrXyD9BCvkgGJV4TnHG2SWJ0PhJfrDu3NAcQvh7g@mail.gmail.com  

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

Fix non-GNU makefiles for AIX make.

commit   : e21a556e136973cea95852b91fe1d72c7626bc34    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 30 Nov 2017 00:57:22 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 30 Nov 2017 00:57:22 -0800    

Click here for diff

Invoking the Makefile without an explicit target was building every  
possible target instead of just the "all" target.  Back-patch to 9.3  
(all supported versions).  

M Makefile
M src/test/regress/Makefile

Fix neqjoinsel's behavior for semi/anti join cases.

commit   : 7ca25b7de6aefa5537e0dbe56541bc41c0464f97    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Nov 2017 22:00:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Nov 2017 22:00:29 -0500    

Click here for diff

Previously, this function estimated the selectivity as 1 minus eqjoinsel()  
for the negator equality operator, regardless of join type (I think there  
was an expectation that eqjoinsel would handle the join type).  But  
actually this is completely wrong for semijoin cases: the fraction of the  
LHS that has a non-matching row is not one minus the fraction of the LHS  
that has a matching row.  In reality a semijoin with <> will nearly always  
succeed: it can only fail when the RHS is empty, or it contains a single  
distinct value that is equal to the particular LHS value, or the LHS value  
is null.  The only one of those things we should have much confidence in  
estimating is the fraction of LHS values that are null, so let's just take  
the selectivity as 1 minus outer nullfrac.  
  
Per coding convention, antijoin should be estimated the same as semijoin.  
  
Arguably this is a bug fix, but in view of the lack of field complaints  
and the risk of destabilizing plans, no back-patch.  
  
Thomas Munro, reviewed by Ashutosh Bapat  
  
Discussion: https://postgr.es/m/CAEepm=270ze2hVxWkJw-5eKzc3AB4C9KpH3L2kih75R5pdSogg@mail.gmail.com  

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

Add a barrier primitive for synchronizing backends.

commit   : 1145acc70debacc34de01fac238defde543f4ed4    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Nov 2017 17:07:16 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Nov 2017 17:07:16 -0800    

Click here for diff

Provide support for dynamic or static parties of processes to wait for  
all processes to reach point in the code before continuing.  
  
This is similar to the mechanism of the same name in POSIX threads and  
MPI, though has explicit phasing and dynamic party support like the  
Java core library's Phaser.  
  
This will be used by an upcoming patch adding support for parallel  
hash joins.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=2_y7oi01OjA_wLvYcWMc9_d=LaoxrY3eiROCZkB_qakA@mail.gmail.com  

M src/backend/storage/ipc/Makefile
A src/backend/storage/ipc/barrier.c
A src/include/storage/barrier.h

Add some regression tests that exercise hash join code.

commit   : fa330f9adf4e83c0707b0b1164e7bf09c9204b3d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Nov 2017 16:06:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Nov 2017 16:06:50 -0800    

Click here for diff

Although hash joins are already tested by many queries, these tests  
systematically cover the four different states we can reach as part of  
the strategy for respecting work_mem.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  

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

New C function: bms_add_range

commit   : 84940644de931f331433b35e3a391822671f8c9c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Nov 2017 17:06:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Nov 2017 17:06:14 -0500    

Click here for diff

This will be used by pending patches to improve partition pruning.  
  
Amit Langote and Kyotaro Horiguchi, per a suggestion from David  
Rowley.  Review and testing of the larger patch set of which this is a  
part by Ashutosh Bapat, David Rowley, Dilip Kumar, Jesper Pedersen,  
Rajkumar Raghuwanshi, Beena Emerson, Amul Sul, and Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/nodes/bitmapset.c
M src/include/nodes/bitmapset.h

Add extensive tests for partition pruning.

commit   : 8d4e70a63bf8772bbf5db620ef1e14761fbd2044    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Nov 2017 15:19:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Nov 2017 15:19:07 -0500    

Click here for diff

Currently, partition pruning happens via constraint exclusion, but  
there are pending places to replace that with a different and  
hopefully faster mechanism.  To be sure that we don't change behavior  
without realizing it, add extensive test coverage.  
  
Note that not all of these behaviors are optimal; in some cases,  
partitions are not pruned even though it would be safe to do so.  
These tests therefore serve to memorialize the current state rather  
than the ideal state.  Patches that improve things can update the test  
results as appropriate.  
  
Amit Langote, adjusted by me.  Review and testing of the larger patch  
set of which this is a part by Ashutosh Bapat, David Rowley, Dilip  
Kumar, Jesper Pedersen, Rajkumar Raghuwanshi, Beena Emerson, Amul Sul,  
and Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/[email protected]  

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

PL/Python: Fix remaining scan-build warnings

commit   : c7f5c58e1c6bb250ff7c24970a05e033201be409    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 20:05:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 20:05:49 -0400    

Click here for diff

Apparently, scan-build thinks that proc->is_setof can change during  
PLy_exec_function().  To make it clearer, save the value in a local  
variable.  
  
Also add an assertion to clear another warning.  
  
Reviewed-by: John Naylor <[email protected]>  

M src/pl/plpython/plpy_exec.c

Add compiler hints to PLy_elog()

commit   : cdddd5d40b8a8b37db18adda3912e029756d1e36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 20:05:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2017 20:05:49 -0400    

Click here for diff

Decorate PLy_elog() in a similar way as elog(), to give compilers and  
static analyzers hints in which cases it does not return.  
  
Reviewed-by: John Naylor <[email protected]>  

M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_elog.h

Update typedefs.list and re-run pgindent

commit   : eaedf0df7197b21182f6c341a44e4fdaa3cd6ea6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Nov 2017 09:24:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Nov 2017 09:24:24 -0500    

Click here for diff

Discussion: http://postgr.es/m/CA+TgmoaA9=1RWKtBWpDaj+sF3Stgc8sHgf5z=KGtbjwPLQVDMA@mail.gmail.com  

M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/isn/isn.c
M src/backend/access/brin/brin.c
M src/backend/access/common/printsimple.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/smgr/smgr.c
M src/backend/tcop/postgres.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/psql/describe.c
M src/include/access/hash.h
M src/include/catalog/partition.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/fe_utils/psqlscan_int.h
M src/include/lib/dshash.h
M src/include/lib/stringinfo.h
M src/include/libpq/scram.h
M src/include/nodes/relation.h
M src/include/utils/guc.h
M src/include/utils/memutils.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/thread/thread_test.c
M src/tools/pgindent/typedefs.list

Clarify old comment about qual_is_pushdown_safe's handling of subplans.

commit   : 801386af62eac84c13feec5a643c120cf0ce33bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Nov 2017 23:32:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Nov 2017 23:32:17 -0500    

Click here for diff

This comment glossed over the difference between initplans and subplans,  
but they are indeed different for our purposes here.  

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

Make memset() use sizeof() rather than re-compute size

commit   : 3848d21673e9dcb42d4bc1353043d7c7d6f550cd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 29 Nov 2017 00:09:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 29 Nov 2017 00:09:17 -0300    

Click here for diff

This is simpler and more closely follows overwhelming precedent.  
  
Report and patch by Mark Dilger.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/extended_stats.c

Fix extstat collection when no stats are produced for a column

commit   : 414cd434ff681e5f499803458eae9d5bb32372a9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 Nov 2017 23:25:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 Nov 2017 23:25:47 -0300    

Click here for diff

This is a mistakenly placed conditional in bf2a691e02d7.  
  
Reported by Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/extended_stats.c

Fix wrong function name in comment.

commit   : cd482f295150f8311290b5234873917f2172a34a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 14:17:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 14:17:21 -0500    

Click here for diff

Rushabh Lathia  
  
Discussion: http://postgr.es/m/CAGPqQf2z5g+7YmGZSZgKoiFsaUB+63Rzmz8-5PQHuS6hd14FEg@mail.gmail.com  

M src/backend/executor/execPartition.c

If a range-partitioned table has no default partition, reject null keys.

commit   : 2d7950f2222c97bd9d9f4d4edc1b59e6660c3621    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 14:11:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 14:11:16 -0500    

Click here for diff

Commit 4e5fe9ad19e14af360de7970caa8b150436c9dec introduced this  
problem.  Also add a test so it doesn't get broken again.  
  
Report by Rushabh Lathia.  Fix by Amit Langote.  Reviewed by Rushabh  
Lathia and Amul Sul.  Tweaked by me.  
  
Discussion: http://postgr.es/m/CAGPqQf0Y1iJyk4QJBdMf=pS9i6Q0JUMM_h5-qkR3OMJ-e04PyA@mail.gmail.com  

M src/backend/catalog/partition.c
M src/test/regress/expected/insert.out
M src/test/regress/sql/insert.sql

Revert "PL/Python: Fix potential NULL pointer dereference"

commit   : 62546b4357f2aec46bb896fdbddfc0904a2d7920    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Nov 2017 13:55:39 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Nov 2017 13:55:39 -0500    

Click here for diff

This reverts commit e42e2f38907681c48c43f49c5ec9f9f41a9aa9a5.  
  
It's not safe to return in the middle of a PG_TRY block, so this will  
have to be done differently.  

M src/pl/plpython/plpy_spi.c

Fix ReinitializeParallelDSM to tolerate finding no error queues.

commit   : 445dbd82a3192c6f4d15de012333943882020904    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 12:05:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 12:05:52 -0500    

Click here for diff

Commit d4663350646ca0c069a36d906155a0f7e3372eb7 changed things so  
that shm_toc_lookup would fail with an error rather than silently  
returning NULL in the hope that such failures would be reported  
in a useful way rather than via a system crash.  However, it  
overlooked the fact that the lookup of PARALLEL_KEY_ERROR_QUEUE  
in ReinitializeParallelDSM is expected to fail when no DSM segment  
was created in the first place; in that case, we end up with a  
backend-private memory segment that still contains an entry for  
PARALLEL_KEY_FIXED but no others.  Consequently a benign failure  
to initialize parallelism can escalate into an elog(ERROR);  
repair.  
  
Discussion: http://postgr.es/m/CA+Tgmob8LFw55DzH1QEREpBEA9RJ_W_amhBFCVZ6WMwUhVpOqg@mail.gmail.com  

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

Teach bitmap heap scan to cope with absence of a DSA.

commit   : c6755e233be1cccadd0884d952a2bb455fa0db1f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 11:39:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 11:39:16 -0500    

Click here for diff

If we have a plan that uses parallelism but are unable to execute it  
using parallelism, for example due to a lack of available DSM  
segments, then the EState's es_query_dsa will be NULL.  Parallel  
bitmap heap scan needs to fall back to a non-parallel scan in such  
cases.  
  
Patch by me, reviewed by Dilip Kumar  
  
Discussion: http://postgr.es/m/CAEepm=0kADK5inNf_KuemjX=HQ=PuTP0DykM--fO5jS5ePVFEA@mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c

PL/Python: Fix potential NULL pointer dereference

commit   : e42e2f38907681c48c43f49c5ec9f9f41a9aa9a5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Nov 2017 11:28:05 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Nov 2017 11:28:05 -0500    

Click here for diff

After d0aa965c0a0ac2ff7906ae1b1dad50a7952efa56, one error path in  
PLy_spi_execute_fetch_result() could result in the variable "result"  
being dereferenced after being set to NULL.  To fix that, just clear the  
resources right there and return early.  
  
Also add another SPI_freetuptable() call so that that is cleared in all  
error paths.  
  
discovered by John Naylor <[email protected]> via scan-build  

M src/pl/plpython/plpy_spi.c

Add null test to partition constraint for default range partitions.

commit   : 7b88d63a9122646ead60c1afffc248a31d4e457d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 10:51:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 10:51:01 -0500    

Click here for diff

Non-default range partitions have a constraint which include null  
tests, and both default and non-default list partitions also have a  
constraint which includes null tests, but for some reason this was  
missed for default range partitions.  This could cause the partition  
constraint to evaluate to false for rows that were (correctly) routed  
to that partition by insert tuple routing, which could in turn  
cause constraint exclusion to prune the default partition in cases  
where it should not.  
  
Amit Langote, reviewed by Kyotaro Horiguchi  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/test/regress/expected/inherit.out
M src/test/regress/expected/update.out
M src/test/regress/sql/inherit.sql

Fix typo.

commit   : 487a0c1518af2f3ae2d05b7fd23d636d687f28f3    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 08:18:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Nov 2017 08:18:00 -0500    

Click here for diff

Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoCq_QG6UEo6yb-purmhLQjDLsCA2_B+8Wh3ah9P2-XmrQ@mail.gmail.com  

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

Mark some more functions as pg_attribute_noreturn().

commit   : 0772c152b9bd02baeca6920c3371fce95e8f13dc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Nov 2017 20:56:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Nov 2017 20:56:46 -0500    

Click here for diff

Doing this suppresses Coverity warnings and might allow improved  
code in some cases.  The prospects of that are not so bright as  
to warrant back-patching, though.  
  
Michael Paquier, per Coverity  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/test/isolation/isolationtester.c

commit   : cb03fa33aeaea4775b9f3437a2240de4ac9cb630    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Nov 2017 19:22:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Nov 2017 19:22:08 -0500    

Click here for diff

heap_drop_with_catalog and ATExecDetachPartition neglected to check for  
SearchSysCache failures, as noted in bugs #14927 and #14928 from Pan Bian.  
Such failures are pretty unlikely, since we should already have some sort  
of lock on the rel at these points, but it's neither a good idea nor  
per project style to omit a check for failure.  
  
Also, StorePartitionKey contained a syscache lookup that it never did  
anything with, including never releasing the result.  Presumably the  
reason why we don't see refcount-leak complaints is that the lookup  
always fails; but in any case it's pretty useless, so remove it.  
  
All of these errors were evidently introduced by the relation  
partitioning feature.  Back-patch to v10 where that came in.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c

Fix creation of resjunk tlist entries for inherited mixed UPDATE/DELETE.

commit   : 9a785ad573176b88a93563209980fbe80cd72163    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Nov 2017 17:53:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Nov 2017 17:53:56 -0500    

Click here for diff

rewriteTargetListUD's processing is dependent on the relkind of the query's  
target table.  That was fine at the time it was made to act that way, even  
for queries on inheritance trees, because all tables in an inheritance tree  
would necessarily be plain tables.  However, the 9.5 feature addition  
allowing some members of an inheritance tree to be foreign tables broke the  
assumption that rewriteTargetListUD's output tlist could be applied to all  
child tables with nothing more than column-number mapping.  This led to  
visible failures if foreign child tables had row-level triggers, and would  
also break in cases where child tables belonged to FDWs that used methods  
other than CTID for row identification.  
  
To fix, delay running rewriteTargetListUD until after the planner has  
expanded inheritance, so that it is applied separately to the (already  
mapped) tlist for each child table.  We can conveniently call it from  
preprocess_targetlist.  Refactor associated code slightly to avoid the  
need to heap_open the target relation multiple times during  
preprocess_targetlist.  (The APIs remain a bit ugly, particularly around  
the point of which steps scribble on parse->targetList and which don't.  
But avoiding such scribbling would require a change in FDW callback APIs,  
which is more pain than it's worth.)  
  
Also fix ExecModifyTable to ensure that "tupleid" is reset to NULL when  
we transition from rows providing a CTID to rows that don't.  (That's  
really an independent bug, but it manifests in much the same cases.)  
  
Add a regression test checking one manifestation of this problem, which  
was that row-level triggers on a foreign child table did not work right.  
  
Back-patch to 9.5 where the problem was introduced.  
  
Etsuro Fujita, reviewed by Ildus Kurbangaliev and Ashutosh Bapat  
  
Discussion: https://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/fdwhandler.sgml
M doc/src/sgml/rules.sgml
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/rewrite/rewriteHandler.c
M src/include/optimizer/prep.h
M src/include/rewrite/rewriteHandler.h

Additional docs for toast_tuple_target changes

commit   : 117469006bf525c6e8dc84cb9fcbdc4c1a050878    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 27 Nov 2017 09:51:51 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 27 Nov 2017 09:51:51 +0000    

Click here for diff

M doc/src/sgml/storage.sgml

Pad XLogReaderState's per-buffer data_bufsz more aggressively.

commit   : 59af8d4384ba5ae72986eab7e5cdc514a969aa05    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 27 Nov 2017 09:34:05 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 27 Nov 2017 09:34:05 +0000    

Click here for diff

Originally, we palloc'd this buffer just barely big enough to hold the  
largest xlog backup block seen so far. We now MAXALIGN the palloc size.  
  
The original coding could result in many repeated palloc cycles, in the  
worst case where we see a series ofgradually larger xlog records.  We  
ameliorate that similarly to 8735978e7aebfbc499843630131c18d1f7346c79  
by imposing a minimum buffer size of BLCKSZ.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo in comment

commit   : d5f965c257aed40d515e6b518422ac6e6982c46c    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 27 Nov 2017 09:24:14 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 27 Nov 2017 09:24:14 +0100    

Click here for diff

Andreas Karlsson  

M src/tools/msvc/config_default.pl

Pad XLogReaderState's main_data buffer more aggressively.

commit   : 8735978e7aebfbc499843630131c18d1f7346c79    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Nov 2017 15:17:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Nov 2017 15:17:24 -0500    

Click here for diff

Originally, we palloc'd this buffer just barely big enough to hold the  
largest xlog record seen so far.  It turns out that that can result in  
valgrind complaints, because some compilers will emit code that assumes  
it can safely fetch padding bytes at the end of a struct, and those  
padding bytes were unallocated so far as aset.c was concerned.  We can  
fix that by MAXALIGN'ing the palloc request size, ensuring that it is big  
enough to include any possible padding that might've been omitted from  
the on-disk record.  
  
An additional objection to the original coding is that it could result in  
many repeated palloc cycles, in the worst case where we see a series of  
gradually larger xlog records.  We can ameliorate that cheaply by  
imposing a minimum buffer size that's large enough for most xlog records.  
BLCKSZ/2 was chosen after a bit of discussion.  
  
In passing, remove an obsolete comment in struct xl_heap_new_cid that the  
combocid field is free due to alignment considerations.  Perhaps that was  
true at some point, but it's not now.  
  
Back-patch to 9.5 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogreader.c
M src/include/access/heapam_xlog.h

Make has_sequence_privilege support WITH GRANT OPTION

commit   : 752714dd9de3d1b919d582ddaac96425a6cfa66d    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 26 Nov 2017 09:49:40 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 26 Nov 2017 09:49:40 -0800    

Click here for diff

The various has_*_privilege() functions all support an optional  
WITH GRANT OPTION added to the supported privilege types to test  
whether the privilege is held with grant option. That is, all except  
has_sequence_privilege() variations. Fix that.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update MSVC build process for new timezone data.

commit   : 6d4ae6a8e782d87ffb6aab62f75787b2722daa2d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 18:15:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 18:15:22 -0500    

Click here for diff

Missed this dependency in commits 7cce222c9 et al.  

M src/tools/msvc/Install.pm

Replace raw timezone source data with IANA's new compact format.

commit   : 7cce222c965dec93327692dbac9c340a6220afe9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 15:30:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 15:30:11 -0500    

Click here for diff

Traditionally IANA has distributed their timezone data in pure source  
form, replete with extensive historical comments.  As of release 2017c,  
they've added a compact single-file format that omits comments and  
abbreviates command keywords.  This form is way shorter than the pure  
source, even before considering its allegedly better compressibility.  
Hence, let's distribute the data in that form rather than pure source.  
  
I'm pushing this now, rather than at the next timezone database update,  
so that it's easy to confirm that this data file produces compiled zic  
output that's identical to what we were getting before.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/Makefile
M src/timezone/README
D src/timezone/data/africa
D src/timezone/data/antarctica
D src/timezone/data/asia
D src/timezone/data/australasia
D src/timezone/data/backward
D src/timezone/data/backzone
D src/timezone/data/etcetera
D src/timezone/data/europe
D src/timezone/data/factory
D src/timezone/data/northamerica
D src/timezone/data/pacificnew
D src/timezone/data/southamerica
D src/timezone/data/systemv
A src/timezone/data/tzdata.zi

Avoid formally-undefined use of memcpy() in hstoreUniquePairs().

commit   : d3f4e8a8a78be60f3a971f1f8ef6acc2d0576e5f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 14:42:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 14:42:10 -0500    

Click here for diff

hstoreUniquePairs() often called memcpy with equal source and destination  
pointers.  Although this is almost surely harmless in practice, it's  
undefined according to the letter of the C standard.  Some versions of  
valgrind will complain about it, and some versions of libc as well  
(cf. commit ad520ec4a).  Tweak the code to avoid doing that.  
  
Noted by Tomas Vondra.  Back-patch to all supported versions because  
of the hazard of libc assertions.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore_io.c

Repair failure with SubPlans in multi-row VALUES lists.

commit   : 9b63c13f0a213bfb38bb70a3df3f28cc1f496b30    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 14:15:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 14:15:48 -0500    

Click here for diff

When nodeValuesscan.c was written, it was impossible to have a SubPlan in  
VALUES --- any sub-SELECT there would have to be uncorrelated and thereby  
would produce an InitPlan instead.  We therefore took a shortcut in the  
logic that throws away a ValuesScan's per-row expression evaluation data  
structures.  This was broken by the introduction of LATERAL however; a  
sub-SELECT containing a lateral reference produces a correlated SubPlan.  
  
The cleanest fix for this would be to give up the optimization of  
discarding the expression eval state.  But that still seems pretty  
unappetizing for long VALUES lists.  It seems to work to just prevent  
the subexpressions from hooking into the ValuesScan node's subPlan  
list, so let's do that and see how well it works.  (If this breaks,  
due to additional connections between the subexpressions and the outer  
query structures, we might consider compromises like throwing away data  
only for VALUES rows not containing SubPlans.)  
  
Per bug #14924 from Christian Duta.  Back-patch to 9.3 where LATERAL  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update buffile.h/.c comments for removal of non-temp option.

commit   : ab97aaac8f058f2e16ef08655d185db20bc241d3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 13:19:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 13:19:43 -0500    

Click here for diff

Commit 11e264517 removed BufFile's isTemp flag, thereby eliminating  
the possibility of resurrecting BufFileCreate().  But it left that  
function in place, as well as a bunch of comments describing how things  
worked for the non-temp-file case.  At best, that's now a source of  
confusion.  So remove the long-since-commented-out function and change  
relevant comments.  
  
I (tgl) wanted to rename BufFileCreateTemp() to BufFileCreate(), but  
that seems not to be the consensus position, so leave it as-is.  
  
In passing, fix commit f0828b2fc's failure to update BufFileSeek's  
comment to match the change of its argument type from long to off_t.  
(I think that might actually have been intentional at the time, but  
now that 64-bit off_t is nearly universal, it looks anachronistic.)  
  
Thomas Munro and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/buffile.c
M src/include/storage/buffile.h

Improve planner's handling of set-returning functions in grouping columns.

commit   : df3a66e282b66971b3c08896176b95f745466a64    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 11:48:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Nov 2017 11:48:09 -0500    

Click here for diff

Improve query_is_distinct_for() to accept SRFs in the targetlist when  
we can prove distinctness from a DISTINCT clause.  In that case the  
de-duplication will surely happen after SRF expansion, so the proof  
still works.  Continue to punt in the case where we'd try to prove  
distinctness from GROUP BY (or, in the future, source relations).  
To do that, we'd have to determine whether the SRFs were in the  
grouping columns or elsewhere in the tlist, and it still doesn't  
seem worth the trouble.  But this trivial change allows us to  
recognize that "SELECT DISTINCT unnest(foo) FROM ..." produces  
unique-ified output, which seems worth having.  
  
Also, fix estimate_num_groups() to consider the possibility of SRFs in  
the grouping columns.  Its failure to do so was masked before v10 because  
grouping_planner() scaled up plan rowcount estimates by the estimated SRF  
multiplier after performing grouping.  That doesn't happen anymore, which  
is more correct, but it means we need an adjustment in the estimate for  
the number of groups.  Failure to do this leads to an underestimate for  
the number of output rows of subqueries like "SELECT DISTINCT unnest(foo)"  
compared to what 9.6 and earlier estimated, thus breaking plan choices  
in some cases.  
  
Per report from Dmitry Shalashov.  Back-patch to v10 to avoid degraded  
plan choices compared to previous releases.  
  
Discussion: https://postgr.es/m/CAKPeCUGAeHgoh5O=SvcQxREVkoX7UdeJUMj1F5=aBNvoTa+O8w@mail.gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/backend/utils/adt/selfuncs.c

Avoid projecting tuples unnecessarily in Gather and Gather Merge.

commit   : b10967eddf964f8c0a11060cf3f366bbdd1235f6    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 25 Nov 2017 10:49:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 25 Nov 2017 10:49:17 -0500    

Click here for diff

It's most often the case that the target list for the Gather (Merge)  
node matches the target list supplied by the underlying plan node;  
when this is so, we can avoid the overhead of projecting.  
  
This depends on commit f455e1125e2588d4cd4fc663c6a10da4e003a3b5 for  
proper functioning.  
  
Idea by Andres Freund.  Patch by me.  Review by Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoZ0ZL=cesZFq8c9NnfK6bqy-wwUd3_74iYGodYrSoQ7Fw@mail.gmail.com  

M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/include/executor/executor.h

Improve valgrind logic in aset.c, and fix multiple issues in generation.c.

commit   : 0f2458ff5f970cade04313f1a10fe01d02f888b7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 19:28:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 19:28:19 -0500    

Click here for diff

Revise aset.c so that all the "private" fields of chunk headers are  
marked NOACCESS when outside the module, improving on the previous  
coding which protected only requested_size.  Fix a couple of corner  
case bugs, such as failing to re-protect the header during a failure  
exit from AllocSetRealloc, and wrong padding-size calculation for an  
oversize allocation request.  
  
Apply the same design to generation.c, and also fix several bugs therein  
that I found by dint of hacking the code to use generation.c as the  
standard allocator and then running the core regression tests with it.  
Notably, we have to track the actual size of each block, else the  
wipe_mem call in GenerationReset clears the wrong amount of memory for  
an oversize-chunk block; and GenerationCheck needs a way of identifying  
freed chunks that isn't fooled by palloc(0).  I chose to fix the latter  
by resetting the context pointer to NULL in a freed chunk, roughly like  
what happens in a freed aset.c chunk.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c

Mostly-cosmetic improvements in memory chunk header alignment coding.

commit   : f65d21b258085bdc8ef2cc282ab1ff12da9c595c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 15:50:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 15:50:22 -0500    

Click here for diff

Add commentary about what we're doing and why.  Apply the method used for  
padding in GenerationChunk to AllocChunkData, replacing the rather ad-hoc  
solution used in commit 7e3aa03b4.  Reorder fields in GenerationChunk so  
that the padding calculation will work even if sizeof(size_t) is different  
from sizeof(void *) --- likely that will never happen, but we don't need  
the assumption if we do it like this.  Improve static assertions about  
alignment.  
  
In passing, fix a couple of oversights in the "large chunk" path in  
GenerationAlloc().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/slab.c

Fix bug in generation.c's valgrind support.

commit   : cc3c4af4a948e5c5be22afe769bab41235c574e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 13:43:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 13:43:34 -0500    

Click here for diff

This doesn't look like the last such bug, but it's one that the  
test_decoding regression test is tripping over.  Per buildfarm.  
  
Tomas Vondra  
  
Discussion: https://postgr.es/m/[email protected]  

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

RLS comment fixes.

commit   : 9c55391f0f277318c754f89950e65363ede4136e    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 24 Nov 2017 14:14:40 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 24 Nov 2017 14:14:40 +0000    

Click here for diff

The comments in get_policies_for_relation() say that CREATE POLICY  
does not support defining restrictive policies. This is no longer  
true, starting from PG10.  

M src/backend/rewrite/rowsecurity.c

Fix broken XML in CREATE POLICY sgml.

commit   : 26329ad8dcc78eb651ab61f6b17c4f5f7bb77323    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 24 Nov 2017 13:59:25 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 24 Nov 2017 13:59:25 +0000    

Click here for diff

Commit 87c2a17fee failed to close some tags (necessary now that the  
SGML docs are in fact XML).  

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

Doc: add a summary table to the CREATE POLICY docs.

commit   : 87c2a17fee784c7e1004ba3d3c5d8147da676783    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 24 Nov 2017 12:01:18 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 24 Nov 2017 12:01:18 +0000    

Click here for diff

This table summarizes which RLS policy expressions apply to each  
command type, and whether they apply to the old or new tuples (or  
both), which saves reading through a lot of text.  
  
Rod Taylor, hacked on by me. Reviewed by Fabien Coelho.  
  
Discussion: https://postgr.es/m/CAHz80e4HxJShm6m9ZWFrHW=pgd2KP=RZmfFnEccujtPMiAOW5Q@mail.gmail.com  

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

Fix unstable regression test added by commits 59b71c6fe et al.

commit   : e842791b0f99dd2005fc2d1754755a632514e5e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 00:29:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Nov 2017 00:29:20 -0500    

Click here for diff

The query didn't really have a preferred index, leading to platform-  
specific choices of which one to use.  Adjust it to make sure tenk1_hundred  
is always chosen.  
  
Per buildfarm.  

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

Support linking with MinGW-built Perl.

commit   : 84c4313c6f6a3f67ccc2296e5a7674dee1979e7a    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 23 Nov 2017 20:22:04 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 23 Nov 2017 20:22:04 -0800    

Click here for diff

This is necessary for ActivePerl 5.18 onwards and for Strawberry Perl.  
It is not sufficient for 32-bit builds with newer Visual Studio; these  
fail with error LINK2026.  Back-patch to 9.3 (all supported versions).  
  
Reported by Victor Wagner.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/perl.m4
M configure
M src/pl/plperl/plperl.h
M src/tools/msvc/Mkvcbuild.pm

Fix handling of NULLs returned by aggregate combine functions.

commit   : 59b71c6fe6ca89566f40439bcdff94a2f5b39a92    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Nov 2017 17:13:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Nov 2017 17:13:09 -0800    

Click here for diff

When strict aggregate combine functions, used in multi-stage/parallel  
aggregation, returned NULL, we didn't check for that, invoking the  
combine function with NULL the next round, despite it being strict.  
  
The equivalent code invoking normal transition functions has a check  
for that situation, which did not get copied in a7de3dc5c346. Fix the  
bug by adding the equivalent check.  
  
Based on a quick look I could not find any strict combine functions in  
core actually returning NULL, and it doesn't seem very likely external  
users have done so. So this isn't likely to have caused issues in  
practice.  
  
Add tests verifying transition / combine functions returning NULL is  
tested.  
  
Reported-By: Andres Freund  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.6, where parallel aggregation was introduced  

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

Ensure sizeof(GenerationChunk) is maxaligned.

commit   : 07bd77b95a7846de2b193d1574951436d5783800    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Nov 2017 17:02:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Nov 2017 17:02:15 -0500    

Click here for diff

Per buildfarm.  
  
Also improve some comments.  

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

Convert documentation to DocBook XML

commit   : 3c49c6facb22cdea979f5d1465ba53f972d32163    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Nov 2017 09:39:47 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Nov 2017 09:39:47 -0500    

Click here for diff

Since some preparation work had already been done, the only source  
changes left were changing empty-element tags like <xref linkend="foo">  
to <xref linkend="foo"/>, and changing the DOCTYPE.  
  
The source files are still named *.sgml, but they are actually XML files  
now.  Renaming could be considered later.  
  
In the build system, the intermediate step to convert from SGML to XML  
is removed.  Everything is build straight from the source files again.  
The OpenSP (or the old SP) package is no longer needed.  
  
The documentation toolchain instructions are updated and are much  
simpler now.  
  
Peter Eisentraut, Alexander Lakhin, JĆ¼rgen Purtz  

M config/docbook.m4
M configure
M configure.in
M doc/src/sgml/Makefile
M doc/src/sgml/adminpack.sgml
M doc/src/sgml/advanced.sgml
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/array.sgml
M doc/src/sgml/auth-delay.sgml
M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/bgworker.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/dict-int.sgml
M doc/src/sgml/dict-xsyn.sgml
M doc/src/sgml/diskusage.sgml
M doc/src/sgml/dml.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/errcodes.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/intro.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/keywords.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/oid2name.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/passwordcheck.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgprewarm.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstandby.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/query.sgml
M doc/src/sgml/rangetypes.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/abort.sgml
M doc/src/sgml/ref/alter_aggregate.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_conversion.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_event_trigger.sgml
M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_language.sgml
M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_rule.sgml
M doc/src/sgml/ref/alter_schema.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_server.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/alter_trigger.sgml
M doc/src/sgml/ref/alter_tsconfig.sgml
M doc/src/sgml/ref/alter_tsdictionary.sgml
M doc/src/sgml/ref/alter_tsparser.sgml
M doc/src/sgml/ref/alter_tstemplate.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/alter_user_mapping.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/begin.sgml
M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/ref/close.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/commit_prepared.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_access_method.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_cast.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_conversion.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_extension.sgml
M doc/src/sgml/ref/create_foreign_data_wrapper.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/ref/create_opfamily.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/create_rule.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M doc/src/sgml/ref/create_transform.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_tsconfig.sgml
M doc/src/sgml/ref/create_tsdictionary.sgml
M doc/src/sgml/ref/create_tsparser.sgml
M doc/src/sgml/ref/create_tstemplate.sgml
M doc/src/sgml/ref/create_type.sgml
M doc/src/sgml/ref/create_user.sgml
M doc/src/sgml/ref/create_user_mapping.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/deallocate.sgml
M doc/src/sgml/ref/declare.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/discard.sgml
M doc/src/sgml/ref/do.sgml
M doc/src/sgml/ref/drop_access_method.sgml
M doc/src/sgml/ref/drop_aggregate.sgml
M doc/src/sgml/ref/drop_cast.sgml
M doc/src/sgml/ref/drop_collation.sgml
M doc/src/sgml/ref/drop_conversion.sgml
M doc/src/sgml/ref/drop_database.sgml
M doc/src/sgml/ref/drop_domain.sgml
M doc/src/sgml/ref/drop_event_trigger.sgml
M doc/src/sgml/ref/drop_extension.sgml
M doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
M doc/src/sgml/ref/drop_foreign_table.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/drop_group.sgml
M doc/src/sgml/ref/drop_index.sgml
M doc/src/sgml/ref/drop_language.sgml
M doc/src/sgml/ref/drop_materialized_view.sgml
M doc/src/sgml/ref/drop_opclass.sgml
M doc/src/sgml/ref/drop_operator.sgml
M doc/src/sgml/ref/drop_opfamily.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/ref/drop_publication.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/drop_rule.sgml
M doc/src/sgml/ref/drop_schema.sgml
M doc/src/sgml/ref/drop_sequence.sgml
M doc/src/sgml/ref/drop_server.sgml
M doc/src/sgml/ref/drop_statistics.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/ref/drop_table.sgml
M doc/src/sgml/ref/drop_tablespace.sgml
M doc/src/sgml/ref/drop_transform.sgml
M doc/src/sgml/ref/drop_trigger.sgml
M doc/src/sgml/ref/drop_tsconfig.sgml
M doc/src/sgml/ref/drop_tsdictionary.sgml
M doc/src/sgml/ref/drop_tsparser.sgml
M doc/src/sgml/ref/drop_tstemplate.sgml
M doc/src/sgml/ref/drop_type.sgml
M doc/src/sgml/ref/drop_user.sgml
M doc/src/sgml/ref/drop_user_mapping.sgml
M doc/src/sgml/ref/drop_view.sgml
M doc/src/sgml/ref/dropdb.sgml
M doc/src/sgml/ref/dropuser.sgml
M doc/src/sgml/ref/ecpg-ref.sgml
M doc/src/sgml/ref/end.sgml
M doc/src/sgml/ref/execute.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/import_foreign_schema.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/listen.sgml
M doc/src/sgml/ref/load.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/move.sgml
M doc/src/sgml/ref/notify.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_isready.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/ref/postmaster.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/prepare_transaction.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/release_savepoint.sgml
M doc/src/sgml/ref/reset.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/rollback.sgml
M doc/src/sgml/ref/rollback_prepared.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/ref/savepoint.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/select_into.sgml
M doc/src/sgml/ref/set.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/ref/set_transaction.sgml
M doc/src/sgml/ref/show.sgml
M doc/src/sgml/ref/start_transaction.sgml
M doc/src/sgml/ref/truncate.sgml
M doc/src/sgml/ref/unlisten.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M doc/src/sgml/ref/values.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-8.0.sgml
M doc/src/sgml/release-8.1.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/release-old.sgml
M doc/src/sgml/replication-origins.sgml
M doc/src/sgml/rowtypes.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sourcerepo.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/standalone-install.xml
M doc/src/sgml/start.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/tablesample-method.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/trigger.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M doc/src/sgml/typeconv.sgml
M doc/src/sgml/user-manag.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/vacuumlo.sgml
M doc/src/sgml/wal.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xml2.sgml
M doc/src/sgml/xoper.sgml
M doc/src/sgml/xplang.sgml
M doc/src/sgml/xtypes.sgml
M src/Makefile.global.in

doc: mention wal_receiver_status_interval as GUC affecting logical rep worker.

commit   : 2f8d6369e60a244f28e0c93b8a02e73758322915    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 23 Nov 2017 16:46:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 23 Nov 2017 16:46:42 +0900    

Click here for diff

wal_receiver_timeout, wal_receiver_status_interval and  
wal_retrieve_retry_interval configuration parameters affect the logical rep  
worker, but previously only wal_receiver_status_interval was not mentioned  
as such parameter in the doc.  
  
Back-patch to v10 where logical rep was added.  
  
Author: Masahiko Sawada  
Discussion: https://www.postgresql.org/message-id/CAD21AoBUnuH_UsnKXyPCsCR7EAMamW0sSb6a7=WgiQRpnMAp5w@mail.gmail.com  

M doc/src/sgml/config.sgml

Build src/test/isolation during "make" and "make install".

commit   : de0aca6a82af9c04cb4634d091ab065763fd4d5a    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 22 Nov 2017 20:18:15 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 22 Nov 2017 20:18:15 -0800    

Click here for diff

This hack closes a race condition in "make -j check-world" and "make -j  
installcheck-world".  Back-patch to v10, before which these parallel  
invocations had worse problems.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile
M src/test/isolation/Makefile

Fix typo

commit   : 2393194c0dded22972f03dd53dcbf864dab8ebc6    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 22 Nov 2017 21:51:55 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 22 Nov 2017 21:51:55 +0100    

Click here for diff

Daniel Gustafsson  

M src/bin/pg_upgrade/relfilenode.c

Tweak code for older compilers

commit   : b99661c2ff4eef923abd96d2a733556f5f64c2d6    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 06:55:18 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 06:55:18 +1100    

Click here for diff

Attempt to quiesce build farm  
  
Author: Tomas Vondra  

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

Generational memory allocator

commit   : a4ccc1cef5a04cc054af83bc4582a045d5232cb3    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 05:45:07 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 05:45:07 +1100    

Click here for diff

Add new style of memory allocator, known as Generational  
appropriate for use in cases where memory is allocated  
and then freed in roughly oldest first order (FIFO).  
  
Use new allocator for logical decodingā€™s reorderbuffer  
to significantly reduce memory usage and improve performance.  
  
Author: Tomas Vondra  
Reviewed-by: Simon Riggs  

M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/mmgr/Makefile
M src/backend/utils/mmgr/README
A src/backend/utils/mmgr/generation.c
M src/include/nodes/memnodes.h
M src/include/nodes/nodes.h
M src/include/replication/reorderbuffer.h
M src/include/utils/memutils.h

Sort default partition to bottom of psql \d+

commit   : 3bae43ca4dc6c3123788044436521f1d33d9f930    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 05:17:47 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 05:17:47 +1100    

Click here for diff

Minor patch to change sort order only  
  
Author: Ashutosh Bapat  
Reviewed-by:  Ɓlvaro Herrera, Simon Riggs  

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

Show partition info from psql \d+

commit   : 05b6ec39d72f7065bb5ce770319e826f1da92441    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 05:10:39 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 23 Nov 2017 05:10:39 +1100    

Click here for diff

Author: Amit Langote, Ashutosh Bapat  
Reviewed-by:  Ɓlvaro Herrera, Simon Riggs  

M src/bin/psql/describe.c
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/insert.out
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/insert.sql

Set es_output_cid in replication worker

commit   : 7e17a6889a4441c2cebca2dd47f4170ff8dc5de2    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 22 Nov 2017 16:28:14 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 22 Nov 2017 16:28:14 +1100    

Click here for diff

Allows triggers to operate correctly  
  
Author: Petr Jelinek <[email protected]>  
Reported-by: Konstantin Knizhnik <[email protected]>  

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

pgbench: fix stats reporting when some transactions are skipped.

commit   : 16827d442448d1935ed644e944a4cb8213345351    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Nov 2017 17:30:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Nov 2017 17:30:48 -0500    

Click here for diff

pgbench can skip some transactions when both -R and -L options are used.  
Previously, this resulted in slightly silly statistics both in progress  
reports and final output, because the skipped transactions were counted  
as executed for TPS and related stats.  Discount skipped xacts in TPS  
numbers, and also when figuring the percentage of xacts exceeding the  
latency limit.  
  
Also, don't print per-script skipped-transaction counts when there is  
only one script.  That's redundant with the overall count, and it's  
inconsistent with the fact that we don't print other per-script stats  
when there's only one script.  Clean up some unnecessary interactions  
between what should be independent options that were due to that  
decision.  
  
While at it, avoid division-by-zero in cases where no transactions were  
executed.  While on modern platforms this would generally result in  
printing "NaN" rather than a crash, that isn't spelled consistently  
across platforms and it would confuse many people.  Skip the relevant  
output entirely when practical, else print zeroes.  
  
Fabien Coelho, reviewed by Steve Singer, additional hacking by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Doc: fix broken markup.

commit   : 41761265e88f09fba4028352b8e2be82d049cedc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Nov 2017 16:37:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Nov 2017 16:37:11 -0500    

Click here for diff

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

Provide for forward compatibility with future minor protocol versions.

commit   : ae65f6066dc3d19a55f4fdcd3b30003c5ad8dbed    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 Nov 2017 13:56:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 Nov 2017 13:56:24 -0500    

Click here for diff

Previously, any attempt to request a 3.x protocol version other than  
3.0 would lead to a hard connection failure, which made the minor  
protocol version really no different from the major protocol version  
and precluded gentle protocol version breaks.  Instead, when the  
client requests a 3.x protocol version where x is greater than 0, send  
the new NegotiateProtocolVersion message to convey that we support  
only 3.0.  This makes it possible to introduce new minor protocol  
versions without requiring a connection retry when the server is  
older.  
  
In addition, if the startup packet includes name/value pairs where  
the name starts with "_pq_.", assume that those are protocol options,  
not GUCs.  Include those we don't support (i.e. all of them, at  
present) in the NegotiateProtocolVersion message so that the client  
knows they were not understood.  This makes it possible for the  
client to request previously-unsupported features without bumping  
the protocol version at all; the client can tell from the server's  
response whether the option was understood.  
  
It will take some time before servers that support these new  
facilities become common in the wild; to speed things up and make  
things easier for a future 3.1 protocol version, back-patch to all  
supported releases.  
  
Robert Haas and Badrul Chowdhury  
  
Discussion: http://postgr.es/m/BN6PR21MB0772FFA0CBD298B76017744CD1730@BN6PR21MB0772.namprd21.prod.outlook.com  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/postmaster/postmaster.c

Fix multiple problems with satisfies_hash_partition.

commit   : f3b0897a1213f46b4d3a99a7f8ef3a4b32e03572    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 Nov 2017 13:06:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 Nov 2017 13:06:32 -0500    

Click here for diff

Fix the function header comment to describe the actual behavior.  
Check that table OID, modulus, and remainder arguments are not NULL  
before accessing them.  Check that the modulus and remainder are  
sensible.  If the table OID doesn't exist, return NULL instead of  
emitting an internal error, similar to what we do elsewhere.  Check  
that the actual argument types match, or at least are binary coercible  
to, the expected argument types.  Correctly handle invocation of this  
function using the VARIADIC syntax.  Add regression tests.  
  
Robert Haas and Amul Sul, per a report by Andreas Seltenreich and  
subsequent followup investigation.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
A src/test/regress/expected/hash_part.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/hash_part.sql

Support index-only scans in contrib/cube and contrib/seg GiST indexes.

commit   : de1d042f5979bc1388e9a6d52a4d445342b04932    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Nov 2017 20:25:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Nov 2017 20:25:18 -0500    

Click here for diff

To do this, we only have to remove the compress and decompress support  
functions, which have never done anything more than detoasting.  
In the wake of commit d3a4f89d8, this results in automatically enabling  
index-only scans, since the core code will now know that the stored  
representation is the same as the original data (up to detoasting).  
  
The only exciting part of this is that ALTER OPERATOR FAMILY lacks  
a way to drop a support function that was declared as being part of  
an opclass rather than being loose in the family.  For the moment,  
we'll hack our way to a solution with a manual update of the pg_depend  
entry type, which is what distinguishes the two cases.  Perhaps  
someday it'll be worth providing a cleaner way to do that, but for  
now it seems like a very niche problem.  
  
Note that the underlying C functions remain, to support use of the shared  
libraries with older versions of the modules' SQL declarations.  Someday  
we may be able to remove them, but not soon.  
  
Andrey Borodin, reviewed by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/cube/Makefile
A contrib/cube/cube–1.3–1.4.sql
M contrib/cube/cube.control
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_2.out
M contrib/cube/sql/cube.sql
M contrib/seg/Makefile
M contrib/seg/expected/seg.out
M contrib/seg/expected/seg_1.out
A contrib/seg/seg–1.2–1.3.sql
M contrib/seg/seg.control
M contrib/seg/sql/seg.sql

Use out-of-line M68K spinlock code for OpenBSD as well as NetBSD.

commit   : 84669c9b06ba0d2485007643322bd3fcaa8c729e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Nov 2017 18:05:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Nov 2017 18:05:02 -0500    

Click here for diff

David Carlier (from a patch being carried by OpenBSD packagers)  
  
Discussion: https://postgr.es/m/CA+XhMqzwFSGVU7MEnfhCecc8YdP98tigXzzpd0AAdwaGwaVXEA@mail.gmail.com  

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

Add support for Motorola 88K to s_lock.h.

commit   : f3bd00c0168abaf13ac0733a77bc1106d3f6720d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Nov 2017 17:57:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Nov 2017 17:57:46 -0500    

Click here for diff

Apparently there are still people out there who care about this old  
architecture.  They probably care about dusty versions of Postgres  
too, so back-patch to all supported branches.  
  
David Carlier (from a patch being carried by OpenBSD packagers)  
  
Discussion: https://postgr.es/m/CA+XhMqzwFSGVU7MEnfhCecc8YdP98tigXzzpd0AAdwaGwaVXEA@mail.gmail.com  

M src/include/storage/s_lock.h

Fix pg_control_checkpoint from commit 4b0d28de06

commit   : 2ede45c3a49e484edfa143850d55eb32dba296de    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 21 Nov 2017 08:00:54 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 21 Nov 2017 08:00:54 +1100    

Click here for diff

Author: Simon Riggs <[email protected]>  
Reported-By: Andreas Seltenreich <[email protected]>  

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

Tweak use of ExecContextForcesOids by Gather (Merge).

commit   : 0510421ee091ee3ddabdd5bd7ed096563f6bf17f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Nov 2017 12:34:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Nov 2017 12:34:06 -0500    

Click here for diff

Specifically, pass the outer plan's PlanState instead of our own  
PlanState.  At present, ExecContextForcesOids doesn't actually care  
which PlanState we pass; it just looks through to the underlying  
EState to find the result relation or top-level eflags.  However, in  
the future it might care.  If that happens, and if our goal is to get  
a tuple descriptor that matches that of the outer plan, then I think  
what we care about is whether the outer plan's context forces OIDs,  
rather than whether our own context forces OIDs, just as we use the  
outer node's target list rather than our own.  
  
Patch by me, reviewed by Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoZ0ZL=cesZFq8c9NnfK6bqy-wwUd3_74iYGodYrSoQ7Fw@mail.gmail.com  

M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c

Pass eflags down to parallel workers.

commit   : f455e1125e2588d4cd4fc663c6a10da4e003a3b5    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Nov 2017 12:00:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Nov 2017 12:00:33 -0500    

Click here for diff

Currently, there are no known consequences of this oversight, so no  
back-patch.  Several of the EXEC_FLAG_* constants aren't usable in  
parallel mode anyway, and potential problems related to the presence  
or absence of OIDs (see EXEC_FLAG_WITH_OIDS, EXEC_FLAG_WITHOUT_OIDS)  
seem at present to be masked by the unconditional projection step  
performed by Gather and Gather Merge.  In general, however, it seems  
important that all participants agree on the values of these flags,  
which modify executor behavior globally, and a pending patch to skip  
projection in Gather (Merge) would be outright broken in certain cases  
without this fix.  
  
Patch by me, based on investigation of a test case provided by Amit  
Kapila.  This patch was also reviewed by Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoZ0ZL=cesZFq8c9NnfK6bqy-wwUd3_74iYGodYrSoQ7Fw@mail.gmail.com  

M src/backend/executor/execParallel.c

Reduce test variability for toast_tuple_target test

commit   : 56f34686220731eef72dfd129519b25f28406db1    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 20 Nov 2017 12:09:40 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 20 Nov 2017 12:09:40 +1100    

Click here for diff

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

Parameter toast_tuple_target controls TOAST for new rows

commit   : c2513365a0a85e77d3c21adb92fe12cfbe0d1897    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 20 Nov 2017 09:50:10 +1100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 20 Nov 2017 09:50:10 +1100    

Click here for diff

Specifies the point at which we try to move long column values  
into TOAST tables.  
  
No effect on existing rows.  
  
Discussion: https://postgr.es/m/CANP8+jKsVmw6CX6YP9z7zqkTzcKV1+Uzr3XjKcZW=2Ya00OyQQ@mail.gmail.com  
  
Author: Simon Riggs <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/tuptoaster.c
M src/include/utils/rel.h
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Fix compiler warning in rangetypes_spgist.c.

commit   : 52f63bd916184b5f07130c293475d0cf4f202a86    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 16:46:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 16:46:29 -0500    

Click here for diff

On gcc 7.2.0, comparing pointer to (Datum) 0 produces a warning.  
Treat it as a simple pointer to avoid that; this is more consistent  
with comparable code elsewhere, anyway.  
  
Tomas Vondra  
  
Discussion: https://postgr.es/m/[email protected]  

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

Merge near-duplicate code in RI triggers.

commit   : 4797f9b519995ceca5d6b8550b5caa2ff6d19347    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 16:24:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 16:24:05 -0500    

Click here for diff

Merge ri_restrict_del and ri_restrict_upd into one function ri_restrict.  
Create a function ri_setnull that is the common implementation of  
RI_FKey_setnull_del and RI_FKey_setnull_upd.  Likewise create a function  
ri_setdefault that is the common implementation of RI_FKey_setdefault_del  
and RI_FKey_setdefault_upd.  All of these pairs of functions were identical  
except for needing to check for no-actual-key-change in the UPDATE cases;  
the one extra if-test is a small price to pay for saving so much code.  
  
Aside from removing about 400 lines of essentially duplicate code, this  
allows us to recognize that we were uselessly caching two identical plans  
whenever there were pairs of triggers using these duplicated functions  
(which is likely very common).  
  
Ildar Musin, reviewed by Ildus Kurbangaliev  
  
Discussion: https://postgr.es/m/[email protected]  

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

Consistently catch errors from Python _New() functions

commit   : d0aa965c0a0ac2ff7906ae1b1dad50a7952efa56    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 Oct 2017 10:49:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 Oct 2017 10:49:36 -0400    

Click here for diff

Python Py*_New() functions can fail and return NULL in out-of-memory  
conditions.  The previous code handled that inconsistently or not at  
all.  This change organizes that better.  If we are in a function that  
is called from Python, we just check for failure and return NULL  
ourselves, which will cause any exception information to be passed up.  
If we are called from PostgreSQL, we consistently create an "out of  
memory" error.  
  
Reviewed-by: Tom Lane <[email protected]>  

M contrib/hstore_plpython/hstore_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c

Improve to_date/to_number/to_timestamp behavior with multibyte characters.

commit   : 976a1a48fc35cde3c750982be64f872c4de4d343    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 12:42:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 12:42:52 -0500    

Click here for diff

The documentation says that these functions skip one input character  
per literal (non-pattern) format character.  Actually, though, they  
skipped one input *byte* per literal *byte*, which could be hugely  
confusing if either data or format contained multibyte characters.  
  
To fix, adjust the FormatNode representation and parse_format() so  
that multibyte format characters are stored as one FormatNode not  
several, and adjust the data-skipping bits to advance by pg_mblen()  
not necessarily one byte.  There's no user-visible behavior change  
on the to_char() side, although the internal representation changes.  
  
Commit e87d4965b had already fixed most places where we skip characters  
on the basis of non-literal format patterns to advance by characters  
not bytes, but this gets one more place, the SKIP_THth macro.  I think  
everything in formatting.c gets that right now.  
  
It'd be nice to have some regression test cases covering this behavior;  
but of course there's no way to do so in an encoding-agnostic way, and  
many of the interesting aspects would also require unportable locale  
selections.  So I've not bothered here.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix quoted-substring handling in format parsing for to_char/to_number/etc.

commit   : 63ca86318dc3d6a768eed78efbc6ca014a0622a8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 12:16:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Nov 2017 12:16:37 -0500    

Click here for diff

This code evidently intended to treat backslash as an escape character  
within double-quoted substrings, but it was sufficiently confused that  
cases like ..."foo\\"... did not work right: the second backslash  
managed to quote the double-quote after it, despite being quoted itself.  
Rewrite to get that right, while preserving the existing behavior  
outside double-quoted substrings, which is that backslash isn't special  
except in the combination \".  
  
Comparing to Oracle, it seems that their version of to_char() for  
timestamps allows literal alphanumerics only within double quotes, while  
non-alphanumerics are allowed outside quotes; backslashes aren't special  
anywhere; there is no way at all to emit a literal double quote.  
(Bizarrely, their to_char() for numbers is different; it doesn't allow  
literal text at all AFAICT.)  The fact that they don't treat backslash  
as special justifies our existing behavior for backslash outside double  
quotes.  I considered making backslash inside double quotes act the same  
way (ie, special only if before "), which in a green field would be a  
more consistent behavior.  But that would likely break more existing SQL  
code than what this patch does.  
  
Add some test cases illustrating this behavior.  (Only the last new  
case actually changes behavior in this commit.)  
  
Little of this behavior was documented, either, so fix that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Support channel binding 'tls-unique' in SCRAM

commit   : 9288d62bb4b6f302bf13bb2fed3783b61385f315    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Nov 2017 10:07:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Nov 2017 10:07:57 -0500    

Click here for diff

This is the basic feature set using OpenSSL to support the feature.  In  
order to allow the frontend and the backend to fetch the sent and  
expected TLS Finished messages, a PG-like API is added to be able to  
make the interface pluggable for other SSL implementations.  
  
This commit also adds a infrastructure to facilitate the addition of  
future channel binding types as well as libpq parameters to control the  
SASL mechanism names and channel binding names.  Those will be added by  
upcoming commits.  
  
Some tests are added to the SSL test suite to test SCRAM authentication  
with channel binding.  
  
Author: Michael Paquier <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  

M doc/src/sgml/protocol.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/include/libpq/libpq-be.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl
A src/test/ssl/t/002_scram.pl

Update postgresql.conf.sample comment for bgwriter_lru_maxpages

commit   : 611fe7d4793ba6516e839dc50b5319b990283f4f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Nov 2017 14:52:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Nov 2017 14:52:00 -0500    

Click here for diff

Commit 14ca9abfbe4643408ad6ed3279f2f6366cafb3f1 should have done  
this, but did not.  
  
Jeff Janes  
  
Discussion: http://postgr.es/m/CAMkU=1yWOvL+YFYzGM9yXSoWjxr_5_Ny78pPzLKQCkfgB7H-JQ@mail.gmail.com  

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

Remove contrib/start-scripts/osx/.

commit   : 527878635030489e464d965b3b64f6caf178f641    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2017 12:53:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2017 12:53:20 -0500    

Click here for diff

Since those scripts haven't worked at all in macOS releases of 2014  
and later, and aren't the recommended way to do it on any release  
since 2005, there seems little point carrying them into the future.  
It's very unlikely that anyone would be installing PG >= 11 on a  
macOS release where they couldn't use contrib/start-scripts/macos/.  
  
Discussion: https://postgr.es/m/[email protected]  

D contrib/start-scripts/osx/PostgreSQL
D contrib/start-scripts/osx/README
D contrib/start-scripts/osx/StartupParameters.plist
D contrib/start-scripts/osx/install.sh

Provide modern examples of how to auto-start Postgres on macOS.

commit   : ac3b9626812b1dd1482ec201711f26af733800f9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2017 12:46:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2017 12:46:52 -0500    

Click here for diff

The scripts in contrib/start-scripts/osx don't work at all on macOS  
10.10 (Yosemite) or later, because they depend on SystemStarter which  
Apple deprecated long ago and removed in 10.10.  Add a new subdirectory  
contrib/start-scripts/macos with scripts that use the newer launchd  
infrastructure.  
  
Since this problem is independent of which Postgres version you're using,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

A contrib/start-scripts/macos/README
A contrib/start-scripts/macos/org.postgresql.postgres.plist
A contrib/start-scripts/macos/postgres-wrapper.sh
M contrib/start-scripts/osx/README

Prevent to_number() from losing data when template doesn't match exactly.

commit   : e87d4965bd39e4d0d56346c1bbe9361d3eb9ff0a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2017 12:04:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Nov 2017 12:04:06 -0500    

Click here for diff

Non-data template patterns would consume characters whether or not those  
characters were what the pattern expected, for example  
	SELECT TO_NUMBER('1234', '9,999');  
produced 134 because the '2' got eaten by the comma pattern.  This seems  
undesirable, not least because it doesn't happen in Oracle.  For the ','  
and 'G' template patterns, we can fix this by consuming characters only  
if they match what the pattern would output.  For non-data patterns such  
as 'L' and 'TH', it seems impractical to tighten things up to the point of  
consuming only exact matches to what the pattern would output; but we can  
improve matters quite a lot by redefining the behavior as "consume only  
characters that aren't digits, signs, decimal point, or comma".  
  
Also, fix it so that the behavior is to consume the number of *characters*  
the pattern would output, not the number of *bytes*.  The old coding would  
do surprising things with non-ASCII currency symbols, for example.  (It  
would be good to apply that rule for literal text as well, but this commit  
only fixes it for non-data patterns.)  
  
Oliver Ford, reviewed by Thomas Munro and Nathan Wagner, and whacked around  
a bit more by me  
  
Discussion: https://postgr.es/m/CAGMVOdvpbMqPf9XWNzOwBpzJfErkydr_fEGhmuDGa015z97mwg@mail.gmail.com  

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

Set proargmodes for satisfies_hash_partition.

commit   : be92769e4e63de949fe3ba29e0bf5c0a96f54ae3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Nov 2017 11:53:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Nov 2017 11:53:00 -0500    

Click here for diff

It appears that proargmodes should always be set for variadic  
functions, but satifies_hash_partition had it as NULL.  In addition to  
fixing the problem, add a regression test to guard against future  
mistakes of this type.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql

Remove BufFile's isTemp flag.

commit   : 11e264517dff7a911d9e6494de86049cab42cde3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Nov 2017 17:52:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Nov 2017 17:52:57 -0800    

Click here for diff

The isTemp flag controls whether buffile.c chops BufFile data up into  
1GB segments on disk.  Since it was badly named and always true, get  
rid of it.  
  
Author: Thomas Munro (based on suggestion by Peter Geoghegan)  
Reviewed-By: Peter Geoghegan, Andres Freund  
Discussion: https://postgr.es/m/CAH2-Wz%3D%2B9Rfqh5UdvdW9rGezdhrMGGH-JL1X9FXXVZdeeGeOJA%40mail.gmail.com  

M src/backend/storage/file/buffile.c

Provide DSM segment to ExecXXXInitializeWorker functions.

commit   : 7082e614c0dd504cdf49c4d5a692159f22e78f9d    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Nov 2017 17:28:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Nov 2017 17:28:11 -0800    

Click here for diff

Previously, executor nodes running in parallel worker processes didn't  
have access to the dsm_segment object used for parallel execution.  In  
order to support resource management based on DSM segment lifetime,  
they need that.  So create a ParallelWorkerContext object to hold it  
and pass it to all InitializeWorker functions.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=2W=cOkiZxcg6qiFQP-dHUe09aqTrEMM7yJDrHMhDv_RA@mail.gmail.com  

M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSort.c
M src/include/access/parallel.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/executor/nodeSort.h
M src/tools/pgindent/typedefs.list

Clean up warnings in MinGW builds.

commit   : 09a777447a858a01ac4d547d678ba295d9542c3b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 17:57:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 17:57:38 -0500    

Click here for diff

Experimentation with modern MinGW (specifically the 5.0.2 version packaged  
for Fedora 26) shows that its version of sys/stat.h *does* provide S_IRGRP  
and friends, contrary to the expectation of win32_port.h.  This results in  
an astonishing number of compiler warnings, and perhaps in incorrect code  
--- I'm not sure if the nonzero values supplied by MinGW's header actually  
do anything.  Hence, adjust win32_port.h to only define these macros if  
<sys/stat.h> doesn't.  
  
This might be worth back-patching, but given the lack of complaints so  
far, I'm not too excited about it.  

M src/include/port/win32_port.h

Make PL/Python handle domain-type conversions correctly.

commit   : 687f096ea9da82d267f1809a5f3fdfa027092045    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 16:22:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 16:22:57 -0500    

Click here for diff

Fix PL/Python so that it can handle domains over composite, and so that  
it enforces domain constraints correctly in other cases that were not  
always done properly before.  Notably, it didn't do arrays of domains  
right (oversight in commit c12d570fa), and it failed to enforce domain  
constraints when returning a composite type containing a domain field,  
and if a transform function is being used for a domain's base type then  
it failed to enforce domain constraints on the result.  Also, in many  
places it missed checking domain constraints on null values, because  
the plpy_typeio code simply wasn't called for Py_None.  
  
Rather than try to band-aid these problems, I made a significant  
refactoring of the plpy_typeio logic.  The existing design of recursing  
for array and composite members is extended to also treat domains as  
containers requiring recursion, and the APIs for the module are cleaned  
up and simplified.  
  
The patch also modifies plpy_typeio to rely on the typcache more than  
it did before (which was pretty much not at all).  This reduces the  
need for repetitive lookups, and lets us get rid of an ad-hoc scheme  
for detecting changes in composite types.  I added a couple of small  
features to typcache to help with that.  
  
Although some of this is fixing bugs that long predate v11, I don't  
think we should risk a back-patch: it's a significant amount of code  
churn, and there've been no complaints from the field about the bugs.  
  
Tom Lane, reviewed by Anthony Bykov  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql
M src/backend/utils/cache/typcache.c
M src/include/utils/typcache.h
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_cursorobject.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_planobject.h
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_procedure.h
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/sql/plpython_types.sql

Remove redundant line from Makefile.

commit   : 575cead991398aac255cf6f0e333c6d59053cf55    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 15:30:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 15:30:56 -0500    

Click here for diff

Masahiko Sawada, reviewed by Michael Paquier  
  
Discussion: http://postgr.es/m/CAD21AoDFes_Mgye-1K89rmTgeU3RxYF3zgTjzCJVq2KzzcpC4A@mail.gmail.com  

M src/test/recovery/Makefile

Fix broken cleanup interlock for GIN pending list.

commit   : 3b2787e1f8f1eeeb6bd9565288ab210262705b56    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 14:19:27 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 14:19:27 -0500    

Click here for diff

The pending list must (for correctness) always be cleaned up by vacuum, and  
should (for the avoidance of surprising behavior) always be cleaned up  
by an explicit call to gin_clean_pending_list, but cleanup is optional  
when inserting.  The old logic got this backward: cleanup was forced  
if (stats == NULL), but that's going to be *false* when vacuuming and  
*true* for inserts.  
  
Masahiko Sawada, reviewed by me.  
  
Discussion: http://postgr.es/m/CAD21AoBLUSyiYKnTYtSAbC+F=XDjiaBrOUEGK+zUXdQ8owfPKw@mail.gmail.com  

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

Fix typo in comment.

commit   : 6b2cd278a9d1e4643c419b598780aa55520f4f1a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 14:16:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 14:16:45 -0500    

Click here for diff

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

M src/backend/catalog/partition.c

Update postgresql.conf.sample to match pg_settings classificaitons.

commit   : 79f2d637139f117a7be2e751328b504f1decd9b7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 12:57:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 12:57:17 -0500    

Click here for diff

A handful of settings, most notably shared_preload_libraries, were  
just plain the wrong place compared to their assigned config_group  
value in guc.c (and thus pg_settings).  In other cases the names of  
the sections in postgresql.conf.sample were mildly different from  
the corresponding entries in config_group_names[].  Make it all  
consistent.  
  
AdriƔn Escoms, reviewed by me.  
  
Discussion: http://postgr.es/m/CACksPC2veEmFRYqwYepWYO9U7aFhAx6sYq+WqjTyHw7uV=E=pw@mail.gmail.com  

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

Pass InitPlan values to workers via Gather (Merge).

commit   : e89a71fb449af2ef74f47be1175f99956cf21524    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 12:06:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Nov 2017 12:06:14 -0500    

Click here for diff

If a PARAM_EXEC parameter is used below a Gather (Merge) but the InitPlan  
that computes it is attached to or above the Gather (Merge), force the  
value to be computed before starting parallelism and pass it down to all  
workers.  This allows us to use parallelism in cases where it previously  
would have had to be rejected as unsafe.  We do - in this case - lose the  
optimization that the value is only computed if it's actually used.  An  
alternative strategy would be to have the first worker that needs the value  
compute it, but one downside of that approach is that we'd then need to  
select a parallel-safe path to compute the parameter value; it couldn't for  
example contain a Gather (Merge) node.  At some point in the future, we  
might want to consider both approaches.  
  
Independent of that consideration, there is a great deal more work that  
could be done to make more kinds of PARAM_EXEC parameters parallel-safe.  
This infrastructure could be used to allow a Gather (Merge) on the inner  
side of a nested loop (although that's not a very appealing plan) and  
cases where the InitPlan is attached below the Gather (Merge) could be  
addressed as well using various techniques.  But this is a good start.  
  
Amit Kapila, reviewed and revised by me.  Reviewing and testing from  
Kuntal Ghosh, Haribabu Kommi, and Tushar Ahuja.  
  
Discussion: http://postgr.es/m/CAA4eK1LV0Y1AUV4cUCdC+sYOx0Z0-8NAJ2Pd9=UKsbQ5Sr7+JQ@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execParallel.c
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/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/nodes/plannodes.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Define _WINSOCK_DEPRECATED_NO_WARNINGS in all MSVC builds.

commit   : ff2d4356f8b18f5489e5d7b1f8b4b5357d088c8c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 12:03:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 12:03:04 -0500    

Click here for diff

Commit 0fb54de9a thought that this was only needed in VS2015 and later,  
but buildfarm member woodlouse shows that at least VS2013 whines as  
well.  Let's just define it regardless of MSVC version; it should be  
harmless enough in older releases.  
  
Also, in the wake of ed9b3606d, it seems better to put it in win32_port.h  
where <winsock2.h> is included.  
  
Since this is only suppressing a pedantic compiler warning, I don't  
feel a need for a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/win32.h
M src/include/port/win32_port.h

Back out the session_start and session_end hooks feature.

commit   : 98d54bb7790d5fb0a77173d5e5e3c655901b472c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 16 Nov 2017 11:35:02 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 16 Nov 2017 11:35:02 -0500    

Click here for diff

It's become apparent during testing that there are problems with at  
least the testing regime. I don't think we should have it without a  
working test regime, and the difficulties might indicate implementation  
problems anyway, so I'm backing out the whole thing until that's sorted  
out.  
  
This reverts commits 7459484 9989f92 cd8ce3a  

M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/tcop/tcopprot.h
M src/test/modules/Makefile
D src/test/modules/test_session_hooks/.gitignore
D src/test/modules/test_session_hooks/Makefile
D src/test/modules/test_session_hooks/README
D src/test/modules/test_session_hooks/expected/test_session_hooks.out
D src/test/modules/test_session_hooks/session_hooks.conf
D src/test/modules/test_session_hooks/sql/test_session_hooks.sql
D src/test/modules/test_session_hooks/test_session_hooks–1.0.sql
D src/test/modules/test_session_hooks/test_session_hooks.c
D src/test/modules/test_session_hooks/test_session_hooks.control
M src/tools/msvc/vcregress.pl

Fix bogus logic for checking data dirs' versions within pg_upgrade.

commit   : 164d6338785b0b6c5a1ac30ee3e4b63bd77441ba    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 11:16:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 11:16:53 -0500    

Click here for diff

Commit 9be95ef15 failed to cure all of the redundancy here: we were  
actually calling get_major_server_version() three times for each  
of the old and new data directories.  While that's not enormously  
expensive, it's still sloppy.  
  
A. Akenteva  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/exec.c

Further refactoring of c.h and nearby files.

commit   : ed9b3606dadb461aac57e41ac509f3892095a394    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 10:36:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Nov 2017 10:36:18 -0500    

Click here for diff

This continues the work of commit 91aec93e6 by getting rid of a lot of  
Windows-specific funny business in "section 0".  Instead of including  
pg_config_os.h in different places depending on platform, let's  
standardize on putting it before the system headers, and in consequence  
reduce win32.h to just what has to appear before the system headers or  
the body of c.h (the latter category seems to include only PGDLLIMPORT  
and PGDLLEXPORT).  The rest of what was in win32.h is moved to a new  
sub-include of port.h, win32_port.h.  Some of what was in port.h seems  
to better belong there too.  
  
It's possible that I missed some declaration ordering dependency that  
needs to be preserved, but hopefully the buildfarm will find that  
out in short order.  
  
Unlike the previous commit, no back-patch, since this is just cleanup  
not a prerequisite for a bug fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c
M src/include/c.h
M src/include/port.h
M src/include/port/win32.h
A src/include/port/win32_port.h

Refactor routine to test connection to SSL server

commit   : 642bafa0c5f9f08d106a14f31429e0e0c718b603    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Nov 2017 08:41:40 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Nov 2017 08:41:40 -0500    

Click here for diff

Move the sub-routines wrappers to check if a connection to a server is  
fine or not into the test main module. This is useful for other tests  
willing to check connectivity into a server.  
  
Author: Michael Paquier <[email protected]>  

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

Disable installcheck tests for test_session_hooks

commit   : 745948422c799c1b9f976ee30f21a7aac050e0f3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 15 Nov 2017 17:49:04 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 15 Nov 2017 17:49:04 -0500    

Click here for diff

The module requires a preloaded library and the defect can't be cured by  
a LOAD instruction in the test script. To achieve this we override the  
installcheck target in the module's Makefile, and exclude ithe module in  
vcregress.pl.  
  
Along the way, revert commit 9989f92aabd.  

M src/test/modules/Makefile
M src/test/modules/test_session_hooks/Makefile
M src/tools/msvc/vcregress.pl

Disable test_session_hooks test module until buildfarm issues are sorted out

commit   : 9989f92aabdc2015c9dc64b9df4cdeceecf75e47    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 15 Nov 2017 13:32:29 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 15 Nov 2017 13:32:29 -0500    

Click here for diff

M src/test/modules/Makefile

Remove TRUE and FALSE

commit   : 6337865f36da34e9c89aaa292f976bde6df0b065    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    

Click here for diff

Code should be using true and false.  Existing code can be changed to  
those in a backward compatible way.  
  
The definitions in the ecpg header files are left around to avoid  
upsetting those users unnecessarily.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/include/c.h

commit   : 4e5fe9ad19e14af360de7970caa8b150436c9dec    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Nov 2017 10:23:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Nov 2017 10:23:28 -0500    

Click here for diff

Some code is moved from partition.c, which has grown very quickly lately;  
splitting the executor parts out might help to keep it from getting  
totally out of control.  Other code is moved from execMain.c.  All is  
moved to a new file execPartition.c.  get_partition_for_tuple now has  
a new interface that more clearly separates executor concerns from  
generic concerns.  
  
Amit Langote.  A slight comment tweak by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/executor/Makefile
M src/backend/executor/execMain.c
A src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/catalog/partition.h
A src/include/executor/execPartition.h
M src/include/executor/executor.h

Add hooks for session start and session end

commit   : cd8ce3a22c0b48d32ffe6543837ba3bb647ac2b2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 15 Nov 2017 10:16:34 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 15 Nov 2017 10:16:34 -0500    

Click here for diff

These hooks can be used in loadable modules. A simple test module is  
included.  
  
Discussion:  https://postgr.es/m/[email protected]  
  
FabrĆ­zio de Royes Mello  and Yugo Nagata  
Reviewed by Michael Paquier and Aleksandr Parfenov  

M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/tcop/tcopprot.h
M src/test/modules/Makefile
A src/test/modules/test_session_hooks/.gitignore
A src/test/modules/test_session_hooks/Makefile
A src/test/modules/test_session_hooks/README
A src/test/modules/test_session_hooks/expected/test_session_hooks.out
A src/test/modules/test_session_hooks/session_hooks.conf
A src/test/modules/test_session_hooks/sql/test_session_hooks.sql
A src/test/modules/test_session_hooks/test_session_hooks–1.0.sql
A src/test/modules/test_session_hooks/test_session_hooks.c
A src/test/modules/test_session_hooks/test_session_hooks.control

Fix typo.

commit   : ebc189e12259cc28b9a09db000626fea1e2a3ffa    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Nov 2017 08:37:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Nov 2017 08:37:32 -0500    

Click here for diff

Jesper Pedersen  
  
Discussion: http://postgr.es/m/[email protected]  

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

Add parallel_leader_participation GUC.

commit   : e5253fdc4f5fe2f38aec47e08c6aee93f934183d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 15 Nov 2017 08:17:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 15 Nov 2017 08:17:29 -0500    

Click here for diff

Sometimes, for testing, it's useful to have the leader do nothing but  
read tuples from workers; and it's possible that could work out better  
even in production.  
  
Thomas Munro, reviewed by Amit Kapila and by me.  A few final tweaks  
by me.  
  
Discussion: http://postgr.es/m/CAEepm=2U++Lp3bNTv2Bv_kkr5NE2pOyHhxU=G0YTa4ZhSYhHiw@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/optimizer/planmain.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Prevent int128 from requiring more than MAXALIGN alignment.

commit   : 7518049980be1d90264addab003476ae105f70d4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2017 15:03:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2017 15:03:55 -0500    

Click here for diff

Our initial work with int128 neglected alignment considerations, an  
oversight that came back to bite us in bug #14897 from Vincent Lachenal.  
It is unsurprising that int128 might have a 16-byte alignment requirement;  
what's slightly more surprising is that even notoriously lax Intel chips  
sometimes enforce that.  
  
Raising MAXALIGN seems out of the question: the costs in wasted disk and  
memory space would be significant, and there would also be an on-disk  
compatibility break.  Nor does it seem very practical to try to allow some  
data structures to have more-than-MAXALIGN alignment requirement, as we'd  
have to push knowledge of that throughout various code that copies data  
structures around.  
  
The only way out of the box is to make type int128 conform to the system's  
alignment assumptions.  Fortunately, gcc supports that via its  
__attribute__(aligned()) pragma; and since we don't currently support  
int128 on non-gcc-workalike compilers, we shouldn't be losing any platform  
support this way.  
  
Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and  
called it a day, I did a little bit of extra work to make the code more  
portable than that: it will also support int128 on compilers without  
__attribute__(aligned()), if the native alignment of their 128-bit-int  
type is no more than that of int64.  
  
Add a regression test case that exercises the one known instance of the  
problem, in parallel aggregation over a bigint column.  
  
This will need to be back-patched, along with the preparatory commit  
91aec93e6.  But let's see what the buildfarm makes of it first.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Rearrange c.h to create a "compiler characteristics" section.

commit   : 91aec93e6089a5ba49cce0aca3bf7f7022d62ea4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2017 13:46:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2017 13:46:54 -0500    

Click here for diff

Generalize section 1 to handle stuff that is principally about the  
compiler (not libraries), such as attributes, and collect stuff there  
that had been dropped into various other parts of c.h.  Also, push  
all the gettext macros into section 8, so that section 0 is really  
just inclusions rather than inclusions and random other stuff.  
  
The primary goal here is to get pg_attribute_aligned() defined before  
section 3, so that we can use it with int128.  But this seems like good  
cleanup anyway.  
  
This patch just moves macro definitions around, and shouldn't result  
in any changes in generated code.  But I'll push it out separately  
to see if the buildfarm agrees.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h

Document changes in large-object privilege checking.

commit   : 6d776522d243d38faca6924d9b3c7cfaf0c4860d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2017 12:33:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Nov 2017 12:33:10 -0500    

Click here for diff

Commit 5ecc0d738 removed the hard-wired superuser checks in lo_import  
and lo_export in favor of protecting them with SQL permissions, but  
failed to adjust the documentation to match.  Fix that, and add a  
<caution> paragraph pointing out the nontrivial security hazards  
involved with actually granting such permissions.  (It's still better  
than ALLOW_DANGEROUS_LO_FUNCTIONS, though.)  
  
Also, commit ae20b23a9 caused large object read/write privilege to  
be checked during lo_open() rather than in the actual read or write  
calls.  Document that.  
  
Discussion: https://postgr.es/m/CAB7nPqRHmNOYbETnc_2EjsuzSM00Z+BWKv9sy6tnvSd5gWT_JA@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/lobj.sgml

Simplify index_[constraint_]create API

commit   : a61f5ab986386628cf20b33971364475ce452412    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 14 Nov 2017 15:19:05 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 14 Nov 2017 15:19:05 +0100    

Click here for diff

Instead of passing large swaths of boolean arguments, define some flags  
that can be used in a bitmask.  This makes it easier not only to figure  
out what each call site is doing, but also to add some new flags.  
  
The flags are split in two -- one set for index_create directly and  
another for constraints.  index_create() itself receives both, and then  
passes down the latter to index_constraint_create(), which can also be  
called standalone.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Simon Riggs  

M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/include/catalog/index.h

Allow running just selected steps of pgbench's initialization sequence.

commit   : 591c504fad0de88b559bf28e929d23672179a857    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2017 16:40:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Nov 2017 16:40:03 -0500    

Click here for diff

This feature caters to specialized use-cases such as running the normal  
pgbench scenario with nonstandard indexes, or inserting other actions  
between steps of the initialization sequence.  The normal sequence of  
initialization actions is broken down into half a dozen steps which can  
be executed in a user-specified order, to the extent to which that's  
sensible.  The actions themselves aren't changed, except to make them  
more robust against nonstandard uses:  
  
* all four tables are now dropped in one DROP command, to reduce  
assumptions about what foreign key relationships exist;  
  
* all four tables are now truncated at the start of the data load  
step, for consistency;  
  
* the foreign key creation commands now specify constraint names, to  
prevent accidentally creating duplicate constraints by executing the  
'f' step twice.  
  
Make some cosmetic adjustments in the messages emitted by pgbench  
so that it's clear which steps are getting run, and so that the  
messages agree with the documented names of the steps.  
  
In passing, fix failure to enforce that the -v option is used only  
in benchmarking mode.  
  
Masahiko Sawada, reviewed by Fabien Coelho, editorialized a bit by me  
  
Discussion: https://postgr.es/m/CAD21AoCsz0ZzfCFcxYZ+PUdpkDd5VsCSG0Pre_-K1EgokCDFYA@mail.gmail.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

Push target list evaluation through Gather Merge.

commit   : 44ae64c388bde6e4b077272570c84dedfb17bed3    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 Nov 2017 16:33:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 Nov 2017 16:33:56 -0500    

Click here for diff

We already do this for Gather, but it got overlooked for Gather Merge.  
  
Amit Kapila, with review and minor revisions by Rushabh Lathia  
and by me.  
  
Discussion: http://postgr.es/m/CAA4eK1KUC5Uyu7qaifxrjpHxbSeoQh3yzwN3bThnJsmJcZ-qtA@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Track in the plan the types associated with PARAM_EXEC parameters.

commit   : e64861c79bda659ee384bc253f651401f953dadc    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 Nov 2017 15:24:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 Nov 2017 15:24:12 -0500    

Click here for diff

Up until now, we only tracked the number of parameters, which was  
sufficient to allocate an array of Datums of the appropriate size,  
but not sufficient to, for example, know how to serialize a Datum  
stored in one of those slots.  An upcoming patch wants to do that,  
so add this tracking to make it possible.  
  
Patch by me, reviewed by Tom Lane and Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoYqpxDKn8koHdW8BEKk8FMUL0=e8m2Qe=M+r0UBjr3tuQ@mail.gmail.com  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

Mention CREATE/DROP STATISTICS in event triggers docs

commit   : ce4c86a656d2c0174d1ff1f64f38da07574562c0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Nov 2017 19:26:35 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Nov 2017 19:26:35 +0100    

Click here for diff

The new commands are reported by event triggers, but they weren't  
documented as such.  Repair.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f-t-NE=AThB3zu1mKhdrm8PCb=++3e7x=Lf343xcrFHxQ@mail.gmail.com  

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

Fix typo

commit   : cfd8c87e16bc77eceddb1227c8b865c8606e4ccd    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 13 Nov 2017 09:40:30 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 13 Nov 2017 09:40:30 -0500    

Click here for diff

Determinisitcally -> Deterministically  
  
Author: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CAB7nPqSauJ9gUMzj1aiXQVxqEkyko+WZ+wUac8_hB_M_bO6U_A@mail.gmail.com  

M src/backend/libpq/auth-scram.c

MSVC: Rebuild spiexceptions.h when out of date.

commit   : 9363b8b79b0f2475b5b607fe4e0aa73a86398223    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Nov 2017 18:43:32 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Nov 2017 18:43:32 -0800    

Click here for diff

Also, add a warning to catch future instances of naming a nonexistent  
file as a prerequisite.  Back-patch to 9.3 (all supported versions).  

M src/tools/msvc/Solution.pm

Install Windows crash dump handler before all else.

commit   : cbfffee41c3f571fa3fcb26fca5eb11bc508f972    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Nov 2017 14:31:00 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Nov 2017 14:31:00 -0800    

Click here for diff

Apart from calling write_stderr() on failure, the handler depends on no  
PostgreSQL facilities.  We have experienced crashes before reaching the  
former call site.  Given such an early crash, this change cannot hurt  
and may produce a helpful dump.  Absent an early crash, this change has  
no effect.  Back-patch to 9.3 (all supported versions).  
  
Takayuki Tsunakawa  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F80CD13@G01JPEXMBYT05  

M src/backend/main/main.c

Don't call pgwin32_message_to_UTF16() without CurrentMemoryContext.

commit   : e02571b73f2d8124fe75d7408f9b63d4c5fe03b0    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Nov 2017 13:03:15 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Nov 2017 13:03:15 -0800    

Click here for diff

PostgreSQL running as a Windows service crashed upon calling  
write_stderr() before MemoryContextInit().  This fix completes work  
started in 5735efee15540765315aa8c1a230575e756037f7.  Messages this  
early contain only ASCII bytes; if we removed the CurrentMemoryContext  
requirement, the ensuing conversions would have no effect.  Back-patch  
to 9.3 (all supported versions).  
  
Takayuki Tsunakawa, reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F80CC73@G01JPEXMBYT05  

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

Add post-2010 ecpg tests to checktcp.

commit   : 0b7e76eb2b142d0b4a2a831e7fa1fac44820f52c    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 14:35:22 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 14:35:22 -0800    

Click here for diff

This suite had been a proper superset of the regular ecpg test suite,  
but the three newest tests didn't reach it.  To make this less likely to  
recur, delete the extra schedule file and pass the TCP-specific test on  
the command line.  Back-patch to 9.3 (all supported versions).  

M src/interfaces/ecpg/test/Makefile
D src/interfaces/ecpg/test/ecpg_schedule_tcp

Make connect/test1 independent of localhost IPv6.

commit   : 34baf8a00b018caf7269134cf9b461266e66d9a7    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 14:33:02 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 14:33:02 -0800    

Click here for diff

Since commit 868898739a8da9ab74c105b8349b7b5c711f265a, it has assumed  
"localhost" resolves to both ::1 and 127.0.0.1.  We gain nothing from  
that assumption, and it does not hold in a default installation of Red  
Hat Enterprise Linux 5.  Back-patch to 9.3 (all supported versions).  

M src/interfaces/ecpg/test/connect/test1.pgc
M src/interfaces/ecpg/test/expected/connect-test1.c
M src/interfaces/ecpg/test/expected/connect-test1.stderr

Fix previous commit's test, for non-UTF8 databases with non-XML builds.

commit   : 4b865aee2582292a42a8e58247a41b46f5aa8a82    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 13:07:46 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 13:07:46 -0800    

Click here for diff

To ensure stable output, catch one more configuration-specific error.  
Back-patch to 9.3, like the commit that added the test.  

M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Ignore XML declaration in xpath_internal(), for UTF8 databases.

commit   : 2918fcedbf2b2adab688a7849ecce4556ef912ac    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 11:10:53 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 Nov 2017 11:10:53 -0800    

Click here for diff

When a value contained an XML declaration naming some other encoding,  
this function interpreted UTF8 bytes as the named encoding, yielding  
mojibake.  xml_parse() already has similar logic.  This would be  
necessary but not sufficient for non-UTF8 databases, so preserve  
behavior there until the xpath facility can support such databases  
comprehensively.  Back-patch to 9.3 (all supported versions).  
  
Pavel Stehule and Noah Misch  
  
Discussion: https://postgr.es/m/CAFj8pRC-dM=tT=QkGi+Achkm+gwPmjyOayGuUfXVumCxkDgYWg@mail.gmail.com  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Account for the effect of lossy pages when costing bitmap scans.

commit   : 5edc63bda68a77c4d38f0cbeae1c4271f9ef4100    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 10 Nov 2017 16:50:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 10 Nov 2017 16:50:50 -0500    

Click here for diff

Dilip Kumar, reviewed by Alexander Kumenkov, Amul Sul, and me.  
Some final adjustments by me.  
  
Discussion: http://postgr.es/m/CAFiTN-sYtqUOXQ4SpuhTv0Z9gD0si3YxZGv_PQAAMX8qbOotcg@mail.gmail.com  

M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/path/costsize.c
M src/include/nodes/tidbitmap.h

Fix some null pointer dereferences in LDAP auth code

commit   : 0c98d0dd5c85ce0c8485ae1a8351a26b83c4338b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Nov 2017 14:21:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Nov 2017 14:21:32 -0500    

Click here for diff

An LDAP URL without a host name such as "ldap://" or without a base DN  
such as "ldap://localhost" would cause a crash when reading pg_hba.conf.  
  
If no binddn is configured, an error message might end up trying to print a  
null pointer, which could crash on some platforms.  
  
Author: Thomas Munro <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/libpq/auth.c
M src/backend/libpq/hba.c

Add some const decorations to prototypes

commit   : 0e1539ba0d0a43de06c6e0572a565e73b9472538    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 Oct 2017 10:34:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 Oct 2017 10:34:31 -0400    

Click here for diff

Reviewed-by: Fabien COELHO <[email protected]>  

M contrib/dict_xsyn/dict_xsyn.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/pgcrypto/pgcrypto.c
M contrib/seg/seg.c
M contrib/seg/segdata.h
M contrib/seg/segparse.y
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/access/common/reloptions.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogarchive.c
M src/backend/catalog/heap.c
M src/backend/commands/comment.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/view.c
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/port/dynloader/darwin.c
M src/backend/port/dynloader/darwin.h
M src/backend/port/dynloader/hpux.c
M src/backend/port/dynloader/hpux.h
M src/backend/port/dynloader/linux.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/basebackup.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/snowball/dict_snowball.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_db.h
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/include/access/gist_private.h
M src/include/access/reloptions.h
M src/include/access/xact.h
M src/include/access/xlog_internal.h
M src/include/catalog/heap.h
M src/include/commands/comment.h
M src/include/commands/defrem.h
M src/include/commands/typecmds.h
M src/include/commands/view.h
M src/include/executor/tablefunc.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/postmaster/bgworker.h
M src/include/rewrite/rewriteDefine.h
M src/include/storage/lwlock.h
M src/include/utils/dynamic_loader.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpg_informix.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/pgtypes_date.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc
M src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc
M src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
M src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
M src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
M src/interfaces/ecpg/test/expected/preproc-init.c
M src/interfaces/ecpg/test/expected/preproc-whenever.c
M src/interfaces/ecpg/test/preproc/init.pgc
M src/interfaces/ecpg/test/preproc/whenever.pgc
M src/interfaces/libpq/fe-connect.c
M src/pl/plperl/plperl.c
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h

Tighten test in contrib/bloom/t/001_wal.pl.

commit   : 7e60e678615b1f803ac73faee71cca79ec310d1d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Nov 2017 12:30:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Nov 2017 12:30:01 -0500    

Click here for diff

Make bloom WAL test compare psql output text, not just result codes;  
this was evidently the intent all along, but it was mis-coded.  
In passing, make sure we will notice any failure in setup steps.  
  
Alexander Korotkov, reviewed by Michael Paquier and Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAPpHfdtohPdQ9rc5mdWjxq+3VsBNw534KV_5O65dTQrSdVJNgw@mail.gmail.com  

M contrib/bloom/t/001_wal.pl

Fix incorrect comment.

commit   : b9941d3468505aea8bfdd74840b753ed27b9d29f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 10 Nov 2017 10:55:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 10 Nov 2017 10:55:09 -0500    

Click here for diff

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

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

Add -wnet to SP invocations

commit   : 9a8d3c4eeaf34966056a41a263c6e2ca4d5e4012    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2017 17:06:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2017 17:06:32 -0500    

Click here for diff

This causes a warning when accidentally backpatching an XML-style  
empty-element tag like <xref linkend="abc"/>.  

M doc/src/sgml/Makefile

Add hash partitioning.

commit   : 1aba8e651ac3e37e1d2d875842de1e0ed22a651e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Nov 2017 18:07:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Nov 2017 18:07:25 -0500    

Click here for diff

Hash partitioning is useful when you want to partition a growing data  
set evenly.  This can be useful to keep table sizes reasonable, which  
makes maintenance operations such as VACUUM faster, or to enable  
partition-wise join.  
  
At present, we still depend on constraint exclusion for partitioning  
pruning, and the shape of the partition constraints for hash  
partitioning is such that that doesn't work.  Work is underway to fix  
that, which should both improve performance and make partitioning  
pruning work with hash partitioning.  
  
Amul Sul, reviewed and tested by Dilip Kumar, Ashutosh Bapat, Yugo  
Nagata, Rajkumar Raghuwanshi, Jesper Pedersen, and by me.  A few  
final tweaks also by me.  
  
Discussion: http://postgr.es/m/CAAJ_b96fhpJAP=ALbETmeLk1Uni_GFZD938zgenhF49qgDTjaQ@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/joinrels.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/partition.h
M src/include/catalog/pg_proc.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/update.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/partition_join.sql
M src/test/regress/sql/update.sql
M src/tools/pgindent/typedefs.list

Remove junk left from DSSSL to XSL conversion

commit   : e7397f015c9589f95f5f5b48d7a274b2f1628971    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2017 17:00:53 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Nov 2017 17:00:53 -0500    

Click here for diff

M doc/src/sgml/Makefile

Refactor permissions checks for large objects.

commit   : ae20b23a9e7029f31ee902da08a464d968319f56    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 12:56:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 12:56:07 -0500    

Click here for diff

Up to now, ACL checks for large objects happened at the level of  
the SQL-callable functions, which led to CVE-2017-7548 because of a  
missing check.  Push them down to be enforced in inv_api.c as much  
as possible, in hopes of preventing future bugs.  This does have the  
effect of moving read and write permission errors to happen at lo_open  
time not loread or lowrite time, but that seems acceptable.  
  
Michael Paquier and Tom Lane  
  
Discussion: https://postgr.es/m/CAB7nPqRHmNOYbETnc_2EjsuzSM00Z+BWKv9sy6tnvSd5gWT_JA@mail.gmail.com  

M src/backend/catalog/objectaddress.c
M src/backend/libpq/be-fsstubs.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/misc/guc.c
M src/include/libpq/be-fsstubs.h
M src/include/storage/large_object.h

Restrict lo_import()/lo_export() via SQL permissions not hard-wired checks.

commit   : 5ecc0d738e5864848bbc2d1d97e56d5846624ba2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 12:36:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 12:36:58 -0500    

Click here for diff

While it's generally unwise to give permissions on these functions to  
anyone but a superuser, we've been moving away from hard-wired permission  
checks inside functions in favor of using the SQL permission system to  
control access.  Bring lo_import() and lo_export() into compliance with  
that approach.  
  
In particular, this removes the manual configuration option  
ALLOW_DANGEROUS_LO_FUNCTIONS.  That dates back to 1999 (commit 4cd4a54c8);  
it's unlikely anyone has used it in many years.  Moreover, if you really  
want such behavior, now you can get it with GRANT ... TO PUBLIC instead.  
  
Michael Paquier  
  
Discussion: https://postgr.es/m/CAB7nPqRHmNOYbETnc_2EjsuzSM00Z+BWKv9sy6tnvSd5gWT_JA@mail.gmail.com  

M src/backend/catalog/system_views.sql
M src/backend/libpq/be-fsstubs.c
M src/include/catalog/catversion.h
M src/include/pg_config_manual.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Fix typo in ALTER SYSTEM output.

commit   : 6c3a7ba5bb0f960ed412b1c36e815f53347b3d79    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 11:57:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 11:57:20 -0500    

Click here for diff

The header comment written into postgresql.auto.conf by ALTER SYSTEM  
should match what initdb put there originally.  
  
Feike Steenbergen  
  
Discussion: https://postgr.es/m/CAK_s-G0KcKdO=0hqZkwb3s+tqZuuHwWqmF5BDsmoO9FtX75r0g@mail.gmail.com  

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

Fix bogus logic for checking executables' versions within pg_upgrade.

commit   : 9be95ef156e7c2ae0924300acddd483504fa33b3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 11:30:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 11:30:30 -0500    

Click here for diff

Somebody messed up a refactoring here.  As it stood, we'd check pg_ctl's  
--version output twice for each cluster.  Worse, the first check for the  
new cluster's version happened before we'd done any validate_exec checks  
there, breaking the check ordering the code intended.  
  
A. Akenteva  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/exec.c

Revert "Allow --with-bonjour to work with non-macOS implementations of Bonjour."

commit   : 20d9adab60754ac71b0b500c91c45e12e940b3ce    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 11:00:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Nov 2017 11:00:36 -0500    

Click here for diff

Upon further review, our Bonjour code doesn't actually work with the  
Avahi not-too-compatible compatibility library.  While you can get it  
to work on non-macOS platforms if you link to Apple's own mDNSResponder  
code, there don't seem to be many people who care about that.  Leaving in  
the AC_SEARCH_LIBS call seems more likely to encourage people to build  
broken configurations than to do anything very useful.  
  
Hence, remove the AC_SEARCH_LIBS call and put in a warning comment instead.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Allow --with-bonjour to work with non-macOS implementations of Bonjour.

commit   : 9b9cb3c4534d717c1c95758670198ebbf8a20af2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2017 17:47:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2017 17:47:14 -0500    

Click here for diff

On macOS the relevant functions require no special library, but elsewhere  
we need to pull in libdns_sd.  
  
Back-patch to supported branches.  No docs change since the docs do not  
suggest that this is a Mac-only feature.  
  
Luke Lonergan  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Doc: fix erroneous example.

commit   : bd65e0c62486e6108a7dc824f918754a13072f7a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2017 17:20:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2017 17:20:53 -0500    

Click here for diff

The grammar requires these options to appear the other way 'round.  
  
[email protected]  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Fix two violations of the ResourceOwnerEnlarge/Remember protocol.

commit   : c5269472ea9bb4a6fbb8a0510f7d676d725933ab    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2017 16:50:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Nov 2017 16:50:12 -0500    

Click here for diff

The point of having separate ResourceOwnerEnlargeFoo and  
ResourceOwnerRememberFoo functions is so that resource allocation  
can happen in between.  Doing it in some other order is just wrong.  
  
OpenTemporaryFile() did open(), enlarge, remember, which would leak the  
open file if the enlarge step ran out of memory.  Because fd.c has its own  
layer of resource-remembering, the consequences look like they'd be limited  
to an intratransaction FD leak, but it's still not good.  
  
IncrBufferRefCount() did enlarge, remember, incr-refcount, which would blow  
up if the incr-refcount step ever failed.  It was safe enough when written,  
but since the introduction of PrivateRefCountHash, I think the assumption  
that no error could happen there is pretty shaky.  
  
The odds of real problems from either bug are probably small, but still,  
back-patch to supported branches.  
  
Thomas Munro and Tom Lane, per a comment from Andres Freund  

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

Change TRUE/FALSE to true/false

commit   : 2eb4a831e5fb5d8fc17e13aea56e04af3efe27b4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    

Click here for diff

The lower case spellings are C and C++ standard and are used in most  
parts of the PostgreSQL sources.  The upper case spellings are only used  
in some files/modules.  So standardize on the standard spellings.  
  
The APIs for ICU, Perl, and Windows define their own TRUE and FALSE, so  
those are left as is when using those APIs.  
  
In code comments, we use the lower-case spelling for the C concepts and  
keep the upper-case spelling for the SQL concepts.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_bytea.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_text.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/hstore/hstore_gist.c
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_op.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/ltree_gist.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/seg/seg.c
M doc/src/sgml/gin.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/sslinfo.sgml
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/heap.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_type.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/proclang.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/foreign/foreign.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/var.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/scansup.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/repl_gram.y
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/tqual.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/large_obj.c
M src/bin/psql/stringutils.c
M src/common/md5.c
M src/include/access/gin_private.h
M src/include/access/hash_xlog.h
M src/include/access/slru.h
M src/include/access/xlog.h
M src/include/c.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_type.h
M src/include/commands/vacuum.h
M src/include/executor/instrument.h
M src/include/executor/tuptable.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/parser/parse_node.h
M src/include/storage/s_lock.h
M src/include/storage/spin.h
M src/include/tsearch/ts_utils.h
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-events.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c

Put markup in the right place

commit   : 4497f2f3b30fa5cd48898033c351bfcf01ce73e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Nov 2017 10:57:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Nov 2017 10:57:27 -0500    

Click here for diff

M doc/src/sgml/protocol.sgml

Expand empty end tag

commit   : 6e1e4c0d2f757677b03b6f164487a582c7dfab33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Nov 2017 21:14:41 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Nov 2017 21:14:41 -0500    

Click here for diff

M doc/src/sgml/protocol.sgml

Fix typo in comment.

commit   : 698e5254377baffb95774d47872100997f135cba    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Nov 2017 16:34:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Nov 2017 16:34:48 -0500    

Click here for diff

Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoDrf5AOpZ-mX-j6O=zFNFfKaTdHkv3o1X2eSs2nBXALug@mail.gmail.com  

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

Fix unportable spelling of int64 constant.

commit   : 92a1834dd88e56e823ac6641313a2f077a8af72e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Nov 2017 13:54:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Nov 2017 13:54:36 -0500    

Click here for diff

Per buildfarm member pademelon.  

M src/include/utils/hashutils.h

Fix unportable usage of <ctype.h> functions.

commit   : d1f9ac5b100dbc4da02f0f209a2e7730bd5e83e9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Nov 2017 13:49:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Nov 2017 13:49:36 -0500    

Click here for diff

isdigit(), isspace(), etc are likely to give surprising results if passed a  
signed char.  We should always cast the argument to unsigned char to avoid  
that.  Error in commit 63d6b97fd, found by buildfarm member gaur.  
Back-patch to 9.3, like that commit.  

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

Remove secondary checkpoint

commit   : 4b0d28de06b28e57c540fca458e4853854fbeaf8    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Nov 2017 12:56:30 -0500    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Nov 2017 12:56:30 -0500    

Click here for diff

Previously server reserved WAL for last two checkpoints,  
which used too much disk space for small servers.  
  
Bumps PG_CONTROL_VERSION  
  
Author: Simon Riggs <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.h

Exclude pg_internal.init from BASE_BACKUP

commit   : 98267ee83e068afa8bd85c8cc710ab2144e711fa    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Nov 2017 12:28:35 -0500    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Nov 2017 12:28:35 -0500    

Click here for diff

Add docs to explain this for other backup mechanisms  
  
Author: David Steele <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]> et al  

M doc/src/sgml/backup.sgml
M doc/src/sgml/protocol.sgml
M src/backend/replication/basebackup.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/include/utils/relcache.h

Fix version numbering foulups exposed by 10.1.

commit   : d0c80c17f1a6d0b93d2ca14fe47d83b131ce9108    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2017 19:46:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2017 19:46:52 -0500    

Click here for diff

configure computed PG_VERSION_NUM incorrectly.  (Coulda sworn I tested  
that logic back when, but it had an obvious thinko.)  
  
pg_upgrade had not been taught about the new dispensation with just  
one part in the major version number.  
  
Both things accidentally failed to fail with 10.0, but with 10.1 we  
got the wrong results.  
  
Per buildfarm.  

M configure
M configure.in
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/server.c

Last-minute updates for release notes.

commit   : 92d830f4bff643953a09563abaa106af42625207    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2017 12:02:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2017 12:02:30 -0500    

Click here for diff

Security: CVE-2017-12172, CVE-2017-15098, CVE-2017-15099  

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

Add tests for json{b}_populate_recordset() crash case.

commit   : b574228715f0fd77ed1f4f084603cff9e757e992    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2017 10:29:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Nov 2017 10:29:11 -0500    

Click here for diff

The problem reported as CVE-2017-15098 was already resolved in HEAD by  
commit 37a795a60, but let's add the relevant test cases anyway.  
  
Michael Paquier and Tom Lane, per a report from David Rowley.  
  
Security: CVE-2017-15098  

M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

start-scripts: switch to $PGUSER before opening $PGLOG.

commit   : dfc015dcf46c1996bd7ed5866e9e045d258604b3    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 6 Nov 2017 07:11:10 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 6 Nov 2017 07:11:10 -0800    

Click here for diff

By default, $PGUSER has permission to unlink $PGLOG.  If $PGUSER  
replaces $PGLOG with a symbolic link, the server will corrupt the  
link-targeted file by appending log messages.  Since these scripts open  
$PGLOG as root, the attack works regardless of target file ownership.  
  
"make install" does not install these scripts anywhere.  Users having  
manually installed them in the past should repeat that process to  
acquire this fix.  Most script users have $PGLOG writable to root only,  
located in $PGDATA.  Just before updating one of these scripts, such  
users should rename $PGLOG to $PGLOG.old.  The script will then recreate  
$PGLOG with proper ownership.  
  
Reviewed by Peter Eisentraut.  Reported by Antoine Scemama.  
  
Security: CVE-2017-12172  

M contrib/start-scripts/freebsd
M contrib/start-scripts/linux
M contrib/start-scripts/osx/PostgreSQL

Always require SELECT permission for ON CONFLICT DO UPDATE.

commit   : 87b2ebd352c4afe1ded0841604b59a3afbae97d1    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 6 Nov 2017 09:19:22 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 6 Nov 2017 09:19:22 +0000    

Click here for diff

The update path of an INSERT ... ON CONFLICT DO UPDATE requires SELECT  
permission on the columns of the arbiter index, but it failed to check  
for that in the case of an arbiter specified by constraint name.  
  
In addition, for a table with row level security enabled, it failed to  
check updated rows against the table's SELECT policies when the update  
path was taken (regardless of how the arbiter index was specified).  
  
Backpatch to 9.5 where ON CONFLICT DO UPDATE and RLS were introduced.  
  
Security: CVE-2017-15099  

M src/backend/catalog/pg_constraint.c
M src/backend/parser/parse_clause.c
M src/backend/rewrite/rowsecurity.c
M src/include/catalog/pg_constraint_fn.h
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql

Add a temp-install prerequisite to "check"-like targets not having one.

commit   : c66b438db62748000700c9b90b585e756dd54141    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 5 Nov 2017 18:51:08 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 5 Nov 2017 18:51:08 -0800    

Click here for diff

Makefile.global assigns this prerequisite to every target named "check",  
but similar targets must mention it explicitly.  Affected targets  
failed, tested $PATH binaries, or tested a stale temporary installation.  
The src/test/modules examples worked properly when called as "make -C  
src/test/modules/$FOO check", but "make -j" allowed the test to start  
before the temporary installation was in place.  Back-patch to 9.5,  
where commit dcae5faccab64776376d354decda0017c648bb53 introduced the  
shared temp-install.  

M src/interfaces/ecpg/test/Makefile
M src/test/locale/Makefile
M src/test/modules/brin/Makefile
M src/test/modules/commit_ts/Makefile
M src/test/modules/test_pg_dump/Makefile
M src/test/regress/GNUmakefile

Release notes for 10.1, 9.6.6, 9.5.10, 9.4.15, 9.3.20, 9.2.24.

commit   : b35b185bf705c4dbaf21198c81b3d85f4a96804a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Nov 2017 13:47:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Nov 2017 13:47:56 -0500    

Click here for diff

In the v10 branch, also back-patch the effects of 1ff01b390 and c29c57890  
on these files, to reduce future maintenance issues.  (I'd do it further  
back, except that the 9.X branches differ anyway due to xlog-to-wal  
link tag renaming.)  

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

Ignore CatalogSnapshot when checking COPY FREEZE prerequisites.

commit   : bab3a714b62160f0e89c8943c5e054649cd58945    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 5 Nov 2017 09:25:52 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 5 Nov 2017 09:25:52 -0800    

Click here for diff

This restores the ability, essentially lost in commit  
ffaa44cb559db332baeee7d25dedd74a61974203, to use COPY FREEZE under  
REPEATABLE READ isolation.  Back-patch to 9.4, like that commit.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CA+TgmoahWDm-7fperBxzU9uZ99LPMUmEpSXLTw9TmrOgzwnORw@mail.gmail.com  

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

Fix comment

commit   : 86bc521811f381a121817fdfb096df431edb32f5    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 5 Nov 2017 11:48:20 -0500    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 5 Nov 2017 11:48:20 -0500    

Click here for diff

Author: Bernd Helmle <[email protected]>  

M src/bin/pg_basebackup/receivelog.c

First-draft release notes for 10.1.

commit   : 42de8a0255c2509bf179205e94b9d65f9d6f3cf9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Nov 2017 18:27:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Nov 2017 18:27:06 -0400    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  Note that a  
fair percentage of the entries apply only to prior branches because  
their issue was already fixed in 10.0.  

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

doc: Update text for new recovery_target_lsn setting

commit   : bc105c4be057177c6fe7bd93b31eb1dc66ed4395    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 4 Nov 2017 14:42:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 4 Nov 2017 14:42:20 -0400    

Click here for diff

Reported-by: Tomonari Katsumata <[email protected]>  
Author: Michael Paquier <[email protected]>  

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

ecpg: Use bool instead of int

commit   : 4703a480a9e15f8b8b481dac44f2e36a4a687fe4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 20:54:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 20:54:55 -0400    

Click here for diff

Use "bool" for Boolean variables, rather than "int", matching backend  
change f505edace12655f3491b9c91991731e2b6bf1f0b.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

ecpg: Remove useless return values

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

Click here for diff

Remove useless or inconsistently used return values from functions,  
matching backend changes 99bf328237d89e0fd22821a940d4af0506353218 and  
791359fe0eae83641f0929159d5861359d395e97.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c

Fix incorrect use of bool

commit   : cb29ff8315ef74043f279c21783cca8aaf79ebde    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Sep 2017 08:30:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Sep 2017 08:30:03 -0400    

Click here for diff

NSUnLinkModule() doesn't take a bool as second argument but one of set  
of specific constants.  The numeric values are the same in this case,  
but clean it up while we're cleaning up bool use elsewhere.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/port/dynloader/darwin.c

Avoid looping through line pointers twice in PageRepairFragmentation().

commit   : a9169f0200fc57e01cbd216bbd41c9ea3a79a7b0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Nov 2017 17:21:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Nov 2017 17:21:59 -0400    

Click here for diff

There doesn't seem to be any good reason to do the filling of the  
itemidbase[] array separately from the first traversal of the pointers.  
It's certainly not a win if there are any line pointers with storage,  
and even if there aren't, this change doesn't insert code into the part  
of the first loop that will be traversed in that case.  So let's just  
merge the two loops.  
  
Yura Sokolov, reviewed by Claudio Freire  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/page/bufpage.c

Flag index metapages as standard-format in xlog.c calls.

commit   : 4c11d2c559e76892156fd08d6a3cf5e1848a017f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Nov 2017 16:31:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Nov 2017 16:31:32 -0400    

Click here for diff

btree, hash, and bloom indexes all set up their metapages in standard  
format (that is, with pd_lower and pd_upper correctly delimiting the  
unused area); but they mostly didn't inform the xlog routines of this.  
When calling log_newpage[_buffer], this is bad because it loses the  
opportunity to compress unused data out of the WAL record.  When  
calling XLogRegisterBuffer, it's not such a performance problem because  
all of these call sites also use REGBUF_WILL_INIT, preventing an FPI  
image from being written.  But it's still a good idea to provide the  
flag when relevant, because that aids WAL consistency checking.  
  
This completes the project of getting all the in-core index AMs to  
handle their metapage WAL operations similarly.  
  
Amit Kapila, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c

Fix thinkos in BRIN summarization

commit   : 1b890562b8d1b44bd3ef948aeeb58dd59abd04b7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Nov 2017 20:36:32 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Nov 2017 20:36:32 +0100    

Click here for diff

The previous commit contained a thinko that made a single-range  
summarization request process from there to end of table.  Fix by  
setting the correct end range point.  Per buildfarm.  

M src/backend/access/brin/brin.c

doc: Convert ids to upper case at build time

commit   : 49df45acd8d40ee172c2f5491485de997c5f1020    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Oct 2017 15:19:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Oct 2017 15:19:56 -0400    

Click here for diff

This makes the produced HTML anchors upper case, making it backward  
compatible with the previous (9.6) build system.  
  
Reported-by: Thomas Kellerer <[email protected]>  

M doc/src/sgml/stylesheet-html-common.xsl

Don't reset additional columns on subscriber to NULL on UPDATE

commit   : a9fce66729ad5217e8219e22e595974059c21291    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Nov 2017 11:59:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Nov 2017 11:59:20 -0400    

Click here for diff

When a publisher table has fewer columns than a subscriber, the update  
of a row on the publisher should result in updating of only the columns  
in common.  The previous coding mistakenly reset the values of  
additional columns on the subscriber to NULL because it failed to skip  
updates of columns not found in the attribute map.  
  
Author: Petr Jelinek <[email protected]>  

M src/backend/replication/logical/worker.c
A src/test/subscription/t/008_diff_schema.pl

Fix BRIN summarization concurrent with extension

commit   : ec42a1dcb30de235b252f6d4972f2f2bdb2e47f2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Nov 2017 17:23:13 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Nov 2017 17:23:13 +0100    

Click here for diff

If a process is extending a table concurrently with some BRIN  
summarization process, it is possible for the latter to miss pages added  
by the former because the number of pages is computed ahead of time.  
  
Fix by determining a fresh relation size after inserting the placeholder  
tuple: any process that further extends the table concurrently will  
update the placeholder tuple, while previous pages will be processed by  
the heap scan.  
  
Reported-by: Tomas Vondra  
Reviewed-by: Tom Lane  
Author: Ɓlvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-to: 9.5  

M src/backend/access/brin/brin.c

Improve error message for incorrect number inputs in libecpg.

commit   : 7164991caf3858cbd75e5efb7943e11a51ad04f9    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 3 Nov 2017 11:14:30 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 3 Nov 2017 11:14:30 +0100    

Click here for diff

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

pgbench: replace run-time string comparisons with an enum identifier.

commit   : f987f83de20afe3ba78be1e15db5dffe7488faa7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 18:32:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 18:32:14 -0400    

Click here for diff

Minor refactoring that should yield some performance benefit.  
  
Fabien Coelho, reviewed by Aleksandr Parfenov  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1709230538130.4999@lancre  

M src/bin/pgbench/pgbench.c

Set the metapage's pd_lower correctly in brin, gin, and spgist indexes.

commit   : 81e334ce4e6d687d548e60ad8954b7dfd9e568a2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 17:22:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 17:22:08 -0400    

Click here for diff

Previously, these index types left the pd_lower field set to the default  
SizeOfPageHeaderData, which is really a lie because it ought to point past  
whatever space is being used for metadata.  The coding accidentally failed  
to fail because we never told xlog.c that the metapage is of standard  
format --- but that's not very good, because it impedes WAL consistency  
checking, and in some cases prevents compression of full-page images.  
  
To fix, ensure that we set pd_lower correctly, not only when creating a  
metapage but whenever we write it out (these apparently redundant steps are  
needed to cope with pg_upgrade'd indexes that don't yet contain the right  
value).  This allows telling xlog.c that the page is of standard format.  
  
The WAL consistency check mask functions are made to mask only if pd_lower  
appears valid, which I think is likely unnecessary complication, since  
any metapage appearing in a v11 WAL stream should contain valid pd_lower.  
But it doesn't cost much to be paranoid.  
  
Amit Langote, reviewed by Michael Paquier and Amit Kapila  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgxlog.c

Fix float parsing in ecpg INFORMIX mode.

commit   : 6976a4f05fc5f9d3b469869e412e0814c8c7ab2a    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 2 Nov 2017 20:46:34 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 2 Nov 2017 20:46:34 +0100    

Click here for diff

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

pg_ctl: Improve message

commit   : 4b0fbfdf81e0a847b31d0b430f25f8660d5652c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 13:27:42 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 13:27:42 -0400    

Click here for diff

Change message for restarting a server from a directory without a PID  
file.  This accounts for the case where a restart happens after an  
initdb.  The new message indicates that the start has not completed yet  
and might fail.  
  
Author: Jesper Pedersen <[email protected]>  

M src/bin/pg_ctl/pg_ctl.c

Simplify new test suite handling of passwordcheck

commit   : 637a934ab9bac615af6032bb8424056e91988fb8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 12:56:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 12:56:30 -0400    

Click here for diff

This changes the use of a custom configuration file to enforce the value  
of preload_shared_libraries to simply load the library during the tests.  
This removes the restriction of running installcheck on the tests, and  
simplifies its makefile contrary to what has been introduced in af7211e.  
  
Author: Michael Paquier <[email protected]>  

M contrib/passwordcheck/Makefile
M contrib/passwordcheck/expected/passwordcheck.out
D contrib/passwordcheck/passwordcheck.conf
M contrib/passwordcheck/sql/passwordcheck.sql

Fix corner-case errors in brin_doupdate().

commit   : 62a16572d5714bfb19e2a273e61218be6682d3df    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 12:54:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 12:54:22 -0400    

Click here for diff

In some cases the BRIN code releases lock on an index page, and later  
re-acquires lock and tries to check that the tuple it was working on is  
still there.  That check was a couple bricks shy of a load.  It didn't  
consider that the page might have turned into a "revmap" page.  (The  
samepage code path doesn't call brin_getinsertbuffer(), so it isn't  
protected by the checks for revmap status there.)  It also didn't check  
whether the tuple offset was now off the end of the linepointer array.  
Since commit 24992c6db the latter case is pretty common, but at least  
in principle it could have occurred before that.  The net result is  
that concurrent updates of a BRIN index could fail with errors like  
"invalid index offnum" or "inconsistent range map".  
  
Per report from Tomas Vondra.  Back-patch to 9.5, since this code is  
substantially the same in all versions containing BRIN.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_pageops.c

Remove wal_keep_segments from default configuration in PostgresNode.pm

commit   : 5eb8bf2d42676523143c1c76ba584bcdcc584f3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 12:38:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 12:38:59 -0400    

Click here for diff

This is only used in the pg_rewind tests, so only set it there.  It's  
better if other tests run closer to a default configuration.  
  
Author: Michael Paquier <[email protected]>  

M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/PostgresNode.pm

doc: Clarify pgstattuple privileges information

commit   : 0f53934164d37682fd6a6d87d57008f9ca03e3d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 12:12:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 12:12:23 -0400    

Click here for diff

The description has gotten a bit confusing over time, so rewrite the  
paragraph a bit.  
  
Reported-by: Feike Steenbergen <[email protected]>  

M doc/src/sgml/pgstattuple.sgml

Teach planner to account for HAVING quals in aggregation plan nodes.

commit   : 7b6c07547190f056b0464098bb5a2247129d7aa2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 11:24:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Nov 2017 11:24:12 -0400    

Click here for diff

For some reason, we have never accounted for either the evaluation cost  
or the selectivity of filter conditions attached to Agg and Group nodes  
(which, in practice, are always conditions from a HAVING clause).  
  
Applying our regular selectivity logic to post-grouping conditions is a  
bit bogus, but it's surely better than taking the selectivity as 1.0.  
Perhaps someday the extended-statistics mechanism can be taught to provide  
statistics that would help us in getting non-default estimates here.  
  
Per a gripe from Benjamin Coutu.  This is surely a bug fix, but I'm  
hesitant to back-patch because of the prospect of destabilizing existing  
plan choices.  Given that it took us this long to notice the bug, it's  
probably not hurting too many people in the field.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/cost.h

Revert bogus fixes of HOT-freezing bug

commit   : c6764eb3aea63f3f95582bd660785e2b0d4439f9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 2 Nov 2017 15:51:05 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 2 Nov 2017 15:51:05 +0100    

Click here for diff

It turns out we misdiagnosed what the real problem was.  Revert the  
previous changes, because they may have worse consequences going  
forward.  A better fix is forthcoming.  
  
The simplistic test case is kept, though disabled.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execMain.c
M src/include/access/heapam.h
M src/test/isolation/isolation_schedule

doc: Adjust name in acknowledgments

commit   : d8c435e1743773eba4e36498479ca6aef28a2d70    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 09:08:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Nov 2017 09:08:03 -0400    

Click here for diff

per request of the named person  

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

In client support of v10 features, use standard schema handling.

commit   : 51f4d3ed7ea40998f66e15830aa84009c0e36e11    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 1 Nov 2017 19:16:14 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 1 Nov 2017 19:16:14 -0700    

Click here for diff

Back-patch to v10.  This continues the work of commit  
080351466c5a669bf35a323bdec9e296330a5dbb.  
  
Discussion: https://postgr.es/m/CAKOSWN=ds66zLw2SqkLTM8wbXFgDbc_OdkmT3dJfPT2mE5kipA@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c

Doc: update URL for check_postgres.

commit   : c0e2062d3214f6230a0e1eee9236b202bda9221f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Nov 2017 22:07:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Nov 2017 22:07:14 -0400    

Click here for diff

Reported by Dan Vianello.  
  
Discussion: https://postgr.es/m/e6e12f18f70e46848c058084d42fb651@KSTLMEXGP001.CORP.CHARTERCOM.com  

M doc/src/sgml/maintenance.sgml

Allow bitmap scans to operate as index-only scans when possible.

commit   : 7c70996ebf0949b142a99c9445061c3c83ce62b3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Nov 2017 17:38:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Nov 2017 17:38:12 -0400    

Click here for diff

If we don't have to return any columns from heap tuples, and there's  
no need to recheck qual conditions, and the heap page is all-visible,  
then we can skip fetching the heap page altogether.  
  
Skip prefetching pages too, when possible, on the assumption that the  
recheck flag will remain the same from one page to the next.  While that  
assumption is hardly bulletproof, it seems like a good bet most of the  
time, and better than prefetching pages we don't need.  
  
This commit installs the executor infrastructure, but doesn't change  
any planner cost estimates, thus possibly causing bitmap scans to  
not be chosen in cases where this change renders them the best choice.  
I (tgl) am not entirely convinced that we need to account for this  
behavior in the planner, because I think typically the bitmap scan would  
get chosen anyway if it's the best bet.  In any case the submitted patch  
took way too many shortcuts, resulting in too many clearly-bad choices,  
to be committable.  
  
Alexander Kuzmenkov, reviewed by Alexey Chernyshov, and whacked around  
rather heavily by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/optimizer/plan/createplan.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

doc: Mention pg_stat_wal_receiver in streaming replication docs

commit   : ec7ce54204147ccf1a55aaba526ac4b39071f712    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Nov 2017 14:32:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Nov 2017 14:32:05 -0400    

Click here for diff

Also make the link to pg_stat_replication more precise.  
  
Author: Michael Paquier <[email protected]>  
Reviewed-by: Jeff Janes <[email protected]>  

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

Fix ALTER TABLE code to update domain constraints when needed.

commit   : af20e2d728eb508bb169e7294e4e210a3459833a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Nov 2017 13:32:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Nov 2017 13:32:23 -0400    

Click here for diff

It's possible for dropping a column, or altering its type, to require  
changes in domain CHECK constraint expressions; but the code was  
previously only expecting to find dependent table CHECK constraints.  
Make the necessary adjustments.  
  
This is a fairly old oversight, but it's a lot easier to encounter  
the problem in the context of domains over composite types than it  
was before.  Given the lack of field complaints, I'm not going to  
bother with a back-patch, though I'd be willing to reconsider that  
decision if someone does complain.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

doc: Add to hot standby documentation

commit   : 387ec70322aaf60127537bc200e20791f0b415ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Nov 2017 10:50:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Nov 2017 10:50:24 -0400    

Click here for diff

Document the order of changing certain settings when using hot-standby  
servers.  This is just a logical consequence of what was already  
documented, but it gives the users some more practical advice.  
  
Author: Yorick Peterse <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  

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

pg_basebackup: Fix comparison handling of tablespace mappings on Windows

commit   : 067a2259fd2d7050ecf13a82a96e9a95bf8b3785    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Nov 2017 10:20:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Nov 2017 10:20:05 -0400    

Click here for diff

A candidate path needs to be canonicalized before being checked against  
the mappings, because the mappings are also canonicalized.  This is  
especially relevant on Windows  
  
Reported-by: nb <[email protected]>  
Author: Michael Paquier <[email protected]>  
Reviewed-by: Ashutosh Sharma <[email protected]>  

M src/bin/pg_basebackup/pg_basebackup.c

Make sure ecpglib does accepts digits behind decimal point even for integers in Informix mode.

commit   : 63d6b97fd904232e7c7a8a2b9c52a3cc7eb47bef    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 1 Nov 2017 13:32:18 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 1 Nov 2017 13:32:18 +0100    

Click here for diff

Spotted and fixed by 高增ē¦ <[email protected]>  

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

commit   : 0fe2780db4876cb38f9f914c855a54db7c141e2f    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 31 Oct 2017 14:04:49 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 31 Oct 2017 14:04:49 -0400    

Click here for diff

CREATE USER is an alias for CREATE ROLE, not its own command any longer,  
so clean up references to the 'sql-createuser' link to go to  
'sql-createrole' instead.  
  
In passing, change a few cases of 'CREATE USER' to be  
'CREATE ROLE ...  LOGIN'.  The remaining cases appear reasonable and  
also mention the distinction between 'CREATE ROLE' and 'CREATE USER'.  
Also, don't say CREATE USER "assumes" LOGIN, but rather "includes".  
  
Patch-by: David G. Johnston, with assumes->includes by me.  
Discussion: https://postgr.es/m/CAKFQuwYrbhKV8hH4TEABrDRBwf=gKremF=mLPQ6X2yGqxgFpYA@mail.gmail.com  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/user-manag.sgml

Fix underqualified cast-target type names in pg_dump and psql queries.

commit   : 080351466c5a669bf35a323bdec9e296330a5dbb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Oct 2017 13:40:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Oct 2017 13:40:23 -0400    

Click here for diff

Queries running with some non-pg_catalog schema frontmost in their search  
path need to be careful to schema-qualify type names that should be sought  
in pg_catalog.  Vitaly Burovoy reported an oversight of this sort in  
pg_dump's dumpSequence, and grepping detected another one in psql's  
describeOneTableDetails, both introduced by sequence-related changes in  
v10.  In pg_dump, we can fix things by removing the cast altogether, since  
it doesn't really matter what data types are reported for these query  
result columns.  Likewise in psql, the query seemed to be working unduly  
hard to get a result that's guaranteed to be exactly 'bigint'.  
  
I also changed a couple of occurrences of "::char" similarly.  These are  
not bugs, since "char" is a typename keyword and not subject to search_path  
rules, but it seems better to use uniform style.  
  
Vitaly Burovoy and Tom Lane  
  
Discussion: https://postgr.es/m/CAKOSWN=ds66zLw2SqkLTM8wbXFgDbc_OdkmT3dJfPT2mE5kipA@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c

Don't exaggerate the number of temporary blocks read.

commit   : ee4673ac071f8352c41cc673299b7ec695f079ff    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 31 Oct 2017 14:54:41 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 31 Oct 2017 14:54:41 +0530    

Click here for diff

A read that returns zero bytes (or an error) should not increment  
the number of temporary blocks read.  
  
Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=21xgihg=WaG+O5MFotEZfN6kFETpfw+RkSnEqNQqGn2Q@mail.gmail.com  

M src/backend/storage/file/buffile.c

commit   : cf7ab13bfb450dde50c86fa714a92964ce32b537    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 31 Oct 2017 14:41:21 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 31 Oct 2017 14:41:21 +0530    

Click here for diff

The entry in appinfo->translated_vars can be NULL; if so, we must avoid  
dereferencing it.  
  
Ashutosh Bapat  
  
Discussion: http://postgr.es/m/CAFjFpReL7+1ien=-21rhjpO3bV7aAm1rQ8XgLVk2csFagSzpZQ@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Add sanity check for pg_proc.provariadic

commit   : 35f059e9bdfb3b14ac9d22a9e159d36ec0ccf804    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 31 Oct 2017 09:52:39 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 31 Oct 2017 09:52:39 +0530    

Click here for diff

Check that the values from pg_proc.h match what ProcedureCreate would  
have done.  
  
Robert Haas and Amul Sul  
  
Discussion: http://postgr.es/m/CA+TgmoZ_UGXfq5ygeDDMdUSJ4J_VX7nFnjC6mfY6BgOJ3qZCmw@mail.gmail.com  

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

Doc: call out UPDATE syntax change as a v10 compatibility issue.

commit   : 86182b18957b8f9e8045d55b137aeef7c9af9916    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Oct 2017 16:44:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Oct 2017 16:44:26 -0400    

Click here for diff

The change made by commit 906bfcad7 means that if you're writing  
a parenthesized column list in UPDATE ... SET, but that column list  
is only one column, you now need to write ROW(expression) on the  
righthand side, not just a parenthesized expression.  This was an  
intentional change for spec compatibility and potential future  
expansion of the possibilities for the RHS, but I'd neglected to  
document it as a compatibility issue, figuring that hardly anyone  
would bother with parenthesized syntax for a single target column.  
I was wrong, as shown by questions from Justin Pryzby, Adam Brusselback,  
and others.  Move the release note item into the compatibility section  
and point out the behavior change for a single target column.  
  
Discussion: https://postgr.es/m/CAMjNa7cDLzPcs0xnRpkvqmJ6Vb6G3EH8CYGp9ZBjXdpFfTz6dg@mail.gmail.com  

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

Fix autovacuum work item error handling

commit   : be72b9c378bfe99a3d175c98d36dc150229f4faf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Oct 2017 15:52:02 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Oct 2017 15:52:02 +0100    

Click here for diff

In autovacuum's "work item" processing, a few strings were allocated in  
the current transaction's memory context, which goes away during error  
handling; if an error happened during execution of the work item, the  
pfree() calls to clean up afterwards would try to release already-released  
memory, possibly leading to a crash.  In branch master, this was already  
fixed by commit 335f3d04e4c8, so backpatch that to REL_10_STABLE to fix  
the problem there too.  
  
As a secondary problem, verify that the autovacuum worker is connected  
to the right database for each work item; otherwise some items would be  
discarded by workers in other databases.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Fix typo

commit   : 77954f996cdb31ead2718aa3a9b4878da382e385    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 30 Oct 2017 14:37:44 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 30 Oct 2017 14:37:44 +0100    

Click here for diff

M doc/src/sgml/charset.sgml

Fix typo in comment

commit   : 854b643c8eb476ab957d83d562c8bfa10586d123    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 30 Oct 2017 14:37:00 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 30 Oct 2017 14:37:00 +0100    

Click here for diff

Etsuro Fujita  

M src/backend/catalog/partition.c

Fix problems with the "role" GUC and parallel query.

commit   : 846fcc85167c417873865099d70068ed85f758a8    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 29 Oct 2017 12:58:40 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 29 Oct 2017 12:58:40 +0530    

Click here for diff

Without this fix, dropping a role can sometimes result in parallel  
query failures in sessions that have used "SET ROLE" to assume the  
dropped role, even if that setting isn't active any more.  
  
Report by Pavan Deolasee.  Patch by Amit Kapila, reviewed by me.  
  
Discussion: http://postgr.es/m/CABOikdOomRcZsLsLK+Z+qENM1zxyaWnAvFh3MJZzZnnKiF+REg@mail.gmail.com  

M src/backend/access/transam/parallel.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

pg_receivewal: Add --no-sync option.

commit   : 5f3971291fc231bb65a38198b1bcb1c29ef63108    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 29 Oct 2017 12:46:55 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 29 Oct 2017 12:46:55 +0530    

Click here for diff

Michael Paquier, reviewed by Kuntal Ghosh and by me.  I did a little  
wordsmithing on the documentation, too.  
  
Discussion: http://postgr.es/m/CAB7nPqTuXuyEoVKcWcExh_b0uAjgWd_14KfGLrCTccBZ=VA0KA@mail.gmail.com  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Add hash_combine64.

commit   : b7f3eb31405f1dbbf086e5a8f88569a6dc85157a    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 29 Oct 2017 12:41:43 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 29 Oct 2017 12:41:43 +0530    

Click here for diff

Extracted from a larger patch by Amul Sul, with some comment additions  
by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/utils/hashutils.h

Support domains over composite types in PL/Perl.

commit   : 60651e4cddbb77e8f1a0c7fc0be6a7e7bf626fe0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Oct 2017 14:02:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Oct 2017 14:02:21 -0400    

Click here for diff

In passing, don't insist on rsi->expectedDesc being set unless we  
actually need it; this allows succeeding in a couple of cases where  
PL/Perl functions returning setof composite would have failed before,  
and makes the error message more apropos in other cases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/expected/plperl.out
M src/pl/plperl/expected/plperl_util.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl.sql
M src/pl/plperl/sql/plperl_util.sql

Fix typo.

commit   : c6fd5cd7062283575a436ec4ea3ed7899ace79a0    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 12:04:37 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 12:04:37 +0200    

Click here for diff

Eiji Seki  
  
Discussion: http://postgr.es/m/A11BD0E1A40FAC479D740CEFA373E203397E5276@g01jpexmbkw05  

M contrib/bloom/blvacuum.c

Improve comments for parallel executor estimation functions.

commit   : 11c1d555cebe8045a45bc0ee10d0673fad8d4895    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:50:22 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:50:22 +0200    

Click here for diff

The previous comment (which was copied as boilerplate from one file  
to the next) implied that it was the executor node itself which was  
being serialized, but that's not right.  We're not serializing  
the executor nodes; we're just allowing them to store some  
additional information in DSM.  Adjusts the comment to reflect this.  
  
Discussion: http://postgr.es/m/CA+TgmoaHVinxG=3h6qBAsyV8xaDyQwbzK7YZnYfE8nJFMK1=FA@mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSeqscan.c

Add table_constraint synopsis to ALTER TABLE documentation.

commit   : 9f295c08f8776213ccb592de0c4f094738d6d841    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:20:00 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:20:00 +0200    

Click here for diff

This is already present in the CREATE TABLE documentation, but it's  
nicer not to have to refer to CREATE TABLE to find out the syntax  
for ALTER TABLE.  
  
LƦtitia Avrot  

M doc/src/sgml/ref/alter_table.sgml

Fix grammar.

commit   : 24fd674a1affe1ca9776bd6b21b2b35feb0fe6ed    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:14:23 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:14:23 +0200    

Click here for diff

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

M src/backend/optimizer/README

Fix misplaced ReleaseSysCache call in get_default_partition_oid.

commit   : 1310ac258c773ab9d41650b509098dd01cb4ecf3    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:10:21 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 28 Oct 2017 11:10:21 +0200    

Click here for diff

Julien Rouhaud  
  
Discussion: http://postgr.es/m/CAOBaU_Y4omLA+VbsVdA-JwBLoJWiPxfdKCkMjrZM7NMZxa1fKw@mail.gmail.com  

M src/backend/catalog/partition.c

Dept of second thoughts: keep aliasp_item in sync with tlistitem.

commit   : d76886c2d33123299ce7c8255a71e39b9e53711b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 18:16:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 18:16:24 -0400    

Click here for diff

Commit d5b760ecb wasn't quite right, on second thought: if the  
caller didn't ask for column names then it would happily emit  
more Vars than if the caller did ask for column names.  This  
is surely not a good idea.  Advance the aliasp_item whether or  
not we're preparing a colnames list.  

M src/backend/parser/parse_relation.c

Fix crash when columns have been added to the end of a view.

commit   : d5b760ecb5e172252810fae877e6d6193b818167    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 17:10:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 17:10:21 -0400    

Click here for diff

expandRTE() supposed that an RTE_SUBQUERY subquery must have exactly  
as many non-junk tlist items as the RTE has column aliases for it.  
This was true at the time the code was written, and is still true so  
far as parse analysis is concerned --- but when the function is used  
during planning, the subquery might have appeared through insertion  
of a view that now has more columns than it did when the outer query  
was parsed.  This results in a core dump if, for instance, we have  
to expand a whole-row Var that references the subquery.  
  
To avoid crashing, we can either stop expanding the RTE when we run  
out of aliases, or invent new aliases for the added columns.  While  
the latter might be more useful, the former is consistent with what  
expandRTE() does for composite-returning functions in the RTE_FUNCTION  
case, so it seems like we'd better do it that way.  
  
Per bug #14876 from Samuel Horwitz.  This has been busted since commit  
ff1ea2173 allowed views to acquire more columns, so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Allow parallel query for prepared statements with generic plans.

commit   : 682ce911f8f30de39b13cf211fc8ceb8c6cbc01b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 22:22:39 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 22:22:39 +0200    

Click here for diff

This was always intended to work, but due to an oversight in  
max_parallel_hazard_walker, it didn't.  In testing, we missed the  
fact that it was only working for custom plans, where the parameter  
value has been substituted for the parameter itself early enough  
that everything worked.  In a generic plan, the Param node survives  
and must be treated as parallel-safe.  SerializeParamList provides  
for the transmission of parameter values to workers.  
  
Amit Kapila with help from Kuntal Ghosh.  Some changes by me.  
  
Discussion: http://postgr.es/m/CAA4eK1+_BuZrmVCeua5Eqnm4Co9DAXdM5HPAOE2J19ePbR912Q@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Rethink the dependencies recorded for FieldSelect/FieldStore nodes.

commit   : 6784d7a1dc69d53b7f41eebf62bf7ffd63885294    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 12:18:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 12:18:56 -0400    

Click here for diff

On closer investigation, commits f3ea3e3e8 et al were a few bricks  
shy of a load.  What we need is not so much to lock down the result  
type of a FieldSelect, as to lock down the existence of the column  
it's trying to extract.  Otherwise, we can break it by dropping that  
column.  The dependency on the result type is then held indirectly  
through the column, and doesn't need to be recorded explicitly.  
  
Out of paranoia, I left in the code to record a dependency on the  
result type, but it's used only if we can't identify the pg_class OID  
for the column.  That shouldn't ever happen right now, AFAICS, but  
it seems possible that in future the input node could be marked as  
being of type RECORD rather than some specific composite type.  
  
Likewise for FieldStore.  
  
Like the previous patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Move new structure member to the end."

commit   : f0392e677ed098e9e514ad5e4d5dc148c0474c63    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 17:29:20 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 17:29:20 +0200    

Click here for diff

This reverts commit 94d622f27be6d48e61a68496da4f2efb06fe8746.  That  
commit was supposed to get pushed to REL_10_STABLE, but I messed  
up.  

M src/include/nodes/execnodes.h

Doc: mention that you can't PREPARE TRANSACTION after NOTIFY.

commit   : e4fbf22831c2bbcf032ee60a327b871d2364b3f5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 10:46:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Oct 2017 10:46:06 -0400    

Click here for diff

The NOTIFY page said this already, but the PREPARE TRANSACTION page  
missed it.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/prepare_transaction.sgml

Move new structure member to the end.

commit   : 94d622f27be6d48e61a68496da4f2efb06fe8746    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 16:40:06 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 16:40:06 +0200    

Click here for diff

Reduces ABI breakage.  Per Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/nodes/execnodes.h

Fix mistaken failure to allow parallelism in corner case.

commit   : 639c1a6bb9ee08fe4757a6fab1ddbd01291515e1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 16:04:01 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Oct 2017 16:04:01 +0200    

Click here for diff

If we try to run a parallel plan in serial mode because, for example,  
it's going to be scanned via a cursor, but for some reason we're  
already in parallel mode (for example because an outer query is  
running in parallel), we'd incorrectly try to launch workers.  
Fix by adding a flag to the EState, so that we can be certain that  
ExecutePlan() and ExecGather()/ExecGatherMerge() will have the same  
idea about whether we are executing serially or in parallel.  
  
Report and fix by Amit Kapila with help from Kuntal Ghosh.  A few  
tweaks by me.  
  
Discussion: http://postgr.es/m/CAA4eK1+_BuZrmVCeua5Eqnm4Co9DAXdM5HPAOE2J19ePbR912Q@mail.gmail.com  

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

Support domains over composite types in PL/Tcl.

commit   : 820c0305f64507490f00b6220f9175a303c821dd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Oct 2017 16:00:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Oct 2017 16:00:17 -0400    

Click here for diff

Since PL/Tcl does little with SQL types internally, this is just a  
matter of making it work with composite-domain function arguments  
and results.  
  
In passing, make it allow RECORD-type arguments --- that's a trivial  
change that nobody had bothered with up to now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/tcl/expected/pltcl_queries.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_queries.sql

Support domains over composite types.

commit   : 37a795a60b4f4b1def11c615525ec5e0e9449e05    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Oct 2017 13:47:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Oct 2017 13:47:45 -0400    

Click here for diff

This is the last major omission in our domains feature: you can now  
make a domain over anything that's not a pseudotype.  
  
The major complication from an implementation standpoint is that places  
that might be creating tuples of a domain type now need to be prepared  
to apply domain_check().  It seems better that unprepared code fail  
with an error like "<type> is not composite" than that it silently fail  
to apply domain constraints.  Therefore, relevant infrastructure like  
get_func_result_type() and lookup_rowtype_tupdesc() has been adjusted  
to treat domain-over-composite as a distinct case that unprepared code  
won't recognize, rather than just transparently treating it the same  
as plain composite.  This isn't a 100% solution to the possibility of  
overlooked domain checks, but it catches most places.  
  
In passing, improve typcache.c's support for domains (it can now cache  
the identity of a domain's base type), and rewrite the argument handling  
logic in jsonfuncs.c's populate_record[set]_worker to reduce duplicative  
per-call lookups.  
  
I believe this is code-complete so far as the core and contrib code go.  
The PLs need varying amounts of work, which will be tackled in followup  
patches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore_io.c
M doc/src/sgml/datatype.sgml
M doc/src/sgml/rowtypes.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execSRF.c
M src/backend/executor/functions.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/nodes/makefuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/funcapi.c
M src/include/access/htup_details.h
M src/include/access/tupdesc.h
M src/include/funcapi.h
M src/include/nodes/primnodes.h
M src/include/parser/parse_type.h
M src/include/utils/typcache.h
M src/test/regress/expected/domain.out
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/domain.sql
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Make setrefs.c match by ressortgroupref even for plain Vars.

commit   : 08f1e1f0a47b4b0e87b07b9794698747b279c711    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Oct 2017 12:17:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Oct 2017 12:17:40 -0400    

Click here for diff

Previously, we skipped using search_indexed_tlist_for_sortgroupref()  
if the tlist expression being sought in the child plan node was merely  
a Var.  This is purely an optimization, based on the theory that  
search_indexed_tlist_for_var() is faster, and one copy of a Var should  
be as good as another.  However, the GROUPING SETS patch broke the  
latter assumption: grouping columns containing the "same" Var can  
sometimes have different outputs, as shown in the test case added here.  
So do it the hard way whenever a ressortgroupref marking exists.  
  
(If this seems like a bottleneck, we could imagine building a tlist index  
data structure for ressortgroupref values, as we do for Vars.  But I'll  
let that idea go until there's some evidence it's worthwhile.)  
  
Back-patch to 9.6.  The problem also exists in 9.5 where GROUPING SETS  
came in, but this patch is insufficient to resolve the problem in 9.5:  
there is some obscure dependency on the upper-planner-pathification  
work that happened in 9.6.  Given that this is such a weird corner case,  
and no end users have complained about it, it doesn't seem worth the work  
to develop a fix for 9.5.  
  
Patch by me, per a report from Heikki Linnakangas.  (This does not fix  
Heikki's original complaint, just the follow-on one.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve gendef.pl diagnostic on failure to open sym file

commit   : 74d2c0dbfd94aa5512be3828a793b4c2d43df2d0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 26 Oct 2017 10:01:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 26 Oct 2017 10:01:02 -0400    

Click here for diff

There have been numerous buildfarm failures but the diagnostic is  
currently silent about the reason for failure to open the file. Let's  
see if we can get to the bottom of it.  
  
Backpatch to all live branches.  

M src/tools/msvc/gendef.pl

Undo inadvertent change in capitalization in commit 18fc4ec.

commit   : adee9e4e317169463816d005e8bf901333271917    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 26 Oct 2017 08:20:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 26 Oct 2017 08:20:00 -0400    

Click here for diff

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

In relevant log messages, indicate whether vacuums are aggressive.

commit   : b55509332f50f998b6e8b3830a51c5b9d8f666aa    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 26 Oct 2017 12:35:34 +0200    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 26 Oct 2017 12:35:34 +0200    

Click here for diff

Kyotaro Horiguchi, reviewed Masahiko Sawada, David G. Johnston, Ɓlvaro  
Herrera, and me.  Grammar correction to the final posted patch by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/vacuumlazy.c

Fixed handling of escape character in libecpg.

commit   : 0af98a95cf8397d36202a34cd615f222faf24e9a    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 26 Oct 2017 10:16:04 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 26 Oct 2017 10:16:04 +0200    

Click here for diff

Patch by Tsunakawa Takayuki <[email protected]>  

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

Fix libpq to not require user's home directory to exist.

commit   : db6986f47c9531628d151d6bf760a2fe1214b19d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Oct 2017 19:32:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Oct 2017 19:32:24 -0400    

Click here for diff

Some people like to run libpq-using applications in environments where  
there's no home directory.  We've broken that scenario before (cf commits  
5b4067798 and bd58d9d88), and commit ba005f193 broke it again, by making  
it a hard error if we fail to get the home directory name while looking  
for ~/.pgpass.  The previous precedent is that if we can't get the home  
directory name, we should just silently act as though the file we hoped  
to find there doesn't exist.  Rearrange the new code to honor that.  
  
Looking around, the service-file code added by commit 41a4e4595 had the  
same disease.  Apparently, that escaped notice because it only runs when  
a service name has been specified, which I guess the people who use this  
scenario don't do.  Nonetheless, it's wrong too, so fix that case as well.  
  
Add a comment about this policy to pqGetHomeDirectory, in the probably  
vain hope of forestalling the same error in future.  And upgrade the  
rather miserable commenting in parseServiceInfo, too.  
  
In passing, also back off parseServiceInfo's assumption that only ENOENT  
is an ignorable error from stat() when checking a service file.  We would  
need to ignore at least ENOTDIR as well (cf 5b4067798), and seeing that  
the far-better-tested code for ~/.pgpass treats all stat() failures alike,  
I think this code ought to as well.  
  
Per bug #14872 from Dan Watson.  Back-patch the .pgpass change to v10  
where ba005f193 came in.  The service-file bugs are far older, so  
back-patch the other changes to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Process variadic arguments consistently in json functions

commit   : 18fc4ecf4afafe40bd7e7577bd611e5caf74c9fd    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 25 Oct 2017 07:34:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 25 Oct 2017 07:34:00 -0400    

Click here for diff

json_build_object and json_build_array and the jsonb equivalents did not  
correctly process explicit VARIADIC arguments. They are modified to use  
the new extract_variadic_args() utility function which abstracts away  
the details of the call method.  
  
Michael Paquier, reviewed by Tom Lane and Dmitry Dolgov.  
  
Backpatch to 9.5 for the jsonb fixes and 9.4 for the json fixes, as  
that's where they originated.  

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

Add a utility function to extract variadic function arguments

commit   : f3c6e8a27a8f8436cada9a42e4f57338ed38c785    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 25 Oct 2017 07:13:11 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 25 Oct 2017 07:13:11 -0400    

Click here for diff

This is epecially useful in the case or "VARIADIC ANY" functions. The  
caller can get the artguments and types regardless of whether or not and  
explicit VARIADIC array argument has been used. The function also  
provides an option to convert arguments on type "unknown" to to "text".  
  
Michael Paquier and me, reviewed by Tom Lane.  
  
Backpatch to 9.4 in order to support the following json bug fix.  

M src/backend/utils/fmgr/funcapi.c
M src/include/funcapi.h

In the planner, delete joinaliasvars lists after we're done with them.

commit   : 896eb5efbdcea5df12e7a464ae9c23dd1e25abd2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Oct 2017 18:42:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Oct 2017 18:42:47 -0400    

Click here for diff

Although joinaliasvars lists coming out of the parser are quite simple,  
those lists can contain arbitrarily complex expressions after subquery  
pullup.  We do not perform expression preprocessing on them, meaning that  
expressions in those lists will not meet the expectations of later phases  
of the planner (for example, that they do not contain SubLinks).  This had  
been thought pretty harmless, since we don't intentionally touch those  
lists in later phases --- but Andreas Seltenreich found a case in which  
adjust_appendrel_attrs() could recurse into a joinaliasvars list and then  
die on its assertion that it never sees a SubLink.  We considered a couple  
of localized fixes to prevent that specific case from looking at the  
joinaliasvars lists, but really this seems like a generic hazard for all  
expression processing in the planner.  Therefore, probably the best answer  
is to delete the joinaliasvars lists from the parsetree at the end of  
expression preprocessing, so that there are no reachable expressions that  
haven't been through preprocessing.  
  
The case Andreas found seems to be harmless in non-Assert builds, and so  
far there are no field reports suggesting that there are user-visible  
effects in other cases.  I considered back-patching this anyway, but  
it turns out that Andreas' test doesn't fail at all in 9.4-9.6, because  
in those versions adjust_appendrel_attrs contains code (added in commit  
842faa714 and removed again in commit 215b43cdc) to process SubLinks  
rather than complain about them.  Barring discovery of another path by  
which unprocessed joinaliasvars lists can cause trouble, the most  
prudent compromise seems to be to patch this into v10 but not further.  
  
Patch by me, with thanks to Amit Langote for initial investigation  
and review.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Documentation improvements around domain types.

commit   : a32c0923b4da7f7df95616aaecbb85ef9f12f93f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Oct 2017 14:08:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Oct 2017 14:08:40 -0400    

Click here for diff

I was a bit surprised to find that domains were almost completely  
unmentioned in the main SGML documentation, outside of the reference  
pages for CREATE/ALTER/DROP DOMAIN.  In particular, noplace was it  
mentioned that we don't support domains over composite, making it  
hard to document the planned fix for that.  
  
Hence, add a section about domains to chapter 8 (Data Types).  
  
Also, modernize the type system overview in section 37.2; it had never  
heard of range types, and insisted on calling arrays base types, which  
seems a bit odd from a user's perspective; furthermore it didn't fit well  
with the fact that we now support arrays over types other than base types.  
It seems appropriate to use the term "container types" to describe all of  
arrays, composites, and ranges, so let's do that.  
  
Also a few other minor improvements, notably improve an example query  
in rowtypes.sgml by using a LATERAL function instead of an ad-hoc  
OFFSET 0 clause.  
  
In part this is mop-up for commit c12d570fa, which missed updating 37.2  
to reflect the fact that it added arrays of domains.  We could possibly  
back-patch this without that claim, but I don't feel a strong need to.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/rowtypes.sgml

Update time zone data files to tzdata release 2017c.

commit   : 8df4ce1eac7835d87d89a4fc4d5d3ae5554f87b7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Oct 2017 18:15:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Oct 2017 18:15:36 -0400    

Click here for diff

DST law changes in Fiji, Namibia, Northern Cyprus, Sudan, Tonga,  
and Turks & Caicos Islands.  Historical corrections for Alaska, Apia,  
Burma, Calcutta, Detroit, Ireland, Namibia, and Pago Pago.  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backward
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/southamerica

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

commit   : 24a1897ab92646795bf065aa1b9d266aba74469f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Oct 2017 17:54:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Oct 2017 17:54:09 -0400    

Click here for diff

This is a trivial update containing only cosmetic changes.  The point  
is just to get back to being synced with an official release of tzcode,  
rather than some ad-hoc point in their commit history, which is where  
commit 47f849a3c left it.  

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

Fix some oversights in expression dependency recording.

commit   : f3ea3e3e820b6b7512e48660bf984603418d53ff    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Oct 2017 13:57:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Oct 2017 13:57:45 -0400    

Click here for diff

find_expr_references() neglected to record a dependency on the result type  
of a FieldSelect node, allowing a DROP TYPE to break a view or rule that  
contains such an expression.  I think we'd omitted this case intentionally,  
reasoning that there would always be a related dependency ensuring that the  
DROP would cascade to the view.  But at least with nested field selection  
expressions, that's not true, as shown in bug #14867 from Mansur Galiev.  
Add the dependency, and for good measure a dependency on the node's exposed  
collation.  
  
Likewise add a dependency on the result type of a FieldStore.  I think here  
the reasoning was that it'd only appear within an assignment to a field,  
and the dependency on the field's column would be enough ... but having  
seen this example, I think that's wrong for nested-composites cases.  
  
Looking at nearby code, I notice we're not recording a dependency on the  
exposed collation of CoerceViaIO, which seems inconsistent with our choices  
for related node types.  Maybe that's OK but I'm feeling suspicious of this  
code today, so let's add that; it certainly can't hurt.  
  
This patch does not do anything to protect already-existing views, only  
views created after it's installed.  But seeing that the issue has been  
there a very long time and nobody noticed till now, that's probably good  
enough.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c

Adjust psql \d query to avoid use of @> operator.

commit   : 471d55859c11b40059aef7dd82f82b3a0dc338b1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Oct 2017 16:45:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Oct 2017 16:45:16 -0400    

Click here for diff

It seems that the parray_gin extension has seen fit to introduce a  
"text[] @> text[]" operator, which conflicts with the core  
"anyarray @> anyarray" operator, causing ambiguous-operator failures  
if the input arguments are coercible to text[] without being exactly  
that type.  This strikes me as a bad idea, but it's out there and  
people use it.  As of v10, that breaks psql's query that tries to  
test "pg_statistic_ext.stxkind @> '{d}'", since stxkind is char[].  
The best workaround seems to be to avoid use of that operator.  
We can use a scalar-vs-array test "'d' = any(stxkind)" instead;  
that's arguably more readable anyway.  
  
Per report from Justin Pryzby.  Backpatch to v10 where this  
query was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Convert another SGML ID to lower case

commit   : 7c981590c2e8149a88f6b53829770e2277336879    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 21 Oct 2017 12:25:31 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 21 Oct 2017 12:25:31 -0400    

Click here for diff

The mostly automated conversion in  
1ff01b3902cbf5b22d1a439014202499c21b2994 missed this one because of the  
unusual whitespace.  

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

Convert SGML IDs to lower case

commit   : 1ff01b3902cbf5b22d1a439014202499c21b2994    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Oct 2017 21:16:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Oct 2017 21:16:39 -0400    

Click here for diff

IDs in SGML are case insensitive, and we have accumulated a mix of upper  
and lower case IDs, including different variants of the same ID.  In  
XML, these will be case sensitive, so we need to fix up those  
differences.  Going to all lower case seems most straightforward, and  
the current build process already makes all anchors and lower case  
anyway during the SGML->XML conversion, so this doesn't create any  
difference in the output right now.  A future XML-only build process  
would, however, maintain any mixed case ID spellings in the output, so  
that is another reason to clean this up beforehand.  
  
Author: Alexander Lakhin <[email protected]>  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/biblio.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/passwordcheck.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/query.sgml
M doc/src/sgml/rangetypes.sgml
M doc/src/sgml/ref/abort.sgml
M doc/src/sgml/ref/alter_aggregate.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_conversion.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_event_trigger.sgml
M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_language.sgml
M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_rule.sgml
M doc/src/sgml/ref/alter_schema.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_server.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/alter_trigger.sgml
M doc/src/sgml/ref/alter_tsconfig.sgml
M doc/src/sgml/ref/alter_tsdictionary.sgml
M doc/src/sgml/ref/alter_tsparser.sgml
M doc/src/sgml/ref/alter_tstemplate.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/alter_user_mapping.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/begin.sgml
M doc/src/sgml/ref/close.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/commit_prepared.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_cast.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_conversion.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_extension.sgml
M doc/src/sgml/ref/create_foreign_data_wrapper.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/ref/create_opfamily.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/create_rule.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M doc/src/sgml/ref/create_transform.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_tsconfig.sgml
M doc/src/sgml/ref/create_tsdictionary.sgml
M doc/src/sgml/ref/create_tsparser.sgml
M doc/src/sgml/ref/create_tstemplate.sgml
M doc/src/sgml/ref/create_type.sgml
M doc/src/sgml/ref/create_user.sgml
M doc/src/sgml/ref/create_user_mapping.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/deallocate.sgml
M doc/src/sgml/ref/declare.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/discard.sgml
M doc/src/sgml/ref/do.sgml
M doc/src/sgml/ref/drop_aggregate.sgml
M doc/src/sgml/ref/drop_cast.sgml
M doc/src/sgml/ref/drop_collation.sgml
M doc/src/sgml/ref/drop_conversion.sgml
M doc/src/sgml/ref/drop_database.sgml
M doc/src/sgml/ref/drop_domain.sgml
M doc/src/sgml/ref/drop_event_trigger.sgml
M doc/src/sgml/ref/drop_extension.sgml
M doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
M doc/src/sgml/ref/drop_foreign_table.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/drop_group.sgml
M doc/src/sgml/ref/drop_index.sgml
M doc/src/sgml/ref/drop_language.sgml
M doc/src/sgml/ref/drop_materialized_view.sgml
M doc/src/sgml/ref/drop_opclass.sgml
M doc/src/sgml/ref/drop_operator.sgml
M doc/src/sgml/ref/drop_opfamily.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/ref/drop_publication.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/drop_rule.sgml
M doc/src/sgml/ref/drop_schema.sgml
M doc/src/sgml/ref/drop_sequence.sgml
M doc/src/sgml/ref/drop_server.sgml
M doc/src/sgml/ref/drop_statistics.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/ref/drop_table.sgml
M doc/src/sgml/ref/drop_tablespace.sgml
M doc/src/sgml/ref/drop_transform.sgml
M doc/src/sgml/ref/drop_trigger.sgml
M doc/src/sgml/ref/drop_tsconfig.sgml
M doc/src/sgml/ref/drop_tsdictionary.sgml
M doc/src/sgml/ref/drop_tsparser.sgml
M doc/src/sgml/ref/drop_tstemplate.sgml
M doc/src/sgml/ref/drop_type.sgml
M doc/src/sgml/ref/drop_user.sgml
M doc/src/sgml/ref/drop_user_mapping.sgml
M doc/src/sgml/ref/drop_view.sgml
M doc/src/sgml/ref/dropdb.sgml
M doc/src/sgml/ref/dropuser.sgml
M doc/src/sgml/ref/ecpg-ref.sgml
M doc/src/sgml/ref/end.sgml
M doc/src/sgml/ref/execute.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/import_foreign_schema.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/listen.sgml
M doc/src/sgml/ref/load.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/move.sgml
M doc/src/sgml/ref/notify.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_controldata.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/prepare_transaction.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/release_savepoint.sgml
M doc/src/sgml/ref/reset.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/rollback.sgml
M doc/src/sgml/ref/rollback_prepared.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/ref/savepoint.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/select_into.sgml
M doc/src/sgml/ref/set.sgml
M doc/src/sgml/ref/set_constraints.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/ref/set_transaction.sgml
M doc/src/sgml/ref/show.sgml
M doc/src/sgml/ref/start_transaction.sgml
M doc/src/sgml/ref/truncate.sgml
M doc/src/sgml/ref/unlisten.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M doc/src/sgml/ref/values.sgml
M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/start.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xindex.sgml

Fix typcache's failure to treat ranges as container types.

commit   : 36ea99c84d856177ec307307788a279cc600566e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2017 17:12:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2017 17:12:27 -0400    

Click here for diff

Like the similar logic for arrays and records, it's necessary to examine  
the range's subtype to decide whether the range type can support hashing.  
We can omit checking the subtype for btree-defined operations, though,  
since range subtypes are required to have those operations.  (Possibly  
that simplification for btree cases led us to overlook that it does  
not apply for hash cases.)  
  
This is only an issue if the subtype lacks hash support, which is not  
true of any built-in range type, but it's easy to demonstrate a problem  
with a range type over, eg, money: you can get a "could not identify  
a hash function" failure when the planner is misled into thinking that  
hash join or aggregation would work.  
  
This was born broken, so back-patch to all supported branches.  

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

Fix misimplementation of typcache logic for extended hashing.

commit   : a8f1efc8ace228b5258ee7d06eace923007072c4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2017 16:08:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Oct 2017 16:08:17 -0400    

Click here for diff

The previous coding would report that an array type supports extended  
hashing if its element type supports regular hashing.  This bug is  
only latent at the moment, since AFAICS there is not yet any code  
that depends on checking presence of extended-hashing support to make  
any decisions.  (And in any case it wouldn't matter unless the element  
type has only regular hashing, which isn't true of any core data type.)  
But that doesn't make it less broken.  Extend the  
cache_array_element_properties infrastructure to check this properly.  

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

pg_stat_statements: Add a comment about the dangers of padding bytes.

commit   : 2959213bf33cf7d2d1fc0b46c67d36254ffe043f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Oct 2017 09:40:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Oct 2017 09:40:17 -0400    

Click here for diff

Inspired by a patch from Julien Rouhaud, but I reworded it.  
  
Discussion: http://postgr.es/m/CAOBaU_a8AH8=ypfqgHnDYu06ts+jWTUgh=VgCxA3yNV-K10j9w@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c

commit   : e250c8c8408a1c068285df210a7ceff68c421b3b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Oct 2017 11:16:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Oct 2017 11:16:18 -0400    

Click here for diff

As noted by M. Justin.  
  
Also, to keep the HEAD and REL_10 versions of release-10.sgml in sync,  
back-patch the effects of c29c57890 on that file.  We have a bigger  
problem there though :-(  
  
Discussion: https://postgr.es/m/CALtA7pmsQyTTD3fC2rmfUWgfivv5sCJJ84PHY0F_5t_SRc07Qg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

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

Add more tests for reloptions

commit   : 4b95cc1dc36c9d1971f757e9b519fcc442833f0e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Oct 2017 14:14:18 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Oct 2017 14:14:18 +0200    

Click here for diff

This is preparation for a future patch to extensively change how  
reloptions work.  
  
Author: Nikolay Shaplov  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/2615372.orqtEn8VGB@x200m  

M contrib/bloom/expected/bloom.out
M contrib/bloom/sql/bloom.sql
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/gist.out
M src/test/regress/expected/hash_index.out
A src/test/regress/expected/reloptions.out
M src/test/regress/expected/spgist.out
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/gist.sql
M src/test/regress/sql/hash_index.sql
A src/test/regress/sql/reloptions.sql
M src/test/regress/sql/spgist.sql

Fix typos

commit   : 752871b6de9b4c7d2c685a059adb55887e169201    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 19 Oct 2017 13:58:30 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 19 Oct 2017 13:58:30 +0200    

Click here for diff

David Rowley  

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

Fix typo

commit   : 275c4be19deec4288c303cc9ba3a3540bd1b8f5f    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 19 Oct 2017 13:57:20 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 19 Oct 2017 13:57:20 +0200    

Click here for diff

Masahiko Sawada  

M src/backend/libpq/auth.c

Fix typo in release notes

commit   : bcf2e5ceb0998318deb36911b13677e88d45c8b4    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 19 Oct 2017 13:54:33 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 19 Oct 2017 13:54:33 +0200    

Click here for diff

Spotted by Piotr Stefaniak  

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

UCS_to_most.pl: Process encodings in sorted order

commit   : 927e1ee2cb74e3bc49454dfa181dcce83b70d371    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Oct 2017 05:58:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Oct 2017 05:58:39 -0400    

Click here for diff

Otherwise the order depends on the Perl hash implementation, making it  
cumbersome to scan the output when debugging.  

M src/backend/utils/mb/Unicode/UCS_to_most.pl

Make OWNER TO subcommand mention consistent

commit   : bf54c0f05c0a58db17627724a83e1b6d4ec2712c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Oct 2017 13:29:16 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Oct 2017 13:29:16 +0200    

Click here for diff

We say 'OWNER TO' in the synopsis; let's use that form elsewhere.  
  
There is a paragraph in the <note> section that refers to various  
subcommands very loosely (including OWNER); I didn't think it was an  
improvement to change that one.  
  
This is a fairly inconsequential change, so no backpatch.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_table.sgml

Make release notes aware that --xlog-method was renamed

commit   : f5b73093339d965744607b786d7c34bf8f430935    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Oct 2017 13:21:43 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Oct 2017 13:21:43 +0200    

Click here for diff

Author: David G. Johnston  
Discussion: https:/postgr.es/m/CAKFQuwaCsb-OKOjQXGeN0R7byxiRWvr7OtyKDbJoYgiF2vBG4Q@mail.gmail.com  

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

Don't use SGML empty tags

commit   : c29c578908dc0271eeb13a4014e54bff07a29c05    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Oct 2017 21:44:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Oct 2017 21:44:17 -0400    

Click here for diff

For DocBook XML compatibility, don't use SGML empty tags (</>) anymore,  
replace by the full tag name.  Add a warning option to catch future  
occurrences.  
  
Alexander Lakhin, JĆ¼rgen Purtz  

M doc/src/sgml/Makefile
M doc/src/sgml/acronyms.sgml
M doc/src/sgml/adminpack.sgml
M doc/src/sgml/advanced.sgml
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/array.sgml
M doc/src/sgml/auth-delay.sgml
M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/bgworker.sgml
M doc/src/sgml/biblio.sgml
M doc/src/sgml/bki.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/btree-gin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/citext.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/contrib-spi.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/dict-int.sgml
M doc/src/sgml/dict-xsyn.sgml
M doc/src/sgml/diskusage.sgml
M doc/src/sgml/dml.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/errcodes.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/fuzzystrmatch.sgml
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generic-wal.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/info.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/intagg.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/intro.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/notation.sgml
M doc/src/sgml/oid2name.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgprewarm.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstandby.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/pgvisibility.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/query.sgml
M doc/src/sgml/rangetypes.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/abort.sgml
M doc/src/sgml/ref/alter_aggregate.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_conversion.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_schema.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_server.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/alter_trigger.sgml
M doc/src/sgml/ref/alter_tsconfig.sgml
M doc/src/sgml/ref/alter_tsdictionary.sgml
M doc/src/sgml/ref/alter_tsparser.sgml
M doc/src/sgml/ref/alter_tstemplate.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_user_mapping.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/begin.sgml
M doc/src/sgml/ref/close.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/commit_prepared.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_access_method.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_cast.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_conversion.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_extension.sgml
M doc/src/sgml/ref/create_foreign_data_wrapper.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/ref/create_opfamily.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/create_rule.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_tsconfig.sgml
M doc/src/sgml/ref/create_tstemplate.sgml
M doc/src/sgml/ref/create_type.sgml
M doc/src/sgml/ref/create_user.sgml
M doc/src/sgml/ref/create_user_mapping.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/declare.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/discard.sgml
M doc/src/sgml/ref/do.sgml
M doc/src/sgml/ref/drop_access_method.sgml
M doc/src/sgml/ref/drop_aggregate.sgml
M doc/src/sgml/ref/drop_collation.sgml
M doc/src/sgml/ref/drop_conversion.sgml
M doc/src/sgml/ref/drop_database.sgml
M doc/src/sgml/ref/drop_domain.sgml
M doc/src/sgml/ref/drop_extension.sgml
M doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
M doc/src/sgml/ref/drop_foreign_table.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/drop_index.sgml
M doc/src/sgml/ref/drop_language.sgml
M doc/src/sgml/ref/drop_opclass.sgml
M doc/src/sgml/ref/drop_opfamily.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_publication.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/drop_schema.sgml
M doc/src/sgml/ref/drop_sequence.sgml
M doc/src/sgml/ref/drop_server.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/ref/drop_table.sgml
M doc/src/sgml/ref/drop_tablespace.sgml
M doc/src/sgml/ref/drop_tsconfig.sgml
M doc/src/sgml/ref/drop_tsdictionary.sgml
M doc/src/sgml/ref/drop_tsparser.sgml
M doc/src/sgml/ref/drop_tstemplate.sgml
M doc/src/sgml/ref/drop_type.sgml
M doc/src/sgml/ref/drop_user_mapping.sgml
M doc/src/sgml/ref/drop_view.sgml
M doc/src/sgml/ref/dropdb.sgml
M doc/src/sgml/ref/dropuser.sgml
M doc/src/sgml/ref/ecpg-ref.sgml
M doc/src/sgml/ref/end.sgml
M doc/src/sgml/ref/execute.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/import_foreign_schema.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/listen.sgml
M doc/src/sgml/ref/load.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/move.sgml
M doc/src/sgml/ref/notify.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_config-ref.sgml
M doc/src/sgml/ref/pg_controldata.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_isready.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/ref/postmaster.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/prepare_transaction.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/release_savepoint.sgml
M doc/src/sgml/ref/reset.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/rollback.sgml
M doc/src/sgml/ref/rollback_prepared.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/ref/savepoint.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/set.sgml
M doc/src/sgml/ref/set_constraints.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/ref/set_transaction.sgml
M doc/src/sgml/ref/show.sgml
M doc/src/sgml/ref/start_transaction.sgml
M doc/src/sgml/ref/truncate.sgml
M doc/src/sgml/ref/unlisten.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M doc/src/sgml/ref/values.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-8.0.sgml
M doc/src/sgml/release-8.1.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml
M doc/src/sgml/release-old.sgml
M doc/src/sgml/release.sgml
M doc/src/sgml/rowtypes.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sourcerepo.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/sslinfo.sgml
M doc/src/sgml/start.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/tablesample-method.sgml
M doc/src/sgml/tcn.sgml
M doc/src/sgml/test-decoding.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/trigger.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M doc/src/sgml/typeconv.sgml
M doc/src/sgml/unaccent.sgml
M doc/src/sgml/user-manag.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/vacuumlo.sgml
M doc/src/sgml/wal.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xml2.sgml
M doc/src/sgml/xoper.sgml
M doc/src/sgml/xplang.sgml
M doc/src/sgml/xtypes.sgml

REASSIGN OWNED BY doc: s/privileges/membership/

commit   : 6ecabead4b5993c42745f2802d857b1a79f48bf9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Oct 2017 11:45:34 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Oct 2017 11:45:34 +0200    

Click here for diff

Reported by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwajWqjqEL9xc1xnnmTyBg32EdAZKJXijzigbosGSs_vag@mail.gmail.com  

M doc/src/sgml/ref/reassign_owned.sgml

Fix incorrect handling of CTEs and ENRs as DML target relations.

commit   : 7421f4b89a90e1fa45751dd1cbc4e8d4ca1cba5e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 17:56:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 17:56:42 -0400    

Click here for diff

setTargetTable threw an error if the proposed target RangeVar's relname  
matched any visible CTE or ENR.  This breaks backwards compatibility in  
the CTE case, since pre-v10 we never looked for a CTE here at all, so that  
CTE names did not mask regular tables.  It does seem like a good idea to  
throw an error for the ENR case, though, thus causing ENRs to mask tables  
for this purpose; ENRs are new in v10 so we're not breaking existing code,  
and we may someday want to allow them to be the targets of DML.  
  
To fix that, replace use of getRTEForSpecialRelationTypes, which was  
overkill anyway, with use of scanNameSpaceForENR.  
  
A second problem was that the check neglected to verify null schemaname,  
so that a CTE or ENR could incorrectly be thought to match a qualified  
RangeVar.  That happened because getRTEForSpecialRelationTypes relied  
on its caller to have checked for null schemaname.  Even though the one  
remaining caller got it right, this is obviously bug-prone, so move  
the check inside getRTEForSpecialRelationTypes.  
  
Also, revert commit 18ce3a4ab's extremely poorly thought out decision to  
add a NULL return case to parserOpenTable --- without either documenting  
that or adjusting any of the callers to check for it.  The current bug  
seems to have arisen in part due to working around that bad idea.  
  
In passing, remove the one-line shim functions transformCTEReference and  
transformENRReference --- they don't seem to be adding any clarity or  
functionality.  
  
Per report from Hugo Mercier (via Julien Rouhaud).  Back-patch to v10  
where the bug was introduced.  
  
Thomas Munro, with minor editing by me  
  
Discussion: https://postgr.es/m/CAOBaU_YdPVH+PTtiKSSLOiiW3mVDYsnNUekK+XPbHXiP=wrFLA@mail.gmail.com  

M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/with.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/with.sql

Exclude flex-generated code from coverage testing

commit   : 421167362242ce1fb46d6d720798787e7cd65aad    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

Flex generates a lot of functions that are not actually used.  In order  
to avoid coverage figures being ruined by that, mark up the part of the  
.l files where the generated code appears by lcov exclusion markers.  
That way, lcov will typically only reported on coverage for the .l file,  
which is under our control, but not for the .c file.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M contrib/cube/cubescan.l
M contrib/seg/segscan.l
M src/backend/bootstrap/bootscanner.l
M src/backend/parser/scan.l
M src/backend/replication/repl_scanner.l
M src/backend/replication/syncrep_scanner.l
M src/backend/utils/misc/guc-file.l
M src/bin/pgbench/exprscan.l
M src/bin/psql/psqlscanslash.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/isolation/specscanner.l

Treat aggregate direct arguments as per-agg data not per-trans data.

commit   : cf5ba7c30c0428f5ff49197ec1e0f052035300d6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 16:02:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 16:02:51 -0400    

Click here for diff

There is no reason to insist that direct arguments must match before  
we can merge transition states of two aggregate calls.  They're only  
used during the finalfn call, so we can treat them as like the finalfn  
itself.  This allows, eg, merging of  
  
select  
  percentile_cont(0.25) within group (order by a),  
  percentile_disc(0.5) within group (order by a)  
from ...  
  
This didn't matter (and could not have been tested) before we allowed  
state merging of OSAs otherwise.  
  
Discussion: https://postgr.es/m/CAB4ELO5RZhOamuT9Xsf72ozbenDLLXZKSk07FiSVsuJNZB861A@mail.gmail.com  

M src/backend/executor/nodeAgg.c

Allow the built-in ordered-set aggregates to share transition state.

commit   : be0ebb65f51225223421df6e10eb6e87fc8264d7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 15:51:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 15:51:23 -0400    

Click here for diff

The built-in OSAs all share the same transition function, so they can  
share transition state as long as the final functions cooperate to not  
do the sort step more than once.  To avoid running the tuplesort object  
in randomAccess mode unnecessarily, add a bit of infrastructure to  
nodeAgg.c to let the aggregate functions find out whether the transition  
state is actually being shared or not.  
  
This doesn't work for the hypothetical aggregates, since those inject  
a hypothetical row that isn't traceable to the shared input state.  
So they remain marked aggfinalmodify = 'w'.  
  
Discussion: https://postgr.es/m/CAB4ELO5RZhOamuT9Xsf72ozbenDLLXZKSk07FiSVsuJNZB861A@mail.gmail.com  

M src/backend/executor/nodeAgg.c
M src/backend/utils/adt/orderedsetaggs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
M src/include/fmgr.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Repair breakage of aggregate FILTER option.

commit   : c3dfe0fec01469b8a7de327303cad50ba8ed338a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 15:24:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Oct 2017 15:24:36 -0400    

Click here for diff

An aggregate's input expression(s) are not supposed to be evaluated  
at all for a row where its FILTER test fails ... but commit 8ed3f11bb  
overlooked that requirement.  Reshuffle so that aggregates having a  
filter clause evaluate their arguments separately from those without.  
This still gets the benefit of doing only one ExecProject in the  
common case of multiple Aggrefs, none of which have filters.  
  
While at it, arrange for filter clauses to be included in the common  
ExecProject evaluation, thus perhaps buying a little bit even when  
there are filters.  
  
Back-patch to v10 where the bug was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Rework DefineIndex relkind check

commit   : 60a1d96ed7ba0930024af696e1fb209a030b6c42    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Oct 2017 12:22:18 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Oct 2017 12:22:18 +0200    

Click here for diff

Simplify coding using a switch rather than nested if tests.  
  
Author: Ɓlvaro  
Reviewed-by: Robert Haas, Amit Langote, Michaƫl Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c

Restore nodeAgg.c's ability to check for improperly-nested aggregates.

commit   : 5fc438fb256ce83248feaf60e22e0919b76e3c7b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Oct 2017 19:19:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Oct 2017 19:19:18 -0400    

Click here for diff

While poking around in the aggregate logic, I noticed that commit  
8ed3f11bb broke the logic in nodeAgg.c that purports to detect nested  
aggregates, by moving initialization of regular aggregate argument  
expressions out of the code segment that checks for that.  
  
You could argue that this check is unnecessary, but it's not much code  
so I'm inclined to keep it as a backstop against parser and planner  
bugs.  However, there's certainly zero value in checking only some of  
the subexpressions.  
  
We can make the check complete again, and as a bonus make it a good  
deal more bulletproof against future mistakes of the same ilk, by  
moving it out to the outermost level of ExecInitAgg.  This means we  
need to check only once per Agg node not once per aggregate, which  
also seems like a good thing --- if the check does find something  
wrong, it's not urgent that we report it before the plan node  
initialization finishes.  
  
Since this requires remembering the original length of the aggs list,  
I deleted a long-obsolete stanza that changed numaggs from 0 to 1.  
That's so old it predates our decision that palloc(0) is a valid  
operation, in (digs...) 2004, see commit 24a1e20f1.  
  
In passing improve a few comments.  
  
Back-patch to v10, just in case.  

M src/backend/executor/nodeAgg.c

doc: Postgres -> PostgreSQL

commit   : d8794fd7c337a2285f46b23d348c9826afff69eb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 15 Oct 2017 09:14:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 15 Oct 2017 09:14:08 -0400    

Click here for diff

M doc/src/sgml/ref/create_aggregate.sgml

gcc's support for __attribute__((noinline)) hasn't been around forever.

commit   : 82aff8d3369754282114cb0fff92a342b2864e75    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2017 15:52:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2017 15:52:00 -0400    

Click here for diff

Buildfarm member gaur says it wasn't there in 2.95.3.  Guess that 3.0  
and later have it.  

M src/include/c.h

Explicitly track whether aggregate final functions modify transition state.

commit   : 4de2d4fba38f4f7aff7f95401eb43a6cd05a6db4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2017 15:21:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Oct 2017 15:21:39 -0400    

Click here for diff

Up to now, there's been hard-wired assumptions that normal aggregates'  
final functions never modify their transition states, while ordered-set  
aggregates' final functions always do.  This has always been a bit  
limiting, and in particular it's getting in the way of improving the  
built-in ordered-set aggregates to allow merging of transition states.  
Therefore, let's introduce catalog and CREATE AGGREGATE infrastructure  
that lets the finalfn's behavior be declared explicitly.  
  
There are now three possibilities for the finalfn behavior: it's purely  
read-only, it trashes the transition state irrecoverably, or it changes  
the state in such a way that no more transfn calls are possible but the  
state can still be passed to other, compatible finalfns.  There are no  
examples of this third case today, but we'll shortly make the built-in  
OSAs act like that.  
  
This change allows user-defined aggregates to explicitly disclaim support  
for use as window functions, and/or to prevent transition state merging,  
if their implementations cannot handle that.  While it was previously  
possible to handle the window case with a run-time error check, there was  
not any way to prevent transition state merging, which in retrospect is  
something commit 804163bc2 should have provided for.  But better late  
than never.  
  
In passing, split out pg_aggregate.c's extern function declarations into  
a new header file pg_aggregate_fn.h, similarly to what we've done for  
some other catalog headers, so that pg_aggregate.h itself can be safe  
for frontend files to include.  This lets pg_dump use the symbolic  
names for relevant constants.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/xaggr.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/commands/aggregatecmds.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
A src/include/catalog/pg_aggregate_fn.h
M src/test/regress/expected/create_aggregate.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/create_aggregate.sql
M src/test/regress/sql/opr_sanity.sql

Reinstate genhtml --prefix option for non-vpath builds

commit   : 5f340cb30ce2f0d9f272840b0d977b0a4b854f0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 14 Oct 2017 11:40:54 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 14 Oct 2017 11:40:54 -0400    

Click here for diff

In c3d9a66024a93e6d0380bdd1b18cb03a67216b72, the genhtml --prefix option  
was removed to get slightly better behavior for vpath builds.  genhtml  
would then automatically pick a suitable prefix.  However, for non-vpath  
builds, this makes the coverage output dependent on the length of the  
path where the source code happens to be, leading to confusingly  
arbitrary results.  So put the --prefix option back for non-vpath  
builds.  

M src/Makefile.global.in

Add missing options to pg_regress help() output

commit   : b81eba6a650186dc35b6a1fb8bde320d9c29055d    
  
author   : Joe Conway <[email protected]>    
date     : Fri, 13 Oct 2017 16:06:41 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Fri, 13 Oct 2017 16:06:41 -0700    

Click here for diff

A few command line options accepted by pg_regress were not being output  
by help(), including --help itself. Add that one, as well as --version  
and --bindir, and the corresponding short options for the first two.  
  
We could consider this for backpatching, but it did not seem worthwhile  
and no one else advocated for it, so apply only to master for now.  
  
Author: Joe Conway  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/dd519469-06d7-2662-83ef-c926f6c4f0f1%40joeconway.com  

M src/test/regress/pg_regress.c

Improve sys/catcache performance.

commit   : 141fd1b66ce6e3d10518d66d4008bd368f1505fd    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2017 13:16:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2017 13:16:50 -0700    

Click here for diff

The following are the individual improvements:  
1) Avoidance of FunctionCallInfo based function calls, replaced by  
   more efficient functions with a native C argument interface.  
2) Don't extract columns from a cache entry's tuple whenever matching  
   entries - instead store them as a Datum array. This also allows to  
   get rid of having to build dummy tuples for negative & list  
   entries, and of a hack for dealing with cstring vs. text weirdness.  
3) Reorder members of catcache.h struct, so imortant entries are more  
   likely to be on one cacheline.  
4) Allowing the compiler to specialize critical SearchCatCache for a  
   specific number of attributes allows to unroll loops and avoid  
   other nkeys dependant initialization.  
5) Only initializing the ScanKey when necessary, i.e. catcache misses,  
   greatly reduces cache unnecessary cpu cache misses.  
6) Split of the cache-miss case from the hash lookup, reducing stack  
   allocations etc in the common case.  
7) CatCTup and their corresponding heaptuple are allocated in one  
   piece.  
  
This results in making cache lookups themselves roughly three times as  
fast - full-system benchmarks obviously improve less than that.  
  
I've also evaluated further techniques:  
- replace open coded hash with simplehash - the list walk right now  
  shows up in profiles. Unfortunately it's not easy to do so safely as  
  an entry's memory location can change at various times, which  
  doesn't work well with the refcounting and cache invalidation.  
- Cacheline-aligning CatCTup entries - helps some with performance,  
  but the win isn't big and the code for it is ugly, because the  
  tuples have to be freed as well.  
- add more proper functions, rather than macros for  
  SearchSysCacheCopyN etc., but right now they don't show up in  
  profiles.  
  
The reason the macro wrapper for syscache.c/h have to be changed,  
rather than just catcache, is that doing otherwise would require  
exposing the SysCache array to the outside.  That might be a good idea  
anyway, but it's for another day.  
  
Author: Andres Freund  
Reviewed-By: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/syscache.c
M src/include/utils/catcache.h
M src/include/utils/syscache.h
M src/tools/pgindent/typedefs.list

Add pg_noinline macro to c.h.

commit   : a0247e7a11bb9f5fd55694b594a3906b7bd05881    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2017 11:44:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2017 11:44:51 -0700    

Click here for diff

Forcing a function not to be inlined can be useful if it's the  
slow-path of a performance critical function, or should be visible in  
profiles to allow for proper cost attribution.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h

Force "restrict" not to be used when compiling with xlc.

commit   : d133982d598c7e6208d16cb4fc0b552151796603    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2017 11:54:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Oct 2017 11:54:59 -0700    

Click here for diff

Per buildfarm animal Hornet and followup manual testing by Noah Misch,  
it appears xlc miscompiles code using "restrict" in at least some  
cases. Allow disabling restrict usage with FORCE_DISABLE_RESTRICT=yes  
in template files, and do so for aix/xlc.  
  
Author: Andres Freund and Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/template/aix

Fix possible crash with Parallel Bitmap Heap Scan.

commit   : 6393613b6a1e0feae3d22af608397b252cee5b58    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 13 Oct 2017 14:53:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 13 Oct 2017 14:53:28 -0400    

Click here for diff

If a Parallel Bitmap Heap scan's chain of leftmost descendents  
includes a BitmapOr whose first child is a BitmapAnd, the prior coding  
would mistakenly create a non-shared TIDBitmap and then try to perform  
shared iteration.  
  
Report by Tomas Vondra.  Patch by Dilip Kumar.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Improve implementation of CRE-stack-flattening in map_variable_attnos().

commit   : 73937119bfd07a140da4817f5ca949351942ffdc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Oct 2017 13:43:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Oct 2017 13:43:55 -0400    

Click here for diff

I (tgl) objected to the obscure implementation introduced in commit  
1c497fa72.  This one seems a bit less action-at-a-distance-y, at the  
price of repeating a few lines of code.  
  
Improve the comments about what the function is doing, too.  
  
Amit Khandekar, whacked around a bit more by me  
  
Discussion: https://postgr.es/m/CAJ3gD9egYTyHUH0nTMxm8-1m3RvdqEbaTyGC-CUNtYf7tKNDaQ@mail.gmail.com  

M src/backend/rewrite/rewriteManip.c

Rely on sizeof(typename) rather than sizeof(variable) in pqformat.h.

commit   : 5229db6c6f92515afcd698cf5d5badc12ffe6bc2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Oct 2017 11:46:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Oct 2017 11:46:05 -0400    

Click here for diff

In each of the pq_writeintN functions, the three uses of sizeof() should  
surely all be consistent.  I started out to make them all sizeof(ni),  
but on reflection let's make them sizeof(typename) instead.  That's more  
like our usual style elsewhere, and it's just barely possible that the  
failures buildfarm member hornet has shown since 4c119fbcd went in are  
caused by the compiler getting confused about sizeof() a parameter that  
it's optimizing away.  
  
In passing, improve a couple of comments.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/pqformat.h

Attempt to fix LDAP build

commit   : 7d1b8e7591690fb68cc53553e0f13b537b5455dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Oct 2017 23:47:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Oct 2017 23:47:48 -0400    

Click here for diff

Apparently, an older spelling of LDAP_OPT_DIAGNOSTIC_MESSAGE is  
LDAP_OPT_ERROR_STRING, so fall back to that one.  

M src/backend/libpq/auth.c

Log diagnostic messages if errors occur during LDAP auth.

commit   : cf1238cd9763f0a6e3454ddf75ac56ff722f18ee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Oct 2017 22:33:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Oct 2017 22:33:34 -0400    

Click here for diff

Diagnostic messages seem likely to help users diagnose root  
causes more easily, so let's report them as errdetail.  
  
Author: Thomas Munro  
Reviewed-By: Ashutosh Bapat, Christoph Berg, Alvaro Herrera, Peter Eisentraut  
Discussion: https://postgr.es/m/CAEepm=2_dA-SYpFdmNVwvKsEBXOUj=K4ooKovHmvj6jnMdt8dw@mail.gmail.com  

M src/backend/libpq/auth.c
M src/test/ldap/t/001_auth.pl

Improve LDAP cleanup code in error paths.

commit   : 1feff99fe4576d4685c14dff18d1f845a1456f10    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Oct 2017 22:33:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Oct 2017 22:33:15 -0400    

Click here for diff

After calling ldap_unbind_s() we probably shouldn't try to use the LDAP  
connection again to call ldap_get_option(), even if it failed.  The OpenLDAP  
man page for ldap_unbind[_s] says "Once it is called, the connection to the  
LDAP server is closed, and the ld structure is invalid."  Otherwise, as a  
general rule we should probably call ldap_unbind() before returning in all  
paths to avoid leaking resources.  It is unlikely there is any practical  
leak problem since failure to authenticate currently results in the backend  
exiting soon afterwards.  
  
Author: Thomas Munro  
Reviewed-By: Alvaro Herrera, Peter Eisentraut  
Discussion: https://postgr.es/m/20170914141205.eup4kxzlkagtmfac%40alvherre.pgsql  

M src/backend/libpq/auth.c

Use C99 restrict via pg_restrict, rather than restrict directly.

commit   : 91d5f1a4a3e8aea2a6488243bac55806160408fb    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 Oct 2017 15:25:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 Oct 2017 15:25:38 -0700    

Click here for diff

Unfortunately using 'restrict' plainly causes problems with MSVC,  
which supports restrict only as '__restrict'. Defining 'restrict' to  
'__restrict' unfortunately causes a conflict with MSVC's usage of  
__declspec(restrict) in headers.  
  
Therefore define pg_restrict to the appropriate keyword instead, and  
replace existing usages.  
  
This replaces the temporary workaround introduced in 36b4b91ba078.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid coercing a whole-row variable that is already coerced.

commit   : 1c497fa72df7593d8976653538da3d0ab033207f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 17:10:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 17:10:48 -0400    

Click here for diff

Marginal efficiency and beautification hack.  I'm not sure whether  
this case ever arises currently, but the pending patch for update  
tuple routing will cause it to arise.  
  
Amit Khandekar  
  
Discussion: http://postgr.es/m/CAJ3gD9cazfppe7-wwUbabPcQ4_0SubkiPFD1+0r5_DkVNWo5yg@mail.gmail.com  

M src/backend/rewrite/rewriteManip.c

Use ResultRelInfo ** rather than ResultRelInfo * for tuple routing.

commit   : 60f7c0abef0327648c02795312d1679c66586fbb    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 16:50:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 16:50:53 -0400    

Click here for diff

The previous convention doesn't lend itself to creating ResultRelInfos  
lazily, as we already do in ExecGetTriggerResultRel.  This patch  
doesn't make anything lazier than before, but the pending patch for  
UPDATE tuple routing proposes to do so (and there might be other  
opportunities as well).  
  
Amit Khandekar with some adjustments by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYPVP9Lyf6vUFA5DwxS4c--x6LOj2y36BsJaYtp62eXPQ@mail.gmail.com  

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

Fix AggGetAggref() so it won't lie to aggregate final functions.

commit   : 305cf1fd7239e0ffa9ae4ff54a7c66f36432c741    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Oct 2017 15:20:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Oct 2017 15:20:04 -0400    

Click here for diff

If we merge the transition calculations for two different aggregates,  
it's reasonable to assume that the transition function should not care  
which of those Aggref structs it gets from AggGetAggref().  It is not  
reasonable to make the same assumption about an aggregate final function,  
however.  Commit 804163bc2 broke this, as it will pass whichever Aggref  
was first associated with the transition state in both cases.  
  
This doesn't create an observable bug so far as the core system is  
concerned, because the only existing uses of AggGetAggref() are in  
ordered-set aggregates that happen to not pay attention to anything  
but the input properties of the Aggref; and besides that, we disabled  
sharing of transition calculations for OSAs yesterday.  Nonetheless,  
if some third-party code were using AggGetAggref() in a normal aggregate,  
they would be entitled to call this a bug.  Hence, back-patch the fix  
to 9.6 where the problem was introduced.  
  
In passing, improve some of the comments about transition state sharing.  
  
Discussion: https://postgr.es/m/CAB4ELO5RZhOamuT9Xsf72ozbenDLLXZKSk07FiSVsuJNZB861A@mail.gmail.com  

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

Synchronize error messages.

commit   : ad4a7ed0996ee044ee7291559deddf9842d8bbf7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 15:14:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 15:14:22 -0400    

Click here for diff

Commits 6476b26115f3ef25a9cd87880e0ac5ec5f7a05f6  
and 14f67a8ee282ebc0de78e773fbd597f460ab4a54 didn't use quite the  
same error message for what is basically the same situation.  
  
Amit Langote, pared back a bit by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Doc: fix typo in release notes.

commit   : 0a047a1e3ef852884278b1324df73e359972c43a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Oct 2017 11:35:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Oct 2017 11:35:54 -0400    

Click here for diff

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

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

Infer functional dependency past RelabelType

commit   : e9ef11ac8bb2acc2d2462fc17ec3291a959589e7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Oct 2017 17:23:47 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Oct 2017 17:23:47 +0200    

Click here for diff

Vars hidden within a RelabelType would not be detected as compatible  
with some functional dependency.  Repair by properly ignoring the  
RelabelType.  
  
Author: David Rowley  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAKJS1f-y-UEy=rsBXynBOgiW1fKMr_LVoYSGL9QOc36mLEC-ww@mail.gmail.com  

M src/backend/statistics/dependencies.c

Fix logical replication to fire BEFORE ROW DELETE triggers.

commit   : 360fd1a7b2fe779cc9e696b813b12f6a8e83b558    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 10:09:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 12 Oct 2017 10:09:26 -0400    

Click here for diff

Before, that would fail to happen unless a BEFORE ROW UPDATE trigger  
was also present.  
  
Noted by me while reviewing a patch from Masahiko Sawada, who also  
wrote this patch.  Reviewed by Petr Jelinek.  
  
Discussion: http://postgr.es/m/CA+TgmobAZvCxduG8y_mQKBK7nz-vhbdLvjM354KEFozpuzMN5A@mail.gmail.com  

M src/backend/executor/execReplication.c

Replace remaining uses of pq_sendint with pq_sendint{8,16,32}.

commit   : 31079a4a8e66e56e48bad94d380fa6224e9ffa0d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 21:00:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 21:00:46 -0700    

Click here for diff

pq_sendint() remains, so extension code doesn't unnecessarily break.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore_io.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/transam/parallel.c
M src/backend/commands/async.c
M src/backend/commands/copy.c
M src/backend/libpq/auth.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/proto.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/xid.c

Prevent sharing transition states between ordered-set aggregates.

commit   : 52328727bea4d9f95af9622e4624b9d1492df88e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 22:18:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 22:18:01 -0400    

Click here for diff

This ought to work, but the built-in OSAs are not capable of coping,  
because their final-functions destructively modify their transition  
state (specifically, the contained tuplesort object).  That was fine  
when those functions were written, but commit 804163bc2 moved the  
goalposts without telling orderedsetaggs.c.  
  
We should fix the built-in OSAs to support this, but it will take  
a little work, especially if we don't want to sacrifice performance  
in the normal non-shared-state case.  Given that it took a year after  
9.6 release for anyone to notice this bug, we should not prioritize  
sharable-state over nonsharable-state performance.  And a proper fix  
is likely to be more complicated than we'd want to back-patch, too.  
  
Therefore, let's just put in this stop-gap patch to prevent nodeAgg.c  
from choosing to use shared state for OSAs.  We can revert it in HEAD  
when we get a better fix.  
  
Report from Lukas Eder, diagnosis by me, patch by David Rowley.  
Back-patch to 9.6 where the problem was introduced.  
  
Discussion: https://postgr.es/m/CAB4ELO5RZhOamuT9Xsf72ozbenDLLXZKSk07FiSVsuJNZB861A@mail.gmail.com  

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

Temporary attempt at a workaround for further MSVC restrict build failures.

commit   : 36b4b91ba07843406d5a30106facb59d8275c6de    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 19:06:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 19:06:29 -0700    

Click here for diff

It appears some versions of msvc use __declspec(restrict) in stdlib.h  
and subsidiary headers. Including those after defining 'restrict' to  
'__restrict' doesn't work.  Try to get the buildfarm green to see  
whether there's further problems, by including stdlib.h just before  
said define.  

M src/include/pg_config.h.win32

Work around overly strict restrict checks by MSVC.

commit   : 060b069984a69ff0255ce318f10681c553613bef    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 17:16:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 17:16:16 -0700    

Click here for diff

Apparently MSVC requires a * before a restrict in a variable  
declaration, even if the adorned type already is a pointer, just via  
typedef.  
  
As reported by buildfarm animal woodlouse.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/pqformat.h

Improve performance of SendRowDescriptionMessage.

commit   : 4c119fbcd49ba882791c7b99a1e934b985468e9f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:49:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:49:31 -0700    

Click here for diff

There's three categories of changes leading to better performance:  
- Splitting the per-attribute part of SendRowDescriptionMessage into a  
  v2 and a v3 version allows avoiding branches for every attribute.  
- Preallocating the size of the buffer to be big enough for all  
  attributes and then using pq_write* avoids unnecessary buffer  
  size checks & resizing.  
- Reusing a persistently allocated StringInfo for all  
  SendRowDescriptionMessage() invocations avoids repeated allocations  
  & reallocations.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/printtup.c
M src/backend/tcop/postgres.c
M src/include/access/printtup.h

pg_stat_statements: Widen query IDs from 32 bits to 64 bits.

commit   : cff440d368690f94fbda1a475277e90ea2263843    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Oct 2017 19:52:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Oct 2017 19:52:46 -0400    

Click here for diff

This takes advantage of the infrastructure introduced by commit  
81c5e46c490e2426db243eada186995da5bb0ba7 to greatly reduce the  
likelihood that two different queries will end up with the same query  
ID.  It's still possible, of course, but whereas before it the chances  
of a collision reached 25% around 50,000 queries, it will now take  
more than 3 billion queries.  
  
Backward incompatibility: Because the type exposed at the SQL level is  
int8, users may now see negative query IDs in the pg_stat_statements  
view (and also, query IDs more than 4 billion, which was the old  
limit).  
  
Patch by me, reviewed by Michael Paquier and Peter Geoghegan.  
  
Discussion: http://postgr.es/m/CA+TgmobG_Kp4cBKFmsznUAaM1GWW6hhRNiZC0KjRMOOeYnz5Yw@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/executor/execParallel.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/rewrite/rewriteHandler.c
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h

Use one stringbuffer for all rows printed in printtup.c.

commit   : f2dec34e19d3969ddd616e671fe9a7b968bec812    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:26:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:26:35 -0700    

Click here for diff

This avoids newly allocating, and then possibly growing, the  
stringbuffer for every row. For wide rows this can substantially  
reduce memory allocator overhead, at the price of not immediately  
reducing memory usage after outputting an especially wide row.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/printtup.c

Add more efficient functions to pqformat API.

commit   : 1de09ad8eb1fa673ee7899d6dfbb2b49ba204818    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:01:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:01:52 -0700    

Click here for diff

There's three prongs to achieve greater efficiency here:  
  
1) Allow reusing a stringbuffer across pq_beginmessage/endmessage,  
   with the new pq_beginmessage_reuse/endmessage_reuse. This can be  
   beneficial both because it avoids allocating the initial buffer,  
   and because it's more likely to already have an correctly sized  
   buffer.  
  
2) Replacing pq_sendint() with pq_sendint$width() inline  
   functions. Previously unnecessary and unpredictable branches in  
   pq_sendint() were needed. Additionally the replacement functions  
   are implemented more efficiently.  pq_sendint is now deprecated, a  
   separate commit will convert all in-tree callers.  
  
3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient  
   space in the StringInfo's buffer, avoiding individual space checks  
   & potential individual resizing.  To allow this to be used for  
   strings, expose mbutil.c's MAX_CONVERSION_GROWTH.  
  
Followup commits will make use of these facilities.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/pqformat.c
M src/backend/utils/mb/mbutils.c
M src/include/libpq/pqformat.h
M src/include/mb/pg_wchar.h

Allow to avoid NUL-byte management for stringinfos and use in format.c.

commit   : 70c2d1be2b1e1efa8ef38a92b443fa290a9558dd    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:01:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:01:52 -0700    

Click here for diff

In a lot of the places having appendBinaryStringInfo() maintain a  
trailing NUL byte wasn't actually meaningful, e.g. when appending an  
integer which can contain 0 in one of its bytes.  
  
Removing this yields some small speedup, but more importantly will be  
more consistent when providing faster variants of pq_sendint etc.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/stringinfo.c
M src/backend/libpq/pqformat.c
M src/include/lib/stringinfo.h

Add configure infrastructure to detect support for C99's restrict.

commit   : 0b974dba2d6b5581ce422ed883209de46f313fb6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:01:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 16:01:52 -0700    

Click here for diff

Will be used in later commits improving performance for a few key  
routines where information about aliasing allows for significantly  
better code generation.  
  
This allows to use the C99 'restrict' keyword without breaking C89, or  
for that matter C++, compilers. If not supported it's defined to be  
empty.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Remove unnecessary PG_TRY overhead for CurrentResourceOwner changes.

commit   : 5fa6b0d102eb8ccd15c4963ee9841baec50df45e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 17:43:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 17:43:50 -0400    

Click here for diff

resowner/README contained advice to use a PG_TRY block to restore the  
old CurrentResourceOwner value anywhere that that variable is transiently  
changed.  That advice was only inconsistently followed, however, and  
on reflection it seems like unnecessary overhead.  We don't bother  
with such a convention for transient CurrentMemoryContext changes,  
on the grounds that any (sub)transaction abort will start out by  
resetting CurrentMemoryContext to what it wants.  But the same is  
true of CurrentResourceOwner, so there seems no need to treat it  
differently.  
  
Hence, remove PG_TRY blocks that exist only to restore CurrentResourceOwner  
before re-throwing the error.  There are a couple of places that restore  
it along with some other actions, and I left those alone; the restore is  
probably unnecessary but no noticeable gain will result from removing it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/commands/portalcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/trigger.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/resowner/README
M src/backend/utils/resowner/resowner.c

Prevent idle in transaction session timeout from sometimes being ignored.

commit   : f676616651c83b14e1d879fbfabdd3ab2dc70bbe    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 12:03:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Oct 2017 12:03:26 -0700    

Click here for diff

The previous coding in ProcessInterrupts() could lead to  
idle_in_transaction_session_timeout being ignored, when  
statement_timeout occurred earlier.  
  
The problem was that ProcessInterrupts() would return before  
processing the transaction timeout if QueryCancelPending was set while  
QueryCancelHoldoffCount != 0 - which is the case when reading new  
commands from the client. Ergo when the idle transaction timeout would  
hit.  
  
Fix that by removing the early return. Alternatively the transaction  
timeout code could have been moved up, but that early return seems  
like an issue that could hit other cases too.  
  
Author: Lukas Fittl  
Bug: #14821  
Discussion:  
    https://www.postgresql.org/message-id/20170921010956.17345.61461%40wrigleys.postgresql.org  
    https://www.postgresql.org/message-id/CAP53PkxQnv3OWJpyNPGJYT62uY=n1=2CF_Lpc6gVOFnc0-gazw@mail.gmail.com  
Backpatch: 9.6-, where idle_in_transaction_session_timeout was introduced.  

M src/backend/tcop/postgres.c

Doc: fix missing explanation of default object privileges.

commit   : 28605968322b70a7efe1cc89595d1cfc557d80b9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 16:56:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 16:56:23 -0400    

Click here for diff

The GRANT reference page, which lists the default privileges for new  
objects, failed to mention that USAGE is granted by default for data  
types and domains.  As a lesser sin, it also did not specify anything  
about the initial privileges for sequences, FDWs, foreign servers,  
or large objects.  Fix that, and add a comment to acldefault() in the  
probably vain hope of getting people to maintain this list in future.  
  
Noted by Laurenz Albe, though I editorialized on the wording a bit.  
Back-patch to all supported branches, since they all have this behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/grant.sgml
M src/backend/utils/adt/acl.c

Fix mistakes in comments.

commit   : 20d210bf5bb0d5ae37c727d364cfd810c367704a    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Oct 2017 15:55:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Oct 2017 15:55:10 -0400    

Click here for diff

Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoBsfYsMHD6_SL9iN3n_Foaa+oPbL5jG55DxU1ChaujqwQ@mail.gmail.com  

M src/backend/executor/execReplication.c

Fix low-probability loss of NOTIFY messages due to XID wraparound.

commit   : 118e99c3d71efbea85341697a447d84bbfb54f18    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 14:28:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 14:28:33 -0400    

Click here for diff

Up to now async.c has used TransactionIdIsInProgress() to detect whether  
a notify message's source transaction is still running.  However, that  
function has a quick-exit path that reports that XIDs before RecentXmin  
are no longer running.  If a listening backend is doing nothing but  
listening, and not running any queries, there is nothing that will advance  
its value of RecentXmin.  Once 2 billion transactions elapse, the  
RecentXmin check causes active transactions to be reported as not running.  
If they aren't committed yet according to CLOG, async.c decides they  
aborted and discards their messages.  The timing for that is a bit tight  
but it can happen when multiple backends are sending notifies concurrently.  
The net symptom therefore is that a sufficiently-long-surviving  
listen-only backend starts to miss some fraction of NOTIFY traffic,  
but only under heavy load.  
  
The only function that updates RecentXmin is GetSnapshotData().  
A brute-force fix would therefore be to take a snapshot before  
processing incoming notify messages.  But that would add cycles,  
as well as contention for the ProcArrayLock.  We can be smarter:  
having taken the snapshot, let's use that to check for running  
XIDs, and not call TransactionIdIsInProgress() at all.  In this  
way we reduce the number of ProcArrayLock acquisitions from one  
per message to one per notify interrupt; that's the same under  
light load but should be a benefit under heavy load.  Light testing  
says that this change is a wash performance-wise for normal loads.  
  
I looked around for other callers of TransactionIdIsInProgress()  
that might be at similar risk, and didn't find any; all of them  
are inside transactions that presumably have already taken a  
snapshot.  
  
Problem report and diagnosis by Marko Tiikkaja, patch by me.  
Back-patch to all supported branches, since it's been like this  
since 9.0.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/async.c
M src/backend/utils/time/tqual.c
M src/include/utils/tqual.h

Add port/strnlen support to libpq and ecpg Makefiles.

commit   : 46912d9b1504cfaede1b22811039028a75f76ab8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 11:27:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Oct 2017 11:27:57 -0400    

Click here for diff

In the wake of fffd651e8, any makefile that pulls in snprintf.c  
from src/port/ needs to be prepared to pull in strnlen.c as well.  
Per buildfarm.  

M src/interfaces/ecpg/compatlib/.gitignore
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/.gitignore
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile

Fix whitespace

commit   : e9e0f78bdeaee6e1e24544fd564cf0907f6a2134    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Oct 2017 09:15:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Oct 2017 09:15:20 -0400    

Click here for diff

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

Regenerate configure script.

commit   : f4128ab466aac639387a5dade6647621c87bbb3f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Oct 2017 19:14:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Oct 2017 19:14:06 -0400    

Click here for diff

Not sure how fffd651e83ccbd6191a76be6ec7c6b1b27888fde ended up  
probing for "strnlenfrak" rather than "strnlen".  
My autoconf doesn't do that ...  

M configure

Rewrite strnlen replacement implementation from 8a241792f96.

commit   : fffd651e83ccbd6191a76be6ec7c6b1b27888fde    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 10 Oct 2017 14:42:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 10 Oct 2017 14:42:16 -0700    

Click here for diff

The previous placement of the fallback implementation in libpgcommon  
was problematic, because libpqport functions need strnlen  
functionality.  
  
Move replacement into libpgport. Provide strnlen() under its posix  
name, instead of pg_strnlen(). Fix stupid configure bug, executing the  
test only when compiled with threading support.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/utils/mmgr/mcxt.c
M src/common/string.c
M src/include/common/string.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
M src/port/snprintf.c
A src/port/strnlen.c

Add missing clean step to src/test/modules/brin/Makefile.

commit   : fa5e119dc71ada8d023deadcb36dbfae328f8902    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Oct 2017 12:51:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Oct 2017 12:51:09 -0400    

Click here for diff

I noticed the tmp_check subdirectory wasn't getting cleaned up  
after a check-world run.  Apparently pgxs.mk will only do this  
for you if you've defined REGRESS.  The only other src/test/modules  
Makefile that does not set that is snapshot_too_old, and it  
does it like this.  

M src/test/modules/brin/Makefile

Use lower-case SGML attribute values

commit   : 44b3230e821e7a0cc4e9438d1c27305d533edacc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Oct 2017 22:00:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Oct 2017 22:00:57 -0400    

Click here for diff

for DocBook XML compatibility  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_event_trigger.sgml
M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_rule.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_server.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/alter_trigger.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/alter_user_mapping.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/close.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/commit_prepared.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_foreign_data_wrapper.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_type.sgml
M doc/src/sgml/ref/create_user.sgml
M doc/src/sgml/ref/create_user_mapping.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/do.sgml
M doc/src/sgml/ref/drop_database.sgml
M doc/src/sgml/ref/drop_domain.sgml
M doc/src/sgml/ref/drop_event_trigger.sgml
M doc/src/sgml/ref/drop_extension.sgml
M doc/src/sgml/ref/drop_foreign_table.sgml
M doc/src/sgml/ref/drop_group.sgml
M doc/src/sgml/ref/drop_index.sgml
M doc/src/sgml/ref/drop_language.sgml
M doc/src/sgml/ref/drop_materialized_view.sgml
M doc/src/sgml/ref/drop_opclass.sgml
M doc/src/sgml/ref/drop_operator.sgml
M doc/src/sgml/ref/drop_opfamily.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_publication.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/drop_rule.sgml
M doc/src/sgml/ref/drop_schema.sgml
M doc/src/sgml/ref/drop_sequence.sgml
M doc/src/sgml/ref/drop_statistics.sgml
M doc/src/sgml/ref/drop_table.sgml
M doc/src/sgml/ref/drop_tablespace.sgml
M doc/src/sgml/ref/drop_trigger.sgml
M doc/src/sgml/ref/drop_tsconfig.sgml
M doc/src/sgml/ref/drop_tsdictionary.sgml
M doc/src/sgml/ref/drop_tsparser.sgml
M doc/src/sgml/ref/drop_tstemplate.sgml
M doc/src/sgml/ref/drop_type.sgml
M doc/src/sgml/ref/drop_user.sgml
M doc/src/sgml/ref/drop_view.sgml
M doc/src/sgml/ref/execute.sgml
M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/import_foreign_schema.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/listen.sgml
M doc/src/sgml/ref/load.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/move.sgml
M doc/src/sgml/ref/notify.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/prepare_transaction.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reset.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/rollback_prepared.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/ref/select_into.sgml
M doc/src/sgml/ref/set.sgml
M doc/src/sgml/ref/show.sgml
M doc/src/sgml/ref/truncate.sgml
M doc/src/sgml/ref/unlisten.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/values.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/unaccent.sgml

Fix pnstrdup() to not memcpy() the maximum allowed length.

commit   : 82c117cb90e6b6b79f06d61eb1ddf06e94e75b60    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 9 Oct 2017 15:20:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 9 Oct 2017 15:20:42 -0700    

Click here for diff

The previous behaviour was dangerous if the length passed wasn't the  
size of the underlying buffer, but the maximum size of the underlying  
buffer.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Add pg_strnlen() a portable implementation of strlen.

commit   : 8a241792f968ed5be6cf4d41e32c0d264f6c0c65    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 9 Oct 2017 15:20:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 9 Oct 2017 15:20:42 -0700    

Click here for diff

As the OS version is likely going to be more optimized, fall back to  
it if available, as detected by configure.  

M configure
M configure.in
M src/common/string.c
M src/include/common/string.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/port/snprintf.c

Remove unused documentation file

commit   : 71c75ddfbb277362bf62dc5b1645c3903e16bc34    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Oct 2017 21:51:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Oct 2017 21:51:58 -0400    

Click here for diff

D doc/src/sgml/contacts.sgml
M doc/src/sgml/filelist.sgml

Reduce memory usage of targetlist SRFs.

commit   : 84ad4b036d975ad1be0f52251bac3a06463c9811    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 8 Oct 2017 15:08:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 8 Oct 2017 15:08:25 -0700    

Click here for diff

Previously nodeProjectSet only released memory once per input tuple,  
rather than once per returned tuple. If the computation of an  
individual returned tuple requires a lot of memory, that can lead to  
problems.  
  
Instead change things so that the expression context can be reset once  
per output tuple, which requires a new memory context to store SRF  
arguments in.  
  
This is a longstanding issue, but was hard to fix before 9.6, due to  
the way tSRFs where evaluated. But it's fairly easy to fix now. We  
could backpatch this into 10, but given there've been fewc omplaints  
that doesn't seem worth the risk so far.  
  
Reported-By: Lucas Fairchild  
Author: Andres Freund, per discussion with Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execSRF.c
M src/backend/executor/nodeProjectSet.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Increase distance between flush requests during bulk file copies.

commit   : 643c27e36ff38f40d256c2a05b51a14ae2b26077    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Oct 2017 15:25:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Oct 2017 15:25:26 -0400    

Click here for diff

copy_file() reads and writes data 64KB at a time (with default BLCKSZ),  
and historically has issued a pg_flush_data request after each write.  
This turns out to interact really badly with macOS's new APFS file  
system: a large file copy takes over 100X longer than it ought to on  
APFS, as reported by Brent Dearth.  While that's arguably a macOS bug,  
it's not clear whether Apple will do anything about it in the near  
future, and in any case experimentation suggests that issuing flushes  
a bit less often can be helpful on other platforms too.  
  
Hence, rearrange the logic in copy_file() so that flush requests are  
issued once per N writes rather than every time through the loop.  
I set the FLUSH_DISTANCE to 32MB on macOS (any less than that still  
results in a noticeable speed degradation on APFS), but 1MB elsewhere.  
In limited testing on Linux and FreeBSD, this seems slightly faster  
than the previous code, and certainly no worse.  It helps noticeably  
on macOS even with the older HFS filesystem.  
  
A simpler change would have been to just increase the size of the  
copy buffer without changing the loop logic, but that seems likely  
to trash the processor cache without really helping much.  
  
Back-patch to 9.6 where we introduced msync() as an implementation  
option for pg_flush_data().  The problem seems specific to APFS's  
mmap/msync support, so I don't think we need to go further back.  
  
Discussion: https://postgr.es/m/CADkxhTNv-j2jw2g8H57deMeAbfRgYBoLmVuXkC=YCFBXRuCOww@mail.gmail.com  

M src/backend/storage/file/copydir.c

Reduce "X = X" to "X IS NOT NULL", if it's easy to do so.

commit   : 8ec5429e2f422f4d570d4909507db0d4ca83bbac    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Oct 2017 12:23:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Oct 2017 12:23:32 -0400    

Click here for diff

If the operator is a strict btree equality operator, and X isn't volatile,  
then the clause must yield true for any non-null value of X, or null if X  
is null.  At top level of a WHERE clause, we can ignore the distinction  
between false and null results, so it's valid to simplify the clause to  
"X IS NOT NULL".  This is a useful improvement mainly because we'll get  
a far better selectivity estimate in most cases.  
  
Because such cases seldom arise in well-written queries, it is unappetizing  
to expend a lot of planner cycles looking for them ... but it turns out  
that there's a place we can shoehorn this in practically for free, because  
equivclass.c already has to detect and reject candidate equivalences of the  
form X = X.  That doesn't catch every place that it would be valid to  
simplify to X IS NOT NULL, but it catches the typical case.  Working harder  
doesn't seem justified.  
  
Patch by me, reviewed by Petr Jelinek  
  
Discussion: https://postgr.es/m/CAMjNa7cC4X9YR-vAJS-jSYCajhRDvJQnN7m2sLH1wLh-_Z2bsw@mail.gmail.com  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/initsplan.c
M src/include/optimizer/paths.h
M src/test/regress/expected/equivclass.out
M src/test/regress/sql/equivclass.sql

Improve pg_regress's error reporting for schedule-file problems.

commit   : b11f0d36b224a9673863b4e592f40f179dba3016    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2017 18:04:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2017 18:04:25 -0400    

Click here for diff

The previous coding here trashed the line buffer as it scanned it,  
making it impossible to print the source line in subsequent error  
messages.  With a few save/restore/strdup pushups we can improve  
that situation.  
  
In passing, move the free'ing of the various strings that are collected  
while processing one set of tests down to the bottom of the loop.  
That's simpler, less surprising, and should make valgrind less unhappy  
about the strings that were previously leaked by the last iteration.  

M src/test/regress/pg_regress.c

Enforce our convention about max number of parallel regression tests.

commit   : ef73a8162a5fe9c4b2f895bf9fb660f1aabc796c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2017 17:20:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2017 17:20:09 -0400    

Click here for diff

We have a very old rule that parallel_schedule should have no more  
than twenty tests in any one parallel group, so as to provide a  
bound on the number of concurrently running processes needed to  
pass the tests.  But people keep forgetting the rule, so let's add  
a few lines of code to check it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/tools/msvc/vcregress.pl

Clean up sloppy maintenance of regression test schedule files.

commit   : 1fdab4d5aa47d8a2bb29ccb1122b0158f6db221f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2017 13:19:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Oct 2017 13:19:13 -0400    

Click here for diff

The partition_join test was added to a parallel group that was already  
at the maximum of 20 concurrent tests.  The hash_func test wasn't  
added to serial_schedule at all.  The identity and partition_join tests  
were added to serial_schedule with the aid of a dartboard, rather than  
maintaining consistency with parallel_schedule.  
  
There are proposals afoot to make these sorts of errors harder to make,  
but in the meantime let's fix the ones already in place.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule

Fix crash when logical decoding is invoked from a PL function.

commit   : 1518d07842dcb412ea6b8bb8172c40da7499b174    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 19:18:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 19:18:58 -0400    

Click here for diff

The logical decoding functions do BeginInternalSubTransaction and  
RollbackAndReleaseCurrentSubTransaction to clean up after themselves.  
It turns out that AtEOSubXact_SPI has an unrecognized assumption that  
we always need to cancel the active SPI operation in the SPI context  
that surrounds the subtransaction (if there is one).  That's true  
when the RollbackAndReleaseCurrentSubTransaction call is coming from  
the SPI-using function itself, but not when it's happening inside  
some unrelated function invoked by a SPI query.  In practice the  
affected callers are the various PLs.  
  
To fix, record the current subtransaction ID when we begin a SPI  
operation, and clean up only if that ID is the subtransaction being  
canceled.  
  
Also, remove AtEOSubXact_SPI's assertion that it must have cleaned  
up the surrounding SPI context's active tuptable.  That's proven  
wrong by the same test case.  
  
Also clarify (or, if you prefer, reinterpret) the calling conventions  
for _SPI_begin_call and _SPI_end_call.  The memory context cleanup  
in the latter means that these have always had the flavor of a matched  
resource-management pair, but they weren't documented that way before.  
  
Per report from Ben Chobot.  
  
Back-patch to 9.4 where logical decoding came in.  In principle,  
the SPI changes should go all the way back, since the problem dates  
back to commit 7ec1c5a86.  But given the lack of field complaints  
it seems few people are using internal subtransactions in this way.  
So I don't feel a need to take any risks in 9.2/9.3.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/decoding_into_rel.out
M contrib/test_decoding/sql/decoding_into_rel.sql
M src/backend/executor/spi.c
M src/include/executor/spi_priv.h

Copy information from the relcache instead of pointing to it.

commit   : 45866c75507f0757de0da6e90c694a0dbe67d727    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Oct 2017 15:27:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Oct 2017 15:27:11 -0400    

Click here for diff

We have the relations continuously locked, but not open, so relcache  
pointers are not guaranteed to be stable.  Per buildfarm member  
prion.  
  
Ashutosh Bapat.  I fixed a typo.  
  
Discussion: http://postgr.es/m/CAFjFpRcRBqoKLZSNmRsjKr81uEP=ennvqSQaXVCCBTXvJ2rW+Q@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/optimizer/util/plancat.c
M src/include/catalog/partition.h

Fix intra-query memory leakage in nodeProjectSet.c.

commit   : a1c2c430d33e0945da234b025b78bd265c8bdfb5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 14:28:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 14:28:42 -0400    

Click here for diff

Both ExecMakeFunctionResultSet() and evaluation of simple expressions  
need to be done in the per-tuple memory context, not per-query, else  
we leak data until end of query.  This is a consideration that was  
missed while refactoring code in the ProjectSet patch (note that in  
pre-v10, ExecMakeFunctionResult is called in the per-tuple context).  
  
Per bug #14843 from Ben M.  Diagnosed independently by Andres and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execSRF.c
M src/backend/executor/nodeProjectSet.c

Fix access-off-end-of-array in clog.c.

commit   : 6b87416c9a4dd305b76e619ecac36e2b968462f8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 12:20:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 12:20:12 -0400    

Click here for diff

Sloppy loop coding in set_status_by_pages() resulted in fetching one array  
element more than it should from the subxids[] array.  The odds of this  
resulting in SIGSEGV are pretty small, but we've certainly seen that happen  
with similar mistakes elsewhere.  While at it, we can get rid of an extra  
TransactionIdToPage() calculation per loop.  
  
Per report from David Binderman.  Back-patch to all supported branches,  
since this code is quite old.  
  
Discussion: https://postgr.es/m/HE1PR0802MB2331CBA919CBFFF0C465EB429C710@HE1PR0802MB2331.eurprd08.prod.outlook.com  

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

Support coverage on vpath builds

commit   : c3d9a66024a93e6d0380bdd1b18cb03a67216b72    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

A few paths needed to be tweaked so everything looks into the  
appropriate directories.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.global.in

Run coverage commands quietly

commit   : 52e1b1b0425553250db35101f44090898322fb6f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

They are very chatty by default, but the output doesn't seem all that  
useful for normal operation.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.global.in

Remove coverage details view

commit   : c01123630db18561039d4eb17f9502bed0e9d109    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

This is only useful if we name the different tests, which we don't do at  
the moment.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.global.in

#ifdef out some dead code in psql/mainloop.c.

commit   : 3620569fecc6c2edb1cccfbba39b86c4e7d2faae    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 11:35:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Oct 2017 11:35:49 -0400    

Click here for diff

This pg_send_history() call is unreachable, since the block it's in  
is currently only entered in !cur_cmd_interactive mode.  But rather  
than just delete it, make it #ifdef NOT_USED, in hopes that we'll  
remember to enable it if we ever change that decision.  
  
Per report from David Binderman.  Since this is basically cosmetic,  
I see no great need to back-patch.  
  
Discussion: https://postgr.es/m/HE1PR0802MB233122B61F00A15E035C83BE9C710@HE1PR0802MB2331.eurprd08.prod.outlook.com  

M src/bin/psql/mainloop.c

Fix traversal of half-frozen update chains

commit   : a5736bf754c82d8b86674e199e232096c679201d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Oct 2017 17:14:42 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Oct 2017 17:14:42 +0200    

Click here for diff

When some tuple versions in an update chain are frozen due to them being  
older than freeze_min_age, the xmax/xmin trail can become broken.  This  
breaks HOT (and probably other things).  A subsequent VACUUM can break  
things in more serious ways, such as leaving orphan heap-only tuples  
whose root HOT redirect items were removed.  This can be seen because  
index creation (or REINDEX) complain like  
  ERROR:  XX000: failed to find parent tuple for heap-only tuple at (0,7) in table "t"  
  
Because of relfrozenxid contraints, we cannot avoid the freezing of the  
early tuples, so we must cope with the results: whenever we see an Xmin  
of FrozenTransactionId, consider it a match for whatever the previous  
Xmax value was.  
  
This problem seems to have appeared in 9.3 with multixact changes,  
though strictly speaking it seems unrelated.  
  
Since 9.4 we have commit 37484ad2a "Change the way we mark tuples as  
frozen", so the fix is simple: just compare the raw Xmin (still stored  
in the tuple header, since freezing merely set an infomask bit) to the  
Xmax.  But in 9.3 we rewrite the Xmin value to FrozenTransactionId, so  
the original value is lost and we have nothing to compare the Xmax with.  
To cope with that case we need to compare the Xmin with FrozenXid,  
assume it's a match, and hope for the best.  Sadly, since you can  
pg_upgrade a 9.3 instance containing half-frozen pages to newer  
releases, we need to keep the old check in newer versions too, which  
seems a bit brittle; I hope we can somehow get rid of that.  
  
I didn't optimize the new function for performance.  The new coding is  
probably a bit slower than before, since there is a function call rather  
than a straight comparison, but I'd rather have it work correctly than  
be fast but wrong.  
  
This is a followup after 20b655224249 fixed a few related problems.  
Apparently, in 9.6 and up there are more ways to get into trouble, but  
in 9.3 - 9.5 I cannot reproduce a problem anymore with this patch, so  
there must be a separate bug.  
  
Reported-by: Peter Geoghegan  
Diagnosed-by: Peter Geoghegan, Michael Paquier, Daniel Wood,  
	Yi Wen Wong, Ɓlvaro  
Discussion: https://postgr.es/m/CAH2-Wznm4rCrhFAiwKPWTpEw2bXDtgROZK7jWWGucXeH3D1fmA@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/executor/execMain.c
M src/include/access/heapam.h

Basic partition-wise join functionality.

commit   : f49842d1ee31b976c681322f76025d7732e860f3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Oct 2017 11:11:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Oct 2017 11:11:10 -0400    

Click here for diff

Instead of joining two partitioned tables in their entirety we can, if  
it is an equi-join on the partition keys, join the matching partitions  
individually.  This involves teaching the planner about "other join"  
rels, which are related to regular join rels in the same way that  
other member rels are related to baserels.  This can use significantly  
more CPU time and memory than regular join planning, because there may  
now be a set of "other" rels not only for every base relation but also  
for every join relation.  In most practical cases, this probably  
shouldn't be a problem, because (1) it's probably unusual to join many  
tables each with many partitions using the partition keys for all  
joins and (2) if you do that scenario then you probably have a big  
enough machine to handle the increased memory cost of planning and (3)  
the resulting plan is highly likely to be better, so what you spend in  
planning you'll make up on the execution side.  All the same, for now,  
turn this feature off by default.  
  
Currently, we can only perform joins between two tables whose  
partitioning schemes are absolutely identical.  It would be nice to  
cope with other scenarios, such as extra partitions on one side or the  
other with no match on the other side, but that will have to wait for  
a future patch.  
  
Ashutosh Bapat, reviewed and tested by Rajkumar Raghuwanshi, Amit  
Langote, Rafia Sabih, Thomas Munro, Dilip Kumar, Antonin Houska, Amit  
Khandekar, and by me.  A few final adjustments by me.  
  
Discussion: http://postgr.es/m/CAFjFpRfQ8GrQvzp3jA2wnLqrHmaXna-urjm_UY9BqXj=EaDTSA@mail.gmail.com  
Discussion: http://postgr.es/m/CAFjFpRcitjfrULr5jfuKWRPsGUX0LQ0k8-yG0Qw2+1LBGNpMdw@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/README
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/foreign/fdwapi.h
M src/include/nodes/extensible.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
A src/test/regress/expected/partition_join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/partition_join.sql

Fix typo in README.

commit   : fe9ba28ee852bb968bc8948d172c6bc0c70c50df    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Oct 2017 15:05:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Oct 2017 15:05:49 -0400    

Click here for diff

s/BeginInternalSubtransaction/BeginInternalSubTransaction/  

M src/backend/access/transam/README

On CREATE TABLE, consider skipping validation of subpartitions.

commit   : 6476b26115f3ef25a9cd87880e0ac5ec5f7a05f6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 13:21:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 13:21:50 -0400    

Click here for diff

This is just like commit 14f67a8ee282ebc0de78e773fbd597f460ab4a54, but  
for CREATE PARTITION rather than ATTACH PARTITION.  
  
Jeevan Ladhe, with test case changes by me.  
  
Discussion: http://postgr.es/m/CAOgcT0MWwG8WBw8frFMtRYHAgDD=tpt6U7WcsO_L2k0KYpm4Jg@mail.gmail.com  

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

On attach, consider skipping validation of subpartitions individually.

commit   : 14f67a8ee282ebc0de78e773fbd597f460ab4a54    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 13:06:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 13:06:46 -0400    

Click here for diff

If the table attached as a partition is itself partitioned, individual  
partitions might have constraints strong enough to skip scanning the  
table even if the table actually attached does not.  This is pretty  
cheap to check, and possibly a big win if it works out.  
  
Amit Langote, with test case changes by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Improve error message when skipping scan of default partition.

commit   : c31e9d4bafd80da52408af5f87fe874c9ca0c952    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 12:19:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 12:19:40 -0400    

Click here for diff

It seems like a good idea to clearly distinguish between skipping the  
scan of the new partition itself and skipping the scan of the default  
partition.  
  
Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

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

Allow DML commands that create tables to use parallel query.

commit   : e9baa5e9fa147e00a2466ab2c40eb99c8a700824    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 11:34:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 11:34:38 -0400    

Click here for diff

Haribabu Kommi, reviewed by Dilip Kumar and Rafia Sabih.  Various  
cosmetic changes by me to explain why this appears to be safe but  
allowing inserts in parallel mode in general wouldn't be.  Also, I  
removed the REFRESH MATERIALIZED VIEW case from Haribabu's patch,  
since I'm not convinced that case is OK, and hacked on the  
documentation somewhat.  
  
Discussion: http://postgr.es/m/CAJrrPGdo5bak6qnPWe8Kpi8g_jfQEs-G4SYmG9y+OFaw2-dPvA@mail.gmail.com  

M doc/src/sgml/parallel.sgml
M src/backend/access/heap/heapam.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/optimizer/plan/planner.c
A src/test/regress/expected/write_parallel.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/write_parallel.sql

Improve comments in vacuum_rel() and analyze_rel().

commit   : 4d85c2900b113e331925baf308cc7fc75ac4530b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Oct 2017 10:47:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Oct 2017 10:47:47 -0400    

Click here for diff

Remove obsolete references to get_rel_oids().  Avoid listing specific  
relkinds in the comments, since we seem unable to keep such things  
in sync with the code, and it's not all that helpful anyhow.  
  
Noted by Michael Paquier, though I rewrote the comments a bit more.  
  
Discussion: https://postgr.es/m/CAB7nPqTWiN9zwKTaOrsnKiGDChqRt7C1+CiiDk4N4OMn92rs6A@mail.gmail.com  

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

Fix typo.

commit   : 4b2ba1fe0222b7820a2f4cd52b133baeb91c5a93    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 08:45:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 08:45:24 -0400    

Click here for diff

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

M src/backend/catalog/partition.c

Fix more user-visible elog() calls.

commit   : c097b271e8a14eac5e6189139deca66796b16a59    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 07:58:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Oct 2017 07:58:02 -0400    

Click here for diff

Michael Paquier discovered that this could be triggered via SQL;  
give a nicer message instead.  
  
Patch by Michael Paquier, reviewed by Masahiko Sawada.  
  
Discussion: http://postgr.es/m/CAB7nPqQtPg+LKKtzdKN26judHcvPZ0s1gNigzOT4j8CYuuuBYg@mail.gmail.com  

M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/sql/replorigin.sql
M src/backend/replication/logical/origin.c

Document and use SPI_result_code_string()

commit   : 036166f26e00ab3286ef29a6519525d6291fdfd7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:16:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:16:50 -0400    

Click here for diff

A lot of semi-internal code just prints out numeric SPI error codes,  
which is not very helpful.  We already have an API function to convert  
the codes to a string, so let's make more use of that.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M contrib/spi/refint.c
M contrib/spi/timetravel.c
M doc/src/sgml/spi.sgml
M src/backend/utils/adt/ri_triggers.c
M src/test/regress/regress.c

Move SPI error reporting out of ri_ReportViolation()

commit   : 582bbcf37fb45ea2e6a851bf9a3c7d7364c7ad32    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:16:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:16:50 -0400    

Click here for diff

These are two completely unrelated code paths, so it doesn't make sense  
to pack them into one function.  
  
Add attribute noreturn to ri_ReportViolation().  
  
Reviewed-by: Michael Paquier <[email protected]>  

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

Msvc doesn't know UINT16_MAX, replace with PG_UINT16_MAX.

commit   : 9eafa2b5b043b84fb9846bd7a57d15ed1ee220c1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 10:01:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 10:01:02 -0700    

Click here for diff

UINT16_MAX usage is originating from commit 212e6f34d55c.  
  
Per buildfarm animal currawong.  

M src/include/utils/fmgrtab.h

Attempt to adapt windows build for 212e6f34d55c.

commit   : 15334ad19a776f76cbb725e4e9162a7bce1bd4d0    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 09:32:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 09:32:02 -0700    

Click here for diff

Per buildfarm animal baiji.  

M src/tools/msvc/Solution.pm

Replace binary search in fmgr_isbuiltin with a lookup array.

commit   : 212e6f34d55c910505f87438d878698223d9a617    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 00:22:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 00:22:38 -0700    

Click here for diff

Turns out we have enough functions that the binary search is quite  
noticeable in profiles.  
  
Thus have Gen_fmgrtab.pl build a new mapping from a builtin function's  
oid to an index in the existing fmgr_builtins array. That keeps the  
additional memory usage at a reasonable amount.  
  
Author: Andres Freund, with input from Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/fmgr/fmgr.c
M src/include/utils/fmgrtab.h

Move genbki.pl's find_defined_symbol to Catalog.pm.

commit   : 18f791ab2b6a01a632653d394e046f3daf193ff6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 00:11:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Oct 2017 00:11:36 -0700    

Click here for diff

Will be used in Gen_fmgrtab.pl in a followup commit.  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl

Adjust git_changelog for new-style release tags.

commit   : 4736d74479745f0f5a0129fba4628a742034b90e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Oct 2017 00:45:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Oct 2017 00:45:15 -0400    

Click here for diff

It wasn't on board with REL_n_n format.  

M src/tools/git_changelog

Allow multiple tables to be specified in one VACUUM or ANALYZE command.

commit   : 11d8d72c27a64ea4e30adce11cf6c4f3dd3e60db    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2017 18:53:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2017 18:53:44 -0400    

Click here for diff

Not much to say about this; does what it says on the tin.  
  
However, formerly, if there was a column list then the ANALYZE action was  
implied; now it must be specified, or you get an error.  This is because  
it would otherwise be a bit unclear what the user meant if some tables  
have column lists and some don't.  
  
Nathan Bossart, reviewed by Michael Paquier and Masahiko Sawada, with some  
editorialization by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Fix race condition with unprotected use of a latch pointer variable.

commit   : 45f9d08684d954b0e514b69f270e763d2785dd53    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2017 14:00:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Oct 2017 14:00:56 -0400    

Click here for diff

Commit 597a87ccc introduced a latch pointer variable to replace use  
of a long-lived shared latch in the shared WalRcvData structure.  
This was not well thought out, because there are now hazards of the  
pointer variable changing while it's being inspected by another  
process.  This could obviously lead to a core dump in code like  
  
	if (WalRcv->latch)  
		SetLatch(WalRcv->latch);  
  
and there's a more remote risk of a torn read, if we have any  
platforms where reading/writing a pointer is not atomic.  
  
An actual problem would occur only if the walreceiver process  
exits (gracefully) while the startup process is trying to  
signal it, but that seems well within the realm of possibility.  
  
To fix, treat the pointer variable (not the referenced latch)  
as being protected by the WalRcv->mutex spinlock.  There  
remains a race condition that we could apply SetLatch to a  
process latch that no longer belongs to the walreceiver, but  
I believe that's harmless: at worst it'd cause an extra wakeup  
of the next process to use that PGPROC structure.  
  
Back-patch to v10 where the faulty code was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/include/replication/walreceiver.h

Fix coding rules violations in walreceiver.c

commit   : 89e434b59caffeeeb7478653c74ad5d7a50d2e96    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Oct 2017 14:58:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Oct 2017 14:58:25 +0200    

Click here for diff

1. Since commit b1a9bad9e744 we had pstrdup() inside a  
spinlock-protected critical section; reported by Andreas Seltenreich.  
Turn those into strlcpy() to stack-allocated variables instead.  
Backpatch to 9.6.  
  
2. Since commit 9ed551e0a4fd we had a pfree() uselessly inside a  
spinlock-protected critical section.  Tom Lane noticed in code review.  
Move down.  Backpatch to 9.6.  
  
3. Since commit 64233902d22b we had GetCurrentTimestamp() (a kernel  
call) inside a spinlock-protected critical section.  Tom Lane noticed in  
code review.  Move it up.  Backpatch to 9.2.  
  
4. Since commit 1bb2558046cc we did elog(PANIC) while holding spinlock.  
Tom Lane noticed in code review.  Release spinlock before dying.  
Backpatch to 9.2.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walreceiver.c

Expand collation documentation

commit   : f41bd4cb90eb1d93631a346bf71d17dfc4beee50    
  
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

Grammar typo in security warning about md5

commit   : 0703c197adb0bf5fa6c99e8af74b13585bdc9056    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 2 Oct 2017 10:27:46 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 2 Oct 2017 10:27:46 +0100    

Click here for diff

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

Yet another pg_bswap typo in a windows only file.

commit   : 0c8b3ee94478ca07c86c09d2399a2ce73c2b922b    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 20:05:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 20:05:27 -0700    

Click here for diff

Per buildfarm animal frogmouth.  
  
Brown-Paper-Bagged-By: Andres Freund  

M src/port/getaddrinfo.c

Correct include file name in inet_aton fallback.

commit   : 859759b62f2d2f2f2805e2aa9ebdb167a1b9655c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 17:41:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 17:41:00 -0700    

Click here for diff

Per buildfarm animal frogmouth.  
  
Author: Andres Freund  

M src/port/inet_aton.c

Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h.

commit   : 0ba99c84e8c7138143059b281063d4cca5a2bfea    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:36:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:36:14 -0700    

Click here for diff

All postgres internal usages are replaced, it's just libpq example  
usages that haven't been converted. External users of libpq can't  
generally rely on including postgres internal headers.  
  
Note that this includes replacing open-coded byte swapping of 64bit  
integers (using two 32 bit swaps) with a single 64bit swap.  
  
Where it looked applicable, I have removed netinet/in.h and  
arpa/inet.h usage, which previously provided the relevant  
functionality. It's perfectly possible that I missed other reasons for  
including those, the buildfarm will tell.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/crypt-des.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/commands/copy.c
M src/backend/libpq/auth.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/fastpath.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_rewind/libpq_fetch.c
M src/common/scram-common.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/port/getaddrinfo.c
M src/port/inet_aton.c

Remove redundant stdint.h include.

commit   : 1f2830f9df9f0196ba541c1e253463afe657cb67    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:24:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:24:14 -0700    

Click here for diff

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

M src/include/port/pg_bswap.h

Try to make crash restart test work on windows.

commit   : 784905795f8aadc09efe2fdae195279d17250f00    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:21:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:21:45 -0700    

Click here for diff

Author: Andres Freund  
Tested-By: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

Allow pg_ctl kill to send SIGKILL.

commit   : 2e83db3ad2da9b073af9ae12916f0b71cf698e1e    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:17:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Oct 2017 15:17:10 -0700    

Click here for diff

Previously that was disallowed out of an abundance of  
caution. Providing KILL support however is helpful to make the  
013_crash_restart.pl test portable, and there's no actual issue with  
allowing it.  SIGABRT, which has similar consequences except it also  
dumps core, was already allowed.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

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

commit   : 5a632a213d43c30940de3328286172c52730a01d    
  
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   : 4a1c0f3dde765c65e0ccb712c899df16986d09ad    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2017 12:43:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Oct 2017 12:43:46 -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   : 655c938fb0aacde297d4c53daf97ff82a3b90fad    
  
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   : 396ef1561878a5d42ea9191f60098b7fbbec6e41    
  
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 pg_dump to assign domain array type OIDs during pg_upgrade.

commit   : 2632bcce5e767a2b5901bbef54ae52df061eee72    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Sep 2017 17:05:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Sep 2017 17:05:07 -0400    

Click here for diff

During a binary upgrade, all type OIDs are supposed to be assigned by  
pg_dump based on their values in the old cluster.  But now that domains  
have arrays, there's nothing to base the arrays' type OIDs on, if we're  
upgrading from a pre-v11 cluster.  Make pg_dump search for an unused type  
OID to use for this purpose.  Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Support arrays over domains.

commit   : c12d570fa147d0ec273df53de3a2802925d551ba    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Sep 2017 13:40:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Sep 2017 13:40:56 -0400    

Click here for diff

Allowing arrays with a domain type as their element type was left un-done  
in the original domain patch, but not for any very good reason.  This  
omission leads to such surprising results as array_agg() not working on  
a domain column, because the parser can't identify a suitable output type  
for the polymorphic aggregate.  
  
In order to fix this, first clean up the APIs of coerce_to_domain() and  
some internal functions in parse_coerce.c so that we consistently pass  
around a CoercionContext along with CoercionForm.  Previously, we sometimes  
passed an "isExplicit" boolean flag instead, which is strictly less  
information; and coerce_to_domain() didn't even get that, but instead had  
to reverse-engineer isExplicit from CoercionForm.  That's contrary to the  
documentation in primnodes.h that says that CoercionForm only affects  
display and not semantics.  I don't think this change fixes any live bugs,  
but it makes things more consistent.  The main reason for doing it though  
is that now build_coercion_expression() receives ccontext, which it needs  
in order to be able to recursively invoke coerce_to_target_type().  
  
Next, reimplement ArrayCoerceExpr so that the node does not directly know  
any details of what has to be done to the individual array elements while  
performing the array coercion.  Instead, the per-element processing is  
represented by a sub-expression whose input is a source array element and  
whose output is a target array element.  This simplifies life in  
parse_coerce.c, because it can build that sub-expression by a recursive  
invocation of coerce_to_target_type().  The executor now handles the  
per-element processing as a compiled expression instead of hard-wired code.  
The main advantage of this is that we can use a single ArrayCoerceExpr to  
handle as many as three successive steps per element: base type conversion,  
typmod coercion, and domain constraint checking.  The old code used two  
stacked ArrayCoerceExprs to handle type + typmod coercion, which was pretty  
inefficient, and adding yet another array deconstruction to do domain  
constraint checking seemed very unappetizing.  
  
In the case where we just need a single, very simple coercion function,  
doing this straightforwardly leads to a noticeable increase in the  
per-array-element runtime cost.  Hence, add an additional shortcut evalfunc  
in execExprInterp.c that skips unnecessary overhead for that specific form  
of expression.  The runtime speed of simple cases is within 1% or so of  
where it was before, while cases that previously required two levels of  
array processing are significantly faster.  
  
Finally, create an implicit array type for every domain type, as we do for  
base types, enums, etc.  Everything except the array-coercion case seems  
to just work without further effort.  
  
Tom Lane, reviewed by Andrew Dunstan  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/array.sgml
M src/backend/catalog/dependency.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_coerce.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/fmgr/fmgr.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/nodes/primnodes.h
M src/include/parser/parse_coerce.h
M src/include/utils/array.h
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Fix copy & pasto in 510b8cbff15f.

commit   : 248e33756b425335d94a32ffc8e9aace04f82c31    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Sep 2017 17:41:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Sep 2017 17:41:20 -0700    

Click here for diff

Reported-By: Peter Geoghegan  

M src/include/port/pg_bswap.h

Fix typo.

commit   : f14241236ea2e306dc665635665c7f88669b6ca4    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Sep 2017 15:52:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Sep 2017 15:52:55 -0700    

Click here for diff

Reported-By: Thomas Munro and Jesper Pedersen  

M src/include/utils/hashutils.h

Extend & revamp pg_bswap.h infrastructure.

commit   : 510b8cbff15fcece246f66f2273ccf830a6c7e98    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Sep 2017 15:52:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Sep 2017 15:52:55 -0700    

Click here for diff

Upcoming patches are going to address performance issues that involve  
slow system provided ntohs/htons etc. To address that expand  
pg_bswap.h to provide pg_ntoh{16,32,64}, pg_hton{16,32,64} and  
optimize their respective implementations by using compiler intrinsics  
for gcc compatible compilers and msvc. Fall back to manual  
implementations using shifts etc otherwise.  
  
Additionally remove multiple evaluation hazards from the existing  
BSWAP32/64 macros, by replacing them with inline functions when  
necessary. In the course of that the naming scheme is changed to  
pg_bswap16/32/64.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M contrib/btree_gist/btree_uuid.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h

Use Py_RETURN_NONE where suitable

commit   : 0008a106d4f84206a96fc1fb09a1e6b09f1627ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Sep 2017 16:50:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Sep 2017 16:50:01 -0400    

Click here for diff

This is more idiomatic style and available as of Python 2.4, which is  
our minimum.  

M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_subxactobject.c

Fix inadequate locking during get_rel_oids().

commit   : 19de0ab23ccba12567c18640f00b49f01471018d    
  
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

psql: Don't try to print a partition constraint we didn't fetch.

commit   : 69c16983e103f913ee0dae7f288611de006ba2ba    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Sep 2017 15:59:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Sep 2017 15:59:11 -0400    

Click here for diff

If \d rather than \d+ is used, then verbose is false and we don't ask  
the server for the partition constraint; so we shouldn't print it in  
that case either.  
  
Maksim Milyutin, per a report from Jesper Pedersen.  Reviewed by  
Jesper Pedersen and Amit Langote.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

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

commit   : e55d9643ecb87f41185941b54d632641b3852aaa    
  
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   : 2a14b9609df1de4f2eb5a97aff674aaad033a7e6    
  
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

Marginal improvement for generated code in execExprInterp.c.

commit   : 136ab7c5a5f54fecea7c28c8550c19123245acf0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2017 11:32:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Sep 2017 11:32:05 -0400    

Click here for diff

Avoid the coding pattern "*op->resvalue = f();", as some compilers think  
that requires them to evaluate "op->resvalue" before the function call.  
Unless there are lots of free registers, this can lead to a useless  
register spill and reload across the call.  
  
I changed all the cases like this in ExecInterpExpr(), but didn't bother  
in the out-of-line opcode eval subroutines, since those are presumably  
not as performance-critical.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c

Add background worker type

commit   : 5373bc2a0867048bb78f93aede54ac1309b5e227    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2017 12:24:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Aug 2017 12:24:47 -0400    

Click here for diff

Add bgw_type field to background worker structure.  It is intended to be  
set to the same value for all workers of the same type, so they can be  
grouped in pg_stat_activity, for example.  
  
The backend_type column in pg_stat_activity now shows bgw_type for a  
background worker.  The ps listing also no longer calls out that a  
process is a background worker but just show the bgw_type.  That way,  
being a background worker is more of an implementation detail now that  
is not shown to the user.  However, most log messages still refer to  
'background worker "%s"'; otherwise constructing sensible and  
translatable log messages would become tricky.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M contrib/pg_prewarm/autoprewarm.c
M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/parallel.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/launcher.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/postmaster/bgworker.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/worker_spi/worker_spi.c

Remove replacement selection sort.

commit   : 8b304b8b72b0a60f1968d39f01cf817c8df863ec    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Sep 2017 10:20:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Sep 2017 10:20:44 -0400    

Click here for diff

At the time replacement_sort_tuples was introduced, there were still  
cases where replacement selection sort noticeably outperformed using  
quicksort even for the first run.  However, those cases seem to have  
evaporated as a result of further improvements made since that time  
(and perhaps also advances in CPU technology).  So remove replacement  
selection and the controlling GUC entirely.  This makes tuplesort.c  
noticeably simpler and probably paves the way for further  
optimizations someone might want to do later.  
  
Peter Geoghegan, with review and testing by Tomas Vondra and me.  
  
Discussion: https://postgr.es/m/CAH2-WzmmNjG_K0R9nqYwMq3zjyJJK+hCbiZYNGhAy-Zyjs64GQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/release-9.6.sgml
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/sort/tuplesort.c
M src/include/miscadmin.h
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Add PostgreSQL version to coverage output

commit   : d2773f9bcd980cf6ed720928cd0700196608ef19    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

Also make overriding the title easier.  That helps telling where the  
report came from and labeling different variants of a report.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.global.in

Add lcov --initial

commit   : 4bb5a2536bcff5dfef9242818979faaa0659b1af    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

By just running lcov on the produced .gcda data files, we don't account  
for source files that are not touched by tests at all.  To fix that, run  
lcov --initial to create a base line info file with all zero counters,  
and merge that with the actual counters when creating the final report.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M .gitignore
M src/Makefile.global.in

Remove SGML marked sections

commit   : 22d9764646d03ac7d3419c4fd0effd256568c922    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2017 16:17:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Sep 2017 16:17:28 -0400    

Click here for diff

For XML compatibility, replace marked sections <![IGNORE[ ]]> with  
comments <!-- -->.  In some cases it seemed better to remove the ignored  
text altogether, and in one case the text should not have been ignored.  

M doc/src/sgml/Makefile
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/release-old.sgml
M doc/src/sgml/rules.sgml

Fix freezing of a dead HOT-updated tuple

commit   : 20b655224249e6d2daf7ef0595995228baddb381    
  
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

Have lcov exclude external files

commit   : 66fd86a6a3d2ac9772f977ec43af190ea3fe6ddb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

Call lcov with --no-external option to exclude external files (for  
example, system headers with inline functions) from output.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.global.in

Run only top-level recursive lcov

commit   : 504923a0ed5c75775196c8ed0cd59b15d55cd39b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

This is the way lcov was intended to be used.  It is much faster and  
more robust and makes the makefiles simpler than running it in each  
subdirectory.  
  
The previous coding ran gcov before lcov, but that is useless because  
lcov/geninfo call gcov internally and use that information.  Moreover,  
this led to complications and failures during parallel make.  This  
separates the two targets:  You either use "make coverage" to get  
textual output from gcov or "make coverage-html" to get an HTML report  
via lcov.  (Using both is still problematic because they write the same  
output files.)  
  
Reviewed-by: Michael Paquier <[email protected]>  

M .gitignore
M doc/src/sgml/regress.sgml
M src/Makefile.global.in

Fix behavior when converting a float infinity to numeric.

commit   : 7769fc000aa3b959d3e1c7d7c3c2555aba7722c3    
  
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   : 28e07270768518524291d7d7906668eb67f6b8a5    
  
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

Fix plperl build

commit   : 65c865620237bf1964757436a36c40af591d30fb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Sep 2017 15:51:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Sep 2017 15:51:04 -0400    

Click here for diff

The changes in 639928c988c1c2f52bbe7ca89e8c7c78a041b3e2 turned out to  
require Perl 5.9.3, which is newer than our minimum required version.  
So revert back to the old code for the normal case and only use the new  
variant when both coverage and vpath are used.  As the minimum Perl  
version moves forward, we can drop the old code sometime.  

M src/pl/plperl/GNUmakefile

Improve the CREATE POLICY documentation.

commit   : af44cbd5ecd7e1db0ae4bce75c8f1bce14b1d6db    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 27 Sep 2017 17:16:15 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 27 Sep 2017 17:16:15 +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

Improve vpath support in plperl build

commit   : 639928c988c1c2f52bbe7ca89e8c7c78a041b3e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Aug 2017 23:33:47 -0400    

Click here for diff

Run xsubpp with the -output option instead of redirecting stdout.  That  
ensures that the #line directives in the output file point to the right  
place in a vpath build.  This in turn fixes an error in coverage builds  
that it can't find the source files.  
  
Refactor the makefile rules while we're here.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/pl/plperl/GNUmakefile

Get rid of parameterized marked sections in SGML

commit   : 684cf76b83e9dc8aed12aeb9131d2208f61bd31f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Sep 2017 10:17:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Sep 2017 10:17:37 -0400    

Click here for diff

Previously, we created a variant of the installation instructions for  
producing the plain-text INSTALL file by marking up certain parts of  
installation.sgml using SGML parameterized marked sections.  Marked  
sections will not work anymore in XML, so before we can convert the  
documentation to XML, we need a new approach.  
  
DocBook provides a "profiling" feature that allows selecting content  
based on attributes, which would work here.  But it imposes a noticeable  
overhead when building the full documentation and causes complications  
when building some output formats, and given that we recently spent a  
fair amount of effort optimizing the documentation build time, it seems  
sad to have to accept that.  
  
So as an alternative, (1) we create our own mini-profiling layer that  
adjusts just the text we want, and (2) assemble the pieces of content  
that we want in the INSTALL file using XInclude.  That way, there is no  
overhead when building the full documentation and most of the "ugly"  
stuff in installation.sgml can be removed and dealt with out of line.  

M doc/src/sgml/Makefile
M doc/src/sgml/filelist.sgml
M doc/src/sgml/installation.sgml
D doc/src/sgml/standalone-install.sgml
A doc/src/sgml/standalone-install.xml
A doc/src/sgml/standalone-profile.xsl

pg_basebackup: Add option to create replication slot

commit   : 3709ca1cf069cee24ef8000cb6a479813b5537df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 16:07:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 16:07:52 -0400    

Click here for diff

When requesting a particular replication slot, the new pg_basebackup  
option -C/--create-slot creates it before starting to replicate from it.  
  
Further refactor the slot creation logic to include the temporary slot  
creation logic into the same function.  Add new arguments is_temporary  
and preserve_wal to CreateReplicationSlot().  Print in --verbose mode  
that a slot has been created.  
  
Author: Michael Banck <[email protected]>  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Don't recommend "DROP SCHEMA information_schema CASCADE".

commit   : 59597e6485847ae40eab2e80ff04af3e8663f2d8    
  
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

Add some more pg_receivewal tests

commit   : fa41461205ae4eb417045825583c3209e5a4f339    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 16:41:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 16:41:20 -0400    

Click here for diff

Add some more tests for the --create-slot and --drop-slot options,  
verifying that the right kind of slot was created and that the slot was  
dropped.  While working on an unrelated patch for pg_basebackup, some of  
this was temporarily broken without any tests noticing.  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Turn on log_replication_commands in PostgresNode

commit   : 43588f58aa045c736af168267e0f1c5934333e15    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 15:00:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 15:00:05 -0400    

Click here for diff

This is useful for example for the pg_basebackup and related tests.  

M src/test/perl/PostgresNode.pm

Improve wording of error message added in commit 714805010.

commit   : 9a50a93c7b1427f6182ed1f21ed76da5b1d6a57c    
  
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   : 5ea96efaa0100e96b6b927eb1e67869143e1db4e    
  
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   : 984c92074d84a81dc17e9865fc79e264eb50ad61    
  
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   : 1635e80d30b16df98aebead12f2b82f17efd9bc8    
  
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

Sort pg_basebackup options better

commit   : 15a8010ed691f190aad19c0a205f4a17868591e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 11:58:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Sep 2017 11:58:22 -0400    

Click here for diff

The --slot option somehow ended up under options controlling the output,  
and some other options were in a nonsensical place or were not moved  
after recent renamings, so tidy all that up a bit.  

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

Handle heap rewrites better in logical replication

commit   : ab28feae2bd3d4629bd73ae3548e671c57d785f0    
  
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

Remove lsn from HashScanPosData.

commit   : 22c5e73562c53437979efec4c26cd9fff408777c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Sep 2017 09:16:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Sep 2017 09:16:45 -0400    

Click here for diff

This was intended as infrastructure for weakening VACUUM's locking  
requirements, similar to what was done for btree indexes in commit  
2ed5b87f96d473962ec5230fd820abfeaccb2069.  However, for hash indexes,  
it seems that the improvements which are possible are actually  
extremely marginal.  Furthermore, performing the LSN cross-check will  
end up skipping cleanup far more often than is necessary; we only care  
about page modifications due to a VACUUM, but the LSN check will fail  
if ANY modification has occurred.  So, rather than pressing forward  
with that "optimization", just rip the LSN field out.  
  
Patch by me, reviewed by Ashutosh Sharma and Amit Kapila  
  
Discussion: http://postgr.es/m/CAA4eK1JxqqcuC5Un7YLQVhOYSZBS+t=3xqZuEkt5RyquyuxpwQ@mail.gmail.com  

M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/include/access/hash.h

Fix trivial mistake in README.

commit   : 79a4a665c046af91d4216fe69b535c429039d0d0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Sep 2017 08:58:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Sep 2017 08:58:06 -0400    

Click here for diff

You might think I (Robert) could manage to count to five without  
messing it up, but if you did, you would be wrong.  
  
Amit Kapila  
  
Discussion: http://postgr.es/m/CAA4eK1JxqqcuC5Un7YLQVhOYSZBS+t=3xqZuEkt5RyquyuxpwQ@mail.gmail.com  

M src/backend/access/hash/README

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

commit   : 899bd785c0edf376077d3f5d65c316f92c1b64b5    
  
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

Make construct_[md_]array return a valid empty array for zero-size input.

commit   : 716ea626a88ac510523ab3af5bc779d78eeced58    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2017 11:55:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Sep 2017 11:55:24 -0400    

Click here for diff

If construct_array() or construct_md_array() were given a dimension of  
zero, they'd produce an array that contains no elements but has positive  
dimension.  This violates a general expectation that empty arrays should  
have ndims = 0; in particular, while arrays like this print as empty,  
they don't compare equal to other empty arrays.  
  
Up to now we've expected callers to avoid making such calls and instead  
be careful to call construct_empty_array() if there would be no elements.  
But this has always been an easily missed case, and we've repeatedly had to  
fix callers to do it right.  In bug #14826, Erwin Brandstetter pointed out  
yet another such oversight, in ts_lexize(); and a bit of examination of  
other call sites found at least two more with similar issues.  So let's  
fix the problem centrally and permanently by changing these two functions  
to construct a proper zero-D empty array whenever the array would be empty.  
  
This renders a few explicit calls of construct_empty_array() redundant,  
but the only such place I found that really seemed worth changing was in  
ExecEvalArrayExpr().  
  
Although this fixes some very old bugs, no back-patch: the problem is  
pretty minor and the risk of changing behavior seems to outweigh the  
benefit in stable branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/utils/adt/arrayfuncs.c
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

Support building with Visual Studio 2017

commit   : f2ab3898f3a25ef431db4ea90a8d128b974dbffe    
  
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

Fix assorted infelicities in new SetWALSegSize() function.

commit   : 8485a25a8c9a419ff3e0d30e43e4abd5e680cc65    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Sep 2017 12:05:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Sep 2017 12:05:06 -0400    

Click here for diff

* Failure to check for malloc failure (ok, pretty unlikely here, but  
that's not an excuse).  
  
* Leakage of open fd on read error, and of malloc'd buffer always.  
  
* Incorrect assumption that a short read would set errno to zero.  
  
* Failure to adhere to message style conventions (in particular,  
not reporting errno where relevant; using "couldn't open" rather than  
"could not open" is not really in line with project style either).  
  
* Missing newlines on some messages.  
  
Coverity spotted the leak problems; I noticed the rest while  
fixing the leaks.  

M contrib/pg_standby/pg_standby.c

Allow ICU to use SortSupport on Windows with UTF-8

commit   : 6dda0998afc7d449145b9ba216844bdba7a817d6    
  
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   : 9b31c72a9492880e657b68b1ed971dec3c361c95    
  
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   : 74ca8f9b9077017529fe658e445a11da296ac6ab    
  
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

... and the very same bug in publicationListToArray().

commit   : 24541ffd788d56009126fff52b2341ada6c84245    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 15:16:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 15:16:48 -0400    

Click here for diff

Sigh.  

M src/backend/commands/subscriptioncmds.c

Fix bogus size calculation in strlist_to_textarray().

commit   : 737639017c87d5a0a466e8676f1eadc61d775c78    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 15:01:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 15:01:59 -0400    

Click here for diff

It's making an array of Datum, not an array of text *.  The mistake  
is harmless since those are currently the same size, but it's still  
wrong.  

M src/backend/catalog/objectaddress.c

Improve memory management in autovacuum.c.

commit   : 335f3d04e4c8dd495c4dd30ab1049b6fe8f25052    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 13:28:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 13:28:16 -0400    

Click here for diff

Invoke vacuum(), as well as "work item" processing, in the PortalContext  
that do_autovacuum() has manufactured, which will be reset before each  
such invocation.  This ensures cleanup of any memory leaked by these  
operations.  It also avoids the rather dangerous practice of calling  
vacuum() in a context that vacuum() itself will destroy while it runs.  
There's no known live bug there, but it's not hard to imagine introducing  
one if we leave it like this.  
  
Tom Lane, reviewed by Michael Paquier and Alvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Remove pgbench "progress" test pending solution of its timing issues.

commit   : ad51c6fb5708342e603d12a730bbc4e663bd637e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 13:02:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 13:02:30 -0400    

Click here for diff

Buildfarm member skink shows that this is even more flaky than  
I thought.  There are probably some actual pgbench bugs here  
as well as a timing dependency.  But we can't have stuff this  
unstable in the buildfarm, it obscures other issues.  

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

Ten-second timeout in 013_crash_restart.pl is not enough, let's try 60.

commit   : 01c7d3ef85d4b0e1c52cc1a3542864f95f386f76    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 12:56:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Sep 2017 12:56:31 -0400    

Click here for diff

Per buildfarm member topminnow.  

M src/test/recovery/t/013_crash_restart.pl

Refactor new file permission handling

commit   : 0c5803b450e0cc29b3527df3f352e6f18a038cc6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Sep 2017 09:49:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Sep 2017 09:49:22 -0400    

Click here for diff

The file handling functions from fd.c were called with a diverse mix of  
notations for the file permissions when they were opening new files.  
Almost all files created by the server should have the same permissions  
set.  So change the API so that e.g. OpenTransientFile() automatically  
uses the standard permissions set, and OpenTransientFilePerm() is a new  
function that takes an explicit permissions set for the few cases where  
it is needed.  This also saves an unnecessary argument for call sites  
that are just opening an existing file.  
  
While we're reviewing these APIs, get rid of the FileName typedef and  
use the standard const char * for the file name and mode_t for the file  
mode.  This makes these functions match other file handling functions  
and removes an unnecessary layer of mysteriousness.  We can also get rid  
of a few casts that way.  
  
Author: David Steele <[email protected]>  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/catalog.c
M src/backend/libpq/be-fsstubs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/smgr/md.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/misc/guc.c
M src/include/storage/fd.h

Test BRIN autosummarization

commit   : 404ba54e8fd3036eee0f9241f68b17092ce734ee    
  
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

Fix saving and restoring umask

commit   : aa6b7b72d9bcf967cbccd378de4bc5cef33d02f9    
  
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

Revert "Add basic TAP test setup for pg_upgrade"

commit   : 58ffe141eb37c3f027acd25c1fc6b36513bf9380    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 16:34:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 16:34:46 -0400    

Click here for diff

This reverts commit f41e56c76e39f02bef7ba002c9de03d62b76de4d.  
  
The build farm client would run the pg_upgrade tests twice, once as part  
of the existing pg_upgrade check run and once as part of picking up all  
TAP tests by looking for "t" directories.  Since the pg_upgrade tests  
are pretty slow, we will need a better solution or possibly a build farm  
client change before we can proceed with this.  

M src/bin/pg_upgrade/Makefile
D src/bin/pg_upgrade/t/001_basic.pl

Add inline murmurhash32(uint32) function.

commit   : 791961f59b792fbd4f0a992d3ccab47298e79103    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 22 Sep 2017 13:38:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 22 Sep 2017 13:38:42 -0700    

Click here for diff

The function already existed in tidbitmap.c but more users requiring  
fast hashing of 32bit ints are coming up.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/tidbitmap.c
M src/include/utils/hashutils.h

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

commit   : 91ad8b416cee753eaa6f520ee2d21c2d41853381    
  
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

Expand expected output for recovery test even further.

commit   : 8d926029e817d280b2376433e3aaa3895e1a7128    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 22 Sep 2017 11:29:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 22 Sep 2017 11:29:05 -0700    

Click here for diff

I'd assumed that the backend being killed should be able to get out an  
error message - but it turns out it's not guaranteed that it's not  
still sending a ready-for-query.  Really need to do something about  
getting these error message to the client.  
  
Reported-By: Thomas Munro, Tom Lane  
Discussion:  
	https://postgr.es/m/CAEepm=0TE90nded+bNthP45_PEvGAAr=3gxhHJObL4xmOLtX0w@mail.gmail.com  
	https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

Fix s/intidb/initdb/ typo.

commit   : f9583e86b4bfa8c4e4d83ab33e5dcdaeab5c45a1    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 22:59:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 22:59:36 -0700    

Click here for diff

Reported-By: Michael Paquier  
Discussion: https://postgr.es/m/CAB7nPqTfaKAYZ4wuUM-W8kc4VnXrxX1=5-a9i==VoUPTMFpsgg@mail.gmail.com  

M src/include/pg_config_manual.h

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

commit   : 6a2fa09c0cba0e5a11854d733872ac18511f4c83    
  
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

hash: Implement page-at-a-time scan.

commit   : 7c75ef571579a3ad7a1d3ee909f11dba5e0b9440    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 22 Sep 2017 13:26:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 22 Sep 2017 13:26:25 -0400    

Click here for diff

Commit 09cb5c0e7d6fbc9dee26dc429e4fc0f2a88e5272 added a similar  
optimization to btree back in 2006, but nobody bothered to implement  
the same thing for hash indexes, probably because they weren't  
WAL-logged and had lots of other performance problems as well.  As  
with the corresponding btree case, this eliminates the problem of  
potentially needing to refind our position within the page, and cuts  
down on pin/unpin traffic as well.  
  
Ashutosh Sharma, reviewed by Alexander Korotkov, Jesper Pedersen,  
Amit Kapila, and me.  Some final edits to comments and README by  
me.  
  
Discussion: http://postgr.es/m/CAE9k0Pm3KTx93K8_5j6VMzG4h5F+SyknxUwXrN-zqSZ9X8ZS3w@mail.gmail.com  

M src/backend/access/hash/README
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/include/access/hash.h

Allow up to 3 "-P 1" reports per thread in pgbench run of 2 seconds.

commit   : 0f574a7afb5c998d19dc3d981e45cb10267286ed    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 12:59:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 12:59:44 -0400    

Click here for diff

There seems to be some considerable imprecision in the timing of -P  
progress reports.  Nominally each thread ought to produce 2 reports  
in this test, but about 10% of the time we only get one, and 1% of  
the time we get three, as per buildfarm results so far.  Pending  
further investigation, treat the last case as a "pass".  (I, tgl,  
am suspicious that this still might not be lax enough, now that it's  
obvious that the behavior is load-dependent; but there's not yet  
buildfarm evidence to confirm that suspicion.)  
  
Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove contrib/chkpass

commit   : 5d3cad564729f64d972c5c803ff34f0eb40bfd0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 10:59:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Sep 2017 10:59:46 -0400    

Click here for diff

The recent addition of a test suite for this module revealed a few  
problems.  It uses a crypt() method that is no longer considered secure  
and doesn't work anymore on some platforms.  Using a volatile input  
function violates internal sanity check assumptions and leads to  
failures on the build farm.  
  
So this module is neither a usable security tool nor a good example for  
an extension.  No one wanted to argue for keeping or improving it, so  
remove it.  
  
Discussion: https://www.postgresql.org/message-id/5645b0d7-cc40-6ab5-c553-292a91091ee7%402ndquadrant.com  

M contrib/Makefile
D contrib/chkpass/.gitignore
D contrib/chkpass/Makefile
D contrib/chkpass/chkpass–1.0.sql
D contrib/chkpass/chkpass–unpackaged–1.0.sql
D contrib/chkpass/chkpass.c
D contrib/chkpass/chkpass.control
D contrib/chkpass/expected/chkpass.out
D contrib/chkpass/sql/chkpass.sql
D doc/src/sgml/chkpass.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Mop-up for commit 85feb77aa09cda9ff3e12cf95c757c499dc25343.

commit   : ed87e1980706975e7aa412bee200087774c5ff22    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 11:35:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 11:35:12 -0400    

Click here for diff

Adjust commentary in regc_pg_locale.c to remove mention of the possibility  
of not having <wctype.h> functions, since we no longer consider that.  
  
Eliminate duplicate code in wparser_def.c by generalizing the p_iswhat  
macro to take a parameter saying what to return for non-ASCII chars  
in C locale.  (That's not really a consequence of the  
USE_WIDE_UPPER_LOWER-ectomy, but I noticed it while doing that.)  

M src/backend/regex/regc_pg_locale.c
M src/backend/tsearch/wparser_def.c

Assume wcstombs(), towlower(), and sibling functions are always present.

commit   : 85feb77aa09cda9ff3e12cf95c757c499dc25343    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 11:00:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Sep 2017 11:00:58 -0400    

Click here for diff

These functions are required by SUS v2, which is our minimum baseline  
for Unix platforms, and are present on all interesting Windows versions  
as well.  Even our oldest buildfarm members have them.  Thus, we were not  
testing the "!USE_WIDE_UPPER_LOWER" code paths, which explains why the bug  
fixed in commit e6023ee7f escaped detection.  Per discussion, there seems  
to be no more real-world value in maintaining this option.  Hence, remove  
the configure-time tests for wcstombs() and towlower(), remove the  
USE_WIDE_UPPER_LOWER symbol, and remove all the !USE_WIDE_UPPER_LOWER code.  
There's not actually all that much of the latter, but simplifying the #if  
nests is a win in itself.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/regex/regc_pg_locale.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/tsearch/ts_locale.h
M src/include/utils/pg_locale.h

Fix build with !USE_WIDE_UPPER_LOWER

commit   : e6023ee7fa73a2d9a2d7524f63584844b2291def    
  
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   : 885cab58115a5af9484926ddee8dca3dc0106c1e    
  
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   : 47f849a3c9005852926dca551d70ad8111f09f3a    
  
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

Revert "Fix bool/int type confusion"

commit   : a890432a872afc9ca2327573f3313fd994d17384    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Sep 2017 19:32:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Sep 2017 19:32:19 -0400    

Click here for diff

This reverts commit 0ec2e908babfbfde83a3925680f06b16408739ff.  
We'll use the upstream (IANA) fix instead.  

M src/timezone/localtime.c

Provide a test for variable existence in psql

commit   : d57c7a7c506276597af619bdb8c62fa5b592745a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 21 Sep 2017 19:02:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 21 Sep 2017 19:02:23 -0400    

Click here for diff

"\if :{?variable_name}" will be translated to "\if TRUE" if the variable  
exists and "\if FALSE" otherwise. Thus it will be possible to execute code  
conditionally on the existence of the variable, regardless of its value.  
  
Fabien Coelho, with some review by Robins Tharakan and some light text  
editing by me.  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1708260835520.3627@lancre  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/psqlscanslash.l
M src/fe_utils/psqlscan.l
M src/include/fe_utils/psqlscan_int.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

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

commit   : 71480501057fee9fa3649b072173ff10e2b842d0    
  
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

Quieten warnings about unused variables

commit   : 28ae524bbf865d23eb10f6ae1b996d59dcc30e4e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 21 Sep 2017 08:41:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 21 Sep 2017 08:41:14 -0400    

Click here for diff

These variables are only ever written to in assertion-enabled builds,  
and the latest Microsoft compilers complain about such variables in  
non-assertion-enabled builds.  
  
Apparently they don't worry so much about variables that are written to  
but not read from, so most of our PG_USED_FOR_ASSERTS_ONLY variables  
don't cause the problem.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Associate partitioning information with each RelOptInfo.

commit   : 9140cf8269b0c4ae002b2748d93979d535891311    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Sep 2017 23:33:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Sep 2017 23:33:04 -0400    

Click here for diff

This is not used for anything yet, but it is necessary infrastructure  
for partition-wise join and for partition pruning without constraint  
exclusion.  
  
Ashutosh Bapat, reviewed by Amit Langote and with quite a few changes,  
mostly cosmetic, by me.  Additional review and testing of this patch  
series by Antonin Houska, Amit Khandekar, Rafia Sabih, Rajkumar  
Raghuwanshi, Thomas Munro, and Dilip Kumar.  
  
Discussion: http://postgr.es/m/CAFjFpRfneFG3H+F6BaiXemMrKF+FY-POpx3Ocy+RiH3yBmXSNw@mail.gmail.com  

M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h

Improve dubious memory management in pg_newlocale_from_collation().

commit   : 7b86c2ac9563ffd9b870cfd73a769431b7922e81    
  
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   : 4939488af9b86edfff9b981773cd388d361c5830    
  
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   : 36b564c648a044e42ca461466ae14d8588e6c5e2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 11:10:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Sep 2017 11:10:36 -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

Fix create_lateral_join_info to handle dead relations properly.

commit   : 57eebca03a9eb61eb18f8ea9db94775653f797d1    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Sep 2017 10:20:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Sep 2017 10:20:10 -0400    

Click here for diff

Commit 0a480502b092195a9b25a2f0f199a21d592a9c57 broke it.  
  
Report by Andreas Seltenreich.  Fix by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix typo.

commit   : 7f3a3312abf34ea7e899046e326775612802764b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Sep 2017 10:07:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Sep 2017 10:07:53 -0400    

Click here for diff

Thomas Munro  
  
Discussion: http://postgr.es/m/CAEepm=2j-HAgnBUrAazwS0ry7Z_ihk+d7g+Ye3u99+6WbiGt_Q@mail.gmail.com  

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

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

commit   : 00210e3fb974ff2b9affc4d8f3b29f9cb3645a60    
  
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

Fix compiler warning

commit   : d42294fc00da4b97d04ddb4401b76295e8d86816    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 20 Sep 2017 09:03:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 20 Sep 2017 09:03:04 -0400    

Click here for diff

from gcc-7 -Wformat-truncation (via -Wall)  

M src/bin/initdb/initdb.c

Sync process names between ps and pg_stat_activity

commit   : be87b70b6117609b7db0cd5e0cd96e7f569bdddb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2017 21:15:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2017 21:15:09 -0400    

Click here for diff

Remove gratuitous differences in the process names shown in  
pg_stat_activity.backend_type and the ps output.  
  
Reviewed-by: Takayuki Tsunakawa <[email protected]>  

M doc/src/sgml/monitoring.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c

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

commit   : 2c74e6c1dcc5002fa8b822e5757f6c95d899fb7a    
  
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

Make WAL segment size configurable at initdb time.

commit   : fc49e24fa69a15efacd5b8958115ed9c43c48f9a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 22:03:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 22:03:48 -0700    

Click here for diff

For performance reasons a larger segment size than the default 16MB  
can be useful. A larger segment size has two main benefits: Firstly,  
in setups using archiving, it makes it easier to write scripts that  
can keep up with higher amounts of WAL, secondly, the WAL has to be  
written and synced to disk less frequently.  
  
But at the same time large segment size are disadvantageous for  
smaller databases. So far the segment size had to be configured at  
compile time, often making it unrealistic to choose one fitting to a  
particularly load. Therefore change it to a initdb time setting.  
  
This includes a breaking changes to the xlogreader.h API, which now  
requires the current segment size to be configured.  For that and  
similar reasons a number of binaries had to be taught how to recognize  
the current segment size.  
  
Author: Beena Emerson, editorialized by Andres Freund  
Reviewed-By: Andres Freund, David Steele, Kuntal Ghosh, Michael  
    Paquier, Peter Eisentraut, Robert Hass, Tushar Ahuja  
Discussion: https://postgr.es/m/CAOG9ApEAcQ--1ieKbhFzXSQPw_YLmepaa4hNdnY5+ZULpt81Mw@mail.gmail.com  

M configure
M configure.in
M contrib/pg_standby/pg_standby.c
M doc/src/sgml/backup.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/checkpointer.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogreader.h
M src/include/catalog/pg_control.h
M src/include/pg_config.h.in
M src/include/pg_config_manual.h
M src/tools/msvc/Solution.pm

Accept that server might not be able to send error in crash recovery test.

commit   : 5ada1fcd0c30be1b0b793a802cf6da386a6c1925    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 21:29:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 21:29:51 -0700    

Click here for diff

As it turns out we can't rely that the script's monitoring session is  
terminated with a proper error by the server, because the session  
might be terminated while already trying to send data.  
  
Also improve robustness and error reporting facilities of the test,  
developed while debugging this issue.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

Remove no-op GiST support functions in the core GiST opclasses.

commit   : 2d484f9b058035d41204f2eb8a0a8d2e8ee57b44    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Sep 2017 23:32:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Sep 2017 23:32:45 -0400    

Click here for diff

The preceding patch allowed us to remove useless GiST support functions.  
This patch actually does that for all the no-op cases in the core GiST  
code.  This buys us whatever performance gain is to be had, and more  
importantly exercises the preceding patch.  
  
There remain no-op functions in the contrib GiST opclasses, but those  
will take more work to remove.  
  
Discussion: https://postgr.es/m/CAJEAwVELVx9gYscpE=Be6iJxvdW5unZ_LkcAaVNSeOwvdwtD=A@mail.gmail.com  

M src/backend/access/gist/gistproc.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/create_am.out
M src/test/regress/sql/create_am.sql

Allow no-op GiST support functions to be omitted.

commit   : d3a4f89d8a3e500bd7c0b7a8a8a5ce1b47859128    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Sep 2017 23:32:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Sep 2017 23:32:27 -0400    

Click here for diff

There are common use-cases in which the compress and/or decompress  
functions can be omitted, with the result being that we make no  
data transformation when storing or retrieving index values.  
Previously, you had to provide a no-op function anyway, but this  
patch allows such opclass support functions to be omitted.  
  
Furthermore, if the compress function is omitted, then the core code  
knows that the stored representation is the same as the original data.  
This means we can allow index-only scans without requiring a fetch  
function to be provided either.  Previously you had to provide a  
no-op fetch function if you wanted IOS to work.  
  
This reportedly provides a small performance benefit in such cases,  
but IMO the real reason for doing it is just to reduce the amount of  
useless boilerplate code that has to be written for GiST opclasses.  
  
Andrey Borodin, reviewed by Dmitriy Sarafannikov  
  
Discussion: https://postgr.es/m/CAJEAwVELVx9gYscpE=Be6iJxvdW5unZ_LkcAaVNSeOwvdwtD=A@mail.gmail.com  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvalidate.c

s/NULL byte/NUL byte/ in comment refering to C string terminator.

commit   : 896537f078ba4d709ce754ecaff8350fd55bdfd8    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 16:39:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 16:39:18 -0700    

Click here for diff

Reported-By: Robert Haas  
Discussion: https://postgr.es/m/CA+Tgmoa+YBvWgFST2NVoeXjVSohEpK=vqnVCsoCkhTVVxfLcVQ@mail.gmail.com  

M src/backend/postmaster/pgstat.c

Add basic TAP test setup for pg_upgrade

commit   : f41e56c76e39f02bef7ba002c9de03d62b76de4d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2017 18:29:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Sep 2017 18:29:12 -0400    

Click here for diff

The plan is to convert the current pg_upgrade test to the TAP  
framework.  This commit just puts a basic TAP test in place so that we  
can see how the build farm behaves, since the build farm client has some  
special knowledge of the pg_upgrade tests.  
  
Author: Michael Paquier <[email protected]>  

M src/bin/pg_upgrade/Makefile
A src/bin/pg_upgrade/t/001_basic.pl

Avoid use of non-portable strnlen() in pgstat_clip_activity().

commit   : 71edbb6f66f7139d6209334ef8734a122ba06b56    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 14:17:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 14:17:20 -0700    

Click here for diff

The use of strnlen rather than strlen was just paranoia. Instead of  
giving up on the paranoia, just implement the safeguard  
differently. And add a comment explaining why we're careful.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Speedup pgstat_report_activity by moving mb-aware truncation to read side.

commit   : 54b6cd589ac2f5635a42511236a5eb7299e2dcaf    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 11:46:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 11:46:07 -0700    

Click here for diff

Previously multi-byte aware truncation was done on every  
pgstat_report_activity() call - proving to be a bottleneck for  
workloads with long query strings that execute quickly.  
  
Instead move the truncation to the read side, which commonly is  
executed far less frequently. That's possible because all server  
encodings allow to determine the length of a multi-byte string from  
the first byte.  
  
Rename PgBackendStatus.st_activity to st_activity_raw so existing  
extension users of the field break - their code has to be adjusted to  
use pgstat_clip_activity().  
  
Author: Andres Freund  
Tested-By: Khuntal Ghosh  
Reviewed-By: Robert Haas, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h

Disable multi-byte citext tests

commit   : d1687c6926819f023c78b353458950a303796aba    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 19 Sep 2017 15:31:37 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 19 Sep 2017 15:31:37 -0400    

Click here for diff

This reverts commit 890faaf1 which attempted unsuccessfully to deal with  
the problem, and instead just comments out these tests like other similar  
tests elsewhere in the script.  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql

Cache datatype-output-function lookup info across calls of concat().

commit   : ed22fb8b0091deea23747310fa7609079a96cf82    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Sep 2017 15:09:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Sep 2017 15:09:34 -0400    

Click here for diff

Testing indicates this can save a third to a half of the runtime  
of the function.  
  
Pavel Stehule, reviewed by Alexander Kuzmenkov  
  
Discussion: https://postgr.es/m/CAFj8pRAT62pRgjoHbgTfJUc2uLmeQ4saUj+yVJAEZUiMwNCmdg@mail.gmail.com  

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

Set client encoding to UTF8 for the citext regression script

commit   : 890faaf1957759c6e17fbcbfd16f7cabc4a59d07    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 19 Sep 2017 14:51:51 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 19 Sep 2017 14:51:51 -0400    

Click here for diff

Problem introduced with non-ascii characters in commit f2464997644c  
and discovered on various buildfarm animals.  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql

Make new crash restart test a bit more robust.

commit   : 1910353675bd149e1020b29c0fae02538fc358cd    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 10:32:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Sep 2017 10:32:51 -0700    

Click here for diff

Add timeouts in case psql doesn't deliver the expected output, and try  
to cause the monitoring psql to be fully connected to a backend.  This  
isn't necessarily everything needed, but at least the timeouts should  
reduce the pain for buildfarm owners.  
  
Author: Andres Freund  
Reported-By: Tom Lane, BF animals prairiedog and calliphoridae  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

doc: add example of % substitution for connection URIs

commit   : d61f5bb7c444255b064a60df782907f7dddad61a    
  
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

Add citext_pattern_ops for citext contrib module

commit   : f2464997644c64b5dec93ab3c08305f48bfe14f1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 19 Sep 2017 08:31:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 19 Sep 2017 08:31:45 -0400    

Click here for diff

This is similar to text_pattern_ops.  
  
Alexey Chernyshov, reviewed by Jacob Champion.  

M contrib/citext/citext–1.4–1.5.sql
M contrib/citext/citext.c
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql

Rearm statement_timeout after each executed query.

commit   : f8e5f156b30efee5d0038b03e38735773abcb7ed    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Sep 2017 19:36:44 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Sep 2017 19:36:44 -0700    

Click here for diff

Previously statement_timeout, in the extended protocol, affected all  
messages till a Sync message.  For clients that pipeline/batch query  
execution that's problematic.  
  
Instead disable timeout after each Execute message, and enable, if  
necessary, the timer in start_xact_command(). As that's done only for  
Execute and not Parse / Bind, pipelining the latter two could still  
cause undesirable timeouts. But a survey of protocol implementations  
shows that all drivers issue Sync messages when preparing, and adding  
timeout rearming to both is fairly expensive for the common parse /  
bind / execute sequence.  
  
Author: Tatsuo Ishii, editorialized by Andres Freund  
Reviewed-By: Takayuki Tsunakawa, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c

Fix uninitialized variable in dshash.c.

commit   : 0fb9e4ace5ce4d479d839a720f32b99fdc87f455    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Sep 2017 17:43:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Sep 2017 17:43:37 -0700    

Click here for diff

A bugfix for commit 8c0d7bafad36434cb08ac2c78e69ae72c194ca20.  The code  
would have crashed if hashtable->size_log2 ever had the same value as  
hashtable->control->size_log2 by coincidence.  
  
Per Valgrind.  
  
Author: Thomas Munro  
Reported-By: Tomas Vondra  
Discussion: https://postgr.es/m/e72fb33c-4f31-f276-e972-263d9b59554d%402ndquadrant.com  

M src/backend/lib/dshash.c

Add test for postmaster crash restarts.

commit   : a1924a4ea29399111e5155532ca24c9c51d3c82d    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Sep 2017 23:05:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Sep 2017 23:05:58 -0700    

Click here for diff

Given that I managed to break this...  We probably should extend the  
tests to also cover other sub-processes dying, but that's something  
for later.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

A src/test/recovery/t/013_crash_restart.pl

Fix crash restart bug introduced in 8356753c212.

commit   : ec9e05b3c392ba9587f283507459737684539574    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Sep 2017 01:00:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Sep 2017 01:00:39 -0700    

Click here for diff

The bug was caused by not re-reading the control file during crash  
recovery restarts, which lead to an attempt to pfree() shared memory  
contents. The fix is to re-read the control file, which seems good  
anyway.  
  
It's unclear as of this moment, whether we want to keep the  
refactoring introduced in the commit referenced above, or come up with  
an alternative approach. But fixing the bug in the mean time seems  
like a good idea regardless.  
  
A followup commit will introduce regression test coverage for crash  
restarts.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/include/access/xlog.h

Minor code-cleanliness improvements for btree.

commit   : eb5c404b17752ca566947f12cb702438dcccdcb1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 16:36:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 16:36:28 -0400    

Click here for diff

Make the btree page-flags test macros (P_ISLEAF and friends) return clean  
boolean values, rather than values that might not fit in a bool.  Use them  
in a few places that were randomly referencing the flag bits directly.  
  
In passing, change access/nbtree/'s only direct use of BUFFER_LOCK_SHARE to  
BT_READ.  (Some think we should go the other way, but as long as we have  
BT_READ/BT_WRITE, let's use them consistently.)  
  
Masahiko Sawada, reviewed by Doug Doole  
  
Discussion: https://postgr.es/m/CAD21AoBmWPeN=WBB5Jvyz_Nt3rmW1ebUyAnk3ZbJP3RMXALJog@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h

Make ExplainOpenGroup and ExplainCloseGroup public.

commit   : 66917bfaa7bb0b6bae52a5fe631a8b6443203f55    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 16:01:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 16:01:16 -0400    

Click here for diff

Extensions with custom plan nodes might like to use these in their  
EXPLAIN output.  
  
Hadi Moshayedi  
  
Discussion: https://postgr.es/m/CA+_kT_dU-rHCN0u6pjA6bN5CZniMfD=-wVqPY4QLrKUY_uJq5w@mail.gmail.com  

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

Make DatumGetFoo/PG_GETARG_FOO/PG_RETURN_FOO macro names more consistent.

commit   : 4bd1994650fddf49e717e35f1930d62208845974    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 15:21:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Sep 2017 15:21:23 -0400    

Click here for diff

By project convention, these names should include "P" when dealing with a  
pointer type; that is, if the result of a GETARG macro is of type FOO *,  
it should be called PG_GETARG_FOO_P not just PG_GETARG_FOO.  Some newer  
types such as JSONB and ranges had not followed the convention, and a  
number of contrib modules hadn't gotten that memo either.  Rename the  
offending macros to improve consistency.  
  
In passing, fix a few places that thought PG_DETOAST_DATUM() returns  
a Datum; it does not, it returns "struct varlena *".  Applying  
DatumGetPointer to that happens not to cause any bad effects today,  
but it's formally wrong.  Also, adjust an ltree macro that was designed  
without any thought for what pgindent would do with it.  
  
This is all cosmetic and shouldn't have any impact on generated code.  
  
Mark Dilger, some further tweaks by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/btree_text.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M contrib/cube/cubedata.h
M contrib/hstore/hstore.h
M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltree_op.c
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/ltxtquery_op.c
M contrib/ltree_plpython/ltree_plpython.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/tsgistidx.c
M src/include/utils/array.h
M src/include/utils/jsonb.h
M src/include/utils/rangetypes.h

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

commit   : 3e1683d37e1d751eb2df9a5cb0507bebc6cf7d05    
  
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   : 4b17c894293d0c3ed944da76aeb9bc2bb02a6db6    
  
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   : d31892e2105cf48d8430807d74d5fdf1434af541    
  
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

Fix DROP SUBSCRIPTION hang

commit   : 8edacab209957520423770851351ab4013cb0167    
  
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   : 68ab9acd8557a9401a115a5369a14bf0a169e8e7    
  
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   : 6f44fe7f121ac7c29c1ac8553e4e209f9c3bfbcb    
  
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   : 27c6619e9c8ff80cd78c7f66443aa005734cda90    
  
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   : fd31f9f033213e2ebf00b57ef837e1828c338fc4    
  
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

Fix bogus size calculation introduced by commit cc5f81366.

commit   : cad22075bc2ce9c1fbe61e8d3969d4dbdb5bc1f3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 11:35:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Sep 2017 11:35:27 -0400    

Click here for diff

The elements of RecordCacheArray are TupleDesc, not TupleDesc *.  
Those are actually the same size, so that this error is harmless,  
but it's still wrong --- and it might bite us someday, if TupleDesc  
ever became a struct, say.  
  
Per Coverity.  

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

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

commit   : 936df5ba80a46fb40bfc93da49a709cbc0aafe5e    
  
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   : 0f79440fb0b4c5a9baa9a95570c01828a9093802    
  
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   : 04b64b8ddf9926950fe86d7d489825c46665dc01    
  
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   : 9361f6f54e3ff9bab84e80d4b1e15be79b48d60e    
  
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

src/test/ldap: Fix test function in Linux port

commit   : c29145f00df2aa873672ab9f1b3fc4ec6a0ec05d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 16 Sep 2017 00:39:37 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 16 Sep 2017 00:39:37 +0200    

Click here for diff

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

Apply pg_get_serial_sequence() to identity column sequences as well

commit   : 3012061b8653a57a098c85f06f1f80ec9576711b    
  
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 LDAP authentication test suite

commit   : f0e60ee4bc04fd4865dbaf2139d50d6fe71c1bc3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Sep 2017 11:41:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Sep 2017 11:41:15 -0400    

Click here for diff

Like the SSL test suite, this will not be run by default.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/test/Makefile
A src/test/ldap/.gitignore
A src/test/ldap/Makefile
A src/test/ldap/README
A src/test/ldap/authdata.ldif
A src/test/ldap/t/001_auth.pl

Get rid of shared_record_typmod_registry_worker_detach; it doesn't work.

commit   : 71aa4801a8184eb422c6bf51631bda76f1011278    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2017 10:52:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2017 10:52:30 -0400    

Click here for diff

This code is unsafe, as proven by buildfarm failures, because it tries  
to access shared memory that might already be gone.  It's also unnecessary,  
because we're about to exit the process anyway and so the record type cache  
should never be accessed again.  The idea was to lay some foundations for  
someday recycling workers --- which would require attaching to a different  
shared tupdesc registry --- but that will require considerably more  
thought.  In the meantime let's save some bytes by just removing the  
nonfunctional code.  
  
Problem identification, and proposal to fix by removing functionality  
from the detach function, by Thomas Munro.  I went a bit further by  
removing the function altogether.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Test coverage for CREATE/ALTER FOREIGN DATA WRAPPER .. HANDLER.

commit   : 60cd2f8a2d1a1e763b2df015e2e660caa9e39a67    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 15 Sep 2017 08:07:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 15 Sep 2017 08:07:22 -0400    

Click here for diff

Amit Langote, per a suggestion from Mark Dilger.  Reviewed by  
Marc Dilger and Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/CAFjFpReL0oeN7SCpnsEPbqJhB2Bp1wnH1uvbOF_w6KEuv6ZXvg@mail.gmail.com  

M src/test/regress/expected/foreign_data.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/regress.c
M src/test/regress/sql/foreign_data.sql

Don't use anonymous unions.

commit   : eaa4070543c2e36f0521f831d051265139875254    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2017 00:57:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2017 00:57:38 -0400    

Click here for diff

Commit cc5f81366c36b3dd8f02bd9be1cf75b2cc8482bd introduced a language  
feature that is not acceptable to strict C89 compilers.  
  
Thomas Munro  
  
Per buildfarm.  

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

Avoid duplicate typedef for SharedRecordTypmodRegistry.

commit   : fba366555659fc1dc66a825196be3cc68640d289    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2017 00:25:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Sep 2017 00:25:33 -0400    

Click here for diff

This isn't our usual solution for such problems, and older compilers  
(not terribly old, either) don't like it.  
  
Per buildfarm and local testing.  

M src/include/access/session.h

Remove TupleDesc remapping logic from tqueue.c.

commit   : 6b65a7fe62e129d5c2b85cd74d6a91d8f7564608    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Sep 2017 19:59:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Sep 2017 19:59:02 -0700    

Click here for diff

With the introduction of a shared memory record typmod registry, it is no  
longer necessary to remap record typmods when sending tuples between backends  
so most of tqueue.c can be removed.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com  

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
M src/include/executor/tqueue.h

Add support for coordinating record typmods among parallel workers.

commit   : cc5f81366c36b3dd8f02bd9be1cf75b2cc8482bd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Sep 2017 19:59:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Sep 2017 19:59:21 -0700    

Click here for diff

Tuples can have type RECORDOID and a typmod number that identifies a blessed  
TupleDesc in a backend-private cache.  To support the sharing of such tuples  
through shared memory and temporary files, provide a typmod registry in  
shared memory.  
  
To achieve that, introduce per-session DSM segments, created on demand when a  
backend first runs a parallel query.  The per-session DSM segment has a  
table-of-contents just like the per-query DSM segment, and initially the  
contents are a shared record typmod registry and a DSA area to provide the  
space it needs to grow.  
  
State relating to the current session is accessed via a Session object  
reached through global variable CurrentSession that may require significant  
redesign further down the road as we figure out what else needs to be shared  
or remodelled.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com  

M src/backend/access/common/Makefile
A src/backend/access/common/session.c
M src/backend/access/common/tupdesc.c
M src/backend/access/transam/parallel.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/init/postinit.c
A src/include/access/session.h
M src/include/access/tupdesc.h
M src/include/storage/lwlock.h
M src/include/utils/typcache.h
M src/tools/pgindent/typedefs.list

isn: Fix debug code

commit   : 9b6cb4650bc6a56114000678c1944afdb95f8333    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

The ISN_DEBUG code did not compile.  Fix that code, don't hide it behind  
an #ifdef, make it run when building with asserts, and make it error out  
instead of just logging if it fails.  
  
Reviewed-by: David Steele <[email protected]>  

M contrib/isn/isn.c

pg_archivecleanup: Add test suite

commit   : 98470fdfa72b78ec49dea9a25e658876e6e51989    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

Reviewed-by: David Steele <[email protected]>  

M src/bin/pg_archivecleanup/.gitignore
M src/bin/pg_archivecleanup/Makefile
A src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl

passwordcheck: Add test suite

commit   : af7211e92dc2bba66f90de9e5bea6ae5fa914c61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

Also improve one error message.  
  
Reviewed-by: David Steele <[email protected]>  

A contrib/passwordcheck/.gitignore
M contrib/passwordcheck/Makefile
A contrib/passwordcheck/expected/passwordcheck.out
M contrib/passwordcheck/passwordcheck.c
A contrib/passwordcheck/passwordcheck.conf
A contrib/passwordcheck/sql/passwordcheck.sql

chkpass: Add test suite

commit   : 8423bf4f25ecd7afdd1d89adfbf29ea28992678f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

Reviewed-by: David Steele <[email protected]>  

A contrib/chkpass/.gitignore
M contrib/chkpass/Makefile
A contrib/chkpass/expected/chkpass.out
A contrib/chkpass/sql/chkpass.sql

lo: Add test suite

commit   : 4cb89d830626d009ed6a4482bed3a141c5039a7c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

Reviewed-by: David Steele <[email protected]>  

A contrib/lo/.gitignore
M contrib/lo/Makefile
A contrib/lo/expected/lo.out
A contrib/lo/sql/lo.sql
M doc/src/sgml/lo.sgml

fuzzystrmatch: Add test suite

commit   : 6141123a827a47d02b8b6c8eb97643c33aa4461d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

Reviewed-by: David Steele <[email protected]>  

A contrib/fuzzystrmatch/.gitignore
M contrib/fuzzystrmatch/Makefile
A contrib/fuzzystrmatch/expected/fuzzystrmatch.out
A contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
M doc/src/sgml/fuzzystrmatch.sgml

adminpack: Add test suite

commit   : b28dfa6d6f4e9a7a518d3c22b28375cad8a22272    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Aug 2017 21:04:04 -0400    

Click here for diff

Reviewed-by: David Steele <[email protected]>  

A contrib/adminpack/.gitignore
M contrib/adminpack/Makefile
A contrib/adminpack/expected/adminpack.out
A contrib/adminpack/sql/adminpack.sql

Add missing tags to GetCommandLogLevel.

commit   : 81276fdd3931d286e62b86b2512a517de2ba2de8    
  
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

Perform only one ReadControlFile() during startup.

commit   : 8356753c212a5865469c9befc4cf1e637a9d8bbc    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Sep 2017 02:12:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Sep 2017 02:12:17 -0700    

Click here for diff

Previously we read the control file in multiple places. But soon the  
segment size will be configurable and stored in the control file, and  
that needs to be available earlier than it currently is needed.  
  
Instead of adding yet another place where it's read, refactor things  
so there's a single processing of the control file during startup (in  
EXEC_BACKEND that's every individual backend's startup).  
  
Author: Andres Freund  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/include/access/xlog.h

Expand partitioned table RTEs level by level, without flattening.

commit   : 0a480502b092195a9b25a2f0f199a21d592a9c57    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 15:41:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 15:41:08 -0400    

Click here for diff

Flattening the partitioning hierarchy at this stage makes various  
desirable optimizations difficult.  The original use case for this  
patch was partition-wise join, which wants to match up the partitions  
in one partitioning hierarchy with those in another such hierarchy.  
However, it now seems that it will also be useful in making partition  
pruning work using the PartitionDesc rather than constraint exclusion,  
because with a flattened expansion, we have no easy way to figure out  
which PartitionDescs apply to which leaf tables in a multi-level  
partition hierarchy.  
  
As it turns out, we end up creating both rte->inh and !rte->inh RTEs  
for each intermediate partitioned table, just as we previously did for  
the root table.  This seems unnecessary since the partitioned tables  
have no storage and are not scanned.  We might want to go back and  
rejigger things so that no partitioned tables (including the parent)  
need !rte->inh RTEs, but that seems to require some adjustments not  
related to the core purpose of this patch.  
  
Ashutosh Bapat, reviewed by me and by Amit Langote.  Some final  
adjustments by me.  
  
Discussion: http://postgr.es/m/CAFjFpRd=1venqLL7oGU=C1dEkuvk2DJgvF+7uKbnPHaum1mvHQ@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/include/nodes/relation.h
M src/test/regress/expected/inherit.out
M src/test/regress/expected/join.out
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/join.sql

Avoid use of bool in thread_test.c

commit   : 0c4b879b74f891c19b3b431c5f34f94e50daa09b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    

Click here for diff

It's not necessary for such a small program, and it causes unnecessary  
extra work to get the correct definition of bool, more so if we are  
going to introduce stdbool.h later.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/test/thread/thread_test.c

Make RelationGetPartitionDispatchInfo expand depth-first.

commit   : 77b6b5e9ceca04dbd6f0f6cd3fc881519acc8714    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 12:28:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Sep 2017 12:28:50 -0400    

Click here for diff

With this change, the order of leaf partitions as returned by  
RelationGetPartitionDispatchInfo should now be the same as the  
order used by expand_inherited_rtentry.  This will make it simpler  
for future patches to match up the partition dispatch information  
with the planner data structures.  The new code is also, in my  
opinion anyway, simpler and easier to understand.  
  
Amit Langote, reviewed by Amit Khandekar.  I also reviewed and  
made a few cosmetic revisions.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Remove BoolPtr type

commit   : 8951c65df2701a4620ea43f12b9fbabdb653c164    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    

Click here for diff

Not used and doesn't seem useful.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/include/c.h

Fix bool/int type confusion

commit   : 0ec2e908babfbfde83a3925680f06b16408739ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 00:22:32 -0400    

Click here for diff

Using ++ on a bool variable doesn't work well when stdbool.h is in use.  
The original BSD code appears to use int here, so use that instead.  
  
Reviewed-by: Thomas Munro <[email protected]>  

M src/timezone/localtime.c

Fix inconsistent capitalization.

commit   : 42651bdd68a123544d5bfd0773a170aa3b443f1b    
  
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   : 1555566d9ee1a996a28cc4601840a67831112695    
  
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   : 1ab973ab600dc4295dbbd38d1643f9bd26f81d8e    
  
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   : d2e40b310aea1050fd499f62f391329f2c331f6a    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 13 Sep 2017 20:02:09 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 13 Sep 2017 20:02:09 -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

Adjust unstable regression test case.

commit   : 76e134fefd7de0554536e1b8d45a1878f96cf9c0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Sep 2017 12:27:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Sep 2017 12:27:01 -0400    

Click here for diff

Test queries added by commit 69835bc89 are giving unexpected results  
on some smaller buildfarm critters.  I think probably the seqscan  
logic is kicking in to cause the scans to not start at the beginning  
of the table.  Add ORDER BY to make them be indexscans instead.  
  
Per buildfarm member chipmunk.  

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

Update contrib/seg for new scalarlesel/scalargesel selectivity functions.

commit   : 44ba2920644903d7dfceda810e5facdbcbab58a8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Sep 2017 11:54:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Sep 2017 11:54:55 -0400    

Click here for diff

I somehow missed this module in commit 7d08ce286.  

M contrib/seg/Makefile
A contrib/seg/seg–1.1–1.2.sql
M contrib/seg/seg.control

Distinguish selectivity of < from <= and > from >=.

commit   : 7d08ce286cd5854d58152e428c28636a616bdc42    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Sep 2017 11:12:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Sep 2017 11:12:39 -0400    

Click here for diff

Historically, the selectivity functions have simply not distinguished  
< from <=, or > from >=, arguing that the fraction of the population that  
satisfies the "=" aspect can be considered to be vanishingly small, if the  
comparison value isn't any of the most-common-values for the variable.  
(If it is, the code path that executes the operator against each MCV will  
take care of things properly.)  But that isn't really true unless we're  
dealing with a continuum of variable values, and in practice we seldom are.  
If "x = const" would estimate a nonzero number of rows for a given const  
value, then it follows that we ought to estimate different numbers of rows  
for "x < const" and "x <= const", even if the const is not one of the MCVs.  
Handling this more honestly makes a significant difference in edge cases,  
such as the estimate for a tight range (x BETWEEN y AND z where y and z  
are close together).  
  
Hence, split scalarltsel into scalarltsel/scalarlesel, and similarly  
split scalargtsel into scalargtsel/scalargesel.  Adjust <= and >=  
operator definitions to reference the new selectivity functions.  
Improve the core ineq_histogram_selectivity() function to make a  
correction for equality.  (Along the way, I learned quite a bit about  
exactly why that function gives good answers, which I tried to memorialize  
in improved comments.)  
  
The corresponding join selectivity functions were, and remain, just stubs.  
But I chose to split them similarly, to avoid confusion and to prevent the  
need for doing this exercise again if someone ever makes them less stubby.  
  
In passing, change ineq_histogram_selectivity's clamp for extreme  
probability estimates so that it varies depending on the histogram  
size, instead of being hardwired at 0.0001.  With the default histogram  
size of 100 entries, you still get the old clamp value, but bigger  
histograms should allow us to put more faith in edge values.  
  
Tom Lane, reviewed by Aleksander Alekseev and Kuntal Ghosh  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/Makefile
A contrib/citext/citext–1.4–1.5.sql
M contrib/citext/citext.control
M contrib/cube/Makefile
A contrib/cube/cube–1.2–1.3.sql
M contrib/cube/cube.control
M contrib/hstore/Makefile
A contrib/hstore/hstore–1.4–1.5.sql
M contrib/hstore/hstore.control
M contrib/isn/Makefile
A contrib/isn/isn–1.1–1.2.sql
M contrib/isn/isn.control
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xoper.sgml
M src/backend/optimizer/path/clausesel.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/selfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/tutorial/complex.source

doc: Remove incorrect SCRAM protocol documentation

commit   : 089880ba9af5f95e1a3b050874a90dbe5c33fd61    
  
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   : 82e367ddbfdf798ea8a30da15db3984017277342    
  
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   : 9521ce4a7a1125385fb4de9689f345db594c516a    
  
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   : 61975d6c2cf5bbcf40a2e3160914ecad7a21df1a    
  
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

Define LDAP_NO_ATTRS if necessary.

commit   : 1a2fdc99a4b341feb6c01304e58f01dd0e095d9a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Sep 2017 08:20:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Sep 2017 08:20:45 -0400    

Click here for diff

Commit 83aaac41c66959a3ebaec7daadc4885b5f98f561 introduced the use of  
LDAP_NO_ATTRS to avoid requesting a dummy attribute when doing search+bind  
LDAP authentication.  It turns out that not all LDAP implementations define  
that macro, but its value is fixed by the protocol so we can define it  
ourselves if it's missing.  
  
Author: Thomas Munro  
Reported-By: Ashutosh Sharma  
Discussion: https://postgr.es/m/CAE9k0Pm6FKCfPCiAr26-L_SMGOA7dT_k0%2B3pEbB8%2B-oT39xRpw%40mail.gmail.com  

M src/backend/libpq/auth.c

Add psql variables to track success/failure of SQL queries.

commit   : 69835bc8988812c960f4ed5aeee86b62ac73602a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Sep 2017 19:27:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Sep 2017 19:27:48 -0400    

Click here for diff

This patch adds ERROR, SQLSTATE, and ROW_COUNT, which are updated after  
every query, as well as LAST_ERROR_MESSAGE and LAST_ERROR_SQLSTATE,  
which are updated only when a query fails.  The expected usage of these  
is for scripting.  
  
Fabien Coelho, reviewed by Pavel Stehule  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704042158020.12290@lancre  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/startup.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Introduce BYTES unit for GUCs.

commit   : 6e7baa322773ff8c79d4d8883c99fdeff5bfa679    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Sep 2017 12:13:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Sep 2017 12:13:12 -0700    

Click here for diff

This is already useful for track_activity_query_size, and will further  
be used in a later commit making the WAL segment size configurable.  
  
Author: Beena Emerson  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAOG9ApEu8bXVwBxkOO9J7ZpM76TASK_vFMEEiCEjwhMmSLiaqQ@mail.gmail.com  

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

docs: improve pg_upgrade rsync instructions

commit   : 2d4a614e1ec34a746aca43d6a02aa3344dcf5fd4    
  
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

doc: Remove useless marked section

commit   : 2eeaa74b5ba20bc75bbaf10837a1ae966094d6cc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Sep 2017 10:55:04 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Sep 2017 10:55:04 -0400    

Click here for diff

This was left around when this text was moved from installation.sgml in  
c5ba11f8fb1701441b96a755ea410b96bfe36170.  

M doc/src/sgml/runtime.sgml

doc: Document default scope in LDAP URL

commit   : 58bd60995f1c7470c0542f591b303bcc586a5d5f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Sep 2017 10:02:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Sep 2017 10:02:34 -0400    

Click here for diff

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

Allow custom search filters to be configured for LDAP auth

commit   : 83aaac41c66959a3ebaec7daadc4885b5f98f561    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Sep 2017 09:46:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Sep 2017 09:46:14 -0400    

Click here for diff

Before, only filters of the form "(<ldapsearchattribute>=<user>)"  
could be used to search an LDAP server.  Introduce ldapsearchfilter  
so that more general filters can be configured using patterns, like  
"(|(uid=$username)(mail=$username))" and "(&(uid=$username)  
(objectClass=posixAccount))".  Also allow search filters to be included  
in an LDAP URL.  
  
Author: Thomas Munro  
Reviewed-By: Peter Eisentraut, Mark Cave-Ayland, Magnus Hagander  
Discussion: https://postgr.es/m/CAEepm=0XTkYvMci0WRubZcf_1am8=gP=7oJErpsUfRYcKF2gwg@mail.gmail.com  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h

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

commit   : 35e15688269a2af13f4cddff0c13536a9a42115d    
  
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 RecursiveCopy.pm to cope with disappearing files.

commit   : e183530550dc1b73d24fb5ae7d84e85286e88ffb    
  
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   : 57e1c007939447ecf8c2d2aa2f507124613324ad    
  
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   : 3126433ae7464ffc25a8317110e79defaa3d8865    
  
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

pg_receivewal: Add --endpos option

commit   : 6d9fa52645e71711410a66b5349df3be0dd49608    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 16:30:50 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 16:30:50 -0400    

Click here for diff

This is primarily useful for making tests of this utility more  
deterministic, to avoid the complexity of starting pg_receivewal as a  
deamon in TAP tests.  
  
While this is less useful than the equivalent pg_recvlogical option,  
users can as well use it for example to enforce WAL streaming up to a  
end-of-backup position, to save only a minimal amount of WAL.  
  
Use this new option to stream WAL data in a deterministic way within a  
new set of TAP tests.  
  
Author: Michael Paquier <[email protected]>  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Constify numeric.c.

commit   : c1898c3e1e235ae35b4759d233253eff221b976a    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 10 Sep 2017 16:20:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 10 Sep 2017 16:20:41 -0700    

Click here for diff

This allows the compiler/linker to move the static variables to a  
read-only segment.  Not all the signature changes are necessary, but  
it seems better to apply const in a consistent manner.  
  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Prefer argument name over "$n" for the refname of a plpgsql argument.

commit   : b8060e41b5994a3cffb3ececaab10ed39b8d5dfd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Sep 2017 16:24:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Sep 2017 16:24:34 -0400    

Click here for diff

If a function argument has a name, use that as the "refname" of the  
PLpgSQL_datum representing the argument, instead of $n as before.  
This allows better error messages in some cases.  
  
Pavel Stehule, reviewed by Jeevan Chalke  
  
Discussion: https://postgr.es/m/CAFj8pRB9GyU2U1Sb2ssgP26DZ_yq-FYDfpvUvGQ=k4R=yOPVjg@mail.gmail.com  

M src/pl/plpgsql/src/pl_comp.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

doc: Document function pointer source code style

commit   : 3612019a7925012445af29b9ea7af84bd68a5932    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 14:47:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Sep 2017 14:47:15 -0400    

Click here for diff

as implemented in 1356f78ea93395c107cbc75dc923e29a0efccd8a  

M doc/src/sgml/sources.sgml

Message style fixes

commit   : 821fb8cdbf700a8aadbe12d5b46ca4e61be5a8a8    
  
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   : 3c435952176ae5d294b37e5963cd72ddb66edead    
  
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

Add a test harness for the red-black tree code.

commit   : 610bbdd8acfcbeedad1176188f53ce5c7905e280    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Sep 2017 13:26:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Sep 2017 13:26:46 -0400    

Click here for diff

This improves the regression tests' coverage of rbtree.c from pretty  
awful (because some of the functions aren't used yet) to basically 100%.  
  
Victor Drobny, reviewed by Aleksander Alekseev and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/Makefile
A src/test/modules/test_rbtree/.gitignore
A src/test/modules/test_rbtree/Makefile
A src/test/modules/test_rbtree/README
A src/test/modules/test_rbtree/expected/test_rbtree.out
A src/test/modules/test_rbtree/sql/test_rbtree.sql
A src/test/modules/test_rbtree/test_rbtree–1.0.sql
A src/test/modules/test_rbtree/test_rbtree.c
A src/test/modules/test_rbtree/test_rbtree.control

Remove pre-order and post-order traversal logic for red-black trees.

commit   : f80e782a6b4dcdea78f053f1505fff316f3a3289    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Sep 2017 13:19:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Sep 2017 13:19:11 -0400    

Click here for diff

This code isn't used, and there's no clear reason why anybody would ever  
want to use it.  These traversal mechanisms don't yield a visitation order  
that is semantically meaningful for any external purpose, nor are they  
any faster or simpler than the left-to-right or right-to-left traversals.  
(In fact, some rough testing suggests they are slower :-(.)  Moreover,  
these mechanisms are impossible to test in any arm's-length fashion; doing  
so requires knowledge of the red-black tree's internal implementation.  
Hence, let's just jettison them.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_upgrade: Message style fixes

commit   : c824c7e29fe752110346fc821ad6d01357aa12f8    
  
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 failure-to-copy bug in commit 6f6b99d13.

commit   : fdf87ed451ef1ccb710f4e65dddbc6da17e92ba7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 20:45:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 20:45:31 -0400    

Click here for diff

The previous coding of get_qual_for_list() was careful to copy everything  
it was using from the input data structure.  The new version missed  
making a copy of pass-by-ref datum values that it's inserting into Consts.  
This is not optional, however, as revealed by buildfarm failures on  
machines running -DRELCACHE_FORCE_RELEASE: we're copying from a relcache  
entry that could go away before the required lifespan of our output  
expression.  I'm pretty sure -DCLOBBER_CACHE_ALWAYS machines won't like  
this either, but none of them have reported in yet.  

M src/backend/catalog/partition.c

Fix uninitialized-variable bug.

commit   : e56dd7cf5078d9651d715a72cd802a3aa346c63a    
  
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

Fix more portability issues in new pgbench TAP tests.

commit   : f25000c832f2e147986110116d4ba1a57b9d9256    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 17:37:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 17:37:43 -0400    

Click here for diff

Not completely sure, but I think bowerbird is spitting up on attempting  
to include ">" in a temporary file name.  (Why in the world are we  
writing this stuff into files at all?  A hash would be a better answer.)  

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

Allow a partitioned table to have a default partition.

commit   : 6f6b99d1335be8ea1b74581fc489a97b109dd08a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Sep 2017 17:28:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Sep 2017 17:28:04 -0400    

Click here for diff

Any tuples that don't route to any other partition will route to the  
default partition.  
  
Jeevan Ladhe, Beena Emerson, Ashutosh Bapat, Rahila Syed, and Robert  
Haas, with review and testing at various stages by (at least) Rushabh  
Lathia, Keith Fiske, Amit Langote, Amul Sul, Rajkumar Raghuanshi, Sven  
Kunze, Kyotaro Horiguchi, Thom Brown, Rafia Sabih, and Dilip Kumar.  
  
Discussion: http://postgr.es/m/CAH2L28tbN4SYyhS7YV1YBWcitkqbhSWfQCy0G=apRcC_PEO-bg@mail.gmail.com  
Discussion: http://postgr.es/m/CAOG9ApEYj34fWMcvBMBQ-YtqR9fTdXhdN82QEKG0SVZ6zeL1xg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.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/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/partition.h
M src/include/catalog/pg_partitioned_table.h
M src/include/commands/tablecmds.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/plancache.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/update.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/plancache.sql
M src/test/regress/sql/update.sql

Fix pgbench TAP tests to work with --disable-thread-safety.

commit   : 2cf15ec8b1cb29bea149559700566a21a790b6d3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 17:25:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 17:25:11 -0400    

Click here for diff

Probably matters to nobody but me; but I'd like to still be able to get  
through the TAP tests on gaur/pademelon, from time to time.  

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

Doc: update v10 release notes through today.

commit   : c1602c7a1b2e49acbba680cb72949d4fa3a8d2ee    
  
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   : 3cf17c9d47b1b427b7514c7baa6818a683293ff3    
  
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

Fix more portability issues in new pgbench TAP tests.

commit   : 933851033becf0848e0bb903f310bbd725e19489    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 14:01:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 14:01:51 -0400    

Click here for diff

Strike two on the --bad-option test.  
Three strikes and it's out.  
  
Fabien Coelho, per buildfarm  

M src/bin/pgbench/t/002_pgbench_no_server.pl

Fix more portability issues in new pgbench TAP tests.

commit   : 77d63b7eafd44469c2766c1f29b75533981e4911    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 13:36:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 13:36:13 -0400    

Click here for diff

* Remove no-such-user test case, output isn't stable, and we really  
don't need to be testing such cases here anyway.  
  
* Fix the process exit code test logic to match PostgresNode::psql  
(but I didn't bother with looking at the "core" flag).  
  
* Give up on inf/nan tests.  
  
Per buildfarm.  

M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/test/perl/TestLib.pm

Clean up excessive code

commit   : ee24d2b5cf059cab83711992c0cf110ad44df5f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:28:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:28:36 -0400    

Click here for diff

The encoding ID was converted between string and number too many times,  
probably a remnant from the shell script days.  
  
Reviewed-by: Aleksandr Parfenov <[email protected]>  

M src/bin/initdb/initdb.c

Remove useless empty string initializations

commit   : 8e673801262c66af4a54837f63ff596407835c20    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:28:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:28:36 -0400    

Click here for diff

This coding style probably stems from the days of shell scripts.  
  
Reviewed-by: Aleksandr Parfenov <[email protected]>  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c

Remove useless dead code

commit   : 9361bc347c85b685280fad742c519234d6e42bee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:28:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:28:36 -0400    

Click here for diff

Reviewed-by: Aleksandr Parfenov <[email protected]>  

M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
M src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc

Fix assorted portability issues in new pgbench TAP tests.

commit   : 869aa40a27fa4908ad4112f1079bf732d1a12e13    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 11:28:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 11:28:02 -0400    

Click here for diff

* Our own version of getopt_long doesn't support abbreviation of  
long options.  
  
* It doesn't do automatic rearrangement of non-option arguments to the end,  
either.  
  
* Test was way too optimistic about the platform independence of  
NaN and Infinity outputs.  I rather imagine we might have to lose  
those tests altogether, but for the moment just allow case variation  
and fully spelled out Infinity.  
  
Per buildfarm.  

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

Add much-more-extensive TAP tests for pgbench.

commit   : ed8a7c6fcf92b6b57ed8003bbd4a4eb92a6039bc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 09:32:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Sep 2017 09:32:50 -0400    

Click here for diff

Fabien Coelho, reviewed by Nikolay Shaplov and myself  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704171422500.4025@lancre  

D src/bin/pgbench/t/001_pgbench.pl
A src/bin/pgbench/t/001_pgbench_with_server.pl
A src/bin/pgbench/t/002_pgbench_no_server.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm

Refactor get_partition_for_tuple a bit.

commit   : f0a0c17c1b126882a37ec6bf42ab45a963794c3e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Sep 2017 21:07:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Sep 2017 21:07:47 -0400    

Click here for diff

Pending patches for both default partitioning and hash partitioning  
find the current coding pattern to be inconvenient.  Change it so that  
we switch on the partitioning method first and then do whatever is  
needed.  
  
Amul Sul, reviewed by Jeevan Ladhe, with a few adjustments by me.  
  
Discussion: http://postgr.es/m/CAAJ_b97mTb=dG2pv6+1ougxEVZFVnZJajW+0QHj46mEE7WsoOQ@mail.gmail.com  
Discussion: http://postgr.es/m/CAOgcT0M37CAztEinpvjJc18EdHfm23fw0EG9-36Ya=+rEFUqaQ@mail.gmail.com  

M src/backend/catalog/partition.c

Improve performance of get_actual_variable_range with recently-dead tuples.

commit   : 3ca930fc39ccf987c1c22fd04a1e7463b5dd0dfd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 19:41:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 19:41:51 -0400    

Click here for diff

In commit fccebe421, we hacked get_actual_variable_range() to scan the  
index with SnapshotDirty, so that if there are many uncommitted tuples  
at the end of the index range, it wouldn't laboriously scan through all  
of them looking for a live value to return.  However, that didn't fix it  
for the case of many recently-dead tuples at the end of the index;  
SnapshotDirty recognizes those as committed dead and so we're back to  
the same problem.  
  
To improve the situation, invent a "SnapshotNonVacuumable" snapshot type  
and use that instead.  The reason this helps is that, if the snapshot  
rejects a given index entry, we know that the indexscan will mark that  
index entry as killed.  This means the next get_actual_variable_range()  
scan will proceed past that entry without visiting the heap, making the  
scan a lot faster.  We may end up accepting a recently-dead tuple as  
being the estimated extremal value, but that doesn't seem much worse than  
the compromise we made before to accept not-yet-committed extremal values.  
  
The cost of the scan is still proportional to the number of dead index  
entries at the end of the range, so in the interval after a mass delete  
but before VACUUM's cleaned up the mess, it's still possible for  
get_actual_variable_range() to take a noticeable amount of time, if you've  
got enough such dead entries.  But the constant factor is much much better  
than before, since all we need to do with each index entry is test its  
"killed" bit.  
  
We chose to back-patch commit fccebe421 at the time, but I'm hesitant to  
do so here, because this form of the problem seems to affect many fewer  
people.  Also, even when it happens, it's less bad than the case fixed  
by commit fccebe421 because we don't get the contention effects from  
expensive TransactionIdIsInProgress tests.  
  
Dmitriy Sarafannikov, reviewed by Andrey Borodin  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/time/tqual.c
M src/include/utils/snapshot.h
M src/include/utils/tqual.h

Improve documentation about behavior of multi-statement Query messages.

commit   : b976499480bdbab6d69a11e47991febe53865adc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 14:04:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 14:04:41 -0400    

Click here for diff

We've long done our best to sweep this topic under the rug, but in view  
of recent work it seems like it's time to explain it more precisely.  
Here's an initial cut at doing that.  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F6BE40D@G01JPEXMBYT05  

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

Reduce excessive dereferencing of function pointers

commit   : 1356f78ea93395c107cbc75dc923e29a0efccd8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Sep 2017 12:06:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Sep 2017 12:06:23 -0400    

Click here for diff

It is equivalent in ANSI C to write (*funcptr) () and funcptr().  These  
two styles have been applied inconsistently.  After discussion, we'll  
use the more verbose style for plain function pointer variables, to make  
it clear that it's a variable, and the shorter style when the function  
pointer is in a struct (s.func() or s->func()), because then it's clear  
that it's not a plain function name, and otherwise the excessive  
punctuation makes some of those invocations hard to read.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M src/backend/access/transam/xact.c
M src/backend/commands/analyze.c
M src/backend/commands/portalcmds.c
M src/backend/commands/seclabel.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/nodes/params.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/smgr/smgr.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/cache/inval.c
M src/backend/utils/error/elog.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/wchar.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/resowner/resowner.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/psql/variables.c
M src/include/executor/executor.h
M src/include/utils/selfuncs.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c

Even if some partitions are foreign, allow tuple routing.

commit   : 9d71323daca412e6e175595e1e42809fb5e1172d    
  
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]  

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

Fix handling of savepoint commands within multi-statement Query strings.

commit   : 6eb52da3948dc8bc7c8a61cbacac14823b670c58    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 09:49:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 09:49:55 -0400    

Click here for diff

Issuing a savepoint-related command in a Query message that contains  
multiple SQL statements led to a FATAL exit with a complaint about  
"unexpected state STARTED".  This is a shortcoming of commit 4f896dac1,  
which attempted to prevent such misbehaviors in multi-statement strings;  
its quick hack of marking the individual statements as "not top-level"  
does the wrong thing in this case, and isn't a very accurate description  
of the situation anyway.  
  
To fix, let's introduce into xact.c an explicit model of what happens for  
multi-statement Query strings.  This is an "implicit transaction block  
in progress" state, which for many purposes works like the normal  
TBLOCK_INPROGRESS state --- in particular, IsTransactionBlock returns true,  
causing the desired result that PreventTransactionChain will throw error.  
But in case of error abort it works like TBLOCK_STARTED, allowing the  
transaction to be cancelled without need for an explicit ROLLBACK command.  
  
Commit 4f896dac1 is reverted in toto, so that we go back to treating the  
individual statements as "top level".  We could have left it as-is, but  
this allows sharpening the error message for PreventTransactionChain  
calls inside functions.  
  
Except for getting a normal error instead of a FATAL exit for savepoint  
commands, this patch should result in no user-visible behavioral change  
(other than that one error message rewording).  There are some things  
we might want to do in the line of changing the appearance or wording of  
error and warning messages around this behavior, which would be much  
simpler to do now that it's an explicitly modeled state.  But I haven't  
done them here.  
  
Although this fixes a long-standing bug, no backpatch.  The consequences  
of the bug don't seem severe enough to justify the risk that this commit  
itself creates some new issue.  
  
Patch by me, but it owes something to previous investigation by  
Takayuki Tsunakawa, who also reported the bug in the first place.  
Also thanks to Michael Paquier for reviewing.  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F6BE40D@G01JPEXMBYT05  

M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/include/access/xact.h
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

Further marginal hacking on generic atomic ops.

commit   : bfea92563c511931bc98163ec70ba2809b14afa1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 08:50:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Sep 2017 08:50:01 -0400    

Click here for diff

In the generic atomic ops that rely on a loop around a CAS primitive,  
there's no need to force the initial read of the "old" value to be atomic.  
In the typically-rare case that we get a torn value, that simply means  
that the first CAS attempt will fail; but it will update "old" to the  
atomically-read value, so the next attempt has a chance of succeeding.  
It was already being done that way in pg_atomic_exchange_u64_impl(),  
but let's duplicate the approach in the rest.  
  
(Given the current coding of the pg_atomic_read functions, this change  
is a no-op anyway on popular platforms; it only makes a difference where  
pg_atomic_read_u64_impl() is implemented as a CAS.)  
  
In passing, also remove unnecessary take-a-pointer-and-dereference-it  
coding in the pg_atomic_read functions.  That seems to have been based  
on a misunderstanding of what the C standard requires.  What actually  
matters is that the pointer be declared as pointing to volatile, which  
it is.  
  
I don't believe this will change the assembly code at all on x86  
platforms (even ignoring the likelihood that these implementations  
get overridden by others); but it may help on less-mainstream CPUs.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Exclude special values in recovery_target_time

commit   : f06588a8e6d1e2bf56f9dfa58d97e7956050ddc7    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 7 Sep 2017 04:56:34 -0700    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 7 Sep 2017 04:56:34 -0700    

Click here for diff

recovery_target_time accepts timestamp input, though  
does not allow use of special values, e.g. ā€œtodayā€.  
Report a useful error message for these cases.  
  
Reported-by: Piotr Stefaniak  
Author: Simon Riggs  
Discussion: https://postgr.es/m/CANP8+jJdKA+BkkYLWz9zAm16Y0s2ExBv0WfpAwXdTpPfWnA9Bg@mail.gmail.com  

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

Sync function prototype with its actual definition.

commit   : 793a89c1966733c84edacaa25ce47b72a75f3afb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 17:52:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 17:52:08 -0400    

Click here for diff

Use the same parameter names as in the definition.  Cosmetic fix only.  
  
Tatsuro Yamada  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

Merge duplicative code for \sf/\sv, \ef/\ev in psql/command.c.

commit   : ca4e20fde87d182aa699c5384fb1b6091f6e5f79    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 17:32:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 17:32:40 -0400    

Click here for diff

Saves ~150 lines, costs little.  
  
Fabien Coelho, reviewed by Victor Drobny  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1703311958001.14355@lancre  

M src/bin/psql/command.c

Allow SET STATISTICS on expression indexes

commit   : 5b6d13eec72b960eb0f78542199380e49c8583d4    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 6 Sep 2017 13:46:01 -0700    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 6 Sep 2017 13:46:01 -0700    

Click here for diff

Index columns are referenced by ordinal number rather than name, e.g.  
CREATE INDEX coord_idx ON measured (x, y, (z + t));  
ALTER INDEX coord_idx ALTER COLUMN 3 SET STATISTICS 1000;  
  
Incompatibility note for release notes:  
\d+ for indexes now also displays Stats Target  
  
Authors: Alexander Korotkov, with contribution by Adrien NAYRAT  
Review: Adrien NAYRAT, Simon Riggs  
Wordsmith: Simon Riggs  

M doc/src/sgml/ref/alter_index.sgml
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/utils/cache/syscache.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/nodes/parsenodes.h
M src/include/utils/syscache.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_index.out
M src/test/regress/sql/alter_table.sql

Use more of gcc's __sync_fetch_and_xxx builtin functions for atomic ops.

commit   : e09db94c0a5f3b440d96c5c9e8e6c1638d1ec39f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 14:21:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 14:21:39 -0400    

Click here for diff

In addition to __sync_fetch_and_add, gcc offers __sync_fetch_and_sub,  
__sync_fetch_and_and, and __sync_fetch_and_or, which correspond directly  
to primitive atomic ops that we want.  Testing shows that in some cases  
they generate better code than our generic implementations, so use them.  
  
We've assumed that configure's test for __sync_val_compare_and_swap is  
sufficient to allow assuming that __sync_fetch_and_add is available, so  
make the same assumption for these functions.  Should that prove to be  
wrong, we can add more configure tests.  
  
Yura Sokolov, reviewed by Jesper Pedersen and myself  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove duplicate reads from the inner loops in generic atomic ops.

commit   : e530be96859eb0a0e0bab98a79029268ddc98a1d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 14:06:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Sep 2017 14:06:09 -0400    

Click here for diff

The pg_atomic_compare_exchange_xxx functions are defined to update  
*expected to whatever they read from the target variable.  Therefore,  
there's no need to do additional explicit reads after we've initialized  
the "old" variable.  The actual benefit of this is somewhat debatable,  
but it seems fairly unlikely to hurt anything, especially since we  
will override the generic implementations in most performance-sensitive  
cases.  
  
Yura Sokolov, reviewed by Jesper Pedersen and myself  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Make function synopsis formatting more uniform

commit   : 34ae182833a4f69ad5d93f06588665a918ee5b03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Sep 2017 11:38:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Sep 2017 11:38:28 -0400    

Click here for diff

Whitespace use was inconsistent in the same chapter.  

M doc/src/sgml/fdwhandler.sgml

Escape < and & in SGML

commit   : 1c53f612bc8c9dbf97aa5a29910654a66dcdd307    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Sep 2017 11:22:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Sep 2017 11:22:43 -0400    

Click here for diff

This is not required in SGML, but will be in XML, so this is a step to  
prepare for the conversion to XML.  (It is still not required to escape  
>, but we did it here in some cases for symmetry.)  
  
Add a command-line option to osx/onsgmls calls to warn about unescaped  
occurrences in the future.  
  
Author: Alexander Law <[email protected]>  
Author: Peter Eisentraut <[email protected]>  

M doc/src/sgml/Makefile
M doc/src/sgml/array.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/syntax.sgml

Clean up handling of dropped columns in NAMEDTUPLESTORE RTEs.

commit   : 8689e38263af7755b8100203e325a5953ed1e602    
  
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

doc: Clarify pg_inherits description

commit   : 0b554e4e63a4ba4852c01951311713e23acdae02    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Sep 2017 21:35:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Sep 2017 21:35:59 -0400    

Click here for diff

Reported-by: [email protected]  

M doc/src/sgml/catalogs.sgml

Add \gdesc psql command.

commit   : 49ca462eb165dea297f1f110e8eac064308e9d51    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 18:17:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 18:17:47 -0400    

Click here for diff

This command acts somewhat like \g, but instead of executing the query  
buffer, it merely prints a description of the columns that the query  
result would have.  (Of course, this still requires parsing the query;  
if parse analysis fails, you get an error anyway.)  We accomplish this  
using an unnamed prepared statement, which should be invisible to psql  
users.  
  
Pavel Stehule, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/CAFj8pRBhYVvO34FU=EKb=nAF5t3b++krKt1FneCmR0kuF5m-QA@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/tab-complete.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Use lfirst_node() and linitial_node() where appropriate in planner.c.

commit   : 6e427aa4e5f3ad79a79b463c470daf93fa15767b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 15:57:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 15:57:48 -0400    

Click here for diff

There's no particular reason to target this module for the first  
wholesale application of these macros; but we gotta start somewhere.  
  
Ashutosh Bapat and Jeevan Chalke  
  
Discussion: https://postgr.es/m/CAFjFpRcNr3r=u0ni=7A4GD9NnHQVq+dkFafzqo2rS6zy=dt1eg@mail.gmail.com  

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

Remove endof macro

commit   : 153a49bb331005bf70b1e76e69fe28f1c417cc91    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    

Click here for diff

It has not been used in a long time, and it doesn't seem safe anyway, so  
drop it.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Ryan Murphy <[email protected]>  

M src/include/c.h

Remove unnecessary casts

commit   : ec3a4375961abaa209116162966bc7af2d51148a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Ryan Murphy <[email protected]>  

M contrib/cube/cube.c

Remove unnecessary parentheses in return statements

commit   : 17273d059cd3a5cba818505b0d47a444c36a3513    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    

Click here for diff

The parenthesized style has only been used in a few modules.  Change  
that to use the style that is predominant across the whole tree.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Ryan Murphy <[email protected]>  

M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/intarray/_int_bool.c
M contrib/ltree/ltxtquery_op.c
M contrib/pgcrypto/crypt-des.c
M contrib/pgstattuple/pgstatindex.c
M contrib/seg/seg.c
M contrib/spi/refint.c
M contrib/spi/timetravel.c
M doc/src/sgml/spi.sgml
M src/backend/bootstrap/bootscanner.l
M src/backend/tsearch/spell.c
M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/inet_net_pton.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/pgtypeslib/common.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/ecpg/test/compat_informix/dec_test.pgc
M src/interfaces/ecpg/test/compat_informix/describe.pgc
M src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc
M src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc
M src/interfaces/ecpg/test/compat_informix/sqlda.pgc
M src/interfaces/ecpg/test/connect/test1.pgc
M src/interfaces/ecpg/test/connect/test2.pgc
M src/interfaces/ecpg/test/connect/test3.pgc
M src/interfaces/ecpg/test/connect/test4.pgc
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
M src/interfaces/ecpg/test/expected/compat_informix-describe.c
M src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
M src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/connect-test1.c
M src/interfaces/ecpg/test/expected/connect-test2.c
M src/interfaces/ecpg/test/expected/connect-test3.c
M src/interfaces/ecpg/test/expected/connect-test4.c
M src/interfaces/ecpg/test/expected/connect-test5.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
M src/interfaces/ecpg/test/expected/preproc-cursor.c
M src/interfaces/ecpg/test/expected/preproc-define.c
M src/interfaces/ecpg/test/expected/preproc-describe.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c
M src/interfaces/ecpg/test/expected/preproc-strings.c
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/sql-array.c
M src/interfaces/ecpg/test/expected/sql-describe.c
M src/interfaces/ecpg/test/expected/sql-execute.c
M src/interfaces/ecpg/test/expected/sql-oldexec.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-twophase.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/performance/perftest.pgc
M src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc
M src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
M src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
M src/interfaces/ecpg/test/pgtypeslib/num_test.pgc
M src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc
M src/interfaces/ecpg/test/preproc/array_of_struct.pgc
M src/interfaces/ecpg/test/preproc/cursor.pgc
M src/interfaces/ecpg/test/preproc/define.pgc
M src/interfaces/ecpg/test/preproc/outofscope.pgc
M src/interfaces/ecpg/test/preproc/pointer_to_struct.pgc
M src/interfaces/ecpg/test/preproc/strings.pgc
M src/interfaces/ecpg/test/preproc/variable.pgc
M src/interfaces/ecpg/test/sql/array.pgc
M src/interfaces/ecpg/test/sql/describe.pgc
M src/interfaces/ecpg/test/sql/execute.pgc
M src/interfaces/ecpg/test/sql/oldexec.pgc
M src/interfaces/ecpg/test/sql/sqlda.pgc
M src/interfaces/ecpg/test/sql/twophase.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc
M src/test/isolation/specscanner.l

Remove our own definition of NULL

commit   : ba26f5cf768a31e0cbdf5eb8675ee187ad35fd0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    

Click here for diff

Surely everyone has that by now.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Ryan Murphy <[email protected]>  

M src/include/c.h

fuzzystrmatch: Remove dead code

commit   : 5a739e7b2c26aa95ee2871071c87fa248df1776b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Aug 2017 12:39:20 -0400    

Click here for diff

Remnants left behind by a323ede2802956f115d71599514fbc01f2575dee  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Ryan Murphy <[email protected]>  

M contrib/fuzzystrmatch/fuzzystrmatch.c

Support retaining data dirs on successful TAP tests

commit   : 90627cf98a8e7d0531789391fd798c9bfcc3bc1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Sep 2017 12:22:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Sep 2017 12:22:33 -0400    

Click here for diff

This moves the data directories from using temporary directories with  
randomness in the directory name to a static name, to make it easier to  
debug.  The data directory will be retained if tests fail or the test  
code dies/exits with failure, and is automatically removed on the next  
make check.  
  
If the environment variable PG_TEST_NOCLEAN is defined, the data  
directories will be retained regardless of test or exit status.  
  
Author: Daniel Gustafsson <[email protected]>  

M src/Makefile.global.in
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/test/perl/PostgresNode.pm

In psql, use PSQL_PAGER in preference to PAGER, if it's set.

commit   : 5e8304fdce2d5c41ef7a648ed0a622480f8f0a07    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 12:02:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 12:02:06 -0400    

Click here for diff

This allows the user's environment to set up a psql-specific choice  
of pager, in much the same way that we provide PSQL_EDITOR to allow  
a psql-specific override of the more widely known EDITOR variable.  
  
Pavel Stehule, reviewed by Thomas Munro  
  
Discussion: https://postgr.es/m/CAFj8pRD3RRk9S1eRbnGm_T6brc3Ss5mohraNzTSJquzx+pmtKA@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/help.c
M src/fe_utils/print.c
M src/interfaces/libpq/fe-print.c

Correct base backup throttling

commit   : ebd346caf41b8e8738a49d96797ceccd04bb04dc    
  
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

Add psql variables showing server version and psql version.

commit   : 9ae9d8c1549c384dbdb8363e1d932b7311d25c56    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 10:51:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 10:51:36 -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.  
  
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

Reformat psql's --help=variables output.

commit   : 3955c8c4eda2fd8cb7616285c55d98861382bb3a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 10:17:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Sep 2017 10:17:10 -0400    

Click here for diff

The previous format with variable names and descriptions in separate  
columns was extremely constraining about the length of the descriptions.  
We'd dealt with that in several inconsistent ways over the years,  
including letting the lines run over 80 characters, breaking descriptions  
into multiple lines, or shoving the description onto a separate line.  
But it's been a long time since the output could realistically fit onto  
a single screen vertically, so let's just rely even more heavily on the  
pager to deal with the vertical distance, and split each entry into two  
(or more) lines, in the format  
  
  variable-name  
    variable description goes here  
  
Each variable name + description remains a single translatable string,  
in hopes of reducing translator confusion; we're just changing the  
embedded whitespace.  
  
I failed to resist the temptation to copy-edit one or two of the  
descriptions while at it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/help.c

Be more careful about newline-chomping in pgbench.

commit   : 0b707d6ea75971fb464a74e7a6334e2d5ae822b7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Sep 2017 17:25:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Sep 2017 17:25:31 -0400    

Click here for diff

process_backslash_command would drop the last character of the input  
command on the assumption that it was a newline.  Given a non newline  
terminated input file, this could result in dropping the last character  
of the command.  Fix that by doing an actual test that we're removing  
a newline.  
  
While at it, allow for Windows newlines (\r\n), and suppress multiple  
newlines if any.  I do not think either of those cases really occur,  
since (a) we read script files in text mode and (b) the lexer stops  
when it hits a newline.  But it's cheap enough and it provides a  
stronger guarantee about what the result string looks like.  
  
This is just cosmetic, I think, since the possibly-overly-chomped  
line was only used for display not for further processing.  So  
it doesn't seem necessary to back-patch.  
  
Fabien Coelho, reviewed by Nikolay Shaplov, whacked around a bit by me  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704171422500.4025@lancre  

M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h

Fix some subtle problems in pgbench transaction stats counting.

commit   : c23bb6badfa2048d17c08ebcfd81adf942292e51    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Sep 2017 16:24:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Sep 2017 16:24:08 -0400    

Click here for diff

With --latency-limit, transactions might get skipped even beyond the  
transaction count limit specified by -t, throwing off the expected  
number of transactions and thus the denominator for later stats.  
Be sure to stop skipping transactions once -t is reached.  
  
Also, include skipped transactions in the "cnt" fields; this requires  
discounting them again in a couple of places, but most places are  
better off with this definition.  In particular this is needed to  
get correct overall stats for the combination of -R/-L/-t options.  
Merge some more processing into processXactStats() to simplify this.  
  
In passing, add a check that --progress-timestamp is specified only  
when --progress is.  
  
We might consider back-patching this, but given that it only matters  
for a combination of options, and given the lack of field complaints,  
consensus seems to be not to bother.  
  
Fabien Coelho, reviewed by Nikolay Shaplov  
  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704171422500.4025@lancre  

M src/bin/pgbench/pgbench.c

Adjust pgbench to allow non-ASCII characters in variable names.

commit   : 9d36a386608d7349964e76120e48987e3ec67d04    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Sep 2017 13:45:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Sep 2017 13:45:20 -0400    

Click here for diff

This puts it in sync with psql's notion of what is a valid variable name.  
Like psql, we document that "non-Latin letters" are allowed, but actually  
any non-ASCII character is accepted.  
  
Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c

Fix translatable string

commit   : 863d75439e8733b4bf6195a2c8a09966f04d8fbe    
  
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

Suppress compiler warnings in dshash.c.

commit   : 4faa1dc2eb02ba67303110e025d44abb40b12725    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Sep 2017 11:12:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Sep 2017 11:12:29 -0400    

Click here for diff

Some compilers complain, not unreasonably, about left-shifting an  
int32 "1" and then assigning the result to an int64.  In practice  
I sure hope that this data structure never gets large enough that  
an overflow would actually occur; but let's cast the constant to  
the right type to avoid the hazard.  
  
In passing, fix a typo in dshash.h.  
  
Amit Kapila, adjusted as per comment from Thomas Munro.  
  
Discussion: https://postgr.es/m/CAA4eK1+5vfVMYtjK_NX8O3-42yM3o80qdqWnQzGquPrbq6mb+A@mail.gmail.com  

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

Fix macro-redefinition warning on MSVC.

commit   : e451901804bd96a6b0fe3875b5c90aa0555c6a05    
  
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   : afc58affb6616a415ea991763e0383832346e7c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 23:34:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 23:34:12 -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   : 51daa7bdb39e1bdc31eb99fd3f54f61743ebb7ae    
  
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

Add memory info to getrusage output

commit   : c039ba0716383ccaf88c9be1a7f0803a77823de1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 15:36:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 15:36:33 -0400    

Click here for diff

Add the maxrss field to the getrusage output (log_*_stats).  This was  
previously omitted because of portability concerns, but we feel this  
might not be a concern anymore.  
  
based on patch by Justin Pryzby <[email protected]>  

M src/backend/tcop/postgres.c

Tighten up some code in RelationBuildPartitionDesc.

commit   : 0cb8b7531db063bce7def2ef24f616285f1f4b04    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 15:16:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 15:16:44 -0400    

Click here for diff

This probably doesn't save anything meaningful in terms of  
performance, but making the code simpler is a good idea anyway.  
  
Code by Beena Emerson, extracted from a larger patch by Jeevan  
Ladhe, slightly adjusted by me.  
  
Discussion: http://postgr.es/m/CAOgcT0ONgwajdtkoq+AuYkdTPY9cLWWLjxt_k4SXue3eieAr+g@mail.gmail.com  

M src/backend/catalog/partition.c

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

commit   : 9d6b160d7db76809f0c696d9073f6955dd5a973a    
  
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

doc: Remove mentions of server-side CRL and CA file names

commit   : a0572203532560423c92066b90d13383720dce3a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 14:18:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Sep 2017 14:18:45 -0400    

Click here for diff

Commit a445cb92ef5b3a31313ebce30e18cc1d6e0bdecb removed the default file  
names for server-side CRL and CA files, but left them in the docs with a  
small note.  This removes the note and the previous default names to  
clarify, as well as changes mentions of the file names to make it  
clearer that they are configurable.  
  
Author: Daniel Gustafsson <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/sslinfo.sgml

Ensure SIZE_MAX can be used throughout our code.

commit   : b79d69b087561eb6687373031a5098b0694f9ec6    
  
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

pg_dumpall: Add a -E flag to set the encoding, like pg_dump has.

commit   : 84be67181aab22ea8723ba0625ee690223cd8785    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 12:23:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 12:23:16 -0400    

Click here for diff

Michael Paquier, reviewed by Fabien Coelho  
  
Discussion: http://postgr.es/m/CAB7nPqQcYWmrm2n-dVaMUhYPKFU_DxQwPuUGuC4ZF+8B=dS5xQ@mail.gmail.com  

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

Provisional list of Major Features

commit   : 2f5ada2710d6e5a668d6d6b27f93ac545a01bafd    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 17:20:18 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 17:20:18 +0100    

Click here for diff

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

Use group updates when setting transaction status in clog.

commit   : baaf272ac908ea27c09076e34f62c45fa7d1e448    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 11:45:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 11:45:17 -0400    

Click here for diff

Commit 0e141c0fbb211bdd23783afa731e3eef95c9ad7a introduced a mechanism  
to reduce contention on ProcArrayLock by having a single process clear  
XIDs in the procArray on behalf of multiple processes, reducing the  
need to hand the lock around.  A previous attempt to introduce a similar  
mechanism for CLogControlLock in ccce90b398673d55b0387b3de66639b1b30d451b  
crashed and burned, but the design problem which resulted in those  
failures is believed to have been corrected in this version.  
  
Amit Kapila, with some cosmetic changes by me.  See the previous commit  
message for additional credits.  
  
Discussion: http://postgr.es/m/CAA4eK1KudxzgWhuywY_X=yeSAhJMT4DwCjroV5Ay60xaeB2Eew@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/lmgr/proc.c
M src/include/pgstat.h
M src/include/storage/proc.h

Fix two-phase commit test for recovery mode

commit   : 89c59b742a7f89eb598a25b70aaa3ab97381f67d    
  
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   : a6979c3a68e2caa6696021f7a15278a99e7409a1    
  
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   : 4f27c674fd9fb5ba1f2952e2db53886bb5954e8b    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 14:55:44 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 14:55:44 +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

Add a WAIT option to DROP_REPLICATION_SLOT

commit   : be7161566db247fd519e1a888ea8cd36b3c72088    
  
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   : abe85ef1d00187a42e7a757ea0413bc4965a4525    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 07:57:05 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 1 Sep 2017 07:57:05 +0100    

Click here for diff

Author: Thomas Munro  

M doc/src/sgml/maintenance.sgml

Fix assorted carelessness about Datum vs. int64 vs. uint64

commit   : 7b69b6ceb8047979ddf82af12ec1de143da62263    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 00:13:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Sep 2017 00:13:25 -0400    

Click here for diff

Bugs introduced by commit 81c5e46c490e2426db243eada186995da5bb0ba7  

M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c

Try to repair poorly-considered code in previous commit.

commit   : 0d9506d125beef18247a5e38a219d3b23e2d312e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 31 Aug 2017 23:09:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 31 Aug 2017 23:09:00 -0400    

Click here for diff

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

Introduce 64-bit hash functions with a 64-bit seed.

commit   : 81c5e46c490e2426db243eada186995da5bb0ba7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 31 Aug 2017 22:21:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 31 Aug 2017 22:21:21 -0400    

Click here for diff

This will be useful for hash partitioning, which needs a way to seed  
the hash functions to avoid problems such as a hash index on a hash  
partitioned table clumping all values into a small portion of the  
bucket space; it's also useful for anything that wants a 64-bit hash  
value rather than a 32-bit hash value.  
  
Just in case somebody wants a 64-bit hash value that is compatible  
with the existing 32-bit hash values, make the low 32-bits of the  
64-bit hash value match the 32-bit hash value when the seed is 0.  
  
Robert Haas and Amul Sul  
  
Discussion: http://postgr.es/m/CA+Tgmoafx2yoJuhCQQOL5CocEi-w_uG4S2xT0EtgiJnPGcHW3g@mail.gmail.com  

M doc/src/sgml/xindex.sgml
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/commands/opclasscmds.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/typcache.c
M src/include/access/hash.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/fmgr.h
M src/include/utils/jsonb.h
M src/include/utils/typcache.h
M src/test/regress/expected/alter_generic.out
A src/test/regress/expected/hash_func.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/hash_func.sql

Avoid memory leaks when a GatherMerge node is rescanned.

commit   : 2d44c58c79aeef2d376be0141057afbb9ec6b5bc    
  
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

Expand partitioned tables in PartDesc order.

commit   : 30833ba154e0c1106d61e3270242dc5999a3e4f3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 31 Aug 2017 15:50:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 31 Aug 2017 15:50:18 -0400    

Click here for diff

Previously, we expanded the inheritance hierarchy in the order in  
which find_all_inheritors had locked the tables, but that turns out  
to block quite a bit of useful optimization.  For example, a  
partition-wise join can't count on two tables with matching bounds  
to get expanded in the same order.  
  
Where possible, this change results in expanding partitioned tables in  
*bound* order.  Bound order isn't well-defined for a list-partitioned  
table with a null-accepting partition or for a list-partitioned table  
where the bounds for a single partition are interleaved with other  
partitions.  However, when expansion in bound order is possible, it  
opens up further opportunities for optimization, such as  
strength-reducing MergeAppend to Append when the expansion order  
matches the desired sort order.  
  
Patch by me, with cosmetic revisions by Ashutosh Bapat.  
  
Discussion: http://postgr.es/m/CA+TgmoZrKj7kEzcMSum3aXV4eyvvbh9WD=c6m=002WMheDyE3A@mail.gmail.com  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/insert.out

Clean up shm_mq cleanup.

commit   : 6708e447efb5046c95bdcf900b6da97f56f97ae8    
  
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   : 4b1dd62a257a469f92fef4f4cce37beab6c0b98b    
  
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

Remove to pre-8.2 coding convention for PG_MODULE_MAGIC

commit   : b5c75feca7ffb2667c42b86286e262d6cb709b76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:40:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Aug 2017 22:40:24 -0400    

Click here for diff

PG_MODULE_MAGIC has been around since 8.2, with 8.1 long since in EOL,  
so remove the mention of #ifdef guards for compiling against pre-8.2  
sources from the documentation.  
  
Author: Daniel Gustafsson <[email protected]>  

M contrib/citext/citext.c
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/xfunc.sgml
M src/test/regress/regress.c

Code review for nodeGatherMerge.c.

commit   : 04e9678614ec64ad9043174ac99a25b1dc45233a    
  
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   : 41b0dd987d44089dc48e9c70024277e253b396b7    
  
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/backend/executor/nodeSort.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/executor/nodeSort.h
M src/include/foreign/fdwapi.h
M src/include/nodes/extensible.h

Restore test case from a2b70c89ca1a5fcf6181d3c777d82e7b83d2de1b.

commit   : 6c2c5bea3cec4c874d1ee225bb6e222055c03d75    
  
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   : 7df2c1f8daeb361133ac8bdeaf59ceb0484e315a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 09:29:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Aug 2017 09:29:55 -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   : 00f6d5c2c3ae2f6d198e41800e5edcf0150d485b    
  
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   : 6cbee65eee20c144bb4de169c6802f20e76785b0    
  
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   : 2e70d6b5e99b7e7b53336b1838f869bbea1b5024    
  
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

Propagate sort instrumentation from workers back to leader.

commit   : bf11e7ee2e3607bb67d25aec73aa53b2d7e9961b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Aug 2017 13:22:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Aug 2017 13:22:49 -0400    

Click here for diff

Up until now, when parallel query was used, no details about the  
sort method or space used by the workers were available; details  
were shown only for any sorting done by the leader.  Fix that.  
  
Commit 1177ab1dabf72bafee8f19d904cee3a299f25892 forced the test case  
added by commit 1f6d515a67ec98194c23a5db25660856c9aab944 to run  
without parallelism; now that we have this infrastructure, allow  
that again, with a little tweaking to make it pass with and without  
force_parallel_mode.  
  
Robert Haas and Tom Lane  
  
Discussion: http://postgr.es/m/CA+Tgmoa2VBZW6S8AAXfhpHczb=Rf6RqQ2br+zJvEgwJ0uoD_tQ@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeSort.c
M src/backend/utils/sort/tuplesort.c
M src/include/executor/nodeSort.h
M src/include/nodes/execnodes.h
M src/include/utils/tuplesort.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Push tuple limits through Gather and Gather Merge.

commit   : 3452dc5240da43e833118484e1e9b4894d04431c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Aug 2017 13:12:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Aug 2017 13:12:23 -0400    

Click here for diff

If we only need, say, 10 tuples in total, then we certainly don't need  
more than 10 tuples from any single process.  Pushing down the limit  
lets workers exit early when possible.  For Gather Merge, there is  
an additional benefit: a Sort immediately below the Gather Merge can  
be done as a bounded sort if there is an applicable limit.  
  
Robert Haas and Tom Lane  
  
Discussion: http://postgr.es/m/CA+TgmoYa3QKKrLj5rX7UvGqhH73G1Li4B-EKxrmASaca2tFu9Q@mail.gmail.com  

M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeLimit.c
M src/include/executor/execParallel.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

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

commit   : ce5dcf54b942a469194ae390730f803b3f3fb928    
  
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

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

commit   : dc4f356b4470bcdcaf1d0fb68444683206eeba22    
  
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

Fix over-aggressive sanity check in misc_sanity.sql.

commit   : 95e28b7f0c9e30cb636f58b5aa351e5f8ae3a473    
  
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   : 46596f8d6b5dfdb836fa79788614a3786bc3cbb6    
  
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   : f97c55c708a6fbcb675be6fbb94af3038733dfa4    
  
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   : 6a5366e69acf9ae04988488f1e365705ff591d65    
  
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

First-draft release notes for 9.6.5.

commit   : f1b10496a55a64b2872633850e55a2cd9d1c9108    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Aug 2017 15:19:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Aug 2017 15:19:24 -0400    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  Note the first  
entry is only for 9.4.  

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

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

commit   : 04fbe0e4516d26de9420637f6fc90041e574b4b0    
  
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

pg_test_timing: Some NLS fixes

commit   : 2073c641b43e1310784dc40aef32f71119313bdc    
  
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

Make setlocale in ECPG test cases thread aware on Windows.

commit   : a772624b1d6b47ac00384901e1753f1d34b0cd10    
  
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

Improve low-level backup documentation.

commit   : 449338cc644be6035d05afb6b60f536adfd99b3e    
  
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

Fix locale dependency in new ecpg test case.

commit   : aae62278e167623bfac9fd50d1242d8e72208b0c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Aug 2017 14:17:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Aug 2017 14:17:33 -0400    

Click here for diff

Force sorting in "C" locale so that the output ordering doesn't vary,  
per buildfarm.  
  
In passing, add missing .gitignore entries.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stderr
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stdout
M src/interfaces/ecpg/test/preproc/.gitignore
M src/interfaces/ecpg/test/preproc/whenever_do_continue.pgc

pg_upgrade: Remove more dead code

commit   : 99ce446ada332fd8879fcdbded9daa891595f089    
  
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   : e86ac70d6ef12d8639885fcdb238fdaabec80aa7    
  
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

Implement DO CONTINUE action for ECPG WHENEVER statement.

commit   : d22e9d530516f7c9c56d00eff53cf19e45ef348c    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 25 Aug 2017 15:15:03 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 25 Aug 2017 15:15:03 +0200    

Click here for diff

Author: Vinayak Pokale  
Reviewed-By: Masahiko Sawada  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
A src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stderr
A src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.stdout
M src/interfaces/ecpg/test/preproc/Makefile
A src/interfaces/ecpg/test/preproc/whenever_do_continue.pgc

Code review for pushing LIMIT through subqueries.

commit   : 3f4c7917b3bc8b421c0c85cb9995974c55e7232b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Aug 2017 09:05:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Aug 2017 09:05:17 -0400    

Click here for diff

Minor improvements for commit 1f6d515a6.  We do not need the (rather  
expensive) test for SRFs in the targetlist, because since v10 any  
such SRFs would appear in separate ProjectSet nodes.  Also, make the  
code look more like the existing cases by turning it into a simple  
recursion --- the argument that there might be some performance  
benefit to contorting the code seems unfounded to me, especially since  
any good compiler should turn the tail-recursion into iteration anyway.  
  
Discussion: http://postgr.es/m/CADE5jYLuugnEEUsyW6Q_4mZFYTxHxaVCQmGAsF0yiY8ZDggi-w@mail.gmail.com  

M src/backend/executor/nodeLimit.c

Add minimal regression test for blessed record type transfer.

commit   : d36f7efb39e1b9613193b2e12717dbe2418ddae5    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 17:42:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 17:42:49 -0700    

Click here for diff

Test that blessed records can be transferred through a TupleQueue and  
correctly decoded by another backend.  While touching the file, make  
sure that force_parallel_mode settings only cover relevant tests.  
  
Author: Thomas Munro, editorialized by Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/20170823054644.efuzftxjpfi6wwqs%40alap3.anarazel.de  

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

Consolidate the function pointer types used by dshash.c.

commit   : d7694fc148707cd8335d9ccfde9f4c17290189db    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 17:01:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 17:01:36 -0700    

Click here for diff

Commit 8c0d7bafad36434cb08ac2c78e69ae72c194ca20 introduced dshash with hash  
and compare functions like DynaHash's, and also variants that take a user  
data pointer instead of size.  Simplify the interface by merging them into  
a single pair of function pointer types that take both size and a user data  
pointer.  
  
Since it is anticipated that memcmp and tag_hash behavior will be a common  
requirement, provide wrapper functions dshash_memcmp and dshash_memhash that  
conform to the new function types.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/20170823054644.efuzftxjpfi6wwqs%40alap3.anarazel.de  

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

Fix unlikely shared memory leak after failure in dshash_create().

commit   : 4569715bd6faa4c43e489a7069ab7abca68ff663    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 16:58:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Aug 2017 16:58:30 -0700    

Click here for diff

Tidy-up for commit 8c0d7bafad36434cb08ac2c78e69ae72c194ca20, based on a  
complaint from Andres Freund.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/20170823054644.efuzftxjpfi6wwqs%40alap3.anarazel.de  

M src/backend/lib/dshash.c

Fix harmless thinko in dsa.c.

commit   : 20fbf25533763c8c78c9c668b718d831236fb111    
  
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   : 0cdc3e47bea442643c9870dc419364b9f2f52dcb    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 24 Aug 2017 16:20:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 24 Aug 2017 16:20:50 -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   : 6ce6a61840cc90172ad3da7bf303656132fa5fab    
  
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   : fe7774144d5c3f3a2941a2ca51e61352e4005991    
  
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

Make new regression test case parallel-safe, and improve its output.

commit   : 1177ab1dabf72bafee8f19d904cee3a299f25892    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Aug 2017 13:39:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Aug 2017 13:39:51 -0400    

Click here for diff

The test case added by commit 1f6d515a6 fails on buildfarm members that  
have force_parallel_mode turned on, because we currently don't report sort  
performance details from worker processes back to the master.  To fix that,  
just make the test table be temp rather than regular; that's a good idea  
anyway to forestall any possible interference from auto-analyze.  
(The restriction that workers can't access temp tables might go away  
someday, but almost certainly not before the other thing gets fixed.)  
  
Also, improve the test so that we retain as much as possible of the  
EXPLAIN ANALYZE output.  This aids debugging failures, and might also  
expose problems that the preceding version masked.  
  
Discussion: http://postgr.es/m/CADE5jYLuugnEEUsyW6Q_4mZFYTxHxaVCQmGAsF0yiY8ZDggi-w@mail.gmail.com  

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

Fix up secondary expected files

commit   : 27b89876c0fb08faa17768c68101186cda2e4bef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2017 11:13:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Aug 2017 11:13:55 -0400    

Click here for diff

for commit 237a0b87b1dc90f8789aa5441a2a11e67f46c96e  

M src/test/regress/expected/geometry_1.out
M src/test/regress/expected/geometry_2.out

Update code comment for temporary replication slots

commit   : 6d242ee980193f29618aa899eb61f67a953bd712    
  
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   : 1e1b01cd1632a7d768fb8c86c95cf3ec82dc58da    
  
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

Improve plural handling in error message

commit   : 237a0b87b1dc90f8789aa5441a2a11e67f46c96e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 13:56:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2017 13:56:59 -0400    

Click here for diff

This does not use the normal plural handling, because no numbers appear  
in the actual message.  

M src/backend/parser/parse_oper.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/geometry.out
M src/test/regress/expected/horology.out
M src/test/regress/expected/text.out
M src/test/regress/expected/timetz.out
M src/test/regress/expected/with.out

Tweak some SCRAM error messages and code comments

commit   : 85f4d6393da2ed2ad3ec4912a60a918348784c2b    
  
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   : 580ddcec3943216b281c56e3c7fc933fdcf850f4    
  
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

Hash tables backed by DSA shared memory.

commit   : 8c0d7bafad36434cb08ac2c78e69ae72c194ca20    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 22:41:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 22:41:32 -0700    

Click here for diff

Add general purpose chaining hash tables for DSA memory.  Unlike  
DynaHash in shared memory mode, these hash tables can grow as  
required, and cope with being mapped into different addresses in  
different backends.  
  
There is a wide range of potential users for such a hash table, though  
it's very likely the interface will need to evolve as we come to  
understand the needs of different kinds of users.  E.g support for  
iterators and incremental resizing is planned for later commits and  
the details of the callback signatures are likely to change.  
  
Author: Thomas Munro  
Reviewed-By: John Gorman, Andres Freund, Dilip Kumar, Robert Haas  
Discussion:  
	https://postgr.es/m/CAEepm=3d8o8XdVwYT6O=bHKsKAM2pu2D6sV1S_=4d+jStVCE7w@mail.gmail.com  
	https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com  

M src/backend/lib/Makefile
A src/backend/lib/dshash.c
A src/include/lib/dshash.h
M src/tools/pgindent/typedefs.list

pg_upgrade: Message translatability and style fixes

commit   : 7e046e6e8a33f8a7ef641b9539376cf939993105    
  
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   : b5664cfd4c17eb69e6d7356ce670cc4a98074d13    
  
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

Refactor typcache.c's record typmod hash table.

commit   : 35ea75632a56ca8ef22aa8fed03b9dabb9c8c575    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 16:05:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 16:05:48 -0700    

Click here for diff

Previously, tuple descriptors were stored in chains keyed by a fixed size  
array of OIDs.  That meant there were effectively two levels of collision  
chain -- one inside and one outside the hash table.  Instead, let dynahash.c  
look after conflicts for us by supplying a proper hash and equal function  
pair.  
  
This is a nice cleanup on its own, but also simplifies followup  
changes allowing blessed TupleDescs to be shared between backends  
participating in parallel query.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm%3D34GVhOL%2BarUx56yx7OPk7%3DqpGsv3CpO54feqjAwQKm5g%40mail.gmail.com  

M src/backend/access/common/tupdesc.c
M src/backend/utils/cache/typcache.c
M src/include/access/tupdesc.h

Add a hash_combine function for mixing hash values.

commit   : 0052a0243d9c979a06ef273af965508103c456e0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 15:36:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Aug 2017 15:36:49 -0700    

Click here for diff

This hash function is derived from Boost's function of the same name.  
  
Author: Andres Freund, Thomas Munro  
Discussion: https://postgr.es/m/CAEepm%3D3rdgjfxW4cKvJ0OEmya2-34B0qHNG1xV0vK7TGPJGMUQ%40mail.gmail.com  
Discussion: https://postgr.es/m/20170731210844.3cwrkmsmbbpt4rjc%40alap3.anarazel.de  

A src/include/utils/hashutils.h

Don't install ICU collation keyword variants

commit   : 2bfd1b1ee562c4e4fd065c7f7d1beaa9b9852070    
  
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   : 51e225da306e14616b690308a59fd89e22335035    
  
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

Push limit through subqueries to underlying sort, where possible.

commit   : 1f6d515a67ec98194c23a5db25660856c9aab944    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 21 Aug 2017 14:43:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 21 Aug 2017 14:43:01 -0400    

Click here for diff

Douglas Doole, reviewed by Ashutosh Bapat and by me.  Minor formatting  
change by me.  
  
Discussion: http://postgr.es/m/CADE5jYLuugnEEUsyW6Q_4mZFYTxHxaVCQmGAsF0yiY8ZDggi-w@mail.gmail.com  

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

pg_prewarm: Add automatic prewarm feature.

commit   : 79ccd7cbd5ca44bee0191d12e9e65abf702899e7    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 21 Aug 2017 14:43:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 21 Aug 2017 14:43:00 -0400    

Click here for diff

Periodically while the server is running, and at shutdown, write out a  
list of blocks in shared buffers.  When the server reaches consistency  
-- unfortunatey, we can't do it before that point without breaking  
things -- reload those blocks into any still-unused shared buffers.  
  
Mithun Cy and Robert Haas, reviewed and tested by Beena Emerson,  
Amit Kapila, Jim Nasby, and Rafia Sabih.  
  
Discussion: http://postgr.es/m/CAD__OugubOs1Vy7kgF6xTjmEqTR4CrGAv8w+ZbaY_+MZeitukw@mail.gmail.com  

A contrib/file_fdw/data/list1.csv
A contrib/file_fdw/data/list2.bad
A contrib/file_fdw/data/list2.csv
M contrib/pg_prewarm/Makefile
A contrib/pg_prewarm/autoprewarm.c
A contrib/pg_prewarm/pg_prewarm–1.1–1.2.sql
M contrib/pg_prewarm/pg_prewarm.control
M doc/src/sgml/pgprewarm.sgml
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h
M src/tools/pgindent/typedefs.list

Inject $(ICU_LIBS) regardless of platform.

commit   : 66ed3829df959adb47f71d7c903ac59f0670f3e1    
  
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

Partially flatten struct tupleDesc so that it can be used in DSM.

commit   : c6293249dc178f52dd508c3e6ff353af41c90b58    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Aug 2017 11:19:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Aug 2017 11:19:12 -0700    

Click here for diff

TupleDesc's attributes were already stored in contiguous memory after the  
struct.  Go one step further and get rid of the array of pointers to  
attributes so that they can be stored in shared memory mapped at different  
addresses in each backend.  This won't work for TupleDescs with contraints  
and defaults, since those point to other objects, but for many purposes  
only attributes are needed.  
  
Author: Thomas Munro  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com  

M src/backend/access/common/tupdesc.c
M src/include/access/tupdesc.h

Change tupledesc->attrs[n] to TupleDescAttr(tupledesc, n).

commit   : 2cd70845240087da205695baedab6412342d1dbe    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Aug 2017 11:19:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Aug 2017 11:19:07 -0700    

Click here for diff

This is a mechanical change in preparation for a later commit that  
will change the layout of TupleDesc.  Introducing a macro to abstract  
the details of where attributes are stored will allow us to change  
that in separate step and revise it in future.  
  
Author: Thomas Munro, editorialized by Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com  

M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/hstore/hstore_io.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/spi/timetravel.c
M contrib/tablefunc/tablefunc.c
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/spgist/spgutils.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/pg_config.c
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/tupdesc.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c
M src/test/regress/regress.c

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

commit   : b1c2d76a2fcef812af0be3343082414d401909c8    
  
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   : 24620fc52bd9d4139748591b6cce7327fd299684    
  
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   : c4b841ba6aa9252ab9dacd59d317aba8cfa9b31a    
  
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   : a20aac890a89e6f88e841dedbbfa8d9d5f7309fc    
  
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   : 54cde0c4c05807321d3f4bf96a97c376e3fa91cb    
  
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

Refactor validation of new partitions a little bit.

commit   : ecfe59e50fb8316ab7fc653419cd724c8b7a7dd7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 14:49:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 14:49:45 -0400    

Click here for diff

Move some logic that is currently in ATExecAttachPartition to  
separate functions to facilitate future code reuse.  
  
Ashutosh Bapat and Jeevan Ladhe  
  
Discussion: http://postgr.es/m/CA+Tgmobbnamyvii0pRdg9pp_jLHSUvq7u5SiRrVV0tEFFU58Tg@mail.gmail.com  

M src/backend/commands/tablecmds.c

commit   : 1e56883a528eb623c9a55ec7e43b4eee3722014b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 14:04:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Aug 2017 14:04:15 -0400    

Click here for diff

Per discussion with Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Fix ExecReScanGatherMerge.

commit   : a2b70c89ca1a5fcf6181d3c777d82e7b83d2de1b    
  
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   : b5178c5d08ca59e30f9d9428fa6fdb2741794e65    
  
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   : d54285935072175aac1c446e15ec778b08a8fd75    
  
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   : 79f457e53ac37b5d383845c410e5a41457d74950    
  
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

Add missing "static" marker.

commit   : 963af96920fabf5fd7ee28ecc96521f371c13a4b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 11:17:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Aug 2017 11:17:39 -0400    

Click here for diff

Per pademelon.  

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

doc: Fix table column count

commit   : bfe089e3724ad8f9c8922165738d837b8641a6e6    
  
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   : cf851519d40e85c8129515c06532515386eaf41c    
  
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

Fix pg_atomic_u64 initialization.

commit   : dcd052c8d20c5359c55f2a101f10a8e6341233cd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 17 Aug 2017 00:48:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 17 Aug 2017 00:48:44 +0300    

Click here for diff

As Andres pointed out, pg_atomic_init_u64 must be used to initialize an  
atomic variable, before it can be accessed with the actual atomic ops.  
Trying to use pg_atomic_write_u64 on an uninitialized variable leads to a  
failure with the fallback implementation that uses a spinlock.  
  
Discussion: https://www.postgresql.org/message-id/20170816191346.d3ke5tpshhco4bnd%40alap3.anarazel.de  

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

Extend the default rules file for contrib/unaccent with Vietnamese letters.

commit   : ec0a69e49bf41a37b5c2d6f6be66d8abae00ee05    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Aug 2017 16:51:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Aug 2017 16:51:56 -0400    

Click here for diff

Improve generate_unaccent_rules.py to handle composed characters whose base  
is another composed character rather than a plain letter.  The net effect  
of this is to add a bunch of multi-accented Vietnamese characters to  
unaccent.rules.  
  
Original complaint from Kha Nguyen, diagnosis of the script's shortcoming  
by Thomas Munro.  
  
Dang Minh Huong and Michael Paquier  
  
Discussion: https://postgr.es/m/CALo3sF6EC8cy1F2JUz=GRf5h4LMUJTaG3qpdoiLrNbWEXL-tRg@mail.gmail.com  

M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/unaccent.rules

Make the planner assume that the entries in a VALUES list are distinct.

commit   : 2b74303637edc09cf692fbfab3fd93a5e47ccabf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Aug 2017 15:37:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Aug 2017 15:37:14 -0400    

Click here for diff

Previously, if we had to estimate the number of distinct values in a  
VALUES column, we fell back on the default behavior used whenever we lack  
statistics, which effectively is that there are Min(# of entries, 200)  
distinct values.  This can be very badly off with a large VALUES list,  
as noted by Jeff Janes.  
  
We could consider actually running an ANALYZE-like scan on the VALUES,  
but that seems unduly expensive, and anyway it could not deliver reliable  
info if the entries are not all constants.  What seems like a better choice  
is to assume that the values are all distinct.  This will sometimes be just  
as wrong as the old code, but it seems more likely to be more nearly right  
in many common cases.  Also, it is more consistent with what happens in  
some related cases, for example WHERE x = ANY(ARRAY[1,2,3,...,n]) and  
WHERE x = ANY(VALUES (1),(2),(3),...,(n)) now are estimated similarly.  
  
This was discussed some time ago, but consensus was it'd be better  
to slip it in at the start of a development cycle not near the end.  
(It should've gone into v10, really, but I forgot about it.)  
  
Discussion: https://postgr.es/m/CAMkU=1xHkyPa8VQgGcCNg3RMFFvVxUdOpus1gKcFuvVi0w6Acg@mail.gmail.com  

M src/backend/utils/adt/selfuncs.c
M src/include/nodes/relation.h

Fix shm_toc.c to always return buffer-aligned memory.

commit   : ac883ac453e9c479f397780918f235c440b7a02f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Aug 2017 21:52:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Aug 2017 21:52:38 +0300    

Click here for diff

Previously, if you passed a non-aligned size to shm_toc_create(), the  
memory returned by shm_toc_allocate() would be similarly non-aligned.  
This was exposed by commit 3cda10f41b, which allocated structs containing  
a pg_atomic_uint64 field with shm_toc_allocate(). On systems with  
MAXIMUM_ALIGNOF = 4, such structs still need to be 8-bytes aligned, but  
the memory returned by shm_toc_allocate() was only 4-bytes aligned.  
  
It's quite bogus that we abuse BUFFERALIGN to align the structs for  
pg_atomic_uint64. It doesn't really have anything to do with buffers. But  
that's a separate issue.  
  
This ought to fix the buildfarm failures on 32-bit x86 systems.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/storage/ipc/shm_toc.c
M src/include/c.h

doc: Update URL of DocBook XSL stylesheets

commit   : 4395f7daf3b40ecbd316bd2a68c253a56013a538    
  
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   : 346d5bf1ca33bcf27eda5d23fba3999e6356b905    
  
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

Correct representation of foreign tables in information schema

commit   : 9b5140fb503eb50634cd7e080d41f4d9af41e0a6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 11:03:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Aug 2017 11:03:33 -0400    

Click here for diff

tables.table_type is supposed to be 'FOREIGN' rather than 'FOREIGN  
TABLE' according to the SQL standard.  

M doc/src/sgml/information_schema.sgml
M src/backend/catalog/information_schema.sql

Use atomic ops to hand out pages to scan in parallel scan.

commit   : 3cda10f41bfed7e34b0db7013b66dd40a5f75926    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Aug 2017 16:18:41 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Aug 2017 16:18:41 +0300    

Click here for diff

With a lot of CPUs, the spinlock that protects the current scan location  
in a parallel scan can become a bottleneck. Use an atomic fetch-and-add  
instruction instead.  
  
David Rowley  
  
Discussion: https://www.postgresql.org/message-id/CAKJS1f9tgsPhqBcoPjv9_KUPZvTLCZ4jy%3DB%[email protected]  

M src/backend/access/heap/heapam.c
M src/include/access/relscan.h

Remove dedicated B-tree root-split record types.

commit   : 0c504a80cf2e6f66df2cdea563e879bf4abd1629    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Aug 2017 12:16:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Aug 2017 12:16:18 +0300    

Click here for diff

Since commit 40dae7ec53, which changed the way b-tree page splitting  
works, there has been no difference in the handling of root, and non-root  
split WAL records. We don't need to distinguish them anymore  
  
If you're worried about the loss of debugging information, note that  
usually a root split record will normally be followed by a WAL record to  
create the new root page. The root page will also have the BTP_ROOT flag  
set on the page itself, and there is a pointer to it from the metapage.  
  
Author: Aleksander Alekseev  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix up some misusage of appendStringInfo() and friends

commit   : 77d05706beb115b412728bd94dce16d83795583d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 23:34:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 23:34:39 -0400    

Click here for diff

Change to appendStringInfoChar() or appendStringInfoString() where those  
can be used.  
  
Author: David Rowley <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  

M contrib/postgres_fdw/deparse.c
M src/backend/commands/subscriptioncmds.c
M src/backend/nodes/outfuncs.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c
M src/backend/utils/mmgr/freepage.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/scripts/createuser.c
M src/interfaces/libpq/fe-connect.c

Initialize replication_slot_catalog_xmin in procarray

commit   : 4d4c89171598424b31175ef9b600ac87a9a61023    
  
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

doc: Document pg_receivewal exit behavior and status

commit   : 0a2d43d988eef2aee679582ba1b72b2587cbaab2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 20:26:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 20:26:58 -0400    

Click here for diff

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

pg_receivewal: Improve verbose mode

commit   : 514731af58765f62b23309805270a07eae86c2c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 20:25:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Aug 2017 20:25:37 -0400    

Click here for diff

Some informational messages showed up even if verbose mode was not  
used.  Move them to verbose mode.  
  
Author: Michael Paquier <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M src/bin/pg_basebackup/pg_receivewal.c

Include foreign tables in information_schema.table_privileges

commit   : 0659465caa042b958e544e8b1857d8d7de03a83f    
  
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   : 0f0ee68e94319e3f32baf3c18dcae1d5842b0d5c    
  
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   : 31ae1638ce35c23979f9bcbb92c6bb51744dbccb    
  
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

Make simpler-simple-expressions code cope with a Gather plan.

commit   : b73f1b5c29e0ace5a281bc13ce09dea30e1b66de    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 16:49:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 16:49:47 -0400    

Click here for diff

Commit 00418c612 expected that the plan generated for a simple-expression  
query would always be a plain Result node.  However, if force_parallel_mode  
is on, the planner might stick a Gather atop that.  Cope by looking through  
the Gather.  For safety, assert that the Gather's tlist is trivial.  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_exec.c

Fix logical replication protocol comparison logic

commit   : 70b573b2677eb5ef28515e824e5027e26ce21d77    
  
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   : 34a23a34269519e19b5da3ea4e29e4e0abadfee3    
  
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   : e42351ae07c19bb4eaedbdce8ccd4dfb4e905069    
  
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   : 270fec9f0bc9082ed99f0c447d450bd8cd92be73    
  
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

Avoid out-of-memory in a hash join with many duplicate inner keys.

commit   : 4867d7f62f7363909526d84d8fa1e9cf434cffc6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 14:05:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 14:05:46 -0400    

Click here for diff

The executor is capable of splitting buckets during a hash join if  
too much memory is being used by a small number of buckets.  However,  
this only helps if a bucket's population is actually divisible; if  
all the hash keys are alike, the tuples still end up in the same  
new bucket.  This can result in an OOM failure if there are enough  
inner keys with identical hash values.  The planner's cost estimates  
will bias it against choosing a hash join in such situations, but not  
by so much that it will never do so.  To mitigate the OOM hazard,  
explicitly estimate the hash bucket space needed by just the inner  
side's most common value, and if that would exceed work_mem then  
add disable_cost to the hash cost estimate.  
  
This approach doesn't account for the possibility that two or more  
common values would share the same hash value.  On the other hand,  
work_mem is normally a fairly conservative bound, so that eating  
two or more times that much space is probably not going to kill us.  
  
If we have no stats about the inner side, ignore this consideration.  
There was some discussion of making a conservative assumption, but that  
would effectively result in disabling hash join whenever we lack stats,  
which seems like an overreaction given how seldom the problem manifests  
in the field.  
  
Per a complaint from David Hinkle.  Although this could be viewed  
as a bug fix, the lack of similar complaints weighs against back-  
patching; indeed we waited for v11 because it seemed already rather  
late in the v10 cycle to be making plan choice changes like this one.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/relation.h
M src/include/utils/selfuncs.h

Fix error handling path in autovacuum launcher

commit   : d9a622cee162775ae42aa5c1ac592760d0d777d9    
  
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

Assorted preparatory refactoring for partition-wise join.

commit   : e139f1953f29db245f60a7acb72fccb1e05d2442    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 12:30:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 12:30:38 -0400    

Click here for diff

Instead of duplicating the logic to search for a matching  
ParamPathInfo in multiple places, factor it out into a separate  
function.  
  
Pass only the relevant bits of the PartitionKey to  
partition_bounds_equal instead of the whole thing, because  
partition-wise join will want to call this without having a  
PartitionKey available.  
  
Adjust allow_star_schema_join and calc_nestloop_required_outer  
to take relevant Relids rather than the entire Path, because  
partition-wise join will want to call it with the top-parent  
relids to determine whether a child join is allowable.  
  
Ashutosh Bapat.  Review and testing of the larger patch set of which  
this is a part by Amit Langote, Rajkumar Raghuwanshi, Rafia Sabih,  
Thomas Munro, Dilip Kumar, and me.  
  
Discussion: http://postgr.es/m/CA+TgmobQK80vtXjAsPZWWXd7c8u13G86gmuLupN+uUJjA+i4nA@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/partition.h
M src/include/optimizer/pathnode.h

Simplify plpgsql's check for simple expressions.

commit   : 00418c61244138bd8ac2de58076a1d0dd4f539f3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 12:28:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Aug 2017 12:28:39 -0400    

Click here for diff

plpgsql wants to recognize expressions that it can execute directly  
via ExecEvalExpr() instead of going through the full SPI machinery.  
Originally the test for this consisted of recursively groveling through  
the post-planning expression tree to see if it contained only nodes that  
plpgsql recognized as safe.  That was a major maintenance headache, since  
it required updating plpgsql every time we added any kind of expression  
node.  It was also kind of expensive, so over time we added various  
pre-planning checks to try to short-circuit having to do that.  
Robert Haas pointed out that as of the SRF-processing changes in v10,  
particularly the addition of Query.hasTargetSRFs, there really isn't  
any reason to make the recursive scan at all: the initial checks cover  
everything we really care about.  We do have to make sure that those  
checks agree with what inline_function() considers, so that inlining  
of a function that formerly wasn't inlined can't cause an expression  
considered simple to become non-simple.  
  
Hence, delete the recursive function exec_simple_check_node(), and tweak  
those other tests to more exactly agree with inline_function().  Adjust  
some comments and function naming to match.  
  
Discussion: https://postgr.es/m/CA+TgmoZGZpwdEV2FQWaVxA_qZXsQE1DAS5Fu8fwxXDNvfndiUQ@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/pl/plpgsql/src/pl_exec.c

Allow continuation lines in ecpg cppline parsing.

commit   : a4619b26a6a69ab31cab4a0632460647d7f5510f    
  
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

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

commit   : f3a4d7e7c290ba630ba0e6e6f009ac27cd3feb03    
  
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

Teach adjust_appendrel_attrs(_multilevel) to do multiple translations.

commit   : 480f1f4329f1bf8bfbbcda8ed233851e1b110ad4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 10:49:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Aug 2017 10:49:06 -0400    

Click here for diff

Currently, child relations are always base relations, so when we  
translate parent relids to child relids, we only need to translate  
a singler relid.  However, the proposed partition-wise join feature  
will create child joins, which will mean we need to translate a set  
of parent relids to the corresponding child relids.  This is  
preliminary refactoring to make that possible.  
  
Ashutosh Bapat.  Review and testing of the larger patch set of which  
this is a part by Amit Langote, Rajkumar Raghuwanshi, Rafia Sabih,  
Thomas Munro, Dilip Kumar, and me.  Some adjustments, mostly  
cosmetic, by me.  
  
Discussion: http://postgr.es/m/CA+TgmobQK80vtXjAsPZWWXd7c8u13G86gmuLupN+uUJjA+i4nA@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/include/optimizer/prep.h

Avoid unnecessary single-child Append nodes.

commit   : d57929afc7063431f80a0ac4c510fc39aacd22e6    
  
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   : 1295a777882b8ed180a854e249f91be565a99422    
  
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

pg_dump: Add a --load-via-partition-root option.

commit   : 23d7680d04b958de327be96ffdde8f024140d50e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 14 Aug 2017 22:54:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 14 Aug 2017 22:54:41 -0400    

Click here for diff

Rushabh Lathia, reviewed and somewhat revised by me.  Testing by  
Rajkumar Raghuwanshi.  
  
Discussion: http://postgr.es/m/CAGPqQf0C1he087bz9xRBOGZBuESYz9X=Fp8Ca_g+TfHgAff75g@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c

Expand coverage of parallel gather merge a bit.

commit   : d2bc501573d98ff5541271dca94fb5f7a004ecbf    
  
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

Stamp HEAD as 11devel.

commit   : 9f14dc393bd441dd9251bea2a5a3ad7f889b03c5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 18:08:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Aug 2017 18:08:30 -0400    

Click here for diff

Note that we no longer require any manual adjustments to shared-library  
minor version numbers, cf commit a3bce17ef.  So this should be everything.  

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc
M src/tools/git_changelog
M src/tools/version_stamp.pl