PostgreSQL 13.0 (upcoming) commit log

Fix edge case leading to agg transitions skipping ExecAggTransReparent() calls.

commit   : affdde2e15d9df6e9736bbb7e7cd9d56049d2f5a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 20 Jan 2020 23:26:51 -0800    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 20 Jan 2020 23:26:51 -0800    

Click here for diff

The code checking whether an aggregate transition value needs to be  
reparented into the current context has always only compared the  
transition return value with the previous transition value by datum,  
i.e. without regard for NULLness.  This normally works, because when  
the transition function returns NULL (via fcinfo->isnull), it'll  
return a value that won't be the same as its input value.  
  
But there's no hard requirement that that's the case. And it turns  
out, it's possible to hit this case (see discussion or reproducers),  
leading to a non-null transition value not being reparented, followed  
by a crash caused by that.  
  
Instead of adding another comparison of NULLness, instead have  
ExecAggTransReparent() ensure that pergroup->transValue ends up as 0  
when the new transition value is NULL. That avoids having to add an  
additional branch to the much more common cases of the transition  
function returning the old transition value (which is a pointer in  
this case), and when the new value is different, but not NULL.  
  
In branches since 69c3936a149, also deduplicate the reparenting code  
between the expression evaluation based transitions, and the path for  
ordered aggregates.  
  
Reported-By: Teodor Sigaev, Nikita Glukhov  
Author: Andres Freund  
Discussion: https://postgr.es/m/bd34e930-cfec-ea9b-3827-a8bc50891393@sigaev.ru  
Backpatch: 9.4-, this issue has existed since at least 7.4  

M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c

Add GUC variables for stat tracking and timeout as PGDLLIMPORT

commit   : 62c9b522311afd791fd92fe46a294f7e21f10540    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 21 Jan 2020 13:46:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 21 Jan 2020 13:46:39 +0900    

Click here for diff

This helps integration of extensions with Windows.  The following  
parameters are changed:  
- idle_in_transaction_session_timeout (9.6 and newer versions)  
- lock_timeout  
- statement_timeout  
- track_activities  
- track_counts  
- track_functions  
  
Author: Pascal Legrand  
Reviewed-by: Amit Kamila, Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/1579298868581-0.post@n3.nabble.com  
Backpatch-through: 9.4  

M src/include/pgstat.h
M src/include/storage/proc.h

Further tweaking of jsonb_set_lax().

commit   : 31f403e95fdf88338d3fc9c6af80fcf6d8241044    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Jan 2020 14:26:56 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Jan 2020 14:26:56 -0500    

Click here for diff

Some buildfarm members were still warning about this, because in  
9c679a08f I'd missed decorating one of the ereport() code paths  
with a dummy return.  
  
Also, adjust the error messages to be more in line with project  
style guide.  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/jsonb.out

Fix pg_dump's sigTermHandler() to use _exit() not exit().

commit   : cd23a2019c4b8da47905e91c8a841cadac978a32    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Jan 2020 12:57:17 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Jan 2020 12:57:17 -0500    

Click here for diff

sigTermHandler() tried to be careful to invoke only operations that  
are safe to do in a signal handler.  But for some reason we forgot  
that exit(3) is not among those, because it calls atexit handlers  
that might do various random things.  (pg_dump itself installs no  
atexit handlers, but e.g. OpenSSL does.)  That led to crashes or  
lockups when attempting to terminate a parallel dump or restore  
via a signal.  
  
Fix by calling _exit() instead.  
  
Per bug #16199 from Raúl Marín.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/16199-cb2f121146a96f9b@postgresql.org  

M src/bin/pg_dump/parallel.c

Fix crash in BRIN inclusion op functions, due to missing datum copy.

commit   : 4c87010981f3a9a41751e5550f6eb889ab5667e8    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 20 Jan 2020 10:36:35 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 20 Jan 2020 10:36:35 +0200    

Click here for diff

The BRIN add_value() and union() functions need to make a longer-lived  
copy of the argument, if they want to store it in the BrinValues struct  
also passed as argument. The functions for the "inclusion operator  
classes" used with box, range and inet types didn't take into account  
that the union helper function might return its argument as is, without  
making a copy. Check for that case, and make a copy if necessary. That  
case arises at least with the range_union() function, when one of the  
arguments is an 'empty' range:  
  
CREATE TABLE brintest (n numrange);  
CREATE INDEX brinidx ON brintest USING brin (n);  
INSERT INTO brintest VALUES ('empty');  
INSERT INTO brintest VALUES (numrange(0, 2^1000::numeric));  
INSERT INTO brintest VALUES ('(-1, 0)');  
  
SELECT brin_desummarize_range('brinidx', 0);  
SELECT brin_summarize_range('brinidx', 0);  
  
Backpatch down to 9.5, where BRIN was introduced.  
  
Discussion: https://www.postgresql.org/message-id/e6e1d6eb-0a67-36aa-e779-bcca59167c14%40iki.fi  
Reviewed-by: Emre Hasegeli, Tom Lane, Alvaro Herrera  

M src/backend/access/brin/brin_inclusion.c

Allow vacuum command to process indexes in parallel.

commit   : 40d964ec997f64227bc0ff5e058dc4a5770a70a9    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 20 Jan 2020 07:57:49 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 20 Jan 2020 07:57:49 +0530    

Click here for diff

This feature allows the vacuum to leverage multiple CPUs in order to  
process indexes.  This enables us to perform index vacuuming and index  
cleanup with background workers.  This adds a PARALLEL option to VACUUM  
command where the user can specify the number of workers that can be used  
to perform the command which is limited by the number of indexes on a  
table.  Specifying zero as a number of workers will disable parallelism.  
This option can't be used with the FULL option.  
  
Each index is processed by at most one vacuum process.  Therefore parallel  
vacuum can be used when the table has at least two indexes.  
  
The parallel degree is either specified by the user or determined based on  
the number of indexes that the table has, and further limited by  
max_parallel_maintenance_workers.  The index can participate in parallel  
vacuum iff it's size is greater than min_parallel_index_scan_size.  
  
Author: Masahiko Sawada and Amit Kapila  
Reviewed-by: Dilip Kumar, Amit Kapila, Robert Haas, Tomas Vondra,  
Mahendra Singh and Sergei Kornilov  
Tested-by: Mahendra Singh and Prabhat Sahu  
Discussion:  
https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com  
https://postgr.es/m/CAA4eK1J-VoR9gzS5E75pcD-OH0mEyCdp8RihcwKrcuw7J-Q0+w@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/parallel.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/include/access/heapam.h
M src/include/access/parallel.h
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql
M src/tools/pgindent/typedefs.list

Fix out-of-memory handling in ecpglib.

commit   : 44f1fc8df5dadbc5e80661660903aab4076d868f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 Jan 2020 19:15:15 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 Jan 2020 19:15:15 -0500    

Click here for diff

ecpg_build_params() would crash on a null pointer dereference if  
realloc() failed, due to updating the persistent "stmt" struct  
too aggressively.  (Even without the crash, this would've leaked  
the old storage that we were trying to realloc.)  
  
Per Coverity.  This seems to have been broken in commit 0cc050794,  
so back-patch into v12.  

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

Silence minor compiler warnings.

commit   : 9c679a08f0cdedcf7f084daea3cba6ae9c3cbced    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 Jan 2020 16:04:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 19 Jan 2020 16:04:36 -0500    

Click here for diff

Ensure that ClassifyUtilityCommandAsReadOnly() has defined behavior  
even if TransactionStmt.kind has a value that's not one of the  
declared values for its enum.  
  
Suppress warnings from compilers that don't know that elog(ERROR)  
doesn't return, in ClassifyUtilityCommandAsReadOnly() and  
jsonb_set_lax().  
  
Per Coverity and buildfarm.  

M src/backend/tcop/utility.c
M src/backend/utils/adt/jsonfuncs.c

Remove separate files for the initial contents of pg_(sh)description

commit   : 7aaefadaac6452b2e813fae4ea531cb12d022531    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 19 Jan 2020 13:54:58 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 19 Jan 2020 13:54:58 +0200    

Click here for diff

This data was only in separate files because it was the most convenient  
way to handle it with a shell script. Now that we use a general-purpose  
programming language, it's easy to assemble the data into the same format  
as the rest of the catalogs and output it into postgres.bki. This allows  
removal of some special-purpose code from initdb.c.  
  
Discussion: https://www.postgresql.org/message-id/CACPNZCtVFtjHre6hg9dput0qRPp39pzuyA2A6BT8wdgrRy%2BQdA%40mail.gmail.com  
Author: John Naylor  

M src/backend/catalog/.gitignore
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/bin/initdb/initdb.c
M src/tools/msvc/clean.bat

Doc: Improve description of connection strings with Percent-encoding

commit   : e0ed6817c0ee218a3681920807404603e042ff04    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 19 Jan 2020 18:55:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 19 Jan 2020 18:55:51 +0900    

Click here for diff

Clarify the description related to the use of characters which can be  
encoded, and add an example.  
  
Author: Jobin Augustine  
Reviewed-by: Peter Eisentraut, Alvaro Herrera, Heikki Linnakangas,  
Michael Paquier, Alex Shulgin  
Discussion: https://postgr.es/m/CANaTPsrYgSgE2fuj3=4x=Jmx1c+NgkEDzftNknZbrMuqL+aBhQ@mail.gmail.com  

M doc/src/sgml/libpq.sgml

Doc: rearrange the documentation of binary-string functions.

commit   : 34a0a81bfb388504deaa51b16a8bb531b827e519    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 Jan 2020 17:51:03 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 18 Jan 2020 17:51:03 -0500    

Click here for diff

Rather than intermixing the discussion of text-string and binary-string  
functions, make a clean break, moving all discussion of binary-string  
operations into section 9.5.  This involves some duplication of  
function descriptions between 9.4 and 9.5, but it seems cleaner on the  
whole since the individual descriptions are clearer (and on the other  
side of the coin, it gets rid of some duplicated descriptions, too).  
  
Move the convert*/encode/decode functions to a separate table, because  
they don't quite seem to fit under the heading of "binary string  
functions".  
  
Also provide full documentation of the textual formats supported by  
encode() and decode() (which was the original goal of this patch  
series, many moons ago).  
  
Also move the table of built-in encoding conversions out of section 9.4,  
where it no longer had any relevance whatsoever, and put it into section  
23.3 about character sets.  I chose to put both that and table 23.2  
(multibyte-translation-table) into a new <sect2> so as not to break up  
the flow of discussion in 23.3.3.  
  
Also do a bunch of minor copy-editing on the function descriptions  
in 9.4 and 9.5.  
  
Karl Pinc, reviewed by Fabien Coelho, further hacking by me  
  
Discussion: https://postgr.es/m/20190304163347.7bca4897@slate.meme.com  

M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml

Add GUC checks for ssl_min_protocol_version and ssl_max_protocol_version

commit   : 41aadeeb124ee5f8e7d154a16a74d53286882b74    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 18 Jan 2020 12:32:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 18 Jan 2020 12:32:43 +0900    

Click here for diff

Mixing incorrect bounds set in the SSL context leads to confusing error  
messages generated by OpenSSL which are hard to act on.  New checks are  
added within the GUC machinery to improve the user experience as they  
apply to any SSL implementation, not only OpenSSL, and doing the checks  
beforehand avoids the creation of a SSL during a reload (or startup)  
which we know will never be used anyway.  
  
Backpatch down to 12, as those parameters have been introduced by  
e73e67c.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/20200114035420.GE1515@paquier.xyz  
Backpatch-through: 12  

M src/backend/utils/misc/guc.c
M src/test/ssl/t/001_ssltests.pl

Avoid full scan of GIN indexes when possible

commit   : 4b754d6c16e16cc1a1adf12ab0f48603069a0efd    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sat, 18 Jan 2020 01:11:39 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sat, 18 Jan 2020 01:11:39 +0300    

Click here for diff

The strategy of GIN index scan is driven by opclass-specific extract_query  
method.  This method that needed search mode is GIN_SEARCH_MODE_ALL.  This  
mode means that matching tuple may contain none of extracted entries.  Simple  
example is '!term' tsquery, which doesn't need any term to exist in matching  
tsvector.  
  
In order to handle such scan key GIN calculates virtual entry, which contains  
all TIDs of all entries of attribute.  In fact this is full scan of index  
attribute.  And typically this is very slow, but allows to handle some queries  
correctly in GIN.  However, current algorithm calculate such virtual entry for  
each GIN_SEARCH_MODE_ALL scan key even if they are multiple for the same  
attribute.  This is clearly not optimal.  
  
This commit improves the situation by introduction of "exclude only" scan keys.  
Such scan keys are not capable to return set of matching TIDs.  Instead, they  
are capable only to filter TIDs produced by normal scan keys.  Therefore,  
each attribute should contain at least one normal scan key, while rest of them  
may be "exclude only" if search mode is GIN_SEARCH_MODE_ALL.  
  
The same optimization might be applied to the whole scan, not per-attribute.  
But that leads to NULL values elimination problem.  There is trade-off between  
multiple possible ways to do this.  We probably want to do this later using  
some cost-based decision algorithm.  
  
Discussion: https://postgr.es/m/CAOBaU_YGP5-BEt5Cc0%3DzMve92vocPzD%2BXiZgiZs1kjY0cj%3DXBg%40mail.gmail.com  
Author: Nikita Glukhov, Alexander Korotkov, Tom Lane, Julien Rouhaud  
Reviewed-by: Julien Rouhaud, Tomas Vondra, Tom Lane  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginscan.c
M src/backend/utils/adt/selfuncs.c
M src/include/access/gin_private.h
M src/test/regress/expected/gin.out
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/gin.sql
M src/test/regress/sql/tsearch.sql

Repair more failures with SubPlans in multi-row VALUES lists.

commit   : 41c6f9db25b5e3a8bb8afbb7d6715cff541fd41e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 17 Jan 2020 16:17:17 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 17 Jan 2020 16:17:17 -0500    

Click here for diff

Commit 9b63c13f0 turns out to have been fundamentally misguided:  
the parent node's subPlan list is by no means the only way in which  
a child SubPlan node can be hooked into the outer execution state.  
As shown in bug #16213 from Matt Jibson, we can also get short-lived  
tuple table slots added to the outer es_tupleTable list.  At this point  
I have little faith that there aren't other possible connections as  
well; the long time it took to notice this problem shows that this  
isn't a heavily-exercised situation.  
  
Therefore, revert that fix, returning to the coding that passed a  
NULL parent plan pointer down to the transiently-built subexpressions.  
That gives us a pretty good guarantee that they won't hook into the  
outer executor state in any way.  But then we need some other solution  
to make SubPlans work.  Adopt the solution speculated about in the  
previous commit's log message: do expression initialization at plan  
startup for just those VALUES rows containing SubPlans, abandoning the  
goal of reclaiming memory intra-query for those rows.  In practice it  
seems unlikely that queries containing a vast number of VALUES rows  
would be using SubPlans in them, so this should not give up much.  
  
(BTW, this test case also refutes my claim in connection with the prior  
commit that the issue only arises with use of LATERAL.  That was just  
wrong: some variants of SubLink always produce SubPlans.)  
  
As with previous patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/16213-871ac3bc208ecf23@postgresql.org  

M src/backend/executor/nodeValuesscan.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Set ReorderBufferTXN->final_lsn more eagerly

commit   : 15cac3a523cc06dba1331635f3f67445fa202a44    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 17 Jan 2020 18:00:39 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 17 Jan 2020 18:00:39 -0300    

Click here for diff

... specifically, set it incrementally as each individual change is  
spilled down to disk.  This way, it is set correctly when the  
transaction disappears without trace, ie. without leaving an XACT_ABORT  
wal record.  (This happens when the server crashes midway through a  
transaction.)  
  
Failing to have final_lsn prevents ReorderBufferRestoreCleanup() from  
working, since it needs the final_lsn in order to know the endpoint of  
its iteration through spilled files.  
  
Commit df9f682c7bf8 already tried to fix the problem, but it didn't set  
the final_lsn in all cases.  Revert that, since it's no longer needed.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila, Dilip Kumar  
Discussion: https://postgr.es/m/CALDaNm2CLk+K9JDwjYST0sPbGg5AQdvhUt0jbKyX_HdAE0jk3A@mail.gmail.com  

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

Allocate freechunks bitmap as part of SlabContext

commit   : 543852fd8bf0adc56192aeb25ff83f1a12c30368    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 17 Jan 2020 14:06:28 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 17 Jan 2020 14:06:28 +0100    

Click here for diff

The bitmap used by SlabCheck to cross-check free chunks in a block used  
to be allocated for each SlabCheck call, and was never freed. The memory  
leak could be fixed by simply adding a pfree call, but it's actually a  
bad idea to do any allocations in SlabCheck at all as it assumes the  
state of the memory management as a whole is sane.  
  
So instead we allocate the bitmap as part of SlabContext, which means  
we don't need to do any allocations in SlabCheck and the bitmap goes  
away together with the SlabContext.  
  
Backpatch to 10, where the Slab context was introduced.  
  
Author: Tomas Vondra  
Reported-by: Andres Freund  
Reviewed-by: Tom Lane  
Backpatch-through: 10  
Discussion: https://www.postgresql.org/message-id/20200116044119.g45f7pmgz4jmodxj%40alap3.anarazel.de  

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

bump catalog version as should have been done for jsonb_set_lax

commit   : 4b0e0f67f2f16c077b4e5c8a3d70c6af4355db09    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 17 Jan 2020 16:24:13 +1030    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 17 Jan 2020 16:24:13 +1030    

Click here for diff

M src/include/catalog/catversion.h

Add a non-strict version of jsonb_set

commit   : a83586b5543b948f9e621462537a7303b113c482    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 17 Jan 2020 11:41:35 +1030    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 17 Jan 2020 11:41:35 +1030    

Click here for diff

jsonb_set_lax() is the same as jsonb_set, except that it takes and extra  
argument that specifies what to do if the value argument is NULL. The  
default is 'use_json_null'. Other possibilities are 'raise_exception',  
'return_target' and 'delete_key', all these behaviours having been  
suggested as reasonable by various users.  
  
Discussion: https://postgr.es/m/375873e2-c957-3a8d-64f9-26c43c2b16e7@2ndQuadrant.com  
  
Reviewed by: Pavel Stehule  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Move OpenSSL routines for min/max protocol setting to src/common/

commit   : f7cd5896a69621818189fbdd209fb2e1fc008102    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 Jan 2020 10:06:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 Jan 2020 10:06:17 +0900    

Click here for diff

Two routines have been added in OpenSSL 1.1.0 to set the protocol bounds  
allowed within a given SSL context:  
- SSL_CTX_set_min_proto_version  
- SSL_CTX_set_max_proto_version  
  
As Postgres supports OpenSSL down to 1.0.1 (as of HEAD), equivalent  
replacements exist in the tree, which are only available for the  
backend.  A follow-up patch is planned to add control of the SSL  
protocol bounds for libpq, so move those routines to src/common/ so as  
libpq can use them.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/4F246AE3-A7AE-471E-BD3D-C799D3748E03@yesql.se  

M src/backend/libpq/be-secure-openssl.c
M src/common/Makefile
A src/common/protocol_openssl.c
A src/include/common/openssl.h
M src/tools/msvc/Mkvcbuild.pm

Rationalize code placement between wchar.c, encnames.c, and mbutils.c.

commit   : 5afaa2e42655811461044c4216e2f821cadc766d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 18:08:21 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 18:08:21 -0500    

Click here for diff

Move all the backend-only code that'd crept into wchar.c and encnames.c  
into mbutils.c.  
  
To remove the last few #ifdef dependencies from wchar.c and encnames.c,  
also make the following changes:  
  
* Adjust get_encoding_name_for_icu to return NULL, not throw an error,  
for unsupported encodings.  Its sole caller can perfectly well throw an  
error instead.  (While at it, I also made this function and its sibling  
is_encoding_supported_by_icu proof against out-of-range encoding IDs.)  
  
* Remove the overlength-name error condition from pg_char_to_encoding.  
It's completely silly not to treat that just like any other  
the-name-is-not-in-the-table case.  
  
Also, get rid of pg_mic_mblen --- there's no obvious reason why  
conv.c shouldn't call pg_mule_mblen instead.  
  
Other than that, this is just code movement and comment-polishing with  
no functional changes.  Notably, I reordered declarations in pg_wchar.h  
to show which functions are frontend-accessible and which are not.  
  
Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/mbutils.c
M src/common/encnames.c
M src/common/wchar.c
M src/include/mb/pg_wchar.h

Update header comments for wchar.c and encnames.c.

commit   : 3d4cb5d6c180e38ebf84f6403cfa18c09d0b738e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 15:58:24 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 15:58:24 -0500    

Click here for diff

Bring these into common style (including having proper copyright  
notices) and adjust their self-declaration of where they live.  
  
Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com  

M src/common/encnames.c
M src/common/wchar.c

Move wchar.c and encnames.c to src/common/.

commit   : e6afa8918c461c1dd80c5063a950518fa4e950cd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 15:56:32 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 15:56:32 -0500    

Click here for diff

Formerly, various frontend directories symlinked these two sources  
and then built them locally.  That's an ancient, ugly hack, and  
we now have a much better way: put them into libpgcommon.  
So do that.  (The immediate motivation for this is the prospect  
of having to introduce still more symlinking if we don't.)  
  
This commit moves these two files absolutely verbatim, for ease of  
reviewing the git history.  There's some follow-on work to be done  
that will modify them a bit.  
  
Robert Haas, Tom Lane  
  
Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com  

M src/backend/utils/mb/Makefile
M src/backend/utils/mb/README
M src/bin/initdb/.gitignore
M src/bin/initdb/Makefile
M src/common/Makefile
R100 src/backend/utils/mb/encnames.c src/common/encnames.c
M src/common/saslprep.c
R100 src/backend/utils/mb/wchar.c src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Fix problems with "read only query" checks, and refactor the code.

commit   : 2eb34ac369741c110b593e2dc2195c57d29ab8e8    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 16 Jan 2020 12:11:31 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 16 Jan 2020 12:11:31 -0500    

Click here for diff

Previously, check_xact_readonly() was responsible for determining  
which types of queries could not be run in a read-only transaction,  
standard_ProcessUtility() was responsibility for prohibiting things  
which were allowed in read only transactions but not in recovery, and  
utility commands were basically prohibited in bulk in parallel mode by  
calls to CommandIsReadOnly() in functions.c and spi.c.  This situation  
was confusing and error-prone. Accordingly, move all the checks to a  
new function ClassifyUtilityCommandAsReadOnly(), which determines the  
degree to which a given statement is read only.  
  
In the old code, check_xact_readonly() inadvertently failed to handle  
several statement types that actually should have been prohibited,  
specifically T_CreatePolicyStmt, T_AlterPolicyStmt, T_CreateAmStmt,  
T_CreateStatsStmt, T_AlterStatsStmt, and T_AlterCollationStmt.  As a  
result, thes statements were erroneously allowed in read only  
transactions, parallel queries, and standby operation. Generally, they  
would fail anyway due to some lower-level error check, but we  
shouldn't rely on that.  In the new code structure, future omissions  
of this type should cause ClassifyUtilityCommandAsReadOnly() to  
complain about an unrecognized node type.  
  
As a fringe benefit, this means we can allow certain types of utility  
commands in parallel mode, where it's safe to do so. This allows  
ALTER SYSTEM, CALL, DO, CHECKPOINT, COPY FROM, EXPLAIN, and SHOW.  
It might be possible to allow additional commands with more work  
and thought.  
  
Along the way, document the thinking process behind the current set  
of checks, as per discussion especially with Peter Eisentraut. There  
is some interest in revising some of these rules, but that seems  
like a job for another patch.  
  
Patch by me, reviewed by Tom Lane, Stephen Frost, and Peter  
Eisentraut.  
  
Discussion: http://postgr.es/m/CA+TgmoZ_rLqJt5sYkvh+JpQnfX0Y+B2R+qfi820xNih6x-FQOQ@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/commands/lockcmds.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/tcop/utility.c
M src/include/tcop/utility.h

Minor code beautification in regexp.c.

commit   : 0db7c67051806f28a9129d50695efc19372d3af2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 11:31:30 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Jan 2020 11:31:30 -0500    

Click here for diff

Remove duplicated code (apparently introduced by commit c8ea87e4b).  
Also get rid of some PG_USED_FOR_ASSERTS_ONLY variables we don't  
really need to have.  
  
Li Japin, Tom Lane  
  
Discussion: https://postgr.es/m/PS1PR0601MB3770A5595B6E5E3FD6F35724B6360@PS1PR0601MB3770.apcprd06.prod.outlook.com  

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

Restructure ALTER TABLE execution to fix assorted bugs.

commit   : 1281a5c907b41e992a66deb13c3aa61888a62268    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 15 Jan 2020 18:49:24 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 15 Jan 2020 18:49:24 -0500    

Click here for diff

We've had numerous bug reports about how (1) IF NOT EXISTS clauses in  
ALTER TABLE don't behave as-expected, and (2) combining certain actions  
into one ALTER TABLE doesn't work, though executing the same actions as  
separate statements does.  This patch cleans up all of the cases so far  
reported from the field, though there are still some oddities associated  
with identity columns.  
  
The core problem behind all of these bugs is that we do parse analysis  
of ALTER TABLE subcommands too soon, before starting execution of the  
statement.  The root of the bugs in group (1) is that parse analysis  
schedules derived commands (such as a CREATE SEQUENCE for a serial  
column) before it's known whether the IF NOT EXISTS clause should cause  
a subcommand to be skipped.  The root of the bugs in group (2) is that  
earlier subcommands may change the catalog state that later subcommands  
need to be parsed against.  
  
Hence, postpone parse analysis of ALTER TABLE's subcommands, and do  
that one subcommand at a time, during "phase 2" of ALTER TABLE which  
is the phase that does catalog rewrites.  Thus the catalog effects  
of earlier subcommands are already visible when we analyze later ones.  
(The sole exception is that we do parse analysis for ALTER COLUMN TYPE  
subcommands during phase 1, so that their USING expressions can be  
parsed against the table's original state, which is what we need.  
Arguably, these bugs stem from falsely concluding that because ALTER  
COLUMN TYPE must do early parse analysis, every other command subtype  
can too.)  
  
This means that ALTER TABLE itself must deal with execution of any  
non-ALTER-TABLE derived statements that are generated by parse analysis.  
Add a suitable entry point to utility.c to accept those recursive  
calls, and create a struct to pass through the information needed by  
the recursive call, rather than making the argument lists of  
AlterTable() and friends even longer.  
  
Getting this to work correctly required a little bit of fiddling  
with the subcommand pass structure, in particular breaking up  
AT_PASS_ADD_CONSTR into multiple passes.  But otherwise it's mostly  
a pretty straightforward application of the above ideas.  
  
Fixing the residual issues for identity columns requires refactoring of  
where the dependency link from an identity column to its sequence gets  
set up.  So that seems like suitable material for a separate patch,  
especially since this one is pretty big already.  
  
Discussion: https://postgr.es/m/10365.1558909428@sss.pgh.pa.us  

M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/include/commands/tablecmds.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/include/tcop/utility.h
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/sql/alter_table.sql
M src/test/regress/sql/identity.sql

Report progress of ANALYZE commands

commit   : a166d408eb0b35023c169e765f4664c3b114b52e    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 15 Jan 2020 11:02:09 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 15 Jan 2020 11:02:09 -0300    

Click here for diff

This uses the progress reporting infrastructure added by c16dc1aca5e0,  
adding support for ANALYZE.  
  
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Co-authored-by: Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>  
Reviewed-by: Julien Rouhaud, Robert Haas, Anthony Nowocien, Kyotaro Horiguchi,  
	Vignesh C, Amit Langote  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/analyze.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/sampling.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/include/pgstat.h
M src/include/utils/sampling.h
M src/test/regress/expected/rules.out

Remove libpq.rc, use win32ver.rc for libpq

commit   : 16a4a3d59cd5574fdc697ea16ef5692ce34c54d5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 15 Jan 2020 10:15:06 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 15 Jan 2020 10:15:06 +0100    

Click here for diff

For historical reasons, libpq used a separate libpq.rc file for the  
Windows builds while all other components use a common file  
win32ver.rc.  With a bit of tweaking, the libpq build can also use the  
win32ver.rc file.  This removes a bit of duplicative code.  
  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/flat/ad505e61-a923-e114-9f38-9867d161073f@2ndquadrant.com  

M src/bin/pgevent/Makefile
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
D src/interfaces/libpq/libpq.rc.in
M src/makefiles/Makefile.win32
M src/port/win32ver.rc
M src/tools/copyright.pl
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat
M src/tools/version_stamp.pl

Fix buggy logic in isTempNamespaceInUse()

commit   : ac5bdf62617507b1942f6124a2696c04a16fca04    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 15 Jan 2020 13:58:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 15 Jan 2020 13:58:33 +0900    

Click here for diff

The logic introduced in this routine as of 246a6c8 would report an  
incorrect result when a session calls it to check if the temporary  
namespace owned by the session is in use or not.  It is possible to  
optimize more the routine in this case to avoid a PGPROC lookup, but  
let's keep the logic simple.  As this routine is used only by autovacuum  
for now, there were no live bugs, still let's be correct for any future  
code involving it.  
  
Author: Michael Paquier  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/20200113093703.GA41902@paquier.xyz  
Backpatch-through: 11  

M src/backend/catalog/namespace.c

Introduce IndexAM fields for parallel vacuum.

commit   : 4d8a8d0c738410ec02aab46b1ebe1835365ad384    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 15 Jan 2020 07:24:14 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 15 Jan 2020 07:24:14 +0530    

Click here for diff

Introduce new fields amusemaintenanceworkmem and amparallelvacuumoptions  
in IndexAmRoutine for parallel vacuum.  The amusemaintenanceworkmem tells  
whether a particular IndexAM uses maintenance_work_mem or not.  This will  
help in controlling the memory used by individual workers as otherwise,  
each worker can consume memory equal to maintenance_work_mem.  The  
amparallelvacuumoptions tell whether a particular IndexAM participates in  
a parallel vacuum and if so in which phase (bulkdelete, vacuumcleanup) of  
vacuum.  
  
Author: Masahiko Sawada and Amit Kapila  
Reviewed-by: Dilip Kumar, Amit Kapila, Tomas Vondra and Robert Haas  
Discussion:  
https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com  
https://postgr.es/m/CAA4eK1LmcD5aPogzwim5Nn58Ki+74a6Edghx4Wd8hAskvHaq5A@mail.gmail.com  

M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/include/access/amapi.h
M src/include/commands/vacuum.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Fix compiler warning about format on Windows

commit   : fe233366f2e3ca44609c805ce0604c1e2122c3f9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 23:59:18 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 23:59:18 +0100    

Click here for diff

On 64-bit Windows, pid_t is long long int, so a %d format isn't  
enough.  

M src/backend/replication/walreceiver.c

docs: change "default role" wording to "predefined role"

commit   : 0e936a2148472e6c364aee8c3e298dc16dc4240a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Jan 2020 13:13:04 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Jan 2020 13:13:04 -0500    

Click here for diff

The new wording was determined to be more accurate.  Also, update  
release note links that reference these sections.  
  
Reported-by: rirans@comcast.net  
  
Discussion: https://postgr.es/m/157742545062.1149.11052653770497832538@wrigleys.postgresql.org  
  
Backpatch-through: 9.6  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/user-manag.sgml

commit   : 344c26915136fa54c4a1bf54074ba15090b32721    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Jan 2020 11:28:07 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Jan 2020 11:28:07 -0500    

Click here for diff

This reverts part of commit 7559d8ebfa.  The copyright script has  
already been updated to skip *.key files.  
  
Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/20200102184059.GA25435@alvherre.pgsql  
  
Backpatch-through: master  

M src/test/ssl/ssl/client-der.key
M src/test/ssl/ssl/client-encrypted-der.key

commit   : 7316f11be03863858fa7acb5eee97ec35c91fca4    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Jan 2020 10:51:58 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Jan 2020 10:51:58 -0500    

Click here for diff

Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/20200102184059.GA25435@alvherre.pgsql  
  
Backpatch-through: master  

M src/tools/copyright.pl

walreceiver uses a temporary replication slot by default

commit   : 329730827848f61eb8d353d5addcbd885fa823da    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 14:07:11 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 14:07:11 +0100    

Click here for diff

If no permanent replication slot is configured using  
primary_slot_name, the walreceiver now creates and uses a temporary  
replication slot.  A new setting wal_receiver_create_temp_slot can be  
used to disable this behavior, for example, if the remote instance is  
out of replication slots.  
  
Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/CA%2Bfd4k4dM0iEPLxyVyme2RAFsn8SUgrNtBJOu81YqTY4V%2BnqZA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/walreceiver.h

Expose PQbackendPID() through walreceiver API

commit   : ee4ac46c8eb289bc200d0fd682e75d11b4c55b5a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 14:05:25 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 14:05:25 +0100    

Click here for diff

This will be used by a subsequent patch.  
  
Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/CA%2Bfd4k4dM0iEPLxyVyme2RAFsn8SUgrNtBJOu81YqTY4V%2BnqZA%40mail.gmail.com  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/include/replication/walreceiver.h

ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION

commit   : f595117e24a79db6072979ab5a757431fd17232f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 13:09:31 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 14 Jan 2020 13:09:31 +0100    

Click here for diff

Add an ALTER TABLE subcommand for dropping the generated property from  
a column, per SQL standard.  
  
Reviewed-by: Sergei Kornilov <sk@zsrv.org>  
Discussion: https://www.postgresql.org/message-id/flat/2f7f1d9c-946e-0453-d841-4f38eb9d69b6%402ndquadrant.com  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/catalog/sql_features.txt
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

commit   : d751ba523546df2b2709c1ffd4d12d6a25e25bf6    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Tue, 14 Jan 2020 09:52:21 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Tue, 14 Jan 2020 09:52:21 +0000    

Click here for diff

A view with conditional INSTEAD rules and no unconditional INSTEAD  
rules or INSTEAD OF triggers is not auto-updatable. Previously we  
relied on a check in the executor to catch this, but that's  
problematic since the planner may fail to properly handle such a query  
and thus return a particularly unhelpful error to the user, before  
reaching the executor check.  
  
Instead, trap this in the rewriter and report the correct error there.  
Doing so also allows us to include more useful error detail than the  
executor check can provide. This doesn't change the existing behaviour  
of updatable views; it merely ensures that useful error messages are  
reported when a view isn't updatable.  
  
Per report from Pengzhou Tang, though not adopting that suggested fix.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com  

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

Revert test added by commit d207038053.

commit   : ed7bb5c311ce059294807cf4abfa9406d95feec0    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 11 Jan 2020 10:24:48 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 11 Jan 2020 10:24:48 +0530    

Click here for diff

This test was trying to test the mechanism to release kernel FDs as needed  
to get us under the max_safe_fds limit in case of spill files.  To do that,  
it needs to set max_files_per_process to a very low value which doesn't  
even permit starting of the server in the case when there are a few already  
opened files.  This test also won't work on platforms where we use one FD  
per semaphore.  
  
Backpatch-through: 10, till where this test was added  
Discussion:  
https://postgr.es/m/CAA4eK1LHhERi06Q+MmP9qBXBBboi+7WV3910J0aUgz71LcnKAw@mail.gmail.com  
https://postgr.es/m/6485.1578583522@sss.pgh.pa.us  

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

Reduce size of backend scanner's tables.

commit   : 7f380c59f800f7e0fb49f45a6ff7787256851a59    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 Jan 2020 15:04:31 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 13 Jan 2020 15:04:31 -0500    

Click here for diff

Previously, the core scanner's yy_transition[] array had 37045 elements.  
Since that number is larger than INT16_MAX, Flex generated the array to  
contain 32-bit integers.  By reimplementing some of the bulkier scanner  
rules, this patch reduces the array to 20495 elements.  The much smaller  
total length, combined with the consequent use of 16-bit integers for  
the array elements reduces the binary size by over 200kB.  This was  
accomplished in two ways:  
  
1. Consolidate handling of quote continuations into a new start condition,  
rather than duplicating that logic for five different string types.  
  
2. Treat Unicode strings and identifiers followed by a UESCAPE sequence  
as three separate tokens, rather than one.  The logic to de-escape  
Unicode strings is moved to the filter code in parser.c, which already  
had the ability to provide special processing for token sequences.  
While we could have implemented the conversion in the grammar, that  
approach was rejected for performance and maintainability reasons.  
  
Performance in microbenchmarks of raw parsing seems equal or slightly  
faster in most cases, and it's reasonable to expect that in real-world  
usage (with more competition for the CPU cache) there will be a larger  
win.  The exception is UESCAPE sequences; lexing those is about 10%  
slower, primarily because the scanner now has to be called three times  
rather than one.  This seems acceptable since that feature is very  
rarely used.  
  
The psql and epcg lexers are likewise modified, primarily because we  
want to keep them all in sync.  Since those lexers don't use the  
space-hogging -CF option, the space savings is much less, but it's  
still good for perhaps 10kB apiece.  
  
While at it, merge the ecpg lexer's handling of C-style comments used  
in SQL and in C.  Those have different rules regarding nested comments,  
but since we already have the ability to keep track of the previous  
start condition, we can use that to handle both cases within a single  
start condition.  This matches the core scanner more closely.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CACPNZCvaoa3EgVWm5yZhcSTX6RAtaLgniCPcBVOCwm8h3xpWkw@mail.gmail.com  

M src/backend/parser/gram.y
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/include/fe_utils/psqlscan_int.h
M src/include/mb/pg_wchar.h
M src/include/parser/kwlist.h
M src/include/parser/scanner.h
M src/interfaces/ecpg/preproc/ecpg.tokens
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/expected/preproc-strings.c
M src/interfaces/ecpg/test/expected/preproc-strings.stderr
M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Fix base backup with database OIDs larger than INT32_MAX

commit   : 259bbe177808986e5d226ea7ce5a1ebb74657791    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Jan 2020 13:27:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Jan 2020 13:27:39 +0100    

Click here for diff

The use of pg_atoi() for parsing a string into an Oid fails for values  
larger than INT32_MAX, since OIDs are unsigned.  Instead, use  
atooid().  While this has less error checking, the contents of the  
data directory are expected to be trustworthy, so we don't need to go  
out of our way to do full error checking.  
  
Discussion: https://www.postgresql.org/message-id/flat/dea47fc8-6c89-a2b1-07e3-754ff1ab094b%402ndquadrant.com  

M src/backend/replication/basebackup.c

Fix typo.

commit   : 23d0dfa8fa016f7f8af25b1040d7a55ba77da6fc    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Jan 2020 14:44:55 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Jan 2020 14:44:55 +0530    

Click here for diff

Reported-by: Antonin Houska  
Author: Antonin Houska  
Backpatch-through: 11, where it was introduced  
Discussion: https://postgr.es/m/2246.1578900133@antos  

M src/include/access/session.h

Fix comment in heapam.c

commit   : 7689d907bbb177fa2a8f5aca3f968761dd16bf28    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 13 Jan 2020 17:57:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 13 Jan 2020 17:57:38 +0900    

Click here for diff

Improvement per suggestion from Tom Lane.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/FED18699-4270-4778-8DA8-10F119A5ECF3@yesql.se  

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

Only superuser can set sslcert/sslkey in postgres_fdw user mappings

commit   : cebf9d6e6ee13cbf9f1a91ec633cf96780ffc985    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 13 Jan 2020 18:08:09 +1030    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 13 Jan 2020 18:08:09 +1030    

Click here for diff

Othrwise there is a security risk.  
  
Discussion: https://postgr.es/m/20200109103014.GA4192@msg.df7cb.de  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Delete empty pages in each pass during GIST VACUUM.

commit   : 4e514c6180fbf71cf7a0171867c828c63afd1c37    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Jan 2020 07:59:44 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Jan 2020 07:59:44 +0530    

Click here for diff

Earlier, we use to postpone deleting empty pages till the second stage of  
vacuum to amortize the cost of scanning internal pages.  However, that can  
sometimes (say vacuum is canceled or errored between first and second  
stage) delay the pages to be recycled.  
  
Another thing is that to facilitate deleting empty pages in the second  
stage, we need to share the information about internal and empty pages  
between different stages of vacuum.  It will be quite tricky to share this  
information via DSM which is required for the upcoming parallel vacuum  
patch.  
  
Also, it will bring the logic to reclaim deleted pages closer to nbtree  
where we delete empty pages in each pass.  
  
Overall, the advantages of deleting empty pages in each pass outweigh the  
advantages of postponing the same.  
  
Author: Dilip Kumar, with changes by Amit Kapila  
Reviewed-by: Sawada Masahiko and Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1LGr+MN0xHZpJ2dfS8QNQ1a_aROKowZB+MPNep8FVtwAA@mail.gmail.com  

M src/backend/access/gist/README
M src/backend/access/gist/gistvacuum.c

Apply multiple multivariate MCV lists when possible

commit   : eae056c19ee8f5ebc45ac0fe13181f91c8791e00    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    

Click here for diff

Until now we've only used a single multivariate MCV list per relation,  
covering the largest number of clauses. So for example given a query  
  
    SELECT * FROM t WHERE a = 1 AND b =1 AND c = 1 AND d = 1  
  
and extended statistics on (a,b) and (c,d), we'd only pick and use one  
of them. This commit improves this by repeatedly picking and applying  
the best statistics (matching the largest number of remaining clauses)  
until no additional statistics is applicable.  
  
This greedy algorithm is simple, but may not be optimal. A different  
choice of statistics may leave fewer clauses unestimated and/or give  
better estimates for some other reason.  
  
This can however happen only when there are overlapping statistics, and  
selecting one makes it impossible to use the other. E.g. with statistics  
on (a,b), (c,d), (b,c,d), we may pick either (a,b) and (c,d) or (b,c,d).  
But it's not clear which option is the best one.  
  
We however assume cases like this are rare, and the easiest solution is  
to define statistics covering the whole group of correlated columns. In  
the future we might support overlapping stats, using some of the clauses  
as conditions (in conditional probability sense).  
  
Author: Tomas Vondra  
Reviewed-by: Mark Dilger, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20191028152048.jc6pqv5hb7j77ocp@development  

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

Apply all available functional dependencies

commit   : aaa6761876ba5b06a5c3fa914b2951ace1e31dee    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    

Click here for diff

When considering functional dependencies during selectivity estimation,  
it's not necessary to bother with selecting the best extended statistic  
object and then use just dependencies from it. We can simply consider  
all applicable functional dependencies at once.  
  
This means we need to deserialie all (applicable) dependencies before  
applying them to the clauses. This is a bit more expensive than picking  
the best statistics and deserializing dependencies for it. To minimize  
the additional cost, we ignore statistics that are not applicable.  
  
Author: Tomas Vondra  
Reviewed-by: Mark Dilger  
Discussion: https://postgr.es/m/20191028152048.jc6pqv5hb7j77ocp@development  

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

Fix edge-case crashes and misestimation in range containment selectivity.

commit   : 652686a334b437f57f9bd0e3baa5dbd245a9e15d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 12 Jan 2020 14:36:59 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 12 Jan 2020 14:36:59 -0500    

Click here for diff

When estimating the selectivity of "range_var <@ range_constant" or  
"range_var @> range_constant", if the upper (or respectively lower)  
bound of the range_constant was above the last bin of the range_var's  
histogram, the code would access uninitialized memory and potentially  
crash (though it seems the probability of a crash is quite low).  
Handle the endpoint cases explicitly to fix that.  
  
While at it, be more paranoid about the possibility of getting NaN  
or other silly results from the range type's subdiff function.  
And improve some comments.  
  
Ordinarily we'd probably add a regression test case demonstrating  
the bug in unpatched code.  But it's too hard to get it to crash  
reliably because of the uninitialized-memory dependence, so skip that.  
  
Per bug #16122 from Adam Scott.  It's been broken from the beginning,  
apparently, so backpatch to all supported branches.  
  
Diagnosis by Michael Paquier, patch by Andrey Borodin and Tom Lane.  
  
Discussion: https://postgr.es/m/16122-eb35bc248c806c15@postgresql.org  

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

Remove incorrect assertion for INSERT in logical replication's publisher

commit   : 1088729e84cc382270c592ac8c57c323836f40ca    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 12 Jan 2020 22:43:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 12 Jan 2020 22:43:45 +0900    

Click here for diff

On the publisher, it was assumed that an INSERT change cannot happen for  
a relation with no replica identity.  However this is true only for a  
change that needs references to old rows, aka UPDATE or DELETE, so  
trying to use logical replication with a relation that has no replica  
identity led to an assertion failure in the publisher when issuing an  
INSERT.  This commit removes the incorrect assertion, and adds more  
regression tests to provide coverage for relations without replica  
identity.  
  
Reported-by: Neha Sharma  
Author: Dilip Kumar, Michael Paquier  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CANiYTQsL1Hb8_Km08qd32svrqNumXLJeoGo014O7VZymgOhZEA@mail.gmail.com  
Backpatch-through: 10  

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

Extensive code review for GSSAPI encryption mechanism.

commit   : 2c0cdc8183654c090c9a1e2f1b5e96ba4634e16a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 11 Jan 2020 17:14:08 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 11 Jan 2020 17:14:08 -0500    

Click here for diff

Fix assorted bugs in handling of non-blocking I/O when using GSSAPI  
encryption.  The encryption layer could return the wrong status  
information to its caller, resulting in effectively dropping some data  
(or possibly in aborting a not-broken connection), or in a "livelock"  
situation where data remains to be sent but the upper layers think  
transmission is done and just go to sleep.  There were multiple small  
thinkos contributing to that, as well as one big one (failure to think  
through what to do when a send fails after having already transmitted  
data).  Note that these errors could cause failures whether the client  
application asked for non-blocking I/O or not, since both libpq and  
the backend always run things in non-block mode at this level.  
  
Also get rid of use of static variables for GSSAPI inside libpq;  
that's entirely not okay given that multiple connections could be  
open at once inside a single client process.  
  
Also adjust a bunch of random small discrepancies between the frontend  
and backend versions of the send/receive functions -- except for error  
handling, they should be identical, and now they are.  
  
Also extend the Kerberos TAP tests to exercise cases where nontrivial  
amounts of data need to be pushed through encryption.  Before, those  
tests didn't provide any useful coverage at all for the cases of  
interest here.  (They still might not, depending on timing, but at  
least there's a chance.)  
  
Per complaint from pmc@citylink and subsequent investigation.  
Back-patch to v12 where this code was introduced.  
  
Discussion: https://postgr.es/m/20200109181822.GA74698@gate.oper.dinoex.org  

M src/backend/libpq/be-secure-gssapi.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/t/001_auth.pl

Make lsn argument of walrcv_create_slot() optional

commit   : c67a55da4ea0caa18547fd1533110e9126ba8d47    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 11 Jan 2020 09:00:19 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 11 Jan 2020 09:00:19 +0100    

Click here for diff

Some callers are not using it, so it's wasteful to have to specify it.  
  
Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/CA+fd4k4BcYrYucNfTnK-CQX3+jsG+PRPEhHAUSo-W4P0Lec57A@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Remove STATUS_FOUND

commit   : c096a804d9dcc46f1a8ebf2742696aca90b2dfcf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 29 Dec 2019 09:09:20 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 29 Dec 2019 09:09:20 +0100    

Click here for diff

Replace the solitary use with a bool.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/flat/a6f91ead-0ce4-2a34-062b-7ab9813ea308%402ndquadrant.com  

M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/c.h
M src/include/storage/lock.h

Maintain valid md.c state when FileClose() fails.

commit   : 38fc056074e034087af8a1589507631682a279d1    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 10 Jan 2020 18:31:22 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 10 Jan 2020 18:31:22 -0800    

Click here for diff

FileClose() failure ordinarily causes a PANIC.  Suppose the user  
disables that PANIC via data_sync_retry=on.  After mdclose() issued a  
FileClose() that failed, calls into md.c raised SIGSEGV.  This fix adds  
repalloc() calls during mdclose(); update a comment about ignoring  
repalloc() cost.  The rate of relation segment count change is a minor  
factor; more relevant to overall performance is the rate of mdclose()  
and subsequent re-opening of segments.  Back-patch to v10, where commit  
45e191e3aa62d47a8bc1a33f784286b2051f45cb introduced the bug.  
  
Reviewed by Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/20191222091930.GA1280238@rfd.leadboat.com  

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

nbtree: Rename BT_HEAP_TID_ATTR.

commit   : 1a4a0329650b0545a54afb3c317aa289fd817f8a    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 10 Jan 2020 13:15:28 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 10 Jan 2020 13:15:28 -0800    

Click here for diff

Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  

M src/include/access/nbtree.h

nbtree: BTREE_[MIN|NOVAC]_VERSION comment tweaks.

commit   : a0dc3c19ed1cffed6616f8b8b5f21ad7d6830045    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 10 Jan 2020 13:12:50 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 10 Jan 2020 13:12:50 -0800    

Click here for diff

Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  

M src/include/access/nbtree.h

Clean up representation of flags in struct ReorderBufferTXN

commit   : a7b6ab5db1d35438112f74f3531354ddd61970b5    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 10 Jan 2020 17:46:57 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 10 Jan 2020 17:46:57 -0300    

Click here for diff

This simplifies addition of further flags.  
  
Author: Nikhil Sontakke  
Discussion: https://postgr.es/m/CAMGcDxeViP+R-OL7QhzUV9eKCVjURobuY1Zijik4Ay_Ddwo4Cg@mail.gmail.com  

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

doc: Fix naming of SELinux

commit   : 00b047fa67e9f4428a682bd90d5e6b08d2f8a87b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 Jan 2020 09:36:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 Jan 2020 09:36:55 +0900    

Click here for diff

Reported-by: Tham Nguyen  
Discussion: https://postgr.es/m/157851402876.29175.12977878383183540468@wrigleys.postgresql.org  
Backpatch-through: 9.4  

M doc/src/sgml/ref/security_label.sgml
M src/test/modules/dummy_seclabel/README

pgbench: Make more debug messages use common logging API

commit   : 39a5f2a94f8a3bcfdb3da7391427a63f8f88b210    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 Jan 2020 09:02:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 Jan 2020 09:02:25 +0900    

Click here for diff

This is a follow-up of 30a3e772, making the output more consistent when  
using --debug for meta-command execution.  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1912241100390.3339@pseudo  

M src/bin/pgbench/pgbench.c

Skip tab-completion tests if envar SKIP_READLINE_TESTS is defined.

commit   : e7ee433137b6eb3678deeebc68be53d58aa1e5d3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Jan 2020 16:46:05 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Jan 2020 16:46:05 -0500    

Click here for diff

Experience so far suggests that getting these tests to pass on  
all libedit versions that are out there may be impossible, or  
require dumbing down the tests to the point of uselessness.  
So we need to provide a way to skip them when the user knows they'll  
fail.  An environment variable is probably the most convenient way  
to deal with this; it's easy for, e.g., a buildfarm animal's  
configuration to set up.  
  
Discussion: https://postgr.es/m/9594.1578586797@sss.pgh.pa.us  

M src/bin/psql/t/010_tab_completion.pl

Reconsider the representation of join alias Vars.

commit   : 9ce77d75c5ab094637cc4a446296dc3be6e3c221    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Jan 2020 11:56:59 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Jan 2020 11:56:59 -0500    

Click here for diff

The core idea of this patch is to make the parser generate join alias  
Vars (that is, ones with varno pointing to a JOIN RTE) only when the  
alias Var is actually different from any raw join input, that is a type  
coercion and/or COALESCE is necessary to generate the join output value.  
Otherwise just generate varno/varattno pointing to the relevant join  
input column.  
  
In effect, this means that the planner's flatten_join_alias_vars()  
transformation is already done in the parser, for all cases except  
(a) columns that are merged by JOIN USING and are transformed in the  
process, and (b) whole-row join Vars.  In principle that would allow  
us to skip doing flatten_join_alias_vars() in many more queries than  
we do now, but we don't have quite enough infrastructure to know that  
we can do so --- in particular there's no cheap way to know whether  
there are any whole-row join Vars.  I'm not sure if it's worth the  
trouble to add a Query-level flag for that, and in any case it seems  
like fit material for a separate patch.  But even without skipping the  
work entirely, this should make flatten_join_alias_vars() faster,  
particularly where there are nested joins that it previously had to  
flatten recursively.  
  
An essential part of this change is to replace Var nodes'  
varnoold/varoattno fields with varnosyn/varattnosyn, which have  
considerably more tightly-defined meanings than the old fields: when  
they differ from varno/varattno, they identify the Var's position in  
an aliased JOIN RTE, and the join alias is what ruleutils.c should  
print for the Var.  This is necessary because the varno change  
destroyed ruleutils.c's ability to find the JOIN RTE from the Var's  
varno.  
  
Another way in which this change broke ruleutils.c is that it's no  
longer feasible to determine, from a JOIN RTE's joinaliasvars list,  
which join columns correspond to which columns of the join's immediate  
input relations.  (If those are sub-joins, the joinaliasvars entries  
may point to columns of their base relations, not the sub-joins.)  
But that was a horrid mess requiring a lot of fragile assumptions  
already, so let's just bite the bullet and add some more JOIN RTE  
fields to make it more straightforward to figure that out.  I added  
two integer-List fields containing the relevant column numbers from  
the left and right input rels, plus a count of how many merged columns  
there are.  
  
This patch depends on the ParseNamespaceColumn infrastructure that  
I added in commit 5815696bc.  The biggest bit of code change is  
restructuring transformFromClauseItem's handling of JOINs so that  
the ParseNamespaceColumn data is propagated upward correctly.  
  
Other than that and the ruleutils fixes, everything pretty much  
just works, though some processing is now inessential.  I grabbed  
two pieces of low-hanging fruit in that line:  
  
1. In find_expr_references, we don't need to recurse into join alias  
Vars anymore.  There aren't any except for references to merged USING  
columns, which are more properly handled when we scan the join's RTE.  
This change actually fixes an edge-case issue: we will now record a  
dependency on any type-coercion function present in a USING column's  
joinaliasvar, even if that join column has no references in the query  
text.  The odds of the missing dependency causing a problem seem quite  
small: you'd have to posit somebody dropping an implicit cast between  
two data types, without removing the types themselves, and then having  
a stored rule containing a whole-row Var for a join whose USING merge  
depends on that cast.  So I don't feel a great need to change this in  
the back branches.  But in theory this way is more correct.  
  
2. markRTEForSelectPriv and markTargetListOrigin don't need to recurse  
into join alias Vars either, because the cases they care about don't  
apply to alias Vars for USING columns that are semantically distinct  
from the underlying columns.  This removes the only case in which  
markVarForSelectPriv could be called with NULL for the RTE, so adjust  
the comments to describe that hack as being strictly internal to  
markRTEForSelectPriv.  
  
catversion bump required due to changes in stored rules.  
  
Discussion: https://postgr.es/m/7115.1577986646@sss.pgh.pa.us  

M src/backend/catalog/dependency.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/paramassign.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteManip.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/parse_relation.h

Add pg_shmem_allocations view.

commit   : ed10f32e37e9a16814c25e400d7826745ae3c797    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 9 Jan 2020 10:59:07 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 9 Jan 2020 10:59:07 -0500    

Click here for diff

This tells you about allocations that have been made from the main  
shared memory segment. The original patch also tried to show information  
about dynamic shared memory allocation as well, but I decided to  
leave that problem for another time.  
  
Andres Freund and Robert Haas, reviewed by Michael Paquier, Marti  
Raudsepp, Tom Lane, Álvaro Herrera, and Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/20140504114417.GM12715@awork2.anarazel.de  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/ipc/shmem.c
M src/include/catalog/pg_proc.dat
M src/include/storage/shmem.h
M src/test/regress/expected/rules.out

Remove bogus 'return'.

commit   : 5acf6d8bb4ec23349604c7c15111959e657ff294    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 9 Jan 2020 09:01:37 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 9 Jan 2020 09:01:37 -0500    

Click here for diff

Per the buildfarm, via Michael Paquier.  
  
Discussion: http://postgr.es/m/20200108032648.GE3413@paquier.xyz  

M src/include/access/tableam.h

Clarify that pg_trgm is used in example

commit   : e3019f631d1f2e21667ad05f903c52d904b9048c    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Thu, 9 Jan 2020 10:48:22 +0100    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Thu, 9 Jan 2020 10:48:22 +0100    

Click here for diff

Reported-by: Octopus ZHANG  
Author: Daniel Gustafsson  

M doc/src/sgml/rules.sgml

Add support for automatically updating Unicode derived files

commit   : f85a485f89e2eb38499558c7489f108994410952    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 Jan 2020 09:54:47 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 Jan 2020 09:54:47 +0100    

Click here for diff

We currently have several sets of files generated from data provided  
by Unicode.  These all have ad hoc rules and instructions for updating  
when new Unicode versions appear, and it's not done consistently.  
  
This patch centralizes and automates the process and makes it part of  
the release checklist.  The Unicode and CLDR versions are specified in  
Makefile.global.in.  There is a new make target "update-unicode" that  
downloads all the relevant files and runs the generation script.  
  
There is also a new script for generating the table of combining  
characters for ucs_wcwidth().  That table is now in a separate include  
file rather than hardcoded into the middle of other code.  This is  
based on the script that was used for generating  
d8594d123c155aeecd47fc2450f62f5100b2fbf0, but the script itself wasn't  
committed at that time.  
  
Reviewed-by: John Naylor <john.naylor@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/flat/c8d05f42-443e-6c23-819b-05b31759a37c@2ndquadrant.com  

M GNUmakefile.in
M contrib/unaccent/.gitignore
M contrib/unaccent/Makefile
M contrib/unaccent/generate_unaccent_rules.py
M src/Makefile.global.in
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/wchar.c
M src/common/unicode/.gitignore
M src/common/unicode/Makefile
M src/common/unicode/README
A src/common/unicode/generate-unicode_combining_table.pl
A src/include/common/unicode_combining_table.h
M src/tools/RELEASE_CHANGES

Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings

commit   : f5fd995a1a24e6571d26b1e29c4dc179112b1003    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Jan 2020 18:39:54 +1030    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Jan 2020 18:39:54 +1030    

Click here for diff

This allows different users to authenticate with different certificates.  
  
Author: Craig Ringer  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Modernize Python exception syntax in tests

commit   : 45223fd9cefe483daa4af7740f15c004486636eb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    

Click here for diff

Change the exception syntax used in the tests to use the more current  
  
    except Exception as ex:  
  
rather than the old  
  
    except Exception, ex:  
  
Since support for Python <2.6 has been removed, all supported versions  
now support the new style, and we can save one step in the Python 3  
compatibility conversion.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com  

M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/expected/plpython_error.out
M src/pl/plpython/expected/plpython_import.out
M src/pl/plpython/expected/plpython_params.out
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/regress-python3-mangle.mk
M src/pl/plpython/sql/plpython_ereport.sql
M src/pl/plpython/sql/plpython_error.sql
M src/pl/plpython/sql/plpython_import.sql
M src/pl/plpython/sql/plpython_params.sql
M src/pl/plpython/sql/plpython_spi.sql
M src/pl/plpython/sql/plpython_subtransaction.sql
M src/pl/plpython/sql/plpython_types.sql
M src/tools/msvc/vcregress.pl

Remove support for Python older than 2.6

commit   : 37f21ed132d1c5aee88e81fee0a0b7e735673d35    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    

Click here for diff

Supporting very old Python versions is a maintenance burden,  
especially with the several variant test files to maintain for Python  
<2.6.  
  
Since we have dropped support for older OpenSSL versions in  
7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a, RHEL 5 is now effectively  
desupported, and that was also the only mainstream operating system  
still using Python versions before 2.6, so it's a good time to drop  
those as well.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml
M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/README
D src/pl/plpython/expected/plpython_error_0.out
M src/pl/plpython/expected/plpython_subtransaction.out
D src/pl/plpython/expected/plpython_subtransaction_0.out
D src/pl/plpython/expected/plpython_subtransaction_5.out
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpython.h
M src/pl/plpython/sql/plpython_subtransaction.sql

Reimplement nullification of walsender timestamp

commit   : f5d28710c707ad602cd869602e092cc9d538cbb9    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 8 Jan 2020 14:33:49 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 8 Jan 2020 14:33:49 -0300    

Click here for diff

Make the value null only at pg_stat_activity-output time, as suggested  
by Tom Lane, instead of messing with the internal state.  This should  
appease buildfarm members with force_parallel_mode=regress, which are  
running parallel queries on logical replication walsenders.  
  
The fact that walsenders can run parallel queries should perhaps be  
studied more carefully, but for the moment let's get rid of the red  
blots in buildfarm.  
  
Backpatch to pg10, like the previous commit.  
  
Discussion: https://postgr.es/m/30804.1578438763@sss.pgh.pa.us  

M src/backend/access/transam/xact.c
M src/backend/utils/adt/pgstatfuncs.c

Improve the handling of result type coercions in SQL functions.

commit   : 913bbd88dc6b859c70ebb48107b38d693c4c6673    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 8 Jan 2020 11:07:53 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 8 Jan 2020 11:07:53 -0500    

Click here for diff

Use the parser's standard type coercion machinery to convert the  
output column(s) of a SQL function's final SELECT or RETURNING  
to the type(s) they should have according to the function's declared  
result type.  We'll allow any case where an assignment-level  
coercion is available.  Previously, we failed unless the required  
coercion was a binary-compatible one (and the documentation ignored  
this, falsely claiming that the types must match exactly).  
  
Notably, the coercion now accounts for typmods, so that cases where  
a SQL function is declared to return a composite type whose columns  
are typmod-constrained now behave as one would expect.  Arguably  
this aspect is a bug fix, but the overall behavioral change here  
seems too large to consider back-patching.  
  
A nice side-effect is that functions can now be inlined in a  
few cases where we previously failed to do so because of type  
mismatches.  
  
Discussion: https://postgr.es/m/18929.1574895430@sss.pgh.pa.us  

M doc/src/sgml/xfunc.sgml
M src/backend/catalog/pg_proc.c
M src/backend/executor/functions.c
M src/backend/optimizer/util/clauses.c
M src/include/executor/functions.h
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

Improve GSSAPI Encryption startup comment in libpq

commit   : 8dd1511e39acd729020e151deb15a958300ebff5    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Wed, 8 Jan 2020 10:57:09 -0500    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Wed, 8 Jan 2020 10:57:09 -0500    

Click here for diff

The original comment was a bit confusing, pointed out by Alvaro Herrera.  
  
Thread: https://postgr.es/m/20191224151520.GA16435%40alvherre.pgsql  

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

Fix handling of generated columns in ALTER TABLE.

commit   : 4ac8aaa36fa24639989849c8109f8b52e9544fd1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 8 Jan 2020 09:42:53 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 8 Jan 2020 09:42:53 -0500    

Click here for diff

ALTER TABLE failed if a column referenced in a GENERATED expression  
had been added or changed in type earlier in the ALTER command.  
That's because the GENERATED expression needs to be evaluated  
against the table's updated tuples, but it was being evaluated  
against the original tuples.  (Fortunately the executor has adequate  
cross-checks to notice the mismatch, so we just got an obscure error  
message and not anything more dangerous.)  
  
Per report from Andreas Joseph Krogh.  Back-patch to v12 where  
GENERATED was added.  
  
Discussion: https://postgr.es/m/VisenaEmail.200.231b0a41523275d0.16ea7f800c7@tc7-visena  

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

pgbench: Use common logging API

commit   : 30a3e772b4013d6593e4141cebd5ebfaff4d71a8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Jan 2020 14:23:55 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Jan 2020 14:23:55 +0100    

Click here for diff

Author: Fabien COELHO <coelho@cri.ensmp.fr>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1912241100390.3339@pseudo  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/002_pgbench_no_server.pl

Revert "Forbid DROP SCHEMA on temporary namespaces"

commit   : 65192e02441cedd106b6abebe0036fb8cc124fb3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 8 Jan 2020 10:36:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 8 Jan 2020 10:36:12 +0900    

Click here for diff

This reverts commit a052f6c, following complains from Robert Haas and  
Tom Lane.  Backpatch down to 9.4, like the previous commit.  
  
Discussion: https://postgr.es/m/CA+TgmobL4npEX5=E5h=5Jm_9mZun3MT39Kq2suJFVeamc9skSQ@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/commands/dropcmds.c

Remove dependency to system calls for memory allocation in refint

commit   : b0b6196386681383b8f0cb76df4fd35178a7371e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 8 Jan 2020 10:02:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 8 Jan 2020 10:02:55 +0900    

Click here for diff

Failures in allocations could lead to crashes with NULL pointer  
dereferences .  Memory context TopMemoryContext is used instead to keep  
alive the plans allocated in the session.  A more specific context could  
be used here, but this is left for later.  
  
Reported-by: Jian Zhang  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Andres Freund  
Discussion: https://postgr.es/m/16190-70181c803641c3dc@postgresql.org  

M contrib/spi/refint.c

pg_stat_activity: show NULL stmt start time for walsenders

commit   : b175bd59fa54a90d21bc541f812643ac45281b98    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 7 Jan 2020 17:38:48 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 7 Jan 2020 17:38:48 -0300    

Click here for diff

Returning a non-NULL time is pointless, sinc a walsender is not a  
process that would be running normal transactions anyway, but the code  
was unintentionally exposing the process start time intermittently,  
which was not only bogus but it also confused monitoring systems looking  
for idle transactions.  Fix by avoiding all updates in walsenders.  
  
Backpatch to 11, where walsenders started appearing in pg_stat_activity.  
  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/20191209234409.exe7osmyalwkt5j4@development  

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

tableam: New callback relation_fetch_toast_slice.

commit   : ce242ae154dde3217971c6f262705d80999f4e00    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Jan 2020 14:35:48 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Jan 2020 14:35:48 -0500    

Click here for diff

Instead of always calling heap_fetch_toast_slice during detoasting,  
invoke a table AM callback which, when the toast table is a heap  
table, will be heap_fetch_toast_slice.  
  
This makes it possible for a table AM other than heap to be used  
as a TOAST table. It also completes the series of commits intended  
to improve the interaction of tableam with TOAST that began with  
commit 8b94dab06617ef80a0901ab103ebd8754427ef5a; detoast.c is  
now, hopefully, fully AM-independent.  
  
Patch by me, reviewed by Andres Freund and Peter Eisentraut.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M src/backend/access/common/detoast.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heaptoast.c
M src/include/access/heaptoast.h
M src/include/access/tableam.h

tableam: Allow choice of toast AM.

commit   : 83322e38da1aa054e1b144cb37e6074a86854199    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Jan 2020 14:23:25 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Jan 2020 14:23:25 -0500    

Click here for diff

Previously, the toast table had to be implemented by the same AM that  
was used for the main table, which was bad, because the detoasting  
code won't work with anything but heap. This commit doesn't fix the  
latter problem, although there's another patch coming which does,  
but it does let you pick something that works (i.e. heap, right now).  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

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

Increase the maximum value of track_activity_query_size.

commit   : 814727858918154bdde9dbdfb99c544b52eb8818    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Jan 2020 12:14:19 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Jan 2020 12:14:19 -0500    

Click here for diff

This one-line change provoked a lot of discussion, but ultimately  
the consensus seems to be that allowing a larger value might be  
useful to somebody, and probably won't hurt anyone who chooses  
not to take advantage of the higher maximum limit.  
  
Vyacheslav Makarov, reviewed by many people.  
  
Discussion: http://postgr.es/m/7b5ecc5a9991045e2f13c84e3047541d@postgrespro.ru  

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

Clean up management of IP addresses in our SSL tests.

commit   : 2bd0735b954b14dcfab85d57fc4a0c7f9826fbb1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Jan 2020 20:56:32 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Jan 2020 20:56:32 -0500    

Click here for diff

Instead of hard-wiring the netmask as /32, allow it to be specified  
where we specify the server address.  This will ease changing the  
test to use IPv6, when/if somebody wants to do that.  
  
Also remove the hard-wired pg_hba.conf entries for IPv6 (::1/128).  
These have never had any usefulness, because the client side  
of the tests has always explicitly connected to $SERVERHOSTADDR  
which has always been set to IPv4 (127.0.0.1).  All they accomplish  
is to break the test on non-IPv6-supporting hosts, and besides  
that they violate the express intent of the code to minimize the  
server's range of allowed connections.  
  
This could be back-patched, perhaps, but for now I don't see  
a need to.  
  
Discussion: https://postgr.es/m/1899.1578356089@sss.pgh.pa.us  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/SSLServer.pm

Reduce the number of GetFlushRecPtr() calls done by walsenders.

commit   : e369f3708636c66718796fc8269d253432410392    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Jan 2020 16:42:20 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Jan 2020 16:42:20 -0500    

Click here for diff

Since the WAL flush position only moves forward, it's safe to cache  
its previous value within each walsender process, and update from  
shared memory only once we've caught up to the previously-seen value.  
When there are many active walsenders, this makes for a very significant  
reduction in the amount of contention on the XLogCtl->info_lck spinlock.  
  
This patch also adjusts the logic so that we update our idea of the  
flush position after processing a WAL record, rather than beforehand.  
This may cause us to realize we're not caught up when the preceding  
coding would've thought that we were, but that seems all to the good;  
it may avoid a useless sleep-and-wakeup cycle.  
  
Back-patch to v12.  The contention problem exists in prior branches,  
but it's much less severe (due to inefficiencies elsewhere) so there  
seems no need to take any risk of back-patching further.  
  
Pierre Ducroquet, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/2931018.Vxl9zapr77@pierred-pdoc  

M src/backend/replication/walsender.c

Add functions min_scale(numeric) and trim_scale(numeric).

commit   : 20d6225d1656102534a73d9675bc531ff0e5203b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Jan 2020 12:13:53 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Jan 2020 12:13:53 -0500    

Click here for diff

These allow better control of trailing zeroes in numeric values.  
  
Pavel Stehule, based on an old proposal of Marko Tiikkaja's;  
review by Karl Pinc  
  
Discussion: https://postgr.es/m/CAFj8pRDjs-navGASeF0Wk74N36YGFJ+v=Ok9_knRa7vDc-qugg@mail.gmail.com  

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

Have logical replication subscriber fire column triggers

commit   : b9c130a1fdf16cd99afb390c186d19acaea7d132    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 6 Jan 2020 08:21:14 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 6 Jan 2020 08:21:14 +0100    

Click here for diff

The logical replication apply worker did not fire per-column update  
triggers because the updatedCols bitmap in the RTE was not populated.  
This fixes that.  
  
Reviewed-by: Euler Taveira <euler@timbira.com.br>  
Discussion: https://www.postgresql.org/message-id/flat/21673e2d-597c-6afe-637e-e8b10425b240%402ndquadrant.com  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/003_constraints.pl

Remove support for OpenSSL 0.9.8 and 1.0.0

commit   : 7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Jan 2020 12:51:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Jan 2020 12:51:44 +0900    

Click here for diff

Support is out of scope from all the major vendors for these versions  
(for example RHEL5 uses a version based on 0.9.8, and RHEL6 uses 1.0.1),  
and it created some extra maintenance work.  Upstream has stopped  
support of 0.9.8 in December 2015 and of 1.0.0 in February 2016.  
  
Since b1abfec, note that the default SSL protocol version set with  
ssl_min_protocol_version is TLSv1.2, whose support was added in OpenSSL  
1.0.1, so there is no point to enforce ssl_min_protocol_version to TLSv1  
in the SSL tests.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/20191205083252.GE5064@paquier.xyz  

M doc/src/sgml/installation.sgml
M doc/src/sgml/libpq.sgml
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/t/SSLServer.pm

Remove redundant incomplete split assertion.

commit   : fc3100112395485f1c65848b273b3235de4aad07    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 5 Jan 2020 17:42:13 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 5 Jan 2020 17:42:13 -0800    

Click here for diff

The fastpath insert optimization's incomplete split flag Assert() is  
redundant.  We'll reach the more general Assert() within  
_bt_findinsertloc() in all cases. (Besides, Assert()'ing that the  
rightmost page doesn't have the flag set never made much sense.)  

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

Minor style improvements for tab-completion test.

commit   : 8c081a2f4e8eec11747e709c1ea4c3485ef129dd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 Jan 2020 11:35:45 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 Jan 2020 11:35:45 -0500    

Click here for diff

Use qr// syntax for regex values.  
Include the regex that failed to match in diagnostic reports.  
  
Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/87k16610xk.fsf@wibble.ilmari.org  

M src/bin/psql/t/010_tab_completion.pl

Docs: use more standard terminology "round-to-nearest-even" instead of "round-to-even".

commit   : 955f1213012361e32d88976c3ce03ae62153c355    
  
author   : Tatsuo Ishii <ishii@postgresql.org>    
date     : Sun, 5 Jan 2020 19:45:37 +0900    
  
committer: Tatsuo Ishii <ishii@postgresql.org>    
date     : Sun, 5 Jan 2020 19:45:37 +0900    

Click here for diff

Per suggestion from Tom Lane.  
Discussion: https://postgr.es/m/flat/20191230.093451.1762483750956466101.t-ishii%40sraoss.co.jp  

M doc/src/sgml/datatype.sgml

Avoid reading ~/.inputrc in tab-completion test, and revert other changes.

commit   : 48e03583cd373ce67827f4d8a99dcef8242364b0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 21:33:34 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 21:33:34 -0500    

Click here for diff

The true explanation for Peter Geoghegan's trouble report turns out  
to be that he has a ~/.inputrc that affects readline's behavior  
enough to break this test.  Prevent readline from reading that file.  
  
Also, the best way to prevent TERM from affecting the results seems  
to be to unset it altogether, not to set it to "xterm".  The latter  
choice licenses readline to emit xterm escape sequences, and there's  
a lot of variation in exactly what it will emit.  
  
Revert changes that attempted to account exactly for xterm escape  
sequences.  We shouldn't need that with TERM unset, and it was not  
looking like a maintainable solution anyway.  
  
Discussion: https://postgr.es/m/23181.1578167938@sss.pgh.pa.us  

M src/bin/psql/t/010_tab_completion.pl

Don't try to force TERM to a fixed value in tab-completion test.

commit   : 7e42478186aa8b41a8706f3f53b44e25a427bde9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 16:40:56 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 16:40:56 -0500    

Click here for diff

Right at the moment, this is making things worse not better in the  
buildfarm.  I'm not happy with anything about the current state,  
but let's at least try to have a green buildfarm report while further  
investigation continues.  
  
Discussion: https://postgr.es/m/23181.1578167938@sss.pgh.pa.us  

M src/bin/psql/t/010_tab_completion.pl

In tab-completion test, print out the value of TERM before changing it.

commit   : 60ab7c80b4de2c3591e50dfb5ed0fd4002f0f2f2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 15:05:24 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 15:05:24 -0500    

Click here for diff

I'm curious to see what values are prevailing in the buildfarm.  
  
Discussion: https://postgr.es/m/23181.1578167938@sss.pgh.pa.us  

M src/bin/psql/t/010_tab_completion.pl

Skip memcpy(x, x) in qunique().

commit   : 5b630501e9fa58c5069b36247d63fc460d912c7f    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 4 Jan 2020 11:31:42 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 4 Jan 2020 11:31:42 -0800    

Click here for diff

It has undefined behavior.  Follow the precedent of commit  
9a9473f3cce1a21c25d6cc7569710e832d2b180b.  No back-patch, since the  
master branch alone has this function.  
  
Discussion: https://postgr.es/m/20191229070221.GA13873@gust.leadboat.com  

M src/include/lib/qunique.h

Make tab-completion tests more robust.

commit   : fac1c04feca6d01f2d324088c5899485f55b6217    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 14:29:28 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Jan 2020 14:29:28 -0500    

Click here for diff

Depending on as-yet-incompletely-explained factors, readline/libedit  
might choose to emit screen-control escape sequences as part of  
repainting the display.  I'd tried to make the test patterns avoid  
matching parts of the output that are likely to contain such, but  
it seems that there's really no way around matching them explicitly  
in some places, unless we want to just give up testing some behaviors  
such as display of alternatives.  
  
Per report from Peter Geoghegan.  
  
Discussion: https://postgr.es/m/CAH2-WznPzfWHu8PQwv1Qjpf4wQVPaaWpoO5NunFz9zsYKB4uJA@mail.gmail.com  

M src/bin/psql/t/010_tab_completion.pl

Make better use of ParseState in ProcessUtility

commit   : 3fd40b628c7db4c4bcf03b548f9a55f85e327e25    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 4 Jan 2020 11:56:58 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 4 Jan 2020 11:56:58 +0100    

Click here for diff

Pass ParseState into the functions called from  
standard_ProcessUtility() instead passing the query string and query  
environment separately.  No functionality change, but it makes the  
notation consistent.  We had already started moving things into  
that direction piece by piece, and this completes it.  
  
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/6e7aa4a1-be6a-1a75-b1f9-83a678e5184a@2ndquadrant.com  

M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/tcop/utility.c
M src/include/commands/createas.h
M src/include/commands/explain.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h

Add xl_btree_delete optimization.

commit   : d2e5e20e57111cca9e14f6e5a99a186d4c66a5b7    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 3 Jan 2020 12:18:13 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 3 Jan 2020 12:18:13 -0800    

Click here for diff

Commit 558a9165e08 taught _bt_delitems_delete() to produce its own XID  
horizon on the primary.  Standbys no longer needed to generate their own  
latestRemovedXid, since they could just use the explicitly logged value  
from the primary instead.  The deleted offset numbers array from the  
xl_btree_delete WAL record was no longer used by the REDO routine for  
anything other than deleting the items.  
  
This enables a minor optimization:  We now treat the array as buffer  
state, not generic WAL data, following _bt_delitems_vacuum()'s example.  
This should be a minor win, since it allows us to avoid including the  
deleted items array in cases where XLogInsert() stores the whole buffer  
anyway.  The primary goal here is to make the code more maintainable,  
though.  Removing inessential differences between the two functions  
highlights the fundamental differences that remain.  
  
Also change xl_btree_delete to use uint32 for the size of the array of  
item offsets being deleted.  This brings xl_btree_delete closer to  
xl_btree_vacuum.  Furthermore, it seems like a good idea to use an  
explicit-width integer type (the field was previously an "int").  
  
Bump XLOG_PAGE_MAGIC because xl_btree_delete changed.  
  
Discussion: https://postgr.es/m/CAH2-Wzkz4TjmezzfAbaV1zYrh=fr0bCpzuJTvBe5iUQ3aUPsCQ@mail.gmail.com  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/xlog_internal.h

Further fixes for tab-completion TAP tests.

commit   : 56a3921a2f5102f804bd0ff741e144a0e6f1c0b6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Jan 2020 12:54:13 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Jan 2020 12:54:13 -0500    

Click here for diff

Escape non-printable characters in failure reports, by using Data::Dumper  
in Useqq mode.  Also, bump $Test::Builder::Level so the diagnostic  
references the calling line, and use diag() instad of note(),  
so it shows even in non-verbose mode (per request from Christoph Berg).  
  
Also, give up on trying to test for the specific way that readline  
chooses to overwrite existing text in the \DRD -> \drds test.  
There are too many variants, it seems, at least on the libedit  
side of things.  
  
Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/20200103110128.GA28967@msg.df7cb.de  

M src/bin/psql/t/010_tab_completion.pl

Add an ugly workaround for a bug in some recent libedit versions.

commit   : ddd87d564508bb1c80aac0a4439cfe74a3c203a9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Jan 2020 11:15:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Jan 2020 11:15:26 -0500    

Click here for diff

Debian unstable is shipping a broken version of libedit: it de-escapes  
words before passing them to the application's tab completion function,  
preventing us from recognizing backslash commands.  Fortunately,  
we have enough information available to dig the original text out of  
rl_line_buffer, so ignore the string argument and do that.  
  
I view this as a temporary workaround to get the affected buildfarm  
members back to green in the wake of 7c015045b.  I hope we can get  
rid of it once somebody fixes Debian's libedit; hence, no back-patch,  
at least for now.  
  
Discussion: https://postgr.es/m/20200103110128.GA28967@msg.df7cb.de  

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

pgbench: Improve test description

commit   : 04334fde69132f335d9d70cfefe419bd1276b232    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 3 Jan 2020 10:44:13 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 3 Jan 2020 10:44:13 +0100    

Click here for diff

Author: Fabien COELHO <coelho@cri.ensmp.fr>  

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

Fix typos in parallel query docs.

commit   : d5b6b6515b35b11c82ce620fa84c989f246068aa    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 3 Jan 2020 10:52:46 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 3 Jan 2020 10:52:46 +0530    

Click here for diff

Reported-by: Jon Jensen  
Author: Jon Jensen  
Reviewed-by: Amit Kapila and Robert Haas  
Backpatch-through: 10  
Discussion: https://postgr.es/m/nycvar.YSQ.7.76.1912301807510.9899@ybpnyubfg  

M doc/src/sgml/parallel.sgml

Clear up btree_xlog_split() alignment comment.

commit   : 0c41c83d8ff44ed8f9753885e2c11b3277babcce    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 Jan 2020 18:30:25 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 Jan 2020 18:30:25 -0800    

Click here for diff

Adjust a comment that describes how alignment of the new left page high  
key works in btree_xlog_split(), the nbtree page split REDO routine.  
The wording used before commit 2c03216d831 is much clearer, so go back  
to that.  

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

Minor portability fixes for new TAP script.

commit   : 90d7f6604b6ed2dcedee2884c3b01541600515cb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 19:44:43 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 19:44:43 -0500    

Click here for diff

Satisfy perlcritic, mostly.  Per buildfarm.  

M src/bin/psql/t/010_tab_completion.pl

Correct _bt_delitems_vacuum() lock comments.

commit   : 44e44bd258a71162444d41a1044c795f2c6dd3d1    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 Jan 2020 13:30:40 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 Jan 2020 13:30:40 -0800    

Click here for diff

The expectation within _bt_delitems_vacuum() is that caller has a  
super-exclusive/cleanup buffer lock (not just a pin and a write lock).  

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

Fix cloning of row triggers to sub-partitions

commit   : 1fa846f1c9afe6bb185d4bb60bed8102a8eacb8f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 2 Jan 2020 17:04:24 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 2 Jan 2020 17:04:24 -0300    

Click here for diff

When row triggers exist in partitioned partitions that are not either  
part of FKs or deferred unique constraints, they are not correctly  
cloned to their partitions.  That's because they are marked "internal",  
and those are purposefully skipped when doing the clone triggers dance.  
Fix by relaxing the condition on which internal triggers are skipped.  
  
Amit Langote initially diagnosed the problem and proposed a fix, but I  
used a different approach.  
  
Reported-by: Petr Fedorov  
Discussion: https://postgr.es/m/6b3f0646-ba8c-b3a9-c62d-1c6651a1920f@phystech.edu  

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

Add basic TAP tests for psql's tab-completion logic.

commit   : 7c015045b9141cc30272930ea88cfa5df47240b7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 15:02:21 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 15:02:21 -0500    

Click here for diff

Up to now, psql's tab-complete.c has had exactly no regression test  
coverage.  This patch is an experimental attempt to add some.  
  
This needs Perl's IO::Pty module, which isn't installed everywhere,  
so the test script just skips all tests if that's not present.  
There may be other portability gotchas too, so I await buildfarm  
results with interest.  
  
So far this just covers a few very basic keyword-completion and  
query-driven-completion scenarios, which should be enough to let us  
get a feel for whether this is practical at all from a portability  
standpoint.  If it is, there's lots more that can be done.  
  
Discussion: https://postgr.es/m/10967.1577562752@sss.pgh.pa.us  

M configure
M configure.in
M src/Makefile.global.in
M src/bin/psql/.gitignore
M src/bin/psql/Makefile
A src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgresNode.pm

Fix typmod exposed for scalar function in FROM, too.

commit   : 915c04f091f13dbbc0fde833e612dc90b70103ce    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 14:02:46 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 14:02:46 -0500    

Click here for diff

On further reflection about commit 4d02eb017, it occurs to me that  
expandRTE() had better agree with what addRangeTableEntryForFunction()  
is doing.  So teach that about functions possibly having typmods, too.  

M src/backend/parser/parse_relation.c

Reorder two nbtree.h function prototypes.

commit   : a412f469880ede9f52336a7b383905129c2b03a0    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 Jan 2020 10:57:15 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 2 Jan 2020 10:57:15 -0800    

Click here for diff

Make the function prototype order consistent with the definition order  
in nbtpage.c.  

M src/include/access/nbtree.h

Fix collation exposed for scalar function in FROM.

commit   : 4d02eb017e3c1268762fd1a10ec3c569515c047d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 13:48:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 13:48:54 -0500    

Click here for diff

One code path in addRangeTableEntryForFunction() neglected to assign  
a collation to the tupdesc entry it constructs (which is a bit odd  
considering the other path did do so).  This didn't matter before commit  
5815696bc, because nothing would look at the type data in this tupdesc;  
but now it does.  
  
While at it, make sure we assign the correct typmod as well.  Most  
function expressions don't have a determinate typmod, but some do.  
  
Per buildfarm, which showed failures in non-C collations, a case  
I'd not thought to test for this patch :-(  

M src/backend/parser/parse_relation.c

Make parser rely more heavily on the ParseNamespaceItem data structure.

commit   : 5815696bc66b3092f6361f53e0394909647042c8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 11:29:01 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Jan 2020 11:29:01 -0500    

Click here for diff

When I added the ParseNamespaceItem data structure (in commit 5ebaaa494),  
it wasn't very tightly integrated into the parser's APIs.  In the wake of  
adding p_rtindex to that struct (commit b541e9acc), there is a good reason  
to make more use of it: by passing around ParseNamespaceItem pointers  
instead of bare RTE pointers, we can get rid of various messy methods for  
passing back or deducing the rangetable index of an RTE during parsing.  
Hence, refactor the addRangeTableEntryXXX functions to build and return  
a ParseNamespaceItem struct, not just the RTE proper; and replace  
addRTEtoQuery with addNSItemToQuery, which is passed a ParseNamespaceItem  
rather than building one internally.  
  
Also, add per-column data (a ParseNamespaceColumn array) to each  
ParseNamespaceItem.  These arrays are built during addRangeTableEntryXXX,  
where we have column type data at hand so that it's nearly free to fill  
the data structure.  Later, when we need to build Vars referencing RTEs,  
we can use the ParseNamespaceColumn info to avoid the rather expensive  
operations done in get_rte_attribute_type() or expandRTE().  
get_rte_attribute_type() is indeed dead code now, so I've removed it.  
This makes for a useful improvement in parse analysis speed, around 20%  
in one moderately-complex test query.  
  
The ParseNamespaceColumn structs also include Var identity information  
(varno/varattno).  That info isn't actually being used in this patch,  
except that p_varno == 0 is a handy test for a dropped column.  
A follow-on patch will make more use of it.  
  
Discussion: https://postgr.es/m/2461.1577764221@sss.pgh.pa.us  

M src/backend/catalog/heap.c
M src/backend/commands/copy.c
M src/backend/commands/policy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/view.c
M src/backend/optimizer/plan/subselect.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/tablesync.c
M src/backend/rewrite/rewriteHandler.c
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/parser/parsetree.h
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Fix comment in test

commit   : 198c7153dccb11950e3030dec564fdc6e59b4451    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 2 Jan 2020 14:40:18 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 2 Jan 2020 14:40:18 +0100    

Click here for diff

The comment was apparently copy-and-pasted and did not reflect the  
actual test outcome.  

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

Fix running out of file descriptors for spill files.

commit   : d207038053837ae9365df2776371632387f6f655    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 14 Dec 2019 11:41:37 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 14 Dec 2019 11:41:37 +0530    

Click here for diff

Currently while decoding changes, if the number of changes exceeds a  
certain threshold, we spill those to disk.  And this happens for each  
(sub)transaction.  Now, while reading all these files, we don't close them  
until we read all the files.  While reading these files, if the number of  
such files exceeds the maximum number of file descriptors, the operation  
errors out.  
  
Use PathNameOpenFile interface to open these files as that internally has  
the mechanism to release kernel FDs as needed to get us under the  
max_safe_fds limit.  
  
Reported-by: Amit Khandekar  
Author: Amit Khandekar  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/CAJ3gD9c-sECEn79zXw4yBnBdOttacoE-6gAyP0oy60nfs_sabQ@mail.gmail.com  

M src/backend/replication/logical/reorderbuffer.c
M src/test/recovery/t/006_logical_decoding.pl

Revise BTP_HAS_GARBAGE nbtree VACUUM comments.

commit   : 4b25f5d0ba0197af80e3af0de7441ca9c88c1e24    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 1 Jan 2020 17:29:41 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 1 Jan 2020 17:29:41 -0800    

Click here for diff

_bt_delitems_vacuum() comments claimed that it isn't worth another scan  
of the page to avoid falsely unsetting the BTP_HAS_GARBAGE page flag  
hint (this happens to be the same wording that was removed from  
_bt_delitems_delete() by my recent commit fe97c61c).  The comments made  
little sense, though.  The issue can't have much to do with performing a  
second scan of the target leaf page, since an LP_DEAD test could easily  
be performed in the first scan of the page anyway (the scan that takes  
place in btvacuumpage() caller).  
  
Revise the explanation.  It makes much more sense to frame this as an  
issue about recovery conflicts.  _bt_delitems_vacuum() cannot easily  
generate an XID cutoff in the same way that _bt_delitems_delete() is  
designed to.  
  
Falsely unsetting the page flag is not ideal, and is likely to happen  
more often than was supposed by the original comments.  Explain why it  
usually isn't a problem in practice.  There may be an argument for  
_bt_delitems_vacuum() not clearing the BTP_HAS_GARBAGE bit, removing the  
question of it being falsely unset by VACUUM (there may even be an  
argument for not using a page level hint at all).  This can be revisited  
later.  

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

Test GROUP BY matching of join columns that are type-coerced by USING.

commit   : 823e739d4a7257cf0ca58fc6eff3c4cec308fccf    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 1 Jan 2020 19:31:41 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 1 Jan 2020 19:31:41 -0500    

Click here for diff

If we have, say, an int column that is left-joined to a bigint column  
with USING, the merged column is the int column promoted to bigint.  
GROUP BY's tests for whether grouping on the merged column allows a  
reference to the underlying column, or vice versa, should know about  
that relationship --- and they do.  But I nearly broke this case with  
an ill-advised optimization, so the lack of any test coverage for it  
seems like a bad idea.  

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

Update btree_xlog_delete() comments.

commit   : c5f3b53b0ef2e8ae78e7488148c12bfe5939ca17    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 1 Jan 2020 11:32:07 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 1 Jan 2020 11:32:07 -0800    

Click here for diff

Commit fe97c61c updated LP_DEAD item deletion comments, but missed a  
minor discrepancy on the REDO side.  Fix it now.  
  
In passing, don't talk about the btree_xlog_vacuum() behavior within  
btree_xlog_delete().  The reliance on XLOG_HEAP2_CLEANUP_INFO records  
for recovery conflicts is already discussed within btvacuumpage() and  
mentioned again in passing above btree_xlog_vacuum(), which seems  
sufficient.  

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

Update copyrights for 2020

commit   : 7559d8ebfa11d98728e816f6b655582ce41150f3    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 1 Jan 2020 12:21:45 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 1 Jan 2020 12:21:45 -0500    

Click here for diff

Backpatch-through: update all files in master, backpatch legal files through 9.4  

M COPYRIGHT
M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/dblink/dblink.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_selfuncs.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/imath.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/port/atomics.c
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashes.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
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/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/scripts_parallel.c
M src/bin/scripts/scripts_parallel.h
M src/bin/scripts/vacuumdb.c
M src/common/base64.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/ip.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/pg_lzcompress.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha2.c
M src/common/sha2_openssl.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/fe_utils/Makefile
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/opfam_internal.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.dat
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/base64.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect.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/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/rbtree.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.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_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.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/prep.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/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/win32_port.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/basebackup.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/md.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hashutils.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq.rc.in
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/pl/tcl/generate-pltclerrcodes.pl
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/dlopen.c
M src/port/erand48.c
M src/port/explicit_bzero.c
M src/port/fls.c
M src/port/fseeko.c
M src/port/getaddrinfo.c
M src/port/getpeereid.c
M src/port/getrusage.c
M src/port/isinf.c
M src/port/kill.c
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pread.c
M src/port/pwrite.c
M src/port/quotes.c
M src/port/random.c
M src/port/snprintf.c
M src/port/sprompt.c
M src/port/srandom.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/ldap/Makefile
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
M src/test/recovery/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/ssl/ssl/client-der.key
M src/test/ssl/ssl/client-encrypted-der.key
M src/test/subscription/Makefile
M src/test/thread/Makefile
M src/test/thread/thread_test.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/findoidjoins/Makefile
M src/tools/findoidjoins/findoidjoins.c
M src/tools/fix-old-flex-code.pl
M src/tools/gen_keywordlist.pl
M src/tools/ifaddrs/Makefile
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Modernize Python exception syntax in documentation

commit   : b55413d77f96b9fa2dfae4ddec43412b90ebf588    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Dec 2019 10:35:16 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Dec 2019 10:35:16 +0100    

Click here for diff

Change the exception syntax used in the documentation to use the more  
current  
  
    except Exception as ex:  
  
rather than the old  
  
    except Exception, ex:  
  
We keep the old syntax in the test code since Python <2.6 is still  
supported there, but the documentation might as well use the modern  
syntax.  

M doc/src/sgml/plpython.sgml

Micro-optimize AllocSetFreeIndex() by reference to pg_bitutils code.

commit   : 0ce38730ac72029f3f2c95ae80b44f5b9060cbcc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 28 Dec 2019 17:21:17 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 28 Dec 2019 17:21:17 -0500    

Click here for diff

Use __builtin_clz() where available.  Where it isn't, we can still win  
a little by using the pg_leftmost_one_pos[] lookup table instead of  
having a private table.  
  
Also drop the initial right shift by ALLOC_MINBITS in favor of  
subtracting ALLOC_MINBITS from the leftmost-one-pos result.  This  
is a win because the compiler can fold that adjustment into other  
constants it'd have to add anyway, making the shift-removal free.  
  
Also, we can explain this coding as an unrolled form of  
pg_leftmost_one_pos32(), even though that's a bit ahistorical  
since it long predates pg_bitutils.h.  
  
John Naylor, with some cosmetic adjustments by me  
  
Discussion: https://postgr.es/m/CACPNZCuNUGMxjK7WTn_=WZnRbfASDdBxmjsVf2+m9MdmeNw_sg@mail.gmail.com  

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

Add pg_dump test for triggers on partitioned tables

commit   : 27a3b2ad836c9e7dd243bfebc760a9df9d6fd5a3    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 27 Dec 2019 18:34:30 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 27 Dec 2019 18:34:30 -0300    

Click here for diff

This currently works, but add this test to ensure it continues to work.  
Lack of this test became evident after a recent bugfix submission that  
would have inadvertently broken it, in  
https://postgr.es/m/CA+HiwqFM2=i+uHB9o4OkLbE2S3sjPHoVe2wXuAD1GLJ4+Pk9eg@mail.gmail.com  

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

doc: add examples of creative use of unique expression indexes

commit   : a9760d0f3cb523336b5fdd9d6c5985e39a8588a1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 27 Dec 2019 14:49:08 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 27 Dec 2019 14:49:08 -0500    

Click here for diff

Unique expression indexes can constrain data in creative ways, so show  
two examples.  
  
Reported-by: Tuomas Leikola  
  
Discussion: https://postgr.es/m/156760275564.1127.12321702656456074572@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

M doc/src/sgml/indices.sgml

docs: clarify infinite range values from data-type infinities

commit   : 650692a18d29c44c8019545c02ba42c3efd2c964    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 27 Dec 2019 14:33:30 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 27 Dec 2019 14:33:30 -0500    

Click here for diff

The previous docs referenced these distinct ideas confusingly.  
  
Reported-by: Eugen Konkov  
  
Discussion: https://postgr.es/m/376945611.20191026161529@yandex.ru  
  
Backpatch-through: 9.4  

M doc/src/sgml/rangetypes.sgml

Forbid DROP SCHEMA on temporary namespaces

commit   : a052f6cbb84e5630d50b68586cecc127e64be639    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 27 Dec 2019 17:58:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 27 Dec 2019 17:58:43 +0900    

Click here for diff

This operation was possible for the owner of the schema or a superuser.  
Down to 9.4, doing this operation would cause inconsistencies in a  
session whose temporary schema was dropped, particularly if trying to  
create new temporary objects after the drop.  A more annoying  
consequence is a crash of autovacuum on an assertion failure when  
logging information about an orphaned temp table dropped.  Note that  
because of 246a6c8 (present in v11~), which has made the removal of  
orphaned temporary tables more aggressive, the failure could be  
triggered more easily, but it is possible to reproduce down to 9.4.  
  
Reported-by: Mahendra Singh, Prabhat Sahu  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Mahendra Singh  
Discussion: https://postgr.es/m/CAKYtNAr9Zq=1-ww4etHo-VCC-k120YxZy5OS01VkaLPaDbv2tg@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/commands/dropcmds.c

commit   : 7854e07f25be3a3dfa9c94011a30767eca3c10ba    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 27 Dec 2019 08:09:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 27 Dec 2019 08:09:00 +0900    

Click here for diff

This follows multiple complains from Peter Geoghegan, Andres Freund and  
Alvaro Herrera that this issue ought to be dug more before actually  
happening, if it happens.  
  
Discussion: https://postgr.es/m/20191226144606.GA5659@alvherre.pgsql  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/common/detoast.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/Makefile
R097 src/backend/access/index/indexamapi.c src/backend/access/index/amapi.c
R098 src/backend/access/index/indexamvalidate.c src/backend/access/index/amvalidate.c
R099 src/backend/access/index/indexgenam.c src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/dbcommands.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.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/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/logical/origin.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/init/postinit.c
R097 src/include/access/indexam.h src/include/access/amapi.h
R084 src/include/access/indexamvalidate.h src/include/access/amvalidate.h
M src/include/access/brin_internal.h
R097 src/include/access/indexgenam.h src/include/access/genam.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/spgist.h
M src/include/executor/nodeIndexscan.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/index_selfuncs.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.

commit   : 4ba4bfaf256c17fe4c8f497924b74eb98241b84f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Dec 2019 15:19:39 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Dec 2019 15:19:39 -0500    

Click here for diff

When revalidate_rectypeid() acts to update a stale record type OID  
in plpgsql's data structures, it fixes the active PLpgSQL_rec struct  
as well as the PLpgSQL_type struct it references.  However, the latter  
is shared across function executions while the former is not.  In a  
later function execution, the PLpgSQL_rec struct would be reinitialized  
by copy_plpgsql_datums and would then contain a stale type OID,  
typically leading to "could not open relation with OID NNNN" errors.  
revalidate_rectypeid() can easily fix this, fortunately, just by  
treating typ->typoid as authoritative.  
  
Per report and diagnosis from Ashutosh Sharma, though this is not his  
suggested fix.  Back-patch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/CAE9k0Pkd4dZwt9J5pS9xhJFWpUtqs05C9xk_GEwPzYdV=GxwWg@mail.gmail.com  

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

Improve comments in utils/rel.h.

commit   : fbe0232358c14792e1b94b902d0f7a9b55154275    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Dec 2019 11:20:05 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Dec 2019 11:20:05 -0500    

Click here for diff

Mark the fields that should be accessed via partitioning-related  
functions, as we already did for some other fields.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFnK6LbVMACMCaqwWrvoSFTecZzufKRahg2qGvLPYMX=g@mail.gmail.com  

M src/include/utils/rel.h

Refactor parser's generation of Var nodes.

commit   : b541e9accb28c90656388a3f827ca3a68dd2a308    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Dec 2019 11:16:42 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Dec 2019 11:16:42 -0500    

Click here for diff

Instead of passing around a pointer to the RangeTblEntry that  
provides the desired column, pass a pointer to the associated  
ParseNamespaceItem.  The RTE is trivially reachable from the nsitem,  
and having the ParseNamespaceItem allows access to additional  
information.  As proof of concept for that, add the rangetable index  
to ParseNamespaceItem, and use that to get rid of RTERangeTablePosn  
searches.  
  
(I have in mind to teach the parser to generate some different  
representation for Vars that are nullable by outer joins, and  
keeping the necessary information in ParseNamespaceItems seems  
like a reasonable approach to that.  But whether that ever  
happens or not, this seems like good cleanup.)  
  
Also refactor the code around scanRTEForColumn so that the  
"fuzzy match" stuff does not leak out of parse_relation.c.  
  
Discussion: https://postgr.es/m/26144.1576858373@sss.pgh.pa.us  

M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h

commit   : 044b319cd77c589507291f9591994093ad30931d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 26 Dec 2019 22:26:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 26 Dec 2019 22:26:09 +0900    

Click here for diff

confirmed_flush is part of a replication slot's information, but not  
confirmed_lsn.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20191226.175919.17237335658671970.horikyota.ntt@gmail.com  
Backpatch-through: 11  

M src/backend/replication/slotfuncs.c

Refactor code dedicated to index vacuuming in vacuumlazy.c

commit   : 1ab41a3c8edcf5d7751e61d6ab83bf43b494668b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 26 Dec 2019 17:01:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 26 Dec 2019 17:01:23 +0900    

Click here for diff

The part in charge of doing the vacuum on all the indexes of a relation  
was duplicated, with the same handling for progress reporting done.  
While on it, update the progress reporting for heap vacuuming in the  
subroutine doing the actual work, keeping the status update local.  This  
way, any future caller of lazy_vacuum_heap() does not have to worry  
about doing any progress reporting update.  
  
Author: Justin Pryzby, Michael Paquier  
Discussion: https://postgr.es/m/20191120210600.GC30362@telsasoft.com  

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

Add note about how each partition's default value is treated, into the doc.

commit   : 1ab029d528dcb409fb371d5ad826a67ec78b2b4e    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Dec 2019 15:07:43 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Dec 2019 15:07:43 +0900    

Click here for diff

Column defaults may be specified separately for each partition.  
But INSERT via a partitioned table ignores those partition's default values.  
The former is documented, but the latter restriction not.  
This commit adds the note about that restriction into the document.  
  
Author: Fujii Masao  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/CAHGQGwEs-59omrfGF7hOHz9iMME3RbKy5ny+iftDx3LHTEn9sA@mail.gmail.com  

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

Allow whole-row Vars to be used in partitioning expressions.

commit   : bb4114a4e2c65f27931cc074214c051dba2876c3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Dec 2019 15:44:15 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Dec 2019 15:44:15 -0500    

Click here for diff

In the wake of commit 5b9312378, there's no particular reason  
for this restriction (previously, it was problematic because of  
the implied rowtype reference).  A simple constraint on a whole-row  
Var probably isn't that useful, but conceivably somebody would want  
to pass one to a function that extracts a partitioning key.  Besides  
which, we're expending much more code to enforce the restriction than  
we save by having it, since the latter quantity is now zero.  
So drop the restriction.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c
M src/include/catalog/partition.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Remove equalPartitionDescs().

commit   : 42f74f49367bee1d3da28c4b383faec29364f320    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Dec 2019 14:45:57 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Dec 2019 14:45:57 -0500    

Click here for diff

This is dead code in the wake of the previous commit.  
We can always add it back if we need it again someday.  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  

M src/backend/partitioning/partdesc.c
M src/include/partitioning/partdesc.h

Load relcache entries' partitioning data on-demand, not immediately.

commit   : 5b9312378e2f8fb35ef4584aea351c3319a10422    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Dec 2019 14:43:13 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Dec 2019 14:43:13 -0500    

Click here for diff

Formerly the rd_partkey and rd_partdesc data structures were always  
populated immediately when a relcache entry was built or rebuilt.  
This patch changes things so that they are populated only when they  
are first requested.  (Hence, callers *must* now always use  
RelationGetPartitionKey or RelationGetPartitionDesc; just fetching  
the pointer directly is no longer acceptable.)  
  
This seems to have some performance benefits, but the main reason to do  
it is that it eliminates a recursive-reload failure that occurs if the  
partkey or partdesc expressions contain any references to the relation's  
rowtype (as discovered by Amit Langote).  In retrospect, since loading  
these data structures might result in execution of nearly-arbitrary code  
via eval_const_expressions, it was a dumb idea to require that to happen  
during relcache entry rebuild.  
  
Also, fix things so that old copies of a relcache partition descriptor  
will be dropped when the cache entry's refcount goes to zero.  In the  
previous coding it was possible for such copies to survive for the  
lifetime of the session, as I'd complained of in a previous discussion.  
(This management technique still isn't perfect, but it's better than  
before.)  Improve the commentary explaining how that works and why  
it's safe to hand out direct pointers to these relcache substructures.  
  
In passing, improve RelationBuildPartitionDesc by using the same  
memory-context-parent-swap approach used by RelationBuildPartitionKey,  
thereby making it less dependent on strong assumptions about what  
partition_bounds_copy does.  Avoid doing get_rel_relkind in the  
critical section, too.  
  
Patch by Amit Langote and Tom Lane; Robert Haas deserves some credit  
for prior work in the area, too.  Although this is a pre-existing  
problem, no back-patch: the patch seems too invasive to be safe to  
back-patch, and the bug it fixes is a corner case that seems  
relatively unlikely to cause problems in the field.  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+TgmoY3bRmGB6-DUnoVy5fJoreiBJ43rwMrQRCdPXuKt4Ykaw@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/commands/indexcmds.c
M src/backend/executor/execPartition.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/include/partitioning/partdesc.h
M src/include/utils/partcache.h
M src/include/utils/rel.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

commit   : 8ce3aa9b5914d1ac45ed3f9bc484f66b3c4850c7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 25 Dec 2019 10:23:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 25 Dec 2019 10:23:39 +0900    

Click here for diff

The following renaming is done so as source files related to index  
access methods are more consistent with table access methods (the  
original names used for index AMs ware too generic, and could be  
confused as including features related to table AMs):  
- amapi.h -> indexam.h.  
- amapi.c -> indexamapi.c.  Here we have an equivalent with  
backend/access/table/tableamapi.c.  
- amvalidate.c -> indexamvalidate.c.  
- amvalidate.h -> indexamvalidate.h.  
- genam.c -> indexgenam.c.  
- genam.h -> indexgenam.h.  
  
This has been discussed during the development of v12 when table AM was  
worked on, but the renaming never happened.  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho, Julien Rouhaud  
Discussion: https://postgr.es/m/20191223053434.GF34339@paquier.xyz  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/common/detoast.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/Makefile
M src/backend/access/index/indexam.c
R097 src/backend/access/index/amapi.c src/backend/access/index/indexamapi.c
R098 src/backend/access/index/amvalidate.c src/backend/access/index/indexamvalidate.c
R099 src/backend/access/index/genam.c src/backend/access/index/indexgenam.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/dbcommands.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.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/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/logical/origin.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/init/postinit.c
M src/include/access/brin_internal.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
R097 src/include/access/amapi.h src/include/access/indexam.h
R084 src/include/access/amvalidate.h src/include/access/indexamvalidate.h
R097 src/include/access/genam.h src/include/access/indexgenam.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/spgist.h
M src/include/executor/nodeIndexscan.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/index_selfuncs.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Avoid splitting C string literals with \-newline

commit   : c4dcd9144ba64946c9f9466748bdb2c51719c8a3    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 24 Dec 2019 12:37:13 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 24 Dec 2019 12:37:13 -0300    

Click here for diff

Using \ is unnecessary and ugly, so remove that.  While at it, stitch  
the literals back into a single line: we've long discouraged splitting  
error message literals even when they go past the 80 chars line limit,  
to improve greppability.  
  
Leave contrib/tablefunc alone.  
  
Discussion: https://postgr.es/m/20191223195156.GA12271@alvherre.pgsql  

M contrib/dblink/dblink.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/tablefunc/tablefunc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/extension.c
M src/backend/commands/prepare.c
M src/backend/executor/execExprInterp.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/portalmem.c

Replace use of strerror() with %s by %m in pg_waldump

commit   : cce64a51cabc1e59d202d95bb0b92ed22bac73cf    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Dec 2019 12:14:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Dec 2019 12:14:08 +0900    

Click here for diff

Since d6c55de1, src/port/snprintf.c is able to use %m instead of  
strerror().  A couple of utilities in src/bin/ have already done the  
switch, and do it now for pg_waldump as this reduces the workload for  
translators.  
  
Note that more could be done, particularly with pgbench.  Thanks to  
Kyotaro Horiguchi for the discussion.  
  
Discussion: https://postgr.es/m/20191129065115.GM2505@paquier.xyz  

M src/bin/pg_waldump/pg_waldump.c

Rotate instead of shifting hash join batch number.

commit   : e69d644547785cc9f079650d29118a3688bc5039    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 24 Dec 2019 11:31:24 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 24 Dec 2019 11:31:24 +1300    

Click here for diff

Our algorithm for choosing batch numbers turned out not to work  
effectively for multi-billion key inner relations.  We would use  
more hash bits than we have, and effectively concentrate all tuples  
into a smaller number of batches than we intended.  While ideally  
we should switch to wider hashes, for now, change the algorithm to  
one that effectively gives up bits from the bucket number when we  
don't have enough bits.  That means we'll finish up with longer  
bucket chains than would be ideal, but that's better than having  
batches that don't fit in work_mem and can't be divided.  
  
Batch-patch to all supported releases.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres Freund for testing and discussion  
Reported-by: James Coleman  
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org  

M src/backend/executor/nodeHash.c
M src/include/port/pg_bitutils.h

Disallow null category in crosstab_hash

commit   : d5b9c2baff662aac22cd2a497d5bcd3b5a916fd0    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Mon, 23 Dec 2019 13:33:25 -0500    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Mon, 23 Dec 2019 13:33:25 -0500    

Click here for diff

While building a hash map of categories in load_categories_hash,  
resulting category names have not thus far been checked to ensure  
they are not null. Prior to pg12 null category names worked to the  
extent that they did not crash on some platforms. This is because  
those system libraries have an snprintf which can deal with being  
passed a null pointer argument for a string. But even in those cases  
null categories did nothing useful. And on some platforms it crashed.  
As of pg12, our own version of snprintf gets called, and it does  
not deal with null pointer arguments at all, and crashes consistently.  
  
Fix that by disallowing null categories. They never worked usefully,  
and no one has ever asked for them to work previously. Back-patch to  
all supported branches.  
  
Reported-By: Ireneusz Pluta  
Discussion: https://postgr.es/m/16176-7489719b05e4303c@postgresql.org  

M contrib/tablefunc/tablefunc.c

Disallow partition key expressions that return pseudo-types.

commit   : 39ebb943de9dd64e305d17329b8989e3061d03a5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Dec 2019 12:53:12 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Dec 2019 12:53:12 -0500    

Click here for diff

This wasn't checked originally, but it should have been, because  
in general pseudo-types can't be stored to and retrieved from disk.  
Notably, partition bound values of type "record" would not be  
interpretable by another session.  
  
In v12 and HEAD, add another flag to CheckAttributeType's repertoire  
so that it can produce a specific error message for this case.  That's  
infeasible in older branches without an ABI break, so fall back to  
a slightly-less-nicely-worded error message in v10 and v11.  
  
Problem noted by Amit Langote, though this patch is not his initial  
solution.  Back-patch to v10 where partitioning was introduced.  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Prevent a rowtype from being included in itself via a range.

commit   : fc7695891d357a54f0258142de85f88520796b9b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Dec 2019 12:08:23 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Dec 2019 12:08:23 -0500    

Click here for diff

We probably should have thought of this case when ranges were added,  
but we didn't.  (It's not the fault of commit eb51af71f, because  
ranges didn't exist then.)  
  
It's an old bug, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/7782.1577051475@sss.pgh.pa.us  

M src/backend/catalog/heap.c
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

GetPublicationByName: Don't repeat ourselves

commit   : 0fd8cfb20d2d41d4c2df021a5f355965fd8d21bc    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 23 Dec 2019 12:47:36 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 23 Dec 2019 12:47:36 -0300    

Click here for diff

Use get_publication_oid() instead of reimplementing it.  
  
Discussion: https://postgr.es/m/20191220201017.GA17292@alvherre.pgsql  

M src/backend/catalog/pg_publication.c

Normalize _bt_finish_split() argument names.

commit   : 696cc3a0cabd5f11d0c8a187b7561f6d0d39c5e0    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Dec 2019 20:07:45 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Dec 2019 20:07:45 -0800    

Click here for diff

Make a function prototype argument's name match the function  
definition's argument name.  

M src/include/access/nbtree.h

Update nbtree LP_DEAD item deletion comments.

commit   : fe97c61c8777858cc1a271e657a7d812e100ef00    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Dec 2019 19:57:35 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Dec 2019 19:57:35 -0800    

Click here for diff

Comments about the consequences of clearing the BTP_HAS_GARBAGE page  
flag bit that apply only to VACUUM were added to code that deals with  
opportunistic deletion of LP_DEAD items by commit a760893d.  The same  
comment block was added to both _bt_delitems_vacuum() and  
_bt_delitems_delete().  Correct _bt_delitems_delete()'s copy of the  
comment block.  
  
_bt_delitems_delete() reliably deletes items that were found by caller  
to have their LP_DEAD bit set.  There is no question about whether or  
not unsetting the BTP_HAS_GARBAGE bit can miss some LP_DEAD items that  
were set recently.  
  
Also tweak a related section of the nbtree README.  

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

Avoid low-probability regression test failures in timestamp[tz] tests.

commit   : b265aa1f39b672d263e37bdb715516d32128d0c4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Dec 2019 18:00:17 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Dec 2019 18:00:17 -0500    

Click here for diff

If the first transaction block in these tests were entered exactly  
at midnight (California time), they'd report a bogus failure due  
to 'now' and 'midnight' having the same values.  Commit 8c2ac75c5  
had dismissed this as being of negligible probability, but we've  
now seen it happen in the buildfarm, so let's prevent it.  We can  
get pretty much the same test coverage without an it's-not-midnight  
assumption by moving the does-'now'-work cases into their own test step.  
  
While here, apply commit 47169c255's s/DELETE/TRUNCATE/ change to  
timestamptz as well as timestamp (not sure why that didn't  
occur to me at the time; the risk of failure is the same).  
  
Back-patch to all supported branches, since the main point is  
to get rid of potential buildfarm failures.  
  
Discussion: https://postgr.es/m/14821.1577031117@sss.pgh.pa.us  

M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Fix compiler warning for ppoll() on Cygwin

commit   : 127ccb37251744c0fad2df0f3f67dd2c38fe8389    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 22 Dec 2019 23:20:00 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 22 Dec 2019 23:20:00 +0100    

Click here for diff

_GNU_SOURCE is required to get the prototype, so just define that  
globally, as was already done in the linux template.  
  
Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com  

M src/template/cygwin

In pgwin32_open, loop after ERROR_ACCESS_DENIED only if we can't stat.

commit   : 5406513e997f5ee9de79d4076ae91c04af0c52f6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 21 Dec 2019 17:39:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 21 Dec 2019 17:39:36 -0500    

Click here for diff

This fixes a performance problem introduced by commit 6d7547c21.  
ERROR_ACCESS_DENIED is returned in some other cases besides the  
delete-pending case considered by that commit; notably, if the  
given path names a directory instead of a plain file.  In that  
case we'll uselessly loop for 1 second before returning the  
failure condition.  That slows down some usage scenarios enough  
to cause test timeout failures on our Windows buildfarm critters.  
  
To fix, try to stat() the file, and sleep/loop only if that fails.  
It will fail in the delete-pending case, and also in the case where  
the deletion completed before we could stat(), so we have the cases  
where we want to loop covered.  In the directory case, the stat()  
should succeed, letting us exit without a wait.  
  
One case where we'll still wait uselessly is if the access-denied  
problem pertains to a directory in the given pathname.  But we don't  
expect that to happen in any performance-critical code path.  
  
There might be room to refine this further, but I'll push it now  
in hopes of making the buildfarm green again.  
  
Back-patch, like the preceding commit.  
  
Alexander Lakhin and Tom Lane  
  
Discussion: https://postgr.es/m/23073.1576626626@sss.pgh.pa.us  

M src/port/open.c

C comment: clarify why psql's help/exit/quit must alone

commit   : 4376fdbae11de9333012a31ba8d3a4f4b5d7a692    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 21 Dec 2019 17:02:38 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 21 Dec 2019 17:02:38 -0500    

Click here for diff

Document why no indentation and why no non-whitespace postfix is  
supported.  
  
Backpatch-through: master  

M src/bin/psql/mainloop.c

docs: clarify handling of column lists in COPY TO/FROM

commit   : 4cab43ec806a6298a545a399415ee8c4fe9307a8    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 21 Dec 2019 12:44:38 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 21 Dec 2019 12:44:38 -0500    

Click here for diff

Previously it was unclear how COPY FROM handled cases where not all  
columns were specified, or if the order didn't match.  
  
Reported-by: pavlo.golub@gmail.com  
  
Discussion: https://postgr.es/m/157487729344.7213.14245726713444755296@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

M doc/src/sgml/ref/copy.sgml

Adjust test case added by commit 6136e94dc.

commit   : 0af0504da91e5e15f0b203309a1e49a4829dac64    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Dec 2019 15:45:37 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Dec 2019 15:45:37 -0500    

Click here for diff

Per project policy, transient roles created by regression test cases  
should be named "regress_something", to reduce the risks of running  
such cases against installed servers.  And no such role should ever  
be left behind after running a test.  
  
Discussion: https://postgr.es/m/11297.1576868677@sss.pgh.pa.us  

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

commit   : e60b480d39ee3401727a994988dd9117a3b48466    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Dec 2019 15:34:07 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Dec 2019 15:34:07 -0500    

Click here for diff

We realized years ago that it's better for libpq to accept all  
connection parameters syntactically, even if some are ignored or  
restricted due to lack of the feature in a particular build.  
However, that lesson from the SSL support was for some reason never  
applied to the GSSAPI support.  This is causing various buildfarm  
members to have problems with a test case added by commit 6136e94dc,  
and it's just a bad idea from a user-experience standpoint anyway,  
so fix it.  
  
While at it, fix some places where parameter-related infrastructure  
was added with the aid of a dartboard, or perhaps with the aid of  
the anti-pattern "add new stuff at the end".  It should be safe  
to rearrange the contents of struct pg_conn even in released  
branches, since that's private to libpq (and we'd have to move  
some fields in some builds to fix this, anyway).  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/11297.1576868677@sss.pgh.pa.us  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Clean up inconsistent backslash use in paths

commit   : 77f416af6e821b40649c971ded43089e0450791a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 12:26:01 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 12:26:01 +0100    

Click here for diff

Most of the MSVC Perl code uses forward slashes for file paths.  Make  
the few places that use backslashes the same.  This also helps running  
that code on non-Windows.  

M src/tools/msvc/build.pl
M src/tools/msvc/mkvcbuild.pl

Generate pg_config.h from pg_config.h.in on Windows

commit   : 8f4fb4c648ee8df00f78bee3f8099a6ae510071a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 08:54:42 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 08:54:42 +0100    

Click here for diff

Previously, the Windows MSVC build generated pg_config.h from a  
hard-coded pg_config.h.win32 with some ad hoc postprocessing.  The  
pg_config.h.win32 file required manual maintenance and was as a result  
frequently out of date.  
  
Instead, have the MSVC build scripts emulate what configure and  
config.status do: collect a list of defines and then create  
pg_config.h from pg_config.h.in by changing the appropriate lines.  
  
The previous setup was made to support old Windows build systems that  
didn't have any text processing capabilities, but the current system  
has Perl, so it's not a problem.  pg_config.h.win32 is removed.  
  
In order to try to keep the Windows side of things more up to date in  
the future, we now also require that all symbols found in  
pg_config.h.in are defined in the MSVC build system.  So if there is a  
change in configure that results in a new symbol, an update in  
Solution.pm will be required.  
  
The other headers managed by AC_CONFIG_HEADERS in configure, namely  
src/include/pg_config_ext.h and  
src/interfaces/ecpg/include/ecpg_config.h, get the same treatment, so  
this removes even more ad hoc code in the MSVC build scripts.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/flat/1441b834-f434-e0bf-46ed-9c4d5c29c2d4%402ndquadrant.com  

D src/include/pg_config.h.win32
D src/include/pg_config_ext.h.win32
M src/tools/msvc/Solution.pm
M src/tools/version_stamp.pl

Disallow dropping rules on system tables by default

commit   : df7fe9e2d707da69a4437fb6f9e695c070882160    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 08:25:43 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 08:25:43 +0100    

Click here for diff

This was previously not covered by allow_system_table_mods, but now it  
is.  The impact in practice is probably low, but this makes it  
consistent with most other DDL commands.  
  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/ee9df1af-c0d8-7c82-5be7-39ce4e3b0a9d%402ndquadrant.com  

M src/backend/rewrite/rewriteRemove.c
M src/test/modules/unsafe_tests/expected/alter_system_table.out
M src/test/modules/unsafe_tests/sql/alter_system_table.sql

Fix compiler warnings on MSYS2

commit   : 8c6d30f211390df911072d33f0114a31f066a4cd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 08:04:24 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Dec 2019 08:04:24 +0100    

Click here for diff

The PS_USE_NONE case in ps_status.c left a couple of unused variables  
exposed.  
  
Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com  

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

Superuser can permit passwordless connections on postgres_fdw

commit   : 6136e94dcb88c50b6156aa646746565400e373d4    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Dec 2019 16:23:34 +1030    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Dec 2019 16:23:34 +1030    

Click here for diff

Currently postgres_fdw doesn't permit a non-superuser to connect to a  
foreign server without specifying a password, or to use an  
authentication mechanism that doesn't use the password. This is to avoid  
using the settings and identity of the user running Postgres.  
  
However, this doesn't make sense for all authentication methods. We  
therefore allow a superuser to set "password_required 'false'" for user  
mappings for the postgres_fdw. The superuser must ensure that the  
foreign server won't try to rely solely on the server identity (e.g.  
trust, peer, ident) or use an authentication mechanism that relies on the  
password settings (e.g. md5, scram-sha-256).  
  
This feature is a prelude to better support for sslcert and sslkey  
settings in user mappings.  
  
Author: Craig Ringer.  
Discussion: https://postgr.es/m/075135da-545c-f958-fed0-5dcb462d6dae@2ndQuadrant.com  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Extend the ProcSignal mechanism to support barriers.

commit   : 16a4e4aecd47da7a6c4e1ebc20f6dd1a13f9133b    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Dec 2019 14:56:20 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Dec 2019 14:56:20 -0500    

Click here for diff

A new function EmitProcSignalBarrier() can be used to emit a global  
barrier which all backends that participate in the ProcSignal  
mechanism must absorb, and a new function WaitForProcSignalBarrier()  
can be used to wait until all relevant backends have in fact  
absorbed the barrier.  
  
This can be used to coordinate global state changes, such as turning  
checksums on while the system is running.  
  
There's no real client of this mechanism yet, although two are  
proposed, but an enum has to have at least one element, so this  
includes a placeholder type (PROCSIGNAL_BARRIER_PLACEHOLDER) which  
should be replaced by the first real client of this mechanism to  
get committed.  
  
Andres Freund and Robert Haas, reviewed by Daniel Gustafsson and,  
in earlier versions, by Magnus Hagander.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/startup.c
M src/backend/replication/walreceiver.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/include/miscadmin.h
M src/include/pgstat.h
M src/include/storage/procsignal.h

Remove unneeded "pin scan" nbtree VACUUM code.

commit   : 9f83468b3536caf6fb7fe8f9dcdbb108a98d1257    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 19 Dec 2019 11:35:55 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 19 Dec 2019 11:35:55 -0800    

Click here for diff

The REDO routine for nbtree's xl_btree_vacuum record type hasn't  
performed a "pin scan" since commit 3e4b7d87 went in, so clearly there  
isn't any point in VACUUM WAL-logging information that won't actually be  
used.  Finish off the work of commit 3e4b7d87 (and the closely related  
preceding commit 687f2cd7) by removing the code that generates this  
unused information.  Also remove the REDO routine code disabled by  
commit 3e4b7d87.  
  
Replace the unneeded lastBlockVacuumed field in xl_btree_vacuum with a  
new "ndeleted" field.  The new field isn't actually needed right now,  
since we could continue to infer the array length from the overall  
record length.  However, an upcoming patch to add deduplication to  
nbtree needs to add an "items updated" field to xl_btree_vacuum, so we  
might as well start being explicit about the number of items now.  
(Besides, it doesn't seem like a good idea to leave the xl_btree_vacuum  
struct without any fields; the C standard says that that's undefined.)  
  
nbtree VACUUM no longer forces writing a WAL record for the last block  
in the index.  Writing out a WAL record with no items for the final  
block was supposed to force processing of a lastBlockVacuumed field by a  
pin scan.  
  
Bump XLOG_PAGE_MAGIC because xl_btree_vacuum changed.  
  
Discussion: https://postgr.es/m/CAH2-WzmY_mT7UnTzFB5LBQDBkKpdV5UxP3B5bLb7uP%3D%3D6UQJRQ%40mail.gmail.com  

M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/xlog_internal.h

revert: Remove meaningless assignments in nbtree code

commit   : b93e9a5c94b4c89932a637798bd560971fe790d7    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 19 Dec 2019 11:19:10 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 19 Dec 2019 11:19:10 -0500    

Click here for diff

Reverts commit 05684c8255.  
  
Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/404.1576770942@sss.pgh.pa.us  
  
Backpatch-through: master  

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

Remove meaningless assignments in nbtree code

commit   : 05684c8255af57258386c00354c61155ec519707    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 19 Dec 2019 10:33:48 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 19 Dec 2019 10:33:48 -0500    

Click here for diff

Reported-by: Ranier Vilela  
  
Discussion: https://postgr.es/m/MN2PR18MB2927BB876D12A70FDBE8F35AE3450@MN2PR18MB2927.namprd18.prod.outlook.com  
  
Backpatch-through: master  

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

makeArrayTypeName: Remove pointless relation open/close

commit   : 2b93e3d96b941740877b2ae196511564e5cc989b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 19 Dec 2019 12:08:30 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 19 Dec 2019 12:08:30 -0300    

Click here for diff

Discussion: https://postgr.es/m/20191218221326.GA25537@alvherre.pgsql  

M src/backend/catalog/pg_type.c

Doc: add a short summary of available authentication methods.

commit   : 54fbd155cc6fdbf875185035b3d9823f739b617d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Dec 2019 09:42:39 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Dec 2019 09:42:39 -0500    

Click here for diff

The "auth-methods" <sect1> used to include descriptions of all our  
authentication methods.  Commit 56811e573 promoted its child <sect2>'s  
to <sect1>'s, which has advantages but also created some issues:  
* The auth-methods page itself is essentially empty/useless.  
* Links that pointed to "auth-methods" as a placeholder for all  
auth methods were rendered a bit nonsensical.  
* DocBook no longer provides a subsection table-of-contents here,  
which formerly was a useful if terse summary of available auth methods.  
  
To improve matters, add a handwritten list of all the auth methods.  
  
Per gripe from Dave Cramer.  Back-patch to v11 where the previous  
commit came in.  
  
Discussion: https://postgr.es/m/CADK3HH+xQLhcPgg=kWqfogtXGGZr-JdSo=x=WQC0PkAVyxUWyQ@mail.gmail.com  

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

Update neglected comment.

commit   : 7cdcc747a9fe588f9e9b3a5d3feb650340093fb2    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Dec 2019 09:24:44 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Dec 2019 09:24:44 -0500    

Click here for diff

Commit d986d4e87f61c68f52c68ebc274960dc664b7b4e renamed a variable  
but neglected to update the corresponding comment.  
  
Amit Langote  

M src/backend/commands/trigger.c

Fix minor problems with non-exclusive backup cleanup.

commit   : 303640199d0436c5e7acdf50b837a027b5726594    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Dec 2019 09:06:54 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Dec 2019 09:06:54 -0500    

Click here for diff

The previous coding imagined that it could call before_shmem_exit()  
when a non-exclusive backup began and then remove the previously-added  
handler by calling cancel_before_shmem_exit() when that backup  
ended. However, this only works provided that nothing else in the  
system has registered a before_shmem_exit() hook in the interim,  
because cancel_before_shmem_exit() is documented to remove a callback  
only if it is the latest callback registered. It also only works  
if nothing can ERROR out between the time that sessionBackupState  
is reset and the time that cancel_before_shmem_exit(), which doesn't  
seem to be strictly true.  
  
To fix, leave the handler installed for the lifetime of the session,  
arrange to install it just once, and teach it to quietly do nothing if  
there isn't a non-exclusive backup in process.  
  
This is a bug, but for now I'm not going to back-patch, because the  
consequences are minor. It's possible to cause a spurious warning  
to be generated, but that doesn't really matter. It's also possible  
to trigger an assertion failure, but production builds shouldn't  
have assertions enabled.  
  
Patch by me, reviewed by Kyotaro Horiguchi, Michael Paquier (who  
preferred a different approach, but got outvoted), Fujii Masao,  
and Tom Lane, and with comments by various others.  
  
Discussion: http://postgr.es/m/CA+TgmobMjnyBfNhGTKQEDbqXYE3_rXWpc4CM63fhyerNCes3mA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/replication/basebackup.c
M src/include/access/xlog.h

Add support for MSYS2

commit   : e975c1a6026adb9e248a408fe3ca2629bc8c0084    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Dec 2019 08:28:37 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Dec 2019 08:28:37 +0100    

Click here for diff

It's basically a variant of Cygwin, so use that template.  
  
Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com  

M configure
M configure.in

Re-#include <time.h> in checkpointer.c.

commit   : 9aafc4529f50e027f05037d993c6dd60a6cde54d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 18 Dec 2019 13:03:41 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 18 Dec 2019 13:03:41 -0500    

Click here for diff

Commit 7dbfea3c455e83a77213a92b9dfdc1c0577441ea thought it could get  
away with removing this, but Thomas Munro reports, on behalf of the  
buildfarm, that it's still needed at least on Windows to avoid  
compiler warnings.  

M src/backend/postmaster/checkpointer.c

Move heap-specific detoasting logic into a separate function.

commit   : e9fd0415e6e27c8ce5f40152aa98347ca6fe4385    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 18 Dec 2019 11:08:59 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 18 Dec 2019 11:08:59 -0500    

Click here for diff

The new function, heap_fetch_toast_slice, is shared between  
toast_fetch_datum_slice and toast_fetch_datum, and does all the  
work of scanning the TOAST table, fetching chunks, and storing  
them into the space allocated for the result varlena.  
  
As an incidental side effect, this allows toast_fetch_datum_slice  
to perform the scan with only a single scankey if all chunks are  
being fetched, which might have some tiny performance benefit.  
  
Discussion: http://postgr.es/m/CA+TgmobBzxwFojJ0zV0Own3dr09y43hp+OzU2VW+nos4PMXWEg@mail.gmail.com  

M src/backend/access/common/detoast.c

Minimal portability fix for commit e1551f96e.

commit   : bf7427bdd389aa6c266768f2a07214a2a02b85c9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Dec 2019 10:22:50 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Dec 2019 10:22:50 -0500    

Click here for diff

Older gcc versions are not happy with having multiple declarations  
for the same typedef name (not struct name).  I'm a bit dubious  
as to how well-thought-out that patch was at all, but for the moment  
just fix it enough so I can get some work done today.  
  
Discussion: https://postgr.es/m/20191218101338.GB325369@paquier.xyz  

M src/include/parser/parse_utilcmd.h
M src/include/rewrite/rewriteManip.h

Add .editorconfig

commit   : ecb09cd5de5279ab9cfa20a58fd3da44f7df5779    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Dec 2019 09:08:23 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Dec 2019 09:08:23 +0100    

Click here for diff

The main use right now is getting properly spaced diff views on  
GitHub, but perhaps this will also help developers with editors that  
we currently don't have setup recipes for.  
  
The settings mirror mostly what's currently in .dir-locals.el.  
  
Discussion: https://www.postgresql.org/message-id/flat/273cb788-bbb2-ff34-ad6f-5192b44e5049%402ndquadrant.com  

A .editorconfig

Fix compiler warning in non-assert builds

commit   : 2032645b195a53519b43dad57f55bc163b99f0ef    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 16:55:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 16:55:25 +0900    

Click here for diff

Oversight in commit e1551f9.  
  
Reported-by: Erik Rijkers  
Discussion: https://postgr.es/m/b7ad911d3eaa29af9fcdb9ccb26c363c@xs4all.nl  

M src/backend/access/common/tupconvert.c

Refactor attribute mappings used in logical tuple conversion

commit   : e1551f96e643a52a035c3b35777d968bc073f7fc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 16:23:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 16:23:02 +0900    

Click here for diff

Tuple conversion support in tupconvert.c is able to convert rowtypes  
between two relations, inner and outer, which are logically equivalent  
but have a different ordering or even dropped columns (used mainly for  
inheritance tree and partitions).  This makes use of attribute mappings,  
which are simple arrays made of AttrNumber elements with a length  
matching the number of attributes of the outer relation.  The length of  
the attribute mapping has been treated as completely independent of the  
mapping itself until now, making it easy to pass down an incorrect  
mapping length.  
  
This commit refactors the code related to attribute mappings and moves  
it into an independent facility called attmap.c, extracted from  
tupconvert.c.  This merges the attribute mapping with its length,  
avoiding to try to guess what is the length of a mapping to use as this  
is computed once, when the map is built.  
  
This will avoid mistakes like what has been fixed in dc816e58, which has  
used an incorrect mapping length by matching it with the number of  
attributes of an inner relation (a child partition) instead of an outer  
relation (a partitioned table).  
  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/20191121042556.GD153437@paquier.xyz  

M src/backend/access/common/Makefile
A src/backend/access/common/attmap.c
M src/backend/access/common/tupconvert.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteManip.c
A src/include/access/attmap.h
M src/include/access/tupconvert.h
M src/include/catalog/index.h
M src/include/parser/parse_utilcmd.h
M src/include/replication/logicalrelation.h
M src/include/rewrite/rewriteManip.h
M src/tools/pgindent/typedefs.list

Fix subscriber invalid memory access on DDL.

commit   : 04c8a69c0cccbc271e0feeb22a74c69fbd87c37e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 16 Dec 2019 15:23:46 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 16 Dec 2019 15:23:46 +0530    

Click here for diff

This patch allows building the local relmap cache for a subscribed  
relation after processing pending invalidation messages and potential  
relcache updates.  Without this, the attributes in the local cache don't  
tally with the updated relcache entry leading to invalid memory access.  
  
Reported-by Jehan-Guillaume de Rorthais  
Author: Jehan-Guillaume de Rorthais and Vignesh C  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/20191025175929.7e90dbf5@firost  

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

Doc: Improve readability of options for REINDEX

commit   : 52dcfda48778d16683c64ca4372299a099a15b96    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 11:07:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 11:07:36 +0900    

Click here for diff

That's more consistent with the style we have been using with for  
example EXPLAIN, VACUUM or ANALYZE (this one had only one option in  
v11).  Based on a suggestion from Pavel Stehule.  
  
Author: Josef Šimánek  
Discussion: https://postgr.es/m/CAFj8pRCrUS+eMFvssVPGZN-VDEMP3XN+1Dop0=CmeBq2D+dqOg@mail.gmail.com  
Discussion: https://postgr.es/m/CAFp7QwpeMPEtAR5AYpsG623ooMWX03wMjq5cpZn=X+6OCkfwJw@mail.gmail.com  

M doc/src/sgml/ref/reindex.sgml

Fix some OBJS lists in two Makefiles to be ordered alphabetically

commit   : aa3ef7ff505305d8ee5f733090b076c301a32cc8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 10:42:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 10:42:40 +0900    

Click here for diff

These have been missed in 01368e5, and count for plpython and the  
backend's tsearch code.  
  
Author: Mahendra Singh  
Discussion: https://postgr.es/m/CAKYtNAo4mxRRyDB0YqE6QLh17XD7pPQotpGm3GnHS+gQKz4zQQ@mail.gmail.com  

M src/backend/tsearch/Makefile
M src/pl/plpython/Makefile

Remove redundant not-null test

commit   : 181932a03212751102fb2c105fe556a26aee6ed7    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 17 Dec 2019 20:37:22 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 17 Dec 2019 20:37:22 -0500    

Click here for diff

Reported-by: Ranier Vilela  
  
Discussion: https://postgr.es/m/MN2PR18MB2927E73FADCA8967B2302469E3490@MN2PR18MB2927.namprd18.prod.outlook.com  
  
Author: Ranier Vilela  
  
Backpatch-through: master  

M src/backend/executor/execExpr.c

Remove shadow variables linked to RedoRecPtr in xlog.c

commit   : 70116493a8e07713f7e1270646ca1147898b4f6d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 10:11:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Dec 2019 10:11:13 +0900    

Click here for diff

This changes the routines in charge of recycling WAL segments past the  
last redo LSN to not use anymore "RedoRecPtr" as a local variable, which  
is also available in the context of the session as a static declaration,  
replacing it with "lastredoptr".  This confusion has been introduced by  
d9fadbf, so backpatch down to v11 like the other commit.  
  
Thanks to Tom Lane, Robert Haas, Alvaro Herrera, Mark Dilger and Kyotaro  
Horiguchi for the input provided.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/MN2PR18MB2927F7B5F690065E1194B258E35D0@MN2PR18MB2927.namprd18.prod.outlook.com  
Backpatch-through: 11  

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

Fix error reporting for index expressions of prohibited types.

commit   : 2acab054b3ff8e46707727980ce3fa1a1897381f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Dec 2019 17:44:27 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Dec 2019 17:44:27 -0500    

Click here for diff

If CheckAttributeType() threw an error about the datatype of an  
index expression column, it would report an empty column name,  
which is pretty unhelpful and certainly not the intended behavior.  
I (tgl) evidently broke this in commit cfc5008a5, by not noticing  
that the column's attname was used above where I'd placed the  
assignment of it.  
  
In HEAD and v12, this is trivially fixable by moving up the  
assignment of attname.  Before v12 the code is a bit more messy;  
to avoid doing substantial refactoring, I took the lazy way out  
and just put in two copies of the assignment code.  
  
Report and patch by Amit Langote.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CA+HiwqFA+BGyBFimjiYXXMa2Hc3fcL0+OJOyzUNjhU4NCa_XXw@mail.gmail.com  

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

Fix bad formula in previous commit.

commit   : 5184f110aa4130ec87b0b3e0834292cd8cb1fd8a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 15:53:17 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 15:53:17 -0500    

Click here for diff

Commit d5406dea25b600408e7acf17d5a06e82d3ce6d0d used a slightly  
novel, and wrong, approach to compute the length of the last  
toast chunk. It worked fine unless the last chunk happened to  
have the largest possible size.  

M src/backend/access/common/detoast.c

Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.

commit   : d5406dea25b600408e7acf17d5a06e82d3ce6d0d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 22 Nov 2019 08:43:28 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 22 Nov 2019 08:43:28 -0500    

Click here for diff

Rework some of the checks for bad TOAST chunks to be a bit simpler  
and easier to understand. These checks verify that (1) we get all  
and only the chunk numbers we expect to see and (2) each chunk has  
the expected size. However, the existing code was a bit hard to  
understand, at least for me; try to make it clearer.  
  
As part of that, have toast_fetch_datum_slice check the relationship  
between endchunk and totalchunks only with an Assert() rather than  
checking every chunk number against both values. There's no need to  
check that relationship in production builds because it's not a  
function of whether on-disk corruption is present; it's just a  
question of whether the code does the right math.  
  
Also, have toast_fetch_datum_slice() use ereport(ERROR) rather than  
elog(ERROR). Commit fd6ec93bf890314ac694dc8a7f3c45702ecc1bbd made  
the two functions inconsistent with each other.  
  
Rename assorted variables for better clarity and consistency, and  
move assorted variables from function scope to the function's main  
loop. Remove a few variables that are used only once entirely.  
  
Patch by me, reviewed by Peter Eisentraut.  
  
Discussion: http://postgr.es/m/CA+TgmobBzxwFojJ0zV0Own3dr09y43hp+OzU2VW+nos4PMXWEg@mail.gmail.com  

M src/backend/access/common/detoast.c

simplehash: Allow for use in frontend code.

commit   : da41d71070d14ecd9e2f4bbe275c98a136826d4b    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 14:11:14 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 14:11:14 -0500    

Click here for diff

Commit 48995040d5e7b1e9bac35d72aff326cae002219d removed the largest  
barrier to use of simplehash in frontend code, but there's one more  
problem: it uses elog(ERROR, ...) or elog(LOG, ...) in a couple of  
places. Work around that by changing those to pg_log_error() and  
pg_log_info() when FRONTEND is defined.  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+Tgmob8oyh02NrZW=xCScB+5GyJ-jVowE3+TWTUmPF=FsGWTA@mail.gmail.com  

M src/include/lib/simplehash.h

simplehash: Allow use of simplehash without MemoryContext.

commit   : 48995040d5e7b1e9bac35d72aff326cae002219d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 14:06:25 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 14:06:25 -0500    

Click here for diff

If the SH_RAW_ALLOCATOR is defined, it will be used to allocate bytes  
for the hash table, and no dependencies on MemoryContext will exist.  
This means, in particular, that the SH_CREATE function will not take  
a MemoryContext argument.  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+Tgmob8oyh02NrZW=xCScB+5GyJ-jVowE3+TWTUmPF=FsGWTA@mail.gmail.com  

M src/include/lib/simplehash.h

Add missing "void" to prototypes.

commit   : b1cc572f1274c946da42ed13ae4065e08b13262a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 13:56:19 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 13:56:19 -0500    

Click here for diff

Commit 5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde got this wrong.  
  
Report and patch by Andrew Gierth.  
  
Discussion: http://postgr.es/m/8736diaj98.fsf@news-spur.riddles.org.uk  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c

Partially deduplicate interrupt handling for background processes.

commit   : 7dbfea3c455e83a77213a92b9dfdc1c0577441ea    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 13:14:28 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 13:14:28 -0500    

Click here for diff

Where possible, share signal handler code and main loop interrupt  
checking. This saves quite a bit of code and should simplify  
maintenance, too.  
  
This commit intends not to change the way anything works, even  
though that might allow more code to be unified. It does unify  
a bunch of individual variables into a ShutdownRequestPending  
flag that has is now used by a bunch of different process types,  
though.  
  
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M src/backend/postmaster/Makefile
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
A src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/include/miscadmin.h
A src/include/postmaster/interrupt.h

Use PostgresSigHupHandler in more places.

commit   : 1e53fe0e70f610c34f4c9e770d108cd94151342c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 13:03:57 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 13:03:57 -0500    

Click here for diff

There seems to be no reason for every background process to have  
its own flag indicating that a config-file reload is needed.  
Instead, let's just use ConfigFilePending for that purpose  
everywhere.  
  
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c

Move interrupt-handling code into subroutines.

commit   : 5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 12:55:13 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Dec 2019 12:55:13 -0500    

Click here for diff

Some auxiliary processes, as well as the autovacuum launcher,  
have interrupt handling code directly in their main loops.  
Try to abstract things a little better by moving it into  
separate functions.  
  
This doesn't make any functional difference, and leaves  
in place relatively large differences among processes in how  
interrupts are handled, but hopefully it at least makes it  
easier to see the commonalities and differences across  
process types.  
  
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c

Change overly strict Assert in TransactionGroupUpdateXidStatus.

commit   : af3290f5e790dcd1be3ac209be1805626f4ebac8    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 12 Dec 2019 11:51:30 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 12 Dec 2019 11:51:30 +0530    

Click here for diff

This Assert thought that an overflowed transaction can never get registered  
for the group update.  But that is not true, because even when the number  
of children for a transaction got reduced, the overflow flag is not  
changed.  And, for group update, we only care about the current number of  
children for a transaction that is being committed.  
  
Based on comments by Andres Freund, remove a redundant Assert in  
TransactionIdSetPageStatus as we already had a static Assert for the same  
condition a few lines earlier.  
  
Reported-by: Vignesh C  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAFiTN-s5=uJw-Z6JC9gcqtBSjXsrHnU63PXBrA=pnBjqnkm5UA@mail.gmail.com  

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

Rename nbtree tuple macros.

commit   : fcf3b6917bd8f6f9f463e3e42e53d6ff9612e327    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 16 Dec 2019 17:49:45 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 16 Dec 2019 17:49:45 -0800    

Click here for diff

Rename two function-style macros, removing the word "inner".  This makes  
things more consistent.  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h

Fix query cancellation handling in psql

commit   : 5d43c3c54d77f39135fe463539f5f438f460ae7e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Dec 2019 10:44:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Dec 2019 10:44:25 +0900    

Click here for diff

The refactoring done in a4fd3aa for query cancellation has messed up  
with the logic in psql by mixing CancelRequested and cancel_pressed,  
breaking for example \watch.  The former would be switched to true if a  
cancellation request has been attempted and that it actually succeeded,  
and the latter tracks if a cancellation attempt has been done.  
  
This commit brings back the code of psql to a state consistent to what  
it was before a4fd3aa, without giving up on the refactoring pieces  
introduced.  It should be actually possible to merge more both flags as  
their concepts are close enough, however note that psql's --single-step  
mode relies on cancel_pressed to be always set, so this requires more  
careful analysis left for later.  
  
While on it, fix the declarations of CancelRequested (in cancel.c) and  
cancel_pressed (in psql) to be volatile sig_atomic_t.  Previously,  
both were declared as booleans, which should be fine on modern  
platforms, but the C standard recommends the use of sig_atomic_t for  
variables used in signal handlers.  Note that since its introduction in  
a1792320, CancelRequested declaration was not volatile.  
  
Reported-by: Jeff Janes  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CAMkU=1zpoUDGKqWKuMWkj7t-bOCaJDx0r=5te_-d0B2HVLABXg@mail.gmail.com  

M src/bin/psql/common.c
M src/fe_utils/cancel.c
M src/fe_utils/print.c
M src/include/fe_utils/cancel.h
M src/include/fe_utils/print.h

Fix "force_parallel_mode = regress" to work with ANALYZE + VERBOSE.

commit   : b925a00f4ef65db9359e1c60fbf0e56d05afb25a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Dec 2019 20:14:25 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Dec 2019 20:14:25 -0500    

Click here for diff

force_parallel_mode = regress is supposed to force use of a Gather  
node without having any impact on EXPLAIN output.  But it failed to  
accomplish that if both ANALYZE and VERBOSE are given, because that  
enables per-worker output data that you wouldn't see if the Gather  
hadn't been inserted.  Improve the logic so that we suppress the  
per-worker data too.  
  
This allows putting the new test case added by commit 5935917ce  
back into the originally intended form (cf. 776a2c887, 22864f6e0).  
We can also get rid of a kluge in subselect.sql, which previously  
had to clean up after force_parallel_mode's failure to do what it  
said on the tin.  
  
Discussion: https://postgr.es/m/18445.1576177309@sss.pgh.pa.us  

M src/backend/commands/explain.c
M src/include/commands/explain.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/partition_prune.sql
M src/test/regress/sql/subselect.sql

Update nbtree README's "Scans during Recovery".

commit   : 9067b83955da5fde49a2605510900e6d9fa273af    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 16 Dec 2019 17:11:35 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 16 Dec 2019 17:11:35 -0800    

Click here for diff

get_actual_variable_range() hasn't used a dirty snapshot since commit  
3ca930fc3, which invented a new snapshot type specifically to meet  
selfuncs.c's requirements (HeapTupleSatisfiesNonVacuumable() type  
snapshots were added).  
  
Discussion: https://postgr.es/m/CAH2-Wzn2pSqEOcBDAA40CnO82oEy-EOpE2bNh_XL_cfFoA86jw@mail.gmail.com  

M src/backend/access/nbtree/README

On Windows, wait a little to see if ERROR_ACCESS_DENIED goes away.

commit   : 6d7547c219adf2436323cdbd4bebc5e872d53546    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Dec 2019 15:10:55 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Dec 2019 15:10:55 -0500    

Click here for diff

Attempting to open a file fails with ERROR_ACCESS_DENIED if the file  
is flagged for deletion but not yet actually gone (another in a long  
list of reasons why Windows is broken, if you ask me).  This seems  
likely to explain a lot of irreproducible failures we see in the  
buildfarm.  This state generally persists for only a millisecond or so,  
so just wait a bit and retry.  If it's a real permissions problem,  
we'll eventually give up and report it as such.  If it's the pending  
deletion case, we'll see file-not-found and report that after the  
deletion completes, and the caller will treat that in an appropriate  
way.  
  
In passing, rejigger the existing retry logic for some other error  
cases so that we don't uselessly wait an extra time when we're  
not going to retry anymore.  
  
Alexander Lakhin (with cosmetic tweaks by me).  Back-patch to all  
supported branches, since this seems like a pretty safe change and  
the problem is definitely real.  
  
Discussion: https://postgr.es/m/16161-7a985d2f1bbe8f71@postgresql.org  

M src/port/open.c

Demote variable from global to local

commit   : 91fca4bb60e8c00e8b0e2755555b39f4b1c1659c    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 16 Dec 2019 14:23:56 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 16 Dec 2019 14:23:56 -0300    

Click here for diff

recoveryDelayUntilTime was introduced by commit 36da3cfb457b as a global  
because its method of operation was devilishly intrincate.  Commit  
c945af80cfda removed all that complexity and could have turned it into a  
local variable, but didn't.  Do so now.  
  
Discussion: https://postgr.es/m/20191213200751.GA10731@alvherre.pgsql  
Reviewed-by: Michaël Paquier, Daniel Gustafsson  

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

Fix yet another crash in page split during GiST index creation.

commit   : 741b884353e4803abc15d4392ad287b0d5953fc4    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 16 Dec 2019 13:57:41 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 16 Dec 2019 13:57:41 +0200    

Click here for diff

Commit a7ee7c8513 fixed a bug in GiST page split during index creation,  
where we failed to re-find the position of a downlink after the page  
containing it was split. However, that fix was incomplete; the other call  
to gistinserttuples() in the same function needs to also clear  
'downlinkoffnum'.  
  
Fixes bug #16134 reported by Alexander Lakhin, for real this time. The  
previous fix was enough to fix the crash with the reproducer script for  
bug #16162, but the original script for #16134 was still crashing.  
  
Backpatch to v12, like the previous incomplete fix.  
  
Discussion: https://www.postgresql.org/message-id/d869f537-abe4-d2ea-0510-38cd053f5152%40gmail.com  

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

Fix build of Perl-using modules of Windows

commit   : 502423180a8cc9214861bffcb8405a42f146f160    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Dec 2019 11:48:01 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Dec 2019 11:48:01 +0100    

Click here for diff

Commit f14413b684d57211068ee56ee04695efcc87a23a broke the build of  
Perl-using modules on Windows.  
  
Perl might have its own definitions of uid_t and gid_t, so we hide  
ours, but then we can't use ours in our header files such as port.h  
which don't see the Perl definition.  
  
Hide our definition of getpeereid() on Windows in Perl-using modules,  
using PLPERL_HAVE_UID_GID define.  That means we can't portably use  
getpeeruid() is such modules right now, but there is no need anyway.  

M src/include/port.h

Sort out getpeereid() and peer auth handling on Windows

commit   : f14413b684d57211068ee56ee04695efcc87a23a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Oct 2019 12:58:32 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Oct 2019 12:58:32 +0100    

Click here for diff

The getpeereid() uses have so far been protected by HAVE_UNIX_SOCKETS,  
so they didn't ever care about Windows support.  But in anticipation  
of Unix-domain socket support on Windows, that needs to be handled  
differently.  
  
Windows doesn't support getpeereid() at this time, so we use the  
existing not-supported code path.  We let configure do its usual thing  
of picking up the replacement from libpgport, instead of the custom  
overrides that it was doing before.  
  
But then Windows doesn't have struct passwd, so this patch sprinkles  
some additional #ifdef WIN32 around to make it work.  This is similar  
to existing code that deals with this issue.  
  
Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/5974caea-1267-7708-40f2-6009a9d653b0@2ndquadrant.com  

M configure
M configure.in
M src/backend/libpq/auth.c
M src/include/port.h
M src/interfaces/libpq/fe-connect.c
M src/tools/msvc/Mkvcbuild.pm

Clean up some misplaced comments in partition_join.sql regression test.

commit   : 956ef5875341c22a602fb825e6c98eaabb1ecce7    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 16 Dec 2019 17:00:15 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 16 Dec 2019 17:00:15 +0900    

Click here for diff

Also, add a comment explaining a test case.  
  
Back-patch to 11 where the regression test was added.  
  
Discussion: https://postgr.es/m/CAPmGK15adZPh2B%2BmGUjSOMH%2BH39ogDRWfCfm4G6jncZCAs9V_Q%40mail.gmail.com  

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

Remove duplicated progress reporting during heap scan of VACUUM

commit   : e5a02e0fc68bd57048f2c74a89f5412dbf87015e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 15 Dec 2019 22:05:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 15 Dec 2019 22:05:33 +0900    

Click here for diff

This has been introduced by c16dc1a since progress reporting for VACUUM  
has been added.  As this issue just causes some extra work and is  
harmless, no backpatch is done.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20191213030831.GT2082@telsasoft.com  

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

Try to stabilize results of new tuplesort regression test.

commit   : baa32ce28b39eccdf384e979dac5ad8be91ff44e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Dec 2019 15:01:56 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Dec 2019 15:01:56 -0500    

Click here for diff

It appears that a concurrent autovacuum/autoanalyze run can cause  
changes in the plans expected by this test.  To prevent that, change  
the tables it uses to be temp tables --- there's no need for them  
to be permanent, and this should save a few cycles too.  
  
Discussion: https://postgr.es/m/3244.1576160824@sss.pgh.pa.us  

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

Prevent overly-aggressive collapsing of joins to RTE_RESULT relations.

commit   : 6ea364e7e7d5f298fc965006caa6c228c743fe77    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Dec 2019 13:49:15 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Dec 2019 13:49:15 -0500    

Click here for diff

The RTE_RESULT simplification logic added by commit 4be058fe9 had a  
flaw: it would collapse out a RTE_RESULT that is due to compute a  
PlaceHolderVar, and reassign the PHV to the parent join level, even if  
another input relation of the join contained a lateral reference to  
the PHV.  That can't work because the PHV would be computed too late.  
In practice it led to failures of internal sanity checks later in  
planning (either assertion failures or errors such as "failed to  
construct the join relation").  
  
To fix, add code to check for the presence of such PHVs in relevant  
portions of the query tree.  Notably, this required refactoring  
range_table_walker so that a caller could ask to walk individual RTEs  
not the whole list.  (It might be a good idea to refactor  
range_table_mutator in the same way, if only to keep those functions  
looking similar; but I didn't do so here as it wasn't necessary for  
the bug fix.)  
  
This exercise also taught me that find_dependent_phvs(), as it stood,  
could only safely be used on the entire Query, not on subtrees.  
Adjust its API to reflect that; which in passing allows it to have  
a fast path for the common case of no PHVs anywhere.  
  
Per report from Will Leinweber.  Back-patch to v12 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/CALLb-4xJMd4GZt2YCecMC95H-PafuWNKcmps4HLRx2NHNBfB4g@mail.gmail.com  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/nodeFuncs.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix memory leak when initializing DH parameters in backend

commit   : e0e569e1d192c3fed942257302f24b550cf982f4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 14 Dec 2019 18:17:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 14 Dec 2019 18:17:31 +0900    

Click here for diff

When loading DH parameters used for the generation of ephemeral DH keys  
in the backend, the code has never bothered releasing the memory used  
for the DH information loaded from a file or from libpq's default.  This  
commit makes sure that the information is properly free()'d.  
  
Note that as SSL parameters can be reloaded, this can cause an accumulation  
of memory leaked.  As the leak is minor, no backpatch is done.  
  
Reported-by: Dmitry Uspenskiy  
Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org  

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

Fix mdsyncfiletag(), take II.

commit   : 7c85be08a2d404ec2a1a6a3b089e7f08d62e5db8    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 14 Dec 2019 17:38:09 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 14 Dec 2019 17:38:09 +1300    

Click here for diff

The previous commit failed to consider that FileGetRawDesc() might  
not return a valid fd, as discovered on the build farm.  Switch to  
using the File interface only.  
  
Back-patch to 12, like the previous commit.  

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

Don't use _mdfd_getseg() in mdsyncfiletag().

commit   : 7bb3102cea02101efcbb4c4fba3fdd452a52bdab    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 14 Dec 2019 15:54:31 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 14 Dec 2019 15:54:31 +1300    

Click here for diff

_mdfd_getseg() opens all segments up to the requested one.  That  
causes problems for mdsyncfiletag(), if mdunlinkfork() has  
already unlinked other segment files.  Open the file we want  
directly by name instead, if it's not already open.  
  
The consequence of this bug was a rare panic in the checkpointer,  
made more likely if you saturated the sync request queue so that  
the SYNC_FORGET_REQUEST messages for a given relation were more  
likely to be absorbed in separate cycles by the checkpointer.  
  
Back-patch to 12.  Defect in commit 3eb77eba.  
  
Author: Thomas Munro  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20191119115759.GI30362%40telsasoft.com  

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

Fix crash when a page was split during GiST index creation.

commit   : a7ee7c85132221ff7231b6f910915a1b3ce1ecbc    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Dec 2019 23:58:10 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Dec 2019 23:58:10 +0200    

Click here for diff

The bug was similar to the one that was fixed in commit 22251686f0. When  
we split page X and insert the downlink for the new page, the parent page  
might also need to be split. When that happens, the downlink offset number  
we remembered for X is no longer valid. We correctly called  
gistFindCorrectParent() to re-find it, but gistFindCorrectParent() doesn't  
do anything if the LSN of the page hasn't changed, and we stopped updating  
LSNs during index build in commit 9155580fd5. The buggy codepath was taken  
if the page was split into three or more pages, and inserting the downlink  
caused the parent page to split. To fix, explicitly mark the downlink  
offset number as invalid, to force gistFindCorrectParent() to re-find it.  
  
Fixes bug #16134 reported by Alexander Lakhin, reported again as #16162 by  
Andreas Kunert. Thanks to Jeff Janes, Tom Lane and Tomas Vondra for  
debugging. Backpatch to v12, where we stopped WAL-logging during index  
build.  
  
Discussion: https://www.postgresql.org/message-id/16134-0423f729671dec64%40postgresql.org  
Discussion: https://www.postgresql.org/message-id/16162-45d21b7b6c1a3105%40postgresql.org  

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

Modernize our readline API a tad.

commit   : 5e7bedc5adba570b526d89746201481616756779    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 13 Dec 2019 11:16:33 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 13 Dec 2019 11:16:33 -0500    

Click here for diff

Prefer to call "rl_filename_completion_function" and  
"rl_completion_matches", rather than using the names without the rl_  
prefix.  This matches Readline's documentation, and makes our code  
a little clearer about which names are external.  On platforms that  
only have the un-prefixed names (just some very ancient versions of  
libedit, AFAICT), reverse the direction of the compatibility macro  
definitions to match.  
  
Also, remove our extern declaration of "filename_completion_function";  
whatever libedit versions may have failed to declare that are surely  
dead and buried.  
  
Discussion: https://postgr.es/m/23608.1576248145@sss.pgh.pa.us  

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

Put back regression test case in a more robust form.

commit   : 22864f6e02f8fc19f6167442f13d1f917e36548e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 Dec 2019 13:49:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 Dec 2019 13:49:54 -0500    

Click here for diff

This undoes my hurried commit 776a2c887, restoring the removed test case  
in a form that passes with or without force_parallel_mode = regress.  
  
It turns out that force_parallel_mode = regress simply fails to mask  
the Worker lines that will be produced by EXPLAIN (ANALYZE, VERBOSE).  
I'd say that's a bug in that feature, as its entire alleged reason  
for existence is to make the EXPLAIN output the same.  It's certainly  
not a bug in the plan node pruning logic.  Fortunately, this test case  
doesn't really need to use ANALYZE, so just drop that.  
  
Discussion: https://postgr.es/m/18891.1576109690@sss.pgh.pa.us  

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

Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.

commit   : 1a3efa1eb67ab752231a6fff2743a77ae55808d5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 Dec 2019 12:30:43 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 Dec 2019 12:30:43 -0500    

Click here for diff

The test cases added by commit 26ae3aa80 exposed an old oversight in  
timestamp[tz]_part: they didn't correct the result of date2isoyear()  
for BC years, so that we produced an off-by-one answer for such years.  
Fix that, and back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out

Remove redundant function calls in timestamp[tz]_part().

commit   : 26ae3aa80e337261203ba4442452bed261ff9888    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 Dec 2019 12:12:35 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 Dec 2019 12:12:35 -0500    

Click here for diff

The DTK_DOW/DTK_ISODOW and DTK_DOY switch cases in timestamp_part() and  
timestamptz_part() contained calls of timestamp2tm() that were fully  
redundant with the ones done just above the switch.  This evidently crept  
in during commit 258ee1b63, which relocated that code from another place  
where the calls were indeed needed.  Just delete the redundant calls.  
  
I (tgl) noted that our test coverage of these functions left quite a  
bit to be desired, so extend timestamp.sql and timestamptz.sql to  
cover all the branches.  
  
Back-patch to all supported branches, as the previous commit was.  
There's no real issue here other than some wasted cycles in some  
not-too-heavily-used code paths, but the test coverage seems valuable.  
  
Report and patch by Li Japin; test case adjustments by me.  
  
Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com  

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

(Blindly) tweak new test regex

commit   : 8ed428dc977f6d3e454892ddca089f17e150384f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 12 Dec 2019 13:45:15 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 12 Dec 2019 13:45:15 -0300    

Click here for diff

gcc-based Windows buildfarm animals are not happy about a multiline  
regular expression I added recently.  Try to accomodate; existing  
pg_basebackup tests suggest that \n should work instead of a bare  
newline, but throw in \r also.  This being perl, TIMTOWTDI.  
Also remove the pointless $ at the end of the pattern, for extra luck.  
  
(If this doesn't work, I'll probably just split the regex in two.)  
  
Per buildfarm members jacana and fairywren.  
  
Discussion: https://postgr.es/m/3562.1576161217@sss.pgh.pa.us  

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

Remove extra parenthesis from comment.

commit   : a41a1456c4a1040974939db23a81101a2f6ade6f    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 12 Dec 2019 15:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 12 Dec 2019 15:45:00 +0900    

Click here for diff

M src/backend/partitioning/partbounds.c

Add readfuncs.c support for AppendRelInfo.

commit   : 591d404b9cd2c562bfe7fe60d76988d49b5ba2b1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 19:08:16 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 19:08:16 -0500    

Click here for diff

This is made necessary by the fact that commit 6ef77cf46 added  
AppendRelInfos to plan trees.  I'd concluded that this extra code was  
not necessary because we don't transmit that data to parallel workers  
... but I forgot about -DWRITE_READ_PARSE_PLAN_TREES.  Per buildfarm.  

M src/backend/nodes/readfuncs.c

Remove unstable test case added in commit 5935917ce.

commit   : 776a2c887480977a4327108945364fb4d84a817f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 18:53:53 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 18:53:53 -0500    

Click here for diff

The buildfarm says this produces some unexpected output with  
force_parallel_mode = regress.  There's probably a bug underneath  
that, but for the moment just delete the test case to make the  
buildfarm green again.  
  
(I now notice that the case had also failed to get updated to follow  
commit d52eaa094, which made plan_cache_mode = force_generic_plan  
prevail throughout partition_prune.sql; it was thereby managing to  
break a later test.  When/if we put this back in, *don't* include the  
SET and RESET commands.)  

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

Allow executor startup pruning to prune all child nodes.

commit   : 5935917ce59e2e613ac7a4b54ed49a7b9f8f28ac    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 17:05:30 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 17:05:30 -0500    

Click here for diff

Previously, if the startup pruning logic proved that all child nodes  
of an Append or MergeAppend could be pruned, we still kept one, just  
to keep EXPLAIN from failing.  The previous commit removed the  
ruleutils.c limitation that required this kluge, so drop it.  That  
results in less-confusing EXPLAIN output, as per a complaint from  
Yuzuko Hosoya.  
  
David Rowley  
  
Discussion: https://postgr.es/m/001001d4f44b$2a2cca50$7e865ef0$@lab.ntt.co.jp  

M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Further adjust EXPLAIN's choices of table alias names.

commit   : 6ef77cf46e81f45716ec981cb08781d426181378    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 17:05:18 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 17:05:18 -0500    

Click here for diff

This patch causes EXPLAIN to always assign a separate table alias to the  
parent RTE of an append relation (inheritance set); before, such RTEs  
were ignored if not actually scanned by the plan.  Since the child RTEs  
now always have that same alias to start with (cf. commit 55a1954da),  
the net effect is that the parent RTE usually gets the alias used or  
implied by the query text, and the children all get that alias with "_N"  
appended.  (The exception to "usually" is if there are duplicate aliases  
in different subtrees of the original query; then some of those original  
RTEs will also have "_N" appended.)  
  
This results in more uniform output for partitioned-table plans than  
we had before: the partitioned table itself gets the original alias,  
and all child tables have aliases with "_N", rather than the previous  
behavior where one of the children would get an alias without "_N".  
  
The reason for giving the parent RTE an alias, even if it isn't scanned  
by the plan, is that we now use the parent's alias to qualify Vars that  
refer to an appendrel output column and appear above the Append or  
MergeAppend that computes the appendrel.  But below the append, Vars  
refer to some one of the child relations, and are displayed that way.  
This seems clearer than the old behavior where a Var that could carry  
values from any child relation was displayed as if it referred to only  
one of them.  
  
While at it, change ruleutils.c so that the code paths used by EXPLAIN  
deal in Plan trees not PlanState trees.  This effectively reverts a  
decision made in commit 1cc29fe7c, which seemed like a good idea at  
the time to make ruleutils.c consistent with explain.c.  However,  
it's problematic because we'd really like to allow executor startup  
pruning to remove all the children of an append node when possible,  
leaving no child PlanState to resolve Vars against.  (That's not done  
here, but will be in the next patch.)  This requires different handling  
of subplans and initplans than before, but is otherwise a pretty  
straightforward change.  
  
Discussion: https://postgr.es/m/001001d4f44b$2a2cca50$7e865ef0$@lab.ntt.co.jp  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/utils/ruleutils.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/updatable_views.out

Emit parameter values during query bind/execute errors

commit   : ba79cb5dc841104cf4810b5c23af4f881079dbb5    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 11 Dec 2019 18:03:35 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 11 Dec 2019 18:03:35 -0300    

Click here for diff

This makes such log entries more useful, since the cause of the error  
can be dependent on the parameter values.  
  
Author: Alexey Bashtanov, Álvaro Herrera  
Discussion: https://postgr.es/m/0146a67b-a22a-0519-9082-bc29756b93a2@imap.cc  
Reviewed-by: Peter Eisentraut, Andres Freund, Tom Lane  

M doc/src/sgml/config.sgml
M src/backend/nodes/params.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/include/nodes/params.h
M src/include/utils/guc.h

Use only one thread to handle incoming signals on Windows.

commit   : 16114f2ea0c0aba75d10b622797d31bcd296fadd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 15:09:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Dec 2019 15:09:54 -0500    

Click here for diff

Since its inception, our Windows signal emulation code has worked by  
running a main signal thread that just watches for incoming signal  
requests, and then spawns a new thread to handle each such request.  
That design is meant for servers in which requests can take substantial  
effort to process, and it's worth parallelizing the handling of  
requests.  But those assumptions are just bogus for our signal code.  
It's not much more than pg_queue_signal(), which is cheap and can't  
parallelize at all, plus we don't really expect lots of signals to  
arrive at the same backend at once.  More importantly, this approach  
creates failure modes that we could do without: either inability to  
spawn a new thread or inability to create a new pipe handle will risk  
loss of signals.  Hence, dispense with the separate per-signal threads  
and just service each request in-line in the main signal thread.  This  
should be a bit faster (for the normal case of one signal at a time)  
as well as more robust.  
  
Patch by me; thanks to Andrew Dunstan for testing and Amit Kapila  
for review.  
  
Discussion: https://postgr.es/m/4412.1575748586@sss.pgh.pa.us  

M src/backend/port/win32/signal.c

Remove ATPrepSetStatistics

commit   : 105eb360f2513523d221302b2d52880a14afae34    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Dec 2019 08:59:18 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Dec 2019 08:59:18 +0100    

Click here for diff

It was once possible to do ALTER TABLE ... SET STATISTICS on system  
tables without allow_sytem_table_mods.  This was changed apparently by  
accident between PostgreSQL 9.1 and 9.2, but a code comment still  
claimed this was possible.  Without that functionality, having a  
separate ATPrepSetStatistics() is useless, so use the generic  
ATSimplePermissions() instead and move the remaining custom code into  
ATExecSetStatistics().  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/cc8d2648-a0ec-7a86-13e5-db473484e19e%402ndquadrant.com  

M src/backend/commands/tablecmds.c

Fix output of Unicode normalization test

commit   : b802412106e82ccf1aef36a4984e321082c122cb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Dec 2019 08:42:17 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Dec 2019 08:42:17 +0100    

Click here for diff

Several off-by-more-than-one errors caused the output in case of a  
test failure to be truncated and unintelligible.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/6a7a8516-7d11-8fbd-0e8b-eadb4f0679eb%402ndquadrant.com  

M src/common/unicode/norm_test.c

Fix some compiler warnings with timestamp parsing in formatting.c

commit   : c341c7d391e256f80cfbae53b4f55278bffca699    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 Dec 2019 10:01:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 Dec 2019 10:01:06 +0900    

Click here for diff

gcc-7 used with a sufficient optimization level complains about warnings  
around do_to_timestamp() regarding the initialization and handling of  
some of its variables.  Recent commits 66c74f8 and d589f94 made things  
made the interface more confusing, so document which variables are  
always expected and initialize properly the optional ones when they are  
set.  
  
Author: Andrey Lepikhov, Michael Paquier  
Discussion: https://postgr.es/m/a7e28b83-27b1-4e1c-c76b-4268c4b785bc@postgrespro.ru  

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

Fix tuple column count in pg_control_init().

commit   : 8729fa72483f8a9acf299508bb2cbae1aa9a29b8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 10 Dec 2019 17:51:46 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 10 Dec 2019 17:51:46 -0500    

Click here for diff

Oversight in commit 2e4db241b.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/1B616360-396A-4482-AA28-375566C86160@amazon.com  

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

Cosmetic cleaning of pg_config.h.win32

commit   : 877b61e9ce95934c71a9c01614db4be1b395fff6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 Dec 2019 21:15:30 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 Dec 2019 21:15:30 +0100    

Click here for diff

Clean up some comments (some generated by old versions of autoconf)  
and some random ordering differences, so it's easier to diff this  
against the default pg_config.h or pg_config.h.in.  Remove LOCALEDIR  
handling from pg_config.h.win32 altogether because it's already in  
pg_config_paths.h.  

M src/include/pg_config.h.win32
M src/tools/msvc/Solution.pm

Add backend-only appendStringInfoStringQuoted

commit   : 6cafde1bd43f1c28b044953cac2f2999eb425b22    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 10 Dec 2019 17:09:32 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 10 Dec 2019 17:09:32 -0300    

Click here for diff

This provides a mechanism to emit literal values in informative  
messages, such as query parameters.  The new code is more complex than  
what it replaces, primarily because it wants to be more efficient.  
It also has the (currently unused) additional optional capability of  
specifying a maximum size to print.  
  
The new function lives out of common/stringinfo.c so that frontend users  
of that file need not pull in unnecessary multibyte-encoding support  
code.  
  
Author: Álvaro Herrera and Alexey Bashtanov, after a suggestion from Andres Freund  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20190920203905.xkv5udsd5dxfs6tr@alap3.anarazel.de  

M src/backend/tcop/postgres.c
M src/backend/utils/mb/Makefile
M src/backend/utils/mb/README
A src/backend/utils/mb/stringinfo_mb.c
A src/include/mb/stringinfo_mb.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster log file.

commit   : 0da33c762b85aeada111aa1371c33ac6737f8396    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 10 Dec 2019 13:17:08 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 10 Dec 2019 13:17:08 -0500    

Click here for diff

On Windows, we use CMD.EXE to redirect the postmaster's stdout/stderr  
into a log file.  CMD.EXE will open that file with non-sharing-friendly  
parameters, and the file will remain open for a short time after the  
postmaster has removed postmaster.pid.  This can result in an  
ERROR_SHARING_VIOLATION failure if we attempt to start a new postmaster  
immediately with the same log file (e.g. during "pg_ctl restart").  
This seems to explain intermittent buildfarm failures we've been seeing  
on Windows machines.  
  
To fix, just open and close the log file using our own pgwin32_open(),  
which will wait if necessary to avoid the failure.  (Perhaps someday  
we should stop using CMD.EXE, but that would be a far more complex  
patch, and it doesn't seem worth the trouble ... yet.)  
  
Back-patch to v12.  This only solves the problem when frontend fopen()  
is redirected to pgwin32_fopen(), which has only been true since commit  
0ba06e0bf.  Hence, no point in back-patching further, unless we care  
to back-patch that change too.  
  
Diagnosis and patch by Alexander Lakhin (bug #16154).  
  
Discussion: https://postgr.es/m/16154-1ccf0b537b24d5e0@postgresql.org  

M src/bin/pg_ctl/pg_ctl.c

Fix handling of multiple AFTER ROW triggers on a foreign table.

commit   : 5a20b0219e7684788a1b63e812dd44b31361b259    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 10 Dec 2019 18:00:30 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 10 Dec 2019 18:00:30 +0900    

Click here for diff

AfterTriggerExecute() retrieves a fresh tuple or pair of tuples from a  
tuplestore and then stores the tuple(s) in the passed-in slot(s) if  
AFTER_TRIGGER_FDW_FETCH, while it uses the most-recently-retrieved  
tuple(s) stored in the slot(s) if AFTER_TRIGGER_FDW_REUSE.  This was  
done correctly before 12, but commit ff11e7f4b broke it by mistakenly  
clearing the tuple(s) stored in the slot(s) in that function, leading to  
an assertion failure as reported in bug #16139 from Alexander Lakhin.  
  
Also, fix some other issues with the aforementioned commit in passing:  
  
* For tg_newslot, which is a slot added to the TriggerData struct by the  
  commit to store new updated tuples, it didn't ensure the slot was NULL  
  if there was no such tuple.  
* The commit failed to update the documentation about the trigger  
  interface.  
  
Author: Etsuro Fujita  
Backpatch-through: 12  
Discussion: https://postgr.es/m/16139-94f9ccf0db6119ec%40postgresql.org  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/trigger.sgml
M src/backend/commands/trigger.c

Fix race condition in our Windows signal emulation.

commit   : 28e6a2fd6358c1b75ce2f4e7cb3fcff979dbe539    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Dec 2019 15:03:51 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Dec 2019 15:03:51 -0500    

Click here for diff

pg_signal_dispatch_thread() responded to the client (signal sender)  
and disconnected the pipe before actually setting the shared variables  
that make the signal visible to the backend process's main thread.  
In the worst case, it seems, effective delivery of the signal could be  
postponed for as long as the machine has any other work to do.  
  
To fix, just move the pg_queue_signal() call so that we do it before  
responding to the client.  This essentially makes pgkill() synchronous,  
which is a stronger guarantee than we have on Unix.  That may be  
overkill, but on the other hand we have not seen comparable timing bugs  
on any Unix platform.  
  
While at it, add some comments to this sadly underdocumented code.  
  
Problem diagnosis and fix by Amit Kapila; I just added the comments.  
  
Back-patch to all supported versions, as it appears that this can cause  
visible NOTIFY timing oddities on all of them, and there might be  
other misbehavior due to slow delivery of other signals.  
  
Discussion: https://postgr.es/m/32745.1575303812@sss.pgh.pa.us  

M src/backend/port/win32/signal.c

Improve isolationtester's timeout management.

commit   : 99351a8b5a3882ee5d131bd37d03a67ab07b4fea    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Dec 2019 14:31:57 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Dec 2019 14:31:57 -0500    

Click here for diff

isolationtester.c had a hard-wired limit of 3 minutes per test step.  
It now emerges that this isn't quite enough for some of the slowest  
buildfarm animals.  This isn't the first time we've had to raise  
this limit (cf. 1db439ad4), so let's make it configurable.  This  
patch raises the default to 5 minutes, and introduces an environment  
variable PGISOLATIONTIMEOUT that can be set if more time is needed,  
following the precedent of PGCTLTIMEOUT.  
  
Also, modify isolationtester so that when the timeout is hit,  
it explicitly reports having sent a cancel.  This makes the regression  
failure log considerably more intelligible.  (In the worst case, a  
timed-out test might actually be reported as "passing" without this  
extra output, so arguably this is a bug fix in itself.)  
  
In passing, update the README file, which had apparently not gotten  
touched when we added "make check" support here.  
  
Back-patch to 9.6; older versions don't have comparable timeout logic.  
  
Discussion: https://postgr.es/m/22964.1575842935@sss.pgh.pa.us  

M src/test/isolation/README
M src/test/isolation/isolationtester.c

Fix typos in miscinit.c.

commit   : 2d0fdfaccec8b314895e026018874dcc5565b43e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 9 Dec 2019 08:39:34 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 9 Dec 2019 08:39:34 +0530    

Click here for diff

Commit f13ea95f9e moved the description of postmaster.pid file contents  
from miscadmin.h to pidfile.h, but missed to update the comments in  
miscinit.c.  
  
Author: Hadi Moshayedi  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAK=1=WpYEM9x3LGkaxgXaxeYQjnkdW8XLsxrYRTE2Gq-H83FMw@mail.gmail.com  

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

Document search_path security with untrusted dbowner or CREATEROLE.

commit   : fd5e16e782fc6cd829b27e2c83c623b8020e5774    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 8 Dec 2019 11:06:26 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 8 Dec 2019 11:06:26 -0800    

Click here for diff

Commit 5770172cb0c9df9e6ce27c507b449557e5b45124 wrote, incorrectly, that  
certain schema usage patterns are secure against CREATEROLE users and  
database owners.  When an untrusted user is the database owner or holds  
CREATEROLE privilege, a query is secure only if its session started with  
SELECT pg_catalog.set_config('search_path', '', false) or equivalent.  
Back-patch to 9.4 (all supported versions).  
  
Discussion: https://postgr.es/m/20191013013512.GC4131753@rfd.leadboat.com  

M doc/src/sgml/ddl.sgml

Doc: improve documentation about run-time pruning's effects on EXPLAIN.

commit   : a395e21e989af0c2aab9dd1b1e0a1842ca42a063    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 8 Dec 2019 10:36:29 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 8 Dec 2019 10:36:29 -0500    

Click here for diff

Tatsuo Ishii complained that this para wasn't very intelligible.  
Try to make it better.  
  
Discussion: https://postgr.es/m/20191207.200500.989741087350666720.t-ishii@sraoss.co.jp  

M doc/src/sgml/perform.sgml

Remove PQsslpassword function

commit   : e75b1e33710249d1699850920c0390fb08ea5673    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 7 Dec 2019 09:20:53 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 7 Dec 2019 09:20:53 -0500    

Click here for diff

This partially reverts commit 4dc6355210.  
  
The information returned by the function can be obtained by calling  
PQconninfo(), so the function is redundant.  

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

Improve test coverage of ruleutils.c.

commit   : 830d1c73b3f4524bc897ddab5c6c3b47840c915a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Dec 2019 17:40:24 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Dec 2019 17:40:24 -0500    

Click here for diff

While fooling around with the EXPLAIN improvements I've been working  
on, I noticed that there were some large gaps in our test coverage  
of ruleutils.c, according to the code coverage report.  This commit  
just adds a few test cases to improve coverage of:  
get_name_for_var_field()  
get_update_query_targetlist_def()  
isSimpleNode()  
get_sublink_expr()  

M src/test/regress/expected/create_view.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/rules.sql

Fix comments in execGrouping.c

commit   : 30d47723fd151641e89d18ce775f1a102ff07ae2    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 6 Dec 2019 11:47:59 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 6 Dec 2019 11:47:59 -0800    

Click here for diff

Commit 5dfc1981 missed updating some comments.  
  
Also, fix a comment typo found in passing.  
  
Author: Jeff Davis  
Discussion: https://postgr.es/m/9723131d247b919f94699152647fa87ee0bc02c2.camel%40j-davis.com  

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

Disallow non-default collation in ADD PRIMARY KEY/UNIQUE USING INDEX.

commit   : fbbf68094c5ff3d513969d072126c92932e484da    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Dec 2019 11:25:09 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Dec 2019 11:25:09 -0500    

Click here for diff

When creating a uniqueness constraint using a pre-existing index,  
we have always required that the index have the same properties you'd  
get if you just let a new index get built.  However, when collations  
were added, we forgot to add the index's collation to that check.  
  
It's hard to trip over this without intentionally trying to break it:  
you'd have to explicitly specify a different collation in CREATE  
INDEX, then convert it to a pkey or unique constraint.  Still, if you  
did that, pg_dump would emit a script that fails to reproduce the  
index's collation.  The main practical problem is that after a  
pg_upgrade the index would be corrupt, because its actual physical  
order wouldn't match what pg_index says.  A more theoretical issue,  
which is new as of v12, is that if you create the index with a  
nondeterministic collation then it wouldn't be enforcing the normal  
notion of uniqueness, causing the constraint to mean something  
different from a normally-created constraint.  
  
To fix, just add collation to the conditions checked for index  
acceptability in ADD PRIMARY KEY/UNIQUE USING INDEX.  We won't try  
to clean up after anybody who's already created such a situation;  
it seems improbable enough to not be worth the effort involved.  
(If you do get into trouble, a REINDEX should be enough to fix it.)  
  
In principle this is a long-standing bug, but I chose not to  
back-patch --- the odds of causing trouble seem about as great  
as the odds of preventing it, and both risks are very low anyway.  
  
Per report from Alexey Bashtanov, though this is not his preferred  
fix.  
  
Discussion: https://postgr.es/m/b05ce36a-cefb-ca5e-b386-a400535b1c0b@imap.cc  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix handling of OpenSSL's SSL_clear_options

commit   : 7d0bcb04771764aa3023e5a5089459d40dbd5e65    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Dec 2019 15:13:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Dec 2019 15:13:55 +0900    

Click here for diff

This function is supported down to OpenSSL 0.9.8, which is the oldest  
version supported since 593d4e4 (from Postgres 10 onwards), and is used  
since e3bdb2d (from 11 onwards).  It is defined as a macro from OpenSSL  
0.9.8 to 1.0.2, and as a function in 1.1.0 and newer versions.  However,  
the configure check present is only adapted for functions.  So, even if  
the code would be able to compile, configure fails to detect the macro,  
causing it to be ignored when compiling the code with OpenSSL from 0.9.8  
to 1.0.2.  
  
The code needs a configure check as per a364dfa, which has fixed a  
compilation issue with a past version of LibreSSL in NetBSD 5.1.  On  
HEAD, just remove the configure check as the last release of NetBSD 5 is  
from 2014 (and we have no more buildfarm members for it).  In 11 and 12,  
improve the configure logic so as both macros and functions are  
correctly detected.  This makes NetBSD 5 still work on already-released  
branches, but not for 13 onwards.  
  
The patch for HEAD is from me, and Daniel has written the version to use  
for the back-branches.  
  
Author: Michael Paquier, Daniel Gustaffson  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20191205083252.GE5064@paquier.xyz  
Discussion: https://postgr.es/m/98F7F99E-1129-41D8-B86B-FE3B1E286881@yesql.se  
Backpatch-through: 11  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/libpq/fe-secure-openssl.c

Improve some comments in pg_upgrade.c

commit   : 690c880269bf08dfb3f5bffb02be67e7e2a6c0f3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Dec 2019 11:55:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Dec 2019 11:55:04 +0900    

Click here for diff

When restoring database schemas on a new cluster, database "template1"  
is processed first, followed by all other databases in parallel,  
including "postgres".  Both "postgres" and "template1" have some extra  
handling to propagate each one's properties, but comments were confusing  
regarding which one is processed where.  
  
Author: Julien Rouhaud  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAOBaU_a2iviTG7FE10yO_gcW+zQCHNFhRA_NDiktf3UR65BHdw@mail.gmail.com  

M src/bin/pg_upgrade/pg_upgrade.c

Remove configure check for OpenSSL's SSL_get_current_compression()

commit   : 28f4bba66b572d6b3b8dc4fcf4e585821e0a5363    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Dec 2019 09:41:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Dec 2019 09:41:32 +0900    

Click here for diff

This function has been added in OpenSSL 0.9.8, which is the oldest  
version supported on HEAD, so checking for it at configure time is  
useless.  Both the frontend and backend code did not even bother to use  
it.  
  
Reported-by: Daniel Gustafsson  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/20191205083252.GE5064@paquier.xyz  
Discussion: https://postgr.es/m/98F7F99E-1129-41D8-B86B-FE3B1E286881@yesql.se  

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

pg_basebackup: Refactor code for reading COPY and tar data.

commit   : 431ba7bebf139b6edf5544ce18f39a1a4dcb8110    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 5 Dec 2019 15:14:09 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 5 Dec 2019 15:14:09 -0500    

Click here for diff

Add a new function ReceiveCopyData that does just that, taking a  
callback as an argument to specify what should be done with each chunk  
as it is received. This allows a single copy of the logic to be shared  
between ReceiveTarFile and ReceiveAndUnpackTarFile, and eliminates  
a few #ifdef conditions based on HAVE_LIBZ.  
  
While this is slightly more code, it's arguably clearer, and  
there is a pending patch that introduces additional calls to  
ReceiveCopyData.  
  
This commit is not intended to result in any functional change.  
  
Discussion: http://postgr.es/m/CA+TgmoYZDTHbSpwZtW=JDgAhwVAYvmdSrRUjOd+AYdfNNXVBDg@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Minor comment improvements for instrumentation.h

commit   : 42f362967d9f82043608610c689c24046e07497c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 5 Dec 2019 07:53:12 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 5 Dec 2019 07:53:12 -0500    

Click here for diff

Remove a duplicated word. Add "of" or "# of" in a couple places  
for clarity and consistency. Start comments with a lower case  
letter as we do elsewhere in this file.  
  
Rafia Sabih  

M src/include/executor/instrument.h

Blind attempt at fixing ecpg/compatlib's build

commit   : 9a798234963cd1f746ded41453392c257a4f9fdd    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 4 Dec 2019 20:15:11 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 4 Dec 2019 20:15:11 -0300    

Click here for diff

It now needs libpgcommon in order to get pnstrdup.  
  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Offer pnstrdup to frontend code

commit   : 0b9466fce2cf4f8c32b3a9170ca272829aa11e66    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 4 Dec 2019 19:36:06 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 4 Dec 2019 19:36:06 -0300    

Click here for diff

We already had it on the backend.  Frontend can also use it now.  
  
Discussion: https://postgr.es/m/20191204144021.GA17976@alvherre.pgsql  

M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/prompt.c
M src/bin/scripts/common.c
M src/common/fe_memutils.c
M src/include/common/fe_memutils.h
M src/interfaces/ecpg/compatlib/informix.c

Update minimum SSL version

commit   : b1abfec825472434ea445b9700eaa80cde9da86a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 Dec 2019 21:40:17 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 Dec 2019 21:40:17 +0100    

Click here for diff

Change default of ssl_min_protocol_version to TLSv1.2 (from TLSv1,  
which means 1.0).  Older versions are still supported, just not by  
default.  
  
TLS 1.0 is widely deprecated, and TLS 1.1 only slightly less so.  All  
OpenSSL versions that support TLS 1.1 also support TLS 1.2, so there  
would be very little reason to, say, set the default to TLS 1.1  
instead on grounds of better compatibility.  
  
The test suite overrides this new setting, so it can still run with  
older OpenSSL versions.  
  
Discussion: https://www.postgresql.org/message-id/flat/b327f8df-da98-054d-0cc5-b76a857cfed9%402ndquadrant.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/ssl/t/SSLServer.pm

Fix whitespace.

commit   : 4af77aa797d95f9f77d7b88a41b4e02bc62d8975    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 4 Dec 2019 12:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 4 Dec 2019 12:45:00 +0900    

Click here for diff

M src/backend/executor/nodeModifyTable.c

Use carriage returns for data insertion logs in pgbench on terminal

commit   : d37ddb745be07502814635585cbf935363c8a33d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Dec 2019 11:33:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Dec 2019 11:33:14 +0900    

Click here for diff

This is similar to what pg_basebackup and pg_rewind do when reporting  
cumulative data, and that's more user-friendly.  Carriage returns are  
now used when stderr points to a terminal, and newlines are used in  
other cases, like a redirection to a log file.  
  
Author: Amit Langote  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/CA+HiwqFNwEjPeVaQsp2L7DyCPv1Eg1guwhrVhzMYqUJUk8ULKg@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Remove unnecessary definition of CancelRequested in bin/scripts/

commit   : 85b9ef5fe7533e5d07dcf2a2b67c8855a34e5125    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Dec 2019 10:06:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Dec 2019 10:06:45 +0900    

Click here for diff

This variable is now part of the refactored code for query cancellation  
in fe_utils.  This fixes an oversight in commit a4fd3aa.  While on it,  
improve some header includes in bin/scripts/.  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/20191203101625.GF1634@paquier.xyz  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
M src/bin/scripts/scripts_parallel.c
M src/bin/scripts/vacuumdb.c

Ensure maxlen is at leat 1 in dict_int

commit   : b5273943679d22f58f1e1e269ad75e791172f557    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 3 Dec 2019 16:55:51 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 3 Dec 2019 16:55:51 +0100    

Click here for diff

The dict_int text search dictionary template accepts maxlen parameter,  
which is then used to cap the length of input strings. The value was  
not properly checked, and the code simply does  
  
    txt[d->maxlen] = '\0';  
  
to insert a terminator, leading to segfaults with negative values.  
  
This commit simply rejects values less than 1. The issue was there since  
dct_int was introduced in 9.3, so backpatch all the way back to 9.4  
which is the oldest supported version.  
  
Reported-by: cili  
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org  
Backpatch-through: 9.4  

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

Further sync postgres_fdw's "Relations" output with the rest of EXPLAIN.

commit   : bf39b3af6a9c6a036aae0742cf339fce662eee3a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 3 Dec 2019 12:25:56 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 3 Dec 2019 12:25:56 -0500    

Click here for diff

EXPLAIN generally only adds schema qualifications to table names when  
VERBOSE is specified.  In postgres_fdw's "Relations" output, table  
names were always so qualified, but that was an implementation  
restriction: in the original coding, we didn't have access to the  
verbose flag at the time the string was generated.  After the code  
rearrangement of commit 4526951d5, we do have that info available  
at the right time, so make this output follow the normal rule.  
  
Discussion: https://postgr.es/m/12424.1575168015@sss.pgh.pa.us  

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

Fix thinkos from commit 9989d37

commit   : 68ab982906187fba3530a01b01eb065ea9134298    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Dec 2019 18:59:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Dec 2019 18:59:09 +0900    

Click here for diff

Error messages referring to incorrect WAL segment names could have been  
generated for a fsync() failure or when creating a new segment at the  
end of recovery.  

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

Fix alter_system_table test

commit   : 88d45ac752ae49dbfafeb163b07381d3b8a6b601    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Dec 2019 09:14:35 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Dec 2019 09:14:35 +0100    

Click here for diff

Add workaround for disabling ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS  
warning for the test that tries to create a tablespace with a reserved  
name.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1iacW7-0003h6-6U%40gemulon.postgresql.org  

M src/test/modules/unsafe_tests/expected/alter_system_table.out
M src/test/modules/unsafe_tests/sql/alter_system_table.sql

Remove XLogFileNameP() from the tree

commit   : 9989d37d1c8dff12f20a1de8e1f470093136c893    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Dec 2019 15:06:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Dec 2019 15:06:04 +0900    

Click here for diff

XLogFileNameP() is a wrapper routine able to build a palloc'd string for  
a WAL segment name, which is used for error string generation.  There  
were several code paths where it gets called in a critical section,  
where memory allocation is not allowed.  This results in triggering  
an assertion failure instead of generating the wanted error message.  
  
Another, more annoying, problem is that if the allocation to generate  
the WAL segment name fails on OOM, then the failure would be escalated  
to a PANIC.  
  
This removes the routine and all its callers are replaced with a logic  
using a fixed-size buffer.  This way, all the existing mistakes are  
fixed and future ones are prevented.  
  
Author: Masahiko Sawada  
Reviewed-by: Michael Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/CA+fd4k5gC9H4uoWMLg9K_QfNrnkkdEw+-AFveob9YX7z8JnKTA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h

Fix failures with TAP tests of pg_ctl on Windows

commit   : e5532f194c18e6c12c3aa9cb07291973dc8adb39    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Dec 2019 13:01:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Dec 2019 13:01:06 +0900    

Click here for diff

On Windows, all the hosts spawned by the TAP tests bind to 127.0.0.1.  
Hence, if there is a port conflict, starting a cluster would immediately  
fail.  One of the test scripts of pg_ctl initializes a node without  
PostgresNode.pm, using the default port 5432.  This could cause  
unexpected startup failures in the tests if an independent server was up  
and running on the same host (the reverse is also possible, though more  
unlikely).  Fix this issue by assigning properly a free port to the node  
configured, in the same range used as for the other nodes part of the  
tests.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/20191202031444.GC1696@paquier.xyz  
Backpatch-through: 11  

M src/bin/pg_ctl/t/001_start_stop.pl

Fix EXPLAIN's column alias output for mismatched child tables.

commit   : 55a1954da16e041f895e5c3a6abff13c5e3a4a2f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Dec 2019 19:08:10 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Dec 2019 19:08:10 -0500    

Click here for diff

If an inheritance/partitioning parent table is assigned some column  
alias names in the query, EXPLAIN mapped those aliases onto the  
child tables' columns by physical position, resulting in bogus output  
if a child table's columns aren't one-for-one with the parent's.  
  
To fix, make expand_single_inheritance_child() generate a correctly  
re-mapped column alias list, rather than just copying the parent  
RTE's alias node.  (We have to fill the alias field, not just  
adjust the eref field, because ruleutils.c will ignore eref in  
favor of looking at the real column names.)  
  
This means that child tables will now always have alias fields in  
plan rtables, where before they might not have.  That results in  
a rather substantial set of regression test output changes:  
EXPLAIN will now always show child tables with aliases that match  
the parent table (usually with "_N" appended for uniqueness).  
But that seems like a net positive for understandability, since  
the parent alias corresponds to something that actually appeared  
in the original query, while the child table names didn't.  
(Note that this does not change anything for cases where an explicit  
table alias was written in the query for the parent table; it  
just makes cases without such aliases behave similarly to that.)  
Hence, while we could avoid these subsidiary changes if we made  
inherit.c more complicated, we choose not to.  
  
Discussion: https://postgr.es/m/12424.1575168015@sss.pgh.pa.us  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/util/inherit.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/union.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/update.out
M src/test/regress/expected/with.out
M src/test/regress/sql/partition_prune.sql

Add a reverse-translation column number array to struct AppendRelInfo.

commit   : ce76c0ba53e4bd0daf3db7a703671b27797b7244    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Dec 2019 18:05:29 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Dec 2019 18:05:29 -0500    

Click here for diff

This provides for cheaper mapping of child columns back to parent  
columns.  The one existing use-case in examine_simple_variable()  
would hardly justify this by itself; but an upcoming bug fix will  
make use of this array in a mainstream code path, and it seems  
likely that we'll find other uses for it as we continue to build  
out the partitioning infrastructure.  
  
Discussion: https://postgr.es/m/12424.1575168015@sss.pgh.pa.us  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pathnodes.h

Make postgres_fdw's "Relations" output agree with the rest of EXPLAIN.

commit   : 4526951d564a7eed512b4a0ac3b5893e0a115690    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Dec 2019 16:31:03 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Dec 2019 16:31:03 -0500    

Click here for diff

The relation aliases shown in the "Relations" line for a foreign scan  
didn't always agree with those used in the rest of EXPLAIN's output.  
The regression test result changes appearing here provide examples.  
  
It's really impossible for postgres_fdw to duplicate EXPLAIN's alias  
assignment logic during postgresGetForeignRelSize(), because of the  
de-duplication that EXPLAIN does on a global basis --- and anyway,  
trying to duplicate that would be unmaintainable.  Instead, just put  
numeric rangetable indexes into the string, and convert those to  
table names/aliases in postgresExplainForeignScan, which does have  
access to the results of ruleutils.c's alias assignment logic.  
Aside from being more reliable, this shifts some work from planning  
to EXPLAIN, which is a good tradeoff for performance.  (I also  
changed from using StringInfo to using psprintf, which makes the  
code slightly simpler and reduces its memory consumption.)  
  
A kluge required by this solution is that we have to reverse-engineer  
the rtoffset applied by setrefs.c.  If that logic ever fails  
(presumably because the member tables of a join got offset by  
different amounts), we'll need some more cooperation with setrefs.c  
to keep things straight.  But for now, there's no need for that.  
  
Arguably this is a back-patchable bug fix, but since this is a mostly  
cosmetic issue and there have been no field complaints, I'll refrain  
for now.  
  
Discussion: https://postgr.es/m/12424.1575168015@sss.pgh.pa.us  

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

Add query cancellation capabilities in pgbench init phase

commit   : 1d468b9ad81b9139b4a0b16b416c3597925af4b0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Dec 2019 11:42:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Dec 2019 11:42:28 +0900    

Click here for diff

This can be useful to stop data generation happening on the server for  
long-running queries caused by large scale factors.  This cannot happen  
by default as data is generated on the client, but it is possible to  
control the initialization steps of pgbench to do that.  
  
Reported-by: Fujii Masao  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1910311939430.27369@lancre  
Discussion: https://postgr.es/m/CAHGQGwHWEyTXxZh46qgFY8a2bDF_EYeUdp3+_Hy=qLZSzwVPKg@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Refactor query cancellation code into src/fe_utils/

commit   : a4fd3aa719e8f97299dfcf1a8f79b3017e2b8d8b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Dec 2019 11:18:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Dec 2019 11:18:56 +0900    

Click here for diff

Originally, this code was duplicated in src/bin/psql/ and  
src/bin/scripts/, but it can be useful for other frontend applications,  
like pgbench.  This refactoring offers the possibility to setup a custom  
callback which would get called in the signal handler for SIGINT or when  
the interruption console events happen on Windows.  
  
Author: Fabien Coelho, with contributions from Michael Paquier  
Reviewed-by: Álvaro Herrera, Ibrar Ahmed  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1910311939430.27369@lancre  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/large_obj.c
M src/bin/psql/startup.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/Makefile
A src/fe_utils/cancel.c
A src/include/fe_utils/cancel.h
M src/tools/msvc/Mkvcbuild.pm

Add dummy versions of new SSL functions for non-SSL builds

commit   : c01ac6dcba0aa65ad237c3af4a67bc70da8e4b0e    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 1 Dec 2019 17:49:43 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 1 Dec 2019 17:49:43 -0500    

Click here for diff

This rectifies an oversight in commit 4dc6355210, which caused certain  
builds to fail, especially on Windows.  

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

Fix misbehavior with expression indexes on ON COMMIT DELETE ROWS tables.

commit   : c35b714caff008c875b484656de7d168a7bc45f9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 1 Dec 2019 13:09:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 1 Dec 2019 13:09:26 -0500    

Click here for diff

We implement ON COMMIT DELETE ROWS by truncating tables marked that  
way, which requires also truncating/rebuilding their indexes.  But  
RelationTruncateIndexes asks the relcache for up-to-date copies of any  
index expressions, which may cause execution of eval_const_expressions  
on them, which can result in actual execution of subexpressions.  
This is a bad thing to have happening during ON COMMIT.  Manuel Rigger  
reported that use of a SQL function resulted in crashes due to  
expectations that ActiveSnapshot would be set, which it isn't.  
The most obvious fix perhaps would be to push a snapshot during  
PreCommit_on_commit_actions, but I think that would just open the door  
to more problems: CommitTransaction explicitly expects that no  
user-defined code can be running at this point.  
  
Fortunately, since we know that no tuples exist to be indexed, there  
seems no need to use the real index expressions or predicates during  
RelationTruncateIndexes.  We can set up dummy index expressions  
instead (we do need something that will expose the right data type,  
as there are places that build index tupdescs based on this), and  
just ignore predicates and exclusion constraints.  
  
In a green field it'd likely be better to reimplement ON COMMIT DELETE  
ROWS using the same "init fork" infrastructure used for unlogged  
relations.  That seems impractical without catalog changes though,  
and even without that it'd be too big a change to back-patch.  
So for now do it like this.  
  
Per private report from Manuel Rigger.  This has been broken forever,  
so back-patch to all supported branches.  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/index.h
M src/include/utils/relcache.h
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

libq support for sslpassword connection param, DER format keys

commit   : 4dc63552109f65cebbe168203bd62c5e4c753162    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 30 Nov 2019 15:27:13 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 30 Nov 2019 15:27:13 -0500    

Click here for diff

This patch providies for support for password protected SSL client  
keys in libpq, and for DER format keys, both encrypted and unencrypted.  
There is a new connection parameter sslpassword, which is supplied to  
the OpenSSL libraries via a callback function. The callback function can  
also be set by an application by calling PQgetSSLKeyPassHook(). There is  
also a function to retreive the connection setting, PQsslpassword().  
  
Craig Ringer and Andrew Dunstan  
  
Reviewed by: Greg Nancarrow  
  
Discussion: https://postgr.es/m/f7ee88ed-95c4-95c1-d4bf-7b415363ab62@2ndQuadrant.com  

M contrib/dblink/expected/dblink.out
M doc/src/sgml/libpq.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/Makefile
A src/test/ssl/ssl/client-der.key
A src/test/ssl/ssl/client-encrypted-der.key
A src/test/ssl/ssl/client-encrypted-pem.key
M src/test/ssl/t/001_ssltests.pl

Fix off-by-one error in PGTYPEStimestamp_fmt_asc

commit   : 3ff660bbeb96086cb1cf880bfb4e2e350cbd21b2    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 30 Nov 2019 14:51:27 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 30 Nov 2019 14:51:27 +0100    

Click here for diff

When using %b or %B patterns to format a date, the code was simply using  
tm_mon as an index into array of month names. But that is wrong, because  
tm_mon is 1-based, while array indexes are 0-based. The result is we  
either use name of the next month, or a segfault (for December).  
  
Fix by subtracting 1 from tm_mon for both patterns, and add a regression  
test triggering the issue. Backpatch to all supported versions (the bug  
is there far longer, since at least 2003).  
  
Reported-by: Paul Spencer  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/16143-0d861eb8688d3fef%40postgresql.org  

M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout
M src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc

Revert commits 290acac92b and 8a7e9e9dad.

commit   : 98a9b37ba70f24b28478360d9cf7f190b0f75f8d    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 30 Nov 2019 07:43:42 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 30 Nov 2019 07:43:42 +0530    

Click here for diff

This commit revert the commits to add a test case that tests the 'force'  
option when there is an active backend connected to the database being  
dropped.  
  
This feature internally sends SIGTERM to all the backends connected to the  
database being dropped and then the same is reported to the client.  We  
found that on Windows, the client end of the socket is not able to read  
the data once we close the socket in the server which leads to loss of  
error message which is not what we expect.  We also observed  similar  
behavior in other cases like pg_terminate_backend(),  
pg_ctl kill TERM <pid>.  There are probably a few others like that.  The  
fix for this requires further study.  
  
Discussion: https://postgr.es/m/E1iaD8h-0004us-K9@gemulon.postgresql.org  

M src/bin/scripts/t/050_dropdb.pl
D src/bin/scripts/t/051_dropdb_force.pl
M src/test/perl/TestLib.pm
M src/test/recovery/t/013_crash_restart.pl

Small code simplification

commit   : e6c2d17c5367ddcd900450c6a857dac8630da0ca    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:55:31 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:55:31 +0100    

Click here for diff

FLOAT8PASSBYVAL can be used instead of USE_FLOAT8_BYVAL here.  

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

Add a regression test for allow_system_table_mods

commit   : 7fc380f83d466b43a8f65bb52c925c1ab19736ea    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    

Click here for diff

Add a regression test file that exercises the kinds of commands that  
allow_system_table_mods allows.  
  
This is put in the "unsafe_tests" suite, so it won't accidentally  
create a mess if someone runs the normal regression tests against an  
instance that they care about.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com  

M src/test/modules/unsafe_tests/Makefile
A src/test/modules/unsafe_tests/expected/alter_system_table.out
A src/test/modules/unsafe_tests/sql/alter_system_table.sql
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Make allow_system_table_mods settable at run time

commit   : c4a7a392ec8f0ff7701d84768080721ff8a7782e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    

Click here for diff

Make allow_system_table_mods settable at run time by superusers.  It  
was previously postmaster start only.  
  
We don't want to make system catalog DDL wide-open, but there are  
occasionally useful things to do like setting reloptions or statistics  
on a busy system table, and blocking those doesn't help anyone.  Also,  
this enables the possibility of writing a test suite for this setting.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com  

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

Remove any-user DML capability from allow_system_table_mods

commit   : 508bf95b767140ec1a339bcb53538d21deb9d995    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    

Click here for diff

Previously, allow_system_table_mods allowed a non-superuser to do DML  
on a system table without further permission checks.  This has been  
removed, as it was quite inconsistent with the rest of the meaning of  
this setting.  (Since allow_system_table_mods was previously only  
accessible with a server restart, it is unlikely that anyone was using  
this possibility.)  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com  

M src/backend/catalog/aclchk.c

Add error position to an error message

commit   : d4feadeca1591fd5fe91bdf73a7897553f5366d7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 09:10:17 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 29 Nov 2019 09:10:17 +0100    

Click here for diff

Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/6e7aa4a1-be6a-1a75-b1f9-83a678e5184a@2ndquadrant.com  

M src/backend/commands/prepare.c
M src/test/regress/expected/prepare.out

Use memcpy instead of a byte loop in pglz_decompress

commit   : c60e520f6e0e8db9618cad042df071a6752f3c06    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 28 Nov 2019 23:29:30 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 28 Nov 2019 23:29:30 +0100    

Click here for diff

The byte loop used in pglz_decompress() because of possible overlap may  
be quite inefficient, so this commit replaces it with memcpy. The gains  
do depend on the data (compressibility) and hardware, but seem to be  
quite significant.  
  
Author: Andrey Borodin  
Reviewed-by: Michael Paquier, Konstantin Knizhnik, Tels  
Discussion: https://postgr.es/m/469C9ED9-348C-4FE7-A7A7-B0FA671BEE4C@yandex-team.ru  

M src/common/pg_lzcompress.c

Remove unnecessary clauses_attnums variable

commit   : 6d61c3f1cb7134c3ad80d29e216563571cc43de2    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 28 Nov 2019 23:25:14 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 28 Nov 2019 23:25:14 +0100    

Click here for diff

Commit c676e659b2 reworked how choose_best_statistics() picks the best  
extended statistics, but failed to remove clauses_attnums which is now  
unnecessary. So get rid of it and backpatch to 12, same as c676e659b2.  
  
Author: Tomas Vondra  
Discussion: https://postgr.es/m/CA+u7OA7H5rcE2=8f263w4NZD6ipO_XOrYB816nuLXbmSTH9pQQ@mail.gmail.com  
Backpatch-through: 12  

M src/backend/statistics/extended_stats.c

Fix choose_best_statistics to check clauses individually

commit   : c676e659b246f94d571b57b559f80cb2dc03e73b    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 28 Nov 2019 22:20:28 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 28 Nov 2019 22:20:28 +0100    

Click here for diff

When picking the best extended statistics object for a list of clauses,  
it's not enough to look at attnums extracted from the clause list as a  
whole. Consider for example this query with OR clauses:  
  
   SELECT * FROM t WHERE (t.a = 1) OR (t.b = 1) OR (t.c = 1)  
  
with a statistics defined on columns (a,b). Relying on attnums extracted  
from the whole OR clause, we'd consider the statistics usable. That does  
not work, as we see the conditions as a single OR-clause, referencing an  
attribute not covered by the statistic, leading to empty list of clauses  
to be estimated using the statistics and an assert failure.  
  
This changes choose_best_statistics to check which clauses are actually  
covered, and only using attributes from the fully covered ones. For the  
previous example this means the statistics object will not be considered  
as compatible with the OR-clause.  
  
Backpatch to 12, where MCVs were introduced. The issue does not affect  
older versions because functional dependencies don't handle OR clauses.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed  
Reported-By: Manuel Rigger  
Discussion: https://postgr.es/m/CA+u7OA7H5rcE2=8f263w4NZD6ipO_XOrYB816nuLXbmSTH9pQQ@mail.gmail.com  
Backpatch-through: 12  

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

Remove useless "return;" lines

commit   : 3974c4a72459fc07acef3ee1369d63a7b8305b62    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 28 Nov 2019 16:48:37 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 28 Nov 2019 16:48:37 -0300    

Click here for diff

Discussion: https://postgr.es/m/20191128144653.GA27883@alvherre.pgsql  

M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_standby/pg_standby.c
M contrib/pgcrypto/mbuf.c
M contrib/seg/seg.c
M contrib/sepgsql/selinux.c
M src/backend/access/gist/gist.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/datetime.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/compress_io.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_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/psql/common.c
M src/fe_utils/print.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/libpq/fe-auth-scram.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/port/win32error.c
M src/test/examples/testlo.c
M src/test/examples/testlo64.c

Add tests for '-f' option in dropdb utility.

commit   : 8a7e9e9dad56419ff987e5f6baaf411a03c1951a    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 28 Nov 2019 11:46:57 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 28 Nov 2019 11:46:57 +0530    

Click here for diff

This will test that the force option works when there is an active backend  
connected to the database being dropped.  
  
Author: Pavel Stehule and Vignesh C  
Reviewed-by: Amit Kapila and Vignesh C  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M src/bin/scripts/t/050_dropdb.pl
A src/bin/scripts/t/051_dropdb_force.pl

Move pump_until to TestLib.pm.

commit   : 290acac92b1d7bebb4ec68fe8b7a5cb442333eda    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 28 Nov 2019 08:28:17 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 28 Nov 2019 08:28:17 +0530    

Click here for diff

The subroutine pump_until provides the functionality to poll until the  
given string is matched, or a timeout occurs.  This can be used from other  
places as well, so moving it to TestLib.pm.  The immediate need is for an  
upcoming regression test patch for dropdb utility.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M src/test/perl/TestLib.pm
M src/test/recovery/t/013_crash_restart.pl

pg_upgrade: adjust error paragraph width to be consistent

commit   : 60b35b7f1ea1d5cd17805e30299fd21616855b7d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 27 Nov 2019 20:36:33 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 27 Nov 2019 20:36:33 -0500    

Click here for diff

Previously these error paragraphs were too wide.  
  
Backpatch-through: 13  

M src/bin/pg_upgrade/check.c

pg_upgrade: improve instructions for fixing incompatible isn use

commit   : f0b57aec1d41f89611efac4d6938a725b056ed00    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 27 Nov 2019 20:24:57 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 27 Nov 2019 20:24:57 -0500    

Click here for diff

This clarifies instructions on how to dump/reload databases that use  
incompatible isn versions.  
  
Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/20191114190652.GA23586@alvherre.pgsql  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
  
Backpatch-through: 13  

M src/bin/pg_upgrade/check.c

Don't use native methods in TestLib::slurp_file on Msys

commit   : f6f59826f01188aa9603983d00b0cd3496e9359d    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 27 Nov 2019 15:45:44 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 27 Nov 2019 15:45:44 -0500    

Click here for diff

Commit 114541d58e has upset some buildfarm members running Msys, that  
weren't previously having problems, so the use of native Windows methods  
to open files is restricted by this patch to only MSVC builds.  

M src/test/perl/TestLib.pm

Revert "Close stdin where it's not needed in TestLib.pm procedures"

commit   : ca266a069a20c32a8f0a1df982a5a67d9483bcb3    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 27 Nov 2019 07:19:22 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 27 Nov 2019 07:19:22 -0500    

Click here for diff

This reverts commits 9af34f3c6b and 792dba73c8.  
  
The code has been found not to be portable.  
  
Discussion: https://postgr.es/m/2658c496-f885-02db-13bb-228423782524@2ndQuadrant.com  

M src/test/perl/TestLib.pm

Move configure --disable-float8-byval to pg_config_manual.h

commit   : 4513d8b07bf342028ca95250b6e1d759858abdd3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 Nov 2019 11:21:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 Nov 2019 11:21:02 +0100    

Click here for diff

This build option was once useful to maintain compatibility with  
version-0 functions, but those are no longer supported, so this option  
is no longer useful for end users.  We keep the option available to  
developers in pg_config_manual.h so that it is easy to test the  
pass-by-reference code paths without having to fire up a 32-bit  
machine.  
  
Discussion: https://www.postgresql.org/message-id/flat/f3e1e576-2749-bbd7-2d57-3f9dcf75255a@2ndquadrant.com  

M configure
M configure.in
M doc/src/sgml/installation.sgml
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config_manual.h
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Fix typo in comment.

commit   : 47a3c7fa06538c181be815db44b5d7e8efe696ef    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 27 Nov 2019 16:00:45 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 27 Nov 2019 16:00:45 +0900    

Click here for diff

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

Fix closing stdin in TestLib.pm

commit   : 792dba73c8f30528e51c4967d3be8ec4bdc5234b    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 26 Nov 2019 16:23:00 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 26 Nov 2019 16:23:00 -0500    

Click here for diff

Commit 9af34f3c6b naively assumed that all non-windows platforms would  
have pseudoterminals and that perl would have IO::Pty. Such is not the  
case. Instead of assumung anything, test for the presence of IO::Pty and  
only use code that might depend on it if it's present. The test result is  
exposed in $TestLib::have_io_pty so that it can be conveniently used in  
SKIP tests.  
  
Discussion: https://postgr.es/m/20191126044110.GB5435@paquier.xyz  

M src/test/perl/TestLib.pm

Allow access to child table statistics if user can read parent table.

commit   : 553d2ec2710be5ae304c40134643c8f6d754af67    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 26 Nov 2019 14:41:48 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 26 Nov 2019 14:41:48 -0500    

Click here for diff

The fix for CVE-2017-7484 disallowed use of pg_statistic data for  
planning purposes if the user would not be able to select the associated  
column and a non-leakproof function is to be applied to the statistics  
values.  That turns out to disable use of pg_statistic data in some  
common cases involving inheritance/partitioning, where the user does  
have permission to select from the parent table that was actually named  
in the query, but not from a child table whose stats are needed.  Since,  
in non-corner cases, the user *can* select the child table's data via  
the parent, this restriction is not actually useful from a security  
standpoint.  Improve the logic so that we also check the permissions of  
the originally-named table, and allow access if select permission exists  
for that.  
  
When checking access to stats for a simple child column, we can map  
the child column number back to the parent, and perform this test  
exactly (including not allowing access if the child column isn't  
exposed by the parent).  For expression indexes, the current logic  
just insists on whole-table select access, and this patch allows  
access if the user can select the whole parent table.  In principle,  
if the child table has extra columns, this might allow access to  
stats on columns the user can't read.  In practice, it's unlikely  
that the planner is going to do any stats calculations involving  
expressions that are not visible to the query, so we'll ignore that  
fine point for now.  Perhaps someday we'll improve that logic to  
detect exactly which columns are used by an expression index ...  
but today is not that day.  
  
Back-patch to v11.  The issue was created in 9.2 and up by the  
CVE-2017-7484 fix, but this patch depends on the append_rel_array[]  
planner data structure which only exists in v11 and up.  In  
practice the issue is most urgent with partitioned tables, so  
fixing v11 and later should satisfy much of the practical need.  
  
Dilip Kumar and Amit Langote, with some kibitzing by me  
  
Discussion: https://postgr.es/m/3876.1531261875@sss.pgh.pa.us  

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

Add safeguards for pg_fsync() called with incorrectly-opened fds

commit   : 12198239c0a5122e29619d50f76f89adc5bc7ade    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 Nov 2019 13:32:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 Nov 2019 13:32:52 +0900    

Click here for diff

On some platforms, fsync() returns EBADFD when opening a file descriptor  
with O_RDONLY (read-only), leading ultimately now to a PANIC to prevent  
data corruption.  
  
This commit adds a new sanity check in pg_fsync() based on fcntl() to  
make sure that we don't repeat again mistakes with incorrectly-set file  
descriptors so as problems are detected at an early stage.  Without  
that, such errors could only be detected after running Postgres on a  
specific supported platform for the culprit code path, which could take  
some time before being found.  b8e19b93 was a fix for such a problem,  
which got undetected for more than 5 years, and a586cc4b fixed another  
similar issue.  
  
Note that the new check added works as well when fsync=off is  
configured, so as all regression tests would detect problems as long as  
assertions are enabled.  fcntl() being not available on Windows, the  
new checks do not happen there.  
  
Author: Michael Paquier  
Reviewed-by: Mark Dilger  
Discussion: https://postgr.es/m/20191009062640.GB21379@paquier.xyz  

M src/backend/storage/file/fd.c

Don't shut down Gather[Merge] early under Limit.

commit   : 080313f8296fb0bcc74bd70fc8e15cd64f45945e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 18 Nov 2019 14:17:41 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 18 Nov 2019 14:17:41 +0530    

Click here for diff

Revert part of commit 19df1702f5.  
  
Early shutdown was added by that commit so that we could collect  
statistics from workers, but unfortunately, it interacted badly with  
rescans.  The problem is that we ended up destroying the parallel context  
which is required for rescans.  This leads to rescans of a Limit node over  
a Gather node to produce unpredictable results as it tries to access  
destroyed parallel context.  By reverting the early shutdown code, we  
might lose statistics in some cases of Limit over Gather [Merge], but that  
will require further study to fix.  
  
Reported-by: Jerry Sievers  
Diagnosed-by: Thomas Munro  
Author: Amit Kapila, testcase by Vignesh C  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/87ims2amh6.fsf@jsievers.enova.com  

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

Use procsignal_sigusr1_handler for auxiliary processes.

commit   : 0d3c3aae3366891f1c3d6bac326070660be36f76    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 25 Nov 2019 16:08:53 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 25 Nov 2019 16:08:53 -0500    

Click here for diff

AuxiliaryProcessMain does ProcSignalInit, so one might expect that  
auxiliary processes would need to respond to SendProcSignal, but none  
of the auxiliary processes do that. Change them to use  
procsignal_sigusr1_handler instead of their own private handlers so  
that they do. Besides seeming more correct, this is also less code. It  
shouldn't make any functional difference right now because, as far as  
we know, there are no current cases where SendProcSignal targets an  
auxiliary process, but there are plans to change that in the future.  
  
Andres Freund  
  
Discussion: http://postgr.es/m/20181030051643.elbxjww5jjgnjaxg@alap3.anarazel.de  

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

Close stdin where it's not needed in TestLib.pm procedures

commit   : 9af34f3c6b02779fac6dbb6cd4c5bb225a019f43    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 25 Nov 2019 15:51:51 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 25 Nov 2019 15:51:51 -0500    

Click here for diff

Where possible, do this using a pseudoterminal, so that things like  
openssl that want to open /dev/tty if stdin isn't a tty won't.  
Elsewhere, i.e. Windows, just close by providing an empty string using  
the standard IPC::Run pipe mechanism.  
  
Patch by Andrew Dunstan, based on an idea from Craig Ringer.  
  
Reviewed by Mark Dilger.  
  
Discussion: https://postgr.es/m/873ebb57-fc98-340d-949d-691b1810bf66@2ndQuadrant.com  

M src/test/perl/TestLib.pm

Refactor WAL file-reading code into WALRead()

commit   : 0dc8ead46363fec6f621a12c7e1f889ba73b55a9    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Nov 2019 15:04:54 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Nov 2019 15:04:54 -0300    

Click here for diff

XLogReader, walsender and pg_waldump all had their own routines to read  
data from WAL files to memory, with slightly different approaches  
according to the particular conditions of each environment.  There's a  
lot of commonality, so we can refactor that into a single routine  
WALRead in XLogReader, and move the differences to a separate (simpler)  
callback that just opens the next WAL-segment.  This results in a  
clearer (ahem) code flow.  
  
The error reporting needs are covered by filling in a new error-info  
struct, WALReadError, and it's the caller's responsibility to act on it.  
The backend has WALReadRaiseError() to do so.  
  
We no longer ever need to seek in this interface; switch to using  
pg_pread().  
  
Author: Antonin Houska, with contributions from Álvaro Herrera  
Reviewed-by: Michaël Paquier, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/14984.1554998742@spoje.net  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walsender.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h

Fix unportable printf format introduced in commit 9290ad198.

commit   : 5883f5fe27d7b52c812dd0f8cbda67373a14c451    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 25 Nov 2019 10:48:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 25 Nov 2019 10:48:36 -0500    

Click here for diff

"%ld" is not an acceptable format spec for int64 variables, though  
it accidentally works on most non-Windows 64-bit platforms.  Follow  
the lead of commit 6a1cd8b92, and use "%lld" with an explicit cast  
to long long.  Per buildfarm.  

M src/backend/replication/walsender.c

Make the order of the header file includes consistent.

commit   : e0487223ecac9cbb7f673e4ff6d2e4086e591abf    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 25 Nov 2019 08:08:57 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 25 Nov 2019 08:08:57 +0530    

Click here for diff

Similar to commits 14aec03502, 7e735035f2 and dddf4cdc33, this commit  
makes the order of header file inclusion consistent in more places.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M contrib/bloom/bloom.h
M contrib/btree_gist/btree_gist.h
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.h
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/libpq/auth.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.h
M src/bin/psql/prompt.h
M src/bin/psql/settings.h
M src/bin/psql/tab-complete.c
M src/bin/scripts/common.h
M src/include/access/gin_private.h
M src/include/access/hio.h
M src/include/access/htup_details.h
M src/include/access/relation.h
M src/include/access/table.h
M src/include/access/twophase.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.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_replication_origin.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_type.h
M src/include/commands/event_trigger.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/tuptable.h
M src/include/funcapi.h
M src/include/jit/llvmjit.h
M src/include/nodes/execnodes.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/walreceiver.h
M src/include/rewrite/rewriteHandler.h
M src/include/statistics/extended_stats_internal.h
M src/include/storage/buf_internals.h
M src/include/storage/condition_variable.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/standby.h
M src/include/tsearch/ts_locale.h
M src/include/utils/date.h
M src/include/utils/jsonpath.h
M src/include/utils/pg_lsn.h
M src/include/utils/xml.h
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/plpy_subxactobject.c
M src/pl/plpython/plpy_subxactobject.h
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c

Fix inconsistent variable name in static function of mac8.c

commit   : 2aa84520b3508dda273b9bbffab7bf87f0d98bf8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 25 Nov 2019 09:57:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 25 Nov 2019 09:57:35 +0900    

Click here for diff

Both argument names were reversed in the declaration of the function.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/MN2PR18MB292755AEFF9A9144B220ABEEE34B0@MN2PR18MB2927.namprd18.prod.outlook.com  

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

Refactor reloption handling for index AMs in-core

commit   : 4cb658af70027c3544fb843d77b2e84028762747    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 25 Nov 2019 09:40:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 25 Nov 2019 09:40:53 +0900    

Click here for diff

This reworks the reloption parsing and build of a couple of index AMs by  
creating new structures for each index AM's options.  This split was  
already done for BRIN, GIN and GiST (which actually has a fillfactor  
parameter), but not for hash, B-tree and SPGiST which relied on  
StdRdOptions due to an overlap with the default option set.  
  
This saves a couple of bytes for rd_options in each relcache entry with  
indexes making use of relation options, and brings more consistency  
between all index AMs.  While on it, add a couple of AssertMacro() calls  
to make sure that utility macros to grab values of reloptions are used  
with the expected index AM.  
  
Author: Nikolay Shaplov  
Reviewed-by: Amit Langote, Michael Paquier, Álvaro Herrera, Dent John  
Discussion: https://postgr.es/m/4127670.gFlpRb6XCm@x200m  

M src/backend/access/common/reloptions.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashutil.c
M src/backend/access/nbtree/nbtree.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/spgist/spgutils.c
M src/include/access/brin.h
M src/include/access/gin_private.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/utils/rel.h
M src/tools/pgindent/typedefs.list

Use native methods to open input in TestLib::slurp_file on Windows.

commit   : 114541d58e5970e51b78b77b65de16210beaab43    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 24 Nov 2019 18:25:22 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 24 Nov 2019 18:25:22 -0500    

Click here for diff

It is hoped that this will avoid some errors that we have seen before,  
but lately with greater frequency, in buildfarm animals.  
  
For now apply only to master. If this proves effective it can be  
backpatched.  
  
Discussion: https://postgr.es/m/13900.1572839580@sss.pgh.pa.us  
  
Author: Juan José Santamaría Flecha  

M src/test/perl/TestLib.pm

Doc: improve discussion of race conditions involved in LISTEN.

commit   : d3aa114ac4de9ecc558ba77ed5c85e2ad9ad01d4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 18:03:39 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 18:03:39 -0500    

Click here for diff

The user docs didn't really explain how to use LISTEN safely,  
so clarify that.  Also clean up some fuzzy-headed explanations  
in comments.  No code changes.  
  
Discussion: https://postgr.es/m/3ac7f397-4d5f-be8e-f354-440020675694@gmail.com  

M doc/src/sgml/ref/listen.sgml
M src/backend/commands/async.c

Avoid assertion failure with LISTEN in a serializable transaction.

commit   : 6b802cfc7fab0f38001ae465ccd4f7f565b6169d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 15:57:31 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 15:57:31 -0500    

Click here for diff

If LISTEN is the only action in a serializable-mode transaction,  
and the session was not previously listening, and the notify queue  
is not empty, predicate.c reported an assertion failure.  That  
happened because we'd acquire the transaction's initial snapshot  
during PreCommit_Notify, which was called *after* predicate.c  
expects any such snapshot to have been established.  
  
To fix, just swap the order of the PreCommit_Notify and  
PreCommit_CheckForSerializationFailure calls during CommitTransaction.  
This will imply holding the notify-insertion lock slightly longer,  
but the difference could only be meaningful in serializable mode,  
which is an expensive option anyway.  
  
It appears that this is just an assertion failure, with no  
consequences in non-assert builds.  A snapshot used only to scan  
the notify queue could not have been involved in any serialization  
conflicts, so there would be nothing for  
PreCommit_CheckForSerializationFailure to do except assign it a  
prepareSeqNo and set the SXACT_FLAG_PREPARED flag.  And given no  
conflicts, neither of those omissions affect the behavior of  
ReleasePredicateLocks.  This admittedly once-over-lightly analysis  
is backed up by the lack of field reports of trouble.  
  
Per report from Mark Dilger.  The bug is old, so back-patch to all  
supported branches; but the new test case only goes back to 9.6,  
for lack of adequate isolationtester infrastructure before that.  
  
Discussion: https://postgr.es/m/3ac7f397-4d5f-be8e-f354-440020675694@gmail.com  
Discussion: https://postgr.es/m/13881.1574557302@sss.pgh.pa.us  

M src/backend/access/transam/xact.c
M src/test/isolation/expected/async-notify.out
M src/test/isolation/specs/async-notify.spec

doc: Fix whitespace in syntax.

commit   : 1974853d899db69a72361a9052fd699c9dcd028e    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 25 Nov 2019 09:20:28 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 25 Nov 2019 09:20:28 +1300    

Click here for diff

Back-patch to 10.  
  
Author: Andreas Karlsson  
Discussion: https://postgr.es/m/043acae2-a369-b7fa-be48-1933aa2e82d1%40proxel.se  

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

Stabilize NOTIFY behavior by transmitting notifies before ReadyForQuery.

commit   : 7900269724424b6deca516eba3dd8e4bf6621bea    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 14:42:59 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 14:42:59 -0500    

Click here for diff

This patch ensures that, if any notify messages were received during  
a just-finished transaction, they get sent to the frontend just before  
not just after the ReadyForQuery message.  With libpq and other client  
libraries that act similarly, this guarantees that the client will see  
the notify messages as available as soon as it thinks the transaction  
is done.  
  
This probably makes no difference in practice, since in realistic  
use-cases the application would have to cope with asynchronous  
arrival of notify events anyhow.  However, it makes it a lot easier  
to build cross-session-notify test cases with stable behavior.  
I'm a bit surprised now that we've not seen any buildfarm instability  
with the test cases added by commit b10f40bf0.  Tests that I intend  
to add in an upcoming bug fix are definitely unstable without this.  
  
Back-patch to 9.6, which is as far back as we can do NOTIFY testing  
with the isolationtester infrastructure.  
  
Discussion: https://postgr.es/m/13881.1574557302@sss.pgh.pa.us  

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

Stabilize the results of pg_notification_queue_usage().

commit   : 8b7ae5a82d04312672c919ecea3c30b1ec7faaf2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 14:09:33 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 14:09:33 -0500    

Click here for diff

This function wasn't touched in commit 51004c717, but that turns out  
to be a bad idea, because its results now include any dead space  
that exists in the NOTIFY queue on account of our being lazy about  
advancing the queue tail.  Notably, the isolation tests now fail  
if run twice without a server restart between, because async-notify's  
first test of the function will already show a positive value.  
It seems likely that end users would be equally unhappy about the  
result's instability.  To fix, just make the function call  
asyncQueueAdvanceTail before computing its result.  That should end  
in producing the same value as before, and it's hard to believe that  
there's any practical use-case where pg_notification_queue_usage()  
is called so often as to create a performance degradation, especially  
compared to what we did before.  
  
Out of paranoia, also mark this function parallel-restricted (it  
was volatile, but parallel-safe by default, before).  Although the  
code seems to work fine when run in a parallel worker, that's outside  
the design scope of async.c, and it's a bit scary to have intentional  
side-effects happening in a parallel worker.  There seems no plausible  
use-case where it'd be important to try to parallelize this, so let's  
not take any risk of introducing new bugs.  
  
In passing, re-pgindent async.c and run reformat-dat-files on  
pg_proc.dat, just because I'm a neatnik.  
  
Discussion: https://postgr.es/m/13881.1574557302@sss.pgh.pa.us  

M src/backend/commands/async.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Remove a couple of unnecessary if-tests.

commit   : 91da65f4ac2837e0792071e42b2e2101059f1b1b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 12:03:16 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 24 Nov 2019 12:03:16 -0500    

Click here for diff

Commit abd9ca377 replaced a couple of while-loops in fmtfloat()  
with calls to dopr_outchmulti, but I (tgl) failed to notice that  
the new if-tests guarding those calls were really unnecessary,  
because they're inside a larger if-block checking the same thing.  
  
Ranier Vilela  
  
Discussion: https://postgr.es/m/MN2PR18MB2927850AB00CF39CC370D107E34B0@MN2PR18MB2927.namprd18.prod.outlook.com  

M src/port/snprintf.c

Remove debugging aid

commit   : 45ff049e288b0fc7d68195b25ba1a78522e7a45b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 23 Nov 2019 13:19:20 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 23 Nov 2019 13:19:20 -0300    

Click here for diff

This Assert(false) was not supposed to be in the committed copy.  
  
Reported by: Tom Lane  
Discussion: https://postgr.es/m/26476.1574525468@sss.pgh.pa.us  

M src/backend/utils/error/elog.c

Update sepgsql to add mandatory access control for TRUNCATE

commit   : 4f66c93f61439b4db866b21cc1ecd5bf815564ef    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Sat, 23 Nov 2019 10:41:52 -0500    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Sat, 23 Nov 2019 10:41:52 -0500    

Click here for diff

Use SELinux "db_table: { truncate }" to check if permission is granted to  
TRUNCATE. Update example SELinux policy to grant needed permission for  
TRUNCATE. Add new regression test to demonstrate a positive and negative  
cases. Test will only be run if the loaded SELinux policy has the  
"db_table: { truncate }" permission. Makes use of recent commit which added  
object TRUNCATE hook. Patch by Yuli Khodorkovskiy with minor  
editorialization by me. Not back-patched because the object TRUNCATE hook  
was not.  
  
Author: Yuli Khodorkovskiy  
Reviewed-by: Joe Conway  
Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com  

A contrib/sepgsql/expected/truncate.out
M contrib/sepgsql/hooks.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql-regtest.te
M contrib/sepgsql/sepgsql.h
A contrib/sepgsql/sql/truncate.sql
M contrib/sepgsql/test_sepgsql

Add object TRUNCATE hook

commit   : f7a2002e82cfc639d1b6df89012f5d6c623ad545    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Sat, 23 Nov 2019 10:39:20 -0500    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Sat, 23 Nov 2019 10:39:20 -0500    

Click here for diff

All operations with acl permissions checks should have a corresponding hook  
so that, for example, mandatory access control (MAC) may be enforced by an  
extension. The command TRUNCATE is missing this hook, so add it. Patch by  
Yuli Khodorkovskiy with some editorialization by me. Based on the discussion  
not back-patched. A separate patch will exercise the hook in the sepgsql  
extension.  
  
Author: Yuli Khodorkovskiy  
Reviewed-by: Joe Conway  
Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com  

M src/backend/catalog/objectaccess.c
M src/backend/commands/tablecmds.c
M src/include/catalog/objectaccess.h

Make psql redisplay the query buffer after \e.

commit   : d1c866e57f1156000a51ff7e26590984d32bab53    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 17:07:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 17:07:54 -0500    

Click here for diff

Up to now, whatever you'd edited was put back into the query buffer  
but not redisplayed, which is less than user-friendly.  But we can  
improve that just by printing the text along with a prompt, if we  
enforce that the editing result ends with a newline (which it  
typically would anyway).  You then continue typing more lines if  
you want, or you can type ";" or do \g or \r or another \e.  
  
This is intentionally divorced from readline's processing,  
for simplicity and so that it works the same with or without  
readline enabled.  We discussed possibly integrating things  
more closely with readline; but that seems difficult, uncertainly  
portable across different readline and libedit versions, and  
of limited real benefit anyway.  Let's try the simple way and  
see if it's good enough.  
  
Patch by me, thanks to Fabien Coelho and Laurenz Albe for review  
  
Discussion: https://postgr.es/m/13192.1572318028@sss.pgh.pa.us  

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

Avoid taking a new snapshot for an immutable simple expression in plpgsql.

commit   : 73b06cf893c9d3bb38c11878a12cc29407e78b6c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 15:02:18 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 15:02:18 -0500    

Click here for diff

We already used this optimization if the plpgsql function is read-only.  
But it seems okay to do it even in a read-write function, if the  
expression contains only immutable functions/operators.  There would  
only be a change of behavior if an "immutable" called function depends  
on seeing database updates made during the current plpgsql function.  
That's enough of a violation of the promise of immutability that anyone  
who complains won't have much of a case.  
  
The benefits are significant --- for simple cases like  
  
  while i < 10000000  
  loop  
    i := i + 1;  
  end loop;  
  
I see net performance improvements around 45%.  Of course, real-world  
cases won't get that much faster, but it ought to be noticeable.  
At the very least, this removes much of the performance penalty that  
used to exist for forgetting to mark a plpgsql function non-volatile.  
  
Konstantin Knizhnik, reviewed by Pavel Stehule, cosmetic changes by me  
  
Discussion: https://postgr.es/m/ed9da20e-01aa-d04b-d085-e6c16b14b9d7@postgrespro.ru  

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

Add test coverage for "unchanged toast column" replication code path.

commit   : f67b173771a0525ff7f2010d2d57d63d7f546352    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 12:52:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 12:52:26 -0500    

Click here for diff

It seems pretty unacceptable to have no regression test coverage  
for this aspect of the logical replication protocol, especially  
given the bugs we've found in related code.  
  
Discussion: https://postgr.es/m/16129-a0c0f48e71741e5f@postgresql.org  

M src/test/subscription/t/001_rep_changes.pl

Fix bogus tuple-slot management in logical replication UPDATE handling.

commit   : 4d9ceb0018cc087e267f978c90917b3195542e22    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 11:31:19 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 22 Nov 2019 11:31:19 -0500    

Click here for diff

slot_modify_cstrings seriously abused the TupleTableSlot API by relying  
on a slot's underlying data to stay valid across ExecClearTuple.  Since  
this abuse was also quite undocumented, it's little surprise that the  
case got broken during the v12 slot rewrites.  As reported in bug #16129  
from Ondřej Jirman, this could lead to crashes or data corruption when  
a logical replication subscriber processes a row update.  Problems would  
only arise if the subscriber's table contained columns of pass-by-ref  
types that were not being copied from the publisher.  
  
Fix by explicitly copying the datum/isnull arrays from the source slot  
that the old row was in already.  This ends up being about the same  
thing that happened pre-v12, but hopefully in a less opaque and  
fragile way.  
  
We might've caught the problem sooner if there were any test cases  
dealing with updates involving non-replicated or dropped columns.  
Now there are.  
  
Back-patch to v10 where this code came in.  Even though the failure  
does not manifest before v12, IMO this code is too fragile to leave  
as-is.  In any case we certainly want the additional test coverage.  
  
Patch by me; thanks to Tomas Vondra for initial investigation.  
  
Discussion: https://postgr.es/m/16129-a0c0f48e71741e5f@postgresql.org  

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

Add .gitignore to src/tutorial/

commit   : 8959a5e0fa2926b0f99e055e63fb4d81e1dcb3a0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 22 Nov 2019 21:14:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 22 Nov 2019 21:14:54 +0900    

Click here for diff

A set of SQL files are generated for the tutorial when compiling the  
code, so let's avoid any risk to have them added in the tree in the  
future.  

A src/tutorial/.gitignore

Remove traces of version-0 calling convention in src/tutorial/

commit   : a9d5157ae8a7680b496d56f4edc3a43feff708c4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 22 Nov 2019 21:08:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 22 Nov 2019 21:08:49 +0900    

Click here for diff

Support has been removed as of 5ded4bd, but code related to the tutorial  
still used it.  Functions using version-1 are already present for some  
time in the tutorial, and the documentation mentions them, so just  
replace the old version with the new one.  
  
Reported-by: Pavel Stehule  
Analyzed-by: Euler Taveira  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRCgC2uDzrw-vvanXu6Z3ofyviEOQPEpH6_aL4OCe7JRag@mail.gmail.com  

M src/tutorial/funcs.c
D src/tutorial/funcs_new.c

Defend against self-referential views in relation_is_updatable().

commit   : 4a0aab14dcb35550b55e623a3c194442c5666084    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Nov 2019 16:21:43 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Nov 2019 16:21:43 -0500    

Click here for diff

While a self-referential view doesn't actually work, it's possible  
to create one, and it turns out that this breaks some of the  
information_schema views.  Those views call relation_is_updatable(),  
which neglected to consider the hazards of being recursive.  In  
older PG versions you get a "stack depth limit exceeded" error,  
but since v10 it'd recurse to the point of stack overrun and crash,  
because commit a4c35ea1c took out the expression_returns_set() call  
that was incidentally checking the stack depth.  
  
Since this function is only used by information_schema views, it  
seems like it'd be better to return "not updatable" than suffer  
an error.  Hence, add tracking of what views we're examining,  
in just the same way that the nearby fireRIRrules() code detects  
self-referential views.  I added a check_stack_depth() call too,  
just to be defensive.  
  
Per private report from Manuel Rigger.  Back-patch to all  
supported versions.  

M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/misc.c
M src/include/rewrite/rewriteHandler.h

Remove configure --disable-float4-byval

commit   : 2e4db241bfd3206bad8286f8ffc2db6bbdaefcdf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 21 Nov 2019 18:00:07 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 21 Nov 2019 18:00:07 +0100    

Click here for diff

This build option was only useful to maintain compatibility for  
version-0 functions, but those are no longer supported, so this option  
can be removed.  
  
float4 is now always pass-by-value; the pass-by-reference code path is  
completely removed.  
  
Discussion: https://www.postgresql.org/message-id/flat/f3e1e576-2749-bbd7-2d57-3f9dcf75255a@2ndquadrant.com  

M configure
M configure.in
M doc/src/sgml/func.sgml
M doc/src/sgml/installation.sgml
M src/backend/access/index/indexam.c
M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/genbki.pl
M src/backend/commands/analyze.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/initdb/initdb.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/fmgr.h
M src/include/pg_config.h.in
M src/include/postgres.h
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Bump WAL version.

commit   : 43a54a3bccd7dc6be798475214d561f3e93b3055    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 22:17:28 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 22:17:28 +0900    

Click here for diff

Oversight in commit e6d8069522. Since that commit changed the format of  
XLOG_DBASE_DROP WAL record, XLOG_PAGE_MAGIC needs to be bumped.  
  
Spotted by Michael Paquier  

M src/include/access/xlog_internal.h

Make DROP DATABASE command generate less WAL records.

commit   : e6d8069522c8bde8239dd1fedfb4984efa4b3a1a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 21:10:37 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 21:10:37 +0900    

Click here for diff

Previously DROP DATABASE generated as many XLOG_DBASE_DROP WAL records  
as the number of tablespaces that the database to drop uses. This caused  
the scans of shared_buffers as many times as the number of the tablespaces  
during recovery because WAL replay of one XLOG_DBASE_DROP record needs  
that full scan. This could make the recovery time longer especially  
when shared_buffers is large.  
  
This commit changes DROP DATABASE so that it generates only one  
XLOG_DBASE_DROP record, and registers the information of all the tablespaces  
into it. Then, WAL replay of XLOG_DBASE_DROP record needs full scan of  
shared_buffers only once, and which may improve the recovery performance.  
  
Author: Fujii Masao  
Reviewed-by: Kirk Jamison, Simon Riggs  
Discussion: https://postgr.es/m/CAHGQGwF8YwNH0ZaL+2wjZPkj+ji9UhC+Z4ScnG97WKtVY5L9iw@mail.gmail.com  

M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/commands/dbcommands.c
M src/include/commands/dbcommands_xlog.h

Allow ALTER VIEW command to rename the column in the view.

commit   : 30840c92ac0c4073fb7bc8222317630571b8cf25    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 19:55:13 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 19:55:13 +0900    

Click here for diff

ALTER TABLE RENAME COLUMN command always can be used to rename the column  
in the view, but it's reasonable to add that syntax to ALTER VIEW too.  
  
Author: Fujii Masao  
Reviewed-by: Ibrar Ahmed, Yu Kimura  
Discussion: https://postgr.es/m/CAHGQGwHoQMD3b-MqTLcp1MgdhCpOKU7QNRwjFooT4_d+ti5v6g@mail.gmail.com  

M doc/src/sgml/ref/alter_view.sgml
M src/backend/commands/view.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Improve tab-completion for ALTER MATERIALIZED VIEW.

commit   : 61a956d9cca3f72acb279c9c00f1d9cd47bbc934    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 19:22:37 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 21 Nov 2019 19:22:37 +0900    

Click here for diff

Author: Takao Fujii  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/f9dcdef78c124517edc9e5e5880f651e@oss.nttdata.com  

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

Track statistics for spilling of changes from ReorderBuffer.

commit   : 9290ad198b15d6b986b855d2a58d087a54777e87    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 16 Nov 2019 18:24:00 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 16 Nov 2019 18:24:00 +0530    

Click here for diff

This adds the statistics about transactions spilled to disk from  
ReorderBuffer.  Users can query the pg_stat_replication view to check  
these stats.  
  
Author: Tomas Vondra, with bug-fixes and minor changes by Dilip Kumar  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walsender.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/reorderbuffer.h
M src/include/replication/walsender_private.h
M src/test/regress/expected/rules.out

Provide statistics for hypothetical BRIN indexes

commit   : 168d2064001f704965899bb2057591271c44e57a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 21 Nov 2019 10:23:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 21 Nov 2019 10:23:28 +0900    

Click here for diff

Trying to use hypothetical indexes with BRIN currently fails when trying  
to access a relation that does not exist when looking for the  
statistics.  With the current API, it is not possible to easily pass  
a value for pages_per_range down to the hypothetical index, so this  
makes use of the default value of BRIN_DEFAULT_PAGES_PER_RANGE, which  
should be fine enough in most cases.  
  
Being able to refine or enforce the hypothetical costs in more  
optimistic ways would require more refactoring by filling in the  
statistics when building IndexOptInfo in plancat.c.  This would involve  
ABI breakages around the costing routines, something not fit for stable  
branches.  
  
This is broken since 7e534ad, so backpatch down to v10.  
  
Author: Julien Rouhaud, Heikki Linnakangas  
Reviewed-by: Álvaro Herrera, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CAOBaU_ZH0LKEA8VFCocr6Lpte1ab0b6FpvgS0y4way+RPSXfYg@mail.gmail.com  
Backpatch-through: 10  

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

Sync patternsel_common's operator selection logic with pattern_prefix's.

commit   : 9ff5b699ed3e2d922ff6f5660e53b51bb5db983c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Nov 2019 15:00:11 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Nov 2019 15:00:11 -0500    

Click here for diff

Make patternsel_common() select the comparison operators to use with  
hardwired logic that matches pattern_prefix()'s new logic, eliminating  
its dependencies on particular index opfamilies.  
  
This shouldn't change any behavior, as it's just replacing runtime  
operator lookups with the same values hard-wired.  But it makes these  
closely-related functions look more alike, and saving some runtime  
syscache lookups is worth something.  
  
Actually, it's not quite true that this is zero behavioral change:  
when estimating for a column of type "name", the comparison constant  
will be kept as "text" not coerced to "name".  But that's more correct  
anyway, and it allows additional simplification of the coercion logic,  
again syncing this more closely with pattern_prefix().  
  
Per consideration of a report from Manuel Rigger.  
  
Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com  

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

Fix HeapTupleSatisfiesNonVacuumable() comment.

commit   : 9f0f12ac57023653ad870a33a2e0337e6f3bf512    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 20 Nov 2019 11:36:54 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 20 Nov 2019 11:36:54 -0800    

Click here for diff

Oversight in commit 63746189b23.  

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

Reduce match_pattern_prefix()'s dependencies on index opfamilies.

commit   : 2ddedcafca116c99e08c777ab2ab3a4de6f00c7e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Nov 2019 14:13:04 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Nov 2019 14:13:04 -0500    

Click here for diff

Historically, the planner's LIKE/regex index optimizations were only  
carried out for specific index opfamilies.  That's never been a great  
idea from the standpoint of extensibility, but it didn't matter so  
much as long as we had no practical way to extend such behaviors anyway.  
With the addition of planner support functions, and in view of ongoing  
work to support additional table and index AMs, it seems like a good  
time to relax this.  
  
Hence, recast the decisions in match_pattern_prefix() so that rather  
than decide which operators to generate by looking at what the index  
opfamily contains, we decide which operators to generate a-priori  
and then see if the opfamily supports them.  This is much more  
defensible from a semantic standpoint anyway, since we know the  
semantics of the chosen operators precisely, and we only need to  
assume that the opfamily correctly implements operators it claims  
to support.  
  
The existing "pattern" opfamilies put a crimp in this approach, since  
we need to select the pattern operators if we want those to work.  
So we still have to special-case those opfamilies.  But that seems  
all right, since in view of the addition of collations, the pattern  
opfamilies seem like a legacy hack that nobody will be building on.  
  
The only immediate effect of this change, so far as the core code is  
concerned, is that anchored LIKE/regex patterns can be mapped onto  
BRIN index searches, and exact-match patterns can be mapped onto hash  
indexes, not only btree and spgist indexes as before.  That's not a  
terribly exciting result, but it does fix an omission mentioned in  
the ancient comments here.  
  
Note: no catversion bump, even though this touches pg_operator.dat,  
because it's only adding OID macros not changing the contents of  
postgres.bki.  
  
Per consideration of a report from Manuel Rigger.  
  
Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com  

M src/backend/utils/adt/like_support.c
M src/include/catalog/pg_operator.dat

Doc: improve discussion of object owners' inherent privileges.

commit   : 86be6453ba295c3af222ee1e27a243d378070e92    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Nov 2019 12:27:00 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Nov 2019 12:27:00 -0500    

Click here for diff

In particular, clarify that the role membership mechanism allows  
members to inherit the ownership privileges of an object's owning  
role.  
  
Laurenz Albe, with some kibitzing by me  
  
Discussion: https://postgr.es/m/504497aca66bf34bdcdd90bd0bcebdc3a33f577b.camel@cybertec.at  

M doc/src/sgml/ddl.sgml

Remove incorrect markup

commit   : a28704af42c68e659cdeeec5b5b2fc84054ae02c    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Wed, 20 Nov 2019 17:03:07 +0100    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Wed, 20 Nov 2019 17:03:07 +0100    

Click here for diff

Author: Daniel Gustafsson <daniel@yesql.se>  

M doc/src/sgml/libpq.sgml

Fix comment in xact.h

commit   : f9cb8bd3f21719589e09bda33974d994551a63b7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 20 Nov 2019 17:48:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 20 Nov 2019 17:48:31 +0900    

Click here for diff

xl_xact_relfilenodes refers to a number of relations, not XIDs, whose  
relfilenodes are processed.  
  
Author: Yu Kimura  
Discussion: https://postgr.es/m/a6ba6cf6bd0c990e019f008bae83437f@oss.nttdata.com  

M src/include/access/xact.h

Handle ReadFile() EOF correctly on Windows.

commit   : 6969deeb8d3991cc533a5bcf451ae5eecaa9a517    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 20 Nov 2019 17:52:15 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 20 Nov 2019 17:52:15 +1300    

Click here for diff

When ReadFile() encounters the end of a file while reading from  
a synchronous handle with an offset provided via OVERLAPPED, it  
reports an error instead of returning 0.  By not handling that  
(undocumented) result correctly, we caused some noisy LOG  
messages about an unknown error code.  Repair.  
  
Back-patch to 12, where we started using pread()/ReadFile() with  
an offset.  
  
Reported-by: ZhenHua Cai, Amit Kapila  
Diagnosed-by: Juan Jose Santamaria Flecha  
Tested-by: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1LK3%2BWRtpz68TiRdpHwxxWm%3D%2Bt1BMf-G68hhQsAQ41PZg%40mail.gmail.com  

M src/port/pread.c

Add the support for '-f' option in dropdb utility.

commit   : 80e05a088e4edd421c9c0374d54d787c8a4c0d86    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 18 Nov 2019 10:28:32 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 18 Nov 2019 10:28:32 +0530    

Click here for diff

Specifying '-f' will add the 'force' option to the DROP DATABASE command  
sent to the server.  This will try to terminate all existing connections  
to the target database before dropping it.  
  
Author: Pavel Stehule  
Reviewed-by: Vignesh C and Amit Kapila  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M doc/src/sgml/ref/dropdb.sgml
M src/bin/scripts/dropdb.c
M src/bin/scripts/t/050_dropdb.pl

Doc: fix minor typo in func.sgml.

commit   : eecf963269648d4309cc54f8e94508ad42bbb88b    
  
author   : Tatsuo Ishii <ishii@postgresql.org>    
date     : Wed, 20 Nov 2019 09:08:43 +0900    
  
committer: Tatsuo Ishii <ishii@postgresql.org>    
date     : Wed, 20 Nov 2019 09:08:43 +0900    

Click here for diff

Discussion: https://postgr.es/m/20191119.222048.49467220816510881.t-ishii%40sraoss.co.jp  

M doc/src/sgml/func.sgml

Fix corner-case failure in match_pattern_prefix().

commit   : b3c265d7be42484bd0ab4a9c0a920289e8f5c995    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Nov 2019 17:03:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Nov 2019 17:03:26 -0500    

Click here for diff

The planner's optimization code for LIKE and regex operators could  
error out with a complaint like "no = operator for opfamily NNN"  
if someone created a binary-compatible index (for example, a  
bpchar_ops index on a text column) on the LIKE's left argument.  
  
This is a consequence of careless refactoring in commit 74dfe58a5.  
The old code in match_special_index_operator only accepted specific  
combinations of the pattern operator and the index opclass, thereby  
indirectly guaranteeing that the opclass would have a comparison  
operator with the same LHS input type as the pattern operator.  
While moving the logic out to a planner support function, I simplified  
that test in a way that no longer guarantees that.  Really though we'd  
like an altogether weaker dependency on the opclass, so rather than  
put back exactly the old code, just allow lookup failure.  I have in  
mind now to rewrite this logic completely, but this is the minimum  
change needed to fix the bug in v12.  
  
Per report from Manuel Rigger.  Back-patch to v12 where the mistake  
came in.  
  
Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com  

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

Fix page modification outside of critical section in GIN

commit   : b107140804817cc30a4069b1bb5545aa3ea0ce6c    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 20 Nov 2019 00:12:33 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 20 Nov 2019 00:12:33 +0300    

Click here for diff

By oversight 52ac6cd2d0 makes ginDeletePage() sets pd_prune_xid of page to be  
deleted before entering the critical section.  It appears that only versions 11  
and later were affected by this oversight.  
  
Backpatch-through: 11  

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

Revise GIN README

commit   : 32ca32d0bed4b95e5cd63998478a7816a89cd43d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 Nov 2019 23:11:24 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 Nov 2019 23:11:24 +0300    

Click here for diff

We find GIN concurrency bugs from time to time.  One of the problems here is  
that concurrency of GIN isn't well-documented in README.  So, it might be even  
hard to distinguish design bugs from implementation bugs.  
  
This commit revised concurrency section in GIN README providing more details.  
Some examples are illustrated in ASCII art.  
  
Also, this commit add the explanation of how is tuple layout in internal GIN  
B-tree page different in comparison with nbtree.  
  
Discussion: https://postgr.es/m/CAPpHfduXR_ywyaVN4%2BOYEGaw%3DcPLzWX6RxYLBncKw8de9vOkqw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 9.4  

M src/backend/access/gin/README

Fix traversing to the deleted GIN page via downlink

commit   : d5ad7a09afd066dce423f282bb2b338f48614d32    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 Nov 2019 23:08:14 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 Nov 2019 23:08:14 +0300    

Click here for diff

Current GIN code appears to don't handle traversing to the deleted page via  
downlink.  This commit fixes that by stepping right from the delete page like  
we do in nbtree.  
  
This commit also fixes setting 'deleted' flag to the GIN pages.  Now other page  
flags are not erased once page is deleted.  That helps to keep our assertions  
true if we arrive deleted page via downlink.  
  
Discussion: https://postgr.es/m/CAPpHfdvMvsw-NcE5bRS7R1BbvA4BxoDnVVjkXC5W0Czvy9LVrg%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 9.4  

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

Fix deadlock between ginDeletePage() and ginStepRight()

commit   : e14641197a5690d92cc48446d0d40f1aec07bac7    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 Nov 2019 23:07:36 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 Nov 2019 23:07:36 +0300    

Click here for diff

When ginDeletePage() is about to delete page it locks its left sibling to revise  
the rightlink.  So, it locks pages in right to left manner.  Int he same time  
ginStepRight() locks pages in left to right manner, and that could cause a  
deadlock.  
  
This commit makes ginScanToDelete() keep exclusive lock on left siblings of  
currently investigated path.  That elimites need to relock left sibling in  
ginDeletePage().  Thus, deadlock with ginStepRight() can't happen anymore.  
  
Reported-by: Chen Huajun  
Discussion: https://postgr.es/m/5c332bd1.87b6.16d7c17aa98.Coremail.chjischj%40163.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 10  

M src/backend/access/gin/README
M src/backend/access/gin/ginvacuum.c

Doc: clarify use of RECURSIVE in WITH.

commit   : 5b805886ca11d5d74217ab1f12395ad54507d4d5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Nov 2019 14:43:37 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Nov 2019 14:43:37 -0500    

Click here for diff

Apparently some people misinterpreted the syntax as being that  
RECURSIVE is a prefix of individual WITH queries.  It's a modifier  
for the WITH clause as a whole, so state that more clearly.  
  
Discussion: https://postgr.es/m/ca53c6ce-a0c6-b14a-a8e3-162f0b2cc119@a-kretschmer.de  

M doc/src/sgml/ref/select.sgml

Doc: clarify behavior of ALTER DEFAULT PRIVILEGES ... IN SCHEMA.

commit   : 787b3fd33fb3089bf80d49ef9948a6ec85005d04    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Nov 2019 14:21:41 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Nov 2019 14:21:41 -0500    

Click here for diff

The existing text stated that "Default privileges that are specified  
per-schema are added to whatever the global default privileges are for  
the particular object type".  However, that bare-bones observation is  
not quite clear enough, as demonstrated by the complaint in bug #16124.  
Flesh it out by stating explicitly that you can't revoke built-in  
default privileges this way, and by providing an example to drive  
the point home.  
  
Back-patch to all supported branches, since it's been like this  
from the beginning.  
  
Discussion: https://postgr.es/m/16124-423d8ee4358421bc@postgresql.org  

M doc/src/sgml/ref/alter_default_privileges.sgml

Allow invisible PROMPT2 in psql.

commit   : 7f338369ca624ca6c2e4f579623274c88d325bce    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 19 Nov 2019 15:17:15 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 19 Nov 2019 15:17:15 +1300    

Click here for diff

Keep track of the visible width of PROMPT1, and provide %w as a way  
for PROMPT2 to generate the same number of spaces.  
  
Author: Thomas Munro, with ideas from others  
Reviewed-by: Tom Lane (earlier version)  
Discussion: https://postgr.es/m/CA%2BhUKG%2BzGd7RigjWbxwhzGW59gUpf76ydQECeGdEdodH6nd__A%40mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/prompt.c

Add logical_decoding_work_mem to limit ReorderBuffer memory usage.

commit   : cec2edfa7859279f36d2374770ca920c59c73dd8    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 16 Nov 2019 17:49:33 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 16 Nov 2019 17:49:33 +0530    

Click here for diff

Instead of deciding to serialize a transaction merely based on the  
number of changes in that xact (toplevel or subxact), this makes  
the decisions based on amount of memory consumed by the changes.  
  
The memory limit is defined by a new logical_decoding_work_mem GUC,  
so for example we can do this  
  
    SET logical_decoding_work_mem = '128kB'  
  
to reduce the memory usage of walsenders or set the higher value to  
reduce disk writes. The minimum value is 64kB.  
  
When adding a change to a transaction, we account for the size in  
two places. Firstly, in the ReorderBuffer, which is then used to  
decide if we reached the total memory limit. And secondly in the  
transaction the change belongs to, so that we can pick the largest  
transaction to evict (and serialize to disk).  
  
We still use max_changes_in_memory when loading changes serialized  
to disk. The trouble is we can't use the memory limit directly as  
there might be multiple subxact serialized, we need to read all of  
them but we don't know how many are there (and which subxact to  
read first).  
  
We do not serialize the ReorderBufferTXN entries, so if there is a  
transaction with many subxacts, most memory may be in this type of  
objects. Those records are not included in the memory accounting.  
  
We also do not account for INTERNAL_TUPLECID changes, which are  
kept in a separate list and not evicted from memory. Transactions  
with many CTID changes may consume significant amounts of memory,  
but we can't really do much about that.  
  
The current eviction algorithm is very simple - the transaction is  
picked merely by size, while it might be useful to also consider age  
(LSN) of the changes for example. With the new Generational memory  
allocator, evicting the oldest changes would make it more likely  
the memory gets actually pfreed.  
  
The logical_decoding_work_mem can be set in postgresql.conf, in which  
case it serves as the default for all publishers on that instance.  
  
Author: Tomas Vondra, with changes by Dilip Kumar and Amit Kapila  
Reviewed-by: Dilip Kumar and Amit Kapila  
Tested-By: Vignesh C  
Discussion: https://postgr.es/m/688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com  

M contrib/test_decoding/logical.conf
M doc/src/sgml/config.sgml
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/reorderbuffer.h

nbtree: Tweak _bt_pgaddtup() comments.

commit   : 2110f716965fe1ac5af83380aa108541b1457e0d    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 18 Nov 2019 13:04:53 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 18 Nov 2019 13:04:53 -0800    

Click here for diff

Make it clear that _bt_pgaddtup() truncates the first data item on an  
internal page because its key is supposed to be treated as minus  
infinity within _bt_compare().  

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

Further fix dumping of views that contain just VALUES(...).

commit   : bf2efc55da9a1a33da32fa383db9db2f2c49b2cb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 16 Nov 2019 20:00:19 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 16 Nov 2019 20:00:19 -0500    

Click here for diff

It turns out that commit e9f1c01b7 missed a case: we must print a  
VALUES clause in long format if get_query_def is given a resultDesc  
that would require the query's output column name(s) to be different  
from what the bare VALUES clause would produce.  
  
This applies in case an ALTER ... RENAME COLUMN has been done to  
a view that formerly could be printed in simple format, as shown  
in the added regression test case.  It also explains bug #16119  
from Dmitry Telpt, because it turns out that (unlike CREATE VIEW)  
CREATE MATERIALIZED VIEW fails to apply any column aliases it's  
given to the stored ON SELECT rule.  So to get them to be printed,  
we have to account for the resultDesc renaming.  It might be worth  
changing the matview code so that it creates the ON SELECT rule  
with the correct aliases; but we'd still need these messy checks in  
get_simple_values_rte to handle the case of a subsequent column  
rename, so any such change would be just neatnik-ism not a bug fix.  
  
Like the previous patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/16119-e64823f30a45a754@postgresql.org  

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

Add tuplesort test to serial_schedule.

commit   : 815bd578076672a2325d026a2c48b6075454be9b    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 16 Nov 2019 10:51:03 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 16 Nov 2019 10:51:03 -0800    

Click here for diff

Oversight in commit 4a252996.  

M src/test/regress/serial_schedule

Improve stability of tests for VACUUM (SKIP_LOCKED)

commit   : 3db0598d908f22435ab8138d1c76b971f17a5633    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 16 Nov 2019 15:23:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 16 Nov 2019 15:23:12 +0900    

Click here for diff

Concurrent autovacuums running with the main regression test suite  
could cause the tests with VACUUM (SKIP_LOCKED) to generate randomly  
WARNING messages.  For these tests, set client_min_messages to ERROR to  
get rid of those random failures, as disabling autovacuum for the  
relations operated would not completely close the failure window.  
  
For isolation tests, disable autovacuum for the relations vacuumed with  
SKIP_LOCKED.  The tests are designed so as LOCK commands are taken  
in a first session before running a concurrent VACUUM (SKIP_LOCKED) in a  
second to generate WARNING messages, but a concurrent autovacuum could  
cause the tests to be slower.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Tom Lane  
Discussion: https://postgr.es/m/25294.1573077278@sss.pgh.pa.us  
Backpatch-through: 12  

M src/test/isolation/specs/vacuum-skip-locked.spec
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Properly determine length for on-disk TOAST values

commit   : 2dc08bd6179d8cf480c93701010c19ad7a9891d8    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 16 Nov 2019 02:40:02 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 16 Nov 2019 02:40:02 +0100    

Click here for diff

In detoast_attr_slice, VARSIZE_ANY was used to compute compressed length  
of on-disk TOAST values. That's incorrect, because the varlena value may  
be just a TOAST pointer, producing either bogus value or crashing.  
  
This is likely why the code was crashing on big-endian machines before  
540f31680913 replaced the VARSIZE with VARSIZE_ANY, which however only  
masked the issue.  
  
Reported-by: Rushabh Lathia  
Discussion: https://postgr.es/m/CAL-OGkthU9Gs7TZchf5OWaL-Gsi=hXqufTxKv9qpNG73d5na_g@mail.gmail.com  

M src/backend/access/common/detoast.c

Skip system attributes when applying mvdistinct stats

commit   : d482f7f867b58bbd29f65a4471eca8c5b57a7da0    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 16 Nov 2019 01:17:15 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 16 Nov 2019 01:17:15 +0100    

Click here for diff

When estimating number of distinct groups, we failed to ignore system  
attributes when matching the group expressions to mvdistinct stats,  
causing failures like  
  
  ERROR: negative bitmapset member not allowed  
  
Fix that by simply skipping anything that is not a regular attribute.  
Backpatch to PostgreSQL 10, where the extended stats were introduced.  
  
Bug: #16111  
Reported-by: Tuomas Leikola  
Author: Tomas Vondra  
Backpatch-through: 10  
Discussion: https://postgr.es/m/16111-687799584c3a7e73@postgresql.org  

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

Always call ExecShutdownNode() if appropriate.

commit   : 76cbfcdf3a0dff3f029ca079701418b861ce86c8    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 16 Nov 2019 10:04:52 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 16 Nov 2019 10:04:52 +1300    

Click here for diff

Call ExecShutdownNode() after ExecutePlan()'s loop, rather than at each  
break.  We had forgotten to do that in one case.  The omission caused  
intermittent "temporary file leak" warnings from multi-batch parallel  
hash joins with a LIMIT clause.  
  
Back-patch to 11.  Though the problem exists in theory in earlier  
parallel query releases, nothing really depended on it.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Thomas Munro, Amit Kapila  
Discussion: https://postgr.es/m/20191111.212418.2222262873417235945.horikyota.ntt%40gmail.com  

M src/backend/executor/execMain.c

Remove the word "virgins" for documentation

commit   : 6ae4d271879b62c4325df3ddf75bff3f2b911086    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 14 Nov 2019 17:33:26 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 14 Nov 2019 17:33:26 -0300    

Click here for diff

Apparently, it's no longer welcome.  Therefore replace it with "pristine",  
and add some explanatory text while at it.  
  
Reported by Brian Williams  
Discussion: https://postgr.es/m/157313712259.14261.16141263269989647311@wrigleys.postgresql.org  

M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/ref/create_database.sgml

Cleanup code in reloptions.h regarding reloption handling

commit   : 50d22de9325f41a32faeb0d1055f50b43d0507b3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 Nov 2019 13:59:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 Nov 2019 13:59:59 +0900    

Click here for diff

reloptions.h includes since ba748f7 a set of macros to handle reloption  
types in a way similar to how parseRelOptions() works.  They have never  
been used in the core code, and we have more simple methods now to parse  
and fill in rd_options for a given relation depending on its relkind, so  
remove this interface to simplify things.  
  
Per discussion between Amit Langote, Álvaro Herrera and me.  
  
Discussion: https://postgr.es/m/CA+HiwqE6zbNO92az6pp5GiTw4tr-9rfCE0t84whQSP+YwSKjMQ@mail.gmail.com  

M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h

Split handling of reloptions for partitioned tables

commit   : 1bbd608fdae7af314d8e2229e369a45a3da83cd8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 Nov 2019 12:34:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 Nov 2019 12:34:28 +0900    

Click here for diff

Partitioned tables do not have relation options yet, but, similarly to  
what's done for views which have their own parsing table, it could make  
sense to introduce new parameters for some of the existing default ones  
like fillfactor, autovacuum, etc.  Splitting things has the advantage to  
make the information stored in rd_options include only the necessary  
information, reducing the amount of memory used for a relcache entry  
with partitioned tables if new reloptions are introduced at this level.  
  
Author:  Nikolay Shaplov  
Reviewed-by: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/1627387.Qykg9O6zpu@x200m  

M src/backend/access/common/reloptions.c
M src/backend/commands/tablecmds.c
M src/include/access/reloptions.h

Fix plan instability in the new tuplesort test.

commit   : 80ef34fc7075b37fc23f4ab714a5ce60f82400de    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 13 Nov 2019 16:36:31 -0800    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 13 Nov 2019 16:36:31 -0800    

Click here for diff

At least buildfarm member florican doesn't use a material node above a  
sort in the mark/restore case. As material is not intended to be  
tested with that query, disallow.  

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

Remove unused code from tuplesort.

commit   : 7d962eaf50c093b4bb1d35a7b495d416a67b40e2    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 13 Nov 2019 15:57:01 -0800    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 13 Nov 2019 15:57:01 -0800    

Click here for diff

copytup_index() is unused, as tuplesort_putindextuplevalues() doesn't  
use COPYTUP(). Replace function body with an elog(ERROR), as already  
done e.g. for copytup_datum().  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20191013144153.ooxrfglvnaocsrx2@alap3.anarazel.de  

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

Add tests for tuplesort.c.

commit   : 4a252996d5fda7662b2afdf329a5c95be0fe3b01    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 24 Oct 2019 13:58:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 24 Oct 2019 13:58:40 -0700    

Click here for diff

Previously significant parts of tuplesort.c were untested. This  
commit, while not testing every path, significantly increases  
coverage.  In particular, this adds tests for abbreviated key logic,  
forward/backward scans & scrolling and mark/restore.  
  
I tried to keep the table sizes reasonable, and stress the on-disk  
paths by setting work_mem to low values for specific tests. The  
buildfarm will tell whether more attention to test time is needed.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20191013144153.ooxrfglvnaocsrx2@alap3.anarazel.de  

A src/test/regress/expected/tuplesort.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/tuplesort.sql

Add missing check_collation_set call to bpcharne().

commit   : d57d61533a2b5b27b60cc9024c54688390871bf6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 15:53:53 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 15:53:53 -0500    

Click here for diff

We should throw an error for indeterminate collation, but bpcharne()  
was missing that logic, resulting in a much less user-friendly error  
(either an assertion failure or "cache lookup failed for collation 0").  
  
Per report from Manuel Rigger.  Back-patch to v12 where the mistake  
came in, evidently in commit 5e1963fb7.  (Before non-deterministic  
collations, this function wasn't collation sensitive.)  
  
Discussion: https://postgr.es/m/CA+u7OA4HOjtymxAbuGNh4-X_2R0Lw5n01tzvP8E5-i-2gQXYWA@mail.gmail.com  

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

Fix silly initializations (cosmetic only).

commit   : 0cafdd03a850265006c0ada1b0bf4f83e087a409    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 15:26:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 15:26:54 -0500    

Click here for diff

Initializing a pointer to "false" isn't per project style,  
and reportedly some compilers warn about it (though I've  
not seen any such warnings in the buildfarm).  
  
Seems to have come in with commit ff11e7f4b, so back-patch  
to v12 where that was added.  
  
Didier Gautheron  
  
Discussion: https://postgr.es/m/CAJRYxu+XQuM0qnSqt1Ujztu6fBPzMMAT3VEn6W32rgKG6A2Fsw@mail.gmail.com  

M src/backend/commands/trigger.c

Avoid using SplitIdentifierString to parse ListenAddresses, too.

commit   : 7bf40ea0d028e6dc49c152e5820a65d69b74b409    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 13:51:58 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 13:51:58 -0500    

Click here for diff

This gets rid of our former behavior of forcibly downcasing  
the postmaster's hostname list and truncating the elements to  
NAMEDATALEN.  In principle, DNS hostnames are case-insensitive  
so the first behavior should be harmless, and server hostnames  
are seldom long enough for the second behavior to be an issue.  
But it's still dubious, and an easy fix is available: just use  
SplitGUCList instead.  
  
AFAICT, all other SplitIdentifierString calls in the backend are  
OK: either the items actually are SQL identifiers, or they are  
keywords that are short and case-insensitive.  
  
Per thinking about bug #16106.  While this has been wrong for  
a very long time, the lack of field complaints means there's  
little reason to back-patch.  
  
Discussion: https://postgr.es/m/16106-7d319e4295d08e70@postgresql.org  

M src/backend/postmaster/postmaster.c

Avoid downcasing/truncation of RADIUS authentication parameters.

commit   : 7618eaf5f315f53619b718e571cd2a2020fb0226    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 13:41:04 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 13:41:04 -0500    

Click here for diff

Commit 6b76f1bb5 changed all the RADIUS auth parameters to be lists  
rather than single values.  But its use of SplitIdentifierString  
to parse the list format was not very carefully thought through,  
because that function thinks it's parsing SQL identifiers, which  
means it will (a) downcase the strings and (b) truncate them to  
be shorter than NAMEDATALEN.  While downcasing should be harmless  
for the server names and ports, it's just wrong for the shared  
secrets, and probably for the NAS Identifier strings as well.  
The truncation aspect is at least potentially a problem too,  
though typical values for these parameters would fit in 63 bytes.  
  
Fortunately, we now have a function SplitGUCList that is exactly  
the same except for not doing the two unwanted things, so fixing  
this is a trivial matter of calling that function instead.  
  
While here, improve the documentation to show how to double-quote  
the parameter values.  I failed to resist the temptation to do  
some copy-editing as well.  
  
Report and patch from Marcos David (bug #16106); doc changes by me.  
Back-patch to v10 where the aforesaid commit came in, since this is  
arguably a regression from our previous behavior with RADIUS auth.  
  
Discussion: https://postgr.es/m/16106-7d319e4295d08e70@postgresql.org  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/hba.c

Include TableFunc references when computing expression dependencies.

commit   : 2c7b5dad6eb1602839e5961b4d4eb6494fe4a1ee    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 12:11:49 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 12:11:49 -0500    

Click here for diff

The TableFunc node (i.e., XMLTABLE) includes type and collation OIDs  
that might not be referenced anywhere else in the expression tree,  
so they need to be accounted for when extracting dependencies.  
  
Fortunately, the practical effects of this are limited, since  
(a) it's somewhat unlikely that people would be extracting  
columns of non-builtin types from an XML document, and (b)  
in many scenarios, the query would contain other references  
to such types, or functions depending on them.  However, it's  
not hard to construct examples wherein the existing code lets  
one drop a type used in XMLTABLE and thereby break a view.  
  
This is evidently an original oversight in the XMLTABLE patch,  
so back-patch to v10 where that came in.  
  
Discussion: https://postgr.es/m/18427.1573508501@sss.pgh.pa.us  

M src/backend/catalog/dependency.c

Handle arrays and ranges in pg_upgrade's test for non-upgradable types.

commit   : 29aeda6e4e609b66b6f1c3c73b4def6fb34d90ed    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 11:35:37 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Nov 2019 11:35:37 -0500    

Click here for diff

pg_upgrade needs to check whether certain non-upgradable data types  
appear anywhere on-disk in the source cluster.  It knew that it has  
to check for these types being contained inside domains and composite  
types; but it somehow overlooked that they could be contained in  
arrays and ranges, too.  Extend the existing recursive-containment  
query to handle those cases.  
  
We probably should have noticed this oversight while working on  
commit 0ccfc2822 and follow-ups, but we failed to :-(.  The whole  
thing's possibly a bit overdesigned, since we don't really expect  
that any of these types will appear on disk; but if we're going to  
the effort of doing a recursive search then it's silly not to cover  
all the possibilities.  
  
While at it, refactor so that we have only one copy of the search  
logic, not three-and-counting.  Also, to keep the branches looking  
more alike, back-patch the output wording change of commit 1634d3615.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/31473.1573412838@sss.pgh.pa.us  

M src/bin/pg_upgrade/version.c

Make pg_waldump report more detail information about PREPARE TRANSACTION record.

commit   : 7b8a899bdeb638f46e102d1714c079a0874e9fa0    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 13 Nov 2019 16:59:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 13 Nov 2019 16:59:17 +0900    

Click here for diff

This commit changes xact_desc() so that it reports the detail information about  
PREPARE TRANSACTION record, like GID (global transaction identifier),  
timestamp at prepare transaction, delete-on-abort/commit relations,  
XID of subtransactions, and invalidation messages. These are helpful  
when diagnosing 2PC-related troubles.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Andrey Lepikhov, Kyotaro Horiguchi, Julien Rouhaud, Alvaro Herrera  
Discussion: https://postgr.es/m/CAHGQGwEvhASad4JJnCv=0dW2TJypZgW_Vpb-oZik2a3utCqcrA@mail.gmail.com  

M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/twophase.c
M src/include/access/twophase.h
M src/include/access/xact.h

Add regression test for two-phase transaction in postgres_fdw

commit   : 94fec48516a77f219ab94890219d724b973e4674    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 Nov 2019 13:30:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 Nov 2019 13:30:14 +0900    

Click here for diff

postgres_fdw does not support two-phase transactions, so let's add a  
small negative test case to check after it.  Note that this is checked  
using an end-of-xact callback to ensure a proper connection cleanup with  
the foreign server, which is called before checking if a server is able  
to handle 2PC with max_prepared_xacts, so this test does not need an  
alternate output file.  
  
Author: Gilles Darold  
Discussion: https://postgr.es/m/20191108090507.GC1768@paquier.xyz  

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

Introduce the 'force' option for the Drop Database command.

commit   : 1379fd537f9fc7941c8acff8c879ce3636dbdb77    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 12 Nov 2019 11:06:13 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 12 Nov 2019 11:06:13 +0530    

Click here for diff

This new option terminates the other sessions connected to the target  
database and then drop it.  To terminate other sessions, the current user  
must have desired permissions (same as pg_terminate_backend()).  We don't  
allow to terminate the sessions if prepared transactions, active logical  
replication slots or subscriptions are present in the target database.  
  
Author: Pavel Stehule with changes by me  
Reviewed-by: Dilip Kumar, Vignesh C, Ibrar Ahmed, Anthony Nowocien,  
Ryan Lambert and Amit Kapila  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M doc/src/sgml/ref/drop_database.sgml
M src/backend/commands/dbcommands.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/storage/ipc/procarray.c
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.c
M src/include/commands/dbcommands.h
M src/include/nodes/parsenodes.h
M src/include/storage/procarray.h
M src/test/regress/expected/drop_if_exists.out
M src/test/regress/sql/drop_if_exists.sql

Finish reverting commit 0a52d378b.

commit   : 112caf9039f4c8fb286bb610461ced8253313e9f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Nov 2019 16:58:00 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Nov 2019 16:58:00 -0500    

Click here for diff

Apply the solution adopted in commit dcb7d3caf (ie, explicitly  
don't call memcmp for a zero-length comparison) to func_get_detail()  
as well, removing one other place where we were passing an  
uninitialized array to a parse_func.c entry point.  
  
Discussion: https://postgr.es/m/MN2PR18MB2927F24692485D754794F01BE3740@MN2PR18MB2927.namprd18.prod.outlook.com  
Discussion: https://postgr.es/m/MN2PR18MB2927F6873DF2774A505AC298E3740@MN2PR18MB2927.namprd18.prod.outlook.com  

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

pg_stat_activity: document client_port being null

commit   : c5e8ea978d88ea4aa731516836e14d54c50cc957    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Nov 2019 18:34:20 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Nov 2019 18:34:20 -0300    

Click here for diff

As suggested by Stephen Frost.  
Discussion: https://postgr.es/m/20191104160605.GC6962@tamriel.snowman.net  

M doc/src/sgml/monitoring.sgml

pg_stat_{ssl,gssapi}: Show only processes with connections

commit   : 5c46e7d82e88859395c2688c37bb643ae7dbbfa1    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Nov 2019 17:19:41 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Nov 2019 17:19:41 -0300    

Click here for diff

It is pointless to show in those views auxiliary processes that don't  
open network connections.  
  
A small incompatibility is that anybody joining pg_stat_activity and  
pg_stat_ssl/pg_stat_gssapi will have to use a left join if they want to  
see such auxiliary processes.  
  
Author: Euler Taveira  
Discussion: https://postgr.es/m/20190904151535.GA29108@alvherre.pgsql  

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

Make _bt_keep_natts_fast() use datum_image_eq().

commit   : 1f55ebae27225111d0a5c4d89d7e77d917357ff4    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 12 Nov 2019 13:08:41 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 12 Nov 2019 13:08:41 -0800    

Click here for diff

An upcoming patch that adds deduplication to the nbtree AM will rely on  
_bt_keep_natts_fast() understanding that differences in TOAST input  
state can never affect its answer.  In particular, two opclass-equal  
datums (with opclasses deemed safe for deduplication) should never be  
treated as unequal by _bt_keep_natts_fast() due to TOAST input  
differences.  
  
This also seems like a good idea on general principle.  nbtsplitloc.c  
will now occasionally make better decisions about where to split a leaf  
page.  The behavior of _bt_keep_natts_fast() is now somewhat closer to  
the behavior of _bt_keep_natts().  
  
Discussion: https://postgr.es/m/CAH2-Wzn3Ee49Gmxb7V1VJ3-AC8fWn-Fr8pfWQebHe8rYRxt5OQ@mail.gmail.com  

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

Have LookupFuncName accept NULL argtypes for 0 args

commit   : dcb7d3cafa3197c5425c129ba0dc5eddd23c0532    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Nov 2019 17:04:46 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Nov 2019 17:04:46 -0300    

Click here for diff

Prior to this change, it requires to be passed a valid pointer just to  
be able to pass it to a zero-byte memcmp, per 0a52d378b03b.  Given the  
strange resulting code in callsites, it seems better to test for the  
case specifically and remove the requirement.  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/MN2PR18MB2927F24692485D754794F01BE3740@MN2PR18MB2927.namprd18.prod.outlook.com  
Discussion: https://postgr.es/m/MN2PR18MB2927F6873DF2774A505AC298E3740@MN2PR18MB2927.namprd18.prod.outlook.com  

M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/parser/parse_func.c
M src/pl/tcl/pltcl.c

Teach datum_image_eq() about cstring datums.

commit   : 8c951687f58ad604be13e6addfd56446afb36e13    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 12 Nov 2019 11:25:34 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 12 Nov 2019 11:25:34 -0800    

Click here for diff

Bring datum_image_eq() in line with datumIsEqual() by adding support for  
comparing cstring datums.  
  
An upcoming patch that adds deduplication to the nbtree AM will use  
datum_image_eq().  datum_image_eq() will need to work with all datatypes  
that can be used as the storage type of a B-Tree index column, including  
cstring.  (cstring is used as the storage type for columns of type  
"name" as a space-saving optimization.)  
  
Discussion: https://postgr.es/m/CAH2-Wzn3Ee49Gmxb7V1VJ3-AC8fWn-Fr8pfWQebHe8rYRxt5OQ@mail.gmail.com  

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

Fix ecpglib.h to declare bool consistently with c.h.

commit   : 7a0574b50ee9c2b96ce94c29e031c103285c0b1d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Nov 2019 13:00:04 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Nov 2019 13:00:04 -0500    

Click here for diff

This completes the task begun in commit 1408d5d86, to synchronize  
ECPG's exported definitions with the definition of bool used by  
c.h (and, therefore, the one actually in use in the ECPG library).  
On practically all modern platforms, ecpglib.h will now just  
include <stdbool.h>, which should surprise nobody anymore.  
That removes a header-inclusion-order hazard for ECPG clients,  
who previously might get build failures or unexpected behavior  
depending on whether they'd included <stdbool.h> themselves,  
and if so, whether before or after ecpglib.h.  
  
On platforms where sizeof(_Bool) is not 1 (only old PPC-based  
Mac systems, as far as I know), things are still messy, as  
inclusion of <stdbool.h> could still break ECPG client code.  
There doesn't seem to be any clean fix for that, and given the  
probably-negligible population of users who would care anymore,  
it's not clear we should go far out of our way to cope with it.  
This change at least fixes some header-inclusion-order hazards  
for our own code, since c.h and ecpglib.h previously disagreed  
on whether bool should be char or unsigned char.  
  
To implement this with minimal invasion of ECPG client namespace,  
move the choice of whether to rely on <stdbool.h> into configure,  
and have it export a configuration symbol PG_USE_STDBOOL.  
  
ecpglib.h no longer exports definitions for TRUE and FALSE,  
only their lowercase brethren.  We could undo that if we get  
push-back about it.  
  
Ideally we'd back-patch this as far as v11, which is where c.h  
started to rely on <stdbool.h>.  But the odds of creating problems  
for formerly-working ECPG client code seem about as large as the  
odds of fixing any non-working cases, so we'll just do this in HEAD.  
  
Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com  

M configure
M configure.in
M src/backend/utils/fmgr/dfmgr.c
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/include/ecpg_config.h.in
M src/interfaces/ecpg/include/ecpglib.h
M src/pl/plperl/plperl.h
M src/tools/msvc/Solution.pm

gitattributes: Add new file

commit   : de7c2d30b6dc2544b181cf074e942fff54d7999d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 Nov 2019 08:13:55 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 Nov 2019 08:13:55 +0100    

Click here for diff

M .gitattributes

Make the order of the header file includes consistent in backend modules.

commit   : 14aec03502302eff6c67981d8fd121175c436ce9    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 12 Nov 2019 08:30:16 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 12 Nov 2019 08:30:16 +0530    

Click here for diff

Similar to commits 7e735035f2 and dddf4cdc33, this commit makes the order  
of header file inclusion consistent for backend modules.  
  
In the passing, removed a couple of duplicate inclusions.  
  
Author: Vignesh C  
Reviewed-by: Kuntal Ghosh and Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/rmgr.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/xlogfuncs.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/catalog.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/commands/alter.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/hba.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/path/clausesel.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/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/scansup.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slotfuncs.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/page/checksum.c
M src/backend/storage/smgr/md.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/rangetypes_gist.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/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/time/combocid.c

Doc: fix ancient mistake, or at least obsolete info, in rules example.

commit   : b6423e92abfadaa1ed9642319872aa1654403cd6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Nov 2019 14:39:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Nov 2019 14:39:54 -0500    

Click here for diff

The example of expansion of multiple views claimed that the resulting  
subquery nest would not get fully flattened because of an aggregate  
function.  There's no aggregate in the example, though, only a user  
defined function confusingly named MIN().  In a modern server, the  
reason for the non-flattening is that MIN() is volatile, but I'm  
unsure whether that was true back when this text was written.  
  
Let's reduce the confusion level by using LEAST() instead (which  
we didn't have at the time this example was created).  And then  
we can just say that the planner will flatten the sub-queries, so  
the rewrite system doesn't have to.  
  
Noted by Paul Jungwirth.  This text is old enough to vote, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CA+renyXZFnmp9PcvX1EVR2dR=XG5e6E-AELr8AHCNZ8RYrpnPw@mail.gmail.com  

M doc/src/sgml/rules.sgml

Further improve stability of partition_prune regression test.

commit   : 13e8b2ee896d76dfcd02dddee40919fd6f2cd937    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Nov 2019 10:33:00 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Nov 2019 10:33:00 -0500    

Click here for diff

Commits 4ea03f3f4 et al arranged to filter out row counts in parallel  
plans, because those are dependent on the number of workers actually  
obtained.  Somehow I missed that the 'Rows Removed by Filter' counts  
can also vary, so fix that too.  Per buildfarm.  
  
This seems worth a last-minute patch because unreliable regression  
tests are a serious pain in the rear for packagers.  
  
Like the previous patch, back-patch to v11 where this test was  
introduced.  

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

gitattributes: Remove entries for no longer existing files

commit   : 2cd75e4e795bea110c1d32e8cbfdf1e33a109e80    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Nov 2019 11:54:12 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Nov 2019 11:54:12 +0100    

Click here for diff

M .gitattributes

Fix whitespace

commit   : d0c92527cc77a8f6b235c2a5abba95e01367f825    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Nov 2019 09:51:10 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Nov 2019 09:51:10 +0100    

Click here for diff

M src/backend/utils/mmgr/README

Rerun autoheader

commit   : bbaa8232729f2aa1b1061503a3d9f7db503d2788    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Nov 2019 09:50:07 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Nov 2019 09:50:07 +0100    

Click here for diff

This puts pg_config.h.in content back into the "correct" order.  

M src/include/pg_config.h.in

Optimize PredicateLockTuple().

commit   : db2687d1f3787aa8113b3dbb358153feee30c64c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 11 Nov 2019 16:34:01 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 11 Nov 2019 16:34:01 +1300    

Click here for diff

PredicateLockTuple() has a fast exit if tuple was written by the current  
transaction, as in that case it already has a lock.  This check can be  
performed using TransactionIdIsCurrentTransactionId() instead of  
SubTransGetTopmostTransaction(), to avoid any chance of having to hit the  
disk.  
  
Author: Ashwin Agrawal, based on a suggestion from Andres Freund  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com  

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

Optimize TransactionIdIsCurrentTransactionId().

commit   : 695c5977c8bc115029a85dcc1821d7b0136b4e4c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 11 Nov 2019 16:33:04 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 11 Nov 2019 16:33:04 +1300    

Click here for diff

If the passed in xid is the current top transaction, we can do a fast  
check and exit early.  This should work well for the current heap but  
also works very well for proposed AMs that don't use a separate xid  
for subtransactions.  
  
Author: Ashwin Agrawal, based on a suggestion from Andres Freund  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com  

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

Rearrange dropdb() to avoid errors after allowing other sessions to exit.

commit   : 9fab25c6cd1f943284b8e0014007cd5750d54308    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 9 Nov 2019 17:28:27 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 9 Nov 2019 17:28:27 +0530    

Click here for diff

During Drop Database, it is better to error out before allowing other  
sessions to exit and forcefully terminating autovacuum workers.  All the  
other errors except for checking subscriptions are already done before.  
  
Author: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1+qhLkCYG2oy9xug9ur_j=G2wQNRYAyd+-kZfZ1z42pLw@mail.gmail.com  

M src/backend/commands/dbcommands.c

Fix subscription test

commit   : ef8fcbff56e8904ba83b2659e9d0290e6106928e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Nov 2019 13:19:27 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Nov 2019 13:19:27 +0100    

Click here for diff

After altering a subscription, we should wait until the updated table  
sync data has been fetched by the subscriber.  

M src/test/subscription/t/008_diff_schema.pl

doc: Clarify documentation about SSL passphrases

commit   : d2d4c35080026ba3da49583e30c1fd53c9fb22dd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Nov 2019 10:13:14 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Nov 2019 10:13:14 +0100    

Click here for diff

The previous statement that using a passphrase disables the ability to  
change the server's SSL configuration without a server restart was no  
longer completely true since the introduction of  
ssl_passphrase_command_supports_reload.  

M doc/src/sgml/runtime.sgml

doc: Further tweak recovery parameters documentation

commit   : 27b59d619ddfb512e3f158a87f557a46f2d5794f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Nov 2019 09:35:21 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Nov 2019 09:35:21 +0100    

Click here for diff

Remove one sentence that was deemed misleading.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1iEgSp-0004R5-2E%40gemulon.postgresql.org  

M doc/src/sgml/config.sgml

Fix negative bitmapset member not allowed error in logical replication

commit   : 1c60e40ad54b18685436443da3c56a7018a35475    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Nov 2019 13:48:59 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Nov 2019 13:48:59 +0100    

Click here for diff

This happens when we add a replica identity column on a subscriber  
that does not yet exist on the publisher, according to the mapping  
maintained by the subscriber.  Code that checks whether the target  
relation on the subscriber is updatable would check the replica  
identity attribute bitmap with a column number -1, which would result  
in an error.  To fix, skip such columns in the bitmap lookup and  
consider the relation not updatable.  The result is consistent with  
the rule that the replica identity columns on the subscriber must be a  
subset of those on the publisher, since if the column doesn't exist on  
the publisher, the column set on the subscriber can't be a subset.  
  
Reported-by: Tim Clarke <tim.clarke@minerva.info>  
Analyzed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Discussion: https://www.postgresql.org/message-id/flat/a9139c29-7ddd-973b-aa7f-71fed9c38d75%40minerva.info  

M src/backend/replication/logical/relation.c
M src/test/subscription/t/008_diff_schema.pl

Fix new COPY test of PL/pgSQL with VPATH builds

commit   : 943b447d303e6d0a7635d39ac552550b77b96cef    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 9 Nov 2019 15:41:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 9 Nov 2019 15:41:34 +0900    

Click here for diff

The buildfarm has turned red after 1858b10 because VPATH builds need to  
use "@abs_srcdir@" and not "@abs_builddir@" for paths coming directly  
from the source tree.  The input file of the new test got that right,  
but not the output file.  
  
Per complaints from several buildfarm animals, including desmoxytes and  
culicidae.  I have also reproduced the error by myself.  

M src/pl/plpgsql/src/output/plpgsql_copy.source

Add tests for COPY in PL/pgSQL

commit   : 1858b105b05fcded43e9f2b767dec7268431043b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 9 Nov 2019 14:50:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 9 Nov 2019 14:50:20 +0900    

Click here for diff

This stresses the error handling of COPY inside SPI which does not  
support the operation using stdin or stdout, and these scenarios were  
not tested up to now.  
  
Author: Mark Dilger  
Discussion: https://postgr.es/m/a6e9b130-7fd5-387b-4ec5-89bda24373ab@gmail.com  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/data/copy1.data
A src/pl/plpgsql/src/expected/.gitignore
A src/pl/plpgsql/src/input/plpgsql_copy.source
A src/pl/plpgsql/src/output/plpgsql_copy.source
A src/pl/plpgsql/src/sql/.gitignore

Pass ItemPointer not HeapTuple to IndexBuildCallback.

commit   : aae50236e4ce95c05a3962be0814c74c5a22206d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 8 Nov 2019 00:44:52 -0800    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 8 Nov 2019 00:44:52 -0800    

Click here for diff

Not all AMs use HeapTuples internally, making it inconvenient to pass  
a HeapTuple. As the index callbacks really only need the TID, not the  
full tuple, modify callback to only take ItemPointer.  
  
Author: Ashwin Agrawal  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CALfoeis6=8ehuR=VNtHvj3z16cYfCwPdTcpaxU+sfSUJ5QgR3g@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/bloom/blinsert.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/include/access/tableam.h

Add backtrace support for error reporting

commit   : 71a8a4f6e36547bb060dbcc961ea9b57420f7190    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 8 Nov 2019 15:44:20 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 8 Nov 2019 15:44:20 -0300    

Click here for diff

Add some support for automatically showing backtraces in certain error  
situations in the server.  Backtraces are shown on assertion failure;  
also, a new setting backtrace_functions can be set to a list of C  
function names, and all ereport()s and elog()s from the mentioned  
functions will have backtraces generated.  Finally, the function  
errbacktrace() can be manually added to an ereport() call to generate a  
backtrace for that call.  
  
Authors: Peter Eisentraut, Álvaro Herrera  
Discussion: https://postgr.es/m//5f48cb47-bf1e-05b6-7aae-3bf2cd01586d@2ndquadrant.com  
Discussion: https://postgr.es/m/CAMsr+YGL+yfWE=JvbUbnpWtrRZNey7hJ07+zT4bYJdVp4Szdrg@mail.gmail.com  

M configure
M configure.in
M doc/src/sgml/config.sgml
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/include/pg_config.h.in
M src/include/utils/elog.h
M src/include/utils/guc.h

Fix gratuitous error message variation

commit   : 3dcffb381c81c9c8f8254100feacac256b9e75a6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Nov 2019 18:12:51 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Nov 2019 18:12:51 +0100    

Click here for diff

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

postgres_fdw: Fix error message for PREPARE TRANSACTION.

commit   : 879c1176157175e0a83742b810f137aebccef4a4    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 8 Nov 2019 17:00:30 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 8 Nov 2019 17:00:30 +0900    

Click here for diff

Currently, postgres_fdw does not support preparing a remote transaction  
for two-phase commit even in the case where the remote transaction is  
read-only, but the old error message appeared to imply that that was not  
supported only if the remote transaction modified remote tables.  Change  
the message so as to include the case where the remote transaction is  
read-only.  
  
Also fix a comment above the message.  
  
Also add a note about the lack of supporting PREPARE TRANSACTION to the  
postgres_fdw documentation.  
  
Reported-by: Gilles Darold  
Author: Gilles Darold and Etsuro Fujita  
Reviewed-by: Michael Paquier and Kyotaro Horiguchi  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/08600ed3-3084-be70-65ba-279ab19618a5%40darold.net  

M contrib/postgres_fdw/connection.c
M doc/src/sgml/postgres-fdw.sgml

More precise errors from initial pg_control check

commit   : b85e43feb3e837699239aba6b8e0f280a59417be    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Nov 2019 08:03:16 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Nov 2019 08:03:16 +0100    

Click here for diff

Use a separate error message for invalid checkpoint location and  
invalid state instead of just "invalid data" for both.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/20191107041630.GK1768@paquier.xyz  

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

Use "low key" terminology in nbtsort.c.

commit   : e86c8ef243aad4570f66a406c81211f75774ced1    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 7 Nov 2019 17:12:09 -0800    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 7 Nov 2019 17:12:09 -0800    

Click here for diff

nbtree index builds once stashed the "minimum key" for a page, which was  
used as the basis of the pivot tuple that gets placed in the next level  
up (i.e. the tuple that stores the downlink to the page in question).  
It doesn't quite work that way anymore, so the "minimum key" terminology  
now seems misleading (these days the minimum key is actually a straight  
copy of the high key from the left sibling, which is a distinct thing in  
subtle but important ways).  Rename this concept to "low key".  This  
name is a lot clearer given that there is now a sharp distinction  
between pivot and non-pivot tuples.  Also remove comments that describe  
obsolete details about how the minimum key concept used to work.  
  
Rather than generating the minus infinity item for the leftmost page on  
a level by copying the new item and truncating that copy, simply  
allocate a small buffer.  The old approach confusingly created the  
impression that the new item had some kind of significance.  This was  
another artifact of how things used to work before commits 8224de4f and  
dd299df8.  

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

docs: clarify that only INSERT and UPDATE triggers can mod. NEW

commit   : c10fae21428fe926568e67b7662ed8577faf9235    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 Nov 2019 15:50:00 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 Nov 2019 15:50:00 -0500    

Click here for diff

The point is that DELETE triggers cannot modify any values.  
  
Reported-by: Eugen Konkov  
  
Discussion: https://postgr.es/m/919823407.20191029175436@yandex.ru  
  
Backpatch-through: 9.4  

M doc/src/sgml/trigger.sgml

Move declaration of ecpg_gettext() to a saner place.

commit   : c8cb98ec41f0c41ac3b4c3e8be01f12c4c53d3aa    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Nov 2019 14:21:52 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Nov 2019 14:21:52 -0500    

Click here for diff

Declaring this in the client-visible header ecpglib.h was a pretty  
poor decision.  It's not meant to be application-callable (and if  
it was, putting it outside the extern "C" { ... } wrapper means  
that C++ clients would fail to call it).  And the declaration would  
not even compile for a client, anyway, since it would not have the  
macro pg_attribute_format_arg().  Fortunately, it seems that no  
clients have tried to include this header with ENABLE_NLS defined,  
or we'd have gotten complaints about that.  But we have no business  
putting such a restriction on client code.  
  
Move the declaration to ecpglib_extern.h, since in fact nothing  
outside src/interfaces/ecpg/ecpglib/ needs to call it.  
  
The practical effect of this is just that clients can now safely  
#include ecpglib.h while having ENABLE_NLS defined, but that seems  
like enough of a reason to back-patch it.  
  
Discussion: https://postgr.es/m/20590.1573069709@sss.pgh.pa.us  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/include/ecpglib.h

Fix SET CONSTRAINTS .. DEFERRED on partitioned tables

commit   : b4bcc6bfdfa2b564b0171d437f9988a3159fd58d    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Nov 2019 13:59:24 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Nov 2019 13:59:24 -0300    

Click here for diff

SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a  
sanity check that ensures that the affected constraints have triggers.  
On partitioned tables, the triggers are in the leaf partitions, not in  
the partitioned relations themselves, so the sanity check fails.  
Removing the sanity check solves the problem, because the code needed to  
support the case is already there.  
  
Backpatch to 11.  
  
Note: deferred unique constraints are not affected by this bug, because  
they do have triggers in the parent partitioned table.  I did not add a  
test for this scenario.  
  
Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql  

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

Fix integer-overflow edge case detection in interval_mul and pgbench.

commit   : a7145f6bc8b7774a29f3841552a463fb20ea98d7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Nov 2019 11:22:52 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Nov 2019 11:22:52 -0500    

Click here for diff

This patch adopts the overflow check logic introduced by commit cbdb8b4c0  
into two more places.  interval_mul() failed to notice if it computed a  
new microseconds value that was one more than INT64_MAX, and pgbench's  
double-to-int64 logic had the same sorts of edge-case problems that  
cbdb8b4c0 fixed in the core code.  
  
To make this easier to get right in future, put the guts of the checks  
into new macros in c.h, and add commentary about how to use the macros  
correctly.  
  
Back-patch to all supported branches, as we did with the previous fix.  
  
Yuya Watari  
  
Discussion: https://postgr.es/m/CAJ2pMkbkkFw2hb9Qb1Zj8d06EhWAQXFLy73St4qWv6aX=vqnjw@mail.gmail.com  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/timestamp.c
M src/bin/pgbench/pgbench.c
M src/include/c.h
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Remove HAVE_LONG_LONG_INT

commit   : effa40281bb1f6c71e81c980f86852ab3be603c3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Nov 2019 13:30:04 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Nov 2019 13:30:04 +0100    

Click here for diff

The presence of long long int is now implied in the requirement for  
C99 and the configure check for the same.  
  
We keep the define hard-coded in ecpg_config.h for backward  
compatibility with ecpg-using user code.  
  
Discussion: https://www.postgresql.org/message-id/flat/5cdd6a2b-b2c7-c6f6-344c-a406d5c1a254%402ndquadrant.com  

M configure
M configure.in
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpg_config.h.in
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/sql/sqlda.pgc

Fix nested error handling in PG_FINALLY

commit   : 581a55889ba7f76dd87a270e37e5137f684bfdb7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Nov 2019 09:54:09 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Nov 2019 09:54:09 +0100    

Click here for diff

We need to pop the error stack before running the user-supplied  
PG_FINALLY code.  Otherwise an error in the cleanup code would end up  
at the same sigsetjmp() invocation and result in an infinite error  
handling loop.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com  

M src/backend/utils/adt/xml.c
M src/include/utils/elog.h

Fix assertion failure when running pgbench -s.

commit   : a0c96856e8b38a102daac76e3d385d9f8876744e    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 7 Nov 2019 16:31:36 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 7 Nov 2019 16:31:36 +0900    

Click here for diff

If there is the WAL page that the continuation WAL record just fits within  
(i.e., the continuation record ends just at the end of the page) and  
the LSN in such page is specified with -s option, previously pg_waldump  
caused an assertion failure. The cause of this assertion failure was that  
XLogFindNextRecord() that pg_waldump -s calls mistakenly handled  
such special WAL page.  
  
This commit changes XLogFindNextRecord() so that it can handle  
such WAL page correctly.  
  
Back-patch to all supported versions.  
  
Author: Andrey Lepikhov  
Reviewed-by: Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/99303554-5dd5-06e6-f943-b3005ccd6edd@postgrespro.ru  

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

Add reusable routine for making arrays unique.

commit   : 7815e7efdb4ce9575b5d8460beb0dd2569d7ca3a    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Nov 2019 16:51:04 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Nov 2019 16:51:04 +1300    

Click here for diff

Introduce qunique() and qunique_arg(), which can be used after qsort()  
and qsort_arg() respectively to remove duplicate values.  Use it where  
appropriate.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane (in an earlier version)  
Discussion: https://postgr.es/m/CAEepm%3D2vmFTNpAmwbGGD2WaryM6T3hSDVKQPfUwjdD_5XY6vAA%40mail.gmail.com  

M contrib/hstore/hstore_io.c
M contrib/intarray/_int_tool.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/txid.c
M src/backend/utils/cache/syscache.c
A src/include/lib/qunique.h

Check after errors of SPI_execute() in xml.c

commit   : 3feb6ace7cfe8edbf6db702de06dc9295f307a8e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Nov 2019 11:13:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Nov 2019 11:13:31 +0900    

Click here for diff

SPI gets used to build a list of relation OIDs for XML object  
generation, and one code path building a list uses SPI_execute() without  
looking at errors it produces.  So fix that.  
  
Author: Mark Dilger  
Reviewed-by: Michael Paquier, Pavel Stehule  
Discussion: https://postgr.es/m/17d30445-4862-7917-170f-84328dcd292d@gmail.com  

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

Allow sampling of statements depending on duration

commit   : 6e3e6cc0e884a6091e1094dff29db430af08fb93    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 4 Nov 2019 01:57:45 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 4 Nov 2019 01:57:45 +0100    

Click here for diff

This allows logging a sample of statements, without incurring excessive  
log traffic (which may impact performance).  This can be useful when  
analyzing workloads with lots of short queries.  
  
The sampling is configured using two new GUC parameters:  
  
 * log_min_duration_sample - minimum required statement duration  
  
 * log_statement_sample_rate - sample rate (0.0 - 1.0)  
  
Only statements with duration exceeding log_min_duration_sample are  
considered for sampling. To enable sampling, both those GUCs have to  
be set correctly.  
  
The existing log_min_duration_statement GUC has a higher priority, i.e.  
statements with duration exceeding log_min_duration_statement will be  
always logged, irrespectedly of how the sampling is configured. This  
means only configurations  
  
  log_min_duration_sample < log_min_duration_statement  
  
do actually sample the statements, instead of logging everything.  
  
Author: Adrien Nayrat  
Reviewed-by: David Rowley, Vik Fearing, Tomas Vondra  
Discussion: https://postgr.es/m/bbe0a1a8-a8f7-3be2-155a-888e661cc06c@anayrat.info  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h

Document log_transaction_sample_rate as superuser-only

commit   : 11d9ac28e5e0077d8f23761c2962a30423f44cee    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 4 Nov 2019 02:00:26 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 4 Nov 2019 02:00:26 +0100    

Click here for diff

The docs do say which GUCs can be changed only by superusers, but we  
forgot to mention this for the new log_transaction_sample_rate. This  
GUC was introduced in PostgreSQL 12, so backpatch accordingly.  
  
Author: Adrien Nayrat  
Backpatch-through: 12  

M doc/src/sgml/config.sgml

Minor code review for tuple slot rewrite.

commit   : 22e44e8dbcfe4b9f3c4189f07a2361c951d72514    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Nov 2019 12:00:17 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Nov 2019 12:00:17 -0500    

Click here for diff

Avoid creating transiently-inconsistent slot states where possible,  
by not setting TTS_FLAG_SHOULDFREE until after the slot actually has  
a free'able tuple pointer, and by making sure that we reset tts_nvalid  
and related derived state before we replace the tuple contents.  This  
would only matter if something were to examine the slot after we'd  
suffered some kind of error (e.g. out of memory) while manipulating  
the slot.  We typically don't do that, so these changes might just be  
cosmetic --- but even if so, it seems like good future-proofing.  
  
Also remove some redundant Asserts, and add a couple for consistency.  
  
Back-patch to v12 where all this code was rewritten.  
  
Discussion: https://postgr.es/m/16095-c3ff2e5283b8dba5@postgresql.org  

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

Sync our DTrace infrastructure with c.h's definition of type bool.

commit   : ff43b3e88eceb94b3a2b2579e8510e4f3aedbe09    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Nov 2019 11:11:40 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Nov 2019 11:11:40 -0500    

Click here for diff

Since commit d26a810eb, we've defined bool as being either _Bool from  
<stdbool.h>, or "unsigned char"; but that commit overlooked the fact  
that probes.d has "#define bool char".  For consistency, make it say  
"unsigned char" instead.  This should be strictly a cosmetic change,  
but it seems best to be in sync.  
  
Formally, in the now-normal case where we're using <stdbool.h>, it'd  
be better to write "#define bool _Bool".  However, then we'd need  
some build infrastructure to inject that configuration choice into  
probes.d, and it doesn't seem worth the trouble.  We only use  
<stdbool.h> if sizeof(_Bool) is 1, so having DTrace think that  
bool parameters are "unsigned char" should be close enough.  
  
Back-patch to v12 where d26a810eb came in.  
  
Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/probes.d

Fix memory allocation mistake

commit   : d40abd5fcfb25d764419f8e9bffa5cdbdb247c1b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Nov 2019 14:20:29 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Nov 2019 14:20:29 +0100    

Click here for diff

The previous code was allocating more memory than necessary because  
the formula used the wrong data type.  
  
Reported-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Discussion: https://www.postgresql.org/message-id/20191105172918.3e32a446@firost  

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

Remove unused function argument

commit   : 5b7ba75f7ff854003231e8099e3038c7e2eba875    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Nov 2019 08:07:04 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Nov 2019 08:07:04 +0100    

Click here for diff

The cache_plan argument to ri_PlanCheck has not been used since  
e8c9fd5fdf768323911f7088e8287f63b513c3c6.  
  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/ec8a8b45-a30b-9193-cd4b-985d60d1497e%402ndquadrant.com  

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

Fix timestamp of sent message for write context in logical decoding

commit   : 5f6b1eb0cf4b0fb101478da51c294a63fd4726ef    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 6 Nov 2019 16:12:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 6 Nov 2019 16:12:21 +0900    

Click here for diff

When sending data for logical decoding using the streaming replication  
protocol via a WAL sender, the timestamp of the sent write message is  
allocated at the beginning of the message when preparing for the write,  
and actually computed when the write message is ready to be sent.  
  
The timestamp was getting computed after sending the message.  This  
impacts anything using logical decoding, causing for example logical  
replication to report mostly NULL for last_msg_send_time in  
pg_stat_subscription.  
  
This commit makes sure that the timestamp is computed before sending the  
message.  This is wrong since 5a991ef, so backpatch down to 9.4.  
  
Author: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1z=WMn8jt7iEdC5sYNaPgAgOASb_OW5JYv-vMdYaJSL-w@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/replication/walsender.c

Request small targetlist for input to WindowAgg.

commit   : a9056cc637f2d183eefa165ebbd0308d9a89abb9    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Wed, 6 Nov 2019 04:13:30 +0000    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Wed, 6 Nov 2019 04:13:30 +0000    

Click here for diff

WindowAgg will potentially store large numbers of input rows into  
tuplestores to allow access to other rows in the frame. If the input  
is coming via an explicit Sort node, then unneeded columns will  
already have been discarded (since Sort requests a small tlist); but  
there are idioms like COUNT(*) OVER () that result in the input not  
being sorted at all, and cases where the input is being sorted by some  
means other than a Sort; if we don't request a small tlist, then  
WindowAgg's storage requirement is inflated by the unneeded columns.  
  
Backpatch back to 9.6, where the current tlist handling was added.  
(Prior to that, WindowAgg would always use a small tlist.)  
  
Discussion: https://postgr.es/m/87a7ator8n.fsf@news-spur.riddles.org.uk  

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

Correct the command tags for ALTER ... RENAME COLUMN.

commit   : 979766c0afceb95c4b96323b57a0f6edf8472612    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 6 Nov 2019 12:54:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 6 Nov 2019 12:54:17 +0900    

Click here for diff

Previously ALTER MATERIALIZED VIEW / FOREIGN TABLE ... RENAME COLUMN ...  
returned "ALTER TABLE" as a command tag. This commit fixes them so that  
they return "ALTER MATERIALIZED VIEW" and "ALTER FOREIGN TABLE" as  
command tags, respectively.  
  
This issue exists in all supported versions, but we don't back-patch this  
because it's not enough of a bug to justify taking any compatibility risks for.  
Otherwise, the back-patch would cause minor version update to break,  
for example, the existing event trigger functions using TG_TAG.  
  
Author: Fujii Masao  
Reviewed-by: Ibrar Ahmed  
Discussion: https://postgr.es/m/CAHGQGwGUaC03FFdTFoHsCuDrrNvFvNVQ6xyd40==P25WvuBJjg@mail.gmail.com  

M src/backend/tcop/utility.c

Add "G" (server-side data generation) as an initialization step in pgbench.

commit   : a386942bd29b0ef0c9df061392659880d22cdf43    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 6 Nov 2019 11:02:30 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 6 Nov 2019 11:02:30 +0900    

Click here for diff

This commit allows --init-steps option in pgbench to accept "G" character  
meaning server-side data generation as an initialization step.  
With "G", only limited queries are sent from pgbench client and  
then data is actually generated in the server. This might make  
the initialization phase faster if the bandwidth between pgbench client  
and the server is low.  
  
Author: Fabien Coelho  
Reviewed-by: Anna Endo, Ibrar Ahmed, Fujii Masao  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904061826420.3678@lancre  

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

doc: fix plurality typo on bgwriter doc sentence

commit   : 4b5e58b86e3b09daa7384dbbd0bb4cacbd9bd7c6    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 5 Nov 2019 20:54:04 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 5 Nov 2019 20:54:04 -0500    

Click here for diff

Reported-by: matthew.alton@gmail.com  
  
Discussion: https://postgr.es/m/157204060717.1042.8194076510523669244@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

M doc/src/sgml/bgworker.sgml

Make StringInfo available to frontend code.

commit   : 26aaf97b683d6258c098859e6b1268e1f5da242f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 5 Nov 2019 14:56:40 -0800    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 5 Nov 2019 14:56:40 -0800    

Click here for diff

There's plenty places in frontend code that could benefit from a  
string buffer implementation. Some because it yields simpler and  
faster code, and some others because of the desire to share code  
between backend and frontend.  
  
While there is a string buffer implementation available to frontend  
code, libpq's PQExpBuffer, it is clunkier than stringinfo, it  
introduces a libpq dependency, doesn't allow for sharing between  
frontend and backend code, and has a higher API/ABI stability  
requirement due to being exposed via libpq.  
  
Therefore it seems best to just making StringInfo being usable by  
frontend code. There's not much to do for that, except for rewriting  
two subsequent elog/ereport calls into others types of error  
reporting, and deciding on a maximum string length.  
  
For the maximum string size I decided to privately define MaxAllocSize  
to the same value as used in the backend. It seems likely that we'll  
want to reconsider this for both backend and frontend code in the not  
too far away future.  
  
For now I've left stringinfo.h in lib/, rather than common/, to reduce  
the likelihood of unnecessary breakage. We could alternatively decide  
to provide a redirecting stringinfo.h in lib/, or just not provide  
compatibility.  
  
Author: Andres Freund  
Reviewed-By: Kyotaro Horiguchi, Daniel Gustafsson  
Discussion: https://postgr.es/m/20190920051857.2fhnvhvx4qdddviz@alap3.anarazel.de  

M src/backend/lib/Makefile
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/common/Makefile
R086 src/backend/lib/stringinfo.c src/common/stringinfo.c
M src/include/lib/stringinfo.h
M src/tools/msvc/Mkvcbuild.pm

Split all OBJS style lines in makefiles into one-line-per-entry style.

commit   : 01368e5d9da77099b38aac527b01b85cc7869b25    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 5 Nov 2019 14:41:07 -0800    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 5 Nov 2019 14:41:07 -0800    

Click here for diff

When maintaining or merging patches, one of the most common sources  
for conflicts are the list of objects in makefiles. Especially when  
the split across lines has been changed on both sides, which is  
somewhat common due to attempting to stay below 80 columns, those  
conflicts are unnecessarily laborious to resolve.  
  
By splitting, and alphabetically sorting, OBJS style lines into one  
object per line, conflicts should be less frequent, and easier to  
resolve when they still occur.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20191029200901.vww4idgcxv74cwes@alap3.anarazel.de  

M contrib/adminpack/Makefile
M contrib/amcheck/Makefile
M contrib/auto_explain/Makefile
M contrib/bloom/Makefile
M contrib/btree_gin/Makefile
M contrib/btree_gist/Makefile
M contrib/cube/Makefile
M contrib/dblink/Makefile
M contrib/dict_int/Makefile
M contrib/dict_xsyn/Makefile
M contrib/fuzzystrmatch/Makefile
M contrib/hstore/Makefile
M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/intarray/Makefile
M contrib/jsonb_plperl/Makefile
M contrib/jsonb_plpython/Makefile
M contrib/ltree/Makefile
M contrib/ltree_plpython/Makefile
M contrib/oid2name/Makefile
M contrib/pageinspect/Makefile
M contrib/passwordcheck/Makefile
M contrib/pg_buffercache/Makefile
M contrib/pg_freespacemap/Makefile
M contrib/pg_prewarm/Makefile
M contrib/pg_standby/Makefile
M contrib/pg_stat_statements/Makefile
M contrib/pg_trgm/Makefile
M contrib/pg_visibility/Makefile
M contrib/pgcrypto/Makefile
M contrib/pgrowlocks/Makefile
M contrib/pgstattuple/Makefile
M contrib/postgres_fdw/Makefile
M contrib/seg/Makefile
M contrib/sepgsql/Makefile
M contrib/sslinfo/Makefile
M contrib/tsm_system_rows/Makefile
M contrib/tsm_system_time/Makefile
M contrib/unaccent/Makefile
M contrib/uuid-ossp/Makefile
M contrib/vacuumlo/Makefile
M contrib/xml2/Makefile
M src/backend/Makefile
M src/backend/access/brin/Makefile
M src/backend/access/common/Makefile
M src/backend/access/gin/Makefile
M src/backend/access/gist/Makefile
M src/backend/access/hash/Makefile
M src/backend/access/heap/Makefile
M src/backend/access/index/Makefile
M src/backend/access/nbtree/Makefile
M src/backend/access/rmgrdesc/Makefile
M src/backend/access/spgist/Makefile
M src/backend/access/table/Makefile
M src/backend/access/tablesample/Makefile
M src/backend/access/transam/Makefile
M src/backend/bootstrap/Makefile
M src/backend/catalog/Makefile
M src/backend/commands/Makefile
M src/backend/executor/Makefile
M src/backend/foreign/Makefile
M src/backend/jit/Makefile
M src/backend/jit/llvm/Makefile
M src/backend/lib/Makefile
M src/backend/libpq/Makefile
M src/backend/main/Makefile
M src/backend/nodes/Makefile
M src/backend/optimizer/geqo/Makefile
M src/backend/optimizer/path/Makefile
M src/backend/optimizer/plan/Makefile
M src/backend/optimizer/prep/Makefile
M src/backend/optimizer/util/Makefile
M src/backend/parser/Makefile
M src/backend/partitioning/Makefile
M src/backend/port/Makefile
M src/backend/port/win32/Makefile
M src/backend/postmaster/Makefile
M src/backend/regex/Makefile
M src/backend/replication/Makefile
M src/backend/replication/libpqwalreceiver/Makefile
M src/backend/replication/logical/Makefile
M src/backend/replication/pgoutput/Makefile
M src/backend/rewrite/Makefile
M src/backend/snowball/Makefile
M src/backend/statistics/Makefile
M src/backend/storage/buffer/Makefile
M src/backend/storage/file/Makefile
M src/backend/storage/freespace/Makefile
M src/backend/storage/ipc/Makefile
M src/backend/storage/large_object/Makefile
M src/backend/storage/lmgr/Makefile
M src/backend/storage/page/Makefile
M src/backend/storage/smgr/Makefile
M src/backend/storage/sync/Makefile
M src/backend/tcop/Makefile
M src/backend/tsearch/Makefile
M src/backend/utils/adt/Makefile
M src/backend/utils/cache/Makefile
M src/backend/utils/error/Makefile
M src/backend/utils/fmgr/Makefile
M src/backend/utils/hash/Makefile
M src/backend/utils/init/Makefile
M src/backend/utils/mb/Makefile
M src/backend/utils/misc/Makefile
M src/backend/utils/mmgr/Makefile
M src/backend/utils/resowner/Makefile
M src/backend/utils/sort/Makefile
M src/backend/utils/time/Makefile
M src/bin/initdb/Makefile
M src/bin/pg_archivecleanup/Makefile
M src/bin/pg_basebackup/Makefile
M src/bin/pg_checksums/Makefile
M src/bin/pg_config/Makefile
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_dump/Makefile
M src/bin/pg_resetwal/Makefile
M src/bin/pg_rewind/Makefile
M src/bin/pg_test_fsync/Makefile
M src/bin/pg_test_timing/Makefile
M src/bin/pg_upgrade/Makefile
M src/bin/pg_waldump/Makefile
M src/bin/pgbench/Makefile
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/common/Makefile
M src/fe_utils/Makefile
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/libpq/Makefile
M src/pl/plpgsql/src/Makefile
M src/pl/tcl/Makefile
M src/port/Makefile
M src/test/isolation/Makefile
M src/test/modules/test_bloomfilter/Makefile
M src/test/modules/test_ginpostinglist/Makefile
M src/test/modules/test_integerset/Makefile
M src/test/modules/test_parser/Makefile
M src/test/modules/test_predtest/Makefile
M src/test/modules/test_rbtree/Makefile
M src/test/modules/test_rls_hooks/Makefile
M src/test/modules/test_shm_mq/Makefile
M src/timezone/Makefile
M src/tools/findoidjoins/Makefile
M src/tools/ifaddrs/Makefile

Tweak some authentication debug messages to follow project style.

commit   : 66c61c81b90c68db84d422092fbbf8a1a82ee09a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 14:29:08 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 14:29:08 -0500    

Click here for diff

Avoid initial capital, since that's not how we do it.  
  
Discussion: https://postgr.es/m/CACP=ajbrFFYUrLyJBLV8=q+eNCapa1xDEyvXhMoYrNphs-xqPw@mail.gmail.com  

M src/backend/libpq/auth.c

Avoid logging complaints about abandoned connections when using PAM.

commit   : 3affe76ef8227dad85b61cec769235f682132651    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 14:27:37 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 14:27:37 -0500    

Click here for diff

For a long time (since commit aed378e8d) we have had a policy to log  
nothing about a connection if the client disconnects when challenged  
for a password.  This is because libpq-using clients will typically  
do that, and then come back for a new connection attempt once they've  
collected a password from their user, so that logging the abandoned  
connection attempt will just result in log spam.  However, this did  
not work well for PAM authentication: the bottom-level function  
pam_passwd_conv_proc() was on board with it, but we logged messages  
at higher levels anyway, for lack of any reporting mechanism.  
Add a flag and tweak the logic so that the case is silent, as it is  
for other password-using auth mechanisms.  
  
Per complaint from Yoann La Cancellera.  It's been like this for awhile,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CACP=ajbrFFYUrLyJBLV8=q+eNCapa1xDEyvXhMoYrNphs-xqPw@mail.gmail.com  

M src/backend/libpq/auth.c

Fix "unexpected relkind" error when denying permissions on toast tables.

commit   : a30531c5c8a384363d410d4027e1c1eeed76e550    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 13:40:37 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 13:40:37 -0500    

Click here for diff

get_relkind_objtype, and hence get_object_type, failed when applied to a  
toast table.  This is not a good thing, because it prevents reporting of  
perfectly legitimate permissions errors.  (At present, these functions  
are in fact *only* used to determine the ObjectType argument for  
acl_error() calls.)  It seems best to have them fall back to returning  
OBJECT_TABLE in every case where they can't determine an object type  
for a pg_class entry, so do that.  
  
In passing, make some edits to alter.c to make it more obvious that  
those calls of get_object_type() are used only for error reporting.  
This might save a few cycles in the non-error code path, too.  
  
Back-patch to v11 where this issue originated.  
  
John Hsu, Michael Paquier, Tom Lane  
  
Discussion: https://postgr.es/m/C652D3DF-2B0C-4128-9420-FB5379F6B1E4@amazon.com  

M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Generate EquivalenceClass members for partitionwise child join rels.

commit   : 529ebb20aaa5eb68e4fb7a656271bbb83efe9529    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 11:42:24 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Nov 2019 11:42:24 -0500    

Click here for diff

Commit d25ea0127 got rid of what I thought were entirely unnecessary  
derived child expressions in EquivalenceClasses for EC members that  
mention multiple baserels.  But it turns out that some of the child  
expressions that code created are necessary for partitionwise joins,  
else we fail to find matching pathkeys for Sort nodes.  (This happens  
only for certain shapes of the resulting plan; it may be that  
partitionwise aggregation is also necessary to show the failure,  
though I'm not sure of that.)  
  
Reverting that commit entirely would be quite painful performance-wise  
for large partition sets.  So instead, add code that explicitly  
generates child expressions that match only partitionwise child join  
rels we have actually generated.  
  
Per report from Justin Pryzby.  (Amit Langote noticed the problem  
earlier, though it's not clear if he recognized then that it could  
result in a planner error, not merely failure to exploit partitionwise  
join, in the code as-committed.)  Back-patch to v12 where commit  
d25ea0127 came in.  
  
Amit Langote, with lots of kibitzing from me  
  
Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com  
Discussion: https://postgr.es/m/20191011143703.GN10470@telsasoft.com  

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

Doc: Clarify locks taken when using ALTER TABLE ATTACH PARTITION

commit   : 2a4d96ebbd65be9aa421a8a4550a51ff12bc6d2d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Nov 2019 10:32:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Nov 2019 10:32:38 +0900    

Click here for diff

Since 898e5e32, this command uses partially ShareUpdateExclusiveLock,  
but the docs did not get the call.  
  
Author: Justin Pryzby  
Reviewed-by: Amit Langote, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/20191028001207.GB23808@telsasoft.com  
Backpatch-through: 12  

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

Doc: Improve description around ALTER TABLE ATTACH PARTITION

commit   : ea881338014fd5c7d864d78d2eb441d784d1cc39    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Nov 2019 10:17:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Nov 2019 10:17:33 +0900    

Click here for diff

This clarifies more how to use and how to take advantage of constraints  
when attaching a new partition.  
  
Author: Justin Pryzby  
Reviewed-by: Amit Langote, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/20191028001207.GB23808@telsasoft.com  
Backpatch-through: 10  

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

Refactor code building relation options

commit   : 3534fa2233285c1fab1e668871aabf05e5541213    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Nov 2019 09:17:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Nov 2019 09:17:05 +0900    

Click here for diff

Historically, the code to build relation options has been shaped the  
same way in multiple code paths by using a set of datums in input with  
the options parsed with a static table which is then filled with the  
option values.  This introduces a new common routine in reloptions.c to  
do most of the legwork for the in-core code paths.  
  
Author: Amit Langote  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CA+HiwqGsoSn_uTPPYT19WrtR7oYpYtv4CdS0xuedTKiHHWuk_g@mail.gmail.com  

M contrib/bloom/blutils.c
M src/backend/access/brin/brin.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistutil.c
M src/include/access/reloptions.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Stabilize pg_dump output order for similarly-named triggers and policies.

commit   : 5102f39440f758ea53c2e1cdea7d8411df1805d2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Nov 2019 16:25:05 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Nov 2019 16:25:05 -0500    

Click here for diff

The code only compared two triggers' names and namespaces (the latter  
being the owning table's schema).  This could result in falling back  
to an OID-based sort of similarly-named triggers on different tables.  
We prefer to avoid that, so add a comparison of the table names too.  
(The sort order is thus table namespace, trigger name, table name,  
which is a bit odd, but it doesn't seem worth contorting the code  
to work around that.)  
  
Likewise for policy objects, in 9.5 and up.  
  
Complaint and fix by Benjie Gillam.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CAMThMzEEt2mvBbPgCaZ1Ap1N-moGn=Edxmadddjq89WG4NpPtQ@mail.gmail.com  

M src/bin/pg_dump/pg_dump_sort.c

Fix ginEntryInsert's counting of GIN leaf tuples.

commit   : ec28808ba85853fa14b090199236ca555273607e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Nov 2019 14:16:42 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Nov 2019 14:16:42 -0500    

Click here for diff

As the code stands, nEntries counts the number of ginEntryInsert()  
calls, so that's what you end up with at the end of a GIN index build.  
However, ginvacuumcleanup() recomputes nEntries as the number of  
surviving leaf tuples, and that's generally consistent with the way that  
gincostestimate() uses the value.  So let's clearly define nEntries  
as the number of leaf tuples, and therefore adjust ginEntryInsert() to  
increment it only when we make a new one, not when we add TIDs into an  
existing tuple or posting tree.  
  
In practice this inconsistency probably has little impact, so I don't  
feel a need to back-patch.  
  
Insung Moon and Keisuke Kuroda  
  
Discussion: https://postgr.es/m/CAEMmqBuH_O-oXL+3_ArQ6F5cJ7kXVow2SGQB3HRacku_T+xkmA@mail.gmail.com  

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

Fix some compiler warnings on older compilers

commit   : a63c84e59acf9f5e2b54aad4974a80e5075af646    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 Nov 2019 11:07:32 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 Nov 2019 11:07:32 +0100    

Click here for diff

Some older compilers appear to not understand the recently introduced  
PG_FINALLY code structure that well in some circumstances and complain  
about possibly uninitialized variables.  So to fix, initialize the  
variables explicitly in the cases complained about.  
  
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com  

M src/backend/utils/adt/xml.c
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c

Catch invalid typlens in a couple of places

commit   : 8557a6f10ca6f01f4b2f2f25e197292f3f46bb5c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 Nov 2019 08:30:00 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 Nov 2019 08:30:00 +0100    

Click here for diff

Rearrange the logic in record_image_cmp() and datum_image_eq() to  
error out on unexpected typlens (either not supported there or  
completely invalid due to corruption).  Barring corruption, this is  
not possible today but it seems more future-proof and robust to fix  
this.  
  
Reported-by: Peter Geoghegan <pg@bowt.ie>  

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

Suppress warning from older compilers.

commit   : db27b60f07a039e236738fe90bd4215cafd35cf2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 3 Nov 2019 16:10:23 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 3 Nov 2019 16:10:23 -0500    

Click here for diff

Commit 8af1624e3 introduced a warning about possibly returning  
without a value, on compilers that don't realize that ereport(ERROR)  
doesn't return.  Tweak the code to avoid that.  
  
Per buildfarm.  Back-patch to 9.6, like the aforesaid commit.  

M src/backend/tsearch/spell.c

Fix PG_GETARG_SEG_P() definition.

commit   : 741b1aaf61a3da10250555f827c0a7a2f9bc2822    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 3 Nov 2019 10:57:49 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 3 Nov 2019 10:57:49 -0500    

Click here for diff

DatumGetPointer() takes a Datum argument, not a pointer.  
This is cosmetic given the current definitions of the  
underlying macros, but it's still formally a type violation.  
  
Bug was introduced in commit 389bb2818, but there seems  
no need to back-patch.  
  
Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/d8jlfsxq3a0.fsf@dalvik.ping.uio.no  

M contrib/seg/seg.c

Validate ispell dictionaries more carefully.

commit   : 8af1624e3f0efd2d029217a91d07bd3795f080a6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 2 Nov 2019 16:45:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 2 Nov 2019 16:45:32 -0400    

Click here for diff

Using incorrect, or just mismatched, dictionary and affix files  
could result in a crash, due to failure to cross-check offsets  
obtained from the file.  Add necessary validation, as well as  
some Asserts for future-proofing.  
  
Per bug #16050 from Alexander Lakhin.  Back-patch to 9.6 where the  
problem was introduced.  
  
Arthur Zakirov, per initial investigation by Tomas Vondra  
  
Discussion: https://postgr.es/m/16050-024ae722464ab604@postgresql.org  
Discussion: https://postgr.es/m/20191013012610.2p2fp3zzpoav7jzf@development  

M src/backend/tsearch/spell.c
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql

Fix failure when creating cloned indexes for a partition

commit   : dc816e5815913e2b2ae2327a4d3e4d4416ed6898    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 2 Nov 2019 14:16:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 2 Nov 2019 14:16:04 +0900    

Click here for diff

When using CREATE TABLE for a new partition, the partitioned indexes of  
the parent are created automatically in a fashion similar to LIKE  
INDEXES.  The new partition and its parent use a mapping for attribute  
numbers for this operation, and while the mapping was correctly built,  
its length was defined as the number of attributes of the newly-created  
child, and not the parent.  If the parent includes dropped columns, this  
could cause failures.  
  
This is wrong since 8b08f7d which has introduced the concept of  
partitioned indexes, so backpatch down to 11.  
  
Reported-by: Wyatt Alt  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/CAGem3qCcRmhbs4jYMkenYNfP2kEusDXvTfw-q+eOhM0zTceG-g@mail.gmail.com  
Backpatch-through: 11  

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

Add some assertions in syncrep.c

commit   : e174f699c476a4cc01875211a5f43e57c3190a37    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Nov 2019 22:51:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Nov 2019 22:51:05 +0900    

Click here for diff

A couple of routines assume that the LWLock SyncRepLock needs to be  
taken, so add a couple of assertions to be sure of that.  Also, when  
waiting for a given LSN at transaction commit, the code implied that the  
syncrep queue cleanup happens while holding interrupts, but the code  
never checked after that.  
  
Author: Michael Paquier  
Reviewed-by: Fujii Masao, Kyotaro Horiguchi, Dongming Liu  
Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com  

M src/backend/replication/syncrep.c

Fix race condition at backend exit when deleting element in syncrep queue

commit   : 20345197ff48c99a8a20dd3cd191d2aad5c7271c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Nov 2019 22:38:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Nov 2019 22:38:32 +0900    

Click here for diff

When a backend exits, it gets deleted from the syncrep queue if present.  
The queue was checked without SyncRepLock taken in exclusive mode, so it  
would have been possible for a backend to remove itself after a WAL  
sender already did the job.  Fix this issue based on a suggestion from  
Fujii Masao, by first checking the queue without the lock.  Then, if the  
backend is present in the queue, take the lock and perform an additional  
lookup check before doing the element deletion.  
  
Author: Dongming Liu  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com  
Backpatch-through: 9.4  

M src/backend/replication/syncrep.c

Add some assertions to view reloption macros

commit   : 396773762425126a85243fc85a267d401496beb8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Nov 2019 13:16:21 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Nov 2019 13:16:21 +0100    

Click here for diff

In these macros, the rd_options pointer is cast to ViewOption *.  Add  
some assertions that the passed-in relation is actually a view before  
doing that.  
  
Author: Nikolay Shaplov <dhyan@nataraj.su>  
Discussion: https://www.postgresql.org/message-id/flat/3634983.eHpMQ1mJnI@x200m  

M src/include/utils/rel.h

PG_FINALLY

commit   : 604bd3671121b51f977de146ed95484c2297fb3e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Nov 2019 11:09:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Nov 2019 11:09:52 +0100    

Click here for diff

This gives an alternative way of catching exceptions, for the common  
case where the cleanup code is the same in the error and non-error  
cases.  So instead of  
  
    PG_TRY();  
    {  
        ... code that might throw ereport(ERROR) ...  
    }  
    PG_CATCH();  
    {  
        cleanup();  
	PG_RE_THROW();  
    }  
    PG_END_TRY();  
    cleanup();  
  
one can write  
  
    PG_TRY();  
    {  
        ... code that might throw ereport(ERROR) ...  
    }  
    PG_FINALLY();  
    {  
        cleanup();  
    }  
    PG_END_TRY();  
  
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com  

M contrib/auto_explain/auto_explain.c
M contrib/dblink/dblink.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/uavc.c
M src/backend/catalog/index.c
M src/backend/commands/async.c
M src/backend/commands/copy.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuum.c
M src/backend/libpq/be-fsstubs.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/xml.c
M src/include/utils/elog.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c

Add const qualifiers to internal range type APIs

commit   : 73025140885c889410b9bfc4a30a3866396fc5db    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 31 Oct 2019 07:41:41 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 31 Oct 2019 07:41:41 +0100    

Click here for diff

Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/dc9b45fa-b950-fadc-4751-85d6f729df55%402ndquadrant.com  

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/include/utils/rangetypes.h

Fix typo in comment of syncrep.c

commit   : f921ea624eb8695c6ccaaf3410b9f9d9926d71c7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 31 Oct 2019 10:22:24 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 31 Oct 2019 10:22:24 +0900    

Click here for diff

Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20191030.123428.18823202335157111.horikyota.ntt@gmail.com  

M src/backend/replication/syncrep.c

Remove one use of IDENT_USERNAME_MAX

commit   : c5e1df951d9d70ab7d53ce47caaf73f3b2d6b1e1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Oct 2019 11:01:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Oct 2019 11:01:44 +0100    

Click here for diff

IDENT_USERNAME_MAX is the maximum length of the information returned  
by an ident server, per RFC 1413.  Using it as the buffer size in peer  
authentication is inappropriate.  It was done here because of the  
historical relationship between peer and ident authentication.  To  
reduce confusion between the two authenticaton methods and disentangle  
their code, use a dynamically allocated buffer instead.  
  
Discussion: https://www.postgresql.org/message-id/flat/c798fba5-8b71-4f27-c78e-37714037ea31%402ndquadrant.com  

M src/backend/libpq/auth.c

Update code comments about peer authenticaton

commit   : 5cc1e64fb6f59aa8621caae03be36400807e3575    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Oct 2019 09:13:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Oct 2019 09:13:39 +0100    

Click here for diff

For historical reasons, the functions for peer authentication were  
grouped under ident authentication.  But they are really completely  
separate, so give them their own section headings.  

M src/backend/libpq/auth.c

pg_waldump: Fix --bkp-details to not issue spurious newlines for FPWs.

commit   : e4d92126fda1defd9be201b97b162d1568122064    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 29 Oct 2019 22:46:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 29 Oct 2019 22:46:40 -0700    

Click here for diff

The additional newline seems to have accidentally been introduced in  
2c03216d831, in 9.5. The newline is only issued when an FPW is  
present for the block reference.  
  
While there could be an argument that removing the newlines in the  
back branches could cause a problem for somebody parsing the  
pg_waldump output, the likelihood of that seems small enough. It seems  
at least equally likely that the randomness of when newlines are  
issued causes problems.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20191029233341.4gnyau7e5v2lh5sc@alap3.anarazel.de  
Backpatch: 9.5, like 2c03216d831.  

M src/bin/pg_waldump/pg_waldump.c

pg_waldump: Fix small memory leak when rmgr->rm_identify returns NULL.

commit   : e0f76f204ccb870fc207546eaeae65abeacb7dad    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 29 Oct 2019 19:18:07 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 29 Oct 2019 19:18:07 -0700    

Click here for diff

This got broken in 604f7956b94, shortly after rm_identify's  
introduction.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/20191029233341.4gnyau7e5v2lh5sc@alap3.anarazel.de  
Backpatch: 9.5, where rm_identify was introduced  

M src/bin/pg_waldump/pg_waldump.c

Fix typos in the code

commit   : 6ca86bb7e9c72f428c7f4e3f2b48dd6c4084429c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 30 Oct 2019 10:03:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 30 Oct 2019 10:03:00 +0900    

Click here for diff

Author: Vignesh C  
Reviewed-by: Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/CALDaNm0ni+GAOe4+fbXiOxNrVudajMYmhJFtXGX-zBPoN8ixhw@mail.gmail.com  

M contrib/pg_trgm/trgm_op.c
M contrib/pgcrypto/pgp-info.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/schema.c
M src/backend/access/common/detoast.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/replication/walreceiver.c
M src/backend/statistics/mcv.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/mmgr/freepage.c
M src/bin/pg_upgrade/parallel.c
M src/bin/psql/tab-complete.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/interval.c

Fix compiler warnings in ecpg tests

commit   : 517bf2d9107f0d45c5fea2e3904e8d3b10ce6bb2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 29 Oct 2019 09:14:43 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 29 Oct 2019 09:14:43 +0100    

Click here for diff

Under MinGW, when compiling the ecpg test files, you get compiler  
warnings about the use of %lld in printf().  
  
These files don't use our printf replacement or the c.h porting layer,  
so determine the appropriate format conversion the hard way.  
  
Reviewed-by: Michael Meskes <meskes@postgresql.org>  
Discussion: https://www.postgresql.org/message-id/flat/760c9dd1-2d80-c223-3f90-609b615f7918%402ndquadrant.com  

M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/sql/sqlda.pgc

Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY

commit   : d80be6f2f6c9793b92fc87c61d9ae2bcea3db560    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Oct 2019 11:08:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Oct 2019 11:08:09 +0900    

Click here for diff

When cancelling REINDEX CONCURRENTLY after swapping the old and new  
indexes (for example interruption at step 5), the old index remains  
around and is marked as invalid.  The old index should also be manually  
droppable to clean up the parent relation from any invalid indexes still  
remaining.  For a partition index reindexed, pg_class.relispartition was  
not getting updated, causing the index to not be droppable as DROP INDEX  
would look for dependencies in a partition tree, which do not exist  
anymore after the swap phase is done.  
  
The fix here is simple: when swapping the old and new indexes, make sure  
that pg_class.relispartition is correctly switched, similarly to what is  
done for the index name.  
  
Reported-by: Justin Pryzby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20191015164047.GA22729@telsasoft.com  
Backpatch-through: 12  

M src/backend/catalog/index.c

Allow extracting fields from a ROW() expression in more cases.

commit   : 8b7a0f1d118282f612e5b9686d820edcddedd081    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Oct 2019 15:08:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Oct 2019 15:08:24 -0400    

Click here for diff

Teach get_expr_result_type() to manufacture a tuple descriptor directly  
from a RowExpr node.  If the RowExpr has type RECORD, this is the only  
way to get a tupdesc for its result, since even if the rowtype has been  
blessed, we don't have its typmod available at this point.  (If the  
RowExpr has some named composite type, we continue to let the existing  
code handle it, since the RowExpr might well not have the correct column  
names embedded in it.)  
  
This fixes assorted corner cases illustrated by the added regression  
tests.  
  
Discussion: https://postgr.es/m/10872.1572202006@sss.pgh.pa.us  

M src/backend/utils/fmgr/funcapi.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

On Windows, use COMSPEC to find the location of cmd.exe.

commit   : f88544904e4b57b1a8e969a5d594288554417c88    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Oct 2019 14:15:03 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Oct 2019 14:15:03 -0400    

Click here for diff

Historically, psql consulted COMSPEC to spawn a shell in its \! command,  
but we just invoked "cmd" when spawning shells in pg_ctl and pg_regress.  
It seems better to rely on the environment variable, if it's set,  
in all cases.  
  
It's debatable whether this is a bug fix or just a behavioral change,  
so no back-patch.  
  
Juan José Santamaría Flecha  
  
Discussion: https://postgr.es/m/16080-5d7f03222469f717@postgresql.org  

M src/bin/pg_ctl/pg_ctl.c
M src/test/regress/pg_regress.c

Handle empty-string edge cases correctly in strpos().

commit   : bd1ef5799b04168d8a869197dd9b85935d5d5da9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Oct 2019 12:21:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Oct 2019 12:21:13 -0400    

Click here for diff

Commit 9556aa01c rearranged the innards of text_position() in a way  
that would make it not work for empty search strings.  Which is fine,  
because all callers of that code special-case an empty pattern in  
some way.  However, the primary use-case (text_position itself) got  
special-cased incorrectly: historically it's returned 1 not 0 for  
an empty search string.  Restore the historical behavior.  
  
Per complaint from Austin Drenski (via Shay Rojansky).  
Back-patch to v12 where it got broken.  
  
Discussion: https://postgr.es/m/CADT4RqAz7oN4vkPir86Kg1_mQBmBxCp-L_=9vRpgSNPJf0KRkw@mail.gmail.com  

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

Doc: Add missing step for pg_stat_progress_cluster

commit   : 61ecea45e50bcd3b87d4e905719e63e41d6321ce    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 28 Oct 2019 14:23:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 28 Oct 2019 14:23:42 +0900    

Click here for diff

There is a step to track when the new heap is written, but this was  
missing in the documentation.  
  
Author: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/AT5PR8401MB06447FAE88E1592754E958B8EE640@AT5PR8401MB0644.NAMPRD84.PROD.OUTLOOK.COM  
Backpatch-through: 12  

M doc/src/sgml/monitoring.sgml

Fix dependency handling at swap phase of REINDEX CONCURRENTLY

commit   : 68ac9cf2499236996f3d4bf31f7f16d5bd3c77af    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 28 Oct 2019 11:57:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 28 Oct 2019 11:57:31 +0900    

Click here for diff

When swapping the dependencies of the old and new indexes, the code has  
been correctly switching all links in pg_depend from the old to the new  
index for both referencing and referenced entries.  However it forgot  
the fact that the new index may itself have existing entries in  
pg_depend, like references to the parent table attributes.  This  
resulted in duplicated entries in pg_depend after running REINDEX  
CONCURRENTLY.  
  
Fix this problem by removing any existing entries in pg_depend on the  
new index before switching the dependencies of the old index to the new  
one.  More regression tests are added to check the consistency of  
entries in pg_depend for indexes, including partition indexes.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20191025064318.GF8671@paquier.xyz  
Backpatch-through: 12  

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

Fix initialization of fake LSN for unlogged relations

commit   : 51970fa8df9b32b5501ca1cb9d5b805894c1e064    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 27 Oct 2019 13:54:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 27 Oct 2019 13:54:12 +0900    

Click here for diff

9155580 has changed the value of the first fake LSN for unlogged  
relations from 1 to FirstNormalUnloggedLSN (aka 1000), GiST requiring a  
non-zero LSN on some pages to allow an interlocking logic to work, but  
its value was still initialized to 1 at the beginning of recovery or  
after running pg_resetwal.  This fixes the initialization for both code  
paths.  
  
Author: Takayuki Tsunakawa  
Reviewed-by: Dilip Kumar, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/OSBPR01MB2503CE851940C17DE44AE3D9FE6F0@OSBPR01MB2503.jpnprd01.prod.outlook.com  
Backpatch-through: 12  

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

Fix copy-paste defect in comment.

commit   : b804521344fb366215900ac3f01314a1710bc6d8    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 26 Oct 2019 12:55:16 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 26 Oct 2019 12:55:16 -0700    

Click here for diff

Commit a7471bd85c05f849e88d6cfe9da3c795008e8f2e introduced it.  

M src/include/c.h

Update comment about __sync_lock_test_and_set() bug.

commit   : e653c714c25bb8bde0b80b3bf3a220704b71a106    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 26 Oct 2019 12:55:06 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 26 Oct 2019 12:55:06 -0700    

Click here for diff

State the earliest known fixed version, so we can someday judge the  
workaround to be obsolete.  

M src/include/port/atomics.h

Doc: improve documentation of configuration settings that have units.

commit   : cfb7559083436b802e7ecc5e3fa235057890265c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 26 Oct 2019 12:30:41 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 26 Oct 2019 12:30:41 -0400    

Click here for diff

When we added the GUC units feature, we didn't make any great effort  
to adjust the documentation of individual GUCs; they tended to still  
say things like "this is the number of milliseconds that ...", even  
though users might prefer to write some other units, and SHOW might  
even show the value in other units.  Commit 6c9fb69f2 made an effort  
to improve this situation, but I thought it made things less readable  
by injecting units information in mid-sentence.  It also wasn't very  
consistent, and did not touch all the GUCs that have units.  
  
To improve matters, standardize on the phrasing "If this value is  
specified without units, it is taken as <units>".  Also, try to  
standardize where this is mentioned, right before the specification  
of the default.  (In a couple of places, doing that would've required  
more rewriting than seemed justified, so I wasn't 100% consistent  
about that.)  I also tried to use the phrases "amount of time",  
"amount of memory", etc rather than describing the contents of GUCs  
in other ways, as those were the majority usage in places that weren't  
overcommitting to a particular unit.  (I left "length of time" alone  
in a couple of places, though.)  
  
I failed to resist the temptation to copy-edit some awkward text, too.  
  
Backpatch to v12, like 6c9fb69f2, mainly because v12 hasn't diverged  
much from HEAD yet.  
  
Discussion: https://postgr.es/m/15882.1571942223@sss.pgh.pa.us  

M doc/src/sgml/config.sgml

Remove obsolete information schema tables

commit   : 2fc2a88e6722df40245d3ae2ec7f8fc1c6bf0596    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 25 Oct 2019 21:11:48 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 25 Oct 2019 21:11:48 +0200    

Click here for diff

Remove SQL_LANGUAGES, which was eliminated in SQL:2008, and  
SQL_PACKAGES and SQL_SIZING_PROFILES, which were eliminated in  
SQL:2011.  Since they were dropped by the SQL standard, the  
information in them was no longer updated and therefore no longer  
useful.  
  
This also removes the feature-package association information in  
sql_feature_packages.txt, but for the time begin we are keeping the  
information which features are in the Core package (that is, mandatory  
SQL features).  Maybe at some point someone wants to invent a way to  
store that that does not involve using the "package" mechanism  
anymore.  
  
Discussion https://www.postgresql.org/message-id/flat/91334220-7900-071b-9327-0c6ecd012017%402ndquadrant.com  

M doc/src/sgml/features.sgml
M doc/src/sgml/information_schema.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_feature_packages.txt
M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h
M src/test/regress/expected/sanity_check.out

Avoid failure when selecting a namespace node in XMLTABLE.

commit   : 592a16321bd760d21220d0b2648bf151065816a5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 15:22:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 15:22:40 -0400    

Click here for diff

It appears that libxml2 doesn't bother to set the "children" field of  
an XML_NAMESPACE_DECL node to null; that field just contains garbage.  
In v10 and v11, this can result in a crash in XMLTABLE().  The rewrite  
done in commit 251cf2e27 fixed this, somewhat accidentally, in v12.  
We're not going to back-patch 251cf2e27, however.  The case apparently  
doesn't have wide use, so rather than risk introducing other problems,  
just add a safety check to throw an error.  
  
Even though no bug manifests in v12/HEAD, add the relevant test case  
there too, to prevent future regressions.  
  
Chapman Flack (per private report)  

M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

doc: Use proper em and en dashes

commit   : cbe63d02d0f7d85ecbae7d8998f5edfe56d50b9d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 25 Oct 2019 20:23:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 25 Oct 2019 20:23:44 +0200    

Click here for diff

M doc/src/sgml/biblio.sgml
M doc/src/sgml/bki.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/legal.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/textsearch.sgml

Revert "Revert part of commit dddf4cdc3."

commit   : ee201520707596b058e6bbfab0a5e2006f3834c5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 12:18:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 12:18:11 -0400    

Click here for diff

This reverts commit c114229ca2519620703a4be4e38181290cad8c0a.  
Commit 1408d5d869925c8ea7ca01c2644e8903fbab23de should make it  
safe to include these headers in the natural order.  

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

Get rid of useless/dangerous redefinition of bool in ECPG.

commit   : 1408d5d869925c8ea7ca01c2644e8903fbab23de    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 12:17:41 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 12:17:41 -0400    

Click here for diff

pgtypeslib_extern.h contained fallback definitions of "bool", "FALSE",  
and "TRUE".  The latter two are just plain unused, and have been for  
awhile.  The former came into play only if there wasn't a macro  
definition of "bool", which is true only if we aren't using <stdbool.h>.  
However, it then defined bool as "char"; since commit d26a810eb that  
conflicts with c.h's desire to use "unsigned char".  We'd missed seeing  
any bad effects of that due to accidental header inclusion order choices,  
but dddf4cdc3 exposed that it was problematic.  
  
To fix, let's just get rid of these definitions.  They should not be  
needed because everyplace in Postgres should be relying on c.h to  
provide a definition for type bool.  (Note that despite its name,  
pgtypeslib_extern.h isn't exposed to any outside code; we don't  
install it.)  
  
This doesn't fully resolve the issue, because ecpglib.h is doing  
similar things, but that seems to require more thought to fix.  
  
Back-patch to v12 where d26a810eb came in, to forestall any unpleasant  
surprises from future back-patched bug fixes.  
  
Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com  

M src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h

Improve management of statement timeouts.

commit   : 22f6f2c1ccb56e0d6a159d4562418587e4b10e01    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 11:41:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 11:41:16 -0400    

Click here for diff

Commit f8e5f156b added private state in postgres.c to track whether  
a statement timeout is running.  This seems like bad design to me;  
timeout.c's private state should be the single source of truth about  
that.  We already fixed one bug associated with failure to keep those  
states in sync (cf. be42015fc), and I've got little faith that we  
won't find more in future.  So get rid of postgres.c's local variable  
by exposing a way to ask timeout.c whether a timeout is running.  
(Obviously, such an inquiry is subject to race conditions, but it  
seems fine for the purpose at hand.)  
  
To make get_timeout_active() as cheap as possible, add a flag in  
the per-timeout struct showing whether that timeout is active.  
This allows some small savings elsewhere in timeout.c, mainly  
elimination of unnecessary searches of the active_timeouts array.  
  
While at it, fix enable_statement_timeout to not call disable_timeout  
when statement_timeout is 0 and the timeout is not running.  This  
avoids a useless deschedule-and-reschedule-timeouts cycle, which  
represents a significant savings (at least one kernel call) when  
there is any other active timeout.  Right now, there usually isn't,  
but there are proposals around to change that.  
  
Discussion: https://postgr.es/m/16035-456e6e69ebfd4374@postgresql.org  

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

Reset statement_timeout between queries of a multi-query string.

commit   : 2b2bacdca0100f50ba4f79cda53514b6e5114e8f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 11:15:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 25 Oct 2019 11:15:50 -0400    

Click here for diff

Historically, we started the timer (if StatementTimeout > 0) at the  
beginning of a simple-Query message and usually let it run until the  
end, so that the timeout limit applied to the entire query string,  
and intra-string changes of the statement_timeout GUC had no effect.  
But, confusingly, a COMMIT within the string would reset the state  
and allow a fresh timeout cycle to start with the current setting.  
  
Commit f8e5f156b changed the behavior of statement_timeout for extended  
query protocol, and as an apparently-unintended side effect, a change in  
the statement_timeout GUC during a multi-statement simple-Query message  
might have an effect immediately --- but only if it was going from  
"disabled" to "enabled".  
  
This is all pretty confusing, not to mention completely undocumented.  
Let's change things so that the timeout is always reset between queries  
of a multi-query string, whether they're transaction control commands  
or not.  Thus the active timeout setting is applied to each query in  
the string, separately.  This costs a few more cycles if statement_timeout  
is active, but it provides much more intuitive behavior, especially if one  
changes statement_timeout in one of the queries of the string.  
  
Also, add something to the documentation to explain all this.  
  
Per bug #16035 from Raj Mohite.  Although this is a bug fix, I'm hesitant  
to back-patch it; conceivably somebody has worked out the old behavior  
and is depending on it.  (But note that this change should make the  
behavior less restrictive in most cases, since the timeout will now  
be applied to shorter segments of code.)  
  
Discussion: https://postgr.es/m/16035-456e6e69ebfd4374@postgresql.org  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c

Revert part of commit dddf4cdc3.

commit   : c114229ca2519620703a4be4e38181290cad8c0a    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 25 Oct 2019 10:04:20 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 25 Oct 2019 10:04:20 +0530    

Click here for diff

The commit dddf4cdc3 tries to ensure that the Postgres header file  
inclusions are in order based on their ASCII value.  However, in one of  
the case there is a header file dependency due to which we can't maintain  
such order.  
  
Author: Amit Kapila  
Discussion: https://postgr.es/m/E1iNpHW-000855-1u@gemulon.postgresql.org  

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

Make the order of the header file includes consistent in non-backend modules.

commit   : dddf4cdc3300073ec04b2c3e482a4c1fa4b8191b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 23 Oct 2019 09:38:53 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 23 Oct 2019 09:38:53 +0530    

Click here for diff

Similar to commit 7e735035f2, this commit makes the order of header file  
inclusion consistent for non-backend modules.  
  
In passing, fix the case where we were using angle brackets (<>) for the  
local module includes instead of quotes ("").  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

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_basebackup/walmethods.c
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/common.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_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.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/prompt.c
M src/bin/psql/startup.c
M src/bin/psql/variables.c
M src/common/f2s.c
M src/fe_utils/print.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/string_utils.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/interfaces/ecpg/pgtypeslib/common.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/c_keywords.c
M src/interfaces/ecpg/preproc/ecpg_keywords.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_handler.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_sse42.c
M src/port/tar.c
M src/test/isolation/isolationtester.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_shm_mq/setup.c
M src/test/regress/pg_regress.c
M src/test/regress/regress.c

Handle interrupts within a transaction context in REINDEX CONCURRENTLY

commit   : 8270a0d9a948944871dd35d9ff0d5c0d8d78623f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 25 Oct 2019 10:20:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 25 Oct 2019 10:20:08 +0900    

Click here for diff

Phases 2 (building the new index) and 3 (validating the new index)  
checked for interrupts outside a transaction context, having as  
consequence to not release session-level locks taken on the parent  
relation and the old and new indexes processed.  This could for example  
be triggered with statement_timeout and a bad timing, and would issue  
confusing error messages when shutting down the session still holding  
the locks (note that an assertion failure would be triggered first), on  
top of more issues with concurrent sessions trying to take a lock that  
would interfere with the SHARE UPDATE EXCLUSIVE locks hold here.  
  
This moves all the interruption checks inside a transaction context.  
Note that I have manually tested all interruptions to make sure that  
invalid indexes can be cleaned up properly.  Partition indexes still  
have issues on their own with some missing dependency handling, which  
will be dealt with in a follow-up patch.  
  
Reported-by: Justin Pryzby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20191013025145.GC4475@telsasoft.com  
Backpatch-through: 12  

M src/backend/commands/indexcmds.c

Fix typo in xlog.c.

commit   : 3b0c59ac1c7d480821ed009b998dd6be7d2d851c    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 24 Oct 2019 14:13:36 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 24 Oct 2019 14:13:36 +0900    

Click here for diff

Author: Fujii Masao  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAHGQGwH7dtYvOZZ8c0AG5AJwH5pfiRdKaCptY1_RdHy0HYeRfQ@mail.gmail.com  

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

Make the order of the header file includes consistent in contrib modules.

commit   : 7e735035f208418f31b91846ae3e8a381edb3af3    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 23 Oct 2019 09:26:22 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 23 Oct 2019 09:26:22 +0530    

Click here for diff

The basic rule we follow here is to always first include 'postgres.h' or  
'postgres_fe.h' whichever is applicable, then system header includes and  
then Postgres header includes.  In this, we also follow that all the  
Postgres header includes are in order based on their ASCII value.  We  
generally follow these rules, but the code has deviated in many places.  
This commit makes it consistent just for contrib modules.  The later  
commits will enforce similar rules in other parts of code.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvalidate.c
M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_op.c
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/isn/isn.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/crc32.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltree_op.c
M contrib/ltree_plpython/ltree_plpython.c
M contrib/oid2name/oid2name.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_standby/pg_standby.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-md5.c
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp-armor.c
M contrib/pgcrypto/pgp-cfb.c
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-info.c
M contrib/pgcrypto/pgp-mpi-internal.c
M contrib/pgcrypto/pgp-mpi-openssl.c
M contrib/pgcrypto/pgp-mpi.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp-pubdec.c
M contrib/pgcrypto/pgp-pubenc.c
M contrib/pgcrypto/pgp-pubkey.c
M contrib/pgcrypto/pgp-s2k.c
M contrib/pgcrypto/pgp.c
M contrib/pgcrypto/px-crypt.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/uavc.c
M contrib/spi/moddatetime.c
M contrib/tablefunc/tablefunc.c
M contrib/tcn/tcn.c
M contrib/vacuumlo/vacuumlo.c

docs: fix wording of REFRESH CONCURRENTLY manual page

commit   : 59c2617af35f064e5d3ef39cfe94531f7459f3de    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 23 Oct 2019 20:29:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 23 Oct 2019 20:29:02 -0400    

Click here for diff

Reported-by: Asim / apraveen@pivotal.io  
  
Discussion: https://postgr.es/m/157076828181.26165.15231292023740913543@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

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

pg_upgrade: adjust error output to use new database list format

commit   : 0c089d36e2bb07a8ccd575d456265e83b6697d00    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 23 Oct 2019 18:06:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 23 Oct 2019 18:06:38 -0400    

Click here for diff

Commit a524f50d0f added  
old_11_check_for_sql_identifier_data_type_usage(), but it did not use  
the clearer database error list format added to the master branch in  
commit 1634d36157.  This commit fixes that.  
  
Backpatch-through: master  

M src/bin/pg_upgrade/version.c

Acquire properly session-level lock on new index in REINDEX CONCURRENTLY

commit   : 5d3500da72611018f2280d6a31e58ccdb4b16152    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 15:04:48 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 15:04:48 +0900    

Click here for diff

In the first transaction run for REINDEX CONCURRENTLY, a thinko in the  
existing logic caused two session locks to be taken on the old index,  
causing the session lock on the newly-created index to be missed.  This  
made possible concurrent DDL commands (like ALTER INDEX) on the new  
index while REINDEX CONCURRENTLY was processing from the point where the  
first internal transaction committed.  
  
This issue has been discovered while digging into another bug.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20191021074323.GB1869@paquier.xyz  
Backpatch-through: 12  

M src/backend/commands/indexcmds.c

Remove libpq-dist.rc

commit   : 508e84d79910cdb3b61fc410a245fd46e4fad30f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Oct 2019 07:10:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Oct 2019 07:10:09 +0200    

Click here for diff

The use of this was removed by  
6da56f3f84d430671d5edd8f9336bd744c089e31.  
  
Discussion: https://www.postgresql.org/message-id/87d95052-3780-b833-9953-27eab80186cf%402ndquadrant.com  

M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile

Remove last traces of --adduser/--no-adduser in createuser

commit   : 4fa5edcd1a45cb11bc52b612e12bb29ab39cb895    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 12:27:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 12:27:03 +0900    

Click here for diff

8ae0d47 marked those options as obsolete back in 2005, with the options  
removed from the documentation.  This removes the last references to  
both options in the code which were kept around for compatibility  
purposes with past commands.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/5da284a2-62d9-e338-88d1-26ee5009d93e@gmail.com  

M src/bin/scripts/createuser.c

Fix thinkos from 4f4061b for libpq integer parsing

commit   : 57379cd5ac56e575630a5fee5777a1035d0a764a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 11:34:18 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 11:34:18 +0900    

Click here for diff

A check was redundant.  While on it, add an assertion to make sure that  
the parsing routine is never called with a NULL input.  All the code  
paths currently calling the parsing routine are careful with NULL inputs  
already, but future callers may forget that.  
  
Reported-by: Peter Eisentraut, Lars Kanis  
Discussion: https://postgr.es/m/ec64956b-4597-56b6-c3db-457d15250fe4@2ndquadrant.com  
Backpatch-through: 12  

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

Clean up properly error_context_stack in autovacuum worker on exception

commit   : e3db3f829f605edc0675e5d308de97f444b53d4b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 10:25:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 23 Oct 2019 10:25:06 +0900    

Click here for diff

Any callback set would have no meaning in the context of an exception.  
As an autovacuum worker exits quickly in this context, this could be  
only an issue within EmitErrorReport(), where the elog hook is for  
example called.  That's unlikely to going to be a problem, but let's be  
clean and consistent with other code paths handling exceptions.  This is  
present since 2909419, which introduced autovacuum.  
  
Author: Ashwin Agrawal  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CALfoeisM+_+dgmAdAOHAu0k-ZpEHHqSSG=GRf3pKJGm8OqWX0w@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/postmaster/autovacuum.c

Make command order in test more sensible

commit   : ad4b7aeb84434c958e2df76fa69b68493a889e4a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Oct 2019 10:35:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Oct 2019 10:35:54 +0200    

Click here for diff

Through several updates, the CREATE USER command has been separated  
from where the user is actually used in the test.  

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

Fix comment

commit   : f86f46d091a6876fbf28e0a4a87ca72b560cf77f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Oct 2019 09:58:20 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Oct 2019 09:58:20 +0200    

Click here for diff

The last argument of smgrextend() was renamed from isTemp to skipFsync  
in debcec7dc31a992703911a9953e299c8d730c778, but the comments at two  
call sites were not updated.  

M src/backend/access/heap/rewriteheap.c
M src/backend/catalog/storage.c

Refactor jsonpath's compareDatetime()

commit   : 52ad1e659967896ed153185328ffe806d69abcb6    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 21 Oct 2019 23:04:14 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 21 Oct 2019 23:04:14 +0300    

Click here for diff

This commit refactors come ridiculous coding in compareDatetime().  Also, it  
provides correct cross-datatype comparison even when one of values overflows  
during cast.  That eliminates dilemma on whether we should suppress overflow  
errors during cast.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/32308.1569455803%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/a5629d0c-8162-7559-16aa-0c8390d6ba5f%40postgrespro.ru  
Author: Nikita Glukhov, Alexander Korotkov  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/include/utils/timestamp.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

Refactor timestamp2timestamptz_opt_error()

commit   : a6888fde7f0dbe865559b31ba2ce01ac1150debe    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 21 Oct 2019 23:03:55 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 21 Oct 2019 23:03:55 +0300    

Click here for diff

While casting from timestamp to timestamptz we do timestamp2tm() then  
tm2timestamp().  This commit eliminates call to tm2timestamp().  Instead, it  
directly applies timezone offset to the original timestamp value.  That makes  
upcoming datetime overflow handling in jsonpath easier.  That should also save  
us some CPU cycles.  
  
Discussion: https://postgr.es/m/CAPpHfdvRPRh_mTGar5WmDeRZ%3DU5dOXHdxspYYD%3D76m3knNGjXA%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Tom Lane  

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

commit   : db477b691dc4e80bc8379d976ef53a0aa0afe4c0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 21 Oct 2019 14:18:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 21 Oct 2019 14:18:01 -0400    

Click here for diff

It emerges that recent versions of Windows (at least 2016 Standard)  
spell this locale name as "Norwegian Bokmål_Norway.1252", defeating  
our mapping code that translates "Norwegian (Bokmål)_Norway" to  
something that's all-ASCII (cf commits db29620d4 and aa1d2fc5e).  
Add another mapping entry to handle this spelling.  
  
Per bug #16068 from Robert Ford.  Like the previous patches,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/16068-4cb6eeaa7eb46d93@postgresql.org  

M src/port/win32setlocale.c

Use CFLAGS_SL while probing linkability of libperl.

commit   : d995fd667f6d22307864afe18ae91950b23b5b53    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 21 Oct 2019 13:52:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 21 Oct 2019 13:52:25 -0400    

Click here for diff

On recent Red Hat platforms (at least RHEL 8 and Fedora 30, maybe older),  
configure's probe for libperl failed if the user forces CFLAGS to be -O0.  
This is because some code in perl's inline.h fails to be optimized away  
at -O0, and said code doesn't work if compiled without -fPIC.  
  
To fix, add CFLAGS_SL to the compile flags used during the libperl probe.  
This is a better simulation of the way that plperl is built, anyway,  
so it might forestall other issues in future.  
  
Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,  
since people might want to build older branches on these platforms.  
  
Discussion: https://postgr.es/m/20191010.144533.263180400.horikyota.ntt@gmail.com  

M configure
M configure.in

Select CFLAGS_SL at configure time, not in platform-specific Makefiles.

commit   : 44273ce4f664a1bb34ef8ea9359237344cd6aaec    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 21 Oct 2019 12:32:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 21 Oct 2019 12:32:35 -0400    

Click here for diff

Move the platform-dependent logic that sets CFLAGS_SL from  
src/makefiles/Makefile.foo to src/template/foo, so that the value  
is determined at configure time and thus is available while running  
configure's tests.  
  
On a couple of platforms this might save a few microseconds of build  
time by eliminating a test that make otherwise has to do over and over.  
Otherwise it's pretty much a wash for build purposes; in particular,  
this makes no difference to anyone who might be overriding CFLAGS_SL  
via a make option.  
  
This patch in itself does nothing with the value and thus should not  
change any behavior, though you'll probably have to re-run configure  
to get a correctly updated Makefile.global.  We'll use the new  
configure variable in a follow-on patch.  
  
Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,  
because the follow-on patch is a portability bug fix.  
  
Discussion: https://postgr.es/m/20191010.144533.263180400.horikyota.ntt@gmail.com  

M configure
M configure.in
M src/Makefile.global.in
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.hpux
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd
M src/makefiles/Makefile.solaris
M src/makefiles/Makefile.win32
M src/template/aix
M src/template/cygwin
M src/template/darwin
M src/template/freebsd
M src/template/hpux
M src/template/linux
M src/template/netbsd
M src/template/openbsd
M src/template/solaris
M src/template/win32

Update obsolete comment.

commit   : 80831bcdbe80a6ca7f22105e32c2cbb54e125c4c    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 21 Oct 2019 17:30:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 21 Oct 2019 17:30:00 +0900    

Click here for diff

Commit b52b7dc25, which moved code creating PartitionBoundInfo in  
RelationBuildPartitionDesc() in partcache.c (relocated to partdesc.c  
afterwards) to partbounds.c, should have updated this, but didn't.  
  
Author: Etsuro Fujita  
Reviewed-by: Alvaro Herrera  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CAPmGK16Uxr%3DPatiGyaRwiQVLB7Y-GqbkK3AxRLVYzU0Czv%3DsEw%40mail.gmail.com  

M src/backend/partitioning/partbounds.c

Fix memory leak introduced in commit 7df159a620.

commit   : 70a6c37d524cc2c29712424785be3d9e2e62f484    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 17 Oct 2019 08:45:43 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 17 Oct 2019 08:45:43 +0530    

Click here for diff

We memorize all internal and empty leaf pages in the 1st vacuum stage for  
gist indexes.  They are used in the 2nd stage, to delete all the empty  
pages.  There was a memory context page_set_context for this purpose, but  
we never used it.  
  
Reported-by: Amit Kapila  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it got introduced  
Discussion: https://postgr.es/m/CAA4eK1LGr+MN0xHZpJ2dfS8QNQ1a_aROKowZB+MPNep8FVtwAA@mail.gmail.com  

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

Fix error reporting of connect_timeout in libpq for value parsing

commit   : ba19a6b73c5bd771d8864171ede03503a9ff564e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 21 Oct 2019 11:39:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 21 Oct 2019 11:39:15 +0900    

Click here for diff

The logic was correctly detecting a parsing failure, but the parsing  
error did not get reported back to the client properly.  
  
Reported-by: Ed Morley  
Author: Lars Kanis  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/a9b4cbd7-4ecb-06b2-ebd7-1739bbff3217@greiz-reinsdorf.de  
Backpatch-through: 12  

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

Fix parsing of integer values for connection parameters in libpq

commit   : 4f4061b2dde178d2ab79d1ee3b1ae3c62c117926    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 21 Oct 2019 11:17:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 21 Oct 2019 11:17:13 +0900    

Click here for diff

Commit e7a2217 has introduced stricter checks for integer values in  
connection parameters for libpq.  However this failed to correctly check  
after trailing whitespaces, while leading whitespaces were discarded per  
the use of strtol(3).  This fixes and refactors the parsing logic to  
handle both cases consistently.  Note that trying to restrict the use of  
trailing whitespaces can easily break connection strings like in ECPG  
regression tests (these have allowed me to catch the parsing bug with  
connect_timeout).  
  
Author: Michael Paquier  
Reviewed-by: Lars Kanis  
Discussion: https://postgr.es/m/a9b4cbd7-4ecb-06b2-ebd7-1739bbff3217@greiz-reinsdorf.de  
Backpatch-through: 12  

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

Clean up MinGW def file generation

commit   : ea9e06ac66d3e9584950f52878c8e4b71f963610    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 20 Oct 2019 10:19:13 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 20 Oct 2019 10:19:13 +0200    

Click here for diff

There were some leftovers from ancient ad-hoc ways to build on  
Windows, prior to the standardization on MSVC and MinGW.  We don't  
need to build a lib$(NAME)ddll.def (debug build, as opposed to  
lib$(NAME)dll.def) for MinGW, since nothing uses that.  We also don't  
need to build the regular .def file during distprep, since the MinGW  
build environment is perfectly capable of creating that normally at  
build time.  
  
Discussion: https://www.postgresql.org/message-id/flat/0f9db9f8-47b8-a48b-6ccc-15b22b412316%402ndquadrant.com  

M src/Makefile.shlib
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile

Fix most -Wundef warnings

commit   : 5d3587d14b753cb25b0ebcd549d95e1b6ceebce4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 19 Oct 2019 18:21:58 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 19 Oct 2019 18:21:58 +0200    

Click here for diff

In some cases #if was used instead of #ifdef in an inconsistent style.  
Cleaning this up also helps when analyzing cases like  
38d8dce61fff09daae0edb6bcdd42b0c7f10ebcd where this makes a  
difference.  
  
There are no behavior changes here, but the change in pg_bswap.h would  
prevent possible accidental misuse by third-party code.  
  
Discussion: https://www.postgresql.org/message-id/flat/3b615ca5-c595-3f1d-fdf7-a429e564f614%402ndquadrant.com  

M contrib/hstore/hstore_compat.c
M contrib/pg_standby/pg_standby.c
M contrib/pgcrypto/imath.c
M src/backend/libpq/be-fsstubs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/fd.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/mmgr/freepage.c
M src/include/port/pg_bswap.h
M src/port/snprintf.c
M src/port/win32error.c

Use standard compare_exchange loop style in ProcArrayGroupClearXid().

commit   : 48cc59ed24f95fa171b12ba1b461e6dc72d62b2b    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 18 Oct 2019 20:21:10 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 18 Oct 2019 20:21:10 -0700    

Click here for diff

Besides style, this might improve performance in the contended case.  
  
Reviewed by Amit Kapila.  
  
Discussion: https://postgr.es/m/20191015035348.GA4166224@rfd.leadboat.com  

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

For all ppc compilers, implement compare_exchange and fetch_add with asm.

commit   : 30ee5d17c20dbb282a9952b3048d6ad52d56c371    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 18 Oct 2019 20:20:52 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 18 Oct 2019 20:20:52 -0700    

Click here for diff

This is more like how we handle s_lock.h and arch-x86.h.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/20191005173400.GA3979129@rfd.leadboat.com  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port/atomics.h
M src/include/port/atomics/arch-ppc.h
D src/include/port/atomics/generic-xlc.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

For PowerPC instruction "addi", use constraint "b".

commit   : 89b4d7744c80ecb3f6bdf8a07ca711a043718db3    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 18 Oct 2019 20:20:28 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 18 Oct 2019 20:20:28 -0700    

Click here for diff

Without "b", a variant of the tas() code miscompiles on macOS 10.4.  
This may also fix a compilation failure involving macOS 10.1.  Today's  
compilers have been allocating acceptable registers with or without this  
change, but this future-proofs the code by precisely conveying the  
acceptable registers.  Back-patch to 9.4 (all supported versions).  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/20191009063900.GA4066266@rfd.leadboat.com  

M src/include/storage/s_lock.h

Remove last traces of heap_open/close in the tree

commit   : f25968c49697db673f6cd2a07b3f7626779f1827    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 19 Oct 2019 11:18:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 19 Oct 2019 11:18:15 +0900    

Click here for diff

Since pluggable storage has been introduced, those two routines have  
been replaced by table_open/close, with some compatibility macros still  
present to allow extensions to compile correctly with v12.  
  
Some code paths using the old routines still remained, so replace them.  
Based on the discussion done, the consensus reached is that it is better  
to remove those compatibility macros so as nothing new uses the old  
routines, so remove also the compatibility macros.  
  
Discussion: https://postgr.es/m/20191017014706.GF5605@paquier.xyz  

M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/include/access/table.h

Fix failure of archive recovery with recovery_min_apply_delay enabled.

commit   : ec1259e880dd0738a0b111e47d1b7153d3da20fd    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 18 Oct 2019 22:32:18 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 18 Oct 2019 22:32:18 +0900    

Click here for diff

recovery_min_apply_delay parameter is intended for use with streaming  
replication deployments. However, the document clearly explains that  
the parameter will be honored in all cases if it's specified. So it should  
take effect even if in archive recovery. But, previously, archive recovery  
with recovery_min_apply_delay enabled always failed, and caused assertion  
failure if --enable-caasert is enabled.  
  
The cause of this problem is that; the ownership of recoveryWakeupLatch  
that recovery_min_apply_delay uses was taken only when standby mode  
is requested. So unowned latch could be used in archive recovery, and  
which caused the failure.  
  
This commit changes recovery code so that the ownership of  
recoveryWakeupLatch is taken even in archive recovery. Which prevents  
archive recovery with recovery_min_apply_delay from failing.  
  
Back-patch to v9.4 where recovery_min_apply_delay was added.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwEyD6HdZLfdWc+95g=VQFPR4zQL4n+yHxQgGEGjaSVheQ@mail.gmail.com  

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

Make crash recovery ignore recovery_min_apply_delay setting.

commit   : 9b95a36be8be6c3a78b303bbe709c622dc312e87    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 18 Oct 2019 22:24:18 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 18 Oct 2019 22:24:18 +0900    

Click here for diff

In v11 or before, this setting could not take effect in crash recovery  
because it's specified in recovery.conf and crash recovery always  
starts without recovery.conf. But commit 2dedf4d9a8 integrated  
recovery.conf into postgresql.conf and which unexpectedly allowed  
this setting to take effect even in crash recovery. This is definitely  
not good behavior.  
  
To fix the issue, this commit makes crash recovery always ignore  
recovery_min_apply_delay setting.  
  
Back-patch to v12 where the issue was added.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwEyD6HdZLfdWc+95g=VQFPR4zQL4n+yHxQgGEGjaSVheQ@mail.gmail.com  
Discussion: https://postgr.es/m/e445616d-023e-a268-8aa1-67b8b335340c@pgmasters.net  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c

Fix typo

commit   : 89403ed228583c80c608310e68020229818836e6    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 18 Oct 2019 14:49:39 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 18 Oct 2019 14:49:39 +0200    

Click here for diff

Apparently while this code was being developed,  
ReindexRelationConcurrently operated on multiple relations.  The version  
that was ultimately pushed doesn't, so this comment's use of plural is  
inaccurate.  

M src/backend/commands/indexcmds.c

Update comments about progress reporting by index_drop

commit   : d2efb90dbad97828838ab356c03927b3dda65070    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 18 Oct 2019 07:18:50 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 18 Oct 2019 07:18:50 -0300    

Click here for diff

Michaël Paquier complained that index_drop is requesting progress  
reporting for non-obvious reasons, so let's add a comment to explain  
why.  
  
Discussion: https://postgr.es/m/20191017010412.GH2602@paquier.xyz  

M src/backend/catalog/index.c

Fix timeout handling in logical replication worker

commit   : 3f60f690fac1bf375b92cf2f8682e8fe8f690981    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 18 Oct 2019 14:26:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 18 Oct 2019 14:26:29 +0900    

Click here for diff

The timestamp tracking the last moment a message is received in a  
logical replication worker was initialized in each loop checking if a  
message was received or not, causing wal_receiver_timeout to be ignored  
in basically any logical replication deployments.  This also broke the  
ping sent to the server when reaching half of wal_receiver_timeout.  
  
This simply moves the initialization of the timestamp out of the apply  
loop to the beginning of LogicalRepApplyLoop().  
  
Reported-by: Jehan-Guillaume De Rorthais  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/CAOBaU_ZHESFcWva8jLjtZdCLspMj7vqaB2k++rjHLY897ZxbYw@mail.gmail.com  
Backpatch-through: 10  

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

Fix minor bug in logical-replication walsender shutdown

commit   : 38ddeab13b4b86161799c097dea4bdf9be60924a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 17 Oct 2019 15:06:06 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 17 Oct 2019 15:06:06 +0200    

Click here for diff

Logical walsender should exit when it catches up with sending WAL during  
shutdown; but there was a rare corner case when it failed to because of  
a race condition that puts it back to wait for more WAL instead -- but  
since there wasn't any, it'd not shut down immediately.  It would only  
continue the shutdown when wal_sender_timeout terminates the sleep,  
which causes annoying waits during shutdown procedure.  Restructure the  
code so that we no longer forget to set WalSndCaughtUp in that case.  
  
This was an oversight in commit c6c333436.  
  
Backpatch all the way down to 9.4.  
  
Author: Craig Ringer, Álvaro Herrera  
Discussion: https://postgr.es/m/CAMsr+YEuz4XwZX_QmnX_-2530XhyAmnK=zCmicEnq1vLr0aZ-g@mail.gmail.com  

M src/backend/replication/walsender.c

Fix parallel restore of FKs to partitioned tables

commit   : 1752e351639dcc68ea289cf91428246ed316d9b2    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 17 Oct 2019 09:58:01 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 17 Oct 2019 09:58:01 +0200    

Click here for diff

When an FK constraint is created, it needs the index on the referenced  
table to exist and be valid.  When doing parallel pg_restore and the  
referenced table was partitioned, this condition can sometimes not be  
met, because pg_dump didn't emit sufficient object dependencies to  
ensure so; this means that parallel pg_restore would fail in certain  
conditions.  Fix by having pg_dump make the FK constraint object  
dependent on the partition attachment objects for the constraint's  
referenced index.  
  
This has been broken since f56f8f8da6af, so backpatch to Postgres 12.  
  
Discussion: https://postgr.es/m/20191005224333.GA9738@alvherre.pgsql  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/fe_utils/simple_list.c
M src/include/fe_utils/simple_list.h

When restoring GUCs in parallel workers, show an error context.

commit   : 3c8c55dd5445370c5cad3ae04de02caba7be7073    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 17 Oct 2019 13:24:50 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 17 Oct 2019 13:24:50 +1300    

Click here for diff

Otherwise it can be hard to see where an error is coming from, when  
the parallel worker sets all the GUCs that it received from the  
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()  
appeared.  
  
Reported-by: Tiago Anastacio  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org  

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

Fix bug that could try to freeze running multixacts.

commit   : 6bda2af039d45d9a136ddc04e2242163177ab5ad    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 17 Oct 2019 09:59:21 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 17 Oct 2019 09:59:21 +1300    

Click here for diff

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to  
try to freeze a multixact that is still running.  That was  
prevented by a check, but raised an error.  Repair.  
  
Back-patch all the way.  
  
Author: Nathan Bossart, Jeremy Schneider  
Reported-by: Jeremy Schneider  
Reviewed-by: Jim Nasby, Thomas Munro  
Discussion: https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com  

M src/backend/commands/vacuum.c

Fix crash when reporting CREATE INDEX progress

commit   : 0d21f919eb86cd3baa267844d111c6a5af480696    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 16 Oct 2019 14:51:34 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 16 Oct 2019 14:51:34 +0200    

Click here for diff

A race condition can make us try to dereference a NULL pointer to the  
PGPROC struct of a process that's already finished.  That results in  
crashes during REINDEX CONCURRENTLY and CREATE INDEX CONCURRENTLY.  
  
This was introduced in ab0dfc961b6a, so backpatch to pg12.  
  
Reported by: Justin Pryzby  
Reviewed-by: Michaël Paquier  
Discussion: https://postgr.es/m/20191012004446.GT10470@telsasoft.com  

M src/backend/commands/indexcmds.c
M src/backend/storage/lmgr/lmgr.c

Improve the check for pg_catalog.unknown data type in pg_upgrade

commit   : a524f50d0fc6fe6f2146ce708c2c9576d3734da4    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 16 Oct 2019 13:23:18 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 16 Oct 2019 13:23:18 +0200    

Click here for diff

The pg_upgrade check for pg_catalog.unknown type when upgrading from 9.6  
had a couple of issues with domains and composite types - it detected  
even composite types unused in objects with storage. So for example this  
was enough to trigger an unnecessary pg_upgrade failure:  
  
  CREATE TYPE unknown_composite AS (u pg_catalog.unknown)  
  
On the other hand, this only happened with composite types directly on  
the pg_catalog.unknown data type, but not with a domain. So this was not  
detected  
  
  CREATE DOMAIN unknown_domain AS pg_catalog.unknown;  
  CREATE TYPE unknown_composite_2 AS (u unknown_domain);  
  
unlike the first example. These false positives and inconsistencies are  
unfortunate, but what's worse we've failed to detected objects using the  
pg_catalog.unknown type through a domain. So we missed cases like this  
  
  CREATE TABLE t (u unknown_composite_2);  
  
The consequence is clusters broken after a pg_upgrade.  
  
This fixes these false positives and false negatives by using the same  
recursive CTE introduced by eaf900e842 for sql_identifier. Backpatch all  
the way to 10, where the of pg_catalog.unknown data type was restricted.  
  
Author: Tomas Vondra  
Backpatch-to: 10-  
Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org  

M src/bin/pg_upgrade/version.c

Improve the check for pg_catalog.line data type in pg_upgrade

commit   : 8d48e6a7240cb0542577860e1bac768cd86fc633    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 16 Oct 2019 13:23:14 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 16 Oct 2019 13:23:14 +0200    

Click here for diff

The pg_upgrade check for pg_catalog.line data type when upgrading from  
9.3 had a couple of issues with domains and composite types. Firstly, it  
triggered false positives for composite types unused in objects with  
storage. This was enough to trigger an unnecessary pg_upgrade failure:  
  
  CREATE TYPE line_composite AS (l pg_catalog.line)  
  
On the other hand, this only happened with composite types directly on  
the pg_catalog.line data type, but not with a domain. So this was not  
detected  
  
  CREATE DOMAIN line_domain AS pg_catalog.line;  
  CREATE TYPE line_composite_2 AS (l line_domain);  
  
unlike the first example. These false positives and inconsistencies are  
unfortunate, but what's worse we've failed to detected objects using the  
pg_catalog.line data type through a domain. So we missed cases like this  
  
  CREATE TABLE t (l line_composite_2);  
  
The consequence is clusters broken after a pg_upgrade.  
  
This fixes these false positives and false negatives by using the same  
recursive CTE introduced by eaf900e842 for sql_identifier. 9.3 did not  
support domains on composite types, but we can still have multi-level  
composite types.  
  
Backpatch all the way to 9.4, where the format for pg_catalog.line data  
type changed.  
  
Author: Tomas Vondra  
Backpatch-to: 9.4-  
Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org  

M src/bin/pg_upgrade/version.c

Replace alter_table.sql test usage of event triggers.

commit   : ae5cae54ca6b1949829026b9fbb744c7f5a28bd5    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 16 Oct 2019 02:37:34 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 16 Oct 2019 02:37:34 -0700    

Click here for diff

The test in 93765bd956b added an event trigger to ensure that the  
tested table rewrites do not get optimized away (as happened in the  
past). But doing so would require running the tests in isolation, as  
otherwise the trigger might also fire in concurrent sessions, causing  
test failures there.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/3328.1570740683@sss.pgh.pa.us  
Backpatch: 12, just as 93765bd956b  

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

commit   : 1de4fd10922b96b6d90838181c59c1a45f8a95f6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 16 Oct 2019 15:10:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 16 Oct 2019 15:10:14 +0900    

Click here for diff

Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm0LPk9vTGTBPBRv0=fX=94o4r6-DuBbHNeCN2AH5bufLw@mail.gmail.com  

M src/backend/utils/hash/pg_crc.c
M src/include/utils/pg_crc.h

Remove obsolete collation test.

commit   : cce95a2f029e546dc461d7ec1760e2c3a247b0e7    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 16 Oct 2019 17:55:51 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 16 Oct 2019 17:55:51 +1300    

Click here for diff

The previous commit forgot to remove this test, which no longer  
holds on all systems.  

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

Use libc version as a collation version on glibc systems.

commit   : d5ac14f9ccdda036358c9059d4a29836ebc0c440    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 16 Oct 2019 16:51:40 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 16 Oct 2019 16:51:40 +1300    

Click here for diff

Using glibc's version string to detect potential collation definition  
changes is not 100% reliable, but it's better than nothing.  Currently  
this affects only collations explicitly provided by "libc".  More work  
will be needed to handle the default collation.  
  
Author: Thomas Munro, based on a suggestion from Christoph Berg  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/4b76c6d4-ae5e-0dc6-7d0d-b5c796a07e34%402ndquadrant.com  

M doc/src/sgml/ref/alter_collation.sgml
M src/backend/utils/adt/pg_locale.c
M src/bin/pg_dump/t/002_pg_dump.pl

Doc: Fix various inconsistencies

commit   : 4351142e5843dc9fcb080a51aa082d63be59a5ab    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 16 Oct 2019 13:09:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 16 Oct 2019 13:09:52 +0900    

Click here for diff

This fixes multiple areas of the documentation:  
- COPY for its past compatibility section.  
- SET ROLE mentioning INHERITS instead of INHERIT  
- PREPARE referring to stmt_name, that is not present.  
- Extension documentation about format name with upgrade scripts.  
  
Backpatch down to 9.4 for the relevant parts.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/bf95233a-9943-b341-e2ff-a860c28af481@gmail.com  
Backpatch-through: 9.4  

M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/set_role.sgml

Fix CLUSTER on expression indexes.

commit   : cef82eda1464193ab84a58610a388572d456c8c5    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 15 Oct 2019 10:40:13 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 15 Oct 2019 10:40:13 -0700    

Click here for diff

Since the introduction of different slot types, in 1a0586de3657, we  
create a virtual slot in tuplesort_begin_cluster(). While that looks  
right, it unfortunately doesn't actually work, as ExecStoreHeapTuple()  
is used to store tuples in the slot. Unfortunately no regression tests  
for CLUSTER on expression indexes existed so far.  
  
Fix the slot type, and add bare bones tests for CLUSTER on expression  
indexes.  
  
Reported-By: Justin Pryzby  
Author: Andres Freund  
Discussion: https://postgr.es/m/20191011210320.GS10470@telsasoft.com  
Backpatch: 12, like 1a0586de3657  

M src/backend/utils/sort/tuplesort.c
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Correct reference to pg_catalog.regtype in pg_upgrade query

commit   : 3a0e85739490e5cd50e5eba382ae3c9cc3bc2fca    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 15 Oct 2019 00:25:04 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 15 Oct 2019 00:25:04 +0200    

Click here for diff

The recursive CTE added in 0ccfc28223 referenced pg_catalog.regtype,  
without the schema part, unlike all other queries in pg_upgrade.  
  
Backpatch-to: 12  

M src/bin/pg_upgrade/version.c

Check for tables with sql_identifier during pg_upgrade

commit   : 0ccfc2822366f92c61cba96541d1c64d2b8b2086    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 14 Oct 2019 22:31:56 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 14 Oct 2019 22:31:56 +0200    

Click here for diff

Commit 7c15cef86d changed sql_identifier data type to be based on name  
instead of varchar.  Unfortunately, this breaks on-disk format for this  
data type.  Luckily, that should be a very rare problem, as this data  
type is used only in information_schema views, so this only affects user  
objects (tables, materialized views and indexes).  One way to end in  
such situation is to do CTAS with a query on those system views.  
  
There are two options to deal with this - we can either abort pg_upgrade  
if there are user objects with sql_identifier columns in pg_upgrade, or  
we could replace the sql_identifier type with varchar.  Considering how  
rare the issue is expected to be, and the complexity of replacing the  
data type (e.g. in matviews), we've decided to go with the simple check.  
  
The query is somewhat complex - the sql_identifier data type may be used  
indirectly - through a domain, a composite type or both, possibly in  
multiple levels.  Detecting this requires a recursive CTE.  
  
Backpatch to 12, where the sql_identifier definition changed.  
  
Reported-by: Hans Buschmann  
Author: Tomas Vondra  
Reviewed-by: Tom Lane  
Backpatch-to: 12  
Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/version.c

Update test output of sepgsql for ALTER TABLE COLUMN DROP

commit   : 14ac4237cba02f2766a7e6379468e71050de6fd2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 14 Oct 2019 08:58:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 14 Oct 2019 08:58:38 +0900    

Click here for diff

1df5875 has changed the way dependencies are dropped for this command  
with inheritance trees, which impacts sepgsql.  This just updates the  
regression test output to take care of the failures and adapt to the new  
code.  
  
Reported by buildfarm member rhinoceros.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20191013101331.GC1434@paquier.xyz  
Backpatch-through: 12  

M contrib/sepgsql/expected/ddl.out

Update unicode.org URLs

commit   : bdb839cbdebe851c200b2c7c03aec7483573d631    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 13 Oct 2019 22:10:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 13 Oct 2019 22:10:38 +0200    

Click here for diff

Use https, consistent host name, remove references to ftp.  Also  
update the URLs for CLDR, which has moved from Trac to GitHub.  

M contrib/unaccent/generate_unaccent_rules.py
M doc/src/sgml/acronyms.sgml
M doc/src/sgml/charset.sgml
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/common/unicode/Makefile
M src/common/unicode_norm.c

In the postmaster, rely on the signal infrastructure to block signals.

commit   : 9abb2bfc046070b22e3be28173a0736da31cab5a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 13 Oct 2019 15:48:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 13 Oct 2019 15:48:26 -0400    

Click here for diff

POSIX sigaction(2) can be told to block a set of signals while a  
signal handler executes.  Make use of that instead of manually  
blocking and unblocking signals in the postmaster's signal handlers.  
This should save a few cycles, and it also prevents recursive  
invocation of signal handlers when many signals arrive in close  
succession.  We have seen buildfarm failures that seem to be due to  
postmaster stack overflow caused by such recursion (exacerbated by  
a Linux PPC64 kernel bug).  
  
This doesn't change anything about the way that it works on Windows.  
Somebody might consider adjusting port/win32/signal.c to let it work  
similarly, but I'm not in a position to do that.  
  
For the moment, just apply to HEAD.  Possibly we should consider  
back-patching this, but it'd be good to let it age awhile first.  
  
Discussion: https://postgr.es/m/14878.1570820201@sss.pgh.pa.us  

M src/backend/libpq/pqsignal.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/pqsignal.h
M src/include/port.h
M src/port/pqsignal.c

Revert "Hack pg_ctl to report postmaster's exit status."

commit   : f38291e927fa8c04eb772e6a17a3dd44da2b69e8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 13 Oct 2019 12:56:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 13 Oct 2019 12:56:16 -0400    

Click here for diff

This reverts commit 6a5084eed49552bfc8859c438c8d74ad09fc5d3f.  
We learned what we needed to know from that.  

M src/bin/pg_ctl/pg_ctl.c

Fix dependency handling of column drop with partitioned tables

commit   : 1df5875d39383b3981b804666ee1f4b0ff65943f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 13 Oct 2019 17:51:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 13 Oct 2019 17:51:55 +0900    

Click here for diff

When dropping a column on a partitioned table which has one or more  
partitioned indexes, the operation was failing as dependencies with  
partitioned indexes using the column dropped were not getting removed in  
a way consistent with the columns involved across all the relations part  
of an inheritance tree.  
  
This commit refactors the code executing column drop so as all the  
columns from an inheritance tree to remove are gathered first, and  
dropped all at the end.  This way, we let the dependency machinery sort  
out by itself the deletion of all the columns with the partitioned  
indexes across a partition tree.  
  
This issue has been introduced by 1d92a0c, so backpatch down to  
REL_12_STABLE.  
  
Author: Amit Langote, Michael Paquier  
Reviewed-by: Álvaro Herrera, Ashutosh Sharma  
Discussion: https://postgr.es/m/CA+HiwqE9kuBsZ3b5pob2-cvE8ofzPWs-og+g8bKKGnu6b4-yTQ@mail.gmail.com  
Backpatch-through: 12  

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

Fix use of term "verifier"

commit   : b4675a8ae2d0aaafeb136c46c92bb56eaf018d32    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 12 Oct 2019 21:17:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 12 Oct 2019 21:17:34 +0200    

Click here for diff

Within the context of SCRAM, "verifier" has a specific meaning in the  
protocol, per RFCs.  The existing code used "verifier" differently, to  
mean whatever is or would be stored in pg_auth.rolpassword.  
  
Fix this by using the term "secret" for this, following RFC 5803.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/flat/be397b06-6e4b-ba71-c7fb-54cae84a7e18%402ndquadrant.com  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/common/scram-common.c
M src/include/common/scram-common.h
M src/include/libpq/crypt.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/test/authentication/t/001_password.pl
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

AIX: Stop adding option -qsrcmsg.

commit   : 5f3d271d03b249f5c80e3d3ca946f62a33d7862f    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 12 Oct 2019 00:21:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 12 Oct 2019 00:21:47 -0700    

Click here for diff

With xlc v16.1.0, it causes internal compiler errors.  With xlc versions  
not exhibiting that bug, removing -qsrcmsg merely changes the compiler  
error reporting format.  Back-patch to 9.4 (all supported versions).  
  
Discussion: https://postgr.es/m/20191003064105.GA3955242@rfd.leadboat.com  

M src/template/aix

Make crash recovery ignore restore_command and recovery_end_command settings.

commit   : 20961ceaf0426c6fba40bb422cf111f704a00058    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 11 Oct 2019 15:47:59 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 11 Oct 2019 15:47:59 +0900    

Click here for diff

In v11 or before, those settings could not take effect in crash recovery  
because they are specified in recovery.conf and crash recovery always  
starts without recovery.conf. But commit 2dedf4d9a8 integrated  
recovery.conf into postgresql.conf and which unexpectedly allowed  
those settings to take effect even in crash recovery. This is definitely  
not good behavior.  
  
To fix the issue, this commit makes crash recovery always ignore  
restore_command and recovery_end_command settings.  
  
Back-patch to v12 where the issue was added.  
  
Author: Fujii Masao  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/e445616d-023e-a268-8aa1-67b8b335340c@pgmasters.net  

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

Put back pqsignal() as an exported libpq symbol.

commit   : 06a367c382d0a3595238eff2e777222dbc91911b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 10 Oct 2019 14:24:56 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 10 Oct 2019 14:24:56 -0400    

Click here for diff

This reverts commit f7ab80285.  Per discussion, we can't remove an  
exported symbol without a SONAME bump, which we don't want to do.  
In particular that breaks usage of current libpq.so with pre-9.3  
versions of psql etc, which need libpq to export pqsignal().  
  
As noted in that commit message, exporting the symbol from libpgport.a  
won't work reliably; but actually we don't want to export src/port's  
implementation anyway.  Any pre-9.3 client is going to be expecting the  
definition that pqsignal() had before 9.3, which was that it didn't  
set SA_RESTART for SIGALRM.  Hence, put back pqsignal() in a separate  
source file in src/interfaces/libpq, and give it the old semantics.  
  
Back-patch to v12.  
  
Discussion: https://postgr.es/m/E1g5vmT-0003K1-6S@gemulon.postgresql.org  

M src/interfaces/libpq/Makefile
M src/interfaces/libpq/exports.txt
A src/interfaces/libpq/legacy-pqsignal.c

pg_upgrade: Clean up some redundant code

commit   : 3b5d3721c25ed1270832265c5475649c3baa0e26    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 10 Oct 2019 10:51:11 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 10 Oct 2019 10:51:11 +0200    

Click here for diff

No need to call exit() after pg_fatal().  Clean up a few stragglers  
for consistency.  

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

Fix table rewrites that include a column without a default.

commit   : 93765bd956bea26206043de8cbb0ae4b67e4df15    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 9 Oct 2019 22:00:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 9 Oct 2019 22:00:50 -0700    

Click here for diff

In c2fe139c201c I made ATRewriteTable() use tuple slots. Unfortunately  
I did not notice that columns can be added in a rewrite that do not  
have a default, when another column is added/altered requiring one.  
  
Initialize columns to NULL again, and add tests.  
  
Bug: #16038  
Reported-By: anonymous  
Author: Andres Freund  
Discussion: https://postgr.es/m/16038-5c974541f2bf6749@postgresql.org  
Backpatch: 12, where the bug was introduced in c2fe139c201c  

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

Revert "Use libc version as a collation version on glibc systems."

commit   : 50518ec296aea3af3e00c43c2ccef74c96cb5762    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 9 Oct 2019 21:36:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 9 Oct 2019 21:36:01 +0200    

Click here for diff

This reverts commit 9f90b1d08d796a925808b24f77f624a0ff682c77.  
  
This needs some refinements in the pg_dump and pg_upgrade tests.  

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

Use libc version as a collation version on glibc systems.

commit   : 9f90b1d08d796a925808b24f77f624a0ff682c77    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 9 Oct 2019 21:17:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 9 Oct 2019 21:17:47 +0200    

Click here for diff

Using glibc's version number to detect potential collation definition  
changes is not 100% reliable, but it's better than nothing.  
  
Author: Thomas Munro  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/4b76c6d4-ae5e-0dc6-7d0d-b5c796a07e34%402ndquadrant.com  

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

Flush logical mapping files with fd opened for read/write at checkpoint

commit   : b8e19b932a99a7eb5a3bce84e74b0b7c093d0981    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 9 Oct 2019 13:30:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 9 Oct 2019 13:30:43 +0900    

Click here for diff

The file descriptor was opened with read-only to fsync a regular file,  
which would cause EBADFD errors on some platforms.  
  
This is similar to the recent fix done by a586cc4b (which was broken by  
me with 82a5649), except that I noticed this issue while monitoring the  
backend code for similar mistakes.  Backpatch to 9.4, as this has been  
introduced since logical decoding exists as of b89e151.  
  
Author: Michael Paquier  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/20191006045548.GA14532@paquier.xyz  
Backpatch-through: 9.4  

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

pg_upgrade: clarify the database names in error files

commit   : 1634d361577aab30c7d90336c96b969a2f5e5811    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 8 Oct 2019 22:16:48 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 8 Oct 2019 22:16:48 -0400    

Click here for diff

Previously, the "Database:" label in the error file was unclear if the  
label was a status report or the problem was _in_ the database.  New  
text is "In database:".  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20191002172337.GC9680@telsasoft.com  
  
Backpatch-through: head  

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

doc: improve docs so config value default units are clearer

commit   : 6c9fb69f2bb589c210a114162e67c86476460453    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 8 Oct 2019 21:49:08 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 8 Oct 2019 21:49:08 -0400    

Click here for diff

Previously, our docs would say "Specifies the number of milliseconds"  
but it wasn't clear that "milliseconds" was merely the default unit.  
New text says "Specifies duration (defaults to milliseconds)", which is  
clearer.  
  
Reported-by: basil.bourque@gmail.com  
  
Discussion: https://postgr.es/m/15912-2e35e9026f61230b@postgresql.org  
  
Backpatch-through: 12  

M doc/src/sgml/config.sgml

Remove some code for old unsupported versions of MSVC

commit   : 38d8dce61fff09daae0edb6bcdd42b0c7f10ebcd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 8 Oct 2019 10:27:30 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 8 Oct 2019 10:27:30 +0200    

Click here for diff

As of d9dd406fe281d22d5238d3c26a7182543c711e74, we require MSVC 2013,  
which means _MSC_VER >= 1800.  This means that conditionals about  
older versions of _MSC_VER can be removed or simplified.  
  
Previous code was also in some cases handling MinGW, where _MSC_VER is  
not defined at all, incorrectly, such as in pg_ctl.c and win32_port.h,  
leading to some compiler warnings.  This should now be handled better.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/bin/pg_ctl/pg_ctl.c
M src/include/pg_config.h.win32
M src/include/port/win32.h
M src/include/port/win32_port.h
M src/include/utils/float.h
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr
M src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
M src/port/chklocale.c
M src/tools/msvc/Solution.pm

commit   : a7471bd85c05f849e88d6cfe9da3c795008e8f2e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 8 Oct 2019 14:31:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 8 Oct 2019 14:31:30 +0900    

Click here for diff

Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm3Dy=dTdx8UCVw=DWbzLzmRUC1dkq45=heOZDUg3U_PtA@mail.gmail.com  

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

Clarify some comments about ntstatus.h in win32_port.h

commit   : 491bb81fb803b0477062bb0a51edb752fa2cb396    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 8 Oct 2019 13:59:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 8 Oct 2019 13:59:53 +0900    

Click here for diff

Some comments in this file referred to outdated links.  This simplifies  
the outdated comment blocks and refreshes the links.  
  
Reported-by: Vignesh C  
Author: Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/46C03E17-16F7-4C38-B148-029AC7448E96@gmail.com  

M src/include/port/win32_port.h

Improve test coverage of pg_rewind

commit   : 55ba56415bae6ac1f43c12d54537bd60eaa2153b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 8 Oct 2019 11:46:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 8 Oct 2019 11:46:30 +0900    

Click here for diff

This includes new TAP tests for a couple of areas not covered yet and  
some improvements:  
- More coverage for --no-ensure-shutdown, the enforced recovery step and  
--dry-run.  
- Failures with option combinations and basic option checks.  
- Removal of a duplicated comment.  
  
Author: Alexey Kondratov, Michael Paquier  
Discussion: https://postgr.es/m/20191007010651.GD14532@paquier.xyz  

M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
A src/bin/pg_rewind/t/006_options.pl

docs: Improve A?synchronous Multimaster Replication descr.

commit   : 47eec34e4674e327ba7c2c57dda19241c889859e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 7 Oct 2019 18:06:08 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 7 Oct 2019 18:06:08 -0400    

Click here for diff

The docs for sync and async multimaster replication were unclear about  
when to use it, and when it has benefits;  this change clarifies that.  
  
Reported-by: juha-pekka.eloranta@reaktor.fi  
  
Discussion: https://postgr.es/m/156856543824.1274.12180817186798859836@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

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

docs: clarify that today/tomorrow/yesterday is at 00:00

commit   : cae078f3f98fa3614b12719d276db376df95d473    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 7 Oct 2019 17:26:46 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 7 Oct 2019 17:26:46 -0400    

Click here for diff

This should help people clearly know that these days start at midnight.  
  
Reported-by: David Harper  
  
Discussion: https://postgr.es/m/156258047907.1181.11324468080514061996@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

M doc/src/sgml/datatype.sgml

doc: move mention of log_min_error_statement in a better spot

commit   : 47571ec1e46994265961b9ddfb83cccb340e4aec    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 7 Oct 2019 14:33:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 7 Oct 2019 14:33:31 -0400    

Click here for diff

Previously it was mentioned in the lock_timeout docs in a confusing  
location.  
  
Reported-by: ivaylo.zlatanov@gmail.com  
  
Discussion: https://postgr.es/m/157019615723.25307.15449102262106437404@wrigleys.postgresql.org  
  
Backpatch-through: 9.4  

M doc/src/sgml/config.sgml

Check for too many postmaster children before spawning a bgworker.

commit   : 3887e9455f812035473eee1cba0cf9c237969998    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 7 Oct 2019 12:39:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 7 Oct 2019 12:39:09 -0400    

Click here for diff

The postmaster's code path for spawning a bgworker neglected to check  
whether we already have the max number of live child processes.  That's  
a bit hard to hit, since it would necessarily be a transient condition;  
but if we do, AssignPostmasterChildSlot() fails causing a postmaster  
crash, as seen in a report from Bhargav Kamineni.  
  
To fix, invoke canAcceptConnections() in the bgworker code path, as we  
do in the other code paths that spawn children.  Since we don't want  
the same pmState tests in this case, add a child-process-type parameter  
to canAcceptConnections() so that it can know what to do.  
  
Back-patch to 9.5.  In principle the same hazard exists in 9.4, but the  
code is enough different that this patch wouldn't quite fix it there.  
Given the tiny usage of bgworkers in that branch it doesn't seem worth  
creating a variant patch for it.  
  
Discussion: https://postgr.es/m/18733.1570382257@sss.pgh.pa.us  

M src/backend/postmaster/postmaster.c

Simplify PGAC_STRUCT_TIMEZONE Autoconf macro

commit   : 400d5ffcafa65e0f742dd29de83b035b8ea27c4a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Oct 2019 16:28:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Oct 2019 16:28:56 +0200    

Click here for diff

Since 63bd0db12199c5df043e1dea0f2b574f622b3a4c we don't use tzname  
anymore, so we don't need to check for it.  Instead, just keep the  
part of PGAC_STRUCT_TIMEZONE that we need, which is the check for  
struct tm.tm_zone.  
  
Discussion: https://www.postgresql.org/message-id/flat/5eb11a37-f3ca-5fb7-308f-4485dec25a2e%402ndquadrant.com  

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

Remove use of deprecated Autoconf define

commit   : 4d7e5a5db01edaff749555220aa41eb35be06799    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Oct 2019 16:27:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Oct 2019 16:27:31 +0200    

Click here for diff

Change from HAVE_TM_ZONE to HAVE_STRUCT_TM_TM_ZONE.  

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

Hack pg_ctl to report postmaster's exit status.

commit   : 6a5084eed49552bfc8859c438c8d74ad09fc5d3f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 7 Oct 2019 10:39:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 7 Oct 2019 10:39:07 -0400    

Click here for diff

Temporarily change pg_ctl so that the postmaster's exit status will  
be printed (to the postmaster's stdout).  This is to help identify  
the cause of intermittent "postmaster exited during a parallel  
transaction" failures seen on a couple of buildfarm members.  This  
change degrades pg_ctl's functionality in a couple of minor ways,  
so we'll revert it once we've obtained the desired info.  
  
Discussion: https://postgr.es/m/18537.1570421268@sss.pgh.pa.us  

M src/bin/pg_ctl/pg_ctl.c

Fix incorrect use of term HEAD for Git

commit   : cc4ec2d29ac4f3b8335d1851627a9735b81beb50    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Oct 2019 09:44:17 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Oct 2019 09:44:17 +0200    

Click here for diff

HEAD as used here was CVS terminology.  Now we mean master.  

M src/tools/RELEASE_CHANGES
M src/tools/git_changelog

Improve handling and coverage of --no-ensure-shutdown in pg_rewind

commit   : caa078353ecd1f3b3681c0d4fa95ad4bb8c2308a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 7 Oct 2019 09:07:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 7 Oct 2019 09:07:22 +0900    

Click here for diff

This includes a couple of changes around the new behavior of pg_rewind  
which enforces recovery to happen once on a cluster not shut down  
cleanly:  
- Some comments and documentation improvements.  
- Shutdown the cluster to rewind with immediate mode in all the tests,  
this allows to check after the forced recovery behavior which is wanted  
as new default.  
- Use -F for the forced recovery step, so as postgres does not use  
fsync.  This was useless as a final sync is done once the tool is done.  
  
Author: Michael Paquier  
Reviewed-by: Alexey Kondratov  
Discussion: https://postgr.es/m/20191004083721.GA1829@paquier.xyz  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/RewindTest.pm

Doc: improve docs about pg_statistic_ext_data.

commit   : 732457b5d2521c6ccd6b3b096d7aba73fca2a38a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 6 Oct 2019 14:14:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 6 Oct 2019 14:14:45 -0400    

Click here for diff

Commit aa087ec64 was a bit over-hasty about the doc changes needed  
while splitting pg_statistic_ext_data off from pg_statistic_ext.  
It duplicated one para and inserted another in what seems to me  
to be the wrong section.  Fix that up, and in passing do some minor  
copy-editing.  
  
Per report from noborusai.  
  
Discussion: https://postgr.es/m/CAAM3qnLXLUz4mOBkqa8jxigpKhKNxzSuvwpjvCRPvO5EqWjxSg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml

Avoid trying to release a List's initial allocation via repalloc().

commit   : ac12ab06a96179d44046494bc76ec53f30b5d30a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 6 Oct 2019 12:06:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 6 Oct 2019 12:06:30 -0400    

Click here for diff

Commit 1cff1b95a included some code that supposed it could repalloc()  
a memory chunk to a smaller size without risk of the chunk moving.  
That was not a great idea, because it depended on undocumented behavior  
of AllocSetRealloc, which commit c477f3e44 changed thereby breaking it.  
(Not to mention that this code ought to work with other memory context  
types, which might not work the same...)  So get rid of the repalloc  
calls, and instead just wipe the now-unused ListCell array and/or tell  
Valgrind it's NOACCESS, as if we'd freed it.  
  
In cases where the initial list allocation had been quite large, this  
could represent an annoying waste of space.  In principle we could  
ameliorate that by allocating the initial cell array separately when  
it exceeds some threshold.  But that would complicate new_list() which  
is hot code, and the returns would materialize only in narrow cases.  
On balance I don't think it'd be worth it.  
  
Discussion: https://postgr.es/m/17059.1570208426@sss.pgh.pa.us  

M src/backend/nodes/list.c

Change MemoryContextMemAllocated to return Size

commit   : 36425ece5d6c78177cdc1453a9925a0bb85da59f    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 5 Oct 2019 20:49:39 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 5 Oct 2019 20:49:39 +0200    

Click here for diff

Commit f2369bc610 switched most of the memory accounting from int64 to  
Size, but it forgot to change the MemoryContextMemAllocated return type.  
So this fixes that omission.  
  
Discussion: https://www.postgresql.org/message-id/11238.1570200198%40sss.pgh.pa.us  

M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Report test_atomic_ops() failures consistently, via macros.

commit   : e800bd7414df3ce8170761e5b75b13e83f576988    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 5 Oct 2019 10:05:05 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 5 Oct 2019 10:05:05 -0700    

Click here for diff

This prints the unexpected value in more failure cases, and it removes  
forty-eight hand-maintained error messages.  Back-patch to 9.5, which  
introduced these tests.  
  
Reviewed (in an earlier version) by Andres Freund.  
  
Discussion: https://postgr.es/m/20190915160021.GA24376@alvherre.pgsql  

M src/test/regress/regress.c

Avoid use of wildcard in pg_waldump's .gitignore.

commit   : d82f3909da11f9732fbc488333de0fdeb4d91ff5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 5 Oct 2019 12:26:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 5 Oct 2019 12:26:55 -0400    

Click here for diff

This would be all right, maybe, if it didn't also match a file that  
definitely should not be ignored.  We don't add rmgrs so often that  
manual maintenance of this file list is impractical, so just write  
out the list.  
  
(I find the equivalent wildcard use in the Makefile pretty lazy and  
unsafe as well, but will leave that alone until it actually causes a  
problem.)  
  
Per bug #16042 from Denis Stuchalin.  
  
Discussion: https://postgr.es/m/16042-c174ee692ac21cbd@postgresql.org  

M src/bin/pg_waldump/.gitignore

Disable one more set of tests from c8841199509.

commit   : 3a68105154c3a35e4b107b41e2f54ec85fbe29f5    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 5 Oct 2019 08:05:11 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 5 Oct 2019 08:05:11 -0700    

Click here for diff

Discussion: https://postgr.es/m/20191004222437.45qmglpto43pd3jb@alap3.anarazel.de  
Backpatch: 9.6-, just like c8841199509 and 6e61d75f525  

M src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/specs/eval-plan-qual-trigger.spec

Disable one set of tests from c8841199509.

commit   : 6e61d75f5258dc395c131ad5edd712852e29939e    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 21:11:23 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 21:11:23 -0700    

Click here for diff

One of the upsert related tests is unstable (sometimes even hanging  
until isolationtester's step timeout is reached). Based on preliminary  
analysis that might be a problem outside of just that test, but not  
really related to EPQ and triggers.  Disable for now, to get the  
buildfarm greener again.  
  
Discussion: https://postgr.es/m/20191004222437.45qmglpto43pd3jb@alap3.anarazel.de  
Backpatch: 9.6-, just like c8841199509.  

M src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/specs/eval-plan-qual-trigger.spec

Add isolation tests for the combination of EPQ and triggers.

commit   : c88411995098800e19e8507d4db19e86b09d73e4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 13:56:04 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 13:56:04 -0700    

Click here for diff

As evidenced by bug #16036 this area is woefully under-tested. Add  
fairly extensive tests for the combination.  
  
Backpatch back to 9.6 - before that isolationtester was not capable  
enough. While we don't backpatch tests all the time, future fixes to  
trigger.c would potentially look different enough in 12+ from the  
earlier branches that introducing bugs during backpatching is more  
likely than normal. Also, it's just a crucial and undertested area of  
the code.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/16036-28184c90d952fb7f@postgresql.org  
Backpatch: 9.6-, the earliest these tests work  

A src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/eval-plan-qual-trigger.spec

Fix crash caused by EPQ happening with a before update trigger present.

commit   : d986d4e87f61c68f52c68ebc274960dc664b7b4e    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 11:59:34 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 11:59:34 -0700    

Click here for diff

When ExecBRUpdateTriggers()'s GetTupleForTrigger() follows an EPQ  
chain the former needs to run the result tuple through the junkfilter  
again, and update the slot containing the new version of the tuple to  
contain that new version. The input tuple may already be in the  
junkfilter's output slot, which used to be OK - we don't need the  
previous version anymore. Unfortunately ff11e7f4b9ae started to use  
ExecCopySlot() to update newslot, and ExecCopySlot() doesn't support  
copying a slot into itself, leading to a slot in a corrupt  
state, which then can cause crashes or other symptoms.  
  
Fix this by skipping the ExecCopySlot() when copying into itself.  
  
While we could have easily made ExecCopySlot() handle that case, it  
seems better to add an assert forbidding doing so instead. As the goal  
of copying might be to make the contents of one slot independent from  
another, it seems failure prone to handle doing so silently.  
  
A follow-up commit will add tests for the obviously under-covered  
combination of EPQ and triggers. Done as a separate commit as it might  
make sense to backpatch them further than this bug.  
  
Also remove confusion with confusing variable names for slots in  
ExecBRDeleteTriggers() and ExecBRUpdateTriggers().  
  
Bug: #16036  
Reported-By: Антон Власов  
Author: Andres Freund  
Discussion: https://postgr.es/m/16036-28184c90d952fb7f@postgresql.org  
Backpatch: 12-, where ff11e7f4b9ae was merged  

M src/backend/commands/trigger.c
M src/include/executor/tuptable.h

Use a fd opened for read/write when syncing slots during startup, take 2.

commit   : a586cc4b6c568e88a459f1a69ac82aa42af7e5ba    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 13:08:51 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 4 Oct 2019 13:08:51 -0700    

Click here for diff

Cribbing from dfbaed45975:  
    Some operating systems, including the reporter's windows, return EBADFD  
    or similar when fsync() is invoked on a O_RDONLY file descriptor.  
    Unfortunately RestoreSlotFromDisk() does exactly that; which causes  
    failures after restarts in at least some scenarios.  
  
    If you hit the bug the error message will be something like  
    ERROR: could not fsync file "pg_replslot/$name/state": Bad file descriptor  
  
    Simply use O_RDWR instead of O_RDONLY when opening the relevant file  
    descriptor to fix the bug.  
  
Unfortunately this fix was undone in 82a5649fb9db. Re-apply, and add a  
comment.  
  
Bug: 16039  
Reported-By: Hans Buschmann  
Author: Andres Freund  
Discussion: https://postgr.es/m/16039-196fc97cc05e141c@postgresql.org  
Backpatch: 12-, as 82a5649fb9db  

M src/backend/replication/slot.c

Handle spaces in OpenSSL install location for MSVC

commit   : ad7595b890dbc26284bb0d784c2aaf1b9d6f903a    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 4 Oct 2019 15:34:40 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 4 Oct 2019 15:34:40 -0400    

Click here for diff

First, make sure that the .exe name is quoted when trying to get the  
version number. Also, don't quote the lib name for using in the project  
files if it's already been quoted. This second change applies to all  
libraries, not just OpenSSL.  
  
This has clearly been broken forever, so backpatch to all live branches.  

M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm

Rename some toasting functions based on whether they are heap-specific.

commit   : 2e8b6bfa90b252b1e1758364de7deff067d6058a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 4 Oct 2019 14:24:46 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 4 Oct 2019 14:24:46 -0400    

Click here for diff

The old names for the attribute-detoasting functions names included  
the word "heap," which seems outdated now that the heap is only one of  
potentially many table access methods.  
  
On the other hand, toast_insert_or_update and toast_delete are  
heap-specific, so rename them by adding "heap_" as a prefix.  
  
Not all of the work of making the TOAST system fully accessible to AMs  
other than the heap is done yet, but there seems to be little harm in  
getting this renaming out of the way now. Commit  
8b94dab06617ef80a0901ab103ebd8754427ef5a already divided up the  
functions among various files partially according to whether it was  
intended that they should be heap-specific or AM-agnostic, so this is  
just clarifying the division contemplated by that commit.  
  
Patch by me, reviewed and tested by Prabhat Sabu, Thomas Munro,  
Andres Freund, and Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M src/backend/access/common/detoast.c
M src/backend/access/common/indextuple.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/table/toast_helper.c
M src/backend/executor/tstoreReceiver.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/fmgr/fmgr.c
M src/include/access/detoast.h
M src/include/access/heaptoast.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regress.c

Fix bitshiftright()'s zero-padding some more.

commit   : 61aa9f544a91f2908e4c7cd549907cdc5b6f1c82    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 4 Oct 2019 10:34:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 4 Oct 2019 10:34:21 -0400    

Click here for diff

Commit 5ac0d9360 failed to entirely fix bitshiftright's habit of  
leaving one-bits in the pad space that should be all zeroes,  
because in a moment of sheer brain fade I'd concluded that only  
the code path used for not-a-multiple-of-8 shift distances needed  
to be fixed.  Of course, a multiple-of-8 shift distance can also  
cause the problem, so we need to forcibly zero the extra bits  
in both cases.  
  
Per bug #16037 from Alexander Lakhin.  As before, back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/16037-1d1ebca564db54f4@postgresql.org  

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

Use Size instead of int64 to track allocated memory

commit   : f2369bc610a19563cc00054ccfe9089fac469641    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 4 Oct 2019 16:10:56 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 4 Oct 2019 16:10:56 +0200    

Click here for diff

Commit 5dd7fc1519 added block-level memory accounting, but used int64 variable to  
track the amount of allocated memory. That is incorrect, because we have Size for  
exactly these purposes, but it was mostly harmless until c477f3e449 which changed  
how we handle with repalloc() when downsizing the chunk. Previously we've ignored  
these cases and just kept using the original chunk, but now we need to update the  
accounting, and the code was doing this:  
  
    context->mem_allocated += blksize - oldblksize;  
  
Both blksize and oldblksize are Size (so unsigned) which means the subtraction  
underflows, producing a very high positive value. On 64-bit platforms (where Size  
has the same size as mem_alllocated) this happens to work because the result wraps  
to the right value, but on (some) 32-bit platforms this fails.  
  
This fixes two things - it changes mem_allocated (and related variables) to Size,  
and it splits the update to two separate steps, to prevent any underflows.  
  
Discussion: https://www.postgresql.org/message-id/15151.1570163761%40sss.pgh.pa.us  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/include/nodes/memnodes.h

Remove AtSubStart_Notify.

commit   : 967e276e9f6b485c8577371713a323bf277b6902    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 4 Oct 2019 08:19:25 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 4 Oct 2019 08:19:25 -0400    

Click here for diff

Allocate notify-related state lazily instead. This makes trivial  
subtransactions noticeably faster.  
  
Patch by me, reviewed and tested by Dilip Kumar, Kyotaro Horiguchi,  
and Jeevan Ladhe.  
  
Discussion: https://postgr.es/m/CA+TgmobE1J22S1eC-6N-je9LgrcwZypkwp+zH6JXo9mc=4Nk3A@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/commands/async.c
M src/include/commands/async.h

Fix issues in pg_rewind with --no-ensure-shutdown/--write-recovery-conf

commit   : 6837632b758e0470a2692d9f8303e8aebd6fbd8f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 4 Oct 2019 16:18:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 4 Oct 2019 16:18:29 +0900    

Click here for diff

This fixes two issues with recent features added in pg_rewind:  
- --dry-run should do nothing on the target directory, but 927474c  
forgot to consider that for --write-recovery-conf.  
- --no-ensure-shutdown was not actually working.  There is no test  
coverage for this option yet, but a subsequent patch will add that.  
  
Author: Alexey Kondratov  
Discussion: https://postgr.es/m/7ca88204-3e0b-2f4c-c8af-acadc4b266e5@postgrespro.ru  

M src/bin/pg_rewind/pg_rewind.c

Fix --dry-run mode of pg_rewind