PostgreSQL 12.0 (upcoming) commit log

Avoid using lcons and list_delete_first where it's easy to do so.

commit   : d97b714a219959a50f9e7b37ded674f5132f93f3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Jul 2019 11:15:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Jul 2019 11:15:28 -0400    

Click here for diff

Formerly, lcons was about the same speed as lappend, but with the new  
List implementation, that's not so; with a long List, data movement  
imposes an O(N) cost on lcons and list_delete_first, but not lappend.  
  
Hence, invent list_delete_last with semantics parallel to  
list_delete_first (but O(1) cost), and change various places to use  
lappend and list_delete_last where this can be done without much  
violence to the code logic.  
  
There are quite a few places that construct result lists using lcons not  
lappend.  Some have semantic rationales for that; I added comments about  
it to a couple that didn't have them already.  In many such places though,  
I think the coding is that way only because back in the dark ages lcons  
was faster than lappend.  Hence, switch to lappend where this can be done  
without causing semantic changes.  
  
In ExecInitExprRec(), this results in aggregates and window functions that  
are in the same plan node being executed in a different order than before.  
Generally, the executions of such functions ought to be independent of  
each other, so this shouldn't result in visibly different query results.  
But if you push it, as one regression test case does, you can show that  
the order is different.  The new order seems saner; it's closer to  
the order of the functions in the query text.  And we never documented  
or promised anything about this, anyway.  
  
Also, in gistfinishsplit(), don't bother building a reverse-order list;  
it's easy now to iterate backwards through the original list.  
  
It'd be possible to go further towards removing uses of lcons and  
list_delete_first, but it'd require more extensive logic changes,  
and I'm not convinced it's worth it.  Most of the remaining uses  
deal with queues that probably never get long enough to be worth  
sweating over.  (Actually, I doubt that any of the changes in this  
patch will have measurable performance effects either.  But better  
to have good examples than bad ones in the code base.)  
  
Patch by me, thanks to David Rowley and Daniel Gustafsson for review.  
  
Discussion: https://postgr.es/m/21272.1563318411@sss.pgh.pa.us  

M src/backend/access/gist/gist.c
M src/backend/catalog/heap.c
M src/backend/commands/cluster.c
M src/backend/commands/lockcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExpr.c
M src/backend/nodes/list.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_agg.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pg_list.h
M src/test/regress/expected/aggregates.out

Move some md.c-specific logic from smgr.c to md.c.

commit   : dfd0121dc73aab491bcaad2d2b7a2a749389add8    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 17 Jul 2019 12:14:08 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 17 Jul 2019 12:14:08 +1200    

Click here for diff

Potential future SMGR implementations may not want to create  
tablespace directories when creating an SMGR relation.  Move that  
logic to mdcreate().  Move the initialization of md-specific  
data structures from smgropen() to a new callback mdopen().  
  
Author: Thomas Munro  
Reviewed-by: Shawn Debnath (as part of an earlier patch set)  
Discussion: https://postgr.es/m/CA%2BhUKG%2BOZqOiOuDm5tC5DyQZtJ3FH4%2BFSVMqtdC4P1atpJ%2Bqhg%40mail.gmail.com  

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

Fix thinko in construction of old_conpfeqop list.

commit   : 3093eb2b83645a083a47ea62769ffd89e31f3664    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 18:17:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 18:17:47 -0400    

Click here for diff

This should lappend the OIDs, not lcons them; the existing code produced  
a list in reversed order.  This is harmless for single-key FKs or FKs  
where all the key columns are of the same type, which probably explains  
how it went unnoticed.  But if those conditions are not met,  
ATAddForeignKeyConstraint would make the wrong decision about whether an  
existing FK needs to be revalidated.  I think it would almost always err  
in the safe direction by revalidating a constraint that didn't need it.  
You could imagine scenarios where the pfeqop check was fooled by  
swapping the types of two FK columns in one ALTER TABLE, but that case  
would probably be rejected by other tests, so it might be impossible to  
get to the worst-case scenario where an FK should be revalidated and  
isn't.  (And even then, it's likely to be fine, unless there are weird  
inconsistencies in the equality behavior of the replacement types.)  
However, this is a performance bug at least.  
  
Noted while poking around to see whether lcons calls could be converted  
to lappend.  
  
This bug is old, dating to commit cb3a7c2b9, so back-patch to all  
supported branches.  

M src/backend/commands/tablecmds.c

Remove lappend_cell...() family of List functions.

commit   : c245776906b065fcd59831a25c3b24ad3ddcd849    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 13:12:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 13:12:24 -0400    

Click here for diff

It seems worth getting rid of these functions because they require the  
caller to retain a ListCell pointer into a List that it's modifying,  
which is a dangerous practice with the new List implementation.  
(The only other List-modifying function that takes a ListCell pointer  
as input is list_delete_cell, which nowadays is preferentially used  
via the constrained API foreach_delete_current.)  
  
There was only one remaining caller of these functions after commit  
2f5b8eb5a, and that was some fairly ugly GEQO code that can be much  
more clearly expressed using a list-index variable and list_insert_nth.  
Hence, rewrite that code, and remove the functions.  
  
Discussion: https://postgr.es/m/26193.1563228600@sss.pgh.pa.us  

M src/backend/nodes/list.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/include/nodes/pg_list.h

Clean up some ad-hoc code for sorting and de-duplicating Lists.

commit   : 2f5b8eb5a28b4e6de9d20cc7d2c6028c6c7a8aa8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 12:04:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 12:04:06 -0400    

Click here for diff

heap.c and relcache.c contained nearly identical copies of logic  
to insert OIDs into an OID list while preserving the list's OID  
ordering (and rejecting duplicates, in one case but not the other).  
  
The comments argue that this is faster than qsort for small numbers  
of OIDs, which is at best unproven, and seems even less likely to be  
true now that lappend_cell_oid has to move data around.  In any case  
it's ugly and hard-to-follow code, and if we do have a lot of OIDs  
to consider, it's O(N^2).  
  
Hence, replace with simply lappend'ing OIDs to a List, then list_sort  
the completed List, then remove adjacent duplicates if necessary.  
This is demonstrably O(N log N) and it's much simpler for the  
callers.  It's possible that this would be somewhat inefficient  
if there were a very large number of duplicates, but that seems  
unlikely in the existing usage.  
  
This adds list_deduplicate_oid and list_oid_cmp infrastructure  
to list.c.  I didn't bother with equivalent functionality for  
integer or pointer Lists, but such could always be added later  
if we find a use for it.  
  
Discussion: https://postgr.es/m/26193.1563228600@sss.pgh.pa.us  

M src/backend/catalog/heap.c
M src/backend/nodes/list.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/pg_list.h

Redesign the API for list sorting (list_qsort becomes list_sort).

commit   : 569ed7f48312c70ed4a79daec1d7688fda4e74ac    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 11:51:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Jul 2019 11:51:44 -0400    

Click here for diff

In the wake of commit 1cff1b95a, the obvious way to sort a List  
is to apply qsort() directly to the array of ListCells.  list_qsort  
was building an intermediate array of pointers-to-ListCells, which  
we no longer need, but getting rid of it forces an API change:  
the comparator functions need to do one less level of indirection.  
  
Since we're having to touch the callers anyway, let's do two additional  
changes: sort the given list in-place rather than making a copy (as  
none of the existing callers have any use for the copying behavior),  
and rename list_qsort to list_sort.  It was argued that the old name  
exposes more about the implementation than it should, which I find  
pretty questionable, but a better reason to rename it is to be sure  
we get the attention of any external callers about the need to fix  
their comparator functions.  
  
While we're at it, change four existing callers of qsort() to use  
list_sort instead; previously, they all had local reinventions  
of list_qsort, ie build-an-array-from-a-List-and-qsort-it.  
(There are some other places where changing to list_sort perhaps  
would be worthwhile, but they're less obviously wins.)  
  
Discussion: https://postgr.es/m/29361.1563220190@sss.pgh.pa.us  

M src/backend/nodes/list.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_agg.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/rewrite/rowsecurity.c
M src/include/nodes/pg_list.h

Fix inconsistencies and typos in the tree

commit   : 0896ae561b6c799d45cb61d8a3b18fbb442130a7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Jul 2019 13:23:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Jul 2019 13:23:53 +0900    

Click here for diff

This is numbered take 7, and addresses a set of issues around:  
- Fixes for typos and incorrect reference names.  
- Removal of unneeded comments.  
- Removal of unreferenced functions and structures.  
- Fixes regarding variable name consistency.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/10bfd4ac-3e7c-40ab-2b2e-355ed15495e8@gmail.com  

M contrib/cube/cube.c
M contrib/intarray/_int.h
M contrib/ltree/ltxtquery_io.c
M contrib/pgstattuple/pgstatindex.c
M doc/src/sgml/gist.sgml
M src/backend/access/gin/README
M src/backend/access/gin/ginfast.c
M src/backend/access/gist/README
M src/backend/access/gist/gist.c
M src/backend/access/nbtree/README
M src/backend/access/spgist/spgscan.c
M src/backend/access/transam/clog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/namespace.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/parse_agg.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/mmgr/dsa.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_upgrade/pg_upgrade.c
M src/include/access/gist_private.h
M src/include/access/xlog_internal.h
M src/include/foreign/foreign.h
M src/include/postmaster/postmaster.h
M src/include/storage/fsm_internals.h
M src/include/storage/predicate_internals.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/port/thread.c
M src/test/perl/TestLib.pm

Remove dead code.

commit   : 4c3d05d875dd173a81a995c6e14d69496b467eec    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Jul 2019 23:27:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Jul 2019 23:27:13 -0400    

Click here for diff

These memory context switches are useless in the wake of commit  
1cff1b95a.  Noted by Jesper Pedersen.  
  
Discussion: https://postgr.es/m/f078ce63-9e04-0f3e-d200-d7ee66279abe@redhat.com  

M src/backend/commands/async.c

doc: mention pg_reload_conf() for reloading the config file

commit   : c6bce6ebb668c7da03d01244d34cac0335561103    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 15 Jul 2019 20:57:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 15 Jul 2019 20:57:24 -0400    

Click here for diff

Reported-by: Ian Barwick  
  
Discussion: https://postgr.es/m/538950ec-b86a-1650-6078-beb7091c09c2@2ndquadrant.com  
  
Backpatch-through: 9.4  

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

Provide pgbench --show-script to dump built-in scripts.

commit   : 5823677acc567d7790cc68972de12f6718913d7d    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 16 Jul 2019 11:53:12 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 16 Jul 2019 11:53:12 +1200    

Click here for diff

Author: Fabien Coelho  
Reviewed-by: Ibrar Ahmed  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081737390.5867%40lancre  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/002_pgbench_no_server.pl

Report the time taken by pgbench initialization steps.

commit   : ce8f946764005e1bde5a538542205e55f81bb6cc    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 16 Jul 2019 11:31:44 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 16 Jul 2019 11:31:44 +1200    

Click here for diff

Author: Fabien Coelho  
Reviewed-by: Ibrar Ahmed  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904061810510.3678%40lancre  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Correct nbtsplitloc.c comment.

commit   : bfdbac2ab3ef1a12a7de231552b128ed83ad00bb    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 15 Jul 2019 14:35:06 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 15 Jul 2019 14:35:06 -0700    

Click here for diff

The logic just added by commit e3899ffd falls back on a 50:50 page split  
in the event of a new item that's just to the right of our provisional  
"many duplicates" split point.  Fix a comment that incorrectly claimed  
that the new item had to be just to the left of our provisional split  
point.  
  
Backpatch: 12-, just like commit e3899ffd.  

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

Fix pathological nbtree split point choice issue.

commit   : e3899ffd8beafdaaa037b503163a9f572e9fc729    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 15 Jul 2019 13:19:13 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 15 Jul 2019 13:19:13 -0700    

Click here for diff

Specific ever-decreasing insertion patterns could cause successive  
unbalanced nbtree page splits.  Problem cases involve a large group of  
duplicates to the left, and ever-decreasing insertions to the right.  
  
To fix, detect the situation by considering the newitem offset before  
performing a split using nbtsplitloc.c's "many duplicates" strategy.  If  
the new item was inserted just to the right of our provisional "many  
duplicates" split point, infer ever-decreasing insertions and fall back  
on a 50:50 (space delta optimal) split.  This seems to barely affect  
cases that already had acceptable space utilization.  
  
An alternative fix also seems possible.  Instead of changing  
nbtsplitloc.c split choice logic, we could instead teach _bt_truncate()  
to generate a new value for new high keys by interpolating from the  
lastleft and firstright key values.  That would certainly be a more  
elegant fix, but it isn't suitable for backpatching.  
  
Discussion: https://postgr.es/m/CAH2-WznCNvhZpxa__GqAa1fgQ9uYdVc=_apArkW2nc-K3O7_NA@mail.gmail.com  
Backpatch: 12-, where the nbtree page split enhancements were introduced.  

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

Represent Lists as expansible arrays, not chains of cons-cells.

commit   : 1cff1b95ab6ddae32faa3efe0d95a820dbfdc164    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Jul 2019 13:41:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Jul 2019 13:41:58 -0400    

Click here for diff

Originally, Postgres Lists were a more or less exact reimplementation of  
Lisp lists, which consist of chains of separately-allocated cons cells,  
each having a value and a next-cell link.  We'd hacked that once before  
(commit d0b4399d8) to add a separate List header, but the data was still  
in cons cells.  That makes some operations -- notably list_nth() -- O(N),  
and it's bulky because of the next-cell pointers and per-cell palloc  
overhead, and it's very cache-unfriendly if the cons cells end up  
scattered around rather than being adjacent.  
  
In this rewrite, we still have List headers, but the data is in a  
resizable array of values, with no next-cell links.  Now we need at  
most two palloc's per List, and often only one, since we can allocate  
some values in the same palloc call as the List header.  (Of course,  
extending an existing List may require repalloc's to enlarge the array.  
But this involves just O(log N) allocations not O(N).)  
  
Of course this is not without downsides.  The key difficulty is that  
addition or deletion of a list entry may now cause other entries to  
move, which it did not before.  
  
For example, that breaks foreach() and sister macros, which historically  
used a pointer to the current cons-cell as loop state.  We can repair  
those macros transparently by making their actual loop state be an  
integer list index; the exposed "ListCell *" pointer is no longer state  
carried across loop iterations, but is just a derived value.  (In  
practice, modern compilers can optimize things back to having just one  
loop state value, at least for simple cases with inline loop bodies.)  
In principle, this is a semantics change for cases where the loop body  
inserts or deletes list entries ahead of the current loop index; but  
I found no such cases in the Postgres code.  
  
The change is not at all transparent for code that doesn't use foreach()  
but chases lists "by hand" using lnext().  The largest share of such  
code in the backend is in loops that were maintaining "prev" and "next"  
variables in addition to the current-cell pointer, in order to delete  
list cells efficiently using list_delete_cell().  However, we no longer  
need a previous-cell pointer to delete a list cell efficiently.  Keeping  
a next-cell pointer doesn't work, as explained above, but we can improve  
matters by changing such code to use a regular foreach() loop and then  
using the new macro foreach_delete_current() to delete the current cell.  
(This macro knows how to update the associated foreach loop's state so  
that no cells will be missed in the traversal.)  
  
There remains a nontrivial risk of code assuming that a ListCell *  
pointer will remain good over an operation that could now move the list  
contents.  To help catch such errors, list.c can be compiled with a new  
define symbol DEBUG_LIST_MEMORY_USAGE that forcibly moves list contents  
whenever that could possibly happen.  This makes list operations  
significantly more expensive so it's not normally turned on (though it  
is on by default if USE_VALGRIND is on).  
  
There are two notable API differences from the previous code:  
  
* lnext() now requires the List's header pointer in addition to the  
current cell's address.  
  
* list_delete_cell() no longer requires a previous-cell argument.  
  
These changes are somewhat unfortunate, but on the other hand code using  
either function needs inspection to see if it is assuming anything  
it shouldn't, so it's not all bad.  
  
Programmers should be aware of these significant performance changes:  
  
* list_nth() and related functions are now O(1); so there's no  
major access-speed difference between a list and an array.  
  
* Inserting or deleting a list element now takes time proportional to  
the distance to the end of the list, due to moving the array elements.  
(However, it typically *doesn't* require palloc or pfree, so except in  
long lists it's probably still faster than before.)  Notably, lcons()  
used to be about the same cost as lappend(), but that's no longer true  
if the list is long.  Code that uses lcons() and list_delete_first()  
to maintain a stack might usefully be rewritten to push and pop at the  
end of the list rather than the beginning.  
  
* There are now list_insert_nth...() and list_delete_nth...() functions  
that add or remove a list cell identified by index.  These have the  
data-movement penalty explained above, but there's no search penalty.  
  
* list_concat() and variants now copy the second list's data into  
storage belonging to the first list, so there is no longer any  
sharing of cells between the input lists.  The second argument is  
now declared "const List *" to reflect that it isn't changed.  
  
This patch just does the minimum needed to get the new implementation  
in place and fix bugs exposed by the regression tests.  As suggested  
by the foregoing, there's a fair amount of followup work remaining to  
do.  
  
Also, the ENABLE_LIST_COMPAT macros are finally removed in this  
commit.  Code using those should have been gone a dozen years ago.  
  
Patch by me; thanks to David Rowley, Jesper Pedersen, and others  
for review.  
  
Discussion: https://postgr.es/m/11587.1550975080@sss.pgh.pa.us  

M contrib/file_fdw/file_fdw.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/postgres_fdw/deparse.c
M contrib/sepgsql/label.c
M contrib/sepgsql/uavc.c
M src/backend/access/common/printtup.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/view.c
M src/backend/executor/execJunk.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/list.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
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/equivclass.c
M src/backend/optimizer/path/indxpath.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/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/replication/basebackup.c
M src/backend/replication/syncrep.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/mbutils.c
M src/include/nodes/pg_list.h
M src/pl/plpgsql/src/pl_exec.c

Provide XLogRecGetFullXid().

commit   : 67b9b3ca328392f9afc4e66fe03564f5fc87feff    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 Jul 2019 17:03:46 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 Jul 2019 17:03:46 +1200    

Click here for diff

In order to be able to work with FullTransactionId values during replay  
without increasing the size of the WAL, infer the epoch.  In general we  
can't do that safely, but during replay we can because we know that  
nextFullXid can't advance concurrently.  
  
Prevent frontend code from seeing this new function, due to the above  
restriction.  Perhaps in future it will be possible to extract the value  
entirely from independent WAL records, and then this restriction can be  
lifted.  
  
Author: Thomas Munro, based on earlier code from Andres Freund  
Discussion: https://postgr.es/m/CA%2BhUKG%2BmLmuDjMi6o1dxkKvGRL56Y2Rz%2BiXAcrZV03G9ZuFQ8Q%40mail.gmail.com  

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

Add gen_random_uuid function

commit   : 5925e5549890416bcf588334d9d0bc99f8ad6c7f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 14 Jul 2019 14:30:27 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 14 Jul 2019 14:30:27 +0200    

Click here for diff

This adds a built-in function to generate UUIDs.  
  
PostgreSQL hasn't had a built-in function to generate a UUID yet,  
relying on external modules such as uuid-ossp and pgcrypto to provide  
one.  Now that we have a strong random number generator built-in, we  
can easily provide a version 4 (random) UUID generation function.  
  
This patch takes the existing function gen_random_uuid() from pgcrypto  
and makes it a built-in function.  The pgcrypto implementation now  
internally redirects to the built-in one.  
  
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>  
Discussion: https://www.postgresql.org/message-id/6a65610c-46fc-2323-6b78-e8086340a325@2ndquadrant.com  

M contrib/pgcrypto/pgcrypto.c
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/uuid-ossp.sgml
M src/backend/utils/adt/uuid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/uuid.out
M src/test/regress/sql/uuid.sql

Forgotten catversion bump

commit   : 565f3390005318ea4c982b8d054d56e9fe5a6454    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 15:22:21 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 15:22:21 +0300    

Click here for diff

6254c55f81, c085e1c1cb and 075f0a880f all change system catalog.  But  
catversion bump is missed in all of them.  So, do catversion bump now.  
  
Also, I need mention patch reviewer Fabien Coelho, who has been missed in  
commit messages of 6254c55f81, c085e1c1cb and 075f0a880f.  

M src/include/catalog/catversion.h

Add support for <-> (box, point) operator to SP-GiST box_ops

commit   : 075f0a880fbf790f4a3dcac83e2d5125bcad9646    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 14:57:53 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 14:57:53 +0300    

Click here for diff

Opclass support functions already can handle this operator, just catalog  
adjustment appears to be required.  
  
Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Tom Lane, Alexander Korotkov  

M doc/src/sgml/spgist.sgml
M src/include/catalog/pg_amop.dat
M src/test/regress/expected/box.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/box.sql

Add support for <-> (box, point) operator to GiST box_ops

commit   : c085e1c1cb4e29637552f5d250d45ad0cb83e5cf    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 14:56:18 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 14:56:18 +0300    

Click here for diff

Index-based calculation of this operator is exact.  So, signature of  
gist_bbox_distance() function is changes so that caller is responsible for  
setting *recheck flag.  
  
Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Tom Lane, Alexander Korotkov  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/gistproc.c
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

Add missing commutators for distance operators

commit   : 6254c55f815623bb74e2cf27562437dc3b2aa2c8    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 14:55:01 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Jul 2019 14:55:01 +0300    

Click here for diff

Some of <-> operators between geometric types have their commutators missed.  
This commit adds them.  The motivation is upcoming kNN support for some of those  
operators.  
  
Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Tom Lane, Alexander Korotkov  

M src/backend/utils/adt/geo_ops.c
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/geometry.out
M src/test/regress/sql/geometry.sql

Teach pg_stat_statements not to ignore FOR UPDATE clauses

commit   : 6e74c64bcf61eab94091f6b17dfd0ab585b1a77e    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sun, 14 Jul 2019 12:07:40 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sun, 14 Jul 2019 12:07:40 +0100    

Click here for diff

Performance of a SELECT FOR UPDATE may be quite distinct from the  
non-UPDATE version of the query, so treat all of the FOR UPDATE clause  
as being significant for distinguishing queries.  
  
Andrew Gierth and Vik Fearing, reviewed by Sergei Kornilov, Thomas  
Munro, Tom Lane  
  
Discussion: https://postgr.es/m/87h8e4hfwv.fsf@news-spur.riddles.org.uk  

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

Fix documentation for pgbench tpcb-like.

commit   : 0369f4736665864edd7bf43736df190afa223c4c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 14 Jul 2019 14:19:54 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 14 Jul 2019 14:19:54 +1200    

Click here for diff

We choose a random value for delta, not balance.  Back-patch to 9.6 where  
the mistake arrived.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre  

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

Revive test of concurrent OID generation.

commit   : 8a0cbb88524e8b6121597285b811640ee793b3e8    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 13 Jul 2019 13:34:22 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 13 Jul 2019 13:34:22 -0700    

Click here for diff

Commit 578b229718e8f15fa779e20f086c4b6bb3776106 replaced it with a  
concurrent "nextval" test.  That version does not detect PostgreSQL's  
incompatibility with xlc 13.1.3, so bring back an OID-based test that  
does.  Back-patch to v12, where that commit first appeared.  
  
Discussion: https://postgr.es/m/20190707170035.GA1485546@rfd.leadboat.com  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix some inconsistencies in MSVC scripts

commit   : 39aadc984221f57ce7dc11dd3c8c719e10198549    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 13 Jul 2019 16:51:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 13 Jul 2019 16:51:31 +0900    

Click here for diff

In configure scripts, --with-ossp-uuid is obsolete is replaced by  
--with-uuid, and it needs to specify a path to its library builds when  
building with the MSVC scripts.  --with-perl needs also to specify a  
path.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20190712.121529.194600624.horikyota.ntt@gmail.com  

M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Fix and improve several places in the docs

commit   : 170d11b8e7cb9df96a7ee0b8140d28536d55fe3e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 13 Jul 2019 14:43:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 13 Jul 2019 14:43:29 +0900    

Click here for diff

This adds some missing markups, fixes a couple of incorrect ones and  
clarifies some documentation in various places.  
  
Author: Liudmila Mantrova  
Discussion: https://postgr.es/m/a068f947-7a51-5df1-b3fd-1a131ae5c044@postgrespro.ru  
Backpatch-through: 12  

M doc/src/sgml/backup.sgml
M doc/src/sgml/biblio.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/reindex.sgml

Fix tab completion for UPDATE.

commit   : 5b51bbfbd52a444a490247e66751d6a47d2ba7dd    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 15:56:20 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 15:56:20 +1200    

Click here for diff

Previously it suggested an extra "=" after "SET x=".  
  
Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CA%2BhUKGLk%3D0yLDjfviONJLzcHEzygj%3Dx6VbGH43LnXbBUvQb52g%40mail.gmail.com  

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

Tab completion for CREATE TYPE.

commit   : 7bdc6556fb325582b02e9a6931c38f873a0c46a0    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 15:51:52 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 15:51:52 +1200    

Click here for diff

Author: Thomas Munro  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CA%2BhUKGLk%3D0yLDjfviONJLzcHEzygj%3Dx6VbGH43LnXbBUvQb52g%40mail.gmail.com  

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

Forward received condition variable signals on cancel.

commit   : b91dd9de5ea0839d0d248ebbe8cb926c3df52c7c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 13:55:10 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 13:55:10 +1200    

Click here for diff

After a process decides not to wait for a condition variable, it can  
still consume a signal before it reaches ConditionVariableCancelSleep().  
In that case, pass the signal on to another waiter if possible, so that  
a signal doesn't go missing when there is another process ready to  
receive it.  
  
Author: Thomas Munro  
Reviewed-by: Shawn Debnath  
Discussion: https://postgr.es/m/CA%2BhUKGLQ_RW%2BXs8znDn36e-%2Bmq2--zrPemBqTQ8eKT-VO1OF4Q%40mail.gmail.com  

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

Introduce timed waits for condition variables.

commit   : 1321509fa43293615c4e5fa5dc8eed5286f479b1    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 13:40:36 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 13:40:36 +1200    

Click here for diff

Provide ConditionVariableTimedSleep(), like ConditionVariableSleep()  
but with a timeout argument.  
  
Author: Shawn Debnath  
Reviewed-by: Kyotaro Horiguchi, Thomas Munro  
Discussion: https://postgr.es/m/eeb06007ccfe46e399df6af18bfcd15a@EX13D05UWC002.ant.amazon.com  

M src/backend/storage/lmgr/condition_variable.c
M src/include/storage/condition_variable.h

Warn if wal_level is too low when creating a publication.

commit   : b31fbe852c095a827caade2e0702f8a215053bea    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 10:35:34 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 13 Jul 2019 10:35:34 +1200    

Click here for diff

Provide a hint to users that they need to increase wal_level before  
subscriptions can work.  
  
Author: Lucas Viecelli, with some adjustments by Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAPjy-57rn5Y9g4e5u--eSOP-7P4QrE9uOZmT2ZcUebF8qxsYhg%40mail.gmail.com  

M src/backend/commands/publicationcmds.c
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql

Fix get_actual_variable_range() to cope with broken HOT chains.

commit   : d3751adcf14d3baacc9738ee9ce869dc1c31d7ad    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 12 Jul 2019 16:24:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 12 Jul 2019 16:24:59 -0400    

Click here for diff

Commit 3ca930fc3 modified get_actual_variable_range() to use a new  
"SnapshotNonVacuumable" snapshot type for selecting tuples that it  
would consider valid.  However, because that snapshot type can accept  
recently-dead tuples, this caused a bug when using a recently-created  
index: we might accept a recently-dead tuple that is an early member  
of a broken HOT chain and does not actually match the index entry.  
Then, the data extracted from the heap tuple would not necessarily be  
an endpoint value of the column; it could even be NULL, leading to  
get_actual_variable_range() itself reporting "found unexpected null  
value in index".  Even without an error, this could lead to poor  
plan choices due to an erroneous notion of the endpoint value.  
  
We can improve matters by changing the code to use the index-only  
scan technique (which didn't exist when get_actual_variable_range was  
originally written).  If any of the tuples in a HOT chain are live  
enough to satisfy SnapshotNonVacuumable, we take the data from the  
index entry, ignoring what is in the heap.  This fixes the problem  
without changing the live-vs-dead-tuple behavior from what was  
intended by commit 3ca930fc3.  
  
A side benefit is that for static tables we might not have to touch  
the heap at all (when the extremal value is in an all-visible page).  
In addition, we can save some overhead by not having to create a  
complete ExecutorState, and we don't need to run FormIndexDatum,  
avoiding more cycles as well as the possibility of failure for  
indexes on expressions.  (I'm not sure that this code would ever  
be used to determine the extreme value of an expression, in the  
current state of the planner; but it's definitely possible that  
lower-order columns of the selected index could be expressions.  
So one could construct perhaps-artificial examples in which the  
old code unexpectedly failed due to trying to compute an  
expression's value for a now-dead row.)  
  
Per report from Manuel Rigger.  Back-patch to v11 where commit  
3ca930fc3 came in.  
  
Discussion: https://postgr.es/m/CA+u7OA7W4NWEhCvftdV6_8bbm2vgypi5nuxfnSEJQqVKFSUoMg@mail.gmail.com  

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

Fix RANGE partition pruning with multiple boolean partition keys

commit   : cfde23493938b543d281c509527f0f5b16fca9ff    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 12 Jul 2019 19:12:38 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 12 Jul 2019 19:12:38 +1200    

Click here for diff

match_clause_to_partition_key incorrectly would return  
PARTCLAUSE_UNSUPPORTED if a bool qual could not be matched to the current  
partition key.  This was a problem, as it causes the calling function to  
discard the qual and not try to match it to any other partition key.  If  
there was another partition key which did match this qual, then the qual  
would not be checked again and we could fail to prune some partitions.  
  
The worst this could do was to cause partitions not to be pruned when they  
could have been, so there was no danger of incorrect query results here.  
  
Fix this by changing match_boolean_partition_clause to have it return a  
PartClauseMatchStatus rather than a boolean value.  This allows it to  
communicate if the qual is unsupported or if it just does not match this  
particular partition key, previously these two cases were treated the  
same.  Now, if match_clause_to_partition_key is unable to match the qual  
to any other qual type then we can simply return the value from the  
match_boolean_partition_clause call so that the calling function properly  
treats the qual as either unmatched or unsupported.  
  
Reported-by: Rares Salcudean  
Reviewed-by: Amit Langote  
Backpatch-through: 11 where partition pruning was introduced  
Discussion: https://postgr.es/m/CAHp_FN2xwEznH6oyS0hNTuUUZKp5PvegcVv=Co6nBXJ+mC7Y5w@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

Fixes for jsonpath filter expression elements table in docs

commit   : 0cea6eb5a5f2948c411706cabfde32ce61df0d7a    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 11 Jul 2019 18:18:15 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 11 Jul 2019 18:18:15 +0300    

Click here for diff

Reported-by: Thom Brown  
Discussion: https://postgr.es/m/CAA-aLv4Tggy6Z3kaG9n%2B3SHwOVGN2Yj_MJXfdfwjH_jBNZzJNA%40mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/func.sgml

Reduce memory consumption for multi-statement query strings.

commit   : b5810de3f4eb0e7b242d31db93a46957d56ea8b4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Jul 2019 14:32:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Jul 2019 14:32:28 -0400    

Click here for diff

Previously, exec_simple_query always ran parse analysis, rewrite, and  
planning in MessageContext, allowing all the data generated thereby  
to persist until the end of processing of the whole query string.  
That's fine for single-command strings, but if a client sends many  
commands in a single simple-Query message, this strategy could result  
in annoying memory bloat, as complained of by Andreas Seltenreich.  
  
To fix, create a child context to do this work in, and reclaim it  
after each command.  But we only do so for parsetrees that are not  
last in their query string.  That avoids adding any memory management  
overhead for the typical case of a single-command string.  Memory  
allocated for the last parsetree would be freed immediately after  
finishing the command string anyway.  
  
Similarly, adjust extension.c's execute_sql_string() to reclaim memory  
after each command.  In that usage, multi-command strings are the norm,  
so it's a bit surprising that no one has yet complained of bloat ---  
especially since the bloat extended to whatever data ProcessUtility  
execution might leak.  
  
Amit Langote, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/87ftp6l2qr.fsf@credativ.de  

M src/backend/commands/extension.c
M src/backend/tcop/postgres.c

docs: remove pg_roles mention of the oid column being displayed

commit   : 909a7b6b8ecd6bf87bb44cb014ed593e9789af11    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 10 Jul 2019 14:24:36 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 10 Jul 2019 14:24:36 -0400    

Click here for diff

It is now always displayed in PG 12+.  
  
Discussion: https://postgr.es/m/b6ec6167-5dd5-6347-ac1d-1fd49382019f@2ndquadrant.com  
  
Author: Ian Barwick  
  
Backpatch-through: 12  

M doc/src/sgml/catalogs.sgml

Mention limitation of unique in partitioned tables

commit   : ec4eaab78b078b9326296236f184773590a92ca3    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 Jul 2019 08:58:41 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 Jul 2019 08:58:41 -0400    

Click here for diff

Per gripe from Phil Bayer.  
  
Authors: Amit Langote and others  
Discussion: https://postgr.es/m/156236160709.1192.4498528196556144085@wrigleys.postgresql.org  

M doc/src/sgml/ddl.sgml

Fix variable initialization when using buffering build with GiST

commit   : fa19a08d71fbeefc39415d9c6c70128460d41f94    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Jul 2019 15:14:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Jul 2019 15:14:54 +0900    

Click here for diff

This can cause valgrind to complain, as the flag marking a buffer as a  
temporary copy was not getting initialized.  
  
While on it, fill in with zeros newly-created buffer pages.  This does  
not matter when loading a block from a temporary file, but it makes the  
push of an index tuple into a new buffer page safer.  
  
This has been introduced by 1d27dcf, so backpatch all the way down to  
9.4.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/15899-0d24fb273b3dd90c@postgresql.org  
Backpatch-through: 9.4  

M src/backend/access/gist/gistbuildbuffers.c

Assorted fixes for jsonpath documentation

commit   : 5a7d697a39365d9762afa8e618bcbdcf592966fa    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 10 Jul 2019 07:46:16 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 10 Jul 2019 07:46:16 +0300    

Click here for diff

This commit contains assorted fixes for jsonpath documentation including:  
grammar fixes, incorrect examples fixes as well as wording improvements.  
  
Discussion: https://postgr.es/m/CAA-aLv4VVX%3Db9RK5hkfPXJczqaiTdqO04teW9i0wiQVhdKcqzw%40mail.gmail.com  
Author: Liudmila Mantrova  
Reviewed-by: Alexander Korotkov  
Reported-by: Thom Brown  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Fix missing calls to table_finish_bulk_insert during COPY, take 2

commit   : f7c830f1ab2645236ac2d6103fb3a88518bdc4fc    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 10 Jul 2019 16:03:04 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 10 Jul 2019 16:03:04 +1200    

Click here for diff

86b85044e abstracted calls to heap functions in COPY FROM to support a  
generic table AM.  However, when performing a copy into a partitioned  
table, this commit neglected to call table_finish_bulk_insert for each  
partition.  Before 86b85044e, when we always called the heap functions,  
there was no need to call heapam_finish_bulk_insert for partitions since  
it only did any work when performing a copy without WAL.  For partitioned  
tables, this was unsupported anyway, so there was no issue.  With  
pluggable storage, we can't make any assumptions about what the table AM  
might want to do in its equivalent function, so we'd better ensure we  
always call table_finish_bulk_insert each partition that's received a row.  
  
For now, we make the table_finish_bulk_insert call whenever we evict a  
CopyMultiInsertBuffer out of the CopyMultiInsertInfo.  This does mean  
that it's possible that we call table_finish_bulk_insert multiple times  
per partition, which is not a problem other than being an inefficiency.  
Improving this requires a more invasive patch, so let's leave that for  
another day.  
  
This also changes things so that we no longer needlessly call  
table_finish_bulk_insert when performing a COPY FROM for a non-partitioned  
table when not using multi-inserts.  
  
Reported-by: Robert Haas  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com  

M src/backend/commands/copy.c

Fix few typos and minor wordsmithing in tableam comments.

commit   : bd56cd75d2cee28c4acd1cd76af57664e622d21f    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 10 Jul 2019 07:52:51 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 10 Jul 2019 07:52:51 +0530    

Click here for diff

Reported-by: Ashwin Agrawal  
Author: Ashwin Agrawal  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com  

M src/include/access/tableam.h

Pass QueryEnvironment down to EvalPlanQual's EState.

commit   : f5825853e3afdb4df4767d30cbfdd375b45d1f2a    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Jul 2019 10:15:32 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Jul 2019 10:15:32 +1200    

Click here for diff

Otherwise the executor can't see trigger transition tables during  
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.  
Back-patch to 10, where trigger transition tables landed.  
  
Author: Alex Aktsipetrov  
Reviewed-by: Thomas Munro, Tom Lane  
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org  
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org  

M src/backend/executor/execMain.c

Propagate trigger arguments to partitions

commit   : 2c84ea6cf994f5853de0f03600aa5df8156cf9f4    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 9 Jul 2019 17:16:36 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 9 Jul 2019 17:16:36 -0400    

Click here for diff

We were creating the cloned triggers with an empty list of arguments,  
losing the ones that had been specified by the user when creating the  
trigger in the partitioned table.  Repair.  
  
This was forgotten in commit 86f575948c77.  
  
Author: Patrick McHardy  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/20190709130027.amr2cavjvo7rdvac@access1.trash.net  
Discussion: https://postgr.es/m/15752-123bc90287986de4@postgresql.org  

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

Message style improvements

commit   : e435c1e7d9d88264453c30f8d1969cb836a60509    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Jul 2019 15:47:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Jul 2019 15:47:09 +0200    

Click here for diff

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/option.c

Force hash joins to be enabled in the hash join regression tests.

commit   : cba0fe024e35839688e3a3d256d1dcdf50baadaf    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 9 Jul 2019 18:11:01 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 9 Jul 2019 18:11:01 +1200    

Click here for diff

Otherwise the regressplans.sh tests generate extremely slow nested  
loop joins.  Back-patch to 11 where the hash join tests came in.  
  
Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz  

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

doc: adjust to_timestamp()/to_date() wording

commit   : 38c268dde0ae749a93acd750afd1aad9c8f01049    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 8 Jul 2019 23:04:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 8 Jul 2019 23:04:02 -0400    

Click here for diff

Discussion: https://postgr.es/m/20190706202425.GA16933@telsasoft.com  
  
Author: Justin Pryzby  
  
Backpatch-through: 12  

M doc/src/sgml/func.sgml

Adjust ssl_ciphers to be specific to OpenSSL

commit   : ba0934251823145461b208d55d8c003576bbfd62    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 8 Jul 2019 19:39:48 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 8 Jul 2019 19:39:48 -0400    

Click here for diff

Syntax is OpenSSL-specific, so only use it for OpenSSL.  
  
Discussion: https://postgr.es/m/8232E273-7B25-47F4-B0E7-3D4264106F82@yesql.se  
  
Author: Daniel Gustafsson  
  
Backpatch-through: head  

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

Remove unused C structure member

commit   : 481837783bee98795379153e7b60405f21fdb38b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 8 Jul 2019 19:31:16 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 8 Jul 2019 19:31:16 -0400    

Click here for diff

Remove quote_all_identifiers from struct _dumpOptions.  
  
Discussion: https://postgr.es/m/d3d92ce9-78a4-8adb-0393-d3deeec29f7e@postgrespro.ru  
  
Author: Arthur Zakirov  
  
Backpatch-through: head  

M src/bin/pg_dump/pg_backup.h

tableam: Provide helper functions for relation sizing.

commit   : 554106b1163853757b72ce14d7db5050c32bfa6a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 8 Jul 2019 14:51:53 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 8 Jul 2019 14:51:53 -0400    

Click here for diff

Most block-based table AMs will need the exact same implementation of  
the relation_size callback as the heap, and if they use a standard  
page layout, they will likely need an implementation of the  
relation_estimate_size callback that is very similar to that of the  
heap.  Rearrange to facilitate code reuse.  
  
Patch by me, reviewed by Michael Paquier, Daniel Gustafsson, and  
Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoZ6DBPnP1E-vRpQZUJQijJFD54F+SR_pxGiAAS-MyrigA@mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/include/access/tableam.h

doc: Clarify logical replication documentation

commit   : 482501d433b9f218d5a117571f1df9aebefe68bb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Jul 2019 14:28:42 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Jul 2019 14:28:42 +0200    

Click here for diff

Document that the data types of replicated tables do not need to  
match.  The documentation previously claimed that they had to match.  
  
Author: Robert Treat <rob@xzilla.net>  
Discussion: https://www.postgresql.org/message-id/flat/CAJSLCQ13==D8Ka2YLyctTm0Y+8MhGYcX_zj7fU0rqRzhcV++3w@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml

Fix inconsistencies in the code

commit   : 6b8548964bccd0f2e65c687d591b7345d5146bfa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Jul 2019 13:15:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Jul 2019 13:15:09 +0900    

Click here for diff

This addresses a couple of issues in the code:  
- Typos and inconsistencies in comments and function declarations.  
- Removal of unreferenced function declarations.  
- Removal of unnecessary compile flags.  
- A cleanup error in regressplans.sh.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/0c991fdf-2670-1997-c027-772a420c4604@gmail.com  

M contrib/cube/cube.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/gist.sgml
M src/backend/access/transam/multixact.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/executor/README
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/lib/dshash.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/basebackup.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/misc/tzparser.c
M src/bin/pg_dump/pg_backup_db.c
M src/include/access/heapam.h
M src/include/access/timeline.h
M src/include/executor/executor.h
M src/include/executor/tablefunc.h
M src/include/nodes/execnodes.h
M src/include/partitioning/partprune.h
M src/include/port/atomics/generic-acc.h
M src/interfaces/ecpg/compatlib/exports.txt
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regressplans.sh
M src/tools/msvc/Mkvcbuild.pm

Use consistent style for checking return from system calls

commit   : 7e9a4c5c3dca0d9637812d8991e96fc8f46800d9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 6 Jul 2019 23:18:46 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 6 Jul 2019 23:18:46 +0200    

Click here for diff

Use  
  
    if (something() != 0)  
        error ...  
  
instead of just  
  
    if (something)  
        error ...  
  
The latter is not incorrect, but it's a bit confusing and not the  
common style.  
  
Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com  

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/libpq/be-fsstubs.c
M src/backend/postmaster/postmaster.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/utils/cache/relmapper.c
M src/common/controldata_utils.c
M src/interfaces/libpq/fe-lobj.c

Remove more unreferenced function declarations

commit   : d1a040543b49e0aad273e7766cd7e2fcf2b781fa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 7 Jul 2019 09:58:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 7 Jul 2019 09:58:33 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDuAYsRb3Q9aobkFZ6DZMWxsyg4HOmgkwgeWNfSkTwGxw@mail.gmail.com  

M src/bin/pg_dump/pg_backup_archiver.h
M src/include/bootstrap/bootstrap.h
M src/include/utils/rel.h
M src/interfaces/libpq/libpq-int.h

In pg_log_generic(), be more paranoid about preserving errno.

commit   : fb30c9c1c5c36989d6b93906986358cb96936d64    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 6 Jul 2019 11:25:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 6 Jul 2019 11:25:37 -0400    

Click here for diff

This code failed to account for the possibility that malloc() would  
change errno, resulting in wrong output for %m, not to mention the  
possibility of message truncation.  Such a change is obviously  
expected when malloc fails, but there's reason to fear that on some  
platforms even a successful malloc call can modify errno.  
  
Discussion: https://postgr.es/m/2576.1527382833@sss.pgh.pa.us  

M src/common/logging.c

Add missing source files to nls.mk

commit   : b33283c36409aef7eddb5ba92bdd9300dd45d974    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 6 Jul 2019 15:02:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 6 Jul 2019 15:02:53 +0200    

Click here for diff

M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/libpq/nls.mk

psql: Fix logging output format

commit   : 3f3542621f131379e32e9283d40853cb6d03a97f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 6 Jul 2019 14:58:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 6 Jul 2019 14:58:08 +0200    

Click here for diff

In normal interactive mode, psql's log messages accidentally got a  
"psql:" prefix that was not supposed to be there.  This only happened  
if there was no .psqlrc file being read, so it wasn't discovered for a  
while.  Fix this by adding the appropriate logging format  
configuration call in the right code path.  
  
Discussion: https://www.postgresql.org/message-id/7586.1560540361@sss.pgh.pa.us  

M src/bin/psql/startup.c

Add missing assertions for required table am callbacks.

commit   : 78d41f6c9b0e1c4bd28f9b80cd07c7530660312f    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 6 Jul 2019 11:41:23 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 6 Jul 2019 11:41:23 +0530    

Click here for diff

Reported-by: Ashwin Agrawal  
Author: Ashwin Agrawal  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com  

M src/backend/access/table/tableamapi.c

Add some test cases to improve test coverage of parse_expr.c.

commit   : cf20cc00a99155a8e41a1bb2a1e498624c86db29    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 23:56:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 23:56:34 -0400    

Click here for diff

I chanced to notice while thumbing through lcov reports that we had  
exactly no coverage of BETWEEN SYMMETRIC, nor of current_time(N) and  
localtime(N).  Improve that.  
  
parse_expr.c still has a pretty awful coverage number, but a large part  
of that is due to lack of coverage of the operator_precedence_warning  
logic.  I have zero desire to write tests for that; I think ripping it  
out would be more sensible at this point.  

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

Remove unreferenced function declarations.

commit   : 79b94716e72086b07549b1c867a8ecdea6bae77e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 19:28:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 19:28:45 -0400    

Click here for diff

These seem to be leftovers from old patches, perhaps.  
  
Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoDuAYsRb3Q9aobkFZ6DZMWxsyg4HOmgkwgeWNfSkTwGxw@mail.gmail.com  

M src/include/access/transam.h
M src/include/commands/tablecmds.h
M src/include/utils/dsa.h

Remove dead encoding-conversion functions.

commit   : 0ab1a2e39b6f65b0f6a5879605ddbf12f9f50de4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 14:17:27 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 14:17:27 -0400    

Click here for diff

The code for conversions SQL_ASCII <-> MULE_INTERNAL and  
SQL_ASCII <-> UTF8 was unreachable, because we long ago changed  
the wrapper functions pg_do_encoding_conversion() et al so that  
they have hard-wired behaviors for conversions involving SQL_ASCII.  
(At least some of those fast paths date back to 2002, though it  
looks like we may not have been totally consistent about this until  
later.)  Given the lack of complaints, nobody is dissatisfied with  
this state of affairs.  Hence, let's just remove the unreachable code.  
  
Also, change CREATE CONVERSION so that it rejects attempts to  
define such conversions.  Since we consider that SQL_ASCII represents  
lack of knowledge about the encoding in use, such a conversion would  
be semantically dubious even if it were reachable.  
  
Adjust a couple of regression test cases that had randomly decided  
to rely on these conversion functions rather than any other ones.  
  
Discussion: https://postgr.es/m/41163.1559156593@sss.pgh.pa.us  

M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_conversion.sgml
M src/backend/commands/conversioncmds.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
D src/backend/utils/mb/conversion_procs/ascii_and_mic/Makefile
D src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
D src/backend/utils/mb/conversion_procs/utf8_and_ascii/Makefile
D src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_proc.dat
M src/include/mb/pg_wchar.h
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

Remove unused variable in statext_mcv_serialize()

commit   : ef777cb093e8cb45dd3ae9d3f1499c765147c1dd    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 5 Jul 2019 18:06:02 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 5 Jul 2019 18:06:02 +0200    

Click here for diff

The itemlen variable used to be referenced in multiple places, but since  
reworking the serialization code it's used only in one assert. Fixed by  
removing the variable and calling the macro from the assert directly.  
  
Backpatch to 12, where this code was introduced.  
  
Reported-by: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1zc_ovH9NZd_9ovuiEWkF9yX06URUDdXCmgDydf-bqB5A@mail.gmail.com  

M src/backend/statistics/mcv.c

Add \warn command to psql.

commit   : 02e95a5049f7933cbde1dacf401604ea3fc02aa5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 12:32:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Jul 2019 12:32:36 -0400    

Click here for diff

This is like \echo except that the text is sent to stderr not stdout.  
  
In passing, fix a pre-existing bug in \echo and \qecho: per documentation  
the -n switch should only be recognized when it is the first argument,  
but actually any argument matching "-n" was treated as a switch.  
(Should we back-patch that?)  
  
David Fetter (bug fix by me), reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/20190421183115.GA4311@fetter.org  

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

Improve comment in postgresql.conf.sample.

commit   : e8fdcacc6cbeed7d1a2175c5eddf0b162e0cb7c4    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 5 Jul 2019 20:59:29 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 5 Jul 2019 20:59:29 +1200    

Click here for diff

The Unix manual section that "man tcp" appears in varies, so let's  
just leave it out of the command to run.  

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

doc: Spell checking

commit   : 594df378ffb04a72b713a13cc0a7166b3bced7b7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 Jul 2019 08:33:51 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 Jul 2019 08:33:51 +0200    

Click here for diff

M doc/src/sgml/btree.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/xfunc.sgml

Add min() and max() aggregates for pg_lsn

commit   : 313f87a17155a6dbd27a3ce687cf59bd171fe75e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jul 2019 12:21:11 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jul 2019 12:21:11 +0900    

Click here for diff

This is useful for monitoring, when it comes for example to calculations  
of WAL retention with replication slots and delays with a set of  
standbys.  
  
Bump catalog version.  
  
Author: Fabrízio de Royes Mello  
Reviewed-by: Surafel Temesgen  
Discussion: https://postgr.es/m/CAFcNs+oc8ZoHhowA4rR1GGCgG8QNgK_TOwPRVYQo5rYy8_PXzA@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/pg_lsn.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/pg_lsn.out
M src/test/regress/sql/pg_lsn.sql

Update hardcoded DH parameters to IANA standards

commit   : 8a810a177c80909b71e9fb3760a1d56ed988638a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jul 2019 10:47:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jul 2019 10:47:32 +0900    

Click here for diff

The source defining the current fallback and hardcoded DH parameters  
has disappeared from the web a long time ago, and RFC 3526 defines the  
most current Diffie-Hellman MODP groups, so update to those new values.  
  
Author: Daniel Gustafsson  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/5E60AC9A-CB10-4851-9EF2-7209490A164C@yesql.se  

M src/include/libpq/libpq-be.h

Simplify pg_mcv_list (de)serialization

commit   : 08aa131c7a72195113ab3a7b191fe8014dd3a898    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 5 Jul 2019 00:45:20 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 5 Jul 2019 00:45:20 +0200    

Click here for diff

The serialization format of multivariate MCV lists included alignment in  
order to allow direct access to part of the serialized data, but despite  
multiple fixes (see for example commits d85e0f366a and ea4e1c0e8f) this  
proved to be problematic.  
  
This commit abandons alignment in the serialized format, and just copies  
everything during deserialization.  We now also track amount of memory  
needed after deserialization (including alignment), which allows us to  
deserialize the MCV list in a single pass.  
  
Bump catversion, as this affects contents of pg_statistic_ext_data.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Author: Tomas Vondra  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/2201.1561521148@sss.pgh.pa.us  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h
M src/include/statistics/extended_stats_internal.h

Fix pg_mcv_list_items() to produce text[]

commit   : 4d66285adc6bb4f9e4fd394d478d663cbccb5fc8    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 4 Jul 2019 23:43:04 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 4 Jul 2019 23:43:04 +0200    

Click here for diff

The function pg_mcv_list_items() returns values stored in MCV items. The  
items may contain columns with different data types, so the function was  
generating text array-like representation, but in an ad-hoc way without  
properly escaping various characters etc.  
  
Fixed by simply building a text[] array, which also makes it easier to  
use from queries etc.  
  
Requires changes to pg_proc entry, so bump catversion.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed  
Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_ext.out

Speed-up build of MCV lists with many distinct values

commit   : e365a581c246a8e18f38cc530013391329dcdb02    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 4 Jul 2019 23:02:02 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 4 Jul 2019 23:02:02 +0200    

Click here for diff

When building multi-column MCV lists, we compute base frequency for each  
item, i.e. a product of per-column frequencies for values from the item.  
As a value may be in multiple groups, the code was scanning the whole  
array of groups while adding items to the MCV list.  This works fine as  
long as the number of distinct groups is small, but it's easy to trigger  
trigger O(N^2) behavior, especially after increasing statistics target.  
  
This commit precomputes frequencies for values in all columns, so that  
when computing the base frequency it's enough to make a simple bsearch  
lookup in the array.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development  

M src/backend/statistics/mcv.c

Remove unnecessary casts from size_t to int

commit   : d5ab9df7774b4570ff50e64b7fa3ba8295596d06    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 6 Jun 2019 14:32:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 6 Jun 2019 14:32:54 +0200    

Click here for diff

We can use the %zu format specifier directly, no need to cast to int.  

M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.trailer

Unwind some workarounds for lack of portable int64 format specifier

commit   : 6a1cd8b9236dcfa91b40af3a8337859e16ba7113    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 6 Jun 2019 14:14:29 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 6 Jun 2019 14:14:29 +0200    

Click here for diff

Because there is no portable int64/uint64 format specifier and we  
can't stick macros like INT64_FORMAT into the middle of a translatable  
string, we have been using various workarounds that put the number to  
be printed into a string buffer first.  Now that we always use our own  
sprintf(), we can rely on %lld and %llu to work, so we can use those.  
  
This patch undoes this workaround in a few places where it was  
egregiously verbose.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/CAH2-Wz%3DWbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A%40mail.gmail.com  

M src/backend/access/transam/xlogreader.c
M src/backend/replication/basebackup.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_test_timing/pg_test_timing.c

Sync our Snowball stemmer dictionaries with current upstream

commit   : 7b925e12703652fef63a2fbbb28d3407b2971d6e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jul 2019 13:10:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jul 2019 13:10:41 +0200    

Click here for diff

The main change is a new stemmer for Greek.  There are minor changes  
in the Danish and French stemmers.  
  
Author: Panagiotis Mavrogiorgos <pmav99@gmail.com>  

M doc/src/sgml/textsearch.sgml
M src/backend/snowball/Makefile
M src/backend/snowball/README
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
M src/backend/snowball/libstemmer/stem_UTF_8_danish.c
M src/backend/snowball/libstemmer/stem_UTF_8_french.c
A src/backend/snowball/libstemmer/stem_UTF_8_greek.c
M src/backend/snowball/libstemmer/utilities.c
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/snowball/libstemmer/api.h
A src/include/snowball/libstemmer/stem_UTF_8_greek.h

Clean up whitespace a bit

commit   : dedb6e0143554e76d4d11376d65c0aa68f8412d4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jul 2019 12:31:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jul 2019 12:31:08 +0200    

Click here for diff

M src/backend/snowball/Makefile

Introduce safer encoding and decoding routines for base64.c

commit   : cfc40d384ae51ea2886d599d2008ae57b529e6ea    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 4 Jul 2019 16:08:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 4 Jul 2019 16:08:09 +0900    

Click here for diff

This is a follow-up refactoring after 09ec55b and b674211, which has  
proved that the encoding and decoding routines used by SCRAM have a  
poor interface when it comes to check after buffer overflows.  This adds  
an extra argument in the shape of the length of the result buffer for  
each routine, which is used for overflow checks when encoding or  
decoding an input string.  The original idea comes from Tom Lane.  
  
As a result of that, the encoding routine can now fail, so all its  
callers are adjusted to generate proper error messages in case of  
problems.  
  
On failure, the result buffer gets zeroed.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/20190623132535.GB1628@paquier.xyz  

M src/backend/libpq/auth-scram.c
M src/common/base64.c
M src/common/scram-common.c
M src/include/common/base64.h
M src/interfaces/libpq/fe-auth-scram.c

Simplify TAP tests of pg_dump for connection strings

commit   : d5ab9a891cb590aad4278026b2edda685f2524a2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 4 Jul 2019 11:33:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 4 Jul 2019 11:33:42 +0900    

Click here for diff

The last set of scenarios did an initialization of nodes followed by an  
extra command to set up the authentication policy with pg_regress  
--config-auth.  This configuration step can be integrated directly using  
the option auth_extra from PostgresNode::init when initializing the  
node, saving from one extra command.  On Windows, this also restricts  
more pg_ident.conf for the SSPI user mapping by removing the entry of  
the OS user running the test, which is not needed anyway.  
  
Note that IPC::Run mishandles double quotes, hence the restore user name  
is changed to map with that.  This was already done in the test as a  
later step, but not in a consistent way, causing the switch to use  
auth_extra to fail.  
  
Found while reviewing ca129e5.  
  
Discussion: https://postgr.es/m/20190703062024.GD3084@paquier.xyz  

M src/bin/pg_dump/t/010_dump_connstr.pl

Use appendStringInfoString and appendPQExpBufferStr where possible

commit   : 8abc13a88938ef473b8a486186f1b96630450728    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 4 Jul 2019 13:01:13 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 4 Jul 2019 13:01:13 +1200    

Click here for diff

This changes various places where appendPQExpBuffer was used in places  
where it was possible to use appendPQExpBufferStr, and likewise for  
appendStringInfo and appendStringInfoString.  This is really just a  
stylistic improvement, but there are also small performance gains to be  
had from doing this.  
  
Discussion: http://postgr.es/m/CAKJS1f9P=M-3ULmPvr8iCno8yvfDViHibJjpriHU8+SXUgeZ=w@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/selinux.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/commands/explain.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.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_upgrade/dump.c
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/string_utils.c
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-protocol3.c

Ensure plpgsql result tuples have the right composite type marking.

commit   : 5683b34956b4e8da9dccadc2e3a53b86104ebb33    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Jul 2019 18:08:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Jul 2019 18:08:53 -0400    

Click here for diff

A function that is declared to return a named composite type must  
return tuple datums that are physically marked as having that type.  
The plpgsql code path that allowed directly returning an expanded-record  
datum forgot to check that, so that an expanded record marked as type  
RECORDOID could be returned if it had a physically-compatible tupdesc.  
This'd be harmless, I think, if the record value never escaped the  
current session --- but it's possible for it to get stored into a table,  
and then subsequent sessions can't interpret the anonymous record type.  
  
Fix by flattening the record into a tuple datum and overwriting its  
type/typmod fields, if its declared type doesn't match the function's  
declared type.  (In principle it might be possible to just change the  
expanded record's stored type ID info, but there are enough tricky  
consequences that I didn't want to mess with that, especially not in  
a back-patched bug fix.)  
  
Per bug report from Steve Rogerson.  Back-patch to v11 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/cbaecae6-7b87-584e-45f6-4d047b92ca2a@yewtc.demon.co.uk  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Doc: document table persistence display in \dt+.

commit   : 03e7b302b1d5a67758e756b1f64686c29d37558f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Jul 2019 12:18:10 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Jul 2019 12:18:10 -0400    

Click here for diff

Forgotten in commit 9a2ea6183.  

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

commit   : 9a2ea618323a4cf8ca7eb6a828b08c6e39b95cdd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Jul 2019 11:46:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Jul 2019 11:46:34 -0400    

Click here for diff

In verbose mode, listTables() now emits a "Persistence" column  
showing whether the table/index/view/etc is permanent, temporary,  
or unlogged.  
  
David Fetter, reviewed by Fabien Coelho and Rafia Sabih  
  
Discussion: https://postgr.es/m/20190423005642.GZ28936@fetter.org  

M src/bin/psql/describe.c

Don't remove surplus columns from GROUP BY for inheritance parents

commit   : a5be4062f7bf2ae9487c5a31ee337a56425cdc84    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 3 Jul 2019 23:44:54 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 3 Jul 2019 23:44:54 +1200    

Click here for diff

d4c3a156c added code to remove columns that were not part of a table's  
PRIMARY KEY constraint from the GROUP BY clause when all the primary key  
columns were present in the group by.  This is fine to do since we know  
that there will only be one row per group coming from this relation.  
However, the logic failed to consider inheritance parent relations.  These  
can have child relations without a primary key, but even if they did, they  
could duplicate one of the parent's rows or one from another child  
relation.  In this case, those additional GROUP BY columns are required.  
  
Fix this by disabling the optimization for inheritance parent tables.  
In v11 and beyond, partitioned tables are fine since partitions cannot  
overlap and before v11 partitioned tables could not have a primary key.  
  
Reported-by: Manuel Rigger  
Discussion: http://postgr.es/m/CA+u7OA7VLKf_vEr6kLF3MnWSA9LToJYncgpNX2tQ-oWzYCBQAw@mail.gmail.com  
Backpatch-through: 9.6  

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

postgres_fdw: Remove redundancy in postgresAcquireSampleRowsFunc().

commit   : 2a1612104cadbfdc739ff0370f279779f323c3b5    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 3 Jul 2019 17:51:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 3 Jul 2019 17:51:00 +0900    

Click here for diff

Previously, in the loop in postgresAcquireSampleRowsFunc() to iterate  
fetching rows from a given remote table, we redundantly 1) determined the  
fetch size by parsing the table's server/table-level options and then 2)  
constructed the fetch command; remove that redundancy.  
  
Author: Etsuro Fujita  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAPmGK17_urk9qkLV65_iYMFw64z5qhdfhY=tMVV6Jg4KNYx8+w@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c

Fix small memory leak in ecpglib ecpg_update_declare_statement() is called the second time.

commit   : e72489e101b21c328e3d10ca64e5367c60f424a5    
  
author   : Michael Meskes <meskes@postgresql.org>    
date     : Tue, 2 Jul 2019 03:51:13 +0200    
  
committer: Michael Meskes <meskes@postgresql.org>    
date     : Tue, 2 Jul 2019 03:51:13 +0200    

Click here for diff

Author: "Zhang, Jie" <zhangjie2@cn.fujitsu.com>  

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

Use strtoint() instead of strtol() in pgtypeslib where the result is stored in an int variable.

commit   : 8372e3c98fbbd529e4545c4d7982e278e118958e    
  
author   : Michael Meskes <meskes@postgresql.org>    
date     : Tue, 2 Jul 2019 03:42:09 +0200    
  
committer: Michael Meskes <meskes@postgresql.org>    
date     : Tue, 2 Jul 2019 03:42:09 +0200    

Click here for diff

Author: Yang Xiao <YangX92@hotmail.com>  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Made ecpg compatibility mode and run-time behaviour options case insensitive.

commit   : 75220fb62b1387b61f92c42b1bd147cb30607012    
  
author   : Michael Meskes <meskes@postgresql.org>    
date     : Tue, 2 Jul 2019 03:34:58 +0200    
  
committer: Michael Meskes <meskes@postgresql.org>    
date     : Tue, 2 Jul 2019 03:34:58 +0200    

Click here for diff

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

Fix accidentally swapped error message arguments

commit   : 84c41ae81bdf15cac71cc5ae0af69b4815594522    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Jul 2019 23:44:30 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Jul 2019 23:44:30 +0100    

Click here for diff

Author: Alexey Kondratov <a.kondratov@postgrespro.ru>  

M src/bin/initdb/initdb.c

Remove redundant newlines from error messages

commit   : 24c7000f64487323fedb52b8aeadf2c84274dcf5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Jul 2019 23:18:43 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Jul 2019 23:18:43 +0100    

Click here for diff

These are no longer needed/allowed with the new logging API.  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/pg_rewind.c

Don't treat complete_from_const as equivalent to complete_from_list.

commit   : b4771d7c7f37d19e2879b18e288f681849d55806    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 Jul 2019 14:04:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 Jul 2019 14:04:42 -0400    

Click here for diff

Commit 4f3b38fe2 supposed that complete_from_const() is equivalent to  
the one-element-list case of complete_from_list(), but that's not  
really true at all.  complete_from_const() supposes that the completion  
is certain enough to justify wiping out whatever the user typed, while  
complete_from_list() will only provide completions that match the  
word-so-far.  
  
In practice, given the lame parsing technology used by tab-complete.c,  
it's fairly hard to believe that we're *ever* certain enough about  
a completion to justify auto-correcting user input that doesn't match.  
  
Hence, remove the inappropriate unification of the two cases.  
As things now stand, complete_from_const() is used only for the  
situation where we have no matches and we need to keep readline  
from applying its default complete-with-file-names behavior.  
  
This (mis?) behavior actually exists much further back, but  
I'm hesitant to change it in released branches.  It's not too  
late for v12, though, especially seeing that the aforesaid  
commit is new in v12.  
  
Per gripe from Ken Tanzer.  
  
Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com  

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

Fix tab completion of "SET variable TO|=" to not offer bogus completions.

commit   : 0ec3e13c69779117c8cfa39adcc6863631dedd44    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 Jul 2019 13:35:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 Jul 2019 13:35:14 -0400    

Click here for diff

Don't think that the context "UPDATE tab SET var =" is a GUC-setting  
command.  
  
If we have "SET var =" but the "var" is not a known GUC variable,  
don't offer any completions.  The most likely explanation is that  
we've misparsed the context and it's not really a GUC-setting command.  
  
Per gripe from Ken Tanzer.  Back-patch to 9.6.  The issue exists  
further back, but before 9.6 the code looks very different and it  
doesn't actually know whether the "var" name matches anything,  
so I desisted from trying to fix it.  
  
Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com  

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

Simplify psql \d's rule for ordering the indexes of a table.

commit   : 4d6603f28dfc4a1cab0d7d317855d935e314297a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 Jul 2019 12:32:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 Jul 2019 12:32:49 -0400    

Click here for diff

The previous rule was "primary key (if any) first, then other unique  
indexes in name order, then all other indexes in name order".  
But the preference for unique indexes seems a bit obsolete since the  
introduction of exclusion constraints.   It's no longer the case  
that unique indexes are the only ones that constrain what data can  
be in the table, and it's hard to see what other rationale there is  
for separating out unique indexes.  Other new features like the  
possibility for some indexes to be INVALID (hence, not constraining  
anything) make this even shakier.  
  
Hence, simplify the sort order to be "primary key (if any) first,  
then all other indexes in name order".  
  
No documentation change, since this was never documented anyway.  
A couple of existing regression test cases change output, though.  
  
Discussion: https://postgr.es/m/14422.1561474929@sss.pgh.pa.us  

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/replica_identity.out

Remove obsolete nbtree "get root" comment.

commit   : 66c5bd3a6fd8a4c317412838ab3870ab251833b6    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 1 Jul 2019 22:28:08 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 1 Jul 2019 22:28:08 -0700    

Click here for diff

Remove a very old Berkeley era comment that doesn't seem to have  
anything to do with the current locking considerations within  
_bt_getroot().  
  
Discussion: https://postgr.es/m/CAH2-WzmA2H+rL-xxF5o6QhMD+9x6cJTnz2Mr3Li_pbPBmqoTBQ@mail.gmail.com  

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

Add support for Visual Studio 2019 in build scripts

commit   : 2b1394fc2b52a2573d08aa626e7b49568f27464e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 Jul 2019 14:02:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 Jul 2019 14:02:33 +0900    

Click here for diff

This fixes at the same time a set of inconsistencies in the  
documentation and the scripts related to the versions of Windows SDK  
supported.  
  
Author: Haribabu Kommi  
Reviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, Michael  
Paquier  
Discussion: https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.com  

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

Refactor code of reindexdb for query generation

commit   : 9adda24543e354317abf5400d7e7d3961a93bce6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 Jul 2019 11:36:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 Jul 2019 11:36:53 +0900    

Click here for diff

This merges the portion related to REINDEX SYSTEM into the routine  
already available for all the other reindex types, making the query  
generation cleaner.  While on it, change the handling of the reindex  
types using an enum, which allows to get rid of the hardcoded strings  
used directly in the query generation present for the same purpose (aka  
"TABLE", "DATABASE", etc.).  
  
Per discussion with Julien Rouhaud, Tom Lane, Alvaro Herrera and me.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/CAOBaU_bSmSik_WRK9niDnm-3NkNZky6+uKxkmQwvthZvMWpS5A@mail.gmail.com  

M src/bin/scripts/reindexdb.c
M src/tools/pgindent/typedefs.list

Remove support for non-ELF BSD systems

commit   : c72f9b9502eadb6b84c6681cdb3bff12b35d3c8a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jul 2019 23:46:24 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jul 2019 23:46:24 +0100    

Click here for diff

This is long obsolete.  
  
Discussion: https://www.postgresql.org/message-id/8eacdc0d-123f-dbca-bacf-0a68766a4889@2ndquadrant.com  

M configure
M configure.in
M src/Makefile.global.in
M src/Makefile.shlib
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd

Stamp HEAD as 13devel.

commit   : 615cebc94b5ef8fbe353e3c8b838b1e97bcdfd49    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jul 2019 12:50:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jul 2019 12:50:55 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.in
M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-12.sgml
A doc/src/sgml/release-13.sgml
M doc/src/sgml/release.sgml
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

pgindent run prior to branching v12.

commit   : 9e1c9f959422192bbe1b842a2a1ffaf76b080196    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jul 2019 12:37:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jul 2019 12:37:52 -0400    

Click here for diff

pgperltidy and reformat-dat-files too, though the latter didn't  
find anything to change.  

M contrib/postgres_fdw/postgres_fdw.h
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/findtimezone.c
M src/include/catalog/pg_statistic_ext_data.h
M src/tools/msvc/Mkvcbuild.pm
M src/tools/pgindent/README
M src/tools/pgindent/typedefs.list

Doc: remove obsolete description of oid column as being "hidden".

commit   : 145b18688c04963efcab8ef3e7e10659bf783eb1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jul 2019 12:09:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jul 2019 12:09:06 -0400    

Click here for diff

Looks like one copy of this text didn't get updated.  
  
Justin Pryzby  
  
Discussion: https://postgr.es/m/20190701155932.GA22866@telsasoft.com  

M doc/src/sgml/catalogs.sgml

Revert fix missing call to table_finish_bulk_insert during COPY

commit   : f5db56fc4d6e95c582b61c99328ea0702b869fa0    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 2 Jul 2019 03:44:56 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 2 Jul 2019 03:44:56 +1200    

Click here for diff

This reverts commits 4de60244e and b2d69806d. Further thought is  
required to make this work properly.  

M src/backend/commands/copy.c

Remove surplus call to table_finish_bulk_insert

commit   : b2d69806d8cc902802a7b56ba37fb7c55e58b0ed    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 2 Jul 2019 03:07:15 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 2 Jul 2019 03:07:15 +1200    

Click here for diff

4de60244e added the call to table_finish_bulk_insert to the  
CopyMultiInsertBufferCleanup function.  We use a CopyMultiInsertBuffer even  
for non-partitioned tables, so having the cleanup do that meant we would  
call table_finsh_bulk_insert twice when performing COPY FROM with  
a non-partitioned table.  
  
Here we can just remove the direct call in CopyFrom and let  
CopyMultiInsertBufferCleanup handle the call instead.  

M src/backend/commands/copy.c

Fix missing call to table_finish_bulk_insert during COPY

commit   : 4de60244e2fcdeb100afc7f8bf5c28b32923a637    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 2 Jul 2019 01:23:26 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 2 Jul 2019 01:23:26 +1200    

Click here for diff

86b85044e abstracted calls to heap functions in COPY FROM to support a  
generic table AM.  However, when performing a copy into a partitioned  
table, this commit neglected to call table_finish_bulk_insert for each  
partition.  Before 86b85044e, when we always called the heap functions,  
there was no need to call heapam_finish_bulk_insert for partitions since  
it only did any work when performing a copy without WAL. For partitioned  
tables, this was unsupported anyway, so there was no issue. With pluggable  
storage, we can't make any assumptions about what the table AM might want  
to do in its equivalent function, so we'd better ensure we always call  
table_finish_bulk_insert each partition that's received a row.  
  
For now, we make the table_finish_bulk_insert call whenever we evict a  
CopyMultiInsertBuffer out of the CopyMultiInsertInfo.  This does mean  
that it's possible that we call table_finish_bulk_insert multiple times  
per partition, which is not a problem other than being an inefficiency.  
Improving this requires a more invasive patch, so let's leave that for  
another day.  
  
In passing, move the table_finish_bulk_insert for the target of the COPY  
command so that it's only called when we're actually performing bulk  
inserts.  We don't need to call this when inserting 1 row at a time.  
  
Reported-by: Robert Haas  
Discussion: https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com  

M src/backend/commands/copy.c

Convert some stragglers to new frontend logging API

commit   : 95bbe5d82e428db342fa3ec60b95f1b9873741e5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jul 2019 13:34:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jul 2019 13:34:31 +0200    

Click here for diff

M src/bin/initdb/initdb.c

Add missing serial commas

commit   : 1b29e990e352885642149262859b83c19d362405    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jul 2019 13:07:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jul 2019 13:07:14 +0200    

Click here for diff

M src/backend/catalog/pg_proc.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl

Fix many typos and inconsistencies

commit   : c74d49d41c9e0fabeb1179dcabfb3137833ed831    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 1 Jul 2019 10:00:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 1 Jul 2019 10:00:23 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/af27d1b3-a128-9d62-46e0-88f424397f44@gmail.com  

M contrib/bloom/blutils.c
M contrib/intarray/_int_selfuncs.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-des.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/diskusage.sgml
M src/backend/access/brin/brin_tuple.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/catalog/heap.c
M src/backend/executor/execExpr.c
M src/backend/libpq/be-fsstubs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_target.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/barrier.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/include/access/attnum.h
M src/include/access/hash.h
M src/include/commands/event_trigger.h
M src/include/commands/extension.h
M src/include/executor/nodeCustom.h
M src/include/funcapi.h
M src/include/nodes/primnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/storage/fd.h
M src/include/storage/proc.h
M src/include/tcop/tcopprot.h
M src/include/utils/inval.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-auth.c

Don't read fields of a misaligned ExpandedObjectHeader or AnyArrayType.

commit   : 459c3cdb4ad8323bfe6bcae0186a3831e0c89c94    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 30 Jun 2019 17:34:17 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 30 Jun 2019 17:34:17 -0700    

Click here for diff

UBSan complains about this.  Instead, cast to a suitable type requiring  
only 4-byte alignment.  DatumGetAnyArrayP() already assumes one can cast  
between AnyArrayType and ArrayType, so this doesn't introduce a new  
assumption.  Back-patch to 9.5, where AnyArrayType was introduced.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/20190629210334.GA1244217@rfd.leadboat.com  

M src/backend/utils/adt/arrayfuncs.c
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/expandeddatum.h

Repair logic for reordering grouping sets optimization.

commit   : da53be23d1c5e529675e958eaee54cfed4e4dbac    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sun, 30 Jun 2019 23:49:13 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sun, 30 Jun 2019 23:49:13 +0100    

Click here for diff

The logic in reorder_grouping_sets to order grouping set elements to  
match a pre-specified sort ordering was defective, resulting in  
unnecessary sort nodes (though the query output would still be  
correct). Repair, simplifying the code a little, and add a test.  
  
Per report from Richard Guo, though I didn't use their patch. Original  
bug seems to have been my fault.  
  
Backpatch back to 9.5 where grouping sets were introduced.  
  
Discussion: https://postgr.es/m/CAN_9JTzyjGcUjiBHxLsgqfk7PkdLGXiM=pwM+=ph2LsWw0WO1A@mail.gmail.com  

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

Exclude new src/test/modules/unsafe_tests directory from MSVC build.

commit   : c000a47ad1fdd4fb92c7068279d97e0c3db4f8eb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 30 Jun 2019 14:05:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 30 Jun 2019 14:05:24 -0400    

Click here for diff

There's nothing to build here, and that was confusing AddContrib().  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Blind attempt to fix SSPI-auth case in 010_dump_connstr.pl.

commit   : 681cca86f5071379c4a8599ef9387b666b7e6879    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 30 Jun 2019 13:34:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 30 Jun 2019 13:34:45 -0400    

Click here for diff

Up to now, pg_regress --config-auth had a hard-wired assumption  
that the target cluster uses the default bootstrap superuser name.  
pg_dump's 010_dump_connstr.pl TAP test uses non-default superuser  
names, and was klugily getting around the restriction by listing  
the desired superuser name as a role to "create".  This is pretty  
confusing (or at least, it confused me).  Let's make it clearer by  
allowing --config-auth mode to be told the bootstrap superuser name.  
Repurpose the existing --user switch for that, since it has no  
other function in --config-auth mode.  
  
Per buildfarm.  I don't have an environment at hand in which I can  
test this fix, but the buildfarm should soon show if it works.  
  
Discussion: https://postgr.es/m/3142.1561840611@sss.pgh.pa.us  

M src/bin/pg_dump/t/010_dump_connstr.pl
M src/test/regress/pg_regress.c

Move rolenames test out of the core regression tests.

commit   : c91504b958e1647f87ffb7168e61db75ca09b928    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 30 Jun 2019 12:51:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 30 Jun 2019 12:51:08 -0400    

Click here for diff

This test script is unsafe to run in "make installcheck" mode for  
(at least) two reasons: it creates and destroys some role names  
that don't follow the "regress_xxx" naming convention, and it  
sets and then resets the application_name GUC attached to every  
existing role.  While we've not had complaints, these surely are  
not good things to do within a production installation, and  
regress.sgml pretty clearly implies that we won't do them.  
  
Rather than lose test coverage altogether, let's just move this  
script somewhere where it will get run by "make check" but not  
"make installcheck".  src/test/modules/ already has that property.  
  
Since it seems likely that we'll want other regression tests in  
future that also exceed the constraints of "make installcheck",  
create a generically-named src/test/modules/unsafe_tests/  
directory to hold them.  
  
Discussion: https://postgr.es/m/16638.1468620817@sss.pgh.pa.us  

M src/test/modules/Makefile
A src/test/modules/unsafe_tests/.gitignore
A src/test/modules/unsafe_tests/Makefile
A src/test/modules/unsafe_tests/README
R100 src/test/regress/expected/rolenames.out src/test/modules/unsafe_tests/expected/rolenames.out
R100 src/test/regress/sql/rolenames.sql src/test/modules/unsafe_tests/sql/rolenames.sql
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule

Fix breakage introduced in pg_lsn_in()

commit   : 2e810508f6b0d89621094445620a1bea3ceff3f1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 30 Jun 2019 13:25:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 30 Jun 2019 13:25:33 +0200    

Click here for diff

Using PG_RETURN_LSN() from non-fmgr pg_lsn_in_internal() happened to  
work on some platforms, but should just be a plain "return".  

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

Don't call data type input functions in GUC check hooks

commit   : 21f428ebde39339487c271a830fed135d6032d73    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 30 Jun 2019 10:15:25 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 30 Jun 2019 10:15:25 +0200    

Click here for diff

Instead of calling pg_lsn_in() in check_recovery_target_lsn and  
timestamptz_in() in check_recovery_target_time, reorganize the  
respective code so that we don't raise any errors in the check hooks.  
The previous code tried to use PG_TRY/PG_CATCH to handle errors in a  
way that is not safe, so now the code contains no ereport() calls and  
can operate safely within the GUC error handling system.  
  
Moreover, since the interpretation of the recovery_target_time string  
may depend on the time zone, we cannot do the final processing of that  
string until all the GUC processing is done.  Instead,  
check_recovery_target_time() now does some parsing for syntax  
checking, but the actual conversion to a timestamptz value is done  
later in the recovery code that uses it.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/flat/20190611061115.njjwkagvxp4qujhp%40alap3.anarazel.de  

M src/backend/access/transam/xlog.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/misc/guc.c
M src/include/access/xlog.h
M src/include/utils/pg_lsn.h

Remove explicit error handling for obsolete date/time values

commit   : 666cbae16da46b833f57ef8b12ff0bf215684d9c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 12 Jun 2019 11:29:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 12 Jun 2019 11:29:53 +0200    

Click here for diff

The date/time values 'current', 'invalid', and 'undefined' were  
removed a long time ago, but the code still contains explicit error  
handling for the transition.  To simplify the code and avoid having to  
handle these values everywhere, just remove the recognition of these  
tokens altogether now.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/datetime.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/test/regress/expected/date.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/date.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Add an enforcement mechanism for global object names in regression tests.

commit   : 54100f5c6052404f68de9ce7310ceb61f1c291f8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Jun 2019 11:34:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Jun 2019 11:34:00 -0400    

Click here for diff

In commit 18555b132 we tentatively established a rule that regression  
tests should use names containing "regression" for databases, and names  
starting with "regress_" for all other globally-visible object names, so  
as to circumscribe the side-effects that "make installcheck" could have  
on an existing installation.  
  
This commit adds a simple enforcement mechanism for that rule: if the code  
is compiled with ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS defined, it  
will emit a warning (not an error) whenever a database, role, tablespace,  
subscription, or replication origin name is created that doesn't obey the  
rule.  Running one or more buildfarm members with that symbol defined  
should be enough to catch new violations, at least in the regular  
regression tests.  Most TAP tests wouldn't notice such warnings, but  
that's actually fine because TAP tests don't execute against an existing  
server anyway.  
  
Since it's already the case that running src/test/modules/ tests in  
installcheck mode is deprecated, we can use that as a home for tests  
that seem unsafe to run against an existing server, such as tests that  
might have side-effects on existing roles.  Document that (though this  
commit doesn't in itself make it any less safe than before).  
  
Update regress.sgml to define these restrictions more clearly, and  
to clean up assorted lack-of-up-to-date-ness in its descriptions of  
the available regression tests.  
  
Discussion: https://postgr.es/m/16638.1468620817@sss.pgh.pa.us  

M doc/src/sgml/regress.sgml
M src/backend/commands/alter.c
M src/backend/commands/dbcommands.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/replication/logical/origin.c
M src/test/modules/README

Fix regression tests to use only global names beginning with "regress_".

commit   : ca129e58c01f29ef24a734313ff315933b3d5b67    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Jun 2019 11:09:03 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Jun 2019 11:09:03 -0400    

Click here for diff

In commit 18555b132 we tentatively established a rule that regression  
tests should use names containing "regression" for databases, and names  
starting with "regress_" for all other globally-visible object names, so  
as to circumscribe the side-effects that "make installcheck" could have on  
an existing installation.  However, no enforcement mechanism was created,  
so it's unsurprising that some new violations have crept in since then.  
  
In fact, a whole new *category* of violations has crept in, to wit we now  
also have globally-visible subscription and replication origin names, and  
"make installcheck" could very easily clobber user-created objects of  
those types.  So it's past time to do something about this.  
  
This commit sanitizes the tests enough that they will pass (i.e. not  
generate any visible warnings) with the enforcement mechanism I'll add  
in the next commit.  There are some TAP tests that still trigger the  
warnings, but the warnings do not cause test failure.  Since these tests  
do not actually run against a pre-existing installation, there's no need  
to worry whether they could conflict with user-created objects.  
  
The problem with rolenames.sql testing special role names like "user"  
is still there, and is dealt with only very cosmetically in this patch  
(by hiding the warnings :-().  What we actually need to do to be safe is  
to take that test script out of "make installcheck" altogether, but that  
seems like material for a separate patch.  
  
Discussion: https://postgr.es/m/16638.1468620817@sss.pgh.pa.us  

M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/sql/rewrite.sql
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_upgrade/test.sh
M src/test/regress/expected/object_address.out
M src/test/regress/expected/rolenames.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/rolenames.sql
M src/test/regress/sql/subscription.sql

Disallow user-created replication origins named "pg_xxx".

commit   : a1e61badf97bc446053145ba40de6db835678ce3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Jun 2019 10:30:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Jun 2019 10:30:08 -0400    

Click here for diff

Since we generate such names internally, it seems like a good idea  
to have a policy of disallowing them for user use, as we do for many  
other object types.  Otherwise attempts to use them will randomly  
fail due to collisions with internally-generated names.  
  
Discussion: https://postgr.es/m/3606.1561747369@sss.pgh.pa.us  

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

Remove unnecessary header from be-secure-gssapi.c

commit   : c0faa727507ed34db0d02769d21bbaaf9605e2e4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 29 Jun 2019 11:14:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 29 Jun 2019 11:14:21 +0900    

Click here for diff

libpq/libpq-be.h is included by libpq/libpq.h so there is no need to  
explicitly include it separately.  
  
Author: Daniel Gustafsson  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/A4852E46-9ED1-4861-A23B-22A83E34A084@yesql.se  

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

Fix for dropped columns in a partitioned table's default partition

commit   : 23cccb17fe0bbb5df86780da5c346cc060c21421    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 28 Jun 2019 14:51:08 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 28 Jun 2019 14:51:08 -0400    

Click here for diff

We forgot to map column numbers to/from the default partition for  
various operations, leading to valid cases failing with spurious  
errors, such as  
ERROR:  attribute N of type some_partition has been dropped  
  
It was also possible that the search for conflicting rows in the default  
partition when attaching another partition would fail to detect some.  
Secondarily, it was also possible that such a search should be skipped  
(because the constraint was implied) but wasn't.  
  
Fix all this by mapping column numbers when necessary.  
  
Reported by: Daniel Wilches  
Author: Amit Langote  
Discussion: https://postgr.es/m/15873-8c61945d6b3ef87c@postgresql.org  

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

Fix misleading comment in nodeIndexonlyscan.c.

commit   : 74b7cc8c02137f059703972aa14445b1e073f005    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 28 Jun 2019 11:11:26 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 28 Jun 2019 11:11:26 +1200    

Click here for diff

The stated reason for acquiring predicate locks on heap pages hasn't  
existed since commit c01262a8, so fix the comment.  Perhaps in a later  
release we'll also be able to change the code to use tuple locks.  
  
Back-patch all the way.  
  
Reviewed-by: Ashwin Agrawal  
Discussion: https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com  

M src/backend/executor/nodeIndexonlyscan.c

Update reference to sampling algorithm in analyze.c

commit   : 69fd82fedd746b82427097883daf2921dd77584e    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 27 Jun 2019 17:41:29 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 27 Jun 2019 17:41:29 +0200    

Click here for diff

Commit 83e176ec1 moved row sampling functions from analyze.c to  
utils/misc/sampling.c, but failed to update comment referring to  
the sampling algorithm from Jeff Vitter's paper. Correct the  
comment by pointing to utils/misc/sampling.c.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK154gp%2BQd%3DcorQOv%2BPmbyVyZBjp_%2Bhb766UJeD1e_ie6XQ%40mail.gmail.com  

M src/backend/commands/analyze.c

Fix use-after-free introduced in 55ed3defc966

commit   : 050098b14e33a5d3dfabf172ebbddd20c6bb4665    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 27 Jun 2019 11:57:10 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 27 Jun 2019 11:57:10 -0400    

Click here for diff

Evidenced by failure under RELCACHE_FORCE_RELEASE (buildfarm member  
prion).  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqGV=k_Eh4jBiQw66ivvdG+EUkrEYeHTYL1SvDj_YOYV0g@mail.gmail.com  

M src/backend/commands/indexcmds.c

Update comment

commit   : f2f0082ef5969b57d0b52d0c2e891872ed1b0a51    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 27 Jun 2019 15:57:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 27 Jun 2019 15:57:14 +0200    

Click here for diff

Function was renamed/replaced in  
c2fe139c201c48f1133e9fbea2dd99b8efe2fadd but the header comment was  
not updated.  

M src/backend/access/index/indexam.c

Remove remaining traces of Rand_OpenSSL() from the tree

commit   : 322c5bfdc3d76f6463768ecd8fced30c881b8be5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 27 Jun 2019 08:25:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 27 Jun 2019 08:25:26 +0900    

Click here for diff

fe0a0b5 has removed the last use of this routine from pgcrypto, leading  
to a useless symbol definition and an extra configure check.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/20190626142544.GN1714@paquier.xyz  

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

Fix partitioned index creation with foreign partitions

commit   : 55ed3defc966cf718fe1e8c0efe964580bb23351    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 26 Jun 2019 18:38:51 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 26 Jun 2019 18:38:51 -0400    

Click here for diff

When a partitioned tables contains foreign tables as partitions, it is  
not possible to implement unique or primary key indexes -- but when  
regular indexes are created, there is no reason to do anything other  
than ignoring such partitions.  We were raising errors upon encountering  
the foreign partitions, which is unfriendly and doesn't protect against  
any actual problems.  
  
Relax this restriction so that index creation is allowed on partitioned  
tables containing foreign partitions, becoming a no-op on them.  (We may  
later want to redefine this so that the FDW is told to create the  
indexes on the foreign side.)  This applies to CREATE INDEX, as well as  
ALTER TABLE / ATTACH PARTITION and CREATE TABLE / PARTITION OF.  
  
Backpatch to 11, where indexes on partitioned tables were introduced.  
  
Discussion: https://postgr.es/m/15724-d5a58fa9472eef4f@postgresql.org  
Author: Álvaro Herrera  
Reviewed-by: Amit Langote  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Follow the rule that regression-test-created roles are named "regress_xxx".

commit   : 65e6d42140c8d9918638b9f73528288ab980af82    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 25 Jun 2019 23:06:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 25 Jun 2019 23:06:17 -0400    

Click here for diff

contrib/amcheck didn't get the memo either.  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql

Follow the rule that regression-test-created roles are named "regress_xxx".

commit   : c360477d2e2f65fdea64aa8bc94a6286d0883f7a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 25 Jun 2019 22:53:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 25 Jun 2019 22:53:42 -0400    

Click here for diff

Commit 1c5d9270e had not gotten the word about this.  (For previous  
context, see 18555b132.)  

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

Add support for OpenSSL 1.1.0 and newer versions in MSVC scripts

commit   : d993e0fb82ffaa15be72c1ac10403bfa06708069    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 26 Jun 2019 10:44:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 26 Jun 2019 10:44:46 +0900    

Click here for diff

Up to now, the MSVC build scripts are able to support only one fixed  
version of OpenSSL, and they lacked logic to detect the version of  
OpenSSL a given compilation of Postgres is linking to (currently 1.0.2,  
the latest LTS of upstream which will be EOL'd at the end of 2019).  
  
This commit adds more logic to detect the version of OpenSSL used by a  
build and makes use of it to add support for compilation with OpenSSL  
1.1.0 which requires a new set of compilation flags to work properly.  
  
The supported OpenSSL installers have changed their library layer with  
various library renames with the upgrade to 1.1.0, making the logic a  
bit more complicated.  The scripts are now able to adapt to the new  
world order.  
  
Reported-by: Sergey Pashkov  
Author: Juan José Santamaría Flecha, Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/15789-8fc75dea3c5a17c8@postgresql.org  

M src/tools/msvc/Solution.pm

Add toast-level reloption for vacuum_index_cleanup

commit   : ce59b75d449d9152667ce3e9eab33ef2872bfd98    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 25 Jun 2019 09:09:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 25 Jun 2019 09:09:27 +0900    

Click here for diff

a96c41f has introduced the option for heap, but it still lacked the  
variant to control the behavior for toast relations.  
  
While on it, refactor the tests so as they stress more scenarios with  
the various values that vacuum_index_cleanup can use.  It would be  
useful to couple those tests with pageinspect to check that pages are  
actually cleaned up, but this is left for later.  
  
Author: Masahiko Sawada, Michael Paquier  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAD21AoCqs8iN04RX=i1KtLSaX5RrTEM04b7NHYps4+rqtpWNEg@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Don't unset MAKEFLAGS in non-GNU Makefile.

commit   : 0089c3059cb6b3dd20cf072f26d1a7a33412df39    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 25 Jun 2019 09:29:53 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 25 Jun 2019 09:29:53 +1200    

Click here for diff

It's useful to be able to pass down options like -s and -j.  
  
Back-patch to 9.5, like commit a76200de.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com  

M Makefile

Remove misleading comment from pathnodes.h.

commit   : a2dec374807565f6337915fb236bb3ae37af0644    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 25 Jun 2019 09:17:04 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 25 Jun 2019 09:17:04 +1200    

Click here for diff

As of commit e5253fdc, it is no longer true that the leader always  
executes the subplan of a Gather Merge node.  Remove comment to that  
effect.  
  
Back-patch to 11.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJEaZJYezXAOutuiWT%2BfxCA44%2BoKtVPAND2ubLiigR%3D-w%40mail.gmail.com  

M src/include/nodes/pathnodes.h

Purely-cosmetic adjustments in tablecmds.c.

commit   : ccfcc8fdbd9bdbfd18fda5d7c698af8d175f5319    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Jun 2019 17:19:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Jun 2019 17:19:32 -0400    

Click here for diff

Move ATExecAlterColumnGenericOptions away from where it was unthinkingly  
dropped, in the middle of a lot of ALTER COLUMN TYPE code.  I don't have  
any high principles about where to put it instead, so let's just put it  
after ALTER COLUMN TYPE and before ALTER OWNER, matching existing  
decisions about how to order related code stanzas.  
  
Also add the minimal function header comment that the original author  
was too cool to bother with.  
  
Along the way, upgrade header comments for nearby ALTER COLUMN TYPE  
functions.  
  
Discussion: https://postgr.es/m/14787.1561403130@sss.pgh.pa.us  

M src/backend/commands/tablecmds.c

Update unicode_norm_table.h to Unicode 12.1.0

commit   : 82be666ee36842af2a1b81e570bd5578f264de65    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 22:15:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 22:15:43 +0200    

Click here for diff

M src/include/common/unicode_norm_table.h

Make script output more pgindent compatible

commit   : 2cadefbb97ff8e5566476780dc200db06af6ba09    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 22:09:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 22:09:50 +0200    

Click here for diff

M src/common/unicode/generate-unicode_norm_table.pl

Correct script name in README file

commit   : eb8d05bfeca416a970cc33af5915ec7b4f4a2f69    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 22:09:29 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 22:09:29 +0200    

Click here for diff

M src/common/unicode/README

Further fix ALTER COLUMN TYPE's handling of indexes and index constraints.

commit   : f946a409143d01951411382fbc3c91c7eb640094    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Jun 2019 16:43:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Jun 2019 16:43:05 -0400    

Click here for diff

This patch reverts all the code changes of commit e76de8861, which turns  
out to have been seriously misguided.  We can't wait till later to compute  
the definition string for an index; we must capture that before applying  
the data type change for any column it depends on, else ruleutils.c will  
deliverr wrong/misleading results.  (This fine point was documented  
nowhere, of course.)  
  
I'd also managed to forget that ATExecAlterColumnType executes once per  
ALTER COLUMN TYPE clause, not once per statement; which resulted in the  
code being basically completely broken for any case in which multiple ALTER  
COLUMN TYPE clauses are applied to a table having non-constraint indexes  
that must be rebuilt.  Through very bad luck, none of the existing test  
cases nor the ones added by e76de8861 caught that, but of course it was  
soon found in the field.  
  
The previous patch also had an implicit assumption that if a constraint's  
index had a dependency on a table column, so would the constraint --- but  
that isn't actually true, so it didn't fix such cases.  
  
Instead of trying to delete unneeded index dependencies later, do the  
is-there-a-constraint lookup immediately on seeing an index dependency,  
and switch to remembering the constraint if so.  In the unusual case of  
multiple column dependencies for a constraint index, this will result in  
duplicate constraint lookups, but that's not that horrible compared to all  
the other work that happens here.  Besides, such cases did not work at all  
before, so it's hard to argue that they're performance-critical for anyone.  
  
Per bug #15865 from Keith Fiske.  As before, back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/15865-17940eacc8f8b081@postgresql.org  

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

Correct obsolete amcheck comments.

commit   : b00326df7ad4ab7d21aad3b6fe6558ea6b61897d    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 24 Jun 2019 10:31:58 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 24 Jun 2019 10:31:58 -0700    

Click here for diff

Oversight in commit dd299df8.  

M contrib/amcheck/verify_nbtree.c

Drop test user when done with it.

commit   : f31111bbe81db0e84fb486c6423a234c47091b30    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Jun 2019 12:36:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Jun 2019 12:36:51 -0400    

Click here for diff

Commit d7f8d26d9 added a test case that created a user, but forgot  
to drop it again.  This is no good; for one thing, it causes repeated  
"make installcheck" runs to fail.  

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

Upgrade internal error message to external

commit   : 12e037e2090b1a6446376814ea0419463b02c254    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 24 Jun 2019 10:39:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 24 Jun 2019 10:39:12 +0200    

Click here for diff

As part of REINDEX CONCURRENTLY, this formerly internal-only error  
message becomes potentially user-visible (see regression tests), so  
change from errmsg_internal() to errmsg(), and update comment.  

M src/backend/catalog/index.c

Don't call PG_RETURN_BOOL() in a function not returning Datum.

commit   : 9a81c9fa3f6a2f57b9db2a1ce5584c85fc1d977e    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 23 Jun 2019 12:02:19 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 23 Jun 2019 12:02:19 -0700    

Click here for diff

This code is new in v12, and the defect probably was not user-visible.  

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

Add security checks to the multivariate MCV estimation code.

commit   : d7f8d26d9f4c0a574250ec53a03b3dc08d13796c    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Sun, 23 Jun 2019 18:50:08 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Sun, 23 Jun 2019 18:50:08 +0100    

Click here for diff

The multivariate MCV estimation code may run user-defined operators on  
the values in the MCV list, which means that those operators may  
potentially leak the values from the MCV list. Guard against leaking  
data to unprivileged users by checking that the user has SELECT  
privileges on the table or all of the columns referred to by the  
statistics.  
  
Additionally, if there are any securityQuals on the RTE (either due to  
RLS policies on the table, or accessing the table via a security  
barrier view), not all rows may be visible to the current user, even  
if they have table or column privileges. Thus we further insist that  
the operator be leakproof in this case.  
  
Dean Rasheed, reviewed by Tomas Vondra.  
  
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui=Vdx4N==VV5XOK5dsXfnGgVOz_JhAicB=ZA@mail.gmail.com  

M src/backend/statistics/extended_stats.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Remove unnecessary comment.

commit   : 89ff7c08eee355195eba6f544d28584e61200665    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 23 Jun 2019 22:19:59 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 23 Jun 2019 22:19:59 +1200    

Click here for diff

Author: Vik Fearing  
Discussion: https://postgr.es/m/150d3e9f-c7ec-3fb3-4fdb-def47c4144af%402ndquadrant.com  

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

Fix spinlock assembly code for MIPS so it works on MIPS r6.

commit   : 1323bfce55109dd54ee164828aab7983d3020a25    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 22 Jun 2019 20:31:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 22 Jun 2019 20:31:50 -0400    

Click here for diff

Original MIPS-I processors didn't have the LL/SC instructions (nor any  
other userland synchronization primitive).  If the build toolchain  
targets that ISA variant by default, as an astonishingly large fraction  
of MIPS platforms still do, the assembler won't take LL/SC without  
coercion in the form of a ".set mips2" instruction.  But we issued that  
unconditionally, making it an ISA downgrade for chips later than MIPS2.  
That breaks things for the latest MIPS r6 ISA, which encodes these  
instructions differently.  Adjust the code so we don't change ISA level  
if it's >= 2.  
  
Note that this patch doesn't change what happens on an actual MIPS-I  
processor: either the kernel will emulate these instructions  
transparently, or you'll get a SIGILL failure.  That tradeoff seemed  
fine in 2002 when this code was added (cf 3cbe6b247), and it's even  
more so today when MIPS-I is basically extinct.  But let's add a  
comment about that.  
  
YunQiang Su (with cosmetic adjustments by me).  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/15844-8f62fe7e163939b3@postgresql.org  

M src/include/storage/s_lock.h

Consolidate methods for translating a Perl path to a Windows path.

commit   : 660a2b19038b2f6b9f6bcb2c3297a47d5e3557a8    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 21 Jun 2019 20:34:23 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 21 Jun 2019 20:34:23 -0700    

Click here for diff

This fixes some TAP suites when using msys Perl and a builddir located  
in an msys mount point other than "/".  For example, builddir=/c/pg  
exhibited the problem, since /c/pg falls in mount point "/c".  
Back-patch to 9.6, where tests first started to perform such  
translations.  In back branches, offer both new and old APIs.  
  
Reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/20190610045838.GA238501@rfd.leadboat.com  

M src/bin/pg_checksums/t/002_actions.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/017_shm.pl

Remove obsolete comments about sempahores from proc.c.

commit   : 25b93a2967a4ebfb90168ca087026cc697fc4b77    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 21 Jun 2019 10:57:07 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 21 Jun 2019 10:57:07 +1200    

Click here for diff

Commit 6753333f switched from a semaphore-based wait to a latch-based  
wait for ProcSleep()/ProcWakeup(), but left behind some stray references  
to semaphores.  
  
Back-patch to 9.5.  
  
Reviewed-by: Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=AFXc1aHuce32tKiQrdEA@mail.gmail.com  

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

Rework some error strings for REINDEX CONCURRENTLY with system catalogs

commit   : 20e1cc898da6f82b5680973c107e8a96d46caf01    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 20 Jun 2019 13:28:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 20 Jun 2019 13:28:12 +0900    

Click here for diff

This makes the whole user experience more consistent when bumping into  
failures, and more in line with the rewording done via 508300e.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/20190514153252.GA22168@alvherre.pgsql  

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

Fix description of pg_class.relam for table access methods

commit   : 252f9a2580b013fe45ba28bb6d7a4994abc93bb5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 20 Jun 2019 13:04:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 20 Jun 2019 13:04:56 +0900    

Click here for diff

Author: Ian Barwick  
Discussion: https://postgr.es/m/087a6961-1aaf-e36c-b712-bd5a644da20a@2ndquadrant.com  

M doc/src/sgml/catalogs.sgml

pg_upgrade: Improve error messages

commit   : cd917ffb9a43e9e4699c2a89d495ee02a8701034    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:49:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:49:03 +0200    

Click here for diff

Make wording more accurate and add strerror() information.  
  
Discussion: https://www.postgresql.org/message-id/24c8bd05-aed1-6301-919d-8acbabdb8c24@2ndquadrant.com  

M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/option.c

pg_upgrade: Improve invalid option handling

commit   : aba78ab4a9509e7ed92acefd707a99425568f49f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:43:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:43:31 +0200    

Click here for diff

Currently, calling pg_upgrade with an invalid command-line option  
aborts pg_upgrade but leaves a pg_upgrade_internal.log file lying  
around.  Reorder things a bit so that that file is not created until  
all the options have been parsed.  
  
Discussion: https://www.postgresql.org/message-id/24c8bd05-aed1-6301-919d-8acbabdb8c24@2ndquadrant.com  

M src/bin/pg_upgrade/option.c

Fix description for $varname jsonpath variable

commit   : dfd79e2d0e8f399785ca2f7c659b45fd620cba17    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 19 Jun 2019 22:41:12 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 19 Jun 2019 22:41:12 +0300    

Click here for diff

The description is ended part way and PASSING clause is not implemented yet.  
But the variables might be passed as parameters to several jsonpath functions.  
So, complete the description based on the current implementation, leaving  
description of PASSING clause in TODO.  
  
Discussion: https://postgr.es/m/CAKPRHz%2BxOuQSSvkuB1mCQjedd%2BB2B1Vnkrq0E-pLmoXyTO%2Bz9Q%40mail.gmail.com  
Author: Kyotaro Horiguchi, Alexander Korotkov  

M doc/src/sgml/json.sgml

Improve documentation for jsonpath like_regex predicate

commit   : 1ff8dc9f19ddf00e3ad69d7141f78341769cd8a3    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 19 Jun 2019 22:41:05 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 19 Jun 2019 22:41:05 +0300    

Click here for diff

Reference posix regex documentation section and list supported flags.  
  
Discussion: https://postgr.es/m/CAKPRHz%2BxOuQSSvkuB1mCQjedd%2BB2B1Vnkrq0E-pLmoXyTO%2Bz9Q%40mail.gmail.com  
Author: Kyotaro Horiguchi, Alexander Korotkov  

M doc/src/sgml/func.sgml

Support 'q' flag in jsonpath 'like_regex' predicate

commit   : 261a5c1928566f938cbda0f62dc16f6a2d1e871d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 19 Jun 2019 22:40:58 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 19 Jun 2019 22:40:58 +0300    

Click here for diff

SQL/JSON standard defines that jsonpath 'like_regex' predicate should support  
the same set of flags as XQuery/XPath.  It appears that implementation of 'q'  
flag was missed.  This commit fixes that.  
  
Discussion: https://postgr.es/m/CAPpHfdtyfPsxLYiTjp5Ov8T5xGsB5t3CwE5%2B3PS%3DLLwA%2BxTJog%40mail.gmail.com  
Author: Nikita Glukhov, Alexander Korotkov  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql

Update list of combining characters

commit   : d8594d123c155aeecd47fc2450f62f5100b2fbf0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:35:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:35:41 +0200    

Click here for diff

The list of combining characters to ignore for calculating the display  
width of a string (used for example by psql) was wildly outdated and  
incorrect.  
  
Discussion: https://www.postgresql.org/message-id/flat/bbb19114-af1e-513b-08a9-61272794bd5c%402ndquadrant.com  

M src/backend/utils/mb/wchar.c

Add XSL stylesheet to fix up SVG files

commit   : ac5bb8f275dd9b2746fe6d433f1c08c1c3bd3d61    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:26:42 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Jun 2019 21:26:42 +0200    

Click here for diff

The SVG output produced by external tools needs some postprocessing.  
This is implemented by this new XSL stylesheet.  
  
Issues are:  
  
- SVG produced by Ditaa does not add a viewBox attribute to the svg  
  element, needed to make the image scalable.  
  
- SVG produced by Graphviz uses a stroke="transparent" attribute,  
  which is not valid SVG.  It appears to mostly work, but FOP  
  complains.  
  
Other tweaks can be added over time.  
  
This reverts 7dc78d8ef3e62f7e06d7767c63dcede048377b9a and  
29046c44f36099f4c979b1491fcf27db2f9184f9, which applied these fixes  
manually.  

M .gitattributes
M doc/src/sgml/images/Makefile
M doc/src/sgml/images/README
A doc/src/sgml/images/fixup-svg.xsl
M doc/src/sgml/images/gin.svg
M doc/src/sgml/images/pagelayout.svg

Fix typo

commit   : 66013fe73095f851c151a17ccc7553abe6246891    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Wed, 19 Jun 2019 14:59:26 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Wed, 19 Jun 2019 14:59:26 +0200    

Click here for diff

Author: Daniel Gustafsson  

M src/backend/access/table/tableamapi.c

Replace an occurrence of slave with standby

commit   : 992fe54e77f66ed67b6480fcf7dd208b2cd28aac    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Wed, 19 Jun 2019 14:38:23 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Wed, 19 Jun 2019 14:38:23 +0200    

Click here for diff

Commit a1ef920e27ba6ab3602aaf6d6751d8628fac1af8 replaced the use of  
slave with standby, but overlooked this comment.  
  
Author: Daniel Gustafsson  

M contrib/pg_stat_statements/pg_stat_statements.c

Remove last references to WAL segment size in MSVC scripts

commit   : 414cca40d506dd3f17b49ae3139853139192c2ba    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 19 Jun 2019 11:18:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 19 Jun 2019 11:18:50 +0900    

Click here for diff

fc49e24 has removed the last use of this compile-time variable as WAL  
segment size is something that can now be set at initdb time, still this  
commit has forgotten some references to it.  
  
Discussion: https://postgr.es/m/20190617073228.GE18917@paquier.xyz  

M src/tools/msvc/Solution.pm

Fix description of WAL record XLOG_BTREE_META_CLEANUP

commit   : 3c28fd2281223580b88473e5145b752cc7cbadf9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 19 Jun 2019 11:02:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 19 Jun 2019 11:02:19 +0900    

Click here for diff

This record uses one metadata buffer and registers some data associated  
to the buffer, but when parsing the record for its description a direct  
access to the record data was done, but there is none.  This leads  
usually to an incorrect description, but can also cause crashes like in  
pg_waldump.  Instead, fix things so as the parsing uses the data  
associated to the metadata block.  
  
This is an oversight from 3d92796, so backpatch down to 11.  
  
Author: Michael Paquier  
Description: https://postgr.es/m/20190617013059.GA3153@paquier.xyz  
Backpatch-through: 11  

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

Fix memory corruption/crash in ANALYZE.

commit   : 23224563d97913aa824d04c498d59ad4d85fda38    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 18 Jun 2019 15:51:04 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 18 Jun 2019 15:51:04 -0700    

Click here for diff

This fixes an embarrassing oversight I (Andres) made in 737a292b,  
namely missing two place where liverows/deadrows were used when  
converting those variables to pointers, leading to incrementing the  
pointer, rather than the value.  
  
It's not that actually that easy to trigger a crash: One needs tuples  
deleted by the current transaction, followed by a tuple deleted in  
another session, all in one page. Which is presumably why this hasn't  
been noticed before.  
  
Reported-By: Steve Singer  
Author: Steve Singer  
Discussion: https://postgr.es/m/c7988239-d42c-ddc4-41db-171b23b35e4f@ssinger.info  

M src/backend/access/heap/heapam_handler.c
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Avoid spurious deadlocks when upgrading a tuple lock

commit   : 8b21b416ed621501db3be38817c298c57470524f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 18 Jun 2019 18:23:16 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 18 Jun 2019 18:23:16 -0400    

Click here for diff

This puts back reverted commit de87a084c0a5, with some bug fixes.  
  
When two (or more) transactions are waiting for transaction T1 to release a  
tuple-level lock, and transaction T1 upgrades its lock to a higher level, a  
spurious deadlock can be reported among the waiting transactions when T1  
finishes.  The simplest example case seems to be:  
  
T1: select id from job where name = 'a' for key share;  
Y: select id from job where name = 'a' for update; -- starts waiting for T1  
Z: select id from job where name = 'a' for key share;  
T1: update job set name = 'b' where id = 1;  
Z: update job set name = 'c' where id = 1; -- starts waiting for T1  
T1: rollback;  
  
At this point, transaction Y is rolled back on account of a deadlock: Y  
holds the heavyweight tuple lock and is waiting for the Xmax to be released,  
while Z holds part of the multixact and tries to acquire the heavyweight  
lock (per protocol) and goes to sleep; once T1 releases its part of the  
multixact, Z is awakened only to be put back to sleep on the heavyweight  
lock that Y is holding while sleeping.  Kaboom.  
  
This can be avoided by having Z skip the heavyweight lock acquisition.  As  
far as I can see, the biggest downside is that if there are multiple Z  
transactions, the order in which they resume after T1 finishes is not  
guaranteed.  
  
Backpatch to 9.6.  The patch applies cleanly on 9.5, but the new tests don't  
work there (because isolationtester is not smart enough), so I'm not going  
to risk it.  
  
Author: Oleksii Kliukin  
Discussion: https://postgr.es/m/B9C9D7CD-EB94-4635-91B6-E558ACEC0EC3@hintbits.com  
Discussion: https://postgr.es/m/2815.1560521451@sss.pgh.pa.us  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
A src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.

commit   : aca127c105aae551620d607e88d76930e6b9a2cf    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 18 Jun 2019 22:38:30 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 18 Jun 2019 22:38:30 +1200    

Click here for diff

WHERE EXISTS (...) queries cannot be executed by Parallel Hash Join  
with jointype JOIN_UNIQUE_INNER, because there is no way to make a  
partial plan totally unique.  The consequence of allowing such plans  
was duplicate results from some EXISTS queries.  
  
Back-patch to 11.  Bug #15857.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane  
Reported-by: Vladimir Kriukov  
Discussion: https://postgr.es/m/15857-d1ba2a64bce0795e%40postgresql.org  

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

Stamp 12beta2.

commit   : 0ab7110bcbcce5ff58afb32e7871c54e87502139    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Jun 2019 17:12:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Jun 2019 17:12:29 -0400    

Click here for diff

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

Translation updates

commit   : 91acff7a538e6e6a8175450a38c7fa1d9a290011    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 17 Jun 2019 15:07:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 17 Jun 2019 15:07:14 +0200    

Click here for diff

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

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

Fix buffer overflow when processing SCRAM final message in libpq

commit   : b67421178880f9df337dc19b8601b54b99efbc78    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 17 Jun 2019 22:13:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 17 Jun 2019 22:13:57 +0900    

Click here for diff

When a client connects to a rogue server sending specifically-crafted  
messages, this can suffice to execute arbitrary code as the operating  
system account used by the client.  
  
While on it, fix one error handling when decoding an incorrect salt  
included in the first message received from server.  
  
Author: Michael Paquier  
Reviewed-by: Jonathan Katz, Heikki Linnakangas  
Security: CVE-2019-10164  
Backpatch-through: 10  

M src/interfaces/libpq/fe-auth-scram.c

Fix buffer overflow when parsing SCRAM verifiers in backend

commit   : 09ec55b933091cb5b0af99978718cb3d289c71b6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 17 Jun 2019 21:48:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 17 Jun 2019 21:48:17 +0900    

Click here for diff

Any authenticated user can overflow a stack-based buffer by changing the  
user's own password to a purpose-crafted value.  This often suffices to  
execute arbitrary code as the PostgreSQL operating system account.  
  
This fix is contributed by multiple folks, based on an initial analysis  
from Tom Lane.  This issue has been introduced by 68e61ee, so it was  
possible to make use of it at authentication time.  It became more  
easily to trigger after ccae190 which has made the SCRAM parsing more  
strict when changing a password, in the case where the client passes  
down a verifier already hashed using SCRAM.  Back-patch to v10 where  
SCRAM has been introduced.  
  
Reported-by: Alexander Lakhin  
Author: Jonathan Katz, Heikki Linnakangas, Michael Paquier  
Security: CVE-2019-10164  
Backpatch-through: 10  

M src/backend/libpq/auth-scram.c
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Fix more typos and inconsistencies in the tree

commit   : 3412030205211079f9b0510e2244083e4ee7b15a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 17 Jun 2019 16:13:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 17 Jun 2019 16:13:16 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/0a5419ea-1452-a4e6-72ff-545b1a5a8076@gmail.com  

M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/common/session.c
M src/backend/access/hash/hash.c
M src/backend/access/transam/xact.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/functioncmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeProjectSet.c
M src/backend/jit/llvm/Makefile
M src/backend/lib/integerset.c
M src/backend/libpq/pqformat.c
M src/backend/replication/walsender.c
M src/backend/statistics/mcv.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/sort/sharedtuplestore.c
M src/bin/pg_dump/common.c
M src/include/access/xlogdefs.h
M src/include/catalog/partition.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/executor/tuptable.h
M src/include/optimizer/placeholder.h
M src/include/partitioning/partprune.h
M src/include/port/pg_bitutils.h
M src/include/utils/jsonapi.h
M src/include/utils/sharedtuplestore.h
M src/pl/plperl/plperl.h
M src/port/pwrite.c
M src/test/isolation/specs/partition-key-update-4.spec
M src/test/modules/test_integerset/README
M src/tools/msvc/config_default.pl

Revert "Avoid spurious deadlocks when upgrading a tuple lock"

commit   : 9d20b0ec8f2af43041b1a65e5fcd91acc47e9ace    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sun, 16 Jun 2019 22:24:21 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sun, 16 Jun 2019 22:24:21 -0400    

Click here for diff

This reverts commits 3da73d6839dc and de87a084c0a5.  
  
This code has some tricky corner cases that I'm not sure are correct and  
not properly tested anyway, so I'm reverting the whole thing for next  
week's releases (reintroducing the deadlock bug that we set to fix).  
I'll try again afterwards.  
  
Discussion: https://postgr.es/m/E1hbXKQ-0003g1-0C@gemulon.postgresql.org  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
D src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Doc: remove description of commit 23bd3cec6 from v12 release notes.

commit   : 16c4e76f1b0a0145572551b7e919b967e406a0b1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Jun 2019 14:02:22 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Jun 2019 14:02:22 -0400    

Click here for diff

Now that we've back-patched that, it shouldn't be mentioned in v12  
anymore.  

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

Further fix privileges on pg_statistic_ext[_data].

commit   : 6973b058bc8d32e104bed99c134a4fab4b5dfe13    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Jun 2019 11:00:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Jun 2019 11:00:23 -0400    

Click here for diff

We don't need to restrict column privileges on pg_statistic_ext;  
all of that data is OK to read publicly.  What we *do* need to do,  
which was overlooked by 6cbfb784c, is revoke public read access on  
pg_statistic_ext_data; otherwise we still have the same security  
hole we started with.  
  
Catversion bump to ensure that installations calling themselves  
beta2 will have this fix.  
  
Diagnosis/correction by Dean Rasheed and Tomas Vondra, but I'm  
going to go ahead and push this fix ASAP so we get more buildfarm  
cycles on it.  
  
Discussion: https://postgr.es/m/8833.1560647898@sss.pgh.pa.us  

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

Fix privileges on pg_statistic_ext.tableoid

commit   : fc8cf3df478e054b892f6698b6d336e72f3a7328    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 16 Jun 2019 12:04:40 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 16 Jun 2019 12:04:40 +0200    

Click here for diff

The GRANT in system_views allowed SELECT privileges on various columns in  
the pg_statistic_ext catalog, but tableoid was not included in the list.  
That made pg_dump fail because it's accessing this column when building  
the list of extended statistics to dump.  
  
Discussion: https://postgr.es/m/8833.1560647898%40sss.pgh.pa.us  

M src/backend/catalog/system_views.sql

Fix incorrect CREATE STATISTICS example in docs

commit   : 7f44efa10b6ea3e5fd125e2800f357f38ab1068c    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 15 Jun 2019 21:38:53 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 15 Jun 2019 21:38:53 +0200    

Click here for diff

The example was incorrectly using parantheses around the list of columns, so  
just drop them.  
  
Reported-By: Robert Haas  
Discussion: https://postgr.es/m/CA%2BTgmoZZEMAqWMAfvLHZnK57SoxOutgvE-ALO94WsRA7zZ7wyQ%40mail.gmail.com  

M doc/src/sgml/ref/create_statistics.sgml

Add pg_stats_ext view for extended statistics

commit   : aa087ec64f703a52f3c48c70117bb02e578f1802    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 13 Jun 2019 17:25:04 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 13 Jun 2019 17:25:04 +0200    

Click here for diff

Regular per-column statistics are stored in pg_statistics catalog, which  
is however rather difficult to read, so we also have pg_stats view with  
a human-reablable version of the data.  
  
For extended statistic the catalog was fairly easy to read, so we did  
not have such human-readable view so far.  Commit 9b6babfa2d however did  
split the catalog into two, which makes querying harder.  Furthermore,  
we want to show the multi-column MCV list in a way similar to per-column  
stats (and not as a bytea value).  
  
This commit introduces pg_stats_ext view, joining the two catalogs and  
massaging the data to produce human-readable output similar to pg_stats.  
It also considers RLS and access privileges - the data is shown only when  
the user has access to all columns the extended statistic is defined on.  
  
Bumped CATVERSION due to adding new system view.  
  
Author: Dean Rasheed, with improvements by me  
Reviewed-by: Dean Rasheed, John Naylor  
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui%3DVdx4N%3D%3DVV5XOK5dsXfnGgVOz_JhAicB%3DZA%40mail.gmail.com  

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

Rework the pg_statistic_ext catalog

commit   : 6cbfb784c3c91146148a76d50cda6f69ae6a79fb    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 13 Jun 2019 17:19:21 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 13 Jun 2019 17:19:21 +0200    

Click here for diff

Since extended statistic got introduced in PostgreSQL 10, there was a  
single catalog pg_statistic_ext storing both the definitions and built  
statistic.  That's however problematic when a user is supposed to have  
access only to the definitions, but not to user data.  
  
Consider for example pg_dump on a database with RLS enabled - if the  
pg_statistic_ext catalog respects RLS (which it should, if it contains  
user data), pg_dump would not see any records and the result would not  
define any extended statistics.  That would be a surprising behavior.  
  
Until now this was not a pressing issue, because the existing types of  
extended statistic (functional dependencies and ndistinct coefficients)  
do not include any user data directly.  This changed with introduction  
of MCV lists, which do include most common combinations of values.  
  
The easiest way to fix this is to split the pg_statistic_ext catalog  
into two - one for definitions, one for the built statistic values.  
The new catalog is called pg_statistic_ext_data, and we're maintaining  
a 1:1 relationship with the old catalog - either there are matching  
records in both catalogs, or neither of them.  
  
Bumped CATVERSION due to changing system catalog definitions.  
  
Author: Dean Rasheed, with improvements by me  
Reviewed-by: Dean Rasheed, John Naylor  
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui%3DVdx4N%3D%3DVV5XOK5dsXfnGgVOz_JhAicB%3DZA%40mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml
M src/backend/catalog/Makefile
M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/README.mcv
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/utils/cache/syscache.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_statistic_ext.h
A src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/toasting.h
M src/include/utils/syscache.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/oidjoins.sql
M src/test/regress/sql/stats_ext.sql
M src/tools/pgindent/typedefs.list

Prefer timezone name "UTC" over alternative spellings.

commit   : e3846a00c2f87402dcedf7f07950ab2d89cf5827    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sat, 15 Jun 2019 18:15:23 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sat, 15 Jun 2019 18:15:23 +0100    

Click here for diff

tzdb 2019a made "UCT" a link to the "UTC" zone rather than a separate  
zone with its own abbreviation. Unfortunately, our code for choosing a  
timezone in initdb has an arbitrary preference for names earlier in  
the alphabet, and so it would choose the spelling "UCT" over "UTC"  
when the system is running on a UTC zone.  
  
Commit 23bd3cec6 was backpatched in order to address this issue, but  
that code helps only when /etc/localtime exists as a symlink, and does  
nothing to help on systems where /etc/localtime is a copy of a zone  
file (as is the standard setup on FreeBSD and probably some other  
platforms too) or when /etc/localtime is simply absent (giving UTC as  
the default).  
  
Accordingly, add a preference for the spelling "UTC", such that if  
multiple zone names have equally good content matches, we prefer that  
name before applying the existing arbitrary rules. Also add a slightly  
lower preference for "Etc/UTC"; lower because that preserves the  
previous behaviour of choosing the shorter name, but letting us still  
choose "Etc/UTC" over "Etc/UCT" when both exist but "UTC" does  
not (not common, but I've seen it happen).  
  
Backpatch all the way, because the tzdb change that sparked this issue  
is in those branches too.  

M src/bin/initdb/findtimezone.c

Add pg_dumpall --rows-per-insert

commit   : a193cbec1199e4e529c46645b7aecbf38956048b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 14 Jun 2019 18:21:52 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 14 Jun 2019 18:21:52 -0400    

Click here for diff

Commit 7e413a0f82c8 added that option to pg_dump, but neglected to teach  
pg_dumpall how to pass it along.  Repair.  
  
Author: Fabien Coelho  
Reported-by: Peter Eisentraut  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/45f50c59-ddbb-8cf2-eedb-81003f603528@2ndquadrant.com  

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

Tweak libpq's PQhost, PQhostaddr, and psql's \connect

commit   : 313f56ce2d1b9dfd3483e4f39611baa27852835a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 14 Jun 2019 18:02:26 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 14 Jun 2019 18:02:26 -0400    

Click here for diff

Fixes some problems introduced by 6e5f8d489acc:  
  
* When reusing conninfo data from the previous connection in \connect,  
  the host address should only be reused if it was specified as  
  hostaddr; if it wasn't, then 'host' is resolved afresh.  We were  
  reusing the same IP address, which ignores a possible DNS change  
  as well as any other addresses that the name resolves to than the  
  one that was used in the original connection.  
  
* PQhost, PQhostaddr: Don't present user-specified hostaddr when we have  
  an inet_net_ntop-produced equivalent address.  The latter has been  
  put in canonical format, which is cleaner (so it produces "127.0.0.1"  
  when given "host=2130706433", for example).  
  
* Document the hostaddr-reusing aspect of \connect.  
  
* Fix some code comments  
  
Author: Fabien Coelho  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/20190527203713.GA58392@gust.leadboat.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/fe-connect.c

Silence compiler warning

commit   : 3da73d6839dc47f1f47ca57974bf28e5abd9b572    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 14 Jun 2019 11:33:40 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 14 Jun 2019 11:33:40 -0400    

Click here for diff

Introduced in de87a084c0a5.  

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

doc: PG 12 relnotes, add mention of single-child optimization

commit   : b9a0724cf7a3ecf19aaaa098ffd26e52bb800c5c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 14 Jun 2019 09:30:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 14 Jun 2019 09:30:31 -0400    

Click here for diff

Add mention of single-child optimization for partitions and UNION ALL.  
  
Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f8R8riwBXw==7ijV=UZNuhP+3qXgDBKSiM+=_cTf4mXXw@mail.gmail.com  

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

postgres_fdw: Fix costing of pre-sorted foreign paths with local stats.

commit   : 08d2d58a2a1c8ef8d39e8132d39ee14a1d029500    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 14 Jun 2019 20:49:59 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 14 Jun 2019 20:49:59 +0900    

Click here for diff

Commit aa09cd242 modified estimate_path_cost_size() so that it reuses  
cached costs of a basic foreign path for a given foreign-base/join  
relation when costing pre-sorted foreign paths for that relation, but it  
incorrectly re-computed retrieved_rows, an estimated number of rows  
fetched from the remote side, which is needed for costing both the basic  
and pre-sorted foreign paths.  To fix, handle retrieved_rows the same way  
as the cached costs: store in that relation's fpinfo the retrieved_rows  
estimate computed for costing the basic foreign path, and reuse it when  
costing the pre-sorted foreign paths.  Also, reuse the rows/width  
estimates stored in that relation's fpinfo when costing the pre-sorted  
foreign paths, to make the code consistent.  
  
In commit ffab494a4, to extend the costing mentioned above to the  
foreign-grouping case, I made a change to add_foreign_grouping_paths() to  
store in a given foreign-grouped relation's RelOptInfo the rows estimate  
for that relation for reuse, but this patch makes that change unnecessary  
since we already store the row estimate in that relation's fpinfo, which  
this patch reuses when costing a foreign path for that relation with the  
sortClause ordering; remove that change.  
  
In passing, fix thinko in commit 7012b132d: in estimate_path_cost_size(),  
the width estimate for a given foreign-grouped relation to be stored in  
that relation's fpinfo was reset incorrectly when costing a basic foreign  
path for that relation with local stats.  
  
Apply the patch to HEAD only to avoid destabilizing existing plan choices.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK17jaJLPDEkgnP2VmkOg=5wT8YQ1CqssU8JRpZ_NSE+dqQ@mail.gmail.com  

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

docs: PG 12 relnotes, update self-join item to mention ctid

commit   : be2e024bd6527b050da4ad02c921869fed84bb5d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 13 Jun 2019 22:53:20 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 13 Jun 2019 22:53:20 -0400    

Click here for diff

Reported-by: Robert Haas  
  
Discussion: https://postgr.es/m/CA+TgmoY==TZwk-4cM3Usebq1f=j7Hpm1brFbk1v48h45wsWzzg@mail.gmail.com  

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

docs: PG 12 relnotes, move vacuumdb to the client app section

commit   : 18ef7a34fe616dc63f7de672a5ab7dd88137dc5c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 13 Jun 2019 22:07:25 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 13 Jun 2019 22:07:25 -0400    

Click here for diff

It was previously incorrectly placed in the server application section.  
  
Reported-by: Tatsuo Ishii  
  
Discussion: https://postgr.es/m/20190526.215341.1023150119477784132.t-ishii@sraoss.co.jp  

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

Fix typos and inconsistencies in code comments

commit   : f43608bda2111a1fda514d1bed4df313ee2bbec3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jun 2019 09:34:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jun 2019 09:34:34 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/dec6aae8-2d63-639f-4d50-20e229fb83e3@gmail.com  

M src/backend/access/nbtree/nbtsearch.c
M src/backend/catalog/catalog.c
M src/backend/commands/copy.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/parser/parse_target.c
M src/backend/postmaster/checkpointer.c
M src/backend/utils/cache/lsyscache.c
M src/port/pg_bitutils.c

Use OpenSSL-specific ifdefs in sha2.h

commit   : 96719e52b1abd3a8c712d06a809b7e6c97c2e3a0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jun 2019 09:00:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jun 2019 09:00:36 +0900    

Click here for diff

In order to separate OpenSSL's SHA symbols, this header has been using  
USE_SSL, which is equivalent to USE_OPENSSL.  There is now only one SSL  
implementation included in the tree, so this works fine, but when  
adding a new SSL implementation this would run into failures.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/0DF29010-CE26-4F51-85A6-9C8ABF5536F9@yesql.se  

M src/include/common/sha2.h

Avoid combinatorial explosion in add_child_rel_equivalences().

commit   : d25ea0127598dd0ad27a029215172f396fbd1009    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 13 Jun 2019 18:10:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 13 Jun 2019 18:10:08 -0400    

Click here for diff

If an EquivalenceClass member expression includes variables from  
multiple appendrels, then instead of producing one substituted  
expression per child relation as intended, we'd create additional  
child expressions for combinations of children of different appendrels.  
This happened because the child expressions generated while considering  
the first appendrel were taken as sources during substitution of the  
second appendrel, and so on.  The extra expressions are useless, and are  
harmless unless there are too many of them --- but if you have several  
appendrels with a thousand or so members each, it gets bad fast.  
  
To fix, consider only original (non-em_is_child) EC members as candidates  
to be expanded.  This requires the ability to substitute directly from a  
top parent relation's Vars to those of an indirect descendant relation,  
but we already have that in adjust_appendrel_attrs_multilevel().  
  
Per bug #15847 from Feike Steenbergen.  This is a longstanding misbehavior,  
but it's only worth worrying about when there are more appendrel children  
than we've historically considered wise to use.  So I'm not going to take  
the risk of back-patching this.  
  
Discussion: https://postgr.es/m/15847-ea3734094bf8ae61@postgresql.org  

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

Avoid spurious deadlocks when upgrading a tuple lock

commit   : de87a084c0a5ac927017cd0834b33a932651cfc9    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 13 Jun 2019 17:28:24 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 13 Jun 2019 17:28:24 -0400    

Click here for diff

When two (or more) transactions are waiting for transaction T1 to release a  
tuple-level lock, and transaction T1 upgrades its lock to a higher level, a  
spurious deadlock can be reported among the waiting transactions when T1  
finishes.  The simplest example case seems to be:  
  
T1: select id from job where name = 'a' for key share;  
Y: select id from job where name = 'a' for update; -- starts waiting for X  
Z: select id from job where name = 'a' for key share;  
T1: update job set name = 'b' where id = 1;  
Z: update job set name = 'c' where id = 1; -- starts waiting for X  
T1: rollback;  
  
At this point, transaction Y is rolled back on account of a deadlock: Y  
holds the heavyweight tuple lock and is waiting for the Xmax to be released,  
while Z holds part of the multixact and tries to acquire the heavyweight  
lock (per protocol) and goes to sleep; once X releases its part of the  
multixact, Z is awakened only to be put back to sleep on the heavyweight  
lock that Y is holding while sleeping.  Kaboom.  
  
This can be avoided by having Z skip the heavyweight lock acquisition.  As  
far as I can see, the biggest downside is that if there are multiple Z  
transactions, the order in which they resume after X finishes is not  
guaranteed.  
  
Backpatch to 9.6.  The patch applies cleanly on 9.5, but the new tests don't  
work there (because isolationtester is not smart enough), so I'm not going  
to risk it.  
  
Author: Oleksii Kliukin  
Discussion: https://postgr.es/m/B9C9D7CD-EB94-4635-91B6-E558ACEC0EC3@hintbits.com  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
A src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Mark ReplicationSlotCtl as PGDLLIMPORT.

commit   : 3c8f8f6ebefb3c2debd1cad1ba445a729290dac7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 13 Jun 2019 10:53:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 13 Jun 2019 10:53:17 -0400    

Click here for diff

Also MyReplicationSlot, in branches where it wasn't already.  
  
This was discussed in the thread that resulted in c572599c6, but  
for some reason nobody pulled the trigger.  Now that we have another  
request for the same thing, we should just do it.  
  
Craig Ringer  
  
Discussion: https://postgr.es/m/CAMsr+YFTsq-86MnsNng=mPvjjh5EAbzfMK0ptJPvzyvpFARuRg@mail.gmail.com  
Discussion: https://postgr.es/m/345138875.20190611151943@cybertec.at  

M src/include/replication/slot.h

Fix double-word typos

commit   : b9768458154de6c001af23efc02514f120c6094f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 12 Jun 2019 14:16:18 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 12 Jun 2019 14:16:18 -0400    

Click here for diff

Discussion: https://postgr.es/m/20190612184527.GA24266@alvherre.pgsql  
Reviewed-by: Michaël Paquier  

M doc/src/sgml/backup.sgml
M src/bin/pg_dump/pg_dump.c
M src/include/executor/tuptable.h
M src/include/fmgr.h
M src/include/utils/snapshot.h
M src/interfaces/ecpg/preproc/type.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/recovery/t/013_crash_restart.pl
M src/test/regress/expected/polygon.out
M src/test/regress/sql/polygon.sql

doc: PG 12 relnotes: update wording on truncate/vacuum item

commit   : 4f41a7227511a3f96148b7f3d4ae6f0c350bc7b2    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 13 Jun 2019 09:15:57 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 13 Jun 2019 09:15:57 -0400    

Click here for diff

This item prevents unauthorized locking of relations, and the previous  
wording was unclear.  
  
Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/20190522072651.GC1278@paquier.xyz  

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

postgres_fdw: Account for triggers in non-direct remote UPDATE planning.

commit   : 8b6da83d162cb0ac9f6d21082727bbd45c972c53    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 13 Jun 2019 17:59:09 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 13 Jun 2019 17:59:09 +0900    

Click here for diff

Previously, in postgresPlanForeignModify, we planned an UPDATE operation  
on a foreign table so that we transmit only columns that were explicitly  
targets of the UPDATE, so as to avoid unnecessary data transmission, but  
if there were BEFORE ROW UPDATE triggers on the foreign table, those  
triggers might change values for non-target columns, in which case we  
would miss sending changed values for those columns.  Prevent optimizing  
away transmitting all columns if there are BEFORE ROW UPDATE triggers on  
the foreign table.  
  
This is an oversight in commit 7cbe57c34 which added triggers on foreign  
tables, so apply the patch all the way back to 9.4 where that came in.  
  
Author: Shohei Mochizuki  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/201905270152.x4R1q3qi014550@toshiba.co.jp  

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

Doc: fix bogus example.

commit   : 7dc6ae37def50b5344c157eee5e029a09359f8ee    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 23:05:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 23:05:40 -0400    

Click here for diff

This wasn't incorrect SQL, but it was doing cm-to-inch conversion  
backward, so it might confuse readers.  
  
Per bug #15849 from TAKATSUKA Haruka.  
  
Discussion: https://postgr.es/m/15849-37ad0c561a836107@postgresql.org  

M doc/src/sgml/ddl.sgml

Doc: improve description of allowed spellings for Boolean input.

commit   : 9729c9360886bee7feddc6a1124b0742de4b9f3d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 22:54:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 22:54:46 -0400    

Click here for diff

datatype.sgml failed to explain that boolin() accepts any unique  
prefix of the basic input strings.  Indeed it was actively misleading  
because it called out a few minimal prefixes without mentioning that  
there were more valid inputs.  
  
I also felt that it wasn't doing anybody any favors by conflating  
SQL key words, valid Boolean input, and string literals containing  
valid Boolean input.  Rewrite in hopes of reducing the confusion.  
  
Per bug #15836 from Yuming Wang, as diagnosed by David Johnston.  
Back-patch to supported branches.  
  
Discussion: https://postgr.es/m/15836-656fab055735f511@postgresql.org  

M doc/src/sgml/datatype.sgml

docs: PG 12 relnotes, update btree items

commit   : 4bfb79ff6b1fd400b3dbc761921472173675a968    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 12 Jun 2019 22:48:04 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 12 Jun 2019 22:48:04 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-Wzn-aH4ToZEWR05ELSSp7bO_JMn=sMPfUhNruwVmCXKh-w@mail.gmail.com  

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

Fix incorrect printing of queries with duplicated join names.

commit   : 3d99a81397abb8bb7b95aee794d6644e174e174f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 19:42:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 19:42:38 -0400    

Click here for diff

Given a query in which multiple JOIN nodes used the same alias  
(which'd necessarily be in different sub-SELECTs), ruleutils.c  
would assign the JOIN nodes distinct aliases for clarity ...  
but then it forgot to print the modified aliases when dumping  
the JOIN nodes themselves.  This results in a dump/reload hazard  
for views, because the emitted query is flat-out incorrect:  
Vars will be printed with table names that have no referent.  
  
This has been wrong for a long time, so back-patch to all supported  
branches.  
  
Philip Dubé  
  
Discussion: https://postgr.es/m/CY4PR2101MB080246F2955FF58A6ED1FEAC98140@CY4PR2101MB0802.namprd21.prod.outlook.com  

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

doc: Fix grammatical error in partitioning docs

commit   : ddc053dc503a773267a4d035418e0c81ce3b4851    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 13 Jun 2019 10:35:11 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 13 Jun 2019 10:35:11 +1200    

Click here for diff

Reported-by: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqGZFkKi0TkBGYpr2_5qrRAbHZoP47AP1BRLUOUkfQdy_A@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

doc: PG 12 relnotes, list added snowball/FTS languages

commit   : 968072837173a0c0fa426114b17177f997b85473    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 12 Jun 2019 17:46:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 12 Jun 2019 17:46:38 -0400    

Click here for diff

Reported-by: Adrien Nayrat  
  
Discussion: https://postgr.es/m/9d6a7515-bcd8-05be-d2a5-e81dc11023cd@anayrat.info  

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

doc: PG 12 relnotes, merge new SQL partition function items

commit   : 6a631a454664c145b7da88c9ef3976f8ac3ab0b1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 12 Jun 2019 17:36:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 12 Jun 2019 17:36:43 -0400    

Click here for diff

Reported-by: Andres Freund  
  
Discussion: https://postgr.es/m/20190528155823.3e4cezblxjxotq2q@alap3.anarazel.de  

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

Fix ALTER COLUMN TYPE failure with a partial exclusion constraint.

commit   : e76de886157b7f974d4d247908b242607cfbf043    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 12:29:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Jun 2019 12:29:24 -0400    

Click here for diff

ATExecAlterColumnType failed to consider the possibility that an index  
that needs to be rebuilt might be a child of a constraint that needs to be  
rebuilt.  We missed this so far because usually a constraint index doesn't  
have a direct dependency on its table, just on the constraint object.  
But if there's a WHERE clause, then dependency analysis of the WHERE  
clause results in direct dependencies on the column(s) mentioned in WHERE.  
This led to trying to drop and rebuild both the constraint and its  
underlying index.  
  
In v11/HEAD, we successfully drop both the index and the constraint,  
and then try to rebuild both, and of course the second rebuild hits a  
duplicate-index-name problem.  Before v11, it fails with obscure messages  
about a missing relation OID, due to trying to drop the index twice.  
  
This is essentially the same kind of problem noted in commit  
20bef2c31: the possible dependency linkages are broader than what  
ATExecAlterColumnType was designed for.  It was probably OK when  
written, but it's certainly been broken since the introduction of  
partial exclusion constraints.  Fix by adding an explicit check  
for whether any of the indexes-to-be-rebuilt belong to any of the  
constraints-to-be-rebuilt, and ignoring any that do.  
  
In passing, fix a latent bug introduced by commit 8b08f7d48: in  
get_constraint_index() we must "continue" not "break" when rejecting  
a relation of a wrong relkind.  This is harmless today because we don't  
expect that code path to be taken anyway; but if there ever were any  
relations to be ignored, the existing coding would have an extremely  
undesirable dependency on the order of pg_depend entries.  
  
Also adjust a couple of obsolete comments.  
  
Per bug #15835 from Yaroslav Schekin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/15835-32d9b7a76c06a7a9@postgresql.org  

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

Fix handling of COMMENT for domain constraints

commit   : ceac4505d3428a8414b4f3d6708ea81506811a5f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 12 Jun 2019 11:30:11 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 12 Jun 2019 11:30:11 +0900    

Click here for diff

For a non-superuser, changing a comment on a domain constraint was  
leading to a cache lookup failure as the code tried to perform the  
ownership lookup on the constraint OID itself, thinking that it was a  
type, but this check needs to happen on the type the domain constraint  
relies on.  As the type a domain constraint relies on can be guessed  
directly based on the constraint OID, first fetch its type OID and  
perform the ownership on it.  
  
This is broken since 7eca575, which has split the handling of comments  
for table constraints and domain constraints, so back-patch down to  
9.5.  
  
Reported-by: Clemens Ladisch  
Author: Daniel Gustafsson, Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/15833-808e11904835d26f@postgresql.org  
Backpatch-through: 9.5  

M src/backend/catalog/objectaddress.c
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source

doc: Add best practises section to partitioning docs

commit   : e788e849addd56007a0e75f3b5514f294a0f3bca    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 12 Jun 2019 08:08:57 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 12 Jun 2019 08:08:57 +1200    

Click here for diff

A few questionable partitioning designs have been cropping up lately  
around the mailing lists.  Generally, these cases have been partitioning  
using too many partitions which have caused performance or OOM problems for  
the users.  
  
Since we have very little else to guide users into good design, here we  
add a new section to the partitioning documentation with some best  
practise guidelines for good design.  
  
Reviewed-by: Justin Pryzby, Amit Langote, Alvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f-2rx+E9mG3xrCVHupefMjAp1+tpczQa9SEOZWyU7fjEA@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

Fix conversion of JSON strings to JSON output columns in json_to_record().

commit   : 6f34fcbbd5ad5a6546710e7b90e6331cacfd36dc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 11 Jun 2019 13:33:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 11 Jun 2019 13:33:08 -0400    

Click here for diff

json_to_record(), when an output column is declared as type json or jsonb,  
should emit the corresponding field of the input JSON object.  But it got  
this slightly wrong when the field is just a string literal: it failed to  
escape the contents of the string.  That typically resulted in syntax  
errors if the string contained any double quotes or backslashes.  
  
jsonb_to_record() handles such cases correctly, but I added corresponding  
test cases for it too, to prevent future backsliding.  
  
Improve the documentation, as it provided only a very hand-wavy  
description of the conversion rules used by these functions.  
  
Per bug report from Robert Vollmert.  Back-patch to v10 where the  
error was introduced (by commit cf35346e8).  
  
Note that PG 9.4 - 9.6 also get this case wrong, but differently so:  
they feed the de-escaped contents of the string literal to json[b]_in.  
That behavior is less obviously wrong, so possibly it's being depended on  
in the field, so I won't risk trying to make the older branches behave  
like the newer ones.  
  
Discussion: https://postgr.es/m/D6921B37-BD8E-4664-8D5F-DB3525765DCD@vllmrt.net  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Fix order of steps in DISCARD ALL documentation

commit   : 9f05c44ba4a4a6a857b957734bb369a2bb4dd62b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 11 Jun 2019 12:22:11 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 11 Jun 2019 12:22:11 -0400    

Click here for diff

The docs have always been slightly inaccurate, but got particularly so  
in a874fe7b4c89, which made DISCARD ALL occur before everything else;  
reorder.  
  
Author: Jan Chochol  
Discussion: https://postgr.es/m/CAEASf_3TzBbnXm64HpnD5zCZEh8An9jN8ubMR=De-vOXHMHGeA@mail.gmail.com  

M doc/src/sgml/ref/discard.sgml

Don't access catalogs to validate GUCs when not connected to a DB.

commit   : fff2a7d7bd09db38e1bafc1303c29b10a9805dc0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 10 Jun 2019 23:20:48 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 10 Jun 2019 23:20:48 -0700    

Click here for diff

Vignesh found this bug in the check function for  
default_table_access_method's check hook, but that was just copied  
from older GUCs. Investigation by Michael and me then found the bug in  
further places.  
  
When not connected to a database (e.g. in a walsender connection), we  
cannot perform (most) GUC checks that need database access. Even when  
only shared tables are needed, unless they're  
nailed (c.f. RelationCacheInitializePhase2()), they cannot be accessed  
without pg_class etc. being present.  
  
Fix by extending the existing IsTransactionState() checks to also  
check for MyDatabaseOid.  
  
Reported-By: Vignesh C, Michael Paquier, Andres Freund  
Author: Vignesh C, Andres Freund  
Discussion: https://postgr.es/m/CALDaNm1KXK9gbZfY-p_peRFm_XrBh1OwQO1Kk6Gig0c0fVZ2uw%40mail.gmail.com  
Backpatch: 9.4-  

M src/backend/access/table/tableamapi.c
M src/backend/commands/tablespace.c
M src/backend/utils/cache/ts_cache.c

postgres_fdw: Reorder C includes.

commit   : 92a88644d2b7208e98d9e913c3a574c5c2fe7b78    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 11 Jun 2019 13:39:31 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 11 Jun 2019 13:39:31 +0900    

Click here for diff

Reorder header files in postgres_fdw.c and connection.c in alphabetical  
order.  
  
Author: Etsuro Fujita  
Reviewed-by: Alvaro Herrera  
Discussion: https://postgr.es/m/CAPmGK17ZmNb-EELqu8LmMh2t2uFdbfWNVDEfDO5-bpejHPONMQ@mail.gmail.com  

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

Fix documentation of ALTER TABLE for stored values

commit   : 727e45c8a457ab7378494ff33bf3b50607d303a8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 11 Jun 2019 12:58:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 11 Jun 2019 12:58:51 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoAA_gvZ002U6kovOHu0FsM7ieoCzdSqWBd7_KaQL0UMKg@mail.gmail.com  

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

tableam: Fix index_build_range_scan parameter name.

commit   : 132a1c101a205ee52ec7d731abcb8593a6354097    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 10 Jun 2019 20:04:44 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 10 Jun 2019 20:04:44 -0400    

Click here for diff

All of the other code thinks that the 8th parameter is the number of  
blocks, but this declaration thinks that it's the ending block number.  
Repair this inconsistency.  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoY49ManQWnJtiwkuytXBkmyTuDFqb74Pr4Zn2Nq9TuNBQ@mail.gmail.com  

M src/include/access/tableam.h

Make pg_dump emit ATTACH PARTITION instead of PARTITION OF (reprise)

commit   : 33a53130a89447e171a8268ae0b221bb48af6468    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 10 Jun 2019 18:56:23 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 10 Jun 2019 18:56:23 -0400    

Click here for diff

Using PARTITION OF can result in column ordering being changed from the  
database being dumped, if the partition uses a column layout different  
from the parent's.  It's not pg_dump's job to editorialize on table  
definitions, so this is not acceptable; back-patch all the way back to  
pg10, where partitioned tables where introduced.  
  
This change also ensures that partitions end up in the correct  
tablespace, if different from the parent's; this is an oversight in  
ca4103025dfe (in pg12 only).  Partitioned indexes (in pg11) don't have  
this problem, because they're already created as independent indexes and  
attached to their parents afterwards.  
  
This change also has the advantage that the partition is restorable from  
the dump (as a standalone table) even if its parent table isn't  
restored.  
  
The original commits (3b23552ad8bb in branch master) failed to cover  
subsidiary column elements correctly, such as NOT NULL constraint and  
CHECK constraints, as reported by Rushabh Lathia (initially as a failure  
to restore serial columns).  They were reverted.  This recapitulation  
commit fixes those problems.  
  
Add some pg_dump tests to verify these things more exhaustively,  
including constraints with legacy-inheritance tables, which were not  
tested originally.  In branches 10 and 11, add a local constraint to the  
pg_dump test partition that was added by commit 2d7eeb1b1492 to master.  
  
Author: Álvaro Herrera, David Rowley  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com  
Discussion: https://postgr.es/m/20190423185007.GA27954@alvherre.pgsql  
Discussion: https://postgr.es/m/CAGPqQf0iQV=PPOv2Btog9J9AwOQp6HmuVd6SbGTR_v3Zp2XT1w@mail.gmail.com  

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

Fix operator naming in pg_trgm GUC option descriptions

commit   : b6987a885ba9216e1f4319441303ee115556922c    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 10 Jun 2019 20:14:19 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 10 Jun 2019 20:14:19 +0300    

Click here for diff

Descriptions of pg_trgm GUC options have % replaced with %% like it was  
a printf-like format.  But that's not needed since they are just plain strings.  
This commit fixed that.  Backpatch to last supported version since this error  
present from the beginning.  
  
Reported-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoAgPKODUsu9gqUFiNqEOAqedStxJ-a0sapsJXWWAVp%3Dxg%40mail.gmail.com  
Backpatch-through: 9.4  

M contrib/pg_trgm/trgm_op.c

Add docs of missing GUC to pgtrgm.sgml

commit   : ba3783e0244e3502d1b08896ffc72b3a88dbdb83    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 10 Jun 2019 19:38:13 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 10 Jun 2019 19:38:13 +0300    

Click here for diff

be8a7a68 introduced pg_trgm.strict_word_similarity_threshold GUC, but missed  
docs for that.  This commit fixes that.  
  
Discussion: https://postgr.es/m/fc907f70-448e-fda3-3aa4-209a59597af0%402ndquadrant.com  
Author: Ian Barwick  
Reviewed-by: Masahiko Sawada, Michael Paquier  
Backpatch-through: 9.6  

M doc/src/sgml/pgtrgm.sgml

Fix docs indentation in pgtrgm.sgml

commit   : 852ddfbbe2121c905f2ecd750b1ec4cbfbea9f76    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 10 Jun 2019 19:28:47 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 10 Jun 2019 19:28:47 +0300    

Click here for diff

5871b884 introduced pg_trgm.word_similarity_threshold GUC, but its documentation  
contains wrong indentation.  This commit fixes that.  Backpatch for easier  
backpatching of other documentation fixes.  
  
Discussion: https://postgr.es/m/4c735d30-ab59-fc0e-45d8-f90eb5ed3855%402ndquadrant.com  
Author: Ian Barwick  
Backpatch-through: 9.6  

M doc/src/sgml/pgtrgm.sgml

MSVC: Reconcile clean.bat with PostgreSQL 12 work.

commit   : ae78a9456c8986a8869ec470b40e177b5617a2f1    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 9 Jun 2019 15:50:54 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 9 Jun 2019 15:50:54 -0700    

Click here for diff

M src/tools/msvc/clean.bat

Reconcile nodes/*funcs.c with PostgreSQL 12 work.

commit   : 44982e7d09cf9b1a08fded7fb0ca9a60dae869a5    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 9 Jun 2019 14:00:36 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 9 Jun 2019 14:00:36 -0700    

Click here for diff

One would have needed out-of-tree code to observe the defects.  Remove  
unreferenced fields instead of completing their support functions.  
Since in-tree code can't reach _readIntoClause(), no catversion bump.  

M src/backend/nodes/outfuncs.c
M src/backend/parser/parse_node.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Switch position of some declarations in libpq.h

commit   : cf4263cc6c3a2310de4f1540745990e62fa2312c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 9 Jun 2019 11:33:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 9 Jun 2019 11:33:52 +0900    

Click here for diff

This makes the header more consistent with the surroundings, with  
declarations associated to a given file grouped together.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/20190608012439.GB7228@paquier.xyz  

M src/include/libpq/libpq.h

Fix some typos

commit   : b880e22de4b2543f1c1db758bca4b2135525e87a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 9 Jun 2019 11:25:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 9 Jun 2019 11:25:56 +0900    

Click here for diff

Author: Guillaume Lelarge  
Discussion: https://postgr.es/m/CAECtzeWPz4JikzUqZdMjqPTe8dAP3nZxPD-58Y-Hhvirg0fF+A@mail.gmail.com  

M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/runtime.sgml

Update documentation about SIGKILL of postmaster.

commit   : a806b14a1139d3443a7c2c263abb9ff8e4a65694    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    

Click here for diff

Removing shared memory and semaphores in response to server start  
failure often masks the real problem, a live process associated with the  
data directory; see commit 5a907404b52753c4d6c6a7c21765aeaa42fd6a3b.  
Since 9.6, it's rarely necessary to kill subprocesses manually.  (When  
it is necessary, that commit's HINT will say as much, in all supported  
versions.)  

M doc/src/sgml/runtime.sgml

Stop using spelling "nonexistant".

commit   : f2c71cb71fe186dcf8ebec967f98d1c7c4777943    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    

Click here for diff

The documentation used "nonexistent" exclusively, and the source tree  
used it three times as often as "nonexistant".  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M src/bin/pg_dump/t/002_pg_dump.pl
M src/interfaces/ecpg/test/connect/test1.pgc
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr
M src/interfaces/ecpg/test/expected/connect-test1.c
M src/interfaces/ecpg/test/expected/connect-test1.stderr
M src/interfaces/ecpg/test/expected/connect-test5.c
M src/interfaces/ecpg/test/expected/connect-test5.stderr
M src/interfaces/ecpg/test/expected/preproc-whenever.c
M src/interfaces/ecpg/test/expected/preproc-whenever.stderr
M src/interfaces/ecpg/test/preproc/whenever.pgc
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_am.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_am.sql
M src/test/regress/sql/rowtypes.sql
M src/test/regress/sql/stats_ext.sql

Update stale comments, and fix comment typos.

commit   : 31d250e049b4e3d51a635edaa2221c11815e40e7    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    

Click here for diff

M src/backend/access/brin/brin_inclusion.c
M src/backend/access/transam/multixact.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/like.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/controldata.c
M src/fe_utils/string_utils.c
M src/include/storage/s_lock.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/recovery/t/013_crash_restart.pl

Fix assorted inconsistencies.

commit   : 92c4abc73693690ce9ff13ede160f0dcb0a2de7b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 8 Jun 2019 08:16:38 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 8 Jun 2019 08:16:38 +0530    

Click here for diff

There were a number of issues in the recent commits which include typos,  
code and comments mismatch, leftover function declarations.  Fix them.  
  
Reported-by: Alexander Lakhin  
Author: Alexander Lakhin, Amit Kapila and Amit Langote  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/ef0c0232-0c1d-3a35-63d4-0ebd06e31387@gmail.com  

M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeModifyTable.c
M src/backend/lib/integerset.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/smgr/md.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/executor/executor.h
M src/include/storage/sync.h
M src/test/modules/test_integerset/test_integerset.c

Move be-gssapi-common.h into src/include/libpq/

commit   : 35b2d4bc0eb5d61a2a294ccb6b2e4abdad307604    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 8 Jun 2019 09:59:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 8 Jun 2019 09:59:02 +0900    

Click here for diff

The file has been introduced in src/backend/libpq/ as of b0b39f72, but  
all backend-side headers of libpq are located in src/include/libpq/.  
Note that the identification path on top of the file referred to  
src/include/libpq/ from the start.  
  
Author: Michael Paquier  
Reviewed-by: Stephen Frost  
Discussion: https://postgr.es/m/20190607043415.GE1736@paquier.xyz  

M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-gssapi.c
R100 src/backend/libpq/be-gssapi-common.h src/include/libpq/be-gssapi-common.h

Improve some comments in pg_checksums about the needed clean shutdown

commit   : 84d4de97e8d14469974eb488730a13f942aa787a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 7 Jun 2019 20:48:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 7 Jun 2019 20:48:39 +0900    

Click here for diff

It was not clear from the code why it is necessary.  And we need a clean  
shutdown to avoid random checksum failures caused by torn pages.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDum5MbAb7F=pa9dOD1W2tukuDMPzWT7NjZceNoWB_6Qw@mail.gmail.com  

M src/bin/pg_checksums/pg_checksums.c

Fix copy-pasto in freeing memory on error in vacuumlo.

commit   : 77b68e3a4f854d95350a3366ecfc8b3b506ebaa7    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 7 Jun 2019 12:42:27 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 7 Jun 2019 12:42:27 +0300    

Click here for diff

It's harmless to call PQfreemem() with a NULL argument, so the only  
consequence was that if allocating 'schema' failed, but allocating 'table'  
or 'field' succeeded, we would leak a bit of memory. That's highly  
unlikely to happen, so this is just academical, but let's get it right.  
  
Per bug #15838 from Timur Birsh. Backpatch back to 9.5, where the  
PQfreemem() calls were introduced.  
  
Discussion: https://www.postgresql.org/message-id/15838-3221652c72c5e69d@postgresql.org  

M contrib/vacuumlo/vacuumlo.c

Fix default_tablespace usage for partitioned tables

commit   : a36c84c3e4a9bee6baa740848f67a5db3fa279b0    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 7 Jun 2019 00:44:17 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 7 Jun 2019 00:44:17 -0400    

Click here for diff

In commit 87259588d0ab I (Álvaro) tried to rationalize the determination  
of tablespace to use for partitioned tables, but failed to handle the  
default_tablespace case.  Repair and add proper tests.  
  
Author: Amit Langote, Rushabh Lathia  
Reported-by: Rushabh Lathia  
Reviewed-by: Amit Langote, Álvaro Herrera  
Discussion: https://postgr.es/m/CAGPqQf0cYjm1=rjxk_6gU0SjUS70=yFUAdCJLwWzh9bhNJnyVg@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Fix inconsistency in comments atop ExecParallelEstimate.

commit   : d8261595bc6f5189896cdce6861915ac23830e7c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 7 Jun 2019 05:23:52 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 7 Jun 2019 05:23:52 +0530    

Click here for diff

When this code was initially introduced in commit d1b7c1ff, the structure  
used was SharedPlanStateInstrumentation, but later when it got changed to  
Instrumentation structure in commit b287df70, we forgot to update the  
comment.  
  
Reported-by: Wu Fei  
Author: Wu Fei  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/52E6E0843B9D774C8C73D6CF64402F0562215EB2@G08CNEXMBPEKD02.g08.fujitsu.local  

M src/backend/executor/execParallel.c

Fix message style

commit   : e8bdea58f960eac669ebac01dc3865606dd7b453    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 6 Jun 2019 12:18:14 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 6 Jun 2019 12:18:14 -0400    

Click here for diff

Mark one message not for translation, and prefer "cannot" over "may  
not", per commentary from Robert Haas.  
  
Discussion: https://postgr.es/m/20190430145813.GA29872@alvherre.pgsql  

M src/backend/access/heap/heapam.c
M src/backend/access/table/tableamapi.c
M src/test/regress/expected/create_am.out

Add forgotten translatable string in pg_checksums.c

commit   : 438e51987dcc21ca7ce28c6d1a4e58b0249eb690    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 6 Jun 2019 22:10:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 6 Jun 2019 22:10:52 +0900    

Click here for diff

Oversight in commit 280e5f1.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20190606.200612.110313249.horikyota.ntt@gmail.com  

M src/bin/pg_checksums/pg_checksums.c

pg_waldump: Fix invalid option handling

commit   : f65eced25118aab29804debc4e0b9a67f4d043ad    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Jun 2019 22:55:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Jun 2019 22:55:16 +0200    

Click here for diff

Previously, running pg_waldump with an invalid option (pg_waldump  
--foo) would print the help output and exit successfully.  This was  
because it tried to process the option letter '?' as a normal option,  
but that letter is used by getopt() to report an invalid option.  
  
To fix, process help and version options separately, like we do  
everywhere else.  Also add a basic test suite for pg_waldump and run  
the basic option handling tests, which would have caught this.  

M src/bin/pg_waldump/.gitignore
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/pg_waldump.c
A src/bin/pg_waldump/t/001_basic.pl

Fix confusion on different kinds of slots in IndexOnlyScans.

commit   : cd96389d713787b025c84869ba417c6f2f008a86    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 6 Jun 2019 09:46:52 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 6 Jun 2019 09:46:52 +0300    

Click here for diff

We used the same slot to store a tuple from the index, and to store a  
tuple from the table. That's not OK. It worked with the heap, because  
heapam_getnextslot() stores a HeapTuple to the slot, and doesn't care how  
large the tts_values/nulls arrays are. But when I played with a toy table  
AM implementation that used a virtual tuple, it caused memory overruns.  
  
In the passing, tidy up comments on the ioss_PscanLen fields.  

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

Docs: concurrent builds of partitioned indexes are not supported

commit   : 6c0c28383749c0ade89ac70ba6dbce9af140c0a9    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 6 Jun 2019 12:36:37 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 6 Jun 2019 12:36:37 +1200    

Click here for diff

Document that CREATE INDEX CONCURRENTLY is not currently supported for  
indexes on partitioned tables.  
  
Discussion: https://postgr.es/m/CAKJS1f_CErd2z9L21Q8OGLD4TgH7yw1z9MAtHTSO13sXVG-yow@mail.gmail.com  
Backpatch-through: 11  

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

commit   : b250898c76f3a04421656f1bd8c5c520de02046d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Jun 2019 22:08:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Jun 2019 22:08:50 +0200    

Click here for diff

Formal tables should generally have an xref in the text that points to  
them.  Add them here.  

M doc/src/sgml/func.sgml

Fix confusing NOTICE text in REINDEX CONCURRENTLY

commit   : e24a815c1c8550fcba5cc5aeb0d130db46570872    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 5 Jun 2019 21:05:41 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 5 Jun 2019 21:05:41 +1200    

Click here for diff

When performing REINDEX TABLE CONCURRENTLY, if all of the table's indexes  
could not be reindexed, a NOTICE message claimed that the table had no  
indexes.  This was confusing, so let's change the NOTICE text to something  
less confusing.  
  
In passing, also mention in the comment before ReindexRelationConcurrently  
that materialized views are supported too and also explain what the return  
value of the function means.  
  
Author: Ashwin Agrawal  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CALfoeithHvi13p_VyR8kt9o6Pa7Z=Smi6Nfc2anHnQx5Lj8bTQ@mail.gmail.com  

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

Fix incorrect index behavior in COPY FROM with partitioned tables

commit   : 56b3b3838284f53c83556592e60688522155f57f    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 5 Jun 2019 18:28:38 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 5 Jun 2019 18:28:38 +1200    

Click here for diff

86b85044e rewrote how COPY FROM works to allow multiple tuple buffers to  
exist to once thus allowing multi-inserts to be used in more cases with  
partitioned tables.  That commit neglected to update the estate's  
es_result_relation_info when flushing the insert buffer to the partition  
making it possible for the index tuples to be added into an index on the  
wrong partition.  
  
Fix this and also add an Assert in ExecInsertIndexTuples to help ensure  
that we never make this mistake again.  
  
Reported-by: Haruka Takatsuka  
Author: Ashutosh Sharma  
Discussion: https://postgr.es/m/15832-b1bf336a4ee246b5@postgresql.org  

M src/backend/commands/copy.c
M src/backend/executor/execIndexing.c
M src/test/regress/input/copy.source
M src/test/regress/output/copy.source

Rework code using list_delete_cell() in MergeAttributes

commit   : f7e954ad1cf99a65b1785d999058898a6d56e014    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 5 Jun 2019 15:01:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 5 Jun 2019 15:01:14 +0900    

Click here for diff

When merging two attributes, we are sure that at least one remains.  
However, when deleting one element in the attribute list we may finish  
with an empty list returned as NIL by list_delete_cell(), but the code  
failed to track that, which is not project-like.  Adjust the call so as  
we check for an empty list, and make use of it in an assertion.  
  
This has been introduced by e7b3349, when adding support for CREATE  
TABLE OF.  
  
Author: Mark Dilger  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/CAE-h2TpPDqSWgOvfvSziOaMngMPwW+QZcmPpY8hQ_KOJ2+3hXQ@mail.gmail.com  

M src/backend/commands/tablecmds.c

Document piecemeal construction of partitioned indexes

commit   : 5efd604ec0a3bdde98fe19d8cada69ab4ef80db3    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 4 Jun 2019 16:42:40 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 4 Jun 2019 16:42:40 -0400    

Click here for diff

Continuous operation cannot be achieved without applying this technique,  
so it needs to be properly described.  
  
Author: Álvaro Herrera  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/8756.1556302759@sss.pgh.pa.us  

M doc/src/sgml/ddl.sgml

doc: Fix whitespace

commit   : ece9dc40d6d77a8607e72931510e30cfdfb78fd4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 4 Jun 2019 13:57:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 4 Jun 2019 13:57:38 +0200    

Click here for diff

Verbatim environment tags should not be indented.  

M doc/src/sgml/func.sgml

Add command column to pg_stat_progress_create_index

commit   : c880096dc1e14b62610aa34bc98db226fa134260    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 4 Jun 2019 09:16:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 4 Jun 2019 09:16:02 +0200    

Click here for diff

This allows determining which command is running, similar to  
pg_stat_progress_cluster.  
  
Discussion: https://www.postgresql.org/message-id/flat/f0e56b3b-74b7-6cbc-e207-a5ed6bee18dc%402ndquadrant.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/index.c
M src/backend/catalog/system_views.sql
M src/backend/commands/indexcmds.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out

Fix some typos and inconsistencies in tableam.h

commit   : 041a2642e51eb008351435709dcb054760a43bb9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Jun 2019 09:48:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Jun 2019 09:48:25 +0900    

Click here for diff

The defined callback definitions have been using references to heap for  
a couple of variables and comments.  This makes the whole interface more  
consistent by using "table" which is more generic.  
  
A variable storing index information was misspelled as well.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20190601190946.GB1905@paquier.xyz  

M src/include/access/tableam.h

Fix contrib/auto_explain to not cause problems in parallel workers.

commit   : 2cd4e835701e15f5e32dd8bde488f8669ddf7ae8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Jun 2019 18:06:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Jun 2019 18:06:04 -0400    

Click here for diff

A parallel worker process should not be making any decisions of its  
own about whether to auto-explain.  If the parent session process  
passed down flags asking for instrumentation data, do that, otherwise  
not.  Trying to enable instrumentation anyway leads to bugs like the  
"could not find key N in shm TOC" failure reported in bug #15821  
from Christian Hofstaedtler.  
  
We can implement this cheaply by piggybacking on the existing logic  
for not doing anything when we've chosen not to sample a statement.  
  
While at it, clean up some tin-eared coding related to the sampling  
feature, including an off-by-one error that meant that asking for 1.0  
sampling rate didn't actually result in sampling every statement.  
  
Although the specific case reported here only manifested in >= v11,  
I believe that related misbehaviors can be demonstrated in any version  
that has parallel query; and the off-by-one error is certainly there  
back to 9.6 where that feature was added.  So back-patch to 9.6.  
  
Discussion: https://postgr.es/m/15821-5eb422e980594075@postgresql.org  

M contrib/auto_explain/auto_explain.c

Fix unsafe memory management in CloneRowTriggersToPartition().

commit   : eaf0292c3ba7acac2735f99a8988bd49a26112f5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Jun 2019 16:59:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Jun 2019 16:59:16 -0400    

Click here for diff

It's not really supported to call systable_getnext() in a different  
memory context than systable_beginscan() was called in, and it's  
*definitely* not safe to do so and then reset that context between  
calls.  I'm not very clear on how this code survived  
CLOBBER_CACHE_ALWAYS testing ... but Alexander Lakhin found a case  
that would crash it pretty reliably.  
  
Per bug #15828.  Fix, and backpatch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/15828-f6ddd7df4852f473@postgresql.org  

M src/backend/commands/tablecmds.c

Update SQL conformance information about JSON path

commit   : 05d36b68ed011d112ee287b1fedd981c73a48f85    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 3 Jun 2019 21:33:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 3 Jun 2019 21:33:01 +0200    

Click here for diff

Reviewed-by: Oleg Bartunov <obartunov@postgrespro.ru>  

M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h

Fix typos in various places

commit   : 1fb6f62a84041b668fd9e85a2f33bb3a0fd28fdc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Jun 2019 13:44:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Jun 2019 13:44:03 +0900    

Click here for diff

Author: Andrea Gelmini  
Reviewed-by: Michael Paquier, Justin Pryzby  
Discussion: https://postgr.es/m/20190528181718.GA39034@glet  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M src/backend/access/gist/gist.c
M src/backend/access/heap/heapam_handler.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/inet_net_pton.c
M src/backend/utils/adt/jsonpath.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/psql/command.c
M src/common/unicode/generate-norm_test_table.pl
M src/include/executor/tuptable.h
M src/include/fe_utils/conditional.h
M src/include/nodes/execnodes.h

Fix some issues and improve psql completion for access methods

commit   : 0240a00fbd4fd14f577edf8d36a032237fd0b9cb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Jun 2019 11:02:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Jun 2019 11:02:32 +0900    

Click here for diff

The following issues have been spotted:  
- CREATE INDEX .. USING suggests both index and table AMs, but it should  
consider only index AMs.  
- CREATE TABLE .. USING has no completion support.  USING was not being  
included in the completion list where it should, and follow-up  
suggestions for table AMs have been missing as well.  
- CREATE ACCESS METHOD .. TYPE suggests only INDEX, with TABLE missing.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20190601191007.GC1905@paquier.xyz  

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

Make cpluspluscheck more portable.

commit   : f4755a2c01486519cfce5b21ab04529ad26f5ed1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 13:45:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 13:45:01 -0400    

Click here for diff

Teach it to scrape -I and -D switches from CPPFLAGS in Makefile.global.  
This is useful for testing on, eg, FreeBSD, where you won't get far  
without "-I/usr/local/include".  
  
Also, expand the set of blacklisted-for-unportability atomics headers,  
based on noting that arch-x86.h fails to compile on an ARM box.  The  
other ones I'd omitted seem to compile all right on architectures they  
don't belong to, but that's surely too shaky to rely on.  Let's do  
like we did for the src/include/port/ headers, and ignore all except  
the variant that's pulled in by the arch-independent header.  

M src/tools/pginclude/cpluspluscheck

Clean up PL/Perl's handling of the _() macro.

commit   : 032627ee7837f0baa539df7247e003dbaded2c90    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 12:23:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 12:23:39 -0400    

Click here for diff

Perl likes to redefine the _() macro:  
  
#ifdef CAN_PROTOTYPE  
#define	_(args) args  
#else ...  
  
There was lots not to like about the way we dealt with this before:  
  
1. Instead of taking care of the conflict centrally in plperl.h, we  
expected every one of its ever-growing number of includers to do so.  
This is duplicative and error-prone in itself, plus it means that  
plperl.h fails to meet the expectation of being compilable standalone,  
resulting in macro-redefinition warnings in cpluspluscheck.  
  
2. We left _() with its Perl definition, meaning that if someone tried  
to use it in any Perl-related extension, it would silently fail to  
provide run-time translation.  I don't see any live bugs of this ilk,  
but it's clearly a hard-to-notice bug waiting to happen.  
  
So fix that by centralizing the cleanup logic, making it match what  
we're already doing for other macro conflicts with Perl.  Since we only  
expect plperl.h to be included by extensions not core code, we should  
redefine _() as dgettext() not gettext().  

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

worker_spi needs a .gitignore file now.

commit   : 135063e6f6ee61c7243801e9f4d702921ed53e06    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 11:13:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 11:13:23 -0400    

Click here for diff

A src/test/modules/worker_spi/.gitignore

Un-break ecpg tests for Windows.

commit   : 10a53cae9993abae159abdc6a76e46f6aac120d1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 11:07:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Jun 2019 11:07:54 -0400    

Click here for diff

Declaring a function "inline" still doesn't work with Windows compilers  
(C99? what's that?), unless the macro provided by pg_config.h is  
in-scope, which it is not in our ECPG test programs.  So the workaround  
I tried to use in commit 7640f9312 doesn't work for Windows.  Revert  
the change in printf_hack.h, and instead just blacklist that file  
in cpluspluscheck --- since it's a not-installed test file, we don't  
really need to verify its C++ cleanliness anyway.  

M src/interfaces/ecpg/test/expected/compat_informix-dec_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/printf_hack.h
M src/tools/pginclude/cpluspluscheck

Increase test coverage for worker_spi by ∞%

commit   : 4b3f1dd71b74f82dedbf37c331d0a444368c4009    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sun, 2 Jun 2019 00:29:49 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sun, 2 Jun 2019 00:29:49 -0400    

Click here for diff

This test module was not getting invoked, other than at compile time,  
limiting its usefulness -- and keeping its coverage at 0%.  Add a  
minimal regression test to ensure it runs on make check-world; this  
makes it 92% covered (line-wise), which seems sufficient.  
  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/20190529193256.GA17603@alvherre.pgsql  

M src/test/modules/worker_spi/Makefile
A src/test/modules/worker_spi/dynamic.conf
A src/test/modules/worker_spi/expected/worker_spi.out
A src/test/modules/worker_spi/sql/worker_spi.sql
M src/test/modules/worker_spi/worker_spi.c

Fix documentation of check_option in information_schema.views

commit   : 0b8e0532c65c3a2d4b0e9c254efa022767bacceb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 1 Jun 2019 15:33:47 -0400    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 1 Jun 2019 15:33:47 -0400    

Click here for diff

Support of CHECK OPTION for updatable views has been added in 9.4, but  
the documentation of information_schema never got the call even if the  
information displayed is correct.  
  
Author: Gilles Darold  
Discussion: https://postgr.es/m/75d07704-6c74-4f26-656a-10045c01a17e@darold.net  
Backpatch-through: 9.4  

M doc/src/sgml/information_schema.sgml

Improve coverage of cpluspluscheck.

commit   : 6f54b80edd88abd5665aa12fbcf10f846dd80939    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 16:32:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 16:32:07 -0400    

Click here for diff

Formerly, cpluspluscheck was only meant to examine headers that  
we thought of as exported --- but its notion of what we export  
was well behind the times.  Let's just make it check *all* .h  
files, except for a well-defined blacklist, instead.  
  
While at it, improve its ability to use a C++ compiler other than g++,  
by scraping the CXX setting from Makefile.global and making it possible  
to override the warning options used (per suggestion from Andres Freund).  
  
Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru  

M src/tools/pginclude/cpluspluscheck

Integrate cpluspluscheck into build system.

commit   : b1cd7ce23f40e1e443b3f2ab127bbe8348add678    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 31 May 2019 12:36:17 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 31 May 2019 12:36:17 -0700    

Click here for diff

Previously cpluspluscheck wouldn't work in vpath builds, this commit  
fixes that. To make it easier to invoke, there's a top-level  
cpluspluscheck target.  
  
Discussion: https://postgr.es/20190530220244.kiputcbl4gkl2oo6@alap3.anarazel.de  

M GNUmakefile.in
M src/tools/pginclude/cpluspluscheck

Fix incorrect parameter name in comment

commit   : 72b6223f766d6ba9076d7b1ebdf05df75e83ba5c    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 31 May 2019 13:30:05 -0400    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 31 May 2019 13:30:05 -0400    

Click here for diff

Author: Antonin Houska  
Discussion: https://postgr.es/m/22370.1559293357@localhost  

M src/include/access/tableam.h

Adjust ecpg expected-results files for commit 7640f9312.

commit   : ec66ec8b21d3d779047313ac214fba7bcd29a97c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 12:47:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 12:47:19 -0400    

Click here for diff

Mea culpa for not rechecking check-world at the last step :-(  
Per buildfarm.  

M src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c

Fix C++ incompatibilities in ecpg/preproc/ header files.

commit   : 4f67858d3f210658d42f44fc674d2850581e572e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 12:38:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 12:38:53 -0400    

Click here for diff

There's probably no need to back-patch this, since it seems unlikely  
that anybody would be inserting C++ code into ecpg's preprocessor.  
  
Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru  

M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/type.h

Fix C++ incompatibilities in plpgsql's header files.

commit   : 3f61b3205f1a8bd27909be97341f002db8842093    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 12:34:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 12:34:54 -0400    

Click here for diff

Rename some exposed parameters so that they don't conflict with  
C++ reserved words.  
  
Back-patch to all supported versions.  
  
George Tarasov  
  
Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru  

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

Fix assorted header files that failed to compile standalone.

commit   : 7640f9312321ceba2af61f7017da7e64f0f7b667    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 11:45:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 11:45:33 -0400    

Click here for diff

We have a longstanding project convention that all .h files should  
be includable with no prerequisites other than postgres.h.  This is  
tested/relied-on by cpluspluscheck.  However, cpluspluscheck has not  
historically been applied to most headers outside the src/include  
tree, with the predictable consequence that some of them don't work.  
Fix that, usually by adding missing #include dependencies.  
  
The change in printf_hack.h might require some explanation: without  
it, my C++ compiler whines that the function is unused.  There's  
not so many call sites that "inline" is going to cost much, and  
besides all the callers are in test code that we really don't care  
about the size of.  
  
There's no actual bugs being fixed here, so I see no need to back-patch.  
  
Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru  

M src/bin/pg_waldump/rmgrdesc.h
M src/bin/psql/crosstabview.h
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/test/printf_hack.h
M src/interfaces/libpq/fe-gssapi-common.h
M src/pl/plperl/plperl_helpers.h
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_resultobject.h
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/plpy_subxactobject.h
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.h
M src/pl/plpython/plpython.h

Make our perfect hash functions be valid C++.

commit   : 9e58705a7f9728f10b2e0f0c9adc6e6ecff7486e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 10:40:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 May 2019 10:40:00 -0400    

Click here for diff

While C is happy to cast "const void *" to "const unsigned char *"  
silently, C++ insists on an explicit cast.  Since we put these  
functions into header files, cpluspluscheck whines about that.  
Add the cast to pacify it.  
  
Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru  

M src/tools/PerfectHash.pm

Fix double-phrase typo in message

commit   : d22f885f895add7e0184b08a78ba92ff091e36c4    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 May 2019 10:08:37 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 May 2019 10:08:37 -0400    

Click here for diff

New in 147e3722f7e5.  

M src/backend/access/table/tableam.c

Rework options of pg_checksums options for filenode handling

commit   : fc115d0f9fc656967260815c031e0f25741428ae    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 May 2019 16:58:17 -0400    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 May 2019 16:58:17 -0400    

Click here for diff

This makes the tool consistent with the option set of oid2name, which  
has been historically using -f for filenodes, and has more recently  
gained long options and --filenode via 1aaf532.  
  
Reported-by: Peter Eisentraut  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/97045260-fb9e-e145-a950-cf7d28c4eaea@2ndquadrant.com  

M doc/src/sgml/ref/pg_checksums.sgml
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl

Remove unnecessary (and wrong) forward declaration.

commit   : 13002bf0bcdf4900987684ca6ef7665a25aa692b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 30 May 2019 13:44:38 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 30 May 2019 13:44:38 -0700    

Click here for diff

Interestingly only C++ compilers have, so far, complained about this  
odd forward declaration. This originated when IndexBuildCallback was  
defined in another file, but now is completely unnecessary (but was  
wrong before too, cpluspluscheck just wouldn't have noticed).  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/53941.1559239260@sss.pgh.pa.us  

M src/include/access/tableam.h

Make error logging in extended statistics more consistent

commit   : fe415ff10408a1487d5773b47459306476ec58f0    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 30 May 2019 16:16:12 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 30 May 2019 16:16:12 +0200    

Click here for diff

Most errors reported in extended statistics are internal issues, and so  
should use elog(). The MCV list code was already following this rule, but  
the functional dependencies and ndistinct coefficients were using a mix  
of elog() and ereport(). Fix this by changing most places to elog(), with  
the exception of input functions.  
  
This is a mostly cosmetic change, it makes the life a little bit easier  
for translators, as elog() messages are not translated. So backpatch to  
PostgreSQL 10, where extended statistics were introduced.  
  
Author: Tomas Vondra  
Backpatch-through: 10 where extended statistics were added  
Discussion: https://postgr.es/m/20190503154404.GA7478@alvherre.pgsql  

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

Fix some documentation about access methods

commit   : 56b78626c7288fad498c0fae7fe4fd1f240ed13f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 29 May 2019 11:37:37 -0400    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 29 May 2019 11:37:37 -0400    

Click here for diff

Author: Guillaume Lelarge  
Discussion: https://postgr.es/m/CAECtzeWPz4JikzUqZdMjqPTe8dAP3nZxPD-58Y-Hhvirg0fF+A@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/tablesample-method.sgml

Fix some documentation about FKs and partitioned tables

commit   : f73293aba4d43e48707e361b2b1ef1465fef46e0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 29 May 2019 11:19:06 -0400    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 29 May 2019 11:19:06 -0400    

Click here for diff

This got forgotten in f56f8f which has added foreign key support for  
partitioned tables.  In passing, add a mention about caveats applying to  
tables partitioned using inheritance regarding indexes and foreign keys.  
  
Author: Paul A Jungwirth  
Reviewed-by: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/CA+renyUuSmYgmZjKc_DfUNVZ0uttF91-FwhDVW3F7WEPj0jL5w@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Make one message just like all its siblings.

commit   : d890fa812dd4620db0d092da1cd7cba01494cd21    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 28 May 2019 23:44:22 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 28 May 2019 23:44:22 -0400    

Click here for diff

M src/backend/storage/page/bufpage.c

Fix typo in message

commit   : a100974751baec7e13a527bf0c378ce8ef2787b6    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 28 May 2019 17:34:38 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 28 May 2019 17:34:38 -0400    

Click here for diff

I introduced the typo in source code in the course of 75445c1515ff.  
Repair.  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out

In the pg_upgrade test suite, don't write to src/test/regress.

commit   : 40b132c1afbb4b1494aa8e48cc35ec98d2b90777    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Tue, 28 May 2019 12:59:00 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Tue, 28 May 2019 12:59:00 -0700    

Click here for diff

When this suite runs installcheck, redirect file creations from  
src/test/regress to src/bin/pg_upgrade/tmp_check/regress.  This closes a  
race condition in "make -j check-world".  If the pg_upgrade suite wrote  
to a given src/test/regress/results file in parallel with the regular  
src/test/regress invocation writing it, a test failed spuriously.  Even  
without parallelism, in "make -k check-world", the suite finishing  
second overwrote the other's regression.diffs.  This revealed test  
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.  
  
Buildfarm client REL_10, released fifty-four days ago, supports saving  
regression.diffs from its new location.  When an older client reports a  
pg_upgradeCheck failure, it will no longer include regression.diffs.  
Back-patch to 9.5, where pg_upgrade moved to src/bin.  
  
Reviewed (in earlier versions) by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com  

M src/bin/pg_upgrade/test.sh
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/tools/msvc/vcregress.pl

In the pg_upgrade test suite, remove and recreate "tmp_check".

commit   : 10b72deafea5972edcafb9eb3f97154f32ccd340    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Tue, 28 May 2019 12:58:30 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Tue, 28 May 2019 12:58:30 -0700    

Click here for diff

This allows "vcregress upgradecheck" to pass twice in immediate  
succession, and it's more like how $(prove_check) works.  Back-patch to  
9.5, where pg_upgrade moved to src/bin.  
  
Discussion: https://postgr.es/m/20190520012436.GA1480421@rfd.leadboat.com  

M src/bin/pg_upgrade/test.sh
M src/tools/msvc/vcregress.pl

v12 release notes: Correct contributor name.

commit   : d5ec46bf224d2ea1b010b2bc10a65e44d4456553    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 28 May 2019 09:06:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 28 May 2019 09:06:40 -0700    

Click here for diff

Mea culpa.  

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

Fix comment

commit   : a94fd139df975a006d1697d2a7180d3656222d4d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 28 May 2019 08:26:24 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 28 May 2019 08:26:24 -0400    

Click here for diff

This code block was copied/adapted from other similar places but  
somehow the comment placement was changed so that it makes less sense.  

M src/bin/pg_checksums/pg_checksums.c

docs: PG 12 relnote wording fix

commit   : 3ceaed106d95e76c7dbfd41f5d83a163fd0d25c8    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 28 May 2019 07:17:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 28 May 2019 07:17:34 -0400    

Click here for diff

Reported-by: Gaby Schilders  

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

Fix typos in SQL scripts of pgcrypto

commit   : af94ea7406f332567331a9b2525fae4b57c96061    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 28 May 2019 06:33:30 -0400    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 28 May 2019 06:33:30 -0400    

Click here for diff

Author: Gurjeet Singh  
Discussion: https://postgr.es/m/CABwTF4U_5kEnH93PXZEuEsZHuoSSuBEOqC6pian8vDfLZSQJNA@mail.gmail.com  

M contrib/pgcrypto/expected/hmac-sha1.out
M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/sql/hmac-sha1.sql
M contrib/pgcrypto/sql/pgp-decrypt.sql

doc: Fix generated column documentation

commit   : 00ef6e3b28a8220f2dba881dbf56e3ba62f851bd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 27 May 2019 12:26:16 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 27 May 2019 12:26:16 -0400    

Click here for diff

The old text still had an implicit reference to the virtual behavior,  
which was not in the final patch.  
  
Author: Tobias Bussmann <t.bussmann@gmx.net>  

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

Fix more thinkos in new ECPG "PREPARE AS" code.

commit   : 39fe881d3cf315d8d2ea9ee4ea1e3e39a82d5cc7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 26 May 2019 10:39:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 26 May 2019 10:39:11 -0400    

Click here for diff

ecpg_build_params() failed to check for ecpg_alloc failure in one  
newly-added code path, and leaked a temporary string in another path.  
Errors in commit a1dc6ab46, spotted by Coverity.  

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

Fix thinko in new ECPG "PREPARE AS" code.

commit   : 331695a4d9ca40864240aca721dc588a206ff395    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 26 May 2019 10:06:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 26 May 2019 10:06:37 -0400    

Click here for diff

ecpg_register_prepared_stmt() is pretty obviously checking the wrong  
variable while trying to detect malloc failure.  Error in commit  
a1dc6ab46, spotted by Coverity.  

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

Fix typos.

commit   : 9679345f3c5ec071f63db358581e28f06c8744a7    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sun, 26 May 2019 18:28:18 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sun, 26 May 2019 18:28:18 +0530    

Click here for diff

Reported-by: Alexander Lakhin  
Author: Alexander Lakhin  
Reviewed-by: Amit Kapila and Tom Lane  
Discussion: https://postgr.es/m/7208de98-add8-8537-91c0-f8b089e2928c@gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/charset.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execTuples.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/libpq/hba.c
M src/backend/postmaster/syslogger.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/statistics/statistics.h
M src/include/utils/jsonpath.h
M src/interfaces/libpq/pqexpbuffer.c

Change Graphviz file extension

commit   : 41205719d34969018f708baa70d9d06dae0c0d08    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 26 May 2019 08:08:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 26 May 2019 08:08:05 +0200    

Click here for diff

Change extension for Graphviz files from .dot to .gv.  The latter  
appears to be the generally preferred one nowadays.  
  
Discussion: https://www.postgresql.org/message-id/flat/71fe76d2-c7d7-2acc-6762-bbf9e61c566e%402ndquadrant.com  

M contrib/pg_trgm/trgm_regexp.c
M doc/src/sgml/images/Makefile
R100 doc/src/sgml/images/gin.dot doc/src/sgml/images/gin.gv

Doc: fix incorrect references in PG 12 release notes.

commit   : 02aa15de1b3821b0288a13dec71ce99f2e31fda5    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 25 May 2019 15:40:53 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 25 May 2019 15:40:53 +0530    

Click here for diff

Reported-by: Euler Taveira  
Author: Euler Taveira  
Discussion: https://postgr.es/m/CAHE3wgjiA8DdnUzH9WqBLxdrUVvjDkKNdHx-MkEg9uV+HtpMfg@mail.gmail.com  

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

Doc: fix typo in pgbench random_zipfian() documentation.

commit   : 591fb289c3eef010ee1bb271a54fab7da385c4cd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 24 May 2019 11:16:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 24 May 2019 11:16:06 -0400    

Click here for diff

Per bug #15819 from Koizumi Satoru.  
  
Discussion: https://postgr.es/m/15819-e6191bef1f7334c0@postgresql.org  

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

commit   : 4c9210f34c621639f896d57cf7bfb5e9be139c91    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 23 May 2019 13:23:59 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 23 May 2019 13:23:59 +1200    

Click here for diff

Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CA%2BhUKGJFWXmtYo6Frd77RR8YXCHz7hJ2mRy5aHV%3D7fJOqDnBHA%40mail.gmail.com  

M src/backend/lib/integerset.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-gssapi-common.h
M src/backend/libpq/be-secure-gssapi.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-secure-gssapi.c

Fix typos.

commit   : 7988cb446d20512ec9d091db66dba6adee3f3d4b    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 23 May 2019 13:17:41 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 23 May 2019 13:17:41 +1200    

Click here for diff

Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CA%2BhUKGJFWXmtYo6Frd77RR8YXCHz7hJ2mRy5aHV%3D7fJOqDnBHA%40mail.gmail.com  

M src/backend/executor/execTuples.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/sharedfileset.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c

tableam: Rename wrapper functions to match callback names.

commit   : 73b8c3bd2889fed986044e15aefd0911f96ccdd3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 23 May 2019 16:25:48 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 23 May 2019 16:25:48 -0700    

Click here for diff

Some of the wrapper functions didn't match the callback names. Many of  
them due to staying "consistent" with historic naming of the wrapped  
functionality. We decided that for most cases it's more important to  
be for tableam to be consistent going forward, than with the past.  
  
The one exception is beginscan/endscan/...  because it'd have looked  
odd to have systable_beginscan/endscan/... with a different naming  
scheme, and changing the systable_* APIs would have caused way too  
much churn (including breaking a lot of external users).  
  
Author: Ashwin Agrawal, with some small additions by Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CALfoeiugyrXZfX7n0ORCa4L-m834dzmaE8eFdbNR6PMpetU4Ww@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/table/tableam.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/tid.c
M src/include/access/tableam.h

Fix table dump in pg_dump[all] with backends older than 9.5

commit   : 54487d1560619a0027e0651d1b8d715ca8fc388c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 24 May 2019 08:19:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 24 May 2019 08:19:21 +0900    

Click here for diff

The access method name "amname" can be dumped as of 3b925e90, but  
queries for backends older than 9.5 forgot to map it to a dummy NULL  
value, causing the column to not be mapped to a number.  As a result,  
pg_dump was throwing some spurious errors in its stderr output coming  
from libpq:  
pg_dump: column number -1 is out of range 0..36  
  
Fix this issue by adding a mapping of "amname" to NULL to all the older  
queries.  
  
Discussion: https://postgr.es/m/20190522083038.GA16837@paquier.xyz  
Author: Michael Paquier  
Reviewed-by: Dmitry Dolgov, Andres Freund, Tom Lane  

M src/bin/pg_dump/pg_dump.c

pg_upgrade: Make test.sh's installcheck use to-be-upgraded version's bindir.

commit   : f916221df5652b95c402847905bdf48950b5b281    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 23 May 2019 14:46:52 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 23 May 2019 14:46:52 -0700    

Click here for diff

On master (after 700538) the old version's installed psql was used -  
even when the old version might not actually be installed / might be  
installed into a temporary directory. As commonly the case when just  
executing make check for pg_upgrade, as $oldbindir is just the current  
version's $bindir.  
  
In the back branches, with --install specified, psql from the new  
version's temporary installation was used, without --install (e.g for  
NO_TEMP_INSTALL, cf 47b3c26642), the new version's installed psql was  
used (which might or might not exist).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20190522175150.c26f4jkqytahajdg@alap3.anarazel.de  

M src/bin/pg_upgrade/test.sh

Fix array size allocation for HashAggregate hash keys.

commit   : 44e95b5728a4569c494fa4ea4317f8a2f50a206b    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Thu, 23 May 2019 15:26:01 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Thu, 23 May 2019 15:26:01 +0100    

Click here for diff

When there were duplicate columns in the hash key list, the array  
sizes could be miscomputed, resulting in access off the end of the  
array. Adjust the computation to ensure the array is always large  
enough.  
  
(I considered whether the duplicates could be removed in planning, but  
I can't rule out the possibility that duplicate columns might have  
different hash functions assigned. Simpler to just make sure it works  
at execution time regardless.)  
  
Bug apparently introduced in fc4b3dea2 as part of narrowing down the  
tuples stored in the hashtable. Reported by Colm McHugh of Salesforce,  
though I didn't use their patch. Backpatch back to version 10 where  
the bug was introduced.  
  
Discussion: https://postgr.es/m/CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com  

M src/backend/executor/nodeAgg.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Fix ordering of GRANT commands in pg_dumpall for tablespaces

commit   : 156c0c2dff403fd115f3a5f6d73ab80959c84129    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 23 May 2019 10:48:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 23 May 2019 10:48:17 +0900    

Click here for diff

This uses a method similar to 68a7c24f and now b8c6014 (applied for  
database creation), which guarantees that GRANT commands using the WITH  
GRANT OPTION are dumped in a way so as cascading dependencies are  
respected.  Note that tablespaces do not have support for initial  
privileges via pg_init_privs, so the same method needs to be applied  
again.  It would be nice to merge all the logic generating ACL queries  
in dumps under the same banner, but this requires extending the support  
of pg_init_privs to objects that cannot use it yet, so this is left as  
future work.  
  
Discussion: https://postgr.es/m/20190522071555.GB1278@paquier.xyz  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Backpatch-through: 9.6  

M src/bin/pg_dump/pg_dumpall.c

Remove -o/--oids from pg_dumpall

commit   : 657c2384c6c79c6ed0d6f71f811b2fc7c41f104a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 23 May 2019 09:36:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 23 May 2019 09:36:28 +0900    

Click here for diff

This has been forgotten in 578b229, which has removed support for WITH  
OIDS.  
  
Discussion: https://postgr.es/m/CALAY4q99FcFCoG6ddke0V-AksGe82L_+bhDWgEfgZBakB840zA@mail.gmail.com  
Author: Surafel Temesgen  

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

Initial pgperltidy run for v12.

commit   : db6e2b4c52ade524f3db419d75084728e96e1f9c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 13:36:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 13:36:19 -0400    

Click here for diff

Make all the perl code look nice, too (for some value of "nice").  

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_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/catalog/unused_oids
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/perl/TestLib.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/100_bugs.pl
M src/tools/gen_keywordlist.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/build.pl
M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/vcregress.pl

Phase 2 pgindent run for v12.

commit   : 8255c7a5eeba8f1a38b7a431c04909bde4f5e67d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 13:04:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 13:04:48 -0400    

Click here for diff

Switch to 2.1 version of pg_bsd_indent.  This formats  
multiline function declarations "correctly", that is with  
additional lines of parameter declarations indented to match  
where the first line's left parenthesis is.  
  
Discussion: https://postgr.es/m/CAEepm=0P3FeTXRcU5B2W3jv3PgRVZ-kGUXLGfd42FFhUROO3ug@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/bloom.h
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.h
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/intarray/_int_selfuncs.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/px-crypt.h
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/sepgsql/sepgsql.h
M contrib/tablefunc/tablefunc.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/xml2/xpath.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/printtup.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/ginentrypage.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistvacuum.c
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/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.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/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/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.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/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.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/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/lib/pairingheap.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.h
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/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/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.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/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/regex/regcomp.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/network.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/oracle_compat.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/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/typcache.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/mb/mbutils.c
M src/backend/utils/misc/guc.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/slab.c
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/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.h
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.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_db.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.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_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.h
M src/bin/psql/copy.h
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/startup.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.h
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/file_utils.c
M src/common/ip.c
M src/fe_utils/print.c
M src/include/access/amvalidate.h
M src/include/access/brin_internal.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/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/rewriteheap.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/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.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/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/catalog.h
M src/include/catalog/dependency.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/partition.h
M src/include/catalog/pg_aggregate.h
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_db_role_setting.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_type.h
M src/include/catalog/storage.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/copy.h
M src/include/commands/createas.h
M src/include/commands/defrem.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/view.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/ip.h
M src/include/common/md5.h
M src/include/common/pg_lzcompress.h
M src/include/common/relpath.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/string.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeGatherMerge.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/nodeSeqscan.h
M src/include/executor/spi.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/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/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/stringinfo.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/crypt.h
M src/include/libpq/hba.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq.h
M src/include/libpq/pqformat.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/extensible.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/print.h
M src/include/nodes/tidbitmap.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/paramassign.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/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_cte.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/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/regex/regex.h
M src/include/regex/regexport.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/walreceiver.h
M src/include/replication/worker_internal.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rowsecurity.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.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/itemptr.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/md.h
M src/include/storage/pg_shmem.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/smgr.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/array.h
M src/include/utils/builtins.h
M src/include/utils/catcache.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/elog.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/freepage.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hashutils.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inval.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memutils.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/pg_locale.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/ps_status.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/relcache.h
M src/include/utils/relmapper.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.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/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/libpq/fe-auth-scram.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-gssapi-common.h
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.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/plpgsql.h
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/tcl/pltcl.c
M src/port/inet_net_ntop.c
M src/port/path.c
M src/port/qsort.c
M src/port/qsort_arg.c
M src/port/snprintf.c
M src/test/isolation/isolationtester.c
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/regress/pg_regress.h
M src/timezone/localtime.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/strftime.c
M src/timezone/zic.c
M src/tools/pgindent/pgindent
M src/tutorial/funcs.c

Initial pgindent run for v12.

commit   : be76af171cdb3e7465c4ef234af403f97ad79b7b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 12:55:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 12:55:34 -0400    

Click here for diff

This is still using the 2.0 version of pg_bsd_indent.  
I thought it would be good to commit this separately,  
so as to document the differences between 2.0 and 2.1 behavior.  
  
Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us  

M contrib/amcheck/verify_nbtree.c
M contrib/cube/cube.c
M contrib/file_fdw/file_fdw.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_tool.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/imath.h
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/common/heaptuple.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/table/tableam.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/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/storage.c
M src/backend/commands/amcmds.c
M src/backend/commands/cluster.c
M src/backend/commands/constraint.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuum.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/nodes/bitmapset.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/dest.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/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/dsa.c
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.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_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.c
M src/common/d2s.c
M src/common/f2s.c
M src/common/file_utils.c
M src/common/logging.c
M src/common/pg_lzcompress.c
M src/common/rmtree.c
M src/include/access/amapi.h
M src/include/access/gistxlog.h
M src/include/access/hio.h
M src/include/access/relscan.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/tableam.h
M src/include/access/tupdesc.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/dependency.h
M src/include/catalog/index.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_policy.h
M src/include/catalog/storage.h
M src/include/commands/defrem.h
M src/include/commands/trigger.h
M src/include/commands/vacuum.h
M src/include/common/file_utils.h
M src/include/common/logging.h
M src/include/executor/execParallel.h
M src/include/executor/executor.h
M src/include/executor/tuptable.h
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/parser/parse_node.h
M src/include/pgstat.h
M src/include/port.h
M src/include/replication/logical.h
M src/include/replication/reorderbuffer.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/fd.h
M src/include/storage/md.h
M src/include/tcop/deparse_utility.h
M src/include/utils/datum.h
M src/interfaces/ecpg/ecpglib/cursor.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/pqexpbuffer.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_exec.c
M src/pl/tcl/pltcl.c
M src/port/dlopen.c
M src/port/pg_bitutils.c
M src/port/strtof.c
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/tools/pgindent/typedefs.list

Convert ExecComputeStoredGenerated to use tuple slots

commit   : 66a4bad83aaa6613a45a00a488c04427f9969fb4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 15 May 2019 19:37:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 15 May 2019 19:37:52 +0200    

Click here for diff

This code was still using the old style of forming a heap tuple rather  
than using tuple slots.  This would be less efficient if a non-heap  
access method was used.  And using tuple slots is actually quite a bit  
faster when using heap as well.  
  
Also add some test cases for generated columns with null values and  
with varlena values.  This lack of coverage was discovered while  
working on this patch.  
  
Discussion: https://www.postgresql.org/message-id/flat/20190331025744.ugbsyks7czfcoksd%40alap3.anarazel.de  

M src/backend/executor/nodeModifyTable.c
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Mention ANALYZE boolean options in documentation.

commit   : 03de5187d50af67d154a47cf00899290dca13003    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 23 May 2019 01:18:16 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 23 May 2019 01:18:16 +0900    

Click here for diff

Commit 41b54ba78e allowed not only VACUUM but also ANALYZE options  
to take a boolean argument. But it forgot to update the documentation  
for ANALYZE. This commit adds the descriptions about those ANALYZE  
boolean options into the documentation.  
  
This patch also updates tab-completion for ANALYZE boolean options.  
  
Reported-by: Kyotaro Horiguchi  
Author: Fujii Masao  
Reviewed-by: Masahiko Sawada, Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwHTUt-kuwgiwe8f0AvTnB+ySqJWh95jvmh-qcoKW9YA9g@mail.gmail.com  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/release-12.sgml
M src/bin/psql/tab-complete.c

Fix O(N^2) performance issue in pg_publication_tables view.

commit   : 166f69f769c83ef8759d905bf7f1a9aa1d97a340    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 11:46:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 11:46:57 -0400    

Click here for diff

The original coding of this view relied on a correlated IN sub-query.  
Our planner is not very bright about correlated sub-queries, and even  
if it were, there's no way for it to know that the output of  
pg_get_publication_tables() is duplicate-free, making the de-duplicating  
semantics of IN unnecessary.  Hence, rewrite as a LATERAL sub-query.  
This provides circa 100X speedup for me with a few hundred published  
tables (the whole regression database), and things would degrade as  
roughly O(published_relations * all_relations) beyond that.  
  
Because the rules.out expected output changes, force a catversion bump.  
Ordinarily we might not want to do that post-beta1; but we already know  
we'll be doing a catversion bump before beta2 to fix pg_statistic_ext  
issues, so it's pretty much free to fix it now instead of waiting for v13.  
  
Per report and fix suggestion from PegoraroF10.  
  
Discussion: https://postgr.es/m/1551385426763-0.post@n3.nabble.com  

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

docs: PG 12 release notes, support functions

commit   : 728840fe13acff7b03a4b1a813eeb8900ce5e469    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 22 May 2019 11:22:13 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 22 May 2019 11:22:13 -0400    

Click here for diff

Move support function mention to the proper section, and reword.  
  
Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/5121.1558472431@sss.pgh.pa.us  

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

doc: PG 12 relnotes, correct recovery_target* variable mention

commit   : ba95a6933632410d103d6f17cd3bc1adf92a08f9    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 22 May 2019 10:54:40 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 22 May 2019 10:54:40 -0400    

Click here for diff

Clarify new restriction on recovery_target* variables.  
  
Reported-by: Gaby Schilders  
  
Discussion: reported via chat  

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

Add .gitignore entries for new ecpg test case.

commit   : 4a657ab260499381c645673ca1c3255adc0b2ace    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 10:42:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 10:42:24 -0400    

Click here for diff

Oversight in commit a1dc6ab465986a62b308dd1bb8da316b5ed9685a.  

M src/interfaces/ecpg/test/sql/.gitignore

In transam.h, don't expose static inline functions to frontend code.

commit   : 4fbf809e13c3ba09c4f03d148cb58767e56f67f1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 10:38:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 May 2019 10:38:21 -0400    

Click here for diff

That leads to unsatisfied external references if the C compiler fails  
to elide unused static functions.  Apparently, we have no buildfarm  
members building HEAD that have that issue ... but such compilers still  
exist in the wild.  Need to do something about that.  
  
In passing, fix Berkeley-era typo in comment.  
  
Discussion: https://postgr.es/m/27054.1558533367@sss.pgh.pa.us  

M src/include/access/transam.h

Fix ordering of GRANT commands in pg_dump for database creation

commit   : b8c6014a65ee0819e8fe4c7536f72da0df5d8e46    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 22 May 2019 14:48:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 22 May 2019 14:48:00 +0900    

Click here for diff

This uses a method similar to 68a7c24f, which guarantees that GRANT  
commands using the WITH GRANT OPTION are dumped in a way so as cascading  
dependencies are respected.  As databases do not have support for  
initial privileges via pg_init_privs, we need to repeat again the same  
ACL reordering method.  
  
ACL for databases have been moved from pg_dumpall to pg_dump in v11, so  
this impacts pg_dump for v11 and above, and pg_dumpall for v9.6 and  
v10.  
  
Discussion: https://postgr.es/m/15788-4e18847520ebcc75@postgresql.org  
Author: Nathan Bossart  
Reviewed-by: Haribabu Kommi  
Backpatch-through: 9.6  

M src/bin/pg_dump/pg_dump.c

Un-break pg_upgrade regression test.

commit   : 5eb4a51cb15166392ca3ede6ec58f8f1f820ef53    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 May 2019 23:51:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 May 2019 23:51:19 -0400    

Click here for diff

Commit 5af2e976d removed a bit too much from the test.sh invocation.  
Per buildfarm.  

M src/bin/pg_upgrade/Makefile

Implement PREPARE AS statement for ECPG.

commit   : a1dc6ab465986a62b308dd1bb8da316b5ed9685a    
  
author   : Michael Meskes <meskes@postgresql.org>    
date     : Wed, 22 May 2019 04:58:29 +0200    
  
committer: Michael Meskes <meskes@postgresql.org>    
date     : Wed, 22 May 2019 04:58:29 +0200    

Click here for diff

Besides implementing the new statement this change fix some issues with the  
parsing of PREPARE and EXECUTE statements. The different forms of these  
statements are now all handled in a ujnified way.  
  
Author: Matsumura-san <matsumura.ryo@jp.fujitsu.com>  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-prepareas.c
A src/interfaces/ecpg/test/expected/sql-prepareas.stderr
A src/interfaces/ecpg/test/expected/sql-prepareas.stdout
M src/interfaces/ecpg/test/sql/Makefile
A src/interfaces/ecpg/test/sql/prepareas.pgc

pg_upgrade: Avoid check target accidentally breaking make's --output-sync.

commit   : 5af2e976d72aa345337596cc986237c57e1146b2    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 21 May 2019 15:03:27 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 21 May 2019 15:03:27 -0700    

Click here for diff

When $(MAKE) is present in a rule, make assumes that target is a  
submake, and it doesn't need to buffer its output. But in this case  
it's a shell script that needs buffered output. Avoid that heuristic,  
by referring to $(MAKE) via an indirection.  
  
Discussion: https://postgr.es/m/20190521004717.qsktdsugj3shagco@alap3.anarazel.de  

M src/bin/pg_upgrade/Makefile

pg_upgrade: Don't use separate installation for test.

commit   : 7005389b2ad17258bc3aa0a2427c4eb77fed1d09    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 21 May 2019 14:56:29 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 21 May 2019 14:56:29 -0700    

Click here for diff

For pg_upgrade's test we (unless prevented by the caller via via  
NO_TEMP_INSTALL) built a separate installation. That causes an  
unnecessary slowdown after the infrastructure introduced by  
dcae5faccab (and unnecessarily duplicates code).  
  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion:  
    https://postgr.es/m/20190521191918.z7kwnrlj45mk2k67@alap3.anarazel.de  
    https://postgr.es/m/20190521195209.qfzwfxvymguuwlu5@alap3.anarazel.de  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/test.sh

docs: PG 12 relnote adjustments based on feedback from Tom Lane

commit   : 8e719d33fd253fc378871ba4dbf2de41fd2ba462    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:45:48 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:45:48 -0400    

Click here for diff

Discussion: https://postgr.es/m/22793.1558399695@sss.pgh.pa.us  

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

docs: adjust RECORD PG 12 relnote item

commit   : 3468a04a3e498bab755909505e8f7b6023bea493    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:35:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:35:43 -0400    

Click here for diff

Discussion: https://postgr.es/m/15486.1558393010@sss.pgh.pa.us  

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

doc: adjust PG 12 relnotes item on float digit adjustment

commit   : b84a801d6a6737e6d84326b77d98b498402ecad0    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:31:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:31:02 -0400    

Click here for diff

Discussion: https://postgr.es/m/87y330d8ty.fsf@news-spur.riddles.org.uk  

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

doc: fix markup for PG 12 rel notes

commit   : 0fca8285ea533fa669a372c91fdb42265dcf7435    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:19:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:19:43 -0400    

Click here for diff

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

doc: adjustments for PG 12 release notes

commit   : 32fe2e3194c7198ca4afdb6bea4ffa12466612b1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:14:33 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 21 May 2019 16:14:33 -0400    

Click here for diff

Mostly commit messages, attribution, and text, all suggested by Andres  
Freund.  
  
Discussion: https://postgr.es/m/20190520221719.pqgld3krjc2docr5@alap3.anarazel.de  

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

Make pg_upgrade's test.sh less chatty.

commit   : eb9812f272db8e93416831e5254569b76edf8264    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 May 2019 13:11:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 May 2019 13:11:57 -0400    

Click here for diff

The use of "set -x" to echo a subset of the test's commands might've  
been a good idea during development of this test, but it's been stable  
for long enough now that the extra output isn't very useful.  Also  
our project expectations have been trending towards less output in  
non-error cases; the fact that "set -x" produces output on stderr  
is particularly annoying from that standpoint.  So get rid of it.  
  
Also, pass "-A trust" to initdb explicitly so that it won't issue  
a warning about "trust" being an insecure default.  This matches  
what the TAP tests have done for a long time, and again gets rid  
of some noise on stderr.  
  
Discussion: https://postgr.es/m/21766.1558397960@sss.pgh.pa.us  

M src/bin/pg_upgrade/test.sh

Insert temporary debugging output in regression tests.

commit   : f03a9ca4366d064d89b7cf7ed75d4e43f2ed0667    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 May 2019 12:23:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 May 2019 12:23:16 -0400    

Click here for diff

We're seeing occasional instability in the plans generated for  
parallel queries on the "a_star" table hierarchy.  This suggests  
that something is changing the planner's stats for those tables,  
but that should not be happening within a regression test run.  
To try to gather some information about what's happening, insert  
additional queries to check the basic page/tuple counts for these  
tables, as well as whether any vacuums or analyzes have happened  
on them.  (We expect that only the database-wide VACUUM in  
sanity_check.sql will have touched them.)  
  
I added the probes not only in select_parallel.sql itself, but  
also in stats.sql, bearing in mind that the stats collector's  
lag may prevent the initial query from reporting current truth.  
If any extra vacuum/analyze has happened, the recheck in stats.sql  
definitely ought to see it.  
  
This commit can be reverted once we figure out what's going on.  
  
Per suggestion from David Rowley, though I changed the queries around.  
  
Discussion: https://postgr.es/m/CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com  

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

tableam: Move heap-specific logic from needs_toast_table below tableam.

commit   : 1171d7d58545f26a402f76a05936d572bf29d53b    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 21 May 2019 11:57:13 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 21 May 2019 11:57:13 -0400    

Click here for diff

This allows table AMs to completely suppress TOAST table creation, or  
to modify the conditions under which they are created.  
  
Patch by me.  Reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+Tgmoa4O2n=yphqD2pERUnYmUO84bH1SqMsA-nSxBGsZ7gWfA@mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/toasting.c
M src/include/access/tableam.h

Doc: improve description of regexp character classes.

commit   : cf92226e9f7f985a678287167b954a831a3b660c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 May 2019 18:39:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 May 2019 18:39:53 -0400    

Click here for diff

Define the meanings of the POSIX-spec character classes in line,  
rather than referring to the ctype(3) man page.  That man page  
doesn't even exist on many modern systems, and if it does exist  
it probably says the wrong things about non-ASCII characters.  
Also document our non-POSIX-spec "ascii" character class.  
  
Also, point out here that this behavior is controlled by collation or  
LC_CTYPE, since the existing text explaining that is pretty far away.  
  
Per gripe from Geert Lobbestael.  Given the lack of prior complaints,  
I'm not excited about back-patching this.  
  
Discussion: https://postgr.es/m/155837022049.1359.2948065118562813468@wrigleys.postgresql.org  

M doc/src/sgml/func.sgml

Stamp 12beta1.

commit   : a240570b1e3802d1e82da08a9d72abeade370249    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 May 2019 16:37:22 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 May 2019 16:37:22 -0400    

Click here for diff

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

Fix regression tests broken in fc7c281f87467.

commit   : 47a14c99e4715dde7f570d050e1ddb6d21278bf8    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 20 May 2019 09:36:06 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 20 May 2019 09:36:06 -0700    

Click here for diff

This shouldn't have been committed without even running the tests (nor  
were the tests added that were suggested). I'm fixing up the results  
to get the buildfarm back to green, it's quite possible we'll want to  
revert this later.  

M src/test/regress/expected/vacuum.out

Fix comment for issue_xlog_fsync().

commit   : b8e2170e40a151eb94079ce9cd791a712ed95342    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 May 2019 00:44:00 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 May 2019 00:44:00 +0900    

Click here for diff

"segno" is the argument for the function, not "log" and "seg".  
  
Author: Antonin Houska  
Discussion: https://postgr.es/m/11863.1558361020@spoje.net  

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

Make VACUUM accept 1 and 0 as a boolean value.

commit   : fc7c281f87467c1ff24fd72e0cc313dd6a71873f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 May 2019 00:22:06 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 May 2019 00:22:06 +0900    

Click here for diff

Commit 41b54ba78e allowed existing VACUUM options to take a boolean  
argument. It's documented that valid boolean values that VACUUM can  
accept are true, false, on, off, 1, and 0. But previously the parser  
failed to accept 1 and 0 as a boolean value in VACUUM syntax because  
of a lack of NumericOnly clause for vac_analyze_option_arg in gram.y.  
  
This commit adds such NumericOnly clause so that VACUUM options  
can take also 1 and 0 as a boolean value.  
  
Discussion: https://postgr.es/m/CAHGQGwGYg82A8UCQxZe7Zn9MnyUBGdyB=1CNpKF3jBny+RbyfA@mail.gmail.com  

M src/backend/parser/gram.y

Translation updates

commit   : 3c439a58df83ae51f650cfae9878df1f9b70c4b8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 May 2019 16:00:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 May 2019 16:00:53 +0200    

Click here for diff

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

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

Remove bug.template file

commit   : 8bbb8166b63eeebd0cb618ddcf7dcaf8c4ba66f4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 May 2019 08:33:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 May 2019 08:33:31 +0200    

Click here for diff

It's outdated and not really in use anymore.  
  
Discussion: https://www.postgresql.org/message-id/flat/cf7ed2b1-1ebe-83cf-e05e-d5943f67af2d%402ndquadrant.com  

M .gitattributes
D doc/bug.template
M src/tools/version_stamp.pl

Remove outdated comment in copy.c.

commit   : fb504c5e4b5ce71e703006375ee2f5e4b57d89c9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 20:47:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 20:47:54 -0700    

Click here for diff

M src/backend/commands/copy.c

Minimally fix partial aggregation for aggregates that don't have one argument.

commit   : 2657283256f1cab53d09d2c7db1ce9b7065193a0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 18:01:06 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 18:01:06 -0700    

Click here for diff

For partial aggregation combine steps,  
AggStatePerTrans->numTransInputs was set to the transition function's  
number of inputs, rather than the combine function's number of  
inputs (always 1).  
  
That lead to partial aggregates with strict combine functions to  
wrongly check for NOT NULL input as required by strictness. When the  
aggregate wasn't exactly passed one argument, the strictness check was  
either omitted (in the 0 args case) or too many arguments were  
checked. In the latter case we'd read beyond the end of  
FunctionCallInfoData->args (only in master).  
  
AggStatePerTrans->numTransInputs actually has been wrong since since  
9.6, where partial aggregates were added. But it turns out to not be  
an active problem in 9.6 and 10, because numTransInputs wasn't used at  
all for combine functions: Before c253b722f6 there simply was no NULL  
check for the input to strict trans functions, and after that the  
check was simply hardcoded for the right offset in fcinfo, as it's  
done by code specific to combine functions.  
  
In bf6c614a2f2 (11) the strictness check was generalized, with common  
code doing the strictness checks for both plain and combine transition  
functions, based on numTransInputs. For combine functions this lead to  
not emitting an expression step to check for strict input in the 0  
arguments case, and in the > 1 arguments case, we'd check too many  
arguments.Due to the fact that the relevant fcinfo->isnull[2..] was  
always zero-initialized (more or less by accident, by being part of  
the AggStatePerTrans struct, which is palloc0'ed), there was no  
observable damage in the latter case before a9c35cf85ca1f, we just  
checked too many array elements.  
  
Due to the changes in a9c35cf85ca1f, > 1 argument bug became visible,  
because these days fcinfo is a) dynamically allocated without being  
zeroed b) exactly the length required for the number of specified  
arguments (hardcoded to 2 in this case).  
  
This commit only contains a fairly minimal fix, setting numTransInputs  
to a hardcoded 1 when building a pertrans for a combine function. It  
seems likely that we'll want to clean this up further (e.g. the  
arguments build_pertrans_for_aggref() aren't particularly meaningful  
for combine functions). But the wrap date for 12 beta1 is coming up  
fast, so it seems good to have a minimal fix in place.  
  
Backpatch to 11. While AggStatePerTrans->numTransInputs was set  
wrongly before that, the value was not used for combine functions.  
  
Reported-By: Rajkumar Raghuwanshi  
Diagnosed-By: Kyotaro Horiguchi, Jeevan Chalke, Andres Freund, David Rowley  
Author: David Rowley, Kyotaro Horiguchi, Andres Freund  
Discussion: https://postgr.es/m/CAKcux6=uZEyWyLw0N7HtR9OBc-sWEFeByEZC7t-KDf15FKxVew@mail.gmail.com  

M src/backend/executor/nodeAgg.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Fix some grammar in documentation of spgist and pgbench

commit   : 03310dbea9746439e9f0fdedce0fa298b8c4cc76    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 20 May 2019 09:47:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 20 May 2019 09:47:19 +0900    

Click here for diff

Discussion: https://postgr.es/m/92961161-9b49-e42f-0a72-d5d47e0ed4de@postgrespro.ru  
Author: Liudmila Mantrova  
Reviewed-by: Jonathan Katz, Tom Lane, Michael Paquier  
Backpatch-through: 9.4  

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

Fix and improve SnapshotType comments.

commit   : 78d6a9cbd3438969ac87b9f1aaf0f07226636ed7    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 16:17:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 16:17:18 -0700    

Click here for diff

The comment for SNAPSHOT_SELF was unfortunately explaining  
SNAPSHOT_DIRTY, as reported by Sergei. Also expand a few comments, and  
include a few more comments from heapam_visibility.c, so they're in an  
AM independent place.  
  
Reported-By: Sergei Kornilov  
Author: Andres Freund  
Discussion: https://postgr.es/m/9152241558192351@sas1-d856b3d759c7.qloud-c.yandex.net  

M src/include/utils/snapshot.h

Revert "In the pg_upgrade test suite, don't write to src/test/regress."

commit   : ae35e1c9d74afc3b1e7572ad60781946fdf71e95    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 19 May 2019 15:24:42 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 19 May 2019 15:24:42 -0700    

Click here for diff

This reverts commit bd1592e8570282b1650af6b8eede0016496daecd.  It had  
multiple defects.  
  
Discussion: https://postgr.es/m/12717.1558304356@sss.pgh.pa.us  

M src/bin/pg_upgrade/test.sh
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/tools/msvc/vcregress.pl

Don't to predicate lock for analyze scans, refactor scan option passing.

commit   : c3b23ae457ddc8b7bfacb3c0569278615a2df2cd    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 15:10:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 19 May 2019 15:10:28 -0700    

Click here for diff

Before this commit, when ANALYZE was run on a table and serializable  
was used (either by virtue of an explicit BEGIN TRANSACTION ISOLATION  
LEVEL SERIALIZABLE, or default_transaction_isolation being set to  
serializable) a null pointer dereference lead to a crash.  
  
The analyze scan doesn't need a snapshot (nor predicate locking), but  
before this commit a scan only contained information about being a  
bitmap or sample scan.  
  
Refactor the option passing to the scan_begin callback to use a  
bitmask instead. Alternatively we could have added a new boolean  
parameter, but that seems harder to read. Even before this issue  
various people (Heikki, Tom, Robert) suggested doing so.  
  
These changes don't change the scan APIs outside of tableam. The flags  
argument could be exposed, it's not necessary to fix this  
problem. Also the wrapper table_beginscan* functions encapsulate most  
of that complexity.  
  
After these changes fixing the bug is trivial, just don't acquire  
predicate lock for analyze style scans. That was already done for  
bitmap heap scans.  Add an assert that a snapshot is passed when  
acquiring the predicate lock, so this kind of bug doesn't require  
running with serializable.  
  
Also add a comment about sample scans currently requiring predicate  
locking the entire relation, that previously wasn't remarked upon.  
  
Reported-By: Joe Wildish  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/4EA80A20-E9BF-49F1-9F01-5B66CAB21453@elusive.cx  
    https://postgr.es/m/20190411164947.nkii4gaeilt4bui7@alap3.anarazel.de  
    https://postgr.es/m/20190518203102.g7peu2fianukjuxm@alap3.anarazel.de  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/access/tableam.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

In the pg_upgrade test suite, don't write to src/test/regress.

commit   : bd1592e8570282b1650af6b8eede0016496daecd    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 19 May 2019 14:36:44 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 19 May 2019 14:36:44 -0700    

Click here for diff

When this suite runs installcheck, redirect file creations from  
src/test/regress to src/bin/pg_upgrade/tmp_check/regress.  This closes a  
race condition in "make -j check-world".  If the pg_upgrade suite wrote  
to a given src/test/regress/results file in parallel with the regular  
src/test/regress invocation writing it, a test failed spuriously.  Even  
without parallelism, in "make -k check-world", the suite finishing  
second overwrote the other's regression.diffs.  This revealed test  
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.  
  
Buildfarm client REL_10, released forty-five days ago, supports saving  
regression.diffs from its new location.  When an older client reports a  
pg_upgradeCheck failure, it will no longer include regression.diffs.  
Back-patch to 9.5, where pg_upgrade moved to src/bin.  
  
Reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com  

M src/bin/pg_upgrade/test.sh
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/tools/msvc/vcregress.pl

Improve logrotate test so that it meaningfully exercises syslogger.

commit   : 9d5c22d28f8c161aa729d841aeec936c646044d4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 May 2019 13:55:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 May 2019 13:55:39 -0400    

Click here for diff

Discussion of bug #15804 reveals that this test didn't really prove  
that the syslogger child process ever launched successfully, much  
less did anything.  It was only checking that the expected log file  
gets created, and that's done in the postmaster.  Moreover, the  
test assumed it could rename the log file, which is likely to fail  
on Windows (cf. commit d611175e5).  
  
Instead, use the default log file name pattern, which should result  
in a new file name being chosen after 1 second, and verify that  
rotation has occurred by checking for a new file name.  Also add code  
to test that messages actually do propagate through the syslogger.  
  
In theory this version of the test should work on Windows, so  
revert d611175e5.  
  
Discussion: https://postgr.es/m/15804-3721117bf40fb654@postgresql.org  

M src/bin/pg_ctl/t/004_logrotate.pl

Revert "postmaster: Start syslogger earlier".

commit   : 833451552925d0175e1e15128e411ddef9a36996    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 May 2019 11:14:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 May 2019 11:14:23 -0400    

Click here for diff

This commit reverts 57431a911d3a650451d198846ad3194900666152.  
  
While that's still a good idea in the abstract, we found out  
that there are multiple crasher bugs in it on Windows builds,  
making the logging_collector option unusable on Windows.  
There's no time left to fix these issues before 12beta1,  
so revert the patch to allow Windows beta testing to proceed.  
We'll try again at some future date.  
  
Per bug #15804 from Yulian Khodorkovskiy and additional  
investigation by Michael Paquier.  
  
Discussion: https://postgr.es/m/15804-3721117bf40fb654@postgresql.org  

M src/backend/postmaster/postmaster.c

Fix declarations of couple jsonpath functions

commit   : da24961e9e1d887111d17cc2dcece2e3946ca5a6    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 19 May 2019 07:45:42 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 19 May 2019 07:45:42 +0300    

Click here for diff

Make jsonb_path_query_array() and jsonb_path_query_first() use  
PG_FUNCTION_ARGS macro instead of its expansion.  

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

Improve documentation for array subscription in jsonpath

commit   : 87bcc02f4f739d76703feee0ff8346b98fa9b907    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Fri, 17 May 2019 05:47:53 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Fri, 17 May 2019 05:47:53 +0300    

Click here for diff

Usage of expressions and multiple ranges in jsonpath array subscription was  
undocumented.  This commit adds lacking documentation.  

M doc/src/sgml/json.sgml

Document jsonpath .** accessor with nesting level filter

commit   : e0e3dad770d3eefc4ee6cd562d9c25b61c263a6e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Fri, 17 May 2019 05:16:31 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Fri, 17 May 2019 05:16:31 +0300    

Click here for diff

It appears that some variants of .** jsonpath accessor are undocumented.  In  
particular undocumented variants are:  
  
 .**{level}  
 .**{lower_level to upper_level}  
 .**{lower_level to last}  
  
This commit adds missing documentation for them.  

M doc/src/sgml/json.sgml

ANSI-ify a few straggler K&R-style function definitions.

commit   : da71f98efba9aed493a178aa29f25dbca7407eaf    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 May 2019 20:16:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 May 2019 20:16:50 -0400    

Click here for diff

We still had a couple of these left in ancient src/port/ files.  
Convert them to modern style in preparation for switching to  
a version of pg_bsd_indent that doesn't cope well with K&R style.  
  
Discussion: https://postgr.es/m/16886.1558104483@sss.pgh.pa.us  

M src/port/crypt.c
M src/port/isinf.c

Make BufFileCreateTemp() ensure that temp tablespaces are set up.

commit   : 93f03dad824f14f40519597e5e4a8fe7b6df858e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 May 2019 13:51:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 May 2019 13:51:16 -0400    

Click here for diff

If PrepareTempTablespaces() has never been called in the current  
transaction, OpenTemporaryFile() will fall back to using the default  
tablespace, which is a bug if the user wanted temp files placed elsewhere.  
gistInitBuildBuffers() appears to have this disease already, and it  
seems like an easy trap for future coders to fall into.  
  
We discussed other ways to close this gap, but none of them are prettier  
or more reliable than just having BufFileCreateTemp do it.  In particular,  
having fd.c do this creates layering issues that we could do without.  
  
Per suggestion from Melanie Plageman.  Arguably this is a bug fix, but  
nobody seems very excited about back-patching, so change in HEAD only.  
  
Discussion: https://postgr.es/m/CAAKRu_YwzjuGAmmaw4-8XO=OVFGR1QhY_Pq-t3wjb9ribBJb_Q@mail.gmail.com  

M src/backend/storage/file/buffile.c

docs: tighten up PG 12 release note item on 1k partitions

commit   : b12db9ff5f09dc60dc05d0e208a5b28728970e55    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 18 May 2019 09:23:29 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 18 May 2019 09:23:29 -0400    

Click here for diff

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

"A void function may not return a value".

commit   : d307954a7d88ed45655d9206bbe1aefc280c09c7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 May 2019 00:40:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 May 2019 00:40:39 -0400    

Click here for diff

Per buildfarm.  

M src/backend/access/table/tableam.c

tableam: Avoid relying on relation size to determine validity of tids.

commit   : 147e3722f7e531f15ba389a4d518efe8cd0bd736    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 17 May 2019 18:52:01 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 17 May 2019 18:52:01 -0700    

Click here for diff

Instead add a tableam callback to do so. To avoid adding per  
validation overhead, pass a scan to tuple_tid_valid. In heap's case  
we'd otherwise incurred a RelationGetNumberOfBlocks() call for each  
tid - which'd have added noticable overhead to nodeTidscan.c.  
  
Author: Andres Freund  
Reviewed-By: Ashwin Agrawal  
Discussion: https://postgr.es/m/20190515185447.gno2jtqxyktylyvs@alap3.anarazel.de  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/tid.c
M src/include/access/heapam.h
M src/include/access/tableam.h

tableam: Don't assume that every AM uses md.c style storage.

commit   : 7f44ede5941499c4cee13b812dd93335f4005095    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 17 May 2019 18:06:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 17 May 2019 18:06:18 -0700    

Click here for diff

Previously various parts of the code routed size requests through  
RelationGetNumberOfBlocks[InFork]. That works if md.c is used by the  
AM, but not otherwise.  
  
Add a tableam callback to return the size of the table. As not every  
AM will use postgres' BLCKSZ, have it return bytes, and have  
RelationGetNumberOfBlocksInFork() round the byte size up into blocks.  
  
To allow code outside of the AM to determine the actual relation size  
map InvalidForkNumber the total size of a relation, as not every AM  
might just need the postgres defined forks.  
  
A few users of RelationGetNumberOfBlocks() ought to be converted away  
from that. One case, the use of it to determine whether a tid is  
valid, will be fixed in a follow up commit. Others will have to wait  
for v13.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20190423225201.3bbv6tbqzkb5w7cw@alap3.anarazel.de  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/tableam.h

Restructure creation of run-time pruning steps.

commit   : 6630ccad7a25cad32e2d1a6833fb971602cb67fe    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 17 May 2019 19:44:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 17 May 2019 19:44:19 -0400    

Click here for diff

Previously, gen_partprune_steps() always built executor pruning steps  
using all suitable clauses, including those containing PARAM_EXEC  
Params.  This meant that the pruning steps were only completely safe  
for executor run-time (scan start) pruning.  To prune at executor  
startup, we had to ignore the steps involving exec Params.  But this  
doesn't really work in general, since there may be logic changes  
needed as well --- for example, pruning according to the last operator's  
btree strategy is the wrong thing if we're not applying that operator.  
The rules embodied in gen_partprune_steps() and its minions are  
sufficiently complicated that tracking their incremental effects in  
other logic seems quite impractical.  
  
Short of a complete redesign, the only safe fix seems to be to run  
gen_partprune_steps() twice, once to create executor startup pruning  
steps and then again for run-time pruning steps.  We can save a few  
cycles however by noting during the first scan whether we rejected  
any clauses because they involved exec Params --- if not, we don't  
need to do the second scan.  
  
In support of this, refactor the internal APIs in partprune.c to make  
more use of passing information in the GeneratePruningStepsContext  
struct, rather than as separate arguments.  
  
This is, I hope, the last piece of our response to a bug report from  
Alan Jackson.  Back-patch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.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
M src/include/partitioning/partprune.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

docs: split out sort-skip partition item in PG 12 release notes

commit   : 05685897f07e7ae5684f0247157faad1f782f889    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 17 May 2019 11:31:49 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 17 May 2019 11:31:49 -0400    

Click here for diff

Discussion: https://postgr.es/m/0cf10a27-c6a0-de4a-cd20-ab7493ea7422@lab.ntt.co.jp  

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

Fix regression test outputs

commit   : 6ba500cae6f57acf8f392d9e1671640f7c9d43b3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 May 2019 09:40:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 May 2019 09:40:02 +0900    

Click here for diff

75445c1 has caused various failures in tests across the tree after  
updating some error messages, so fix the newly-expected output.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/8332.1558048838@sss.pgh.pa.us  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/regex.out
M src/test/regress/expected/strings.out
M src/test/regress/expected/subscription.out
M src/test/regress/output/copy.source

Fix typos in documentatoin of GSSAPI encryption

commit   : 41998f90ce66425ca6071ac5e170a19bb1498414    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 May 2019 08:22:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 May 2019 08:22:28 +0900    

Click here for diff

Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/5520EDD8-7AC7-4307-8171-400DD1D84FDC@yesql.se  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/runtime.sgml

More message style fixes

commit   : 75445c1515fffa581585f1b72e5b5314c1c395ce    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 16 May 2019 18:50:56 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 16 May 2019 18:50:56 -0400    

Click here for diff

Discussion: https://postgr.es/m/20190515183005.GA26486@alvherre.pgsql  

M src/backend/commands/copy.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/analyze.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/regexp.c

Remove extra nbtree half-dead internal page check.

commit   : 3f58cc6dd8fc821992da7ed8099d283b014fc2dc    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 16 May 2019 15:11:58 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 16 May 2019 15:11:58 -0700    

Click here for diff

It's not safe for nbtree VACUUM to attempt to delete a target page whose  
right sibling is already half-dead, since that would fail the  
cross-check when VACUUM attempts to re-find a downlink to the right  
sibling in the parent page.  Logic to prevent this from happening was  
added by commit 8da31837803, which addressed a bug in the overhaul of  
page deletion that went into PostgreSQL 9.4 (commit efada2b8e92).  
VACUUM was made to check the right sibling page, and back off when it  
happened to be half-dead already.  
  
However, it is only truly necessary to do the right sibling check on the  
leaf level, since that transitively determines if the deletion target's  
parent's right sibling page is itself undergoing deletion.  Remove the  
internal page level check, and add a comment explaining why the leaf  
level check alone suffices.  
  
The extra check is also unnecessary due to the fact that internal pages  
that are marked half-dead are generally considered corrupt.  Commit  
efada2b8e92 established the principle that there should never be  
half-dead internal pages (internal pages pending deletion are possible,  
but that status is never directly represented in the internal page).  
VACUUM will complain about corruption when it encounters half-dead  
internal pages, so VACUUM is bound to raise an error one way or another  
when an nbtree index has a half-dead internal page (contrib/amcheck will  
also report that the page is corrupt).  
  
It's possible that a pg_upgrade'd 9.3 database will still have half-dead  
internal pages, so it may seem like there is an argument for leaving the  
check in place to reliably get a cleaner error message that advises the  
user to REINDEX.  However, leaf pages are also deleted in the first  
phase of deletion prior to PostgreSQL 9.4, so I believe we won't even  
attempt to re-find the parent page anyway (we won't have the fully  
deleted leaf page as the right sibling of our target page, so we won't  
even try to find a downlink for it).  
  
Discussion: https://postgr.es/m/CAH2-Wzm_ntmqJjWLRyKzimFmFvk+BnVAvUpaA4s1h9Ja58woaQ@mail.gmail.com  

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

Fix bogus logic for combining range-partitioned columns during pruning.

commit   : 3922f10646fc79264228ea3f6a7343cc3f8f528a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 May 2019 16:25:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 May 2019 16:25:43 -0400    

Click here for diff

gen_prune_steps_from_opexps's notion of how to do this was overly  
complicated and underly correct.  
  
Per discussion of a report from Alan Jackson (though this fixes only one  
aspect of that problem).  Back-patch to v11 where this code came in.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.com  

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

Fix partition pruning to treat stable comparison operators properly.

commit   : 4b1fcb43d070ba8b34ea01d5a657630d76e4b33f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 May 2019 11:58:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 May 2019 11:58:21 -0400    

Click here for diff

Cross-type comparison operators in a btree or hash opclass might be  
only stable not immutable (this is true of timestamp vs. timestamptz  
for example).  partprune.c ignored this possibility and would perform  
plan-time pruning with them anyway, possibly leading to wrong answers  
if the environment changed between planning and execution.  
  
To fix, teach gen_partprune_steps() to do things differently when  
creating plan-time pruning steps vs. run-time pruning steps.  
analyze_partkey_exprs() also needs an extra check, which is rather  
annoying but now is not the time to restructure things enough to  
avoid that.  
  
While at it, simplify the logic for the plan-time case a little  
by insisting that the comparison value be a Const and nothing else.  
This relies on the assumption that eval_const_expressions will have  
reduced any immutable expression to a Const; which is not quite  
100% true, but certainly any case that comes up often enough to be  
interesting should have simplification logic there.  
  
Also improve a bunch of inadequate/obsolete/wrong comments.  
  
Per discussion of a report from Alan Jackson (though this fixes only one  
aspect of that problem).  Back-patch to v11 where this code came in.  
  
David Rowley, with some further hacking by me  
  
Discussion: https://postgr.es/m/FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.com  

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

Remove obsolete nbtree insertion comment.

commit   : 489e431ba56b10f5736fb54a045ca40880f11bbc    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 15 May 2019 16:53:11 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 15 May 2019 16:53:11 -0700    

Click here for diff

Remove a Berkeley-era comment above _bt_insertonpg() that admonishes the  
reader to grok Lehman and Yao's paper before making any changes.  This  
made a certain amount of sense back when _bt_insertonpg() was  
responsible for most of the things that are now spread across  
_bt_insertonpg(), _bt_findinsertloc(), _bt_insert_parent(), and  
_bt_split(), but it doesn't work like that anymore.  
  
I believe that this comment alludes to the need to "couple" or "crab"  
buffer locks as we ascend the tree as page splits cascade upwards.  The  
nbtree README already explains this in detail, which seems sufficient.  
Besides, the changes to page splits made by commit 40dae7ec537 altered  
the exact details of how buffer locks are retained during splits; Lehman  
and Yao's original algorithm seems to release the lock on the left child  
page/buffer slightly earlier than _bt_insertonpg()/_bt_insert_parent()  
can.  

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

Remove no-longer-used typedef.

commit   : 8a0f0ad54047c8dc1430e521e2dc90f2cd138a9d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 15 May 2019 17:26:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 15 May 2019 17:26:52 -0400    

Click here for diff

struct ClonedConstraint is no longer needed, so delete it.  
  
Discussion: https://postgr.es/m/18102.1557947143@sss.pgh.pa.us  

M src/include/catalog/pg_constraint.h

Reverse order of newitem nbtree candidate splits.

commit   : 7505da2f459776a397177f7d591991f5591c2812    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 15 May 2019 12:22:07 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 15 May 2019 12:22:07 -0700    

Click here for diff

Commit fab25024, which taught nbtree to choose candidate split points  
more carefully, had _bt_findsplitloc() record all possible split points  
in an initial pass over a page that is about to be split.  The order  
that candidate split points were processed and stored in was assumed to  
match the offset number order of split points on an imaginary version of  
the page that contains the same items as the original, but also fits  
newitem (the item that provoked the split precisely because it didn't  
fit).  
  
However, the order of split points in the final array was not quite what  
was expected: the split point that makes newitem the firstright item  
came after the split point that makes newitem the lastleft item -- not  
before.  As a result, _bt_findsplitloc() could get confused about the  
leftmost and rightmost tuples among all possible split points recorded  
for the page.  This seems to have no appreciable impact on the quality  
of the final split point chosen by _bt_findsplitloc(), but it's still  
wrong.  
  
To fix, switch the order in which newitem candidate splits are recorded  
in.  This also makes it possible to describe candidate split points in  
terms of which pair of adjoining tuples enclose the split point within  
_bt_findsplitloc(), making it clearer why it's generally safe for  
_bt_split() to expect lastleft and firstright tuples.  

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

docs: properly indent PG 12 release notes

commit   : a429164ef31fc6899cef4d5e4f3f2ce8fc33aa27    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 May 2019 12:44:59 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 May 2019 12:44:59 -0400    

Click here for diff

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

Handle table_complete_speculative's succeeded argument as documented.

commit   : aa4b8c61d2cd57b53be03defb04d59b232a0e150    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 14 May 2019 12:11:26 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 14 May 2019 12:11:26 -0700    

Click here for diff

For some reason both callsite and the implementation for heapam had  
the meaning inverted (i.e. succeeded == true was passed in case of  
conflict). That's confusing.  
  
I (Andres) briefly pondered whether it'd be better to rename  
table_complete_speculative's argument to 'bool specConflict' or such,  
but decided not to. The 'complete' in the function name for me makes  
`succeeded` sound a bit better.  
  
Reported-By: Ashwin Agrawal, Melanie Plageman, Heikki Linnakangas  
Discussion:  
   https://postgr.es/m/CALfoeitk7-TACwYv3hCw45FNPjkA86RfXg4iQ5kAOPhR+F1Y4w@mail.gmail.com  
   https://postgr.es/m/97673451-339f-b21e-a781-998d06b1067c@iki.fi  

M src/backend/access/heap/heapam_handler.c
M src/backend/executor/nodeModifyTable.c

Add isolation test for INSERT ON CONFLICT speculative insertion failure.

commit   : 08e2edc0767ab6e619970f165cb34d4673105f23    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 14 May 2019 11:45:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 14 May 2019 11:45:40 -0700    

Click here for diff

This path previously was not reliably covered. There was some  
heuristic coverage via insert-conflict-toast.spec, but that test is  
not deterministic, and only tested for a somewhat specific bug.  
  
Backpatch, as this is a complicated and otherwise untested code  
path. Unfortunately 9.5 cannot handle two waiting sessions, and thus  
cannot execute this test.  
  
Triggered by a conversion with Melanie Plageman.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAAKRu_a7hbyrk=wveHYhr4LbcRnRCG=yPUVoQYB9YO1CdUBE9Q@mail.gmail.com  
Backpatch: 9.5-  

A src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-specconflict.spec

Fix "make clean" to clean out junk files left behind after ssl tests.

commit   : 6d2fba3189608186d1a196a595f21760412ec5e8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 14:28:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 14:28:33 -0400    

Click here for diff

We .gitignore'd this junk, but we didn't actually remove it.  

M src/test/ssl/Makefile

Move logging.h and logging.c from src/fe_utils/ to src/common/.

commit   : fc9a62af3f87f4bec1e8c904ea99ae50f3c881ef    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 14:19:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 14:19:49 -0400    

Click here for diff

The original placement of this module in src/fe_utils/ is ill-considered,  
because several src/common/ modules have dependencies on it, meaning that  
libpgcommon and libpgfeutils now have mutual dependencies.  That makes it  
pointless to have distinct libraries at all.  The intended design is that  
libpgcommon is lower-level than libpgfeutils, so only dependencies from  
the latter to the former are acceptable.  
  
We already have the precedent that fe_memutils and a couple of other  
modules in src/common/ are frontend-only, so it's not stretching anything  
out of whack to treat logging.c as a frontend-only module in src/common/.  
To the extent that such modules help provide a common frontend/backend  
environment for the rest of common/ to use, it's a reasonable design.  
(logging.c does not yet provide an ereport() emulation, but one can  
dream.)  
  
Hence, move these files over, and revert basically all of the build-system  
changes made by commit cc8d41511.  There are no places that need to grow  
new dependencies on libpgcommon, further reinforcing the idea that this  
is the right solution.  
  
Discussion: https://postgr.es/m/a912ffff-f6e4-778a-c86a-cf5c47a12933@2ndquadrant.com  

M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/Makefile
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.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/datapagemap.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_test_fsync/Makefile
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/large_obj.c
M src/bin/psql/mainloop.c
M src/bin/psql/psqlscanslash.l
M src/bin/psql/startup.c
M src/bin/psql/variables.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/Makefile
M src/common/controldata_utils.c
M src/common/file_utils.c
R092 src/fe_utils/logging.c src/common/logging.c
M src/common/pgfnames.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/fe_utils/Makefile
M src/fe_utils/psqlscan.l
R092 src/include/fe_utils/logging.h src/include/common/logging.h
M src/interfaces/ecpg/test/Makefile
M src/nls-global.mk
M src/test/isolation/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/tools/msvc/Mkvcbuild.pm

docs: Indent listitem tags in PG 12 release notes

commit   : b71dad22ce8a645a47c01e544f640f35b91bfbd3    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 May 2019 13:32:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 May 2019 13:32:03 -0400    

Click here for diff

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

Remove pg_rewind's private logging.h/logging.c files.

commit   : 53ddefbaf8a0493d2c1fa0b18bfaba72da556985    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 13:11:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 13:11:23 -0400    

Click here for diff

The existence of these files became rather confusing with the  
introduction of a widely-known logging.h header in commit cc8d41511.  
(Indeed, there's already some duplicative #includes here, perhaps  
betraying such confusion.)  The only thing left in them, after that  
commit, is a progress-reporting function that's neither general-purpose  
nor tied in any way to other logging infrastructure.  Hence, let's just  
move that function to pg_rewind.c, and get rid of the separate files.  
  
Discussion: https://postgr.es/m/3971.1557787914@sss.pgh.pa.us  

M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
D src/bin/pg_rewind/logging.c
D src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/nls.mk
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

Fix SQL-style substring() to have spec-compliant greediness behavior.

commit   : 7c850320d8cfa5503ecec61c2559661b924f7595    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 11:27:31 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 11:27:31 -0400    

Click here for diff

SQL's regular-expression substring() function is defined to have a  
pattern argument that's separated into three subpatterns by escape-  
double-quote markers; the function result is the part of the input  
matching the second subpattern.  The standard makes it clear that  
if there is ambiguity about how to match the input to the subpatterns,  
the first and third subpatterns should be taken to match the smallest  
possible amount of text (i.e., they're "non greedy", in the terms of  
our regex code).  We were not doing it that way: the first subpattern  
would eat the largest possible amount of text, causing the function  
result to be shorter than what the spec requires.  
  
Fix that by attaching explicit greediness quantifiers to the  
subpatterns.  (This depends on the regex fix in commit 8a29ed053;  
before that, this didn't reliably change the regex engine's behavior.)  
  
Also, by adding parentheses around each subpattern, we ensure that  
"|" (OR) in the subpatterns behave sanely.  Previously, "|" in the  
first or third subpatterns didn't work.  
  
This patch also makes the function throw error if you write more than  
two escape-double-quote markers, and do something sane if you write  
just one, and document that behavior.  Previously, an odd number of  
markers led to a confusing complaint about unbalanced parentheses,  
while extra pairs of markers were just ignored.  (Note that the spec  
requires exactly two markers, but we've historically allowed there  
to be none, and this patch preserves the old behavior for that case.)  
  
In passing, adjust some substring() test cases that didn't really  
prove what they said they were testing for: they used patterns  
that didn't match the data string, so that the output would be  
NULL whether or not the function was really strict.  
  
Although this is certainly a bug fix, changing the behavior in back  
branches seems undesirable: applications could perhaps be depending on  
the old behavior, since it's not obviously wrong unless you read the  
spec very closely.  Hence, no back-patch.  
  
Discussion: https://postgr.es/m/5bb27a41-350d-37bf-901e-9d26f5592dd0@charter.net  

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

In bootstrap mode, use default signal handling for SIGINT etc.

commit   : fb489e4b3195fc33cccc0fd308e5a0ab502cf199    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 10:22:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 14 May 2019 10:22:28 -0400    

Click here for diff

Previously, the code pointed the standard process-termination signals  
to postgres.c's die().  That would typically result in an attempt to  
execute a transaction abort, which is not possible in bootstrap mode,  
leading to PANIC.  This choice seems to be a leftover from an old code  
structure in which the same signal-assignment code was used for many  
sorts of auxiliary processes, including interactive standalone  
backends.  It's not very sensible for bootstrap mode, which has no  
interest in either interactivity or continuing after an error.  We can  
get better behavior with less effort by just letting normal process  
termination happen, after which the parent initdb process will clean up.  
  
This is basically cosmetic in any case, since initdb will react the  
same way whether bootstrap dies on a signal or abort().  Given the  
lack of previous complaints, I don't feel a need to back-patch,  
even though the behavior is old.  
  
Discussion: https://postgr.es/m/3850b11a.5121.16aaf827e4a.Coremail.thunder1@126.com  

M src/backend/bootstrap/bootstrap.c

Update SQL features/conformance information to SQL:2016

commit   : 037165ca95d854e04c0c28cfa85f1515bd852892    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 May 2019 14:56:58 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 May 2019 14:56:58 +0200    

Click here for diff

M doc/src/sgml/features.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h

Update information_schema for SQL:2016

commit   : eb3a1376c98a1d220354b468f4b09e4a1dca909a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 May 2019 15:15:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 May 2019 15:15:05 +0200    

Click here for diff

This is mainly a light renumbering to match the sections in the  
standard.  

M src/backend/catalog/information_schema.sql

Update SQL keywords list to SQL:2016

commit   : c29ba98189190288c2251c6073c13c6234479e5c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 May 2019 09:56:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 May 2019 09:56:40 +0200    

Click here for diff

Per previous convention (see  
ace397e9d24eddc56e7dffa921f506117b602d78), drop SQL:2008 and only keep  
the latest two standards and SQL-92.  
  
Note: SQL:2016-2 lists a large number of non-reserved keywords that  
are really just information_schema column names related to new  
features.  Those kinds of thing have not previously been listed as  
keywords, and this was apparently done here by mistake, since these  
keywords have been removed again in post-2016 working drafts.  So in  
order to avoid bloating the keywords table unnecessarily, I have  
omitted these erroneous keywords here.  

M doc/src/sgml/generate-keywords-table.pl
R090 doc/src/sgml/keywords/sql2008-02-nonreserved.txt doc/src/sgml/keywords/sql2016-02-nonreserved.txt
R082 doc/src/sgml/keywords/sql2008-02-reserved.txt doc/src/sgml/keywords/sql2016-02-reserved.txt
R100 doc/src/sgml/keywords/sql2008-09-nonreserved.txt doc/src/sgml/keywords/sql2016-09-nonreserved.txt
R100 doc/src/sgml/keywords/sql2008-09-reserved.txt doc/src/sgml/keywords/sql2016-09-reserved.txt
R093 doc/src/sgml/keywords/sql2008-14-nonreserved.txt doc/src/sgml/keywords/sql2016-14-nonreserved.txt
R100 doc/src/sgml/keywords/sql2008-14-reserved.txt doc/src/sgml/keywords/sql2016-14-reserved.txt

docs: update partition item in PG 12 release notes

commit   : 356c83795aaa39cfd9bca588bfe4f0196710962e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 May 2019 09:17:08 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 May 2019 09:17:08 -0400    

Click here for diff

Reported-by: Amit Langote  
  
Discussion: https://postgr.es/m/b7954643-41ef-a174-479d-1f8d4834f40a@lab.ntt.co.jp  

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

docs: fix duplicate wording in PG 12 release notes

commit   : 34d40becfa7a5c7343d0079f181597d7e06122e1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 May 2019 09:06:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 May 2019 09:06:03 -0400    

Click here for diff

Reported-by: nickb@imap.cc  
  
Discussion: https://postgr.es/m/6b3414e1-fcef-4ad9-b123-b3ab3702d3db@www.fastmail.com  

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

Detect internal GiST page splits correctly during index build.

commit   : 22251686f07f70527aecda22ab5402986884f6f5    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 14 May 2019 13:18:44 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 14 May 2019 13:18:44 +0300    

Click here for diff

As we descend the GiST tree during insertion, we modify any downlinks on  
the way down to include the new tuple we're about to insert (if they don't  
cover it already). Modifying an existing downlink might cause an internal  
page to split, if the new downlink tuple is larger than the old one. If  
that happens, we need to back up to the parent and re-choose a page to  
insert to. We used to detect that situation, thanks to the NSN-LSN  
interlock normally used to detect concurrent page splits, but that got  
broken by commit 9155580fd5. With that commit, we now use a dummy constant  
LSN value for every page during index build, so the LSN-NSN interlock no  
longer works. I thought that was OK because there can't be any other  
backends modifying the index during index build, but missed that the  
insertion itself can modify the page we're inserting to. The consequence  
was that we would sometimes insert the new tuple to an incorrect page, one  
whose downlink doesn't cover the new tuple.  
  
To fix, add a flag to the stack that keeps track of the state while  
descending tree, to indicate that a page was split, and that we need to  
retry the descend from the parent.  
  
Thomas Munro first reported that the contrib/intarray regression test was  
failing occasionally on the buildfarm after commit 9155580fd5. The failure  
was intermittent, because the gistchoose() function is not deterministic,  
and would only occasionally create the right circumstances for this bug to  
cause the failure.  
  
Patch by Anastasia Lubennikova, with some changes by me to make it work  
correctly also when the internal page split also causes the "grandparent"  
to be split.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJRzLo7tZExWfSbwM3XuK7aAK7FhdBV0FLkbUG%2BW0v0zg%40mail.gmail.com  

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

Fix comment on when HOT update is possible.

commit   : e95d550bbbe21f51d329fbae84cbac3545a9e650    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 14 May 2019 13:06:28 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 14 May 2019 13:06:28 +0300    

Click here for diff

The conditions listed in this comment have changed several times, and at  
some point the thing that the "if so" referred to was negated.  
  
The text was OK up to 9.6. It was differently wrong in v10, v11 and  
master, so fix in all those versions.  

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

Fix typo.

commit   : 7d9eca59cf958eb8c8ff47c40003392681a9ce68    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 14 May 2019 16:05:37 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 14 May 2019 16:05:37 +0900    

Click here for diff

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

doc: Update OID item in PG 12 release notes

commit   : 0b62f0f2552d895301fdae56aa839c1eaae24a3a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 13 May 2019 22:55:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 13 May 2019 22:55:38 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20190513174759.GE23251@telsasoft.com  

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

doc: improve wording of PG 12 releaase note partition item

commit   : f4125278e3c92d8cdd83c77d0b54f468ee81c750    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 13 May 2019 22:38:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 13 May 2019 22:38:50 -0400    

Click here for diff

Reported-by: Amit Langote  
  
Discussion: https://postgr.es/m/d5267ae5-bd4a-3e96-c21b-56bfa9fec7e8@lab.ntt.co.jp  

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

doc: properly attibute PG 12 pgbench release note item

commit   : 5d971565a7993ba8dcd06d34d1387af48fdbd034    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 13 May 2019 22:21:32 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 13 May 2019 22:21:32 -0400    

Click here for diff

Reported-by: Fabien COELHO  
  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1905130839140.13487@lancre  

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

Fix duplicated words in comments

commit   : 7e19929ea29668f3d01280262e407b93042c959a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 14 May 2019 09:37:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 14 May 2019 09:37:35 +0900    

Click here for diff

Author: Stephen Amell  
Discussion: https://postgr.es/m/539fa271-21b3-777e-a468-d96cffe9c768@gmail.com  

M src/backend/executor/execExpr.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/c.h
M src/include/jit/llvmjit_emit.h
M src/include/nodes/execnodes.h
M src/include/replication/logical.h

Standardize ItemIdData terminology.

commit   : ae7291acbc5ae4c3751615177fc256f9f3399403    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 May 2019 15:53:39 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 May 2019 15:53:39 -0700    

Click here for diff

The term "item pointer" should not be used to refer to ItemIdData  
variables, since that is needlessly ambiguous.  Only  
ItemPointerData/ItemPointer variables should be called item pointers.  
  
To fix, establish the convention that ItemIdData variables should always  
be referred to either as "item identifiers" or "line pointers".  The  
term "item identifier" already predominates in docs and translatable  
messages, and so should be the preferred alternative there.  
  
Discussion: https://postgr.es/m/CAH2-Wz=c=MZQjUzde3o9+2PLAPuHTpVZPPdYxN=E4ndQ2--8ew@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/heap/README.HOT
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/storage/page/bufpage.c
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/storage/bufpage.h
M src/include/storage/itemid.h

Doc: Refer to line pointers as item identifiers.

commit   : 08ca9d7feca890e97f77ef1fde02d7542a54ac5e    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 May 2019 15:39:06 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 May 2019 15:39:06 -0700    

Click here for diff

An upcoming HEAD-only patch will standardize the terminology around  
ItemIdData variables/line pointers, ending the practice of referring to  
them as "item pointers".  Make the "Database Page Layout" docs  
consistent with the new policy.  The term "item identifier" is already  
used in the same section, so stick with that.  
  
Discussion: https://postgr.es/m/CAH2-Wz=c=MZQjUzde3o9+2PLAPuHTpVZPPdYxN=E4ndQ2--8ew@mail.gmail.com  
Backpatch: All supported branches.  

M doc/src/sgml/storage.sgml

Fix logical replication's ideas about which type OIDs are built-in.

commit   : 32ebb35128c3d16b64039f6d6774afd96a3d91b9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 May 2019 17:23:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 May 2019 17:23:00 -0400    

Click here for diff

Only hand-assigned type OIDs should be presumed to match across different  
PG servers; those assigned during genbki.pl or during initdb are likely  
to change due to addition or removal of unrelated objects.  
  
This means that the cutoff should be FirstGenbkiObjectId (in HEAD)  
or FirstBootstrapObjectId (before that), not FirstNormalObjectId.  
Compare postgres_fdw's is_builtin() test.  
  
It's likely that this error has no observable consequence in a  
normally-functioning system, since ATM the only affected type OIDs are  
system catalog rowtypes and information_schema types, which would not  
typically be interesting for logical replication.  But you could  
probably break it if you tried hard, so back-patch.  
  
Discussion: https://postgr.es/m/15150.1557257111@sss.pgh.pa.us  

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

Improve commentary about hack in is_publishable_class().

commit   : e34ee993fbc38c8538f9342c5961e5f61fd45180    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 May 2019 17:05:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 May 2019 17:05:48 -0400    

Click here for diff

The FirstNormalObjectId test here is a kluge that needs to go away,  
but the only substitute we can think of is to add a column to pg_class,  
which will take more work than can be handled right now.  Add some  
commentary in the meanwhile.  
  
Discussion: https://postgr.es/m/15150.1557257111@sss.pgh.pa.us  

M src/backend/catalog/pg_publication.c

Don't leave behind junk nbtree pages during split.

commit   : 9b42e713761a43e9ade3965285f077e2ba25bbb7    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 May 2019 10:27:59 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 May 2019 10:27:59 -0700    

Click here for diff

Commit 8fa30f906be reduced the elevel of a number of "can't happen"  
_bt_split() errors from PANIC to ERROR.  At the same time, the new right  
page buffer for the split could continue to be acquired well before the  
critical section.  This was possible because it was relatively  
straightforward to make sure that _bt_split() could not throw an error,  
with a few specific exceptions.  The exceptional cases were safe because  
they involved specific, well understood errors, making it possible to  
consistently zero the right page before actually raising an error using  
elog().  There was no danger of leaving around a junk page, provided  
_bt_split() stuck to this coding rule.  
  
Commit 8224de4f, which introduced INCLUDE indexes, added code to make  
_bt_split() truncate away non-key attributes.  This happened at a point  
that broke the rule around zeroing the right page in _bt_split().  If  
truncation failed (perhaps due to palloc() failure), that would result  
in an errant right page buffer with junk contents.  This could confuse  
VACUUM when it attempted to delete the page, and should be avoided on  
general principle.  
  
To fix, reorganize _bt_split() so that truncation occurs before the new  
right page buffer is even acquired.  A junk page/buffer will not be left  
behind if _bt_nonkey_truncate()/_bt_truncate() raise an error.  
  
Discussion: https://postgr.es/m/CAH2-WzkcWT_-NH7EeL=Az4efg0KCV+wArygW8zKB=+HoP=VWMw@mail.gmail.com  
Backpatch: 11-, where INCLUDE indexes were introduced.  

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

Improve comment for att_isnull.

commit   : 221b377f09a30dd7c74c26c8c1db439afcc59141    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 May 2019 13:13:24 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 May 2019 13:13:24 -0400    

Click here for diff

The comment implies that a 1 in the null bitmap indicates a null value,  
but actually a 0 in the null bitmap indicates a null value. Try to  
be more clear.  
  
Patch by me; proposed wording reviewed by Alvaro Herrera and Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmobHOP8r6cG+UnsDFMrS30-m=jRrCBhgw-nFkn0k9QnFsg@mail.gmail.com  

M src/include/access/tupmacs.h

Fix misuse of an integer as a bool.

commit   : ddf927fb13471bec0cc76794eaf552df8a1178fb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 May 2019 10:53:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 May 2019 10:53:19 -0400    

Click here for diff

pgtls_read_pending is declared to return bool, but what the underlying  
SSL_pending function returns is a count of available bytes.  
  
This is actually somewhat harmless if we're using C99 bools, but in  
the back branches it's a live bug: if the available-bytes count happened  
to be a multiple of 256, it would get converted to a zero char value.  
On machines where char is signed, counts of 128 and up could misbehave  
as well.  The net effect is that when using SSL, libpq might block  
waiting for data even though some has already been received.  
  
Broken by careless refactoring in commit 4e86f1b16, so back-patch  
to 9.5 where that came in.  
  
Per bug #15802 from David Binderman.  
  
Discussion: https://postgr.es/m/15802-f0911a97f0346526@postgresql.org  

M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure-openssl.c

postgres_fdw: Fix typo in comment.

commit   : cc866941ad4583f07e5637c145f6f6ee8a573e11    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 13 May 2019 17:30:35 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 13 May 2019 17:30:35 +0900    

Click here for diff

M contrib/postgres_fdw/postgres_fdw.c

doc: PG 12 release notes: normalize attribution names

commit   : f86b0c3c465319b80d71db7d7a9de636950e104a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 12 May 2019 23:54:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 12 May 2019 23:54:02 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f-ktEhmQ2zJQ1L1niuJ9KB8WPA-bE-AhGiFsSO6QASB_w@mail.gmail.com  

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

doc: adjust PG 12 release note sections

commit   : a6927996be59ac329d65d41cf058d0b1b0978eeb    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 12 May 2019 23:41:53 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 12 May 2019 23:41:53 -0400    

Click here for diff

Tighten section designations.  

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

docs: fix typo in mention of MSVC

commit   : fefb6a75386b72a40f697523953eafc7cb1c7a5b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 12 May 2019 23:24:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 12 May 2019 23:24:43 -0400    

Click here for diff

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

Fix incorrect return value in JSON equality function for scalars

commit   : 1171dbde2daef8f0dcd1dc1e54531a0d8dd34d88    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 13 May 2019 09:11:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 13 May 2019 09:11:50 +0900    

Click here for diff

equalsJsonbScalarValue() uses a boolean as return type, however for one  
code path -1 gets returned, which is confusing.  The origin of the  
confusion is visibly that this code got copy-pasted from  
compareJsonbScalarValue() since it has been introduced in d1d50bf.  
  
No backpatch, as this is only cosmetic.  
  
Author: Rikard Falkeborn  
Discussion: https://postgr.es/m/CADRDgG7mJnek6HNW13f+LF6V=6gag9PM+P7H5dnyWZAv49aBGg@mail.gmail.com  

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

Fix misoptimization of "{1,1}" quantifiers in regular expressions.

commit   : 8a29ed05302ea18b4be177c2d1181b43706af45f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 12 May 2019 18:53:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 12 May 2019 18:53:12 -0400    

Click here for diff

A bounded quantifier with m = n = 1 might be thought a no-op.  But  
according to our documentation (which traces back to Henry Spencer's  
original man page) it still imposes greediness, or non-greediness in the  
case of the non-greedy variant "{1,1}?", on whatever it's attached to.  
  
This turns out not to work though, because parseqatom() optimizes away  
the m = n = 1 case without regard for whether it's supposed to change  
the greediness of the argument RE.  
  
We can fix this by just not applying the optimization when the greediness  
needs to change; the subsequent general cases handle it fine.  
  
The three cases in which we can still apply the optimization are  
(a) no quantifier, or quantifier does not impose a preference;  
(b) atom has no greediness property, implying it cannot match a  
variable amount of text anyway; or  
(c) quantifier's greediness is same as atom's.  
Note that in most cases where one of these applies, we'd have exited  
earlier in the "not a messy case" fast path.  I think it's now only  
possible to get to the optimization when the atom involves capturing  
parentheses or a non-top-level backref.  
  
Back-patch to all supported branches.  I'd ordinarily be hesitant to  
put a subtle behavioral change into back branches, but in this case  
it's very hard to see a reason why somebody would write "{1,1}?" unless  
they're trying to get the documented change-of-greediness behavior.  
  
Discussion: https://postgr.es/m/5bb27a41-350d-37bf-901e-9d26f5592dd0@charter.net  

M src/backend/regex/regcomp.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Fail pgwin32_message_to_UTF16() for SQL_ASCII messages.

commit   : d02768ddd1791bab742cf131de726d0a36b3f337    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 12 May 2019 10:33:05 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 12 May 2019 10:33:05 -0700    

Click here for diff

The function had been interpreting SQL_ASCII messages as UTF8, throwing  
an error when they were invalid UTF8.  The new behavior is consistent  
with pg_do_encoding_conversion().  This affects LOG_DESTINATION_STDERR  
and LOG_DESTINATION_EVENTLOG, which will send untranslated bytes to  
write() and ReportEventA().  On buildfarm member bowerbird, enabling  
log_connections caused an error whenever the role name was not valid  
UTF8.  Back-patch to 9.4 (all supported versions).  
  
Discussion: https://postgr.es/m/20190512015615.GD1124997@rfd.leadboat.com  

M src/backend/utils/mb/mbutils.c
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/scripts/t/200_connstr.pl

Rearrange pgstat_bestart() to avoid failures within its critical section.

commit   : 85ccb6899c6c8639bb3e5962ea3bcce5d886e613    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 11 May 2019 21:27:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 11 May 2019 21:27:13 -0400    

Click here for diff

We long ago decided to design the shared PgBackendStatus data structure to  
minimize the cost of writing status updates, which means that writers just  
have to increment the st_changecount field twice.  That isn't hooked into  
any sort of resource management mechanism, which means that if something  
were to throw error between the two increments, the st_changecount field  
would be left odd indefinitely.  That would cause readers to lock up.  
Now, since it's also a bad idea to leave the field odd for longer than  
absolutely necessary (because readers will spin while we have it set),  
the expectation was that we'd treat these segments like spinlock critical  
sections, with only short, more or less straight-line, code in them.  
  
That was fine as originally designed, but commit 9029f4b37 broke it  
by inserting a significant amount of non-straight-line code into  
pgstat_bestart(), code that is very capable of throwing errors, not to  
mention taking a significant amount of time during which readers will spin.  
We have a report from Neeraj Kumar of readers actually locking up, which  
I suspect was due to an encoding conversion error in X509_NAME_to_cstring,  
though conceivably it was just a garden-variety OOM failure.  
  
Subsequent commits have loaded even more dubious code into pgstat_bestart's  
critical section (and commit fc70a4b0d deserves some kind of booby prize  
for managing to miss the critical section entirely, although the negative  
consequences seem minimal given that the PgBackendStatus entry should be  
seen by readers as inactive at that point).  
  
The right way to fix this mess seems to be to compute all these values  
into a local copy of the process' PgBackendStatus struct, and then just  
copy the data back within the critical section proper.  This plan can't  
be implemented completely cleanly because of the struct's heavy reliance  
on out-of-line strings, which we must initialize separately within the  
critical section.  But still, the critical section is far smaller and  
safer than it was before.  
  
In hopes of forestalling future errors of the same ilk, rename the  
macros for st_changecount management to make it more apparent that  
the writer-side macros create a critical section.  And to prevent  
the worst consequences if we nonetheless manage to mess it up anyway,  
adjust those macros so that they really are a critical section, ie  
they now bump CritSectionCount.  That doesn't add much overhead, and  
it guarantees that if we do somehow throw an error while the counter  
is odd, it will lead to PANIC and a database restart to reset shared  
memory.  
  
Back-patch to 9.5 where the problem was introduced.  
  
In HEAD, also fix an oversight in commit b0b39f72b: it failed to teach  
pgstat_read_current_status to copy st_gssstatus data from shared memory to  
local memory.  Hence, subsequent use of that data within the transaction  
would potentially see changing data that it shouldn't see.  
  
Discussion: https://postgr.es/m/CAPR3Wj5Z17=+eeyrn_ZDG3NQGYgMEOY6JV6Y-WRRhGgwc16U3Q@mail.gmail.com  

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

docs: remove second mention of btree max length reduction

commit   : 4217d15d91128355ea13e6fb9c031b826e2a1335    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 18:24:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 18:24:31 -0400    

Click here for diff

I already added that to the incompatibility section as a separate item.  
  
Reported-by: Peter Geoghegan  

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

doc: remove pg_config mention from PG 12 release notes

commit   : 31f11f964734dbe2af2915182bf79f69e337d4d7    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 17:59:58 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 17:59:58 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/28209.1556556696@sss.pgh.pa.us  

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

docs: PG 12 release notes, mention that REINDEX could now fail

commit   : d56fd6357a5e0e76fecf20c3dc762c5301290331    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 16:42:05 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 16:42:05 -0400    

Click here for diff

This is because of the new tid in the index entry.  
  
Reported-by: Peter Geoghegan  

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

commit   : 1708974485e82e1cf4694c683faa70fc5bcf142c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 16:17:18 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 16:17:18 -0400    

Click here for diff

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

docs: adjust PG 12 floating point item

commit   : 0edc8fc47bc4482ceac85b09575d6372dbbc0bbf    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 10:29:30 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 11 May 2019 10:29:30 -0400    

Click here for diff

Reported-by: Andrew Gierth  
  
Discussion: https://postgr.es/m/87r295hjur.fsf@news-spur.riddles.org.uk  

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

Honor TEMP_CONFIG in TAP suites.

commit   : 54c2ecb56707ed00844b8678a79570dd34cb95a3    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 11 May 2019 00:22:38 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 11 May 2019 00:22:38 -0700    

Click here for diff

The buildfarm client uses TEMP_CONFIG to implement its extra_config  
setting.  Except for stats_temp_directory, extra_config now applies to  
TAP suites; extra_config values seen in the past month are compatible  
with this.  Back-patch to 9.6, where PostgresNode was introduced, so the  
buildfarm can rely on it sooner.  
  
Reviewed by Andrew Dunstan and Tom Lane.  
  
Discussion: https://postgr.es/m/20181229021950.GA3302966@rfd.leadboat.com  

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

Fix error reporting in reindexdb

commit   : e51bad8fb4c3f0ad5cb173034afdc0b349c7e488    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 11 May 2019 13:00:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 11 May 2019 13:00:54 +0900    

Click here for diff

When failing to reindex a table or an index, reindexdb would generate an  
extra error message related to a database failure, which is misleading.  
  
Backpatch all the way down, as this has been introduced by 85e9a5a0.  
  
Discussion: https://postgr.es/m/CAOBaU_Yo61RwNO3cW6WVYWwH7EYMPuexhKqufb2nFGOdunbcHw@mail.gmail.com  
Author: Julien Rouhaud  
Reviewed-by: Daniel Gustafsson, Álvaro Herrera, Tom Lane, Michael  
Paquier  
Backpatch-through: 9.4  

M src/bin/scripts/reindexdb.c

Fix editing error in floating-point docs.

commit   : b721e201a0bcf0f9e1795c295e134e47d698e80c    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sat, 11 May 2019 03:23:55 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sat, 11 May 2019 03:23:55 +0100    

Click here for diff

My fault; the error was introduced in the Ryu patch.  

M doc/src/sgml/datatype.sgml

doc: add Heikki to PG 12 release note btree item

commit   : 064df0edfee91d3843d54d1f67c05a4634690a12    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 22:11:13 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 22:11:13 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-WzkrX-aA7d3OYtQT+8Mspq+tU5vwuVz=FTzMH3CdrSyprA@mail.gmail.com  

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

doc: improve PG 12 item on partitioned tables

commit   : 13d258ec0e55ebc4378e848934f0f4c0ffac0a6f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:22:53 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:22:53 -0400    

Click here for diff

Reported-by: Amit Langote  
  
Discussion: https://postgr.es/m/5936b052-5d92-a2c9-75d2-0245fb2330b5@lab.ntt.co.jp  

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

doc: reorder attribution of PG 12 btree item

commit   : 05f9eba3498f4dbc8687f66eff53a2bfb88f2595    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:16:33 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:16:33 -0400    

Click here for diff

Reported-by: Alexander Korotkov  
  
Discussion: https://postgr.es/m/CAPpHfdvkM-PkyrK6LQitJUDmC_1kOCEtTuseoVhCT=ew0XJmGg@mail.gmail.com  

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

docs: properly attribute PG 12 rel item to James Coleman

commit   : 8aa1b0885e3d248dbf3e0b0c544125d13dbc36d0    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:06:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:06:38 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f-NDmeA_tb0oRFhrgf19xq3A9MeoyMcckY04Ct=_i0c2A@mail.gmail.com  

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

docs: PG 12 docs, clarify btree index changes

commit   : 809e248299894b02e8f4eb3ee17829b2ae14ce9d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:03:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 21:03:31 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-WzkSYOM1GJVGtAbRW-OqymoCD=QWYG6ro+GaoOW-jPRuDQ@mail.gmail.com  

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

doc: PG 12 release note adjustment

commit   : b299efaea433a7d2c04ce124e4f6588807bbe87a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 20:25:52 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 10 May 2019 20:25:52 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20190510013449.GL3925@telsasoft.com  

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

Remove reindex_catalog test from test schedules.

commit   : 5997a8f4d7478ae6bac4dab12ca1f883e41a7aa1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 May 2019 23:31:58 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 May 2019 23:31:58 -0700    

Click here for diff

As none of the approaches for avoiding the deadlock issues seem  
promising enough, and all the expected reindex related changes have  
been made, apply 60c2951e1bab7e to master as well.  
  
Discussion: https://postgr.es/m/4622.1556982247@sss.pgh.pa.us  

M src/test/regress/expected/reindex_catalog.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/reindex_catalog.sql

Cope with EINVAL and EIDRM shmat() failures in PGSharedMemoryAttach.

commit   : 610747d86e46ae6e94b7288393d08823cc39b498    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 10 May 2019 14:56:41 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 10 May 2019 14:56:41 -0400    

Click here for diff

There's a very old race condition in our code to see whether a pre-existing  
shared memory segment is still in use by a conflicting postmaster: it's  
possible for the other postmaster to remove the segment in between our  
shmctl() and shmat() calls.  It's a narrow window, and there's no risk  
unless both postmasters are using the same port number, but that's possible  
during parallelized "make check" tests.  (Note that while the TAP tests  
take some pains to choose a randomized port number, pg_regress doesn't.)  
If it does happen, we treated that as an unexpected case and errored out.  
  
To fix, allow EINVAL to be treated as segment-not-present, and the same  
for EIDRM on Linux.  AFAICS, the considerations here are basically  
identical to the checks for acceptable shmctl() failures, so I documented  
and coded it that way.  
  
While at it, adjust PGSharedMemoryAttach's API to remove its undocumented  
dependency on UsedShmemSegAddr in favor of passing the attach address  
explicitly.  This makes it easier to be sure we're using a null shmaddr  
when probing for segment conflicts (thus avoiding questions about what  
EINVAL means).  I don't think there was a bug there, but it required  
fragile assumptions about the state of UsedShmemSegAddr during  
PGSharedMemoryIsInUse.  
  
Commit c09850992 may have made this failure more probable by applying  
the conflicting-segment tests more often.  Hence, back-patch to all  
supported branches, as that was.  
  
Discussion: https://postgr.es/m/22224.1557340366@sss.pgh.pa.us  

M src/backend/port/sysv_shmem.c

doc: add markup for PG 12 release note text

commit   : c65bcfe9aeecae1c6204ad60612fae43669a88b0    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 23:26:48 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 23:26:48 -0400    

Click here for diff

I will add links to other parts of the docs later.  

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

doc: PG 12 wording improvments

commit   : d0bbf871ca243eafcac7a84138741521c1aea3d2    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 20:58:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 20:58:02 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20190510001335.GJ3925@telsasoft.com  

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

Fix and improve description of locktag types in lock.h

commit   : 752f06443fba7e906cd98987f247297663f19a16    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 May 2019 09:35:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 May 2019 09:35:27 +0900    

Click here for diff

The description of the lock type for speculative insertions was  
incorrect, being copy-pasted from another one.  
  
As discussed, also move the description for all the fields of lock tag  
types from the structure listing lock tag types to the set of macros  
setting each LOCKTAG.  
  
Author: John Naylor  
Discussion: https://postgr.es/m/CACPNZCtA0-ybaC4fFfaDq_8p_TUOLvGxZH9Dm-=TMHZJarBa7Q@mail.gmail.com  

M src/include/storage/lock.h

doc: more PG 12 wording adjustments

commit   : 97b1654da7dd38fa50c9b6139f4213a1c47f0c39    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 20:32:35 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 20:32:35 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20190510001959.GK3925@telsasoft.com  

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

doc: fix capitalization in PG 12 release notes

commit   : 32fe7ee2dd2b2aa8620e69451f60b2b35989677c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 20:10:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 20:10:17 -0400    

Click here for diff

Reported-by: Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGJpep8uSXoDtVF6iROCRKce-39HEhDPUaYFyMn0U5e9ug@mail.gmail.com  

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

doc: more PG 12 release note adjustments

commit   : 79697d039f567cd52d844077244fb85df10dce19    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 19:59:59 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 19:59:59 -0400    

Click here for diff

This adds two more items that should have been included in the  
beginning.  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20190508203204.GA25482@telsasoft.com  

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

docs: update release notes with fixes

commit   : 81ddfa2e4d9350eb68f28cde8ae6a7e0b39ef2ac    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 19:27:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 19:27:03 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20190508203204.GA25482@telsasoft.com  

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

Improve and fix some error handling for REINDEX INDEX/TABLE CONCURRENTLY

commit   : 508300e2e141a9fd87758ce01374c5b0597986fd    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 May 2019 08:18:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 May 2019 08:18:46 +0900    

Click here for diff

This improves the user experience when it comes to restrict several  
flavors of REINDEX CONCURRENTLY.  First, for INDEX, remove a restriction  
on shared relations as we already check after catalog relations.  Then,  
for TABLE, add a proper error message when attempting to run the command  
on system catalogs.  The code path of CREATE INDEX CONCURRENTLY already  
complains about that, but if a REINDEX is issued then then the error  
generated is confusing.  
  
While on it, add more tests to check restrictions on catalog indexes and  
on toast table/index for catalogs.  Some error messages are improved,  
with wording suggestion coming from Tom Lane.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/23694.1556806002@sss.pgh.pa.us  

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

Repair issues with faulty generation of merge-append plans.

commit   : 24c19e9f66863d83009a370604e40b1eaa71bcdd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 May 2019 16:52:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 May 2019 16:52:48 -0400    

Click here for diff

create_merge_append_plan failed to honor the CP_EXACT_TLIST flag:  
it would generate the expected targetlist but then it felt free to  
add resjunk sort targets to it.  This demonstrably leads to assertion  
failures in v11 and HEAD, and it's probably just accidental that we  
don't see the same in older branches.  I've not looked into whether  
there would be any real-world consequences in non-assert builds.  
In HEAD, create_append_plan has sprouted the same problem, so fix  
that too (although we do not have any test cases that seem able to  
reach that bug).  This is an oversight in commit 3fc6e2d7f which  
invented the CP_EXACT_TLIST flag, so back-patch to 9.6 where that  
came in.  
  
convert_subquery_pathkeys would create pathkeys for subquery output  
values if they match any EquivalenceClass known in the outer query  
and are available in the subquery's syntactic targetlist.  However,  
the second part of that condition is wrong, because such values might  
not appear in the subquery relation's reltarget list, which would  
mean that they couldn't be accessed above the level of the subquery  
scan.  We must check that they appear in the reltarget list, instead.  
This can lead to dropping knowledge about the subquery's sort  
ordering, but I believe it's okay, because any sort key that the  
outer query actually has any interest in would appear in the  
reltarget list.  
  
This second issue is of very long standing, but right now there's no  
evidence that it causes observable problems before 9.6, so I refrained  
from back-patching further than that.  We can revisit that choice if  
somebody finds a way to make it cause problems in older branches.  
(Developing useful test cases for these issues is really problematic;  
fixing convert_subquery_pathkeys removes the only known way to exhibit  
the create_merge_append_plan bug, and neither of the test cases added  
by this patch causes a problem in all branches, even when considering  
the issues separately.)  
  
The second issue explains bug #15795 from Suresh Kumar R ("could not  
find pathkey item to sort" with nested DISTINCT queries).  I stumbled  
across the first issue while investigating that.  
  
Discussion: https://postgr.es/m/15795-fadb56c8e44ee73c@postgresql.org  

M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

doc: update PG 12 release notes, v2

commit   : 64084d6857b1d8ac05ae46f658b6c244aa6ab591    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 16:44:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 9 May 2019 16:44:27 -0400    

Click here for diff

Adjustments requested by reviewers.  
  
Reported-by: Amit Kapila, Thomas Munro, Andrew Gierth, Amit Langote, Oleg Bartunov, Michael Paquier, Alvaro Herrera, Tatsuo Ishii  
  
Discussion: https://postgr.es/m/20190506233029.ozwged67i7s4qd6c@momjian.us  

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

Doc: Update FDW documentation about GetForeignUpperPaths().

commit   : a0be05bab062eff16eafce3df73b3df453a694f4    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 9 May 2019 19:50:15 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 9 May 2019 19:50:15 +0900    

Click here for diff

In commit d50d172e51, which added support for LIMIT/OFFSET pushdown in  
postgres_fdw, a new struct was introduced as the extra parameter of  
GetForeignUpperPaths() set for UPPERREL_FINAL, but I forgot to update  
the documentation to mention that.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK17uSXQDe31oRb-z1nYyT6vVzkstZkA3_Wbq38U92b9BmQ%40mail.gmail.com  

M doc/src/sgml/fdwhandler.sgml

postgres_fdw: Fix cost estimation for aggregate pushdown.

commit   : edbcbe277d795ecc339b0e4fa29bae42ce1a7be9    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 9 May 2019 18:39:23 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 9 May 2019 18:39:23 +0900    

Click here for diff

In commit 7012b132d0, which added support for aggregate pushdown in  
postgres_fdw, the expense of evaluating the final scan/join target  
computed by make_group_input_target() was not accounted for at all in  
costing aggregate pushdown paths with local statistics.  The right fix  
for this would be to have a separate upper stage to adjust the final  
scan/join relation (see comments for apply_scanjoin_target_to_paths());  
but for now, fix by adding the tlist eval cost when costing aggregate  
pushdown paths with local statistics.  
  
Apply this to HEAD only to avoid destabilizing existing plan choices.  
  
Author: Etsuro Fujita  
Reviewed-By: Antonin Houska  
Discussion: https://postgr.es/m/5C66A056.60007%40lab.ntt.co.jp  

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

Fix SxactGlobalXmin tracking.

commit   : 47a338cfcd67139a1f91892b080934fcfc3aea03    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 9 May 2019 19:11:46 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 9 May 2019 19:11:46 +1200    

Click here for diff

Commit bb16aba50 broke the code that maintains SxactGlobalXmin.  It  
could get stuck when a well-timed READ ONLY transaction runs.  If  
SxactGlobalXmin stops advancing, transactions on the  
FinishedSerializableTransactions queue are never cleaned up, so  
resources are effectively leaked.  Revert that hunk of the commit.  
  
Also revert another similar hunk that was probably harmless, but  
unnecessary and unjustified, relating to the DOOMED flag in case of  
RO_SAFE early release.  
  
Author: Thomas Munro  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/16170.1557251214%40sss.pgh.pa.us  

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

pg_controldata: Add common gettext flags

commit   : cd805f46d857291b26ba6eb491ce11b6e0fc9ad3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 May 2019 09:15:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 May 2019 09:15:59 +0200    

Click here for diff

So it picks up strings in pg_log_* calls.  This was forgotten when it  
was added to all other relevant subdirectories.  

M src/bin/pg_controldata/nls.mk

Fix grammar in error message

commit   : 02daece4ab4cd85b80d04469056e5b631918c9d6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 May 2019 09:14:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 May 2019 09:14:37 +0200    

Click here for diff

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out

Clean up the behavior and API of catalog.c's is-catalog-relation tests.

commit   : 2d7d946cd323ce1c1d3f3ef0e5f2f41591afc1b9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 8 May 2019 23:27:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 8 May 2019 23:27:29 -0400    

Click here for diff

The right way for IsCatalogRelation/Class to behave is to return true  
for OIDs less than FirstBootstrapObjectId (not FirstNormalObjectId),  
without any of the ad-hoc fooling around with schema membership.  
  
The previous code was wrong because (1) it claimed that  
information_schema tables were not catalog relations but their toast  
tables were, which is silly; and (2) if you dropped and recreated  
information_schema, which is a supported operation, the behavior  
changed.  That's even sillier.  With this definition, "catalog  
relations" are exactly the ones traceable to the postgres.bki data,  
which seems like what we want.  
  
With this simplification, we don't actually need access to the pg_class  
tuple to identify a catalog relation; we only need its OID.  Hence,  
replace IsCatalogClass with "IsCatalogRelationOid(oid)".  But keep  
IsCatalogRelation as a convenience function.  
  
This allows fixing some arguably-wrong semantics in contrib/sepgsql and  
ReindexRelationConcurrently, which were using an IsSystemNamespace test  
where what they really should be using is IsCatalogRelationOid.  The  
previous coding failed to protect toast tables of system catalogs, and  
also was not on board with the general principle that user-created tables  
do not become catalogs just by virtue of being renamed into pg_catalog.  
We can also get rid of a messy hack in ReindexMultipleTables.  
  
While we're at it, also rename IsSystemNamespace to IsCatalogNamespace,  
because the previous name invited confusion with the more expansive  
semantics used by IsSystemRelation/Class.  
  
Also improve the comments in catalog.c.  
  
There are a few remaining places in replication-related code that are  
special-casing OIDs below FirstNormalObjectId.  I'm inclined to think  
those are wrong too, and if there should be any special case it should  
just extend to FirstBootstrapObjectId.  But first we need to debate  
whether a FOR ALL TABLES publication should include information_schema.  
  
Discussion: https://postgr.es/m/21697.1557092753@sss.pgh.pa.us  
Discussion: https://postgr.es/m/15150.1557257111@sss.pgh.pa.us  

M contrib/sepgsql/dml.c
M src/backend/access/transam/varsup.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catalog.h

Fix error status of vacuumdb when multiple jobs are used

commit   : 3ae3c18b362817f9412c380539f1a16c7abb79c9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 9 May 2019 10:29:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 9 May 2019 10:29:10 +0900    

Click here for diff

When running a batch of VACUUM or ANALYZE commands on a given database,  
there were cases where it is possible to have vacuumdb not report an  
error where it actually should, leading to incorrect status results.  
  
Author: Julien Rouhaud  
Reviewed-by: Amit Kapila, Michael Paquier  
Discussion: https://postgr.es/m/CAOBaU_ZuTwz7CtqLYJ1Ouuh272bTQPLN8b1bAPk0bCBm4PDMTQ@mail.gmail.com  
Backpatch-through: 9.5  

M src/bin/scripts/vacuumdb.c

Remove obsolete nbtree split REDO routine comment.

commit   : d95e36dc384e3068ae2db909c228b1800737b18d    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 8 May 2019 12:47:20 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 8 May 2019 12:47:20 -0700    

Click here for diff

Commit dd299df8189, which added suffix truncation to nbtree, simplified  
the WAL record format used by page splits.  It became necessary to  
explicitly WAL-log the new high key for the left half of a split in all  
cases, which relieved the REDO routine from having to reconstruct a new  
high key for the left page by copying the first item from the right  
page.  Remove a comment that referred to the previous practice.  

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

Fix error messages

commit   : 61639816b870347677e6e6945604e0d9da1837ca    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 8 May 2019 13:16:54 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 8 May 2019 13:16:54 -0400    

Click here for diff

Some messages related to foreign servers were reporting the server name  
without quotes, or not at all; our style is to have all names be quoted,  
and the server name already appears quoted in a few other messages, so  
just add quotes and make them all consistent.  
  
Remove an extra "s" in other messages (typos introduced by myself in  
f56f8f8da6af).  

M src/backend/commands/foreigncmds.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/foreign_data.out

Fix documentation for the privileges required for replication functions.

commit   : df631ebc737e9d9cdf8d0691969d404f1bd584a4    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 9 May 2019 01:35:13 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 9 May 2019 01:35:13 +0900    

Click here for diff

Previously it's documented that use of replication functions is  
restricted to superusers. This is true for the functions which  
use replication origin, but not for pg_logicl_emit_message() and  
functions which use replication slot. For example, not only  
superusers but also users with REPLICATION privilege is allowed  
to use the functions for replication slot. This commit fixes  
the documentation for the privileges required for those replication  
functions.  
  
Back-patch to 9.4 (all supported versions).  
  
Author: Matsumura Ryo  
Discussion: https://postgr.es/m/03040DFF97E6E54E88D3BFEE5F5480F74ABA6E16@G01JPEXMBYT04  

M doc/src/sgml/func.sgml

Fix table lock levels for REINDEX INDEX CONCURRENTLY

commit   : add85ead4ab969c1e31d64f4476c2335856f4aa9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 May 2019 14:15:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 May 2019 14:15:01 +0200    

Click here for diff

REINDEX CONCURRENTLY locks tables with ShareUpdateExclusiveLock rather  
than the ShareLock used by a plain REINDEX.  However,  
RangeVarCallbackForReindexIndex() was not updated for that and still  
used the ShareLock only.  This would lead to lock upgrades later,  
leading to possible deadlocks.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/flat/20190430151735.wi52sxjvxsjvaxxt%40alap3.anarazel.de  

M src/backend/commands/indexcmds.c

Probe only 127.0.0.1 when looking for ports on Unix.

commit   : 8efe710d9c84502b3e6a9487937bccf881f56d9c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 6 May 2019 15:02:41 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 6 May 2019 15:02:41 +1200    

Click here for diff

Commit c0985099, later adjusted by commit 4ab02e81, probed 0.0.0.0  
in addition to 127.0.0.1, for the benefit of Windows build farm  
animals.  It isn't really useful on Unix systems, and turned out to  
be a bit inconvenient to users of some corporate firewall software.  
Switch back to probing just 127.0.0.1 on non-Windows systems.  
  
Back-patch to 9.6, like the earlier changes.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2B21EPwfgs4m%2BtqyRtbVqkOUvP8QQ8sWk9%2Bh55Aub1H3A%40mail.gmail.com  

M src/test/perl/PostgresNode.pm

Fix copy-and-paste mistakes in documentation.

commit   : 098344be663f5fc0ad166e7a9e1cd37721ee34d9    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 May 2019 21:14:14 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 May 2019 21:14:14 +1200    

Click here for diff

Reported-by: Vik Fearing  

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

Add missing periods to comments.

commit   : b7434dc007252d7a5e5f7f85700bd7400b1db201    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 8 May 2019 16:49:09 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 8 May 2019 16:49:09 +0900    

Click here for diff

M src/include/nodes/pathnodes.h

Remove leftover reference to old "flat file" mechanism in a comment.

commit   : 256be1050cbbf90b1e44d11c8ed10f98255aa27d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 8 May 2019 09:32:34 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 8 May 2019 09:32:34 +0300    

Click here for diff

The flat file mechanism was removed in PostgreSQL 9.0.  

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

Correct obsolete nbtsort.c minimum key comment.

commit   : d65b5ccad626e1942c862e8a70f56ad7ee7a8003    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 7 May 2019 21:42:12 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 7 May 2019 21:42:12 -0700    

Click here for diff

It is no longer possible under any circumstances for nbtree code to  
reconstruct a strict lower bound key (parent page's pivot tuple key) for  
a right sibling page by retrieving the first item in the right sibling  
page.  

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

Add jsonpath_encoding_1.out changes missed in 29ceacc3f9

commit   : e5f978631722bb3cac42f0eb6e65e947e0f088ec    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 8 May 2019 01:55:31 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 8 May 2019 01:55:31 +0300    

Click here for diff

Reported-by: Tom Lane  
Discussion: https://postgr.es/m/14305.1557268259%40sss.pgh.pa.us  

M src/test/regress/expected/jsonpath_encoding_1.out

Remove word "singleton" out of jsonpath docs

commit   : 53ae0b16d6f60a15427e081091b2b81e36e674ee    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 30 Apr 2019 01:12:05 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 30 Apr 2019 01:12:05 +0300    

Click here for diff

Word "singleton" is hard for user understanding, especially taking into account  
there is only one place it's used in the docs and there is even no definition.  
Use more evident wording instead.  
  
Discussion: https://postgr.es/m/23737.1556550645%40sss.pgh.pa.us  

M doc/src/sgml/func.sgml

Improve error reporting in jsonpath

commit   : 29ceacc3f93720d3ebb7e7e999f8b7fe9622389c    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 23 Apr 2019 17:43:09 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 23 Apr 2019 17:43:09 +0300    

Click here for diff

This commit contains multiple improvements to error reporting in jsonpath  
including but not limited to getting rid of following things:  
  
 * definition of error messages in macros,  
 * errdetail() when valueable information could fit to errmsg(),  
 * word "singleton" which is not properly explained anywhere,  
 * line breaks in error messages.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/14890.1555523005%40sss.pgh.pa.us  
Author: Alexander Korotkov  
Reviewed-by: Tom Lane  

M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out

Add TRUNCATE parameter to VACUUM.

commit   : b84dbc8eb80b43e554891c459a19969d9fbdefe5    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 8 May 2019 02:10:33 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 8 May 2019 02:10:33 +0900    

Click here for diff

This commit adds new parameter to VACUUM command, TRUNCATE,  
which specifies that VACUUM should attempt to truncate off  
any empty pages at the end of the table and allow the disk space  
for the truncated pages to be returned to the operating system.  
  
This parameter, if specified, overrides the vacuum_truncate  
reloption. If neither the reloption nor the VACUUM option is  
used, the default is true, as before.  
  
Author: Fujii Masao  
Reviewed-by: Julien Rouhaud, Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoD+qtrSDL=GSma4Wd3kLYLeRC0hPna-YAdkDeV4z156vg@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Fix typos and clarify a comment

commit   : 98719af6c2e30d538cd05cfe044f58ba4067b52b    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Tue, 7 May 2019 18:26:09 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Tue, 7 May 2019 18:26:09 +0200    

Click here for diff

Author: Daniel Gustafsson <daniel@yesql.se>  

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

Avoid "invalid memory alloc request size" while reading pg_stat_activity.

commit   : 8d0ddccec6366a2851da7d350b33659203aa644b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 7 May 2019 11:41:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 7 May 2019 11:41:37 -0400    

Click here for diff

On a 64-bit machine, if you set track_activity_query_size and  
max_connections such that their product exceeds 1GB, shared memory  
setup will still succeed (given enough RAM), but attempts to read  
pg_stat_activity fail with "invalid memory alloc request size".  
Work around that by using MemoryContextAllocHuge to allocate the  
local copy of the activity strings.  Using the "huge" API costs us  
nothing extra in normal cases, and it seems better than throwing  
an error and/or explaining to people why they can't do this.  
  
This situation seems insanely profligate today, but who knows what  
people will consider normal in ten or twenty years?  So let's fix it  
in HEAD but not worry about a back-patch.  
  
Per report from James Tomson.  
  
Discussion: https://postgr.es/m/1CFDCCD6-B268-48D8-85C8-400D2790B2C3@pushd.com  

M src/backend/postmaster/pgstat.c

doc: Generate keywords table automatically

commit   : b753bc0c84e51c200ec7de6cefb6f689d13fef62    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 7 May 2019 15:29:39 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 7 May 2019 15:29:39 +0200    

Click here for diff

The SQL keywords table in the documentation had until now been  
generated by some ad hoc scripting outside the source tree once for  
each major release.  This changes it to an automated process.  
  
We have the PostgreSQL keywords available in a parseable format in  
parser/kwlist.h.  For the relevant SQL standard versions, keep the  
keyword lists in new text files.  A new script  
generate-keywords-table.pl pulls it all together and produces a  
DocBook table.  
  
The final output in the documentation should be identical after this  
change.  
  
Discussion: https://www.postgresql.org/message-id/flat/07daeadd-8c82-0d95-5e19-e350502cb749%402ndquadrant.com  

M doc/src/sgml/.gitignore
M doc/src/sgml/Makefile
M doc/src/sgml/filelist.sgml
A doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/keywords.sgml
A doc/src/sgml/keywords/sql1992-nonreserved.txt
A doc/src/sgml/keywords/sql1992-reserved.txt
A doc/src/sgml/keywords/sql2008-02-nonreserved.txt
A doc/src/sgml/keywords/sql2008-02-reserved.txt
A doc/src/sgml/keywords/sql2008-09-nonreserved.txt
A doc/src/sgml/keywords/sql2008-09-reserved.txt
A doc/src/sgml/keywords/sql2008-14-nonreserved.txt
A doc/src/sgml/keywords/sql2008-14-reserved.txt
A doc/src/sgml/keywords/sql2011-02-nonreserved.txt
A doc/src/sgml/keywords/sql2011-02-reserved.txt
A doc/src/sgml/keywords/sql2011-09-nonreserved.txt
A doc/src/sgml/keywords/sql2011-09-reserved.txt
A doc/src/sgml/keywords/sql2011-14-nonreserved.txt
A doc/src/sgml/keywords/sql2011-14-reserved.txt

Revert "Avoid the creation of the free space map for small heap relations".

commit   : 7db0cde6b58eef2ba0c70437324cbc7622230320    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 7 May 2019 09:30:24 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 7 May 2019 09:30:24 +0530    

Click here for diff

This feature was using a process local map to track the first few blocks  
in the relation.  The map was reset each time we get the block with enough  
freespace.  It was discussed that it would be better to track this map on  
a per-relation basis in relcache and then invalidate the same whenever  
vacuum frees up some space in the page or when FSM is created.  The new  
design would be better both in terms of API design and performance.  
  
List of commits reverted, in reverse chronological order:  
  
06c8a5090e  Improve code comments in b0eaa4c51b.  
13e8643bfc  During pg_upgrade, conditionally skip transfer of FSMs.  
6f918159a9  Add more tests for FSM.  
9c32e4c350  Clear the local map when not used.  
29d108cdec  Update the documentation for FSM behavior..  
08ecdfe7e5  Make FSM test portable.  
b0eaa4c51b  Avoid creation of the free space map for small heap relations.  
  
Discussion: https://postgr.es/m/20190416180452.3pm6uegx54iitbt5@alap3.anarazel.de  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql
M contrib/pgstattuple/pgstatapprox.c
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xact.c
M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/indexfsm.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/include/storage/freespace.h
D src/test/regress/expected/fsm.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
D src/test/regress/sql/fsm.sql

commit   : af82f95abb23a56d18fd009ef9eca68ef803a041    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 May 2019 09:39:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 May 2019 09:39:39 +0900    

Click here for diff

This code was broken as of 582edc3, and is most likely not used anymore.  
Note that pg_dump supports servers down to 8.0, and psql has code to  
support servers down to 7.4.  
  
Author: Julien Rouhaud  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAOBaU_Y5y=zo3+2gf+2NJC1pvMYPcbRXoQaPXx=U7+C8Qh4CzQ@mail.gmail.com  

M src/bin/scripts/common.c

docs: fist draft version of the PG 12 release notes

commit   : bdf595adbca195fa54a909c74a5233ebc30641a1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 6 May 2019 19:02:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 6 May 2019 19:02:34 -0400    

Click here for diff

Still needs text markup, links, word wrap, and indenting.  

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

Revert "Make pg_dump emit ATTACH PARTITION instead of PARTITION OF"

commit   : a1ec7402e9a0392f95bc79542af0efcd5c6e7929    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 6 May 2019 12:23:49 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 6 May 2019 12:23:49 -0400    

Click here for diff

... and fallout (from branches 10, 11 and master).  The change was  
ill-considered, and it broke a few normal use cases; since we don't have  
time to fix it, we'll try again after this week's minor releases.  
  
Reported-by: Rushabh Lathia  
Discussion: https://postgr.es/m/CAGPqQf0iQV=PPOv2Btog9J9AwOQp6HmuVd6SbGTR_v3Zp2XT1w@mail.gmail.com  

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

Add tests for error message generation in partition tuple routing

commit   : 91248608a61d5504f8ac46534136de9b3717fed2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 May 2019 21:44:24 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 May 2019 21:44:24 +0900    

Click here for diff

This adds extra tests for the error message generated for partition  
tuple routing in the executor, using more than three levels of  
partitioning including partitioned tables with no partitions.  These  
tests have been added to fix CVE-2019-10129 on REL_11_STABLE.  HEAD has  
no active bugs in this area, but it lacked coverage.  
  
Author: Michael Paquier  
Reviewed-by: Noah Misch  
Security: CVE-2019-10129  

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

Use checkAsUser for selectivity estimator checks, if it's set.

commit   : a0905056fd6b0927dd33f185adc9e7503515fc0d    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Mon, 6 May 2019 11:54:32 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Mon, 6 May 2019 11:54:32 +0100    

Click here for diff

In examine_variable() and examine_simple_variable(), when checking the  
user's table and column privileges to determine whether to grant  
access to the pg_statistic data, use checkAsUser for the privilege  
checks, if it's set. This will be the case if we're accessing the  
table via a view, to indicate that we should perform privilege checks  
as the view owner rather than the current user.  
  
This change makes this planner check consistent with the check in the  
executor, so the planner will be able to make use of statistics if the  
table is accessible via the view. This fixes a performance regression  
introduced by commit e2d4ef8de8, which affects queries against  
non-security barrier views in the case where the user doesn't have  
privileges on the underlying table, but the view owner does.  
  
Note that it continues to provide the same safeguards controlling  
access to pg_statistic for direct table access (in which case  
checkAsUser won't be set) and for security barrier views, because of  
the nearby checks on rte->security_barrier and rte->securityQuals.  
  
Back-patch to all supported branches because e2d4ef8de8 was.  
  
Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.  

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

Fix security checks for selectivity estimation functions with RLS.

commit   : 1aebfbea83c4a3e1a0aba4b0910135dc5a45666c    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Mon, 6 May 2019 11:38:43 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Mon, 6 May 2019 11:38:43 +0100    

Click here for diff

In commit e2d4ef8de8, security checks were added to prevent  
user-supplied operators from running over data from pg_statistic  
unless the user has table or column privileges on the table, or the  
operator is leakproof. For a table with RLS, however, checking for  
table or column privileges is insufficient, since that does not  
guarantee that the user has permission to view all of the column's  
data.  
  
Fix this by also checking for securityQuals on the RTE, and insisting  
that the operator be leakproof if there are any. Thus the  
leakproofness check will only be skipped if there are no securityQuals  
and the user has table or column privileges on the table -- i.e., only  
if we know that the user has access to all the data in the column.  
  
Back-patch to 9.5 where RLS was added.  
  
Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.  
  
Security: CVE-2019-10130  

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

Bring pg_nextoid()'s error messages into line with message style guide.

commit   : bd5e8b627bae9e394352a388d2ad30465eafea2c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 May 2019 17:06:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 May 2019 17:06:53 -0400    

Click here for diff

Noticed while reviewing nearby code.  Given all the disclaimers about  
this not being meant as user-facing code, I wonder whether we should  
make these non-translatable?  But in any case there's little excuse  
for them not to be good English.  

M src/backend/catalog/catalog.c

Fix style violations in syscache lookups.

commit   : 9691aa72e2a7fb146ac759e1f8a8b04962128cc0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 May 2019 13:10:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 May 2019 13:10:07 -0400    

Click here for diff

Project style is to check the success of SearchSysCacheN and friends  
by applying HeapTupleIsValid to the result.  A tiny minority of calls  
creatively did it differently.  Bring them into line with the rest.  
  
This is just cosmetic, since HeapTupleIsValid is indeed just a null  
check at the moment ... but that may not be true forever, and in any  
case it puts a mental burden on readers who may wonder why these  
call sites are not like the rest.  
  
Back-patch to v11 just to keep the branches in sync.  (The bulk of these  
errors seem to have originated in v11 or v12, though a few are old.)  
  
Per searching to see if anyplace else had made the same error  
repaired in 62148c352.  

M src/backend/catalog/partition.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/plancat.c

Add check for syscache lookup failure in update_relispartition().

commit   : 62148c3520b562e518f17134b22120bab0cb113b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 May 2019 12:44:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 May 2019 12:44:32 -0400    

Click here for diff

Omitted in commit 05b38c7e6 (though it looks like the original blame  
belongs to 9e9befac4).  A failure is admittedly unlikely, but if it  
did happen, SIGSEGV is not the approved method of reporting it.  
  
Per Coverity.  Back-patch to v11 where the broken code originated.  

M src/backend/commands/indexcmds.c

Fix set of issues with memory-allocation system calls in frontend code

commit   : 84e4570da9230d45022ef77f98b560f26eaf6916    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 4 May 2019 16:32:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 4 May 2019 16:32:19 +0900    

Click here for diff

Like the backend, the frontend has wrappers on top of malloc() and such  
whose use is recommended.  Particularly, it is possible to do memory  
allocation without issuing an error.  Some binaries missed the use of  
those wrappers, so let's fix the gap for consistency.  
  
This also fixes two latent bugs:  
- In pg_dump/pg_dumpall when parsing an ACL item, on an out-of-memory  
error for strdup(), the code considered the failure as a ACL parsing  
problem instead of an actual OOM.  
- In pg_waldump, an OOM when building the target directory string would  
cause a crash.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/gY0y9xenfoBPc-Tufsr2Zg-MmkrJslm0Tw_CMg4p_j58-k_PXNC0klMdkKQkg61BkXC9_uWo-DcUzfxnHqpkpoR5jjVZrPHqKYikcHIiONhg=@yesql.se  

M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/large_obj.c

MSVC: Build ~35% faster by calling dumpbin just once per directory.

commit   : 34ff542a71f8e8e768b24d40548dec4be0c707c3    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 3 May 2019 21:56:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 3 May 2019 21:56:47 -0700    

Click here for diff

Peifeng Qiu  
  
Discussion: https://postgr.es/m/CABmtVJiKXQjast0dQD-8KAtfm8XmyYxo-4Dc7+M+fBr8JRTqkw@mail.gmail.com  

M src/tools/msvc/gendef.pl

Suppress compiler warning in non-SSL, non-assert builds.

commit   : 726cc4242a2f766c8280a72ef7c8418965d139c8    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 3 May 2019 21:56:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 3 May 2019 21:56:46 -0700    

Click here for diff

Jeff Janes, reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/CAMkU=1x8taZfsbPkv_MsWbTtzibW_yQHXoMhF_DTtm=z2hVHDg@mail.gmail.com  

M contrib/pgcrypto/imath.c

Correct more obsolete nbtree page split comments.

commit   : 7b37f4b02e11813b3cd9f7086149ba962a91e03c    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 3 May 2019 13:34:45 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 3 May 2019 13:34:45 -0700    

Click here for diff

Commit 3f342839 corrected obsolete comments about buffer locks at the  
main _bt_insert_parent() call site, but missed similar obsolete comments  
above _bt_insert_parent() itself.  Both sets of comments were rendered  
obsolete by commit 40dae7ec537, which made the nbtree page split  
algorithm more robust.  Fix the comments that were missed the first time  
around now.  
  
In passing, refine a related _bt_insert_parent() comment about  
re-finding the parent page to insert new downlink.  

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

Doc: remove obsolete comment about per-branch documentation.

commit   : 8309eae499d6782bfc5e81f4d1cfcbf8e3fc8f5d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 May 2019 12:32:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 May 2019 12:32:06 -0400    

Click here for diff

I should have removed this in a0b762626, but forgot.  

M doc/src/sgml/release.sgml

Remove RelationSetIndexList().

commit   : f884dca4959f64bd47e78102d1dadd2c77d49201    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 May 2019 10:26:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 May 2019 10:26:14 -0400    

Click here for diff

In the wake of commit f912d7dec, RelationSetIndexList isn't used any  
more.  It was always a horrid wart, so getting rid of it is very nice.  
We can also convert rd_indexvalid back to a plain boolean.  
  
Discussion: https://postgr.es/m/28926.1556664156@sss.pgh.pa.us  

M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h
M src/include/utils/relcache.h

Fix reindexing of pg_class indexes some more.

commit   : f912d7dec29341d55315fccef8dc3fdfd068c6e3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 May 2019 19:11:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 May 2019 19:11:28 -0400    

Click here for diff

Commits 3dbb317d3 et al failed under CLOBBER_CACHE_ALWAYS testing.  
Investigation showed that to reindex pg_class_oid_index, we must  
suppress accesses to the index (via SetReindexProcessing) before we call  
RelationSetNewRelfilenode, or at least before we do CommandCounterIncrement  
therein; otherwise, relcache reloads happening within the CCI may try to  
fetch pg_class rows using the index's new relfilenode value, which is as  
yet an empty file.  
  
Of course, the point of 3dbb317d3 was that that ordering didn't work  
either, because then RelationSetNewRelfilenode's own update of the index's  
pg_class row cannot access the index, should it need to.  
  
There are various ways we might have got around that, but Andres Freund  
came up with a brilliant solution: for a mapped index, we can really just  
skip the pg_class update altogether.  The only fields it was actually  
changing were relpages etc, but it was just setting them to zeroes which  
is useless make-work.  (Correct new values will be installed at the end  
of index build.)  All pg_class indexes are mapped and probably always will  
be, so this eliminates the problem by removing work rather than adding it,  
always a pleasant outcome.  Having taught RelationSetNewRelfilenode to do  
it that way, we can revert the code reordering in reindex_index.  (But  
I left the moved setup code where it was; there seems no reason why it  
has to run without use of the old index.  If you're trying to fix a  
busted pg_class index, you'll have had to disable system index use  
altogether to get this far.)  
  
Moreover, this means we don't need RelationSetIndexList at all, because  
reindex_relation's hacking to make "REINDEX TABLE pg_class" work is  
likewise now unnecessary.  We'll leave that code in place in the back  
branches, but a follow-on patch will remove it in HEAD.  
  
In passing, do some minor cleanup for commit 5c1560606 (in HEAD only),  
notably removing a duplicate newrnode assignment.  
  
Patch by me, using a core idea due to Andres Freund.  Back-patch to all  
supported branches, as 3dbb317d3 was.  
  
Discussion: https://postgr.es/m/28926.1556664156@sss.pgh.pa.us  

M src/backend/catalog/index.c
M src/backend/utils/cache/relcache.c

heap_prepare_freeze_tuple: Simplify coding

commit   : 2bf372a4ae26337ee61cf7a82081cf4bed05182d    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 2 May 2019 16:13:48 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 2 May 2019 16:13:48 -0400    

Click here for diff

Commit d2599ecfcc74 introduced some contorted, confused code around:  
readers would think that it's possible for HeapTupleHeaderGetXmin return  
a non-frozen value for some frozen tuples, which would be disastrous.  
There's no actual bug, but it seems better to make it clearer.  
  
Per gripe from Tom Lane and Andres Freund.  
Discussion: https://postgr.es/m/30116.1555430496@sss.pgh.pa.us  

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

Fix nbtsort.c's page space accounting.

commit   : 6dd86c269d5b9a176f6c9f67ea61cc17fef9d860    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 May 2019 12:33:35 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 May 2019 12:33:35 -0700    

Click here for diff

Commit dd299df8189, which made heap TID a tiebreaker nbtree index  
column, introduced new rules on page space management to make suffix  
truncation safe.  In general, suffix truncation needs to have a small  
amount of extra space available on the new left page when splitting a  
leaf page.  This is needed in case it turns out that truncation cannot  
even "truncate away the heap TID column", resulting in a  
larger-than-firstright leaf high key with an explicit heap TID  
representation.  
  
Despite all this, CREATE INDEX/nbtsort.c did not account for the  
possible need for extra heap TID space on leaf pages when deciding  
whether or not a new item could fit on current page.  This could lead to  
"failed to add item to the index page" errors when CREATE  
INDEX/nbtsort.c tried to finish off a leaf page that lacked space for a  
larger-than-firstright leaf high key (it only had space for firstright  
tuple, which was just short of what was needed following "truncation").  
  
Several conditions needed to be met all at once for CREATE INDEX to  
fail.  The problem was in the hard limit on what will fit on a page,  
which tends to be masked by the soft fillfactor-wise limit.  The easiest  
way to recreate the problem seems to be a CREATE INDEX on a low  
cardinality text column, with tuples that are of non-uniform width,  
using a fillfactor of 100.  
  
To fix, bring nbtsort.c in line with nbtsplitloc.c, which already  
pessimistically assumes that all leaf page splits will have high keys  
that have a heap TID appended.  
  
Reported-By: Andreas Joseph Krogh  
Discussion: https://postgr.es/m/VisenaEmail.c5.3ee7fe277d514162.16a6d785bea@tc7-visena  

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

Fix some problems with VACUUM (INDEX_CLEANUP FALSE).

commit   : dd69597988859c51131e0cbff3e30432db4259e1    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 2 May 2019 10:07:13 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 2 May 2019 10:07:13 -0400    

Click here for diff

The new nleft_dead_tuples and nleft_dead_itemids fields are confusing  
and do not seem like the correct way forward.  One of them is tested  
via an assertion that can fail, as it has already done on buildfarm  
member topminnow.  Remove the assertion and the fields.  
  
Change the logic for the case where a tuple is not initially pruned  
by heap_page_prune but later diagnosed HEAPTUPLE_DEAD by  
HeapTupleSatisfiesVacuum.  Previously, tupgone = true was set in  
that case, which leads to treating the tuple as one that will be  
removed.  In a normal vacuum, that's OK, because we'll remove  
index entries for it and then the second heap pass will remove the  
tuple itself, but when index cleanup is disabled, those things  
don't happen, so we must instead treat it as a recently-dead  
tuple that we have voluntarily chosen to keep.  
  
Report and analysis by Tom Lane.  This patch loosely based on one  
from Masahiko Sawada, but I changed most of it.  

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

doc: clarify behavior of pg_upgrade's clone mode

commit   : 26950273dc27ec7775029cffe1140165f942325d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 1 May 2019 09:09:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 1 May 2019 09:09:28 -0400    

Click here for diff

Be more precise about the benefits of using clone mode.  

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

Fix union for pgstat message types

commit   : 659e53498c3c04e4f400323c02bef98fe8d13ec8    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Wed, 1 May 2019 12:30:44 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Wed, 1 May 2019 12:30:44 +0200    

Click here for diff

The message type for temp files and for checksum failures were missing  
from the union. Due to the coding style used there was no compiler error  
when this happend. So change the code to actively use the union thereby  
producing a compiler error if the same mistake happens again, suggested  
by Tom Lane.  
  
Author: Julien Rouhaud  
Reported-By: Tomas Vondra  
Discussion: https://postgr.es/m/20190430163328.zd4rrlnbvgaqlcdz@development  

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

Run catalog reindexing test from 3dbb317d32 serially, to avoid deadlocks.

commit   : 809c9b48f4bdd11dfc088f6d0b9a6c57936c32ca    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    

Click here for diff

The tests turn out to cause deadlocks in some circumstances. Fairly  
reproducibly so with -DRELCACHE_FORCE_RELEASE  
-DCATCACHE_FORCE_RELEASE.  Some of the deadlocks may be hard to fix  
without disproportionate measures, but others probably should be fixed  
- but not in 12.  
  
We discussed removing the new tests until we can fix the issues  
underlying the deadlocks, but results from buildfarm animal  
markhor (which runs with CLOBBER_CACHE_ALWAYS) indicates that there  
might be a more severe, as of yet undiagnosed, issue (including on  
stable branches) with reindexing catalogs. The failure is:  
ERROR: could not read block 0 in file "base/16384/28025": read only 0 of 8192 bytes  
Therefore it seems advisable to keep the tests.  
  
It's not certain that running the tests in isolation removes the risk  
of deadlocks. It's possible that additional locks are needed to  
protect against a concurrent auto-analyze or such.  
  
Per discussion with Tom Lane.  
  
Discussion: https://postgr.es/m/28926.1556664156@sss.pgh.pa.us  
Backpatch: 9.4-, like 3dbb317d3  

M src/test/regress/expected/create_index.out
A src/test/regress/expected/reindex_catalog.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/reindex_catalog.sql

Fix unused variable compiler warning in !debug builds.

commit   : 4b40d40b30ae04ba524cd410f14e64ae4425a180    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    

Click here for diff

Introduced in 3dbb317d3.  Fix by using the new local variable in more  
places.  
  
Reported-By: Bruce Momjian (off-list)  
Backpatch: 9.4-, like 3dbb317d3  

M src/backend/catalog/indexing.c

docs: Fix small copy & paste mistake.

commit   : b06a354e381d30e13cef28904bb923896aa4719b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 16:18:35 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 16:18:35 -0700    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20190418005115.r4mat75wvlski3ij@alap3.anarazel.de  

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

Improve comment spelling and style in llvmjit_deform.c.

commit   : a0b5bb6e026a3acf739843b744f3b14d4093450a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 16:13:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 16:13:54 -0700    

Click here for diff

Author: Justin Pryzby  
Discussion:  
    https://postgr.es/m/20190408141828.GE10080@telsasoft.com  
    https://postgr.es/m/20181127184133.GM10913@telsasoft.com  

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

Improve code inferring length of bitmap for JITed tuple deforming.

commit   : 3a48005b0049d69b4376e6ae386479ae3d255a11    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 15:55:07 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 30 Apr 2019 15:55:07 -0700    

Click here for diff

While discussing comment improvements (see next commit) by Justin  
Pryzby, Tom complained about a few details of the logic to infer the  
length of the NULL bitmap when building the JITed tuple deforming  
function. That bitmap allows to avoid checking the tuple header's  
natts, a check which often causes a pipeline stall  
  
Improvements:  
a) As long as missing columns aren't taken into account, we can  
   continue to infer the length of the NULL bitmap from NOT NULL  
   columns following it. Previously we stopped at the first missing  
   column.  It's unlikely to matter much in practice, but the  
   alternative would have been to document why we stop.  
b) For robustness reasons it seems better to also check against  
   attisdropped - RemoveAttributeById() sets attnotnull to false, but  
   an additional check is trivial.  
c) Improve related comments  
  
Discussion: https://postgr.es/m/20637.1555957068@sss.pgh.pa.us  
Backpatch: -  

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

Clean up handling of constraint_exclusion and enable_partition_pruning.

commit   : e03ff739695cb731956763355e8e0f38c6905008    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 30 Apr 2019 15:03:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 30 Apr 2019 15:03:35 -0400    

Click here for diff

The interaction of these parameters was a bit confused/confusing,  
and in fact v11 entirely misses the opportunity to apply partition  
constraints when a partition is accessed directly (rather than  
indirectly from its parent).  
  
In HEAD, establish the principle that enable_partition_pruning controls  
partition pruning and nothing else.  When accessing a partition via its  
parent, we do partition pruning (if enabled by enable_partition_pruning)  
and then there is no need to consider partition constraints in the  
constraint_exclusion logic.  When accessing a partition directly, its  
partition constraints are applied by the constraint_exclusion logic,  
only if constraint_exclusion = on.  
  
In v11, we can't have such a clean division of these GUCs' effects,  
partly because we don't want to break compatibility too much in a  
released branch, and partly because the clean coding requires  
inheritance_planner to have applied partition pruning to a partitioned  
target table, which it doesn't in v11.  However, we can tweak things  
enough to cover the missed case, which seems like a good idea since  
it's potentially a performance regression from v10.  This patch keeps  
v11's previous behavior in which enable_partition_pruning overrides  
constraint_exclusion for an inherited target table, though.  
  
In HEAD, also teach relation_excluded_by_constraints that it's okay to use  
inheritable constraints when trying to prune a traditional inheritance  
tree.  This might not be thought worthy of effort given that that feature  
is semi-deprecated now, but we have enough infrastructure that it only  
takes a couple more lines of code to do it correctly.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/9813f079-f16b-61c8-9ab7-4363cab28d80@lab.ntt.co.jp  
Discussion: https://postgr.es/m/29069.1555970894@sss.pgh.pa.us  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

doc: improve PG 12 to_timestamp()/to_date() wording

commit   : ad23adc5a169b114f9ff325932cbf2ce1c5e69c1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 Apr 2019 14:06:57 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 Apr 2019 14:06:57 -0400    

Click here for diff

M doc/src/sgml/func.sgml

doc: move "only" to a more appropriate place in the sentence

commit   : 345473862571d5b2c63849f6472828bdc5b49320    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 Apr 2019 13:44:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 Apr 2019 13:44:31 -0400    

Click here for diff

M doc/src/sgml/func.sgml

Message style fixes

commit   : 9f8b717a80c59e4a8e8091a8ff6c6f7666a69c33    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 30 Apr 2019 10:00:38 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 30 Apr 2019 10:00:38 -0400    

Click here for diff

M src/backend/access/table/tableamapi.c
M src/backend/access/transam/twophase.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/utils/misc/guc.c
M src/test/regress/output/tablespace.source

Widen tuple counter variables from long to int64

commit   : 9a83afecb7ec6e828b7dbef3133f3dd8b0b4dddb    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 29 Apr 2019 14:15:19 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 29 Apr 2019 14:15:19 -0400    

Click here for diff

Mistake in ab0dfc961b6a; progress reporting would have wrapped around  
for indexes created with more than 2^31 tuples.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wz=WbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A@mail.gmail.com  

M src/backend/access/hash/hashsort.c
M src/backend/access/nbtree/nbtsort.c

Fix potential assertion failure when reindexing a pg_class index.

commit   : 3dbb317d32f4f084ef7badaed8ef36f5c9b85fe6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 29 Apr 2019 19:42:04 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 29 Apr 2019 19:42:04 -0700    

Click here for diff

When reindexing individual indexes on pg_class it was possible to  
either trigger an assertion failure:  
TRAP: FailedAssertion("!(!ReindexIsProcessingIndex(((index)->rd_id)))  
  
That's because reindex_index() called SetReindexProcessing() - which  
enables an asserts ensuring no index insertions happen into the index  
- before calling RelationSetNewRelfilenode(). That not correct for  
indexes on pg_class, because RelationSetNewRelfilenode() updates the  
relevant pg_class row, which needs to update the indexes.  
  
The are two reasons this wasn't noticed earlier. Firstly the bug  
doesn't trigger when reindexing all of pg_class, as reindex_relation  
has code "hiding" all yet-to-be-reindexed indexes. Secondly, the bug  
only triggers when the the update to pg_class doesn't turn out to be a  
HOT update - otherwise there's no index insertion to trigger the  
bug. Most of the time there's enough space, making this bug hard to  
trigger.  
  
To fix, move RelationSetNewRelfilenode() to before the  
SetReindexProcessing() (and, together with some other code, to outside  
of the PG_TRY()).  
  
To make sure the error checking intended by SetReindexProcessing() is  
more robust, modify CatalogIndexInsert() to check  
ReindexIsProcessingIndex() even when the update is a HOT update.  
  
Also add a few regression tests for REINDEXing of system catalogs.  
  
The last two improvements would have prevented some of the issues  
fixed in 5c1560606dc4c from being introduced in the first place.  
  
Reported-By: Michael Paquier  
Diagnosed-By: Tom Lane and Andres Freund  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/20190418011430.GA19133@paquier.xyz  
Backpatch: 9.4-, the bug is present in all branches  

M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/sql/rewrite.sql
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix several recently introduced issues around handling new relation forks.

commit   : 5c1560606dc4c73993fb07f0176b5ec6c515a1b1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 29 Apr 2019 19:28:05 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 29 Apr 2019 19:28:05 -0700    

Click here for diff

Most of these stem from d25f519107 "tableam: relation creation, VACUUM  
FULL/CLUSTER, SET TABLESPACE.".  
  
1) To pass data to the relation_set_new_filenode()  
   RelationSetNewRelfilenode() was made to update RelationData.rd_rel  
   directly. That's not OK however, as it makes the relcache entries  
   temporarily inconsistent. Which among other scenarios is a problem  
   if a REINDEX targets an index on pg_class - the  
   CatalogTupleUpdate() in RelationSetNewRelfilenode().  Presumably  
   that was introduced because other places in the code do so - while  
   those aren't "good practice" they don't appear to be actively  
   buggy (e.g. because system tables may not be targeted).  
  
   I (Andres) should have caught this while reviewing and signficantly  
   evolving the code in that commit, mea culpa.  
  
   Fix that by instead passing in the new RelFileNode as separate  
   argument to relation_set_new_filenode() and rely on the relcache to  
   update the catalog entry. Also revert that the  
   RelationMapUpdateMap() call was changed to immediate, and undo some  
   other more unnecessary changes.  
  
2) Document that the relation_set_new_filenode cannot rely on the  
   whole relcache entry to be valid. It might be worthwhile to  
   refactor the code to never have to rely on that, but given the way  
   heap_create() is currently coded, that'd be a large change.  
  
3) ATExecSetTableSpace() shouldn't do FlushRelationBuffers() itself. A  
   table AM might not use shared buffers at all. Move to  
   index_copy_data() and heapam_relation_copy_data().  
  
4) heapam_relation_set_new_filenode() previously sometimes accessed  
   rel->rd_rel->relpersistence rather than the `persistence`  
   argument. Code movement mistake.  
  
5) Previously heapam_relation_set_new_filenode() re-opened the smgr  
   relation to create the init for, if necesary. Instead have  
   RelationCreateStorage() return the SMgrRelation and use it to  
   create the init fork.  
  
6) Add a note about the danger of modifying the relcache directly to  
   ATExecSetTableSpace() - it's currently not a bug because there's a  
   check ERRORing for catalog tables.  
  
Regression tests and assertion improvements that together trigger the  
bug described in 1) will be added in a later commit, as there is a  
related bug on all branches.  
  
Reported-By: Michael Paquier  
Diagnosed-By: Tom Lane and Andres Freund  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/20190418011430.GA19133@paquier.xyz  

M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/heap.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/access/tableam.h
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h

Remove obsolete _bt_insert_parent() comment.

commit   : 9ee7414ed0435d8946d040eb523824f2d71e2418    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 29 Apr 2019 14:14:38 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 29 Apr 2019 14:14:38 -0700    

Click here for diff

Remove a comment that refers to a coding practice that was fully removed  
by commit a8b8f4db, which introduced MarkBufferDirty().  It looks like  
the comment was even obsolete before then, since it concerns  
write-ordering dependencies with synchronous buffer writes.  

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

In walreceiver, don't try to do ereport() in a signal handler.

commit   : a1a789eb5ac894b4ca4b7742f2dc2d9602116e46    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Apr 2019 12:26:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Apr 2019 12:26:07 -0400    

Click here for diff

This is quite unsafe, even for the case of ereport(FATAL) where we won't  
return control to the interrupted code, and despite this code's use of  
a flag to restrict the areas where we'd try to do it.  It's possible  
for example that we interrupt malloc or free while that's holding a lock  
that's meant to protect against cross-thread interference.  Then, any  
attempt to do malloc or free within ereport() will result in a deadlock,  
preventing the walreceiver process from exiting in response to SIGTERM.  
We hypothesize that this explains some hard-to-reproduce failures seen  
in the buildfarm.  
  
Hence, get rid of the immediate-exit code in WalRcvShutdownHandler,  
as well as the logic associated with WalRcvImmediateInterruptOK.  
Instead, we need to take care that potentially-blocking operations  
in the walreceiver's data transmission logic (libpqwalreceiver.c)  
will respond reasonably promptly to the process's latch becoming  
set and then call ProcessWalRcvInterrupts.  Much of the needed code  
for that was already present in libpqwalreceiver.c.  I refactored  
things a bit so that all the uses of PQgetResult use latch-aware  
waiting, but didn't need to do much more.  
  
These changes should be enough to ensure that libpqwalreceiver.c  
will respond promptly to SIGTERM whenever it's waiting to receive  
data.  In principle, it could block for a long time while waiting  
to send data too, and this patch does nothing to guard against that.  
I think that that hazard is mostly theoretical though: such blocking  
should occur only if we fill the kernel's data transmission buffers,  
and we don't generally send enough data to make that happen without  
waiting for input.  If we find out that the hazard isn't just  
theoretical, we could fix it by using PQsetnonblocking, but that  
would require more ticklish changes than I care to make now.  
  
This is a bug fix, but it seems like too big a change to push into  
the back branches without much more testing than there's time for  
right now.  Perhaps we'll back-patch once we have more confidence  
in the change.  
  
Patch by me; thanks to Thomas Munro for review.  
  
Discussion: https://postgr.es/m/20190416070119.GK2673@paquier.xyz  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Fix some typos

commit   : 9c592896d9fc81d8def7b98c89a869588e76f0ea    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 29 Apr 2019 23:52:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 29 Apr 2019 23:52:42 +0900    

Click here for diff

Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/42kEeWei6VxLGh12QbR08hiI5Pm-c3XgbK7qj393PSttEhVbnnQoFXHKzXjPRZLUpndWAfHIuZuUqGZBzyXadmEUCSqm9xphWur_I8vESMA=@yesql.se  

M src/bin/pg_dump/pg_dump.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Message fixes

commit   : ffbce803e646e254367a3f0670d8b64604badc50    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 29 Apr 2019 10:05:07 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 29 Apr 2019 10:05:07 -0400    

Click here for diff

M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/check.c
M src/bin/scripts/vacuumdb.c

Fix potential catalog corruption with temporary identity columns

commit   : cd3e27464cca40664c54fb8cd10454f979c1db4e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 29 Apr 2019 08:44:51 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 29 Apr 2019 08:44:51 +0200    

Click here for diff

If a temporary table with an identity column and ON COMMIT DROP is  
created in a single-statement transaction (not useful, but allowed),  
it would leave the catalog corrupted.  We need to add a  
CommandCounterIncrement() so that PreCommit_on_commit_actions() sees  
the created dependency between table and sequence and can clean it  
up.  
  
The analogous and more useful case of doing this in a transaction  
block already runs some CommandCounterIncrement() before it gets to  
the on-commit cleanup, so it wasn't a problem in practical use.  
  
Several locations for placing the new CommandCounterIncrement() call  
were discussed.  This patch places it at the end of  
standard_ProcessUtility().  That would also help if other commands  
were to create catalog entries that some on-commit action would like  
to see.  
  
Bug: #15631  
Reported-by: Serge Latyntsev <dnsl48@gmail.com>  
Author: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  

M src/backend/tcop/utility.c

Do pre-release housekeeping on catalog data, and fix jsonpath send/recv.

commit   : c3f67ed6e434333e1bc011afc94c25d9959a86bd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 28 Apr 2019 17:16:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 28 Apr 2019 17:16:50 -0400    

Click here for diff

Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta  
tasks specified by RELEASE_CHANGES.  (The only change is 8394 -> 3428.)  
  
Also run reformat_dat_file.pl while I'm here.  
  
While looking at the reformat diffs, I chanced to notice that type  
jsonpath had typsend and typreceive = '-', which surely is not the  
intention given that jsonpath_send and jsonpath_recv exist.  
Fix that.  It's safe to assume that these functions have never been  
tested :-(.  I didn't try, but somebody should.  

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

Use preprocessor conditions compatible with Emacs indent.

commit   : 90e7f317735159116fdc3f90e287dd688b18a353    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 28 Apr 2019 12:56:53 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 28 Apr 2019 12:56:53 -0700    

Click here for diff

Emacs wrongly indented hundreds of subsequent lines.  

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

Clean up minor warnings from buildfarm.

commit   : e481d26285b160058b093588e062cf3071fea192    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 28 Apr 2019 12:45:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 28 Apr 2019 12:45:55 -0400    

Click here for diff

Be more consistent about use of XXXGetDatum macros in new jsonpath  
code.  This is mostly to avoid having code that looks randomly  
different from everyplace else that's doing the exact same thing.  
  
In pg_regress.c, avoid an unreferenced-function warning from  
compilers that don't understand pg_attribute_unused().  Putting  
the function inside the same #ifdef as its only caller is more  
straightforward coding anyway.  
  
In be-secure-openssl.c, avoid use of pg_attribute_unused() on a label.  
That's pretty creative, but there's no good reason to suppose that  
it's portable, and there's absolutely no need to use goto's here in the  
first place.  (This wasn't actually causing any buildfarm complaints,  
but it's new code in v12 so it has no portability track record.)  

M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/test/regress/pg_regress.c

Fix more typos and inconsistencies in documentation

commit   : ac862376037727e744f25030bd8b6090c707247b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 28 Apr 2019 22:53:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 28 Apr 2019 22:53:33 +0900    

Click here for diff

This fixes a couple of grammar mistakes, typos and inconsistencies in  
the documentation.  Particularly, the configuration parsing allows only  
"kB" to mean kilobyte but there were references in the docs to "KB".  
Some instances of the latter are still in the code comments.  Some  
parameter values were mentioned with "Minus-one", and using directly  
"-1" with proper markups is more helpful to the reader.  
  
Some of these have been pointed out by Justin, and some others are  
things I bumped into.  
  
Author: Justin Pryzby, Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20190330224333.GQ5815@telsasoft.com  

M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/sources.sgml

Avoid postgres_fdw crash for a targetlist entry that's just a Param.

commit   : 8cad5adb9c0be82e9f40d51b02a542439f47de9e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 27 Apr 2019 13:15:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 27 Apr 2019 13:15:54 -0400    

Click here for diff

foreign_grouping_ok() is willing to put fairly arbitrary expressions into  
the targetlist of a remote SELECT that's doing grouping or aggregation on  
the remote side, including expressions that have no foreign component to  
them at all.  This is possibly a bit dubious from an efficiency standpoint;  
but it rises to the level of a crash-causing bug if the expression is just  
a Param or non-foreign Var.  In that case, the expression will necessarily  
also appear in the fdw_exprs list of values we need to send to the remote  
server, and then setrefs.c's set_foreignscan_references will mistakenly  
replace the fdw_exprs entry with a Var referencing the targetlist result.  
  
The root cause of this problem is bad design in commit e7cb7ee14: it put  
logic into set_foreignscan_references that IMV is postgres_fdw-specific,  
and yet this bug shows that it isn't postgres_fdw-specific enough.  The  
transformation being done on fdw_exprs assumes that fdw_exprs is to be  
evaluated with the fdw_scan_tlist as input, which is not how postgres_fdw  
uses it; yet it could be the right thing for some other FDW.  (In the  
bigger picture, setrefs.c has no business assuming this for the other  
expression fields of a ForeignScan either.)  
  
The right fix therefore would be to expand the FDW API so that the  
FDW could inform setrefs.c how it intends to evaluate these various  
expressions.  We can't change that in the back branches though, and we  
also can't just summarily change setrefs.c's behavior there, or we're  
likely to break external FDWs.  
  
As a stopgap, therefore, hack up postgres_fdw so that it won't attempt  
to send targetlist entries that look exactly like the fdw_exprs entries  
they'd produce.  In most cases this actually produces a superior plan,  
IMO, with less data needing to be transmitted and returned; so we probably  
ought to think harder about whether we should ship tlist expressions at  
all when they don't contain any foreign Vars or Aggs.  But that's an  
optimization not a bug fix so I left it for later.  One case where this  
produces an inferior plan is where the expression in question is actually  
a GROUP BY expression: then the restriction prevents us from using remote  
grouping.  It might be possible to work around that (since that would  
reduce to group-by-a-constant on the remote side); but it seems like a  
pretty unlikely corner case, so I'm not sure it's worth expending effort  
solely to improve that.  In any case the right long-term answer is to fix  
the API as sketched above, and then revert this hack.  
  
Per bug #15781 from Sean Johnston.  Back-patch to v10 where the problem  
was introduced.  
  
Discussion: https://postgr.es/m/15781-2601b1002bad087c@postgresql.org  

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

Add viewBox attribute to storage page layout SVG image

commit   : 29046c44f36099f4c979b1491fcf27db2f9184f9    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Sat, 27 Apr 2019 11:36:51 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Sat, 27 Apr 2019 11:36:51 -0400    

Click here for diff

Recently added SVG image for storage page layout lacks  
a viewBox attribute which seems necessary to ensure propoer  
rendering. Add it.  
  
Author: Jonathan Katz  
Discussion: https://postgr.es/m/ba31e0e1-4c9b-b309-70e8-8e7ac14fc87e%40postgresql.org  

M doc/src/sgml/images/pagelayout.svg

Add guidance on making documentation SVG images responsive

commit   : 7dc78d8ef3e62f7e06d7767c63dcede048377b9a    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Sat, 27 Apr 2019 11:12:52 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Sat, 27 Apr 2019 11:12:52 -0400    

Click here for diff

Recently added guidance on adding SVG images to the documentation  
sources lacks advice on making the images responsive when rendered  
in a variety of media types and viewports. Add some.  
  
Patch by Jonathan Katz with some editorialization by me.  
  
Author: Jonathan Katz  
Discussion: https://postgr.es/m/6358ae6f-7191-a02b-e7b5-68050636ae71@postgresql.org  

M doc/src/sgml/images/README

Correct the URL pointing to PL/R

commit   : cf3ff97a15c184bf6a665b891f41349c8aba79fb    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Sat, 27 Apr 2019 09:27:56 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Sat, 27 Apr 2019 09:27:56 -0400    

Click here for diff

As pointed out by documentation comment, the URL for PL/R  
needs to be updated to the correct current repository. Back-patch  
to all supported branches.  

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

Update config.guess and config.sub

commit   : ddcaa596725a023c29fce34ff9914e123f225a5e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 27 Apr 2019 14:25:00 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 27 Apr 2019 14:25:00 +0200    

Click here for diff

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

Portability fix for zic.c.

commit   : 48f8fa9ce0f9799c8ae8bcd23c498fe002d5496d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 21:20:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 21:20:11 -0400    

Click here for diff

Missed an inttypes.h dependency in previous patch.  Per buildfarm.  

M src/timezone/README
M src/timezone/zic.c

Mention REINDEX CONCURRENTLY in documentation about index maintenance

commit   : a967878414f906a7f88842424c667a5ac31b9625    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 27 Apr 2019 09:06:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 27 Apr 2019 09:06:39 +0900    

Click here for diff

The documentation includes a section about index maintenance and  
reindexing, mentioning a set of steps based on CREATE INDEX CONCURRENTLY  
and ALTER TABLE (for constraint dependencies) to emulate REINDEX  
CONCURRENTLY.  Now that REINDEX CONCURRENTLY is supported, let's just  
directly mention it instead.  
  
Reported-by: Peter Geoghegan  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Tom Lane  
Discussion: https://postgr.es/m/CAH2-WzmEL168t6w29aKrKXtpq9-apcmp0HC7K-fKt6ZgLXV6Dg@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

Sync our copy of the timezone library with IANA release tzcode2019a.

commit   : acb897b806a5f4b23784b1c7e395e67b99a4362b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 19:46:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 19:46:26 -0400    

Click here for diff

This corrects a small bug in zic that caused it to output an incorrect  
year-2440 transition in the Africa/Casablanca zone.  
  
More interestingly, zic has grown a "-r" option that limits the range of  
zone transitions that it will put into the output files.  That might be  
useful to people who don't like the weird GMT offsets that tzdb likes  
to use for very old dates.  It appears that for dates before the cutoff  
time specified with -r, zic will use the zone's standard-time offset  
as of the cutoff time.  So for example one might do  
  
	make install ZIC_OPTIONS='-r @-1893456000'  
  
to cause all dates before 1910-01-01 to be treated as though 1910  
standard time prevailed indefinitely far back.  (Don't blame me for  
the unfriendly way of specifying the cutoff time --- it's seconds  
since or before the Unix epoch.  You can use extract(epoch ...)  
to calculate it.)  
  
As usual, back-patch to all supported branches.  

M src/timezone/Makefile
M src/timezone/README
M src/timezone/private.h
M src/timezone/tzfile.h
M src/timezone/zic.c

Update time zone data files to tzdata release 2019a.

commit   : d312de3fc092c784e743e58be4d1617cfb704b71    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 17:56:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 17:56:26 -0400    

Click here for diff

DST law changes in Palestine and Metlakatla.  
Historical corrections for Israel.  
  
Etc/UCT is now a backward-compatibility link to Etc/UTC, instead  
of being a separate zone that generates the abbreviation "UCT",  
which nowadays is typically a typo.  Postgres will still accept  
"UCT" as an input zone name, but it won't output it.  

M src/timezone/data/tzdata.zi
M src/timezone/known_abbrevs.txt

Update key words table for version 12

commit   : 686fef22fdba732aeca28b471a362d4fb5675675    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Apr 2019 23:23:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Apr 2019 23:23:56 +0200    

Click here for diff

M doc/src/sgml/keywords.sgml

Apply stopgap fix for bug #15672.

commit   : c01eb619a83aed460b9ead50831265f2acde3c57    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 17:18:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 Apr 2019 17:18:07 -0400    

Click here for diff

Fix DefineIndex so that it doesn't attempt to pass down a to-be-reused  
index relfilenode to a child index creation, and fix TryReuseIndex  
to not think that reuse is sensible for a partitioned index.  
  
In v11, this fixes a problem where ALTER TABLE on a partitioned table  
could assign the same relfilenode to several different child indexes,  
causing very nasty catalog corruption --- in fact, attempting to DROP  
the partitioned table then leads not only to a database crash, but to  
inability to restart because the same crash will recur during WAL replay.  
  
Either of these two changes would be enough to prevent the failure, but  
since neither action could possibly be sane, let's put in both changes  
for future-proofing.  
  
In HEAD, no such bug manifests, but that's just an accidental consequence  
of having changed the pg_class representation of partitioned indexes to  
have relfilenode = 0.  Both of these changes still seem like smart  
future-proofing.  
  
This is only a stop-gap because the code for ALTER TABLE on a partitioned  
table with a no-op type change still leaves a great deal to be desired.  
As the added regression tests show, it gets things wrong for comments on  
child indexes/constraints, and it is regenerating child indexes it doesn't  
have to.  However, fixing those problems will take more work which may not  
get back-patched into v11.  We need a fix for the corruption problem now.  
  
Per bug #15672 from Jianing Yang.  
  
Patch by me, regression test cases based on work by Amit Langote,  
who also did a lot of the investigative work.  
  
Discussion: https://postgr.es/m/15672-b9fa7db32698269f@postgresql.org  

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

pg_dump: store unused attribs as NULL instead of '\0'

commit   : 7fcdb5e002145ec95b2bebb4c125751be66c4d1a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 26 Apr 2019 12:03:59 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 26 Apr 2019 12:03:59 -0400    

Click here for diff

Commit f831d4accda0 changed pg_dump to emit (and pg_restore to  
understand) NULLs for unused members in ArchiveEntry structs, as a side  
effect of some code beautification.  That broke pg_restore of dumps  
generated with older pg_dump, however, so it was reverted in  
19455c9f5606.  Since the archiver version number has been bumped in  
3b925e905de3, we can put it back.  
  
Author: Dmitry Dolgov  
Discussion: https://postgr.es/m/CA+q6zcXx0XHqLsFJLaUU2j5BDiBAHig=YRoBC_YVq7VJGvzBEA@mail.gmail.com  

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

doc: Update section on NFS

commit   : 60bbf0753e337114d4c7d60dbc5a496b1f464cb5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Apr 2019 11:50:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Apr 2019 11:50:16 +0200    

Click here for diff

The old section was ancient and didn't seem very helpful.  Here, we  
add some concrete advice on particular mount options.  
  
Reviewed-by: Joe Conway <mail@joeconway.com>  
Discussion: https://www.postgresql.org/message-id/flat/e90f24bb-5423-6abb-58ec-501176eb4afc%402ndquadrant.com  

M doc/src/sgml/runtime.sgml

Add FDW documentation notes about insert and update tuple routing and COPY.

commit   : 90fca7a35aa7ac421f814bdfdf1fee7c30fa82f0    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 26 Apr 2019 18:10:05 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 26 Apr 2019 18:10:05 +0900    

Click here for diff

Author: Laurenz Albe and Etsuro Fujita  
Reviewed-by: Laurenz Albe and Amit Langote  
Backpatch-through: 11 where support for that by FDWs was added  
Discussion: https://postgr.es/m/bf36a0288e8f31b4f2f40952e225bf892dc1ffc5.camel@cybertec.at  

M doc/src/sgml/fdwhandler.sgml

Sanitize line pointers within contrib/amcheck.

commit   : a9ce839a31375a6c04189222706ae6b2abe96919    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 25 Apr 2019 12:50:37 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 25 Apr 2019 12:50:37 -0700    

Click here for diff

Adopt a more defensive approach to accessing index tuples in  
contrib/amcheck: verify that each line pointer looks sane before  
accessing associated tuple using pointer arithmetic based on line  
pointer's offset.  This avoids undefined behavior and assertion failures  
in cases where line pointers are corrupt.  
  
Issue spotted following a complaint about an assertion failure by  
Grigory Smolkin, which involved a test harness that deliberately  
corrupts indexes.  
  
This is arguably a bugfix, but no backpatch given the lack of field  
reports beyond Grigory's.  
  
Discussion: https://postgr.es/m/CAH2-WzmkurhCqnyLHxk0VkOZqd49+ZZsp1xAJOg7j2x7dmp_XQ@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c

Fix partitioned index attachment

commit   : 05b38c7e63d1c8bca8c07ab4c8b194eed3c50ec7    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 25 Apr 2019 10:50:14 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 25 Apr 2019 10:50:14 -0400    

Click here for diff

When an existing index in a partition is attached to a new index on  
its parent, we forgot to set the "relispartition" flag correctly, which  
meant that it was not possible to find the index in various operations,  
such as adding a foreign key constraint that references that partitioned  
table.  One of four places that was assigning the parent index was  
forgetting to do that, so fix by shifting responsibility of updating the  
flag to the routine that changes the parent.  
  
Author: Amit Langote, Álvaro Herrera  
Reported-by: Hubert "depesz" Lubaczewski  
Discussion: https://postgr.es/m/CA+HiwqHMsRtRYRWYTWavKJ8x14AFsv7bmAV46mYwnfD3vy8goQ@mail.gmail.com  

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

Fix file path in comment.

commit   : c247ae09226eeb1c3a77bb54a0736ed7da5622b5    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 25 Apr 2019 23:49:37 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 25 Apr 2019 23:49:37 +0900    

Click here for diff

M src/bin/pg_checksums/pg_checksums.c

Fix function names in comments.

commit   : 978b032d1f39fcfe9b7e895ab313913d97db2268    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 25 Apr 2019 23:43:48 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 25 Apr 2019 23:43:48 +0900    

Click here for diff

Commit 3eb77eba5a renamed some functions, but forgot to  
update some comments referencing to those functions.  
This commit fixes those function names in the comments.  
  
Kyotaro Horiguchi  

M src/backend/postmaster/checkpointer.c
M src/backend/storage/smgr/md.c
M src/backend/storage/sync/sync.c
M src/common/rmtree.c

Fix tablespace inheritance for partitioned rels

commit   : 87259588d0ab0b8e742e30596afa7ae25caadb18    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 25 Apr 2019 10:20:23 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 25 Apr 2019 10:20:23 -0400    

Click here for diff

Commit ca4103025dfe left a few loose ends.  The most important one  
(broken pg_dump output) is already fixed by virtue of commit  
3b23552ad8bb, but some things remained:  
  
* When ALTER TABLE rewrites tables, the indexes must remain in the  
  tablespace they were originally in.  This didn't work because  
  index recreation during ALTER TABLE runs manufactured SQL (yuck),  
  which runs afoul of default_tablespace in competition with the parent  
  relation tablespace.  To fix, reset default_tablespace to the empty  
  string temporarily, and add the TABLESPACE clause as appropriate.  
  
* Setting a partitioned rel's tablespace to the database default is  
  confusing; if it worked, it would direct the partitions to that  
  tablespace regardless of default_tablespace.  But in reality it does  
  not work, and making it work is a larger project.  Therefore, throw  
  an error when this condition is detected, to alert the unwary.  
  
Add some docs and tests, too.  
  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.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/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/commands/tablespace.h
M src/include/nodes/parsenodes.h
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Make pg_dump emit ATTACH PARTITION instead of PARTITION OF

commit   : 3b23552ad8bbb1384381b67f860019d14d5b680e    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 24 Apr 2019 15:30:37 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 24 Apr 2019 15:30:37 -0400    

Click here for diff

Using PARTITION OF can result in column ordering being changed from the  
database being dumped, if the partition uses a column layout different  
from the parent's.  It's not pg_dump's job to editorialize on table  
definitions, so this is not acceptable; back-patch all the way back to  
pg10, where partitioned tables where introduced.  
  
This change also ensures that partitions end up in the correct  
tablespace, if different from the parent's; this is an oversight in  
ca4103025dfe (in pg12 only).  Partitioned indexes (in pg11) don't have  
this problem, because they're already created as independent indexes and  
attached to their parents afterwards.  
  
This change also has the advantage that the partition is restorable from  
the dump (as a standalone table) even if its parent table isn't  
restored.  
  
Author: David Rowley  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com  
Discussion: https://postgr.es/m/20190423185007.GA27954@alvherre.pgsql  

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

Fix some minor postmaster-state-machine issues.

commit   : 0fae846232148754468f6d57b3f98d5b83d90af7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 24 Apr 2019 14:15:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 24 Apr 2019 14:15:44 -0400    

Click here for diff

In sigusr1_handler, don't ignore PMSIGNAL_ADVANCE_STATE_MACHINE based  
on pmState.  The restriction is unnecessary (PostmasterStateMachine  
should work in any state), not future-proof (since it makes too many  
assumptions about why the signal might be sent), and broken even today  
because a race condition can make it necessary to respond to the signal  
in PM_WAIT_READONLY state.  The race condition seems unlikely, but  
if it did happen, a hot-standby postmaster could fail to shut down  
after receiving a smart-shutdown request.  
  
In MaybeStartWalReceiver, don't clear the WalReceiverRequested flag  
if the fork attempt fails.  Leaving it set allows us to try  
again in future iterations of the postmaster idle loop.  (The startup  
process would eventually send a fresh request signal, but this change  
may allow us to retry the fork sooner.)  
  
Remove an obsolete comment and unnecessary test in  
PostmasterStateMachine's handling of PM_SHUTDOWN_2 state.  It's not  
possible to have a live walreceiver in that state, and AFAICT has not  
been possible since commit 5e85315ea.  This isn't a live bug, but the  
false comment is quite confusing to readers.  
  
In passing, rearrange sigusr1_handler's CheckPromoteSignal tests so that  
we don't uselessly perform stat() calls that we're going to ignore the  
results of.  
  
Add some comments clarifying the behavior of MaybeStartWalReceiver;  
I very nearly rearranged it in a way that'd reintroduce the race  
condition fixed in e5d494d78.  Mea culpa for not commenting that  
properly at the time.  
  
Back-patch to all supported branches.  The PMSIGNAL_ADVANCE_STATE_MACHINE  
change is the only one of even minor significance, but we might as well  
keep this code in sync across branches.  
  
Discussion: https://postgr.es/m/9001.1556046681@sss.pgh.pa.us  

M src/backend/postmaster/postmaster.c

Unify error messages

commit   : 0a999e1290fc9d8708da61017e732380bc9239a3    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 24 Apr 2019 09:26:13 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 24 Apr 2019 09:26:13 -0400    

Click here for diff

... for translatability purposes.  

M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c

postgres_fdw: Fix incorrect handling of row movement for remote partitions.

commit   : 5c47049180b8977154f99fdc7988d5846764afa2    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 24 Apr 2019 18:31:50 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 24 Apr 2019 18:31:50 +0900    

Click here for diff

Commit 3d956d9562 added support for update row movement in postgres_fdw.  
This patch fixes the following issues introduced by that commit:  
  
* When a remote partition chosen to insert routed rows into was also an  
  UPDATE subplan target rel that would be updated later, the UPDATE that  
  used a direct modification plan modified those routed rows incorrectly  
  because those routed rows were visible to the later UPDATE command.  
  The right fix for this would be to have some way in postgres_fdw in  
  which the later UPDATE command ignores those routed rows, but it seems  
  hard to do so with the current infrastructure.  For now throw an error  
  in that case.  
  
* When a remote partition chosen to insert routed rows into was also an  
  UPDATE subplan target rel, fmstate created for the UPDATE that used a  
  non-direct modification plan was mistakenly overridden by another  
  fmstate created for inserting those routed rows into the partition.  
  This caused 1) server crash when the partition would be updated later,  
  and 2) resource leak when the partition had been already updated.  To  
  avoid that, adjust the treatment of the fmstate for the inserting.  As  
  for #1, since we would also have the incorrectness issue as mentioned  
  above, error out in that case as well.  
  
Update the docs to mention that postgres_fdw currently does not handle  
the case where a remote partition chosen to insert a routed row into is  
also an UPDATE subplan target rel that will be updated later.  
  
Author: Amit Langote and Etsuro Fujita  
Reviewed-by: Amit Langote  
Backpatch-through: 11 where row movement in postgres_fdw was added  
Discussion: https://postgr.es/m/21e7eaa4-0d4d-20c2-a1f7-c7e96f4ce440@lab.ntt.co.jp  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Allow pg_class xid & multixid horizons to not be set.

commit   : fdc7efcc30b1da950ade72fd35852c21bf8de839    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 23 Apr 2019 21:42:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 23 Apr 2019 21:42:12 -0700    

Click here for diff

This allows table AMs that don't need these horizons. This was already  
documented in the tableam relation_set_new_filenode callback, but an  
assert prevented if from actually working (the test AM code contained  
the change itself). Defang the asserts in the general code, and move  
the stronger ones into heap AM.  
  
Relatedly, after CLUSTER/VACUUM, we'd always assign a relfrozenxid /  
relminmxid. Change the table_relation_copy_for_cluster() interface to  
allow the AM to overwrite the horizons that get set on the pg_class  
entry.  This'd also in the future allow AMs like heap to compute a  
relfrozenxid during rewrite that's the table's actual minimum rather  
than a pre-determined value.  Arguably it'd have been better to move  
the whole computation / setting of those values into the callback, but  
it seems likely that for other reasons it'd be better to be able to  
use one value to vacuum/cluster multiple tables (e.g. a toast's  
horizon shouldn't be different than the table's).  
  
Reported-By: Heikki Linnakangas  
Author: Andres Freund  
Discussion: https://postgr.es/m/9a7fb9cc-2419-5db7-8840-ddc10c93f122@iki.fi  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/include/access/tableam.h

Repair assorted issues in locale data extraction.

commit   : 7ad1cd31bfcbaed122993deb778e6587a226e338    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 18:51:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 18:51:30 -0400    

Click here for diff

cache_locale_time (extraction of LC_TIME-related info) had never been  
taught the lessons we previously learned about extraction of info related  
to LC_MONETARY and LC_NUMERIC.  Specifically, commit 95a777c61 taught  
PGLC_localeconv() that data coming out of localeconv() was in an encoding  
determined by the relevant locale, but we didn't realize that there's a  
similar issue with strftime().  And commit a4930e7ca hardened  
PGLC_localeconv() against errors occurring partway through, but failed  
to do likewise for cache_locale_time().  So, rearrange the latter  
function to perform encoding conversion and not risk failure while  
it's got the locales set to temporary values.  
  
This time around I also changed PGLC_localeconv() to treat it as FATAL  
if it can't restore the previous settings of the locale values.  There  
is no reason (except possibly OOM) for that to fail, and proceeding with  
the wrong locale values seems like a seriously bad idea --- especially  
on Windows where we have to also temporarily change LC_CTYPE.  Also,  
protect against the possibility that we can't identify the codeset  
reported for LC_MONETARY or LC_NUMERIC; rather than just failing,  
try to validate the data without conversion.  
  
The user-visible symptom this fixes is that if LC_TIME is set to a locale  
name that implies an encoding different from the database encoding,  
non-ASCII localized day and month names would be retrieved in the wrong  
encoding, leading to either unexpected encoding-conversion error reports  
or wrong output from to_char().  The other possible failure modes are  
unlikely enough that we've not seen reports of them, AFAIK.  
  
The encoding conversion problems do not manifest on Windows, since  
we'd already created special-case code to handle that issue there.  
  
Per report from Juan José Santamaría Flecha.  Back-patch to all  
supported versions.  
  
Juan José Santamaría Flecha and Tom Lane  
  
Discussion: https://postgr.es/m/CAC+AXB22So5aZm2vZe+MChYXec7gWfr-n-SK-iO091R0P_1Tew@mail.gmail.com  

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

Remove useless comment.

commit   : e0fb4c9d013f8c3f6eb31c5fb991e24b4af6dbb1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 17:17:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 17:17:26 -0400    

Click here for diff

Commit e439c6f0c removed IndexStmt.relationId, but not the comment  
that had been added to explain it.  Said comment was therefore  
very confusing.  

M src/include/nodes/parsenodes.h

Prevent O(N^2) unique index insertion edge case.

commit   : 9b10926263d831fac5758f1493c929a49b55669b    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 23 Apr 2019 10:33:57 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 23 Apr 2019 10:33:57 -0700    

Click here for diff

Commit dd299df8 made nbtree treat heap TID as a tiebreaker column,  
establishing the principle that there is only one correct location (page  
and page offset number) for every index tuple, no matter what.  
Insertions of tuples into non-unique indexes proceed as if heap TID  
(scan key's scantid) is just another user-attribute value, but  
insertions into unique indexes are more delicate.  The TID value in  
scantid must initially be omitted to ensure that the unique index  
insertion visits every leaf page that duplicates could be on.  The  
scantid is set once again after unique checking finishes successfully,  
which can force _bt_findinsertloc() to step right one or more times, to  
locate the leaf page that the new tuple must be inserted on.  
  
Stepping right within _bt_findinsertloc() was assumed to occur no more  
frequently than stepping right within _bt_check_unique(), but there was  
one important case where that assumption was incorrect: inserting a  
"duplicate" with NULL values.  Since _bt_check_unique() didn't do any  
real work in this case, it wasn't appropriate for _bt_findinsertloc() to  
behave as if it was finishing off a conventional unique insertion, where  
any existing physical duplicate must be dead or recently dead.  
_bt_findinsertloc() might have to grovel through a substantial portion  
of all of the leaf pages in the index to insert a single tuple, even  
when there were no dead tuples.  
  
To fix, treat insertions of tuples with NULLs into a unique index as if  
they were insertions into a non-unique index: never unset scantid before  
calling _bt_search() to descend the tree, and bypass _bt_check_unique()  
entirely.  _bt_check_unique() is no longer responsible for incoming  
tuples with NULL values.  
  
Discussion: https://postgr.es/m/CAH2-Wzm08nr+JPx4jMOa9CGqxWYDQ-_D4wtPBiKghXAUiUy-nQ@mail.gmail.com  

M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Avoid order-of-execution problems with ALTER TABLE ADD PRIMARY KEY.

commit   : f4a3fdfbdcd3763c42111318d004c2e90d072021    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 12:25:27 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 12:25:27 -0400    

Click here for diff

Up to now, DefineIndex() was responsible for adding attnotnull constraints  
to the columns of a primary key, in any case where it hadn't been  
convenient for transformIndexConstraint() to mark those columns as  
is_not_null.  It (or rather its minion index_check_primary_key) did this  
by executing an ALTER TABLE SET NOT NULL command for the target table.  
  
The trouble with this solution is that if we're creating the index due  
to ALTER TABLE ADD PRIMARY KEY, and the outer ALTER TABLE has additional  
sub-commands, the inner ALTER TABLE's operations executed at the wrong  
time with respect to the outer ALTER TABLE's operations.  In particular,  
the inner ALTER would perform a validation scan at a point where the  
table's storage might be inconsistent with its catalog entries.  (This is  
on the hairy edge of being a security problem, but AFAICS it isn't one  
because the inner scan would only be interested in the tuples' null  
bitmaps.)  This can result in unexpected failures, such as the one seen  
in bug #15580 from Allison Kaptur.  
  
To fix, let's remove the attempt to do SET NOT NULL from DefineIndex(),  
reducing index_check_primary_key's role to verifying that the columns are  
already not null.  (It shouldn't ever see such a case, but it seems wise  
to keep the check for safety.)  Instead, make transformIndexConstraint()  
generate ALTER TABLE SET NOT NULL subcommands to be executed ahead of  
the ADD PRIMARY KEY operation in every case where it can't force the  
column to be created already-not-null.  This requires only minor surgery  
in parse_utilcmd.c, and it makes for a much more satisfying spec for  
transformIndexConstraint(): it's no longer having to take it on faith  
that someone else will handle addition of NOT NULL constraints.  
  
To make that work, we have to move the execution of AT_SetNotNull into  
an ALTER pass that executes ahead of AT_PASS_ADD_INDEX.  I moved it to  
AT_PASS_COL_ATTRS, and put that after AT_PASS_ADD_COL to avoid failure  
when the column is being added in the same command.  This incidentally  
fixes a bug in the only previous usage of AT_PASS_COL_ATTRS, for  
AT_SetIdentity: it didn't work either for a newly-added column.  
  
Playing around with this exposed a separate bug in ALTER TABLE ONLY ...  
ADD PRIMARY KEY for partitioned tables.  The intent of the ONLY modifier  
in that context is to prevent doing anything that would require holding  
lock for a long time --- but the implied SET NOT NULL would recurse to  
the child partitions, and do an expensive validation scan for any child  
where the column(s) were not already NOT NULL.  To fix that, invent a  
new ALTER subcommand AT_CheckNotNull that just insists that a child  
column be already NOT NULL, and apply that, not AT_SetNotNull, when  
recursing to children in this scenario.  This results in a slightly laxer  
definition of ALTER TABLE ONLY ... SET NOT NULL for partitioned tables,  
too: that command will now work as long as all children are already NOT  
NULL, whereas before it just threw up its hands if there were any  
partitions.  
  
In passing, clean up the API of generateClonedIndexStmt(): remove a  
useless argument, ensure that the output argument is not left undefined,  
update the header comment.  
  
A small side effect of this change is that no-such-column errors in ALTER  
TABLE ADD PRIMARY KEY now produce a different message that includes the  
table name, because they are now detected by the SET NOT NULL step which  
has historically worded its error that way.  That seems fine to me, so  
I didn't make any effort to avoid the wording change.  
  
The basic bug #15580 is of very long standing, and these other bugs  
aren't new in v12 either.  However, this is a pretty significant change  
in the way ALTER TABLE ADD PRIMARY KEY works.  On balance it seems best  
not to back-patch, at least not till we get some more confidence that  
this patch has no new bugs.  
  
Patch by me, but thanks to Jie Zhang for a preliminary version.  
  
Discussion: https://postgr.es/m/15580-d1a6de5a3d65da51@postgresql.org  
Discussion: https://postgr.es/m/1396E95157071C4EBBA51892C5368521017F2E6E63@G08CNEXMBPEKD02.g08.fujitsu.local  

M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/identity.out
M src/test/regress/expected/indexing.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/identity.sql
M src/test/regress/sql/indexing.sql

Don't request pretty-printed output from xmlNodeDump().

commit   : c06e3550dc4163c3ff29a87283b605f0beb50bed    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 10:51:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Apr 2019 10:51:07 -0400    

Click here for diff

xml.c passed format = 1 to xmlNodeDump(), resulting in sometimes getting  
extra whitespace (newlines + spaces) in the output.  We don't really want  
that, first because whitespace might be semantically significant in some  
XML uses, and second because it happens only very inconsistently.  Only  
one case in our regression tests is affected.  
  
This potentially affects the results of xpath() and the XMLTABLE construct,  
when emitting nodeset values.  
  
Note that the older code in contrib/xml2 doesn't do this; it seems  
to have been an aboriginal bad decision in commit ea3b212fe.  
  
While this definitely seems like a bug to me, the small number of  
complaints to date argues against back-patching a behavioral change.  
Hence, fix in HEAD only, at least for now.  
  
Per report from Jean-Marc Voillequin.  
  
Discussion: https://postgr.es/m/1EC8157EB499BF459A516ADCF135ADCE3A23A9CA@LON-WGMSX712.ad.moodys.net  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_2.out

Fix detection of passwords hashed with MD5 or SCRAM-SHA-256

commit   : ccae190b916f27fbe4079ee4664d34cd1be47b79    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 23 Apr 2019 15:43:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 23 Apr 2019 15:43:21 +0900    

Click here for diff

This commit fixes a couple of issues related to the way password  
verifiers hashed with MD5 or SCRAM-SHA-256 are detected, leading to  
being able to store in catalogs passwords which do not follow the  
supported hash formats:  
- A MD5-hashed entry was checked based on if its header uses "md5" and  
if the string length matches what is expected.  Unfortunately the code  
never checked if the hash only used hexadecimal characters, as reported  
by Tom Lane.  
- A SCRAM-hashed entry was checked based on only its header, which  
should be "SCRAM-SHA-256$", but it never checked for any fields  
afterwards, as reported by Jonathan Katz.  
  
Backpatch down to v10, which is where SCRAM has been introduced, and  
where password verifiers in plain format have been removed.  
  
Author: Jonathan Katz  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/016deb6b-1f0a-8e9f-1833-a8675b170aa9@postgresql.org  
Backpatch-through: 10  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/include/common/md5.h
M src/include/libpq/scram.h
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Convert gist to compute page level xid horizon on primary.

commit   : b5f58cf213bdab7e726f7b09c1137b4ea397fc0b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Apr 2019 14:28:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Apr 2019 14:28:30 -0700    

Click here for diff

Due to parallel development, gist added the missing conflict  
information in c952eae52a3, while 558a9165e08 moved that computation  
to the primary for the index types that already had it.  Thus adapt  
gist to also compute on the primary, using  
index_compute_xid_horizon_for_tuples() instead of its own copy of the  
logic.  
  
This also adds pg_waldump support for XLOG_GIST_DELETE records, which  
previously was not properly present.  
  
Bumps WAL version.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20190406050243.bszosdg4buvabfrt@alap3.anarazel.de  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/xlog_internal.h

Fix documentation of pg_start_backup and pg_stop_backup functions.

commit   : b804c1837b55722369d30be707738c098a75cd7a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 23 Apr 2019 02:41:58 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 23 Apr 2019 02:41:58 +0900    

Click here for diff

This commit adds the description that "non-exclusive" pg_start_backup  
and pg_stop_backup can be executed even during recovery. Previously  
it was wrongly documented that those functions are not allowed to be  
executed during recovery.  
  
Back-patch to 9.6 where non-exclusive backup API was added.  
  
Discussion: https://postgr.es/m/CAHGQGwEuAYrEX7Yhmf2MCrTK81HDkkg-JqsOUh8zw6+zYC5zzw@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix mvdistinct and dependencies size calculations

commit   : d08c44f7a4ec574110bf1587fe8bd682b8557e0f    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 21 Apr 2019 19:54:15 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 21 Apr 2019 19:54:15 +0200    

Click here for diff

The formulas used to calculate size while (de)serializing mvndistinct  
and functional dependencies were based on offset() of the structs. But  
that is incorrect, because the structures are not copied directly, we  
we copy the individual fields directly.  
  
At the moment this works fine, because there is no alignment padding  
on any platform we support. But it might break if we ever added some  
fields into any of the structs, for example. It's also confusing.  
  
Fixed by reworking the macros to directly sum sizes of serialized  
fields. The macros are now useful only for serialiation, so there is  
no point in keeping them in the public header file. So make them  
private by moving them to the .c files.  
  
Also adds a couple more asserts to check the serialization, and fixes  
an incorrect allocation of MVDependency instead of (MVDependency *).  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/29785.1555365602@sss.pgh.pa.us  

M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/include/statistics/statistics.h

docs: reorder collation regression test order in paragraph

commit   : bfbc150e39515c08a5691c7da4291d1b9f2b2b9c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 Apr 2019 11:18:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 Apr 2019 11:18:43 -0400    

Click here for diff

Backpatch-through: 10  

M doc/src/sgml/regress.sgml

GSSAPI: Improve documentation and tests

commit   : eb882a1b717589777e068dc6671830226f3aa7f0    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Fri, 19 Apr 2019 21:22:22 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Fri, 19 Apr 2019 21:22:22 -0400    

Click here for diff

The GSSAPI encryption patch neglected to update the protocol  
documentation to describe how to set up a GSSAPI encrypted connection  
from a client to the server, so fix that by adding the appropriate  
documentation to protocol.sgml.  
  
The tests added for encryption support were overly long and couldn't be  
run in parallel due to race conditions; this was largely because each  
test was setting up its own KDC to perform the tests.  Instead, merge  
the authentication tests and the encryption tests into the original  
test, where we only create one KDC to run the tests with.  Also, have  
the tests check what the server's opinion is of the connection and if it  
was GSS authenticated or encrypted using the pg_stat_gssapi view.  
  
In passing, fix the libpq label for GSSENC-Mode to be consistent with  
the "PGGSSENCMODE" environment variable.  
  
Missing protocol documentation pointed out by Michael Paquier.  
Issues with the tests pointed out by Tom Lane and Peter Eisentraut.  
  
Refactored tests and added documentation by me.  
  
Reviewed by Robbie Harwood (protocol documentation) and Michael Paquier  
(rework of the tests).  

M doc/src/sgml/protocol.sgml
M src/interfaces/libpq/fe-connect.c
M src/test/kerberos/t/001_auth.pl
D src/test/kerberos/t/002_enc.pl

Fix slot type issue for fuzzy distance index scan over out-of-core table AM.

commit   : b8b94ea129ffc988c2d30eb2b5aa65a93329b8fa    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Apr 2019 11:25:48 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Apr 2019 11:25:48 -0700    

Click here for diff

For amcanreorderby scans the nodeIndexscan.c's reorder queue holds  
heap tuples, but the underlying table likely does not. Before this fix  
we'd return different types of slots, depending on whether the tuple  
came from the reorder queue, or from the index + table.  
  
While that could be fixed by signalling that the node doesn't return a  
fixed type of slot, it seems better to instead remove the separate  
slot for the reorder queue, and use ExecForceStoreHeapTuple() to store  
tuples from the queue. It's not particularly common to need  
reordering, after all.  
  
This reverts most of the iss_ReorderQueueSlot related changes to  
nodeIndexscan.c made in 1a0586de3657cd3, except that now  
ExecForceStoreHeapTuple() is used instead of ExecStoreHeapTuple().  
  
Noticed when testing zheap against the in-core version of tableam.  
  
Author: Andres Freund  

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

Fix two memory leaks around force-storing tuples in slots.

commit   : 88e6ad3054ddd5aa0dee12e5def2c335fe92a414    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Apr 2019 11:33:37 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Apr 2019 11:33:37 -0700    

Click here for diff

As reported by Tom, when ExecStoreMinimalTuple() had to perform a  
conversion to store the minimal tuple in the slot, it forgot to  
respect the shouldFree flag, and leaked the tuple into the current  
memory context if true.  Fix that by freeing the tuple in that case.  
  
Looking at the relevant code made me (Andres) realize that not having  
the shouldFree parameter to ExecForceStoreHeapTuple() was a bad  
idea. Some callers had to locally implement the necessary logic, and  
in one case it was missing, creating a potential per-group leak in  
non-hashed aggregation.  
  
The choice to not free the tuple in ExecComputeStoredGenerated() is  
not pretty, but not introduced by this commit - I'll start a separate  
discussion about it.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/366.1555382816@sss.pgh.pa.us  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/trigger.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/tuptable.h

Fix problems with auto-held portals.

commit   : 4d5840cea96d7f893389664dd423716b38fded7a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 Apr 2019 11:20:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 Apr 2019 11:20:37 -0400    

Click here for diff

HoldPinnedPortals() did things in the wrong order: it must not mark  
a portal autoHeld until it's been successfully held.  Otherwise,  
a failure while persisting the portal results in a server crash  
because we think the portal is in a good state when it's not.  
  
Also add a check that portal->status is READY before attempting to  
hold a pinned portal.  We have such a check before the only other  
use of HoldPortal(), so it seems unwise not to check it here.  
  
Lastly, rethink the responsibility for where to call HoldPinnedPortals.  
The comment for it imagined that it was optional for any individual PL  
to call it or not, but that cannot be the case: if some outer level of  
procedure has a pinned portal, failing to persist it when an inner  
procedure commits is going to be trouble.  Let's have SPI do it instead  
of the individual PLs.  That's not a complete solution, since in theory  
a PL might not be using SPI to perform commit/rollback, but such a PL  
is going to have to be aware of lots of related requirements anyway.  
(This change doesn't cause an API break for any external PLs that might  
be calling HoldPinnedPortals per the old regime, because calling it  
twice during a commit or rollback sequence won't hurt.)  
  
Per bug #15703 from Julian Schauder.  Back-patch to v11 where this code  
came in.  
  
Discussion: https://postgr.es/m/15703-c12c5bc0ea34ba26@postgresql.org  

M src/backend/executor/spi.c
M src/backend/utils/mmgr/portalmem.c
M src/pl/plperl/plperl.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
M src/pl/plpython/plpy_plpymodule.c

Fix collection of typos and grammar mistakes in docs and comments

commit   : 148266fa354a47543f6c0325cd1ea900ead4aac6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Apr 2019 16:57:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Apr 2019 16:57:40 +0900    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20190330224333.GQ5815@telsasoft.com  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/optimizer/plan/planner.c
M src/backend/utils/hash/dynahash.c
M src/interfaces/libpq/fe-auth.c

Clean up some documentation for log_statement_sample_rate

commit   : bc540f98599b875e7ee67086291cdb96997db3fc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Apr 2019 16:26:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Apr 2019 16:26:41 +0900    

Click here for diff

This was missing from 88bdbd3.  
  
Author: Christoph Berg, Justin Pryzby  
Discussion: https://postgr.es/m/20190403215938.GA26375@alvherre.pgsql  
Discussion: https://postgr.es/m/20190330224333.GQ5815@telsasoft.com  

M doc/src/sgml/config.sgml

Remove dependency to pageinspect in recovery tests

commit   : 5a9323eab6e2c47e4caee9ab4b5117ba01368253    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Apr 2019 15:51:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Apr 2019 15:51:23 +0900    

Click here for diff

If contrib/pageinspect is not installed, this causes the test checking  
the minimum recovery point to fail.  The point is that the dependency  
with pageinspect is not really necessary as the test does also all  
checks with an offline cluster by scanning directly the on-disk pages,  
which is enough for the purpose of the test.  
  
Per complaint from Tom Lane.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/17806.1555566345@sss.pgh.pa.us  

M src/test/recovery/Makefile
M src/test/recovery/t/016_min_consistency.pl

Fix potential use-after-free for BEFORE UPDATE row triggers on non-core AMs.

commit   : 75e03eabeaac8fd229b14f74de55d0e1470903c4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 18 Apr 2019 17:53:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 18 Apr 2019 17:53:54 -0700    

Click here for diff

When such a trigger returns the old row version, it naturally get  
stored in the slot for the trigger result. When a table AMs doesn't  
store HeapTuples internally, ExecBRUpdateTriggers() frees the old row  
version passed to triggers - but before this fix it might still be  
referenced by the slot holding the new tuple.  
  
Noticed when running the out-of-core zheap AM against the in-core  
version of tableam.  
  
Author: Andres Freund  

M src/backend/commands/trigger.c

Fix handling of temp and unlogged tables in FOR ALL TABLES publications

commit   : bb385c4fb0f4eb33d2bc7e484061565ba51cc790    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 Apr 2019 10:37:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 Apr 2019 10:37:44 +0200    

Click here for diff

If a FOR ALL TABLES publication exists, temporary and unlogged tables  
are ignored for publishing changes.  But CheckCmdReplicaIdentity()  
would still check in that case that such a table has a replica  
identity set before accepting updates.  To fix, have  
GetRelationPublicationActions() return that such a table publishes no  
actions.  
  
Discussion: https://www.postgresql.org/message-id/f3f151f7-c4dd-1646-b998-f60bd6217dd3@2ndquadrant.com  

M src/backend/utils/cache/relcache.c
M src/test/subscription/t/100_bugs.pl

docs: correct typo-ed path to heapam_handler.c.

commit   : 1cebfdee0087624af2fc99a000642c2db4dfbfc9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 Apr 2019 17:31:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 Apr 2019 17:31:54 -0700    

Click here for diff

Reported-By: Michael Paquier, Michel Pelletier  
Discussion:  
   https://postgr.es/m/20190410025531.GA2728@paquier.xyz  
   https://postgr.es/m/CACxu=v+u_QTeFqdajCHv3i4QmzV_63arVb57R19dSKtThdSLkQ@mail.gmail.com  

M doc/src/sgml/tableam.sgml

pg_dump: Remove stray option parsing support for -o.

commit   : 4d0183592764629d38182e30642b1aef8baeb987    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 Apr 2019 17:28:02 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 Apr 2019 17:28:02 -0700    

Click here for diff

I (Andres) missed this in 578b229718e8f, the removal of WITH OIDS  
support.  
  
Author: Daniel Verite  
Discussion: https://postgr.es/m/f06e9735-3717-4904-8c95-47d0b9c3bb10@manitou-mail.org  

M src/bin/pg_dump/pg_dump.c

docs: cleanup/remove/update references to OID column.

commit   : f6b39171f3d65155b9390c2c69bc5b3469f923a8    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 Apr 2019 17:22:56 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 Apr 2019 17:22:56 -0700    

Click here for diff

I (Andres) missed these in 578b229718e8f.  
  
Author: Justin Pryzby, editorialized a bit by Andres Freund  
Reviewed-By: Daniel Verite, Andres Freund  
Discussion: https://postgr.es/m/20190408002847.GA904@telsasoft.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/spi.sgml

Tie loose ends in psql's new \dP command

commit   : 421a2c48328c88eb31f6b29979218f0a350bb739    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 Apr 2019 18:35:41 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 Apr 2019 18:35:41 -0400    

Click here for diff

* Remove one unnecessary pg_class join in SQL command.  Not needed,  
  because we use a regclass cast instead.  
  
* Doc: refer to "partitioned relations" rather than specifically tables,  
  since indexes are also displayed.  
  
* Rename "On table" column to "Table", for consistency with \di.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20190407212525.GB10080@telsasoft.com  

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

psql: display tablespace for partitioned indexes

commit   : b036982db786f7ef6c118419e7e832167ad4a6a7    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 Apr 2019 18:17:43 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 Apr 2019 18:17:43 -0400    

Click here for diff

Nothing was shown previously.  

M src/bin/psql/describe.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

postgresql.conf.sample: add proper defaults for include actions

commit   : fb9c475597c245562a28d1e916b575ac4ec5c19f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 17 Apr 2019 18:12:10 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 17 Apr 2019 18:12:10 -0400    

Click here for diff

Previously, include actions include_dir, include_if_exists, and include  
listed commented-out values which were not the defaults, which is  
inconsistent with other entries.  Instead, replace them with '', which  
is the default value.  
  
Reported-by: Emanuel Araújo  
  
Discussion: https://postgr.es/m/CAMuTAkYMx6Q27wpELDR3_v9aG443y7ZjeXu15_+1nGUjhMWOJA@mail.gmail.com  
  
Backpatch-through: 9.4  

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

docs: clarify pg_upgrade's recovery behavior

commit   : 64bbe1039962a75cb292fb557e2e79a58c77ec33    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 17 Apr 2019 18:01:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 17 Apr 2019 18:01:02 -0400    

Click here for diff

The previous paragraph trying to explain --check, --link, and no --link  
modes and the various points of failure was too complex.  Instead, use  
bullet lists and sublists.  
  
Reported-by: Daniel Gustafsson  
  
Discussion: https://postgr.es/m/qtqiv7hI87s_Xvz5ZXHCaH-1-_AZGpIDJowzlRjF3-AbCr3RhSNydM_JCuJ8DE4WZozrtxhIWmyYTbv0syKyfGB6cYMQitp9yN-NZMm-oAo=@yesql.se  
  
Backpatch-through: 9.4  

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

Fix unportable code in pgbench.

commit   : 1a75c1d0c5d967ea2adcd7129092687cded4e7bf    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Apr 2019 17:30:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Apr 2019 17:30:29 -0400    

Click here for diff

The buildfarm points out that UINT64_FORMAT might not work with sscanf;  
it's calibrated for our printf implementation, which might not agree  
with the platform-supplied sscanf.  Fall back to just accepting an  
unsigned long, which is already more than the documentation promises.  
  
Oversight in e6c3ba7fb; back-patch to v11, as that was.  

M src/bin/pgbench/pgbench.c

Fix assorted minor bogosity in GSSAPI transport error messages.

commit   : 8cde7f49483d7e21569f61108fc80a8fe9e83e56    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Apr 2019 17:06:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Apr 2019 17:06:50 -0400    

Click here for diff

I noted that some buildfarm members were complaining about %ld being  
used to format values that are (probably) declared size_t.  Use %zu  
instead, and insert a cast just in case some versions of the GSSAPI  
API declare the length field differently.  While at it, clean up  
gratuitous differences in wording of equivalent messages, show  
the complained-of length in all relevant messages not just some,  
include trailing newline where needed, adjust random deviations  
from project-standard code layout and message style, etc.  

M src/backend/libpq/be-secure-gssapi.c
M src/interfaces/libpq/fe-secure-gssapi.c

Minor jsonpath fixes.

commit   : b4f96d69ad197731c1f5b959e1234c9ba3517ecb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Apr 2019 13:37:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Apr 2019 13:37:00 -0400    

Click here for diff

Restore missed "make clean" rule, fix misspelling.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CACPNZCt5B8jDCCGQiFoSuqmg-za_NCy4QDioBTLaNRih9+-bXg@mail.gmail.com  

M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonpath_scan.l

Return NULL for checksum failures if checksums are not enabled

commit   : 252b707bc41cc9bf6c55c18d8cb302a6176b7e48    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Wed, 17 Apr 2019 13:51:48 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Wed, 17 Apr 2019 13:51:48 +0200    

Click here for diff

Returning 0 could falsely indicate that there is no problem. NULL  
correctly indicates that there is no information about potential  
problems.  
  
Also return 0 as numbackends instead of NULL for shared objects (as no  
connection can be made to a shared object only).  
  
Author: Julien Rouhaud <rjuju123@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/pgstatfuncs.c
M src/test/regress/expected/rules.out

Fix thinko introduced by 82a5649 in slot.c

commit   : 9010156445c420361c2cef9557751c0b8b52644b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Apr 2019 10:01:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Apr 2019 10:01:22 +0900    

Click here for diff

When saving a replication slot, failing to close the temporary path used  
to save the slot information is considered as a failure and reported as  
such.  However the code forgot to leave immediately as other failure  
paths do.  
  
Noticed while looking up at this area of the code for another patch.  

M src/backend/replication/slot.c

Simplify some ERROR paths clearing wait events and transient files

commit   : 47ac2033d460cefbbda2e39732e18de521dc6a36    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Apr 2019 09:51:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Apr 2019 09:51:45 +0900    

Click here for diff

Transient files and wait events get normally cleaned up when seeing an  
exception (be it in the context of a transaction for a backend or  
another process like the checkpointer), hence there is little point in  
complicating error code paths to do this work.  This shaves a bit of  
code, and removes some extra handling with errno which needed to be  
preserved during the cleanup steps done.  
  
Reported-by: Masahiko Sawada  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDhHYVq5KkXfkaHhmjA-zJYj-e4teiRAJefvXuKJz1tKQ@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/file/copydir.c

Rework handling of invalid indexes with REINDEX CONCURRENTLY

commit   : a6dcf9df4d91ff0db23579f9114079abe6f3e2bf    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Apr 2019 09:33:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Apr 2019 09:33:51 +0900    

Click here for diff

Per discussion with others, allowing REINDEX INDEX CONCURRENTLY to work  
for invalid indexes when working directly on them can have a lot of  
value to unlock situations with invalid indexes without having to use a  
dance involving DROP INDEX followed by an extra CREATE INDEX  
CONCURRENTLY (which would not work for indexes with constraint  
dependency anyway).  This also does not create extra bloat on the  
relation involved as this works on individual indexes, so let's enable  
it.  
  
Note that REINDEX TABLE CONCURRENTLY still bypasses invalid indexes as  
we don't want to bloat the number of indexes defined on a relation in  
the event of multiple and successive failures of REINDEX CONCURRENTLY.  
  
More regression tests are added to cover those behaviors, using an  
invalid index created with CREATE INDEX CONCURRENTLY.  
  
Reported-by: Dagfinn Ilmari Mannsåker, Álvaro Herrera  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/20190411134947.GA22043@alvherre.pgsql  

M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/reindex.sgml
M src/backend/commands/indexcmds.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Add index terms for reloptions in documentation.

commit   : c8e0f6bbdb5ff0f235246af5b567b21dcfc1d22a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 16 Apr 2019 23:16:20 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 16 Apr 2019 23:16:20 +0900    

Click here for diff

Author: Fujii Masao  
Reviewed-By: Alvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwHyKt9-xkibVguPzYqKgb_2tdw14Ub1XDTu08kyHMiTQA@mail.gmail.com  

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

Better scaling of images in HTML output

commit   : e446cde16d676b528f3aa91dcbe5bb9c5a3776d8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 Apr 2019 14:27:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 Apr 2019 14:27:56 +0200    

Click here for diff

Turn on the previously disabled automatic scaling of images in HTML  
output.  To avoid images looking too large on nowadays-normal screens,  
restrict the width to 75% on such screens.  
  
Some work is still necessary because SVG images without a viewBox  
still won't scale, but that will a separate patch.  
  
Discussion: https://www.postgresql.org/message-id/flat/6d2442d1-84a2-36ef-e014-b6d1ece8a139%40postgresql.org  

M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/stylesheet.css

Remove duplicate assignment when initializing logical decoder context

commit   : 5ed4b123b6a678bc6243047846870f7f46e9c67b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Apr 2019 15:08:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Apr 2019 15:08:38 +0900    

Click here for diff

The private data in the WAL reader is already getting set when  
allocating it.  
  
Author: Antonin Houska  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/30563.1555329094@localhost  

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

Don't write to stdin of a test process that could have already exited.

commit   : e12a4726127b90b8fc5e75690fe4527f1866412d    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 15 Apr 2019 18:13:44 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 15 Apr 2019 18:13:44 -0700    

Click here for diff

Instead, close that stdin.  Per buildfarm member conchuela.  Back-patch  
to 9.6, where the test was introduced.  
  
Discussion: https://postgr.es/m/26478.1555373328@sss.pgh.pa.us  

M src/test/recovery/t/017_shm.pl

Use [FLEXIBLE_ARRAY_MEMBER] not [1] in MultiSortSupportData.

commit   : dde7fb7836c7428f79cb3cd88ca5febb802e767e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Apr 2019 19:32:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Apr 2019 19:32:36 -0400    

Click here for diff

This struct seems to have not gotten the word about preferred  
coding style for variable-length arrays.  

M src/include/statistics/extended_stats_internal.h

Convert pre-existing stats_ext tests to new style

commit   : dbb984128ebf6b4bd6f12b4579ee9103ef1ca749    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 16 Apr 2019 00:02:22 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 16 Apr 2019 00:02:22 +0200    

Click here for diff

The regression tests added in commit 7300a69950 test cardinality  
estimates using a function that extracts the interesting pieces  
from the EXPLAIN output, instead of testing the whole plan. That  
seems both easier to understand and less fragile, so this applies  
the same approach to pre-existing tests of ndistinct coefficients  
and functional dependencies.  
  
Discussion: https://postgr.es/m/dfdac334-9cf2-2597-fb27-f0fb3753f435@2ndquadrant.com  

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

Fix pg_mcv_list deserialization

commit   : 3824ca30d162611fdaade403d3aec449fecd0924    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 16 Apr 2019 00:01:39 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 16 Apr 2019 00:01:39 +0200    

Click here for diff

The memcpy() was copying type OIDs in the wrong direction, so the  
deserialized MCV list always had them as 0. This is mostly harmless  
except when printing the data in pg_mcv_list_items(), in which case  
it reported  
  
    ERROR:  cache lookup failed for type 0  
  
Also added a simple regression test for pg_mcv_list_items() function,  
printing a single-item MCV list.  
  
Reported-By: Dean Rasheed  
Discussion: https://postgr.es/m/CAEZATCX6T0iDTTZrqyec4Cd6b4yuL7euu4=rQRXaVBAVrUi1Cg@mail.gmail.com  

M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix failure with textual partition hash keys.

commit   : 4b40e44f07c727c7a82b291d3b60098dd99f3f64    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Apr 2019 16:47:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Apr 2019 16:47:09 -0400    

Click here for diff

Commit 5e1963fb7 overlooked two places in partbounds.c that now  
need to pass a collation identifier to the hash functions for  
a partition key column.  
  
Amit Langote, per report from Jesper Pedersen  
  
Discussion: https://postgr.es/m/a620f85a-42ab-e0f3-3337-b04b97e2e2f5@redhat.com  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/hash_part.out
M src/test/regress/sql/hash_part.sql

Avoid possible regression test instability in timestamp.sql.

commit   : 47169c25500a70a7d04076860717f2f4f0ea83a7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Apr 2019 16:19:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Apr 2019 16:19:51 -0400    

Click here for diff

Concurrent autovacuum could result in a change in the order of the  
live rows in timestamp_tbl.  While this would not happen with the  
default autovacuum parameters, it's fairly easy to hit if  
autovacuum_vacuum_threshold is made small enough to allow autovac  
to decide to process this table.  That's a stumbling block for trying  
to exercise autovacuum aggressively using the core regression tests.  
  
To fix, replace an unqualified DELETE with a TRUNCATE.  There's a  
similar DELETE just above (and no order-sensitive queries between),  
so this doesn't lose any test coverage and might indeed be argued  
to improve it.  
  
Discussion: https://postgr.es/m/17428.1555348950@sss.pgh.pa.us  

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

Fix division by zero in _bt_vacuum_needs_cleanup()

commit   : 1e871981823a68ec9e0174b652e8d27e05ce08bb    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 15 Apr 2019 20:20:43 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 15 Apr 2019 20:20:43 +0300    

Click here for diff

Checks inside _bt_vacuum_needs_cleanup() allow division by zero to happen when  
metad->btm_last_cleanup_num_heap_tuples == 0.  This commit adjusts the  
expression so that no division by zero might happen.  
  
Reported-by: Piotr Stefaniak  
Discussion: https://postgr.es/m/DB8PR03MB5931C41F7787A95313F08322F22A0%40DB8PR03MB5931.eurprd03.prod.outlook.com  
Reviewed-by: Masahiko Sawada  
Backpatch-through: 11  

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

Fix thinko in ExecCleanupTupleRouting().

commit   : 3a45321a491711b556d2cf8f6904ab989b9d0b08    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 15 Apr 2019 19:01:09 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 15 Apr 2019 19:01:09 +0900    

Click here for diff

Commit 3f2393edef changed ExecCleanupTupleRouting() so that it skipped  
cleaning up subplan resultrels before calling EndForeignInsert(), but  
that would cause an issue: when those resultrels were foreign tables,  
the FDWs would fail to shut down.  Repair by skipping it after calling  
EndForeignInsert() as before.  
  
Author: Etsuro Fujita  
Reviewed-by: David Rowley and Amit Langote  
Discussion: https://postgr.es/m/5CAF3B8F.2090905@lab.ntt.co.jp  

M src/backend/executor/execPartition.c

Unbreak index optimization for LIKE on bytea

commit   : abb9c63b2c00109183cdb9f588d2f23fc383ed38    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 Apr 2019 09:26:23 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 Apr 2019 09:26:23 +0200    

Click here for diff

The same code is used to handle both text and bytea, but bytea is not  
collation-aware, so we shouldn't call get_collation_isdeterministic()  
in that case, since that will error out with an invalid collation.  
  
Reported-by: Jeevan Chalke <jeevan.chalke@enterprisedb.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAM2%2B6%3DWaf3qJ1%3DyVTUH8_yG-SC0xcBMY%2BSFLhvKKNnWNXSUDBw%40mail.gmail.com  

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

Fix SHOW ALL command for non-superusers with replication connection

commit   : c34677fdaa73f089d557554a9cd479b9bd5b5143    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Apr 2019 12:34:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Apr 2019 12:34:32 +0900    

Click here for diff

Since Postgres 10, SHOW commands can be triggered with replication  
connections in a WAL sender context, however it missed that a  
transaction context is needed for syscache lookups.  This commit makes  
sure that the syscache lookups can happen correctly by setting a  
transaction context when running SHOW commands in a WAL sender.  
  
Superuser-only parameters can be displayed using SHOW commands not only  
to superusers, but also to members of system role pg_read_all_settings,  
which requires a syscache lookup to check if the connected role is a  
member of this system role or not, or the instance crashes.  Superusers  
do not need to check the syscache so it worked correctly in this case.  
  
New tests are added to cover this issue.  
  
Reported-by: Alexander Kukushkin  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/15734-2daa8761eeed8e20@postgresql.org  
Backpatch-through: 10  

M src/backend/replication/walsender.c
M src/test/recovery/t/001_stream_rep.pl

Test both 0.0.0.0 and 127.0.0.x addresses to find a usable port.

commit   : 4ab02e8156270592c1eae03d5b9ee36bb8c761c2    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 14 Apr 2019 20:02:19 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 14 Apr 2019 20:02:19 -0700    

Click here for diff

Commit c098509927f9a49ebceb301a2cb6a477ecd4ac3c changed  
PostgresNode::get_new_node() to probe 0.0.0.0 instead of 127.0.0.1, but  
the new test was less effective for Windows native Perl.  This increased  
the failure rate of buildfarm members bowerbird and jacana.  Instead,  
test 0.0.0.0 and concrete addresses.  This restores the old level of  
defense, but the algorithm is still subject to its longstanding time of  
check to time of use race condition.  Back-patch to 9.6, like the  
previous change.  
  
Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se  

M src/test/perl/PostgresNode.pm

Switch TAP tests of pg_rewind to use non-superuser role, take two

commit   : d9f543e9e9be15f92abdeaf870e57ef289020191    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 14 Apr 2019 18:47:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 14 Apr 2019 18:47:51 +0900    

Click here for diff

Up to now the tests of pg_rewind have been using a superuser for all its  
tests (which is the default of many tests actually, and something that  
ought to be reviewed) when involving an online source server, still it  
is possible to use a non-superuser role to do that as long as this role  
is granted permissions to execute all the source-side functions used for  
the rewind.  This is possible since v11, and was already documented as  
of bfc8068.  
  
PostgresNode::init is extended so as callers of this routine can add  
extra options to configure the authentication of a new node, which gets  
used by this commit, and allows the tests to work properly on Windows  
where SSPI is used.  
  
This will allow to catch up easily any change in pg_rewind if the tool  
begins to use more backend-side functions, so as the properties  
introduced by v11 are kept.  
  
Per suggestion from Peter Eisentraut.  
  
Author: Michael Paquier  
Reviewed-by: Magnus Hagander  
Discussion: https://postgr.es/m/20190411041336.GM2728@paquier.xyz  

M src/bin/pg_rewind/t/RewindTest.pm
M src/test/perl/PostgresNode.pm

MSYS: Translate REGRESS_SHLIB to a Windows file name.

commit   : 9daefff1226087602d25837b6b30154b3a916ea8    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 14 Apr 2019 00:42:34 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 14 Apr 2019 00:42:34 -0700    

Click here for diff

Per buildfarm member jacana.  Back-patch to v11; earlier branches skip  
the affected test under msys.  
  
Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se  

M src/test/recovery/t/017_shm.pl

When Perl "kill(9, ...)" fails, try "pg_ctl kill".

commit   : 947a35014fdc2ec74cbf06c7dbac6eea6fae90c6    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 13 Apr 2019 11:09:27 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 13 Apr 2019 11:09:27 -0700    

Click here for diff

Per buildfarm member jacana, the former fails under msys Perl 5.8.8.  
Back-patch to 9.6, like the code in question.  
  
Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se  

M src/test/perl/PostgresNode.pm

Prevent memory leaks associated with relcache rd_partcheck structures.

commit   : 5f1433ac5e7f943b29ef01266b6b8fc915e6b917    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 13 Apr 2019 13:22:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 13 Apr 2019 13:22:26 -0400    

Click here for diff

The original coding of generate_partition_qual() just copied the list  
of predicate expressions into the global CacheMemoryContext, making it  
effectively impossible to clean up when the owning relcache entry is  
destroyed --- the relevant code in RelationDestroyRelation() only managed  
to free the topmost List header :-(.  This resulted in a session-lifespan  
memory leak whenever a table partition's relcache entry is rebuilt.  
Fortunately, that's not normally a large data structure, and rebuilds  
shouldn't occur all that often in production situations; but this is  
still a bug worth fixing back to v10 where the code was introduced.  
  
To fix, put the cached expression tree into its own small memory context,  
as we do with other complicated substructures of relcache entries.  
Also, deal more honestly with the case that a partition has an empty  
partcheck list; while that probably isn't a case that's very interesting  
for production use, it's legal.  
  
In passing, clarify comments about how partitioning-related relcache  
data structures are managed, and add some Asserts that we're not leaking  
old copies when we overwrite these data fields.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/7961.1552498252@sss.pgh.pa.us  

M src/backend/partitioning/partdesc.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h

Consistently test for in-use shared memory.

commit   : c098509927f9a49ebceb301a2cb6a477ecd4ac3c    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 12 Apr 2019 22:36:38 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 12 Apr 2019 22:36:38 -0700    

Click here for diff

postmaster startup scrutinizes any shared memory segment recorded in  
postmaster.pid, exiting if that segment matches the current data  
directory and has an attached process.  When the postmaster.pid file was  
missing, a starting postmaster used weaker checks.  Change to use the  
same checks in both scenarios.  This increases the chance of a startup  
failure, in lieu of data corruption, if the DBA does "kill -9 `head -n1  
postmaster.pid` && rm postmaster.pid && pg_ctl -w start".  A postmaster  
will no longer stop if shmat() of an old segment fails with EACCES.  A  
postmaster will no longer recycle segments pertaining to other data  
directories.  That's good for production, but it's bad for integration  
tests that crash a postmaster and immediately delete its data directory.  
Such a test now leaks a segment indefinitely.  No "make check-world"  
test does that.  win32_shmem.c already avoided all these problems.  In  
9.6 and later, enhance PostgresNode to facilitate testing.  Back-patch  
to 9.4 (all supported versions).  
  
Reviewed (in earlier versions) by Daniel Gustafsson and Kyotaro HORIGUCHI.  
  
Discussion: https://postgr.es/m/20190408064141.GA2016666@rfd.leadboat.com  

M src/Makefile.global.in
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/init/postinit.c
M src/include/storage/ipc.h
M src/include/storage/pg_shmem.h
M src/test/perl/PostgresNode.pm
A src/test/recovery/t/017_shm.pl
M src/tools/msvc/vcregress.pl

Revert "Switch TAP tests of pg_rewind to use a role with minimal permissions"

commit   : db8db624e826efbe16aab1ae921bae071f98f099    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 13 Apr 2019 13:20:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 13 Apr 2019 13:20:21 +0900    

Click here for diff

This reverts commit d4e2a84, which added a new user with limited  
permissions to run the TAP tests of pg_rewind.  Buildfarm machine  
members on Windows jacana and bowerbird have been complaining about  
that, the new role not being able to run the rewind because SSPI is not  
configured to allow it.  
  
Fixing the test requires passing down directly the new user to  
pg_regress with --create-role so as SSPI can work properly.  
  
Reported-by: Andrew Dunstan  
Discussion: https://postgr.es/m/3cd43d33-f415-cc41-ade3-7230ab15b2c9@2ndQuadrant.com  

M src/bin/pg_rewind/t/RewindTest.pm

Show shared object statistics in pg_stat_database

commit   : 77bd49adba4711b4497e7e39a5ec3a9812cbd52a    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Fri, 12 Apr 2019 14:04:50 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Fri, 12 Apr 2019 14:04:50 +0200    

Click here for diff

This adds a row to the pg_stat_database view with datoid 0 and datname  
NULL for those objects that are not in a database. This was added  
particularly for checksums, but we were already tracking more satistics  
for these objects, just not returning it.  
  
Also add a checksum_last_failure column that holds the timestamptz of  
the last checksum failure that occurred in a database (or in a  
non-dataabase file), if any.  
  
Author: Julien Rouhaud <rjuju123@gmail.com>  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Fix REINDEX CONCURRENTLY of partitions

commit   : ef6f30fe77af69a8c775cca82bf993b10c9889ee    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 Apr 2019 08:36:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 Apr 2019 08:36:05 +0200    

Click here for diff

In case of a partition index, when swapping the old and new index, we  
also need to attach the new index as a partition and detach the old  
one.  Also, to handle partition indexes, we not only need to change  
dependencies referencing the index, but also dependencies of the index  
referencing something else.  The previous code did this only  
specifically for a constraint, but we also need to do this for  
partitioned indexes.  So instead write a generic function that does it  
for all dependencies.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Author: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/flat/DF4PR8401MB11964EDB77C860078C343BEBEE5A0%40DF4PR8401MB1196.NAMPRD84.PROD.OUTLOOK.COM#154df1fedb735190a773481765f7b874  

M src/backend/catalog/index.c
M src/backend/catalog/pg_depend.c
M src/include/catalog/dependency.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix GetNewTransactionId()'s interaction with xidVacLimit.

commit   : f7feb020c3d8d5aff24204af28359b99ee65bf8f    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 12 Apr 2019 14:53:38 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 12 Apr 2019 14:53:38 +1200    

Click here for diff

Commit ad308058 switched to returning a FullTransactionId, but  
failed to load the potentially updated value in the case where  
xidVacLimit is reached and we release and reacquire the lock.  
Repair, closing bug #15727.  
  
While reviewing that commit, also fix the size computation used  
by EstimateTransactionStateSize() and switch to the mul_size()  
macro traditionally used in such expressions.  
  
Author: Thomas Munro  
Reported-by: Roman Zharkov  
Discussion: https://postgr.es/m/15727-0be246e7d852d229%40postgresql.org  

M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c

Fix typos in reloptions.c

commit   : d87ab88686fb60ad5a34373de05bb20e632cf003    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Apr 2019 12:56:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Apr 2019 12:56:38 +0900    

Click here for diff

Author: Kirk Jamison  
Discussion: https://postgr.es/m/D09B13F772D2274BB348A310EE3027C6493463@g01jpexmbkw24  

M src/backend/access/common/reloptions.c

Switch TAP tests of pg_rewind to use a role with minimal permissions

commit   : d4e2a843e6d6f325c070ee80a0c117ec11675e74    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Apr 2019 10:46:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Apr 2019 10:46:43 +0900    

Click here for diff

Up to now the tests of pg_rewind have been using a superuser for all the  
tests (which is the default of many tests actually, and something that  
ought to be reviewed) when involving an online source server, still it  
is possible to use a non-superuser role to do that as long as this role  
is granted permissions to execute all the source-side functions used for  
the rewind.  This is possible since v11, and was already documented as  
of bfc8068.  
  
This will allow to catch up easily any change in pg_rewind if the tool  
begins to use more backend-side functions, so as the properties  
introduced by v11 are kept.  
  
Per suggestion from Peter Eisentraut.  
  
Author: Michael Paquier  
Reviewed-by: Magnus Hagander  
Discussion: https://postgr.es/m/20190411041336.GM2728@paquier.xyz  

M src/bin/pg_rewind/t/RewindTest.pm

Fix more strcmp() calls using boolean-like comparisons for result checks

commit   : d527fda6216780281b90f48820ae978c61c7905c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Apr 2019 10:16:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Apr 2019 10:16:49 +0900    

Click here for diff

Such calls can confuse the reader as strcmp() uses an integer as result.  
The places patched here have been spotted by Thomas Munro, David Rowley  
and myself.  
  
Author: Michael Paquier  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/20190411021946.GG2728@paquier.xyz  

M contrib/spi/refint.c
M src/backend/commands/lockcmds.c
M src/backend/tsearch/spell.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Re-order some regression test scripts for more parallelism.

commit   : 798070ec058fe75757587c9e9916cc35c623f427    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 18:16:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 18:16:50 -0400    

Click here for diff

Move the strings, numerology, insert, insert_conflict, select and  
errors tests to be parts of nearby parallel groups, instead of  
executing by themselves.  (Moving "select" required adjusting the  
constraints test, which uses a table named "tmp" as select also  
does.  There don't seem to be any other conflicts.)  
  
Move psql and stats_ext to the next parallel group, where the rules  
test also has a long runtime.  To make it safe to run stats_ext in  
parallel with rules, I adjusted the latter to only dump views/rules  
from the pg_catalog and public schemas, which was what it was doing  
anyway.  stats_ext makes some views in a transient schema, which now  
will not affect rules.  
  
Reorder serial_schedule to match parallel_schedule.  
  
Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us  

M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/rules.sql

Speed up sort-order-comparison tests in create_index_spgist.

commit   : 5874c7055702e1cf5e58543f11dfcff6de2cc260    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 17:01:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 17:01:35 -0400    

Click here for diff

This test script verifies that KNN searches of an SP-GiST index  
produce the same sort order as a seqscan-and-sort.  The FULL JOINs  
used for that are exceedingly slow, however.  Investigation shows  
that the problem is that the initial join is on the rank() values,  
and we have a lot of duplicates due to the data set containing 1000  
duplicate points.  We're therefore going to produce 1000000 join  
rows that have to be thrown away again by the join filter.  
  
We can improve matters by using row_number() instead of rank(),  
so that the initial join keys are unique.  The catch is that  
that makes the results sensitive to the sorting of rows with  
equal distances from the reference point.  That doesn't matter  
for the actually-equal points, but as luck would have it, the  
data set also contains two distinct points that have identical  
distances to the origin.  So those two rows could legitimately  
appear in either order, causing unwanted output from the check  
queries.  
  
However, it doesn't seem like it's the job of this test to  
check whether the <-> operator correctly computes distances;  
its charter is just to verify that SP-GiST emits the values  
in distance order.  So we can dodge the indeterminacy problem  
by having the check only compare row numbers and distances  
not the actual point values.  
  
This change reduces the run time of create_index_spgist by a good  
three-quarters, on my machine, with ensuing beneficial effects on  
the runtime of create_index (thanks to interactions with CREATE  
INDEX CONCURRENTLY tests in the latter).  I see a net improvement  
of more than 2X in the runtime of their parallel test group.  
  
Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us  

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

Split up a couple of long-running regression test scripts.

commit   : 385d396b807bdd7034ad3d0cea3c921d7cb04faa    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 16:15:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 16:15:54 -0400    

Click here for diff

The point of this change is to increase the potential for parallelism  
while running the core regression tests.  Most people these days are  
using parallel testing modes on multi-core machines, so we might as  
well try a bit harder to keep multiple cores busy.  Hence, a test that  
runs much longer than others in its parallel group is a candidate to  
be sub-divided.  
  
In this patch, create_index.sql and join.sql are split up.  
I haven't changed the content of the tests in any way, just  
moved them.  
  
I moved create_index.sql's SP-GiST-related tests into a new script  
create_index_spgist, and moved its btree multilevel page deletion test  
over to the existing script btree_index.  (btree_index is a more natural  
home for that test, and it's shorter than others in its parallel group,  
so this doesn't hurt total runtime of that group.)  There might be  
room for more aggressive splitting of create_index, but this is enough  
to improve matters considerably.  
  
Likewise, I moved join.sql's "exercises for the hash join code" into  
a new file join_hash.  Those exercises contributed three-quarters of  
the script's runtime.  Which might well be excessive ... but for the  
moment, I'm satisfied with shoving them into a different parallel  
group, where they can share runtime with the roughly-equally-lengthy  
gist test.  
  
(Note for anybody following along at home: there are interesting  
interactions between the runtimes of create_index and anything running  
in parallel with it, because the tests of CREATE INDEX CONCURRENTLY  
in that file will repeatedly block waiting for concurrent transactions  
to commit.  As committed in this patch, create_index and  
create_index_spgist have roughly equal runtimes, but that's mostly an  
artifact of forced synchronization of the CONCURRENTLY tests; when run  
serially, create_index is much faster.  A followup patch will reduce  
the runtime of create_index_spgist and thereby also create_index.)  
  
Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us  

M src/test/regress/expected/btree_index.out
M src/test/regress/expected/create_index.out
A src/test/regress/expected/create_index_spgist.out
M src/test/regress/expected/join.out
A src/test/regress/expected/join_hash.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/create_index.sql
A src/test/regress/sql/create_index_spgist.sql
M src/test/regress/sql/join.sql
A src/test/regress/sql/join_hash.sql

Move plpgsql error-trapping tests to a new module-specific test file.

commit   : 6726d8d476b424633ebdc7068da3f5a6e6da10af    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 15:09:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 15:09:18 -0400    

Click here for diff

The test for statement timeout has a 2-second timeout, which was only  
moderately annoying when it was written, but nowadays it contributes  
a pretty significant chunk of the elapsed time needed to run the core  
regression tests on a fast machine.  We can improve this situation by  
pushing the test into a plpgsql-specific test file instead of having  
it in a core regression test.  That's a clean win when considering  
just the core tests.  Even when considering check-world or a buildfarm  
test run, we should come out ahead because the core tests get run  
more times in those sequences.  
  
Furthermore, since the plpgsql tests aren't currently parallelized,  
it seems likely that the timing problems reflected in commit f1e671a0b  
(which increased that timeout from 1 sec to 2) will be much less severe  
in this context.  Hence, let's try cutting the timeout back to 1 second  
in hopes of a further win for check-world.  We can undo that if  
buildfarm experience proves it to be a bad idea.  
  
To give the new test file some modicum of intellectual coherency,  
I moved the surrounding tests related to error-trapping along with  
the statement timeout test proper.  Those other tests don't run long  
enough to have any particular bearing on test-runtime considerations.  
The tests are the same as before, except with minor adjustments to  
not depend on an externally-created table.  
  
Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_trap.out
A src/pl/plpgsql/src/sql/plpgsql_trap.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Fix off-by-one check that can lead to a memory overflow in ecpg.

commit   : ed16ba3248d486ec8b2fdfc75e442620d675b617    
  
author   : Michael Meskes <meskes@postgresql.org>    
date     : Thu, 11 Apr 2019 20:56:17 +0200    
  
committer: Michael Meskes <meskes@postgresql.org>    
date     : Thu, 11 Apr 2019 20:56:17 +0200    

Click here for diff

Patch by Liu Huailing <liuhuailing@cn.fujitsu.com>  

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

Remove duplicative polygon SP-GiST sequencing test.

commit   : 4aaa3b5cf1c33d713b8eefa3612a9112cbcf1074    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 14:35:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 14:35:47 -0400    

Click here for diff

Code coverage comparisons confirm that the tests using  
quad_poly_tbl_ord_seq1/quad_poly_tbl_ord_idx1 hit no code  
paths not also covered by the similar tests using  
quad_poly_tbl_ord_seq2/quad_poly_tbl_ord_idx2.  Since these  
test cases are pretty expensive, they need to contribute more  
than zero benefit.  
  
In passing, make quad_poly_tbl_ord_seq2 a temp table, since  
there seems little reason to keep it around after the test.  
  
Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us  

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

doc: adjust libpq wording to be neither/nor

commit   : d4888a3f766a7c02a9330c658c76c60e1ab8cc3e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 11 Apr 2019 13:25:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 11 Apr 2019 13:25:34 -0400    

Click here for diff

Reported-by: postgresql@cohi.at  
  
Discussion: https://postgr.es/m/155419437926.737.10876947446993402227@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

M doc/src/sgml/libpq.sgml

Remove redundant and ineffective test for btree insertion fast path.

commit   : f72d9a5e7dda5f89336a60e8b720ef9964a67177    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 13:15:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 Apr 2019 13:15:59 -0400    

Click here for diff

indexing.sql's test for this feature was added along with the  
feature in commit 2b2727343.  However, shortly later that test was  
rendered ineffective by commit 074251db6, which limited when the  
optimization would be applied, so that the test didn't test it.  
Since then, commit dd299df81 added new tests (in btree_index.sql)  
that actually do test the feature.  Code coverage comparisons  
confirm that this test sequence adds no meaningful coverage, and  
it's rather expensive, accounting for nearly half of the runtime  
of indexing.sql according to my measurements.  So let's remove it.  
  
Per advice from Peter Geoghegan.  
  
Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us  

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

Fix declaration after statement

commit   : 65d857d92c418d732e3531a3761a32f2e352cb35    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 Apr 2019 22:28:50 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 Apr 2019 22:28:50 -0400    

Click here for diff

This style is frowned upon.  I inadvertently introduced one in commit  
fe0e0b4fc7f0.  (My compiler does not complain about it, even though  
-Wdeclaration-after-statement is specified.  Weird.)  
  
Author: Masahiko Sawada  

M src/bin/pgbench/pgbench.c

Fix backwards test in operator_precedence_warning logic.

commit   : 4cae471d1b6bec7493dcb2ca156382bef738f293    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Apr 2019 19:02:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Apr 2019 19:02:21 -0400    

Click here for diff

Warnings about unary minus might have been wrong.  It's a bit  
surprising that nobody noticed yet ... probably the precedence-warning  
feature hasn't really been used much in the field.  
  
Rikard Falkeborn  
  
Discussion: https://postgr.es/m/CADRDgG6fzA8A2oeygUw4=o7ywo4kvz26NxCSgpq22nMD73Bx4Q@mail.gmail.com  

M src/backend/parser/parse_expr.c

pg_restore: Make not verbose by default

commit   : 765525c8c2c6e55abe8c0cd43bf5c728926d76d4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 10 Apr 2019 11:45:00 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 10 Apr 2019 11:45:00 +0200    

Click here for diff

This was accidentally changed in  
cc8d41511721d25d557fc02a46c053c0a602fed0.  
  
Reported-by: Christoph Berg <myon@debian.org>  

M src/bin/pg_dump/pg_restore.c

Avoid counting transaction stats for parallel worker cooperating transaction.

commit   : bdf35744bdf70208fc4d0f4b76f7d4bce3cf326b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 10 Apr 2019 08:24:15 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 10 Apr 2019 08:24:15 +0530    

Click here for diff

The transaction that is initiated by the parallel worker to cooperate  
with the actual transaction started by the main backend to complete the  
query execution should not be counted as a separate transaction.  The  
other internal transactions started and committed by the parallel worker  
are still counted as separate transactions as we that is what we do in  
other places like autovacuum.  
  
This will partially fix the bloat in transaction stats due to additional  
transactions performed by parallel workers.  For a complete fix, we need to  
decide how we want to show all the transactions that are started internally  
for various operations and that is a matter of separate patch.  
  
Reported-by: Haribabu Kommi  
Author: Haribabu Kommi  
Reviewed-by: Amit Kapila, Jamison Kirk and Rahila Syed  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/CAJrrPGc9=jKXuScvNyQ+VNhO0FZk7LLAShAJRyZjnedd2D61EQ@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Improve comment in sync.h.

commit   : d614aae02e8f878438716b7fd2642b8240b3f2b3    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Apr 2019 12:49:49 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Apr 2019 12:49:49 +1200    

Click here for diff

Per off-list complaint from Andres Freund.  

M src/include/storage/sync.h

Fix typos.

commit   : 255044889d419354b46a2bf8907b83507d695af5    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Apr 2019 09:21:06 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Apr 2019 09:21:06 +1200    

Click here for diff

M src/backend/executor/execTuples.c

Prevent inlining of multiply-referenced CTEs with outer recursive refs.

commit   : 9476131278c7bfc435ad9a21fc8e981272ac0dd2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 9 Apr 2019 15:47:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 9 Apr 2019 15:47:26 -0400    

Click here for diff

This has to be prevented because inlining would result in multiple  
self-references, which we don't support (and in fact that's disallowed  
by the SQL spec, see statements about linearly vs. nonlinearly  
recursive queries).  Bug fix for commit 608b167f9.  
  
Per report from Yaroslav Schekin (via Andrew Gierth)  
  
Discussion: https://postgr.es/m/87wolmg60q.fsf@news-spur.riddles.org.uk  

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

Fix typo

commit   : 4dba0f6dc407f965924d6c1007ac1bb5cc209dde    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 9 Apr 2019 12:59:53 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 9 Apr 2019 12:59:53 -0400    

Click here for diff

M src/backend/replication/slotfuncs.c

Fix memory leak in pgbench

commit   : fe0e0b4fc7f0cdc2333bda08b199422a1e77a551    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 9 Apr 2019 12:46:34 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 9 Apr 2019 12:46:34 -0400    

Click here for diff

Commit 25ee70511ec2 introduced a memory leak in pgbench: some PGresult  
structs were not being freed during error bailout, because we're now  
doing more PQgetResult() calls than previously.  Since there's more  
cleanup code outside the discard_response() routine than in it, refactor  
the cleanup code, removing the routine.  
  
This has little effect currently, since we abandon processing after  
hitting errors, but if we ever get further pgbench features (such as  
testing for serializable transactions), it'll matter.  
  
Per Coverity.  
  
Reviewed-by: Michaël Paquier  

M src/bin/pgbench/pgbench.c

Test some more cases with partitioned tables in EvalPlanQual.

commit   : a2418f9e238794fcaaf00bbd5b8f953ca2856aa0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 9 Apr 2019 11:42:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 9 Apr 2019 11:42:53 -0400    

Click here for diff

We weren't testing anything involving EPQ on UPDATEs that move tuples  
into different partitions.  Depending on the implementation,  
it might be that these cases aren't actually very interesting ...  
but given our thin coverage of EPQ in general, I think it's a good  
idea to have a test case.  
  
Amit Langote, minor tweak by me  
  
Discussion: https://postgr.es/m/7889df35-ad1a-691a-00e3-4d4b18f364e3@lab.ntt.co.jp  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Define WIN32_STACK_RLIMIT throughout win32 and cygwin builds.

commit   : ba3fb5d4fb9227719759740b6d7771e719c3318b    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Tue, 9 Apr 2019 08:25:39 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Tue, 9 Apr 2019 08:25:39 -0700    

Click here for diff

The MSVC build system already did this, and commit  
617dc6d299c957e2784320382b3277ede01d9c63 used it in a second file.  
Back-patch to 9.4, like that commit.  
  
Discussion: https://postgr.es/m/CAA8=A7_1SWc3+3Z=-utQrQFOtrj_DeohRVt7diA2tZozxsyUOQ@mail.gmail.com  

M src/backend/tcop/Makefile
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.win32

Replace tabs with spaces in one .sql file

commit   : 9efe068e48f09d915660576f5672bfa9f1c0eb53    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Apr 2019 14:37:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Apr 2019 14:37:37 +0200    

Click here for diff

Let's at least keep this consistent within the same file.  

M src/backend/catalog/system_views.sql

Fix example in comment.

commit   : 16954e22e2a881a4a5ead82f364635bfa63cc9df    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Apr 2019 08:32:02 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Apr 2019 08:32:02 +0300    

Click here for diff

Author: Adrien Nayrat  

M src/backend/lib/integerset.c

Avoid "could not reattach" by providing space for concurrent allocation.

commit   : 617dc6d299c957e2784320382b3277ede01d9c63    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 8 Apr 2019 21:39:00 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 8 Apr 2019 21:39:00 -0700    

Click here for diff

We've long had reports of intermittent "could not reattach to shared  
memory" errors on Windows.  Buildfarm member dory fails that way when  
PGSharedMemoryReAttach() execution overlaps with creation of a thread  
for the process's "default thread pool".  Fix that by providing a second  
region to receive asynchronous allocations that would otherwise intrude  
into UsedShmemSegAddr.  In pgwin32_ReserveSharedMemoryRegion(), stop  
trying to free reservations landing at incorrect addresses; the caller's  
next step has been to terminate the affected process.  Back-patch to 9.4  
(all supported versions).  
  
Reviewed by Tom Lane.  He also did much of the prerequisite research;  
see commit bcbf2346d69f6006f126044864dd9383d50d87b4.  
  
Discussion: https://postgr.es/m/20190402135442.GA1173872@rfd.leadboat.com  

M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/include/storage/pg_shmem.h

tableam: comment and formatting fixes.

commit   : 6421011ea24db3a59dc7a0058a03e91981d53635    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 8 Apr 2019 10:25:16 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 8 Apr 2019 10:25:16 -0700    

Click here for diff

Author: Heikki Linnakangas  
Discussion: https://postgr.es/m/9a7fb9cc-2419-5db7-8840-ddc10c93f122@iki.fi  

M src/include/access/tableam.h

doc: Fix whitespace

commit   : 122fa9f942478f8fdcfba961e01d172574369293    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Apr 2019 22:27:35 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Apr 2019 22:27:35 +0200    

Click here for diff