PostgreSQL 9.5.0 commit log

Stamp 9.5.0.

commit   : cdd4ed5449bf317cc71b45a8deee0173822e7592    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 16:29:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 16:29:34 -0500    

Click here for diff

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

Docs: provide a concrete discussion and example for RLS race conditions.

commit   : d878b115c350c18c0c9836c7652d5a179b5f9a33    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 15:11:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 15:11:44 -0500    

Click here for diff

Commit 43cd468cf01007f3 added some wording to create_policy.sgml purporting  
to warn users against a race condition of the sort that had been noted some  
time ago by Peter Geoghegan.  However, that warning was far too vague to be  
useful (or at least, I completely failed to grasp what it was on about).  
Since the problem case occurs with a security design pattern that lots of  
people are likely to try to use, we need to be as clear as possible about  
it.  Provide a concrete example in the main-line docs in place of the  
original warning.  

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

Adjust behavior of row_security GUC to match the docs.

commit   : 6a77404f5cd9380ccae24414d3f178e79011e96d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 12:21:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 12:21:31 -0500    

Click here for diff

Some time back we agreed that row_security=off should not be a way to  
bypass RLS entirely, but only a way to get an error if it was being  
applied.  However, the code failed to act that way for table owners.  
Per discussion, this is a must-fix bug for 9.5.0.  
  
Adjust the logic in rls.c to behave as expected; also, modify the  
error message to be more consistent with the new interpretation.  
The regression tests need minor corrections as well.  Also update  
the comments about row_security in ddl.sgml to be correct.  (The  
official description of the GUC in config.sgml is already correct.)  
  
I failed to resist the temptation to do some other very minor  
cleanup as well, such as getting rid of a duplicate extern declaration.  

M doc/src/sgml/ddl.sgml
M src/backend/utils/misc/rls.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix typo in comment.

commit   : fa39e891b08a5cb283a721592d0fa2c19b4c7176    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Jan 2016 10:12:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Jan 2016 10:12:37 -0500    

Click here for diff

Masahiko Sawada  

M src/bin/pg_rewind/RewindTest.pm

Translation updates

commit   : 00dfd5c94c41685e867e3a686900cc2f9e4dd829    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jan 2016 08:18:48 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jan 2016 08:18:48 -0500    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/id.po
M src/backend/po/pl.po
M src/backend/po/ru.po
M src/backend/po/zh_CN.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_basebackup/po/pl.po
M src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/pl.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/pl.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/zh_CN.po
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/pg_resetxlog/po/zh_CN.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/pl.po
A src/bin/pg_rewind/po/zh_CN.po
M src/bin/psql/nls.mk
M src/bin/psql/po/de.po
A src/bin/psql/po/ko.po
M src/bin/psql/po/pl.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/pl.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/zh_CN.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/nls.mk
A src/pl/plpython/po/ko.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/zh_CN.po
M src/pl/tcl/po/pl.po
M src/pl/tcl/po/zh_CN.po

Fix regrole and regnamespace output functions to do quoting, too.

commit   : de93252386e25b78400228b08326a50c43dd232b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:53:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:53:24 -0500    

Click here for diff

We discussed this but somehow failed to implement it...  

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

Fix regrole and regnamespace types to honor quoting like other reg* types.

commit   : fa038f830b64779475b746a6840db9bdd0298d80    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:03:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Jan 2016 01:03:53 -0500    

Click here for diff

Aside from any consistency arguments, this is logically necessary because  
the I/O functions for these types also handle numeric OID values.  Without  
a quoting rule it is impossible to distinguish numeric OIDs from role or  
namespace names that happen to contain only digits.  
  
Also change the to_regrole and to_regnamespace functions to dequote their  
arguments.  While not logically essential, this seems like a good idea  
since the other to_reg* functions do it.  Anyone who really wants raw  
lookup of an uninterpreted name can fall back on the time-honored solution  
of (SELECT oid FROM pg_namespace WHERE nspname = whatever).  
  
Report and patch by Jim Nasby, reviewed by Michael Paquier  

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

Fix bogus lock release in RemovePolicyById and RemoveRoleFromObjectPolicy.

commit   : c244a511ba7f40dd43516eb025b1b299f2978f23    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:53:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:53:35 -0500    

Click here for diff

Can't release the AccessExclusiveLock on the target table until commit.  
Otherwise there is a race condition whereby other backends might service  
our cache invalidation signals before they can actually see the updated  
catalog rows.  
  
Just to add insult to injury, RemovePolicyById was closing the rel (with  
incorrect lock drop) and then passing the now-dangling rel pointer to  
CacheInvalidateRelcache.  Probably the reason this doesn't fall over on  
CLOBBER_CACHE buildfarm members is that some outer level of the DROP logic  
is still holding the rel open ... but it'd have bit us on the arse  
eventually, no doubt.  

M src/backend/commands/policy.c

Do some copy-editing on the docs for row-level security.

commit   : 35adf6e44cb65111f7caf5a9988c0738790ef02d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:04:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 20:04:11 -0500    

Click here for diff

Clarifications, markup improvements, corrections of misleading or  
outright wrong statements.  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/drop_policy.sgml

Guard against null arguments in binary_upgrade_create_empty_extension().

commit   : ab1f08a3a4a855cb9245456866918706ca2fdf06    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:26:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:26:38 -0500    

Click here for diff

The CHECK_IS_BINARY_UPGRADE macro is not sufficient security protection  
if we're going to dereference pass-by-reference arguments before it.  
  
But in any case we really need to explicitly check PG_ARGISNULL for all  
the arguments of a non-strict function, not only the ones we expect null  
values for.  
  
Oversight in commits 30982be4e5019684e1772dd9170aaa53f5a8e894 and  
f92fc4c95ddcc25978354a8248d3df22269201bc.  Found by Andreas Seltenreich.  
(The other usages in pg_upgrade_support.c seem safe.)  

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

Do some copy-editing on the docs for replication origins.

commit   : 2e5c9284f688d124b0169ff5b86003ca86842666    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:03:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 16:03:42 -0500    

Click here for diff

Minor grammar and markup improvements.  

M doc/src/sgml/func.sgml
M doc/src/sgml/replication-origins.sgml

Do a final round of copy-editing on the 9.5 release notes.

commit   : 78d0e582ab1087d0cde9d00d8c8994591ae3c955    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 15:33:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 15:33:12 -0500    

Click here for diff

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

Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion condition.

commit   : 29692bdbb1dffed0eda38ad8268655425a7dcdf5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 13:56:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jan 2016 13:56:29 -0500    

Click here for diff

pgwin32_recv() has treated a non-error return of zero bytes from WSARecv()  
as being a reason to block ever since the current implementation was  
introduced in commit a4c40f140d23cefb.  However, so far as one can tell  
from Microsoft's documentation, that is just wrong: what it means is  
graceful connection closure (in stream protocols) or receipt of a  
zero-length message (in message protocols), and neither case should result  
in blocking here.  The only reason the code worked at all was that control  
then fell into the retry loop, which did *not* treat zero bytes specially,  
so we'd get out after only wasting some cycles.  But as of 9.5 we do not  
normally reach the retry loop and so the bug is exposed, as reported by  
Shay Rojansky and diagnosed by Andres Freund.  
  
Remove the unnecessary test on the byte count, and rearrange the code  
in the retry loop so that it looks identical to the initial sequence.  
  
Back-patch to 9.5.  The code is wrong all the way back, AFAICS, but  
since it's relatively harmless in earlier branches we'll leave it alone.  

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

Teach pg_dump to quote reloption values safely.

commit   : b01828e97df66b7ae5e1f8a583e2dc509e13a365    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 19:04:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 19:04:45 -0500    

Click here for diff

Commit c7e27becd2e6eb93 fixed this on the backend side, but we neglected  
the fact that several code paths in pg_dump were printing reloptions  
values that had not gotten massaged by ruleutils.  Apply essentially the  
same quoting logic in those places, too.  

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

Fix overly-strict assertions in spgtextproc.c.

commit   : 701303590053e100aa3a4ea87ac498d7fe00243f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 16:24:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 16:24:50 -0500    

Click here for diff

spg_text_inner_consistent is capable of reconstructing an empty string  
to pass down to the next index level; this happens if we have an empty  
string coming in, no prefix, and a dummy node label.  (In practice, what  
is needed to trigger that is insertion of a whole bunch of empty-string  
values.)  Then, we will arrive at the next level with in->level == 0  
and a non-NULL (but zero length) in->reconstructedValue, which is valid  
but the Assert tests weren't expecting it.  
  
Per report from Andreas Seltenreich.  This has no impact in non-Assert  
builds, so should not be a problem in production, but back-patch to  
all affected branches anyway.  
  
In passing, remove a couple of useless variable initializations and  
shorten the code by not duplicating DatumGetPointer() calls.  

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

Adjust back-branch release note description of commits a2a718b22 et al.

commit   : 9200e5664405600ab0bf588a8ff48621682b9fa2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 15:29:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Jan 2016 15:29:03 -0500    

Click here for diff

As pointed out by Michael Paquier, recovery_min_apply_delay didn't exist  
in 9.0-9.3, making the release note text not very useful.  Instead make it  
talk about recovery_target_xid, which did exist then.  
  
9.0 is already out of support, but we can fix the text in the newer  
branches' copies of its release notes.  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml

commit   : d47bc474b325099da381aa52a3a2a95354a2c80e    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 2 Jan 2016 13:33:39 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 2 Jan 2016 13:33:39 -0500    

Click here for diff

Backpatch certain files through 9.1  

M COPYRIGHT
M doc/src/sgml/legal.sgml

Teach flatten_reloptions() to quote option values safely.

commit   : 404c45bac64d312033dcf0373f7b1c0133b03afc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 15:27:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 15:27:53 -0500    

Click here for diff

flatten_reloptions() supposed that it didn't really need to do anything  
beyond inserting commas between reloption array elements.  However, in  
principle the value of a reloption could be nearly anything, since the  
grammar allows a quoted string there.  Any restrictions on it would come  
from validity checking appropriate to the particular option, if any.  
  
A reloption value that isn't a simple identifier or number could thus lead  
to dump/reload failures due to syntax errors in CREATE statements issued  
by pg_dump.  We've gotten away with not worrying about this so far with  
the core-supported reloptions, but extensions might allow reloption values  
that cause trouble, as in bug #13840 from Kouhei Sutou.  
  
To fix, split the reloption array elements explicitly, and then convert  
any value that doesn't look like a safe identifier to a string literal.  
(The details of the quoting rule could be debated, but this way is safe  
and requires little code.)  While we're at it, also quote reloption names  
if they're not safe identifiers; that may not be a likely problem in the  
field, but we might as well try to be bulletproof here.  
  
It's been like this for a long time, so back-patch to all supported  
branches.  
  
Kouhei Sutou, adjusted some by me  

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

Add some more defenses against silly estimates to gincostestimate().

commit   : d932391fd832aa62c5f86ddf7012622bb01bde9a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 13:42:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 13:42:21 -0500    

Click here for diff

A report from Andy Colson showed that gincostestimate() was not being  
nearly paranoid enough about whether to believe the statistics it finds in  
the index metapage.  The problem is that the metapage stats (other than the  
pending-pages count) are only updated by VACUUM, and in the worst case  
could still reflect the index's original empty state even when it has grown  
to many entries.  We attempted to deal with that by scaling up the stats to  
match the current index size, but if nEntries is zero then scaling it up  
still gives zero.  Moreover, the proportion of pages that are entry pages  
vs. data pages vs. pending pages is unlikely to be estimated very well by  
scaling if the index is now orders of magnitude larger than before.  
  
We can improve matters by expanding the use of the rule-of-thumb estimates  
I introduced in commit 7fb008c5ee59b040: if the index has grown by more  
than a cutoff amount (here set at 4X growth) since VACUUM, then use the  
rule-of-thumb numbers instead of scaling.  This might not be exactly right  
but it seems much less likely to produce insane estimates.  
  
I also improved both the scaling estimate and the rule-of-thumb estimate  
to account for numPendingPages, since it's reasonable to expect that that  
is accurate in any case, and certainly pages that are in the pending list  
are not either entry or data pages.  
  
As a somewhat separate issue, adjust the estimation equations that are  
concerned with extra fetches for partial-match searches.  These equations  
suppose that a fraction partialEntries / numEntries of the entry and data  
pages will be visited as a consequence of a partial-match search.  Now,  
it's physically impossible for that fraction to exceed one, but our  
estimate of partialEntries is mostly bunk, and our estimate of numEntries  
isn't exactly gospel either, so we could arrive at a silly value.  In the  
example presented by Andy we were coming out with a value of 100, leading  
to insane cost estimates.  Clamp the fraction to one to avoid that.  
  
Like the previous patch, back-patch to all supported branches; this  
problem can be demonstrated in one form or another in all of them.  

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

Split out pg_operator.h function declarations to new file pg_operator_fn.h.

commit   : 2d774aaf1801b0338241cca9409803451ef28a6a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 13:00:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jan 2016 13:00:13 -0500    

Click here for diff

Commit a2e35b53c39b2a27 added an #include of catalog/objectaddress.h to  
pg_operator.h, making it impossible for client-side code to #include  
pg_operator.h.  It's not entirely clear whether any client-side code needs  
to include pg_operator.h, but it seems prudent to assume that there is some  
such code somewhere.  Therefore, split off the function definitions into a  
new file pg_operator_fn.h, similarly to what we've done for some other  
catalog header files.  
  
Back-patch of part of commit 0dab5ef39b3d9d86.  

M src/backend/catalog/pg_operator.c
M src/backend/commands/operatorcmds.c
M src/include/catalog/pg_operator.h
A src/include/catalog/pg_operator_fn.h

Add a comment noting that FDWs don't have to implement EXCEPT or LIMIT TO.

commit   : 69892d58c9881acac934629187c7301f8e296eb4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Dec 2015 17:59:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Dec 2015 17:59:10 -0500    

Click here for diff

postgresImportForeignSchema pays attention to IMPORT's EXCEPT and LIMIT TO  
options, but only as an efficiency hack, not for correctness' sake.  The  
FDW documentation does explain that, but someone using postgres_fdw.c  
as a coding guide might not remember it, so let's add a comment here.  
Per question from Regina Obe.  

M contrib/postgres_fdw/postgres_fdw.c

Put back one copyObject() in rewriteTargetView().

commit   : 30858be2f83b57517f84ce2e149f2d1c536c0252    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 16:45:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Dec 2015 16:45:47 -0500    

Click here for diff

Commit 6f8cb1e23485bd6d tried to centralize rewriteTargetView's copying  
of a target view's Query struct.  However, it ignored the fact that the  
jointree->quals field was used twice.  This only accidentally failed to  
fail immediately because the same ChangeVarNodes mutation is applied in  
both cases, so that we end up with logically identical expression trees  
for both uses (and, as the code stands, the second ChangeVarNodes call  
actually does nothing).  However, we end up linking *physically*  
identical expression trees into both an RTE's securityQuals list and  
the WithCheckOption list.  That's pretty dangerous, mainly because  
prepsecurity.c is utterly cavalier about further munging such structures  
without copying them first.  
  
There may be no live bug in HEAD as a consequence of the fact that we apply  
preprocess_expression in between here and prepsecurity.c, and that will  
make a copy of the tree anyway.  Or it may just be that the regression  
tests happen to not trip over it.  (I noticed this only because things  
fell over pretty badly when I tried to relocate the planner's call of  
expand_security_quals to before expression preprocessing.)  In any case  
it's very fragile because if anyone tried to make the securityQuals and  
WithCheckOption trees diverge before we reach preprocess_expression, it  
would not work.  The fact that the current code will preprocess  
securityQuals and WithCheckOptions lists at completely different times in  
different query levels does nothing to increase my trust that that can't  
happen.  
  
In view of the fact that 9.5.0 is almost upon us and the aforesaid commit  
has seen exactly zero field testing, the prudent course is to make an extra  
copy of the quals so that the behavior is not different from what has been  
in the field during beta.  

M src/backend/rewrite/rewriteHandler.c

Rename (new|old)estCommitTs to (new|old)estCommitTsXid

commit   : 282fdfcdc8a8f987c06e839d581b94bf196def8a    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 28 Dec 2015 12:35:16 -0800    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 28 Dec 2015 12:35:16 -0800    

Click here for diff

The variables newestCommitTs and oldestCommitTs sound as if they are  
timestamps, but in fact they are the transaction Ids that correspond  
to the newest and oldest timestamps rather than the actual timestamps.  
Rename these variables to reflect that they are actually xids: to wit  
newestCommitTsXid and oldestCommitTsXid respectively. Also modify  
related code in a similar fashion, particularly the user facing output  
emitted by pg_controldata and pg_resetxlog.  
  
Complaint and patch by me, review by Tom Lane and Alvaro Herrera.  
Backpatch to 9.5 where these variables were first introduced.  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/commit_ts.h
M src/include/access/transam.h
M src/include/catalog/pg_control.h

Document brin_summarize_new_pages

commit   : 5bf939411ce7a4ae87cee65daca2e4add44b2b46    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 15:28:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 15:28:19 -0300    

Click here for diff

Pointer out by Jeff Janes  

M doc/src/sgml/brin.sgml
M doc/src/sgml/func.sgml

Document the exponentiation operator as associating left to right.

commit   : 508a26e2468fc4bb35f4b002552c304d51d97890    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 12:09:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 12:09:00 -0500    

Click here for diff

Common mathematical convention is that exponentiation associates right to  
left.  We aren't going to change the parser for this, but we could note  
it in the operator's description.  (It's already noted in the operator  
precedence/associativity table, but users might not look there.)  
Per bug #13829 from Henrik Pauli.  

M doc/src/sgml/func.sgml

doc: pg_committs -> pg_commit_ts

commit   : 3479b7984b01058993276d3d26ef47ec298ee219    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 13:45:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 13:45:03 -0300    

Click here for diff

Reported by: Alain Laporte (#13836)  

M doc/src/sgml/ref/pg_resetxlog.sgml

Update documentation about pseudo-types.

commit   : ea786b278c2471c69602c4b268be1ce90340e408    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 11:04:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Dec 2015 11:04:42 -0500    

Click here for diff

Tone down an overly strong statement about which pseudo-types PLs are  
likely to allow.  Add "event_trigger" to the list, as well as  
"pg_ddl_command" in 9.5/HEAD.  Back-patch to 9.3 where event_trigger  
was added.  

M doc/src/sgml/datatype.sgml

Fix translation domain in pg_basebackup

commit   : c3e068b26185e6c667dbb45f05bb2466ed11cfea    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 10:50:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Dec 2015 10:50:35 -0300    

Click here for diff

For some reason, we've been overlooking the fact that pg_receivexlog  
and pg_recvlogical are using wrong translation domains all along,  
so their output hasn't ever been translated.  The right domain is  
pg_basebackup, not their own executable names.  
  
Noticed by Ioseph Kim, who's been working on the Korean translation.  
  
Backpatch pg_receivexlog to 9.2 and pg_recvlogical to 9.4.  

M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c

Add forgotten CHECK_FOR_INTERRUPT calls in pgcrypto's crypt()

commit   : c886c30cc8731a3fab989a2b361fd38c5bb1ad53    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 27 Dec 2015 13:03:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 27 Dec 2015 13:03:19 -0300    

Click here for diff

Both Blowfish and DES implementations of crypt() can take arbitrarily  
long time, depending on the number of rounds specified by the caller;  
make sure they can be interrupted.  
  
Author: Andreas Karlsson  
Reviewer: Jeff Janes  
  
Backpatch to 9.1.  

M contrib/pgcrypto/crypt-blowfish.c
M contrib/pgcrypto/crypt-des.c

Fix brin_summarize_new_values() to check index type and ownership.

commit   : e10838026b373f01d1de0f4f7ea80a60c30565da    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Dec 2015 12:56:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Dec 2015 12:56:09 -0500    

Click here for diff

brin_summarize_new_values() did not check that the passed OID was for  
an index at all, much less that it was a BRIN index, and would fail in  
obscure ways if it wasn't (possibly damaging data first?).  It also  
lacked any permissions test; by analogy to VACUUM, we should only allow  
the table's owner to summarize.  
  
Noted by Jeff Janes, fix by Michael Paquier and me  

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

Remove unnecessary row ordering dependency in pg_rewind test suite.

commit   : 2e947ba977eba1c0c31a2981d090b7b1897c49c2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 11:38:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 11:38:31 -0500    

Click here for diff

t/002_databases.pl was expecting to see a specific physical order of the  
rows in pg_database.  I broke that in HEAD with commit 01e386a325549b77,  
but I'd say it's a pretty fragile test methodology in any case, so fix  
it in 9.5 as well.  

M src/bin/pg_rewind/t/002_databases.pl

Docs: fix erroneously-given function name.

commit   : 0bdcb04c7d9c72bf9071b4a3d4ffc3d37ddad89e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:50:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:50:03 -0500    

Click here for diff

pg_replication_session_is_setup() exists nowhere; apparently this is  
meant to refer to pg_replication_origin_session_is_setup().  
  
Adrien Nayrat  

M doc/src/sgml/func.sgml

Fix factual and grammatical errors in comments for struct _tableInfo.

commit   : 84b363fb3476f5c5b3bb159d457aaf9966ba6b2d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:42:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Dec 2015 10:42:58 -0500    

Click here for diff

Amit Langote, further adjusted by me  

M src/bin/pg_dump/pg_dump.h

Improve handling of password reuse in src/bin/scripts programs.

commit   : 3945b6193240cd7fcb5ad3c67e9dca7f12d68b7e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 15:45:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 15:45:43 -0500    

Click here for diff

This reverts most of commit 83dec5a71 in favor of having connectDatabase()  
store the possibly-reusable password in a static variable, similar to the  
coding we've had for a long time in pg_dump's version of that function.  
To avoid possible problems with unwanted password reuse, make callers  
specify whether it's reasonable to attempt to re-use the password.  
This is a wash for cases where re-use isn't needed, but it is far simpler  
for callers that do want that.  Functionally there should be no difference.  
  
Even though we're past RC1, it seems like a good idea to back-patch this  
into 9.5, like the prior commit.  Otherwise, if there are any third-party  
users of connectDatabase(), they'll have to deal with an API change in  
9.5 and then another one in 9.6.  
  
Michael Paquier  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createlang.c
M src/bin/scripts/createuser.c
M src/bin/scripts/droplang.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

In pg_dump, remember connection passwords no matter how we got them.

commit   : a21994c1bf9e61d263a870c98ba1e5f559107b4e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 14:25:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Dec 2015 14:25:31 -0500    

Click here for diff

When pg_dump prompts the user for a password, it remembers the password  
for possible re-use by parallel worker processes.  However, libpq might  
have extracted the password from a connection string originally passed  
as "dbname".  Since we don't record the original form of dbname but  
break it down to host/port/etc, the password gets lost.  Fix that by  
retrieving the actual password from the PGconn.  
  
(It strikes me that this whole approach is rather broken, as it will also  
lose other information such as options that might have been present in  
the connection string.  But we'll leave that problem for another day.)  
  
In passing, get rid of rather silly use of malloc() for small fixed-size  
arrays.  
  
Back-patch to 9.3 where parallel pg_dump was introduced.  
  
Report and fix by Zeus Kronion, adjusted a bit by Michael Paquier and me  

M src/bin/pg_dump/pg_backup_db.c

Comment improvements for abbreviated keys.

commit   : 120b31dc5406cf004b99150b84b48dc312577eca    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 22 Dec 2015 13:57:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 22 Dec 2015 13:57:18 -0500    

Click here for diff

Peter Geoghegan and Robert Haas  

M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

Make viewquery a copy in rewriteTargetView()

commit   : 496943ec2b6de0f22cd9e18f673e13635b5972ef    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 21 Dec 2015 10:34:20 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 21 Dec 2015 10:34:20 -0500    

Click here for diff

Rather than expect the Query returned by get_view_query() to be  
read-only and then copy bits and pieces of it out, simply copy the  
entire structure when we get it.  This addresses an issue where  
AcquireRewriteLocks, which is called by acquireLocksOnSubLinks(),  
scribbles on the parsetree passed in, which was actually an entry  
in relcache, leading to segfaults with certain view definitions.  
This also future-proofs us a bit for anyone adding more code to this  
path.  
  
The acquireLocksOnSubLinks() was added in commit c3e0ddd40.  
  
Back-patch to 9.3 as that commit was.  

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

Remove silly completion for "DELETE FROM tabname ...".

commit   : 0c28e767c612c9e90ae8ab188cf9b21114a34ddc    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Dec 2015 18:29:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Dec 2015 18:29:51 -0500    

Click here for diff

psql offered USING, WHERE, and SET in this context, but SET is not a valid  
possibility here.  Seems to have been a thinko in commit f5ab0a14ea83eb6c  
which added DELETE's USING option.  

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

psql: Review of new help output strings

commit   : 9ade78c65e1b98d2a8336be37d0442a53233c3b1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 20 Dec 2015 11:50:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 20 Dec 2015 11:50:04 -0500    

Click here for diff

M src/bin/psql/describe.c
M src/bin/psql/help.c

Add missing COSTS OFF to EXPLAIN commands in rowsecurity.sql.

commit   : 3ef762e7d806f18db743fd10bbf75a9b2631033c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Dec 2015 16:55:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Dec 2015 16:55:14 -0500    

Click here for diff

Commit e5e11c8cc added a bunch of EXPLAIN statements without COSTS OFF  
to the regression tests.  This is contrary to project policy since it  
results in unnecessary platform dependencies in the output (it's just  
luck that we didn't get buildfarm failures from it).  Per gripe from  
Mike Wilson.  

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

Fix tab completion for ALTER ... TABLESPACE ... OWNED BY.

commit   : 8ae22e7d36e349d7d8fd616fbf7f78cc03e301e0    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Dec 2015 17:37:11 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Dec 2015 17:37:11 +0100    

Click here for diff

Previously the completion used the wrong word to match 'BY'. This was  
introduced brokenly, in b2de2a. While at it, also add completion of  
IN TABLESPACE ... OWNED BY and fix comments referencing nonexistent  
syntax.  
  
Reported-By: Michael Paquier  
Author: Michael Paquier and Andres Freund  
Discussion: CAB7nPqSHDdSwsJqX0d2XzjqOHr==HdWiubCi4L=Zs7YFTUne8w@mail.gmail.com  
Backpatch: 9.4, like the commit introducing the bug  

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

pgbench: Change terminology from "threshold" to "parameter".

commit   : 2c5b57ec7f0155eef7bd8d152e546ee96b2feb5e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 13:24:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 13:24:51 -0500    

Click here for diff

Per a recommendation from Tomas Vondra, it's more helpful to refer to  
the value that determines how skewed a Gaussian or exponential  
distribution is as a parameter rather than a threshold.  
  
Since it's not quite too late to get this right in 9.5, where it was  
introduced, back-patch this.  Most of the patch changes only comments  
and documentation, but a few pgbench messages are altered to match.  
  
Fabien Coelho, reviewed by Michael Paquier and by me.  

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

Fix copy-and-paste error in logical decoding callback.

commit   : 550e9c23053c2540620dd0f72525ce2e47fd40a5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:17:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Dec 2015 12:17:35 -0500    

Click here for diff

This could result in the error context misidentifying where the error  
actually occurred.  
  
Craig Ringer  

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

Remove unreferenced function declarations.

commit   : 30020c3fc3b6de5592978313df929d370f5770ce    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 20:21:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 20:21:42 -0500    

Click here for diff

datapagemap_create() and datapagemap_destroy() were declared extern,  
but they don't actually exist anywhere.  Per YUriy Zhuravlev and  
Michael Paquier.  

M src/bin/pg_rewind/datapagemap.h

Fix improper initialization order for readline.

commit   : 5ec0aad018c3f36f9bd3e844f20562fb3c5d4590    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 16:55:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Dec 2015 16:55:23 -0500    

Click here for diff

Turns out we must set rl_basic_word_break_characters *before* we call  
rl_initialize() the first time, because it will quietly copy that value  
elsewhere --- but only on the first call.  (Love these undocumented  
dependencies.)  I broke this yesterday in commit 2ec477dc8108339d;  
like that commit, back-patch to all active branches.  Per report from  
Pavel Stehule.  

M src/bin/psql/input.c

Rework internals of changing a type's ownership

commit   : 0c6881fd142383845974ac836f3e6476cbe974ee    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Dec 2015 14:25:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Dec 2015 14:25:41 -0300    

Click here for diff

This is necessary so that REASSIGN OWNED does the right thing with  
composite types, to wit, that it also alters ownership of the type's  
pg_class entry -- previously, the pg_class entry remained owned by the  
original user, which caused later other failures such as the new owner's  
inability to use ALTER TYPE to rename an attribute of the affected  
composite.  Also, if the original owner is later dropped, the pg_class  
entry becomes owned by a non-existant user which is bogus.  
  
To fix, create a new routine AlterTypeOwner_oid which knows whether to  
pass the request to ATExecChangeOwner or deal with it directly, and use  
that in shdepReassignOwner rather than calling AlterTypeOwnerInternal  
directly.  AlterTypeOwnerInternal is now simpler in that it only  
modifies the pg_type entry and recurses to handle a possible array type;  
higher-level tasks are handled by either AlterTypeOwner directly or  
AlterTypeOwner_oid.  
  
I took the opportunity to add a few more objects to the test rig for  
REASSIGN OWNED, so that more cases are exercised.  Additional ones could  
be added for superuser-only-ownable objects (such as FDWs and event  
triggers) but I didn't want to push my luck by adding a new superuser to  
the tests on a backpatchable bug fix.  
  
Per bug #13666 reported by Chris Pacejo.  
  
Backpatch to 9.5.  
  
(I would back-patch this all the way back, except that it doesn't apply  
cleanly in 9.4 and earlier because 59367fdf9 wasn't backpatched.  If we  
decide that we need this in earlier branches too, we should backpatch  
both.)  

M src/backend/catalog/pg_shdepend.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/include/commands/typecmds.h
M src/test/regress/expected/dependency.out
M src/test/regress/sql/dependency.sql

Cope with Readline's failure to track SIGWINCH events outside of input.

commit   : f1c152866c4a0786e4ec5504348c10735456f630    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Dec 2015 16:58:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Dec 2015 16:58:55 -0500    

Click here for diff

It emerges that libreadline doesn't notice terminal window size change  
events unless they occur while collecting input.  This is easy to stumble  
over if you resize the window while using a pager to look at query output,  
but it can be demonstrated without any pager involvement.  The symptom is  
that queries exceeding one line are misdisplayed during subsequent input  
cycles, because libreadline has the wrong idea of the screen dimensions.  
  
The safest, simplest way to fix this is to call rl_reset_screen_size()  
just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)  
for every command; but since it only happens when reading from a tty, the  
performance impact should be negligible.  A more valid objection is that  
this still leaves a tiny window during entry to readline() wherein delivery  
of SIGWINCH will be missed; but the practical consequences of that are  
probably negligible.  In any case, there doesn't seem to be any good way to  
avoid the race, since readline exposes no functions that seem safe to call  
from a generic signal handler --- rl_reset_screen_size() certainly isn't.  
  
It turns out that we also need an explicit rl_initialize() call, else  
rl_reset_screen_size() dumps core when called before the first readline()  
call.  
  
rl_reset_screen_size() is not present in old versions of libreadline,  
so we need a configure test for that.  (rl_initialize() is present at  
least back to readline 4.0, so we won't bother with a test for it.)  
We would need a configure test anyway since libedit's emulation of  
libreadline doesn't currently include such a function.  Fortunately,  
libedit seems not to have any corresponding bug.  
  
Merlin Moncure, adjusted a bit by me  

M configure
M configure.in
M src/bin/psql/input.c
M src/include/pg_config.h.in

Stamp 9.5rc1.

commit   : 8abb52fa2971e16844d2a3e61b92fa347dc49d45    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 17:25:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 17:25:44 -0500    

Click here for diff

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

Document use of Subject Alternative Names in SSL server certificates.

commit   : 3ac806ccb5207810c7fe947ee44de4d242d42f97    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:57:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:57:23 -0500    

Click here for diff

Commit acd08d764 did not bother with updating the documentation.  

M doc/src/sgml/libpq.sgml

Update 9.5 release notes through today.

commit   : ddd78136764133b72bfe9102e60bbd49fa22b414    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:42:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Dec 2015 16:42:18 -0500    

Click here for diff

Also do another round of copy-editing, and fix up remaining FIXME items.  

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

Improve CREATE POLICY documentation

commit   : 46ae55c372761af5e02082ea934bebcba98040a4    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Dec 2015 10:08:14 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Dec 2015 10:08:14 -0500    

Click here for diff

Clarify that SELECT policies are now applied when SELECT rights  
are required for a given query, even if the query is an UPDATE or  
DELETE query.  Pointed out by Noah.  
  
Additionally, note the risk regarding concurrently open transactions  
where a relation which controls access to the rows of another relation  
are updated and the rows of the primary relation are also being  
modified.  Pointed out by Peter Geoghegan.  
  
Back-patch to 9.5.  

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

Collect the global OR of hasRowSecurity flags for plancache

commit   : 651e2ba74af997c2952672397828636dc6c6d017    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 14 Dec 2015 20:05:55 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 14 Dec 2015 20:05:55 -0500    

Click here for diff

We carry around information about if a given query has row security or  
not to allow the plancache to use that information to invalidate a  
planned query in the event that the environment changes.  
  
Previously, the flag of one of the subqueries was simply being copied  
into place to indicate if the query overall included RLS components.  
That's wrong as we need the global OR of all subqueries.  Fix by  
changing the code to match how fireRIRules works, which is results  
in OR'ing all of the flags.  
  
Noted by Tom.  
  
Back-patch to 9.5 where RLS was introduced.  

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

Add missing cleanup logic in pg_rewind/t/005_same_timeline.pl test.

commit   : 2c24f0f092acb59184c3a3ace4b6cea4ff308328    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Dec 2015 19:22:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Dec 2015 19:22:50 -0500    

Click here for diff

Per Michael Paquier  

M src/bin/pg_rewind/t/005_same_timeline.pl

pg_rewind: Don't error if the two clusters are already on the same timeline

commit   : 4b021aa6103f49bece51d58fd5e307d4d03380bc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Dec 2015 18:21:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Dec 2015 18:21:42 -0500    

Click here for diff

This previously resulted in an error and a nonzero exit status, but  
after discussion this should rather be a noop with a zero exit status.  
  
This is a back-patch of commit 6b34e5563849edc12896bf5754e8fe7b88012697,  
plus two changes from commit e50cda78404d6400b1326a996a4fabb144871151  
that teach pg_rewind to allow the initial control file states to be  
DB_SHUTDOWNED_IN_RECOVERY as well as DB_SHUTDOWNED.  That's necessary  
to get the additional regression test case to pass, and the old behavior  
seems like rather a foot-gun anyway.  
  
Peter Eisentraut and Tom Lane  

M src/bin/pg_rewind/pg_rewind.c
A src/bin/pg_rewind/t/005_same_timeline.pl

Add missing CHECK_FOR_INTERRUPTS in lseg_inside_poly

commit   : 188675256e15f7ad4d24ae976d1bb5fbb84f43e1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 Dec 2015 16:44:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 Dec 2015 16:44:40 -0300    

Click here for diff

Apparently, there are bugs in this code that cause it to loop endlessly.  
That bug still needs more research, but in the meantime it's clear that  
the loop is missing a check for interrupts so that it can be cancelled  
timely.  
  
Backpatch to 9.1 -- this has been missing since 49475aab8d0d.  

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

Remove xmlparse(document '') test

commit   : c6eced09b25d12d73b93a740f2d81c22bb7e3d1f    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 14 Dec 2015 11:46:47 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 14 Dec 2015 11:46:47 -0600    

Click here for diff

This one test was behaving differently between the ubuntu fix for  
CVE-2015-7499 and the base "expected" file.  It's not worth having  
yet another version of the expected file for this test, so drop it.  
Perhaps at some point when all distros have settled down to the  
same behavior on this test, it can be restored.  
  
Problem found by me on libxml2 (2.9.1+dfsg1-3ubuntu4.6).  
Solution suggested by Tom Lane.  
Backpatch to 9.5, where the test was added.  

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

Fix out-of-memory error handling in ParameterDescription message processing.

commit   : 34d136f92ac65c4ed8ede9459217ef900d603f97    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Dec 2015 18:19:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Dec 2015 18:19:10 +0200    

Click here for diff

If libpq ran out of memory while constructing the result set, it would hang,  
waiting for more data from the server, which might never arrive. To fix,  
distinguish between out-of-memory error and not-enough-data cases, and give  
a proper error message back to the client on OOM.  
  
There are still similar issues in handling COPY start messages, but let's  
handle that as a separate patch.  
  
Michael Paquier, Amit Kapila and me. Backpatch to all supported versions.  

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

Fix bug in SetOffsetVacuumLimit() triggered by find_multixact_start() failure.

commit   : ccde00b9b97ed8b7307e39f95bd48922bf955bb2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:34:16 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:34:16 +0100    

Click here for diff

Previously, if find_multixact_start() failed, SetOffsetVacuumLimit() would  
install 0 into MultiXactState->offsetStopLimit if it previously succeeded.  
Luckily, there are no known cases where find_multixact_start() will return  
an error in 9.5 and above. But if it were to happen, for example due to  
filesystem permission issues, it'd be somewhat bad: GetNewMultiXactId()  
could continue allocating mxids even if close to a wraparound, or it could  
erroneously stop allocating mxids, even if no wraparound is looming.  The  
wrong value would be corrected the next time SetOffsetVacuumLimit() is  
called, or by a restart.  
  
Reported-By: Noah Misch, although this is not his preferred fix  
Discussion: [email protected]  
Backpatch: 9.5, where the bug was introduced as part of 4f627f  

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

Correct statement to actually be the intended assert statement.

commit   : cb89644bb0df1921c6a15aa294903a9458c2a67d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:25:04 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Dec 2015 11:25:04 +0100    

Click here for diff

e3f4cfc7 introduced a LWLockHeldByMe() call, without the corresponding  
Assert() surrounding it.  
  
Spotted by Coverity.  
  
Backpatch: 9.1+, like the previous commit  

M src/backend/storage/buffer/bufmgr.c

Docs: document that psql's "\i -" means read from stdin.

commit   : c9ed438817661238901f43ea10aab8f120ea837f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Dec 2015 23:42:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Dec 2015 23:42:54 -0500    

Click here for diff

This has worked that way for a long time, maybe always, but you would  
not have known it from the documentation.  Also back-patch the notes  
I added to HEAD earlier today about behavior of the "-f -" switch,  
which likewise have been valid for many releases.  

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

Consistently set all fields in pg_stat_replication to null instead of 0

commit   : 28c366789e78af82dfd89ecb6cc32724f58d6a1b    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:53:38 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:53:38 +0100    

Click here for diff

Previously the "sent" field would be set to 0 and all other xlog  
pointers be set to NULL if there were no valid values (such as when  
in a backup sending walsender).  

M src/backend/replication/walsender.c

Properly initialize write, flush and replay locations in walsender slots

commit   : a9c56ff0e1f19fd6c2e48cfe44407c8cb8c4fbd5    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:40:37 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 13 Dec 2015 16:40:37 +0100    

Click here for diff

These would leak random xlog positions if a walsender used for backup would  
a walsender slot previously used by a replication walsender.  
  
In passing also fix a couple of cases where the xlog pointer is directly  
compared to zero instead of using XLogRecPtrIsInvalid, noted by  
Michael Paquier.  

M src/backend/replication/walsender.c

Doc: update external URLs for PostGIS project.

commit   : 332be65b5e6a99420dd9b2762fe3e5602538053d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Dec 2015 20:02:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Dec 2015 20:02:09 -0500    

Click here for diff

Paul Ramsey  

M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/release-8.4.sgml

Fix ALTER TABLE ... SET TABLESPACE for unlogged relations.

commit   : ada9c09aebbe6c37d545fca29ac8c0e690158e80    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Dec 2015 14:19:19 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Dec 2015 14:19:19 +0100    

Click here for diff

Changing the tablespace of an unlogged relation did not WAL log the  
creation and content of the init fork. Thus, after a standby is  
promoted, unlogged relation cannot be accessed anymore, with errors  
like:  
ERROR:  58P01: could not open file "pg_tblspc/...": No such file or directory  
Additionally the init fork was not synced to disk, independent of the  
configured wal_level, a relatively small durability risk.  
  
Investigation of that problem also brought to light that, even for  
permanent relations, the creation of !main forks was not WAL logged,  
i.e. no XLOG_SMGR_CREATE record were emitted. That mostly turns out not  
to be a problem, because these files were created when the actual  
relation data is copied; nonexistent files are not treated as an error  
condition during replay. But that doesn't work for empty files, and  
generally feels a bit haphazard. Luckily, outside init and main forks,  
empty forks don't occur often or are not a problem.  
  
Add the required WAL logging and syncing to disk.  
  
Reported-By: Michael Paquier  
Author: Michael Paquier and Andres Freund  
Discussion: [email protected]  
Backpatch: 9.1, where unlogged relations were introduced  

M src/backend/commands/tablecmds.c

Add an expected-file to match behavior of latest libxml2.

commit   : ea7f7d8b322f0fd13419da1c0c46f7a9c74eef15    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 19:08:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 19:08:40 -0500    

Click here for diff

Recent releases of libxml2 do not provide error context reports for errors  
detected at the very end of the input string.  This appears to be a bug, or  
at least an infelicity, introduced by the fix for libxml2's CVE-2015-7499.  
We can hope that this behavioral change will get undone before too long;  
but the security patch is likely to spread a lot faster/further than any  
follow-on cleanup, which means this behavior is likely to be present in the  
wild for some time to come.  As a stopgap, add a variant regression test  
expected-file that matches what you get with a libxml2 that acts this way.  

A src/test/regress/expected/xml_2.out

For REASSIGN OWNED for foreign user mappings

commit   : 31f88a12a0d9e340f7ccf49e5f133835499c981b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 18:39:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 18:39:09 -0300    

Click here for diff

As reported in bug #13809 by Alexander Ashurkov, the code for REASSIGN  
OWNED hadn't gotten word about user mappings.  Deal with them in the  
same way default ACLs do, which is to ignore them altogether; they are  
handled just fine by DROP OWNED.  The other foreign object cases are  
already handled correctly by both commands.  
  
Also add a REASSIGN OWNED statement to foreign_data test to exercise the  
foreign data objects.  (The changes are just before the "cleanup" phase,  
so it shouldn't remove any existing live test.)  
  
Reported by Alexander Ashurkov, then independently by Jaime Casanova.  

M src/backend/catalog/pg_shdepend.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Install our "missing" script where PGXS builds can find it.

commit   : 6061aa8ed763f1d9d37d402a0e5769c823dd797c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 16:14:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 16:14:27 -0500    

Click here for diff

This allows sane behavior in a PGXS build done on a machine where build  
tools such as bison are missing.  
  
Jim Nasby  

M config/Makefile

Handle policies during DROP OWNED BY

commit   : fda18e46a65196b98d6ca4ce4911085b0d2f182f    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 16:12:36 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 16:12:36 -0500    

Click here for diff

DROP OWNED BY handled GRANT-based ACLs but was not removing roles from  
policies.  Fix that by having DROP OWNED BY remove the role specified  
from the list of roles the policy (or policies) apply to, or the entire  
policy (or policies) if it only applied to the role specified.  
  
As with ACLs, the DROP OWNED BY caller must have permission to modify  
the policy or a WARNING is thrown and no change is made to the policy.  

M src/backend/catalog/pg_shdepend.c
M src/backend/commands/policy.c
M src/include/commands/policy.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Get rid of the planner's LateralJoinInfo data structure.

commit   : dc4518814ecc2ae319c4d1679ee079e47dbd78e9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 15:52:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 15:52:16 -0500    

Click here for diff

I originally modeled this data structure on SpecialJoinInfo, but after  
commit acfcd45cacb6df23 that looks like a pretty poor decision.  
All we really need is relid sets identifying laterally-referenced rels;  
and most of the time, what we want to know about includes indirect lateral  
references, a case the LateralJoinInfo data was unsuited to compute with  
any efficiency.  The previous commit redefined RelOptInfo.lateral_relids  
as the transitive closure of lateral references, so that it easily supports  
checking indirect references.  For the places where we really do want just  
direct references, add a new RelOptInfo field direct_lateral_relids, which  
is easily set up as a copy of lateral_relids before we perform the  
transitive closure calculation.  Then we can just drop lateral_info_list  
and LateralJoinInfo and the supporting code.  This makes the planner's  
handling of lateral references noticeably more efficient, and shorter too.  
  
Such a change can't be back-patched into stable branches for fear of  
breaking extensions that might be looking at the planner's data structures;  
but it seems not too late to push it into 9.5, so I've done so.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/var.c
M src/backend/rewrite/rewriteManip.c
M src/include/nodes/nodes.h
M src/include/nodes/relation.h

Handle dependencies properly in ALTER POLICY

commit   : 12a54c888cf7bd9c37c4ce420e84cb52debe0184    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 15:44:03 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 11 Dec 2015 15:44:03 -0500    

Click here for diff

ALTER POLICY hadn't fully considered partial policy alternation  
(eg: change just the roles on the policy, or just change one of  
the expressions) when rebuilding the dependencies.  Instead, it  
would happily remove all dependencies which existed for the  
policy and then only recreate the dependencies for the objects  
referred to in the specific ALTER POLICY command.  
  
Correct that by extracting and building the dependencies for all  
objects referenced by the policy, regardless of if they were  
provided as part of the ALTER POLICY command or were already in  
place as part of the pre-existing policy.  

M src/backend/commands/policy.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Still more fixes for planner's handling of LATERAL references.

commit   : 564c19e86eff3f2221471e60a963d55bd5f76954    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 14:22:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Dec 2015 14:22:20 -0500    

Click here for diff

More fuzz testing by Andreas Seltenreich exposed that the planner did not  
cope well with chains of lateral references.  If relation X references Y  
laterally, and Y references Z laterally, then we will have to scan X on the  
inside of a nestloop with Z, so for all intents and purposes X is laterally  
dependent on Z too.  The planner did not understand this and would generate  
intermediate joins that could not be used.  While that was usually harmless  
except for wasting some planning cycles, under the right circumstances it  
would lead to "failed to build any N-way joins" or "could not devise a  
query plan" planner failures.  
  
To fix that, convert the existing per-relation lateral_relids and  
lateral_referencers relid sets into their transitive closures; that is,  
they now show all relations on which a rel is directly or indirectly  
laterally dependent.  This not only fixes the chained-reference problem  
but allows some of the relevant tests to be made substantially simpler  
and faster, since they can be reduced to simple bitmap manipulations  
instead of searches of the LateralJoinInfo list.  
  
Also, when a PlaceHolderVar that is due to be evaluated at a join contains  
lateral references, we should treat those references as indirect lateral  
dependencies of each of the join's base relations.  This prevents us from  
trying to join any individual base relations to the lateral reference  
source before the join is formed, which again cannot work.  
  
Andreas' testing also exposed another oversight in the "dangerous  
PlaceHolderVar" test added in commit 85e5e222b1dd02f1.  Simply rejecting  
unsafe join paths in joinpath.c is insufficient, because in some cases  
we will end up rejecting *all* possible paths for a particular join, again  
leading to "could not devise a query plan" failures.  The restriction has  
to be known also to join_is_legal and its cohort functions, so that they  
will not select a join for which that will happen.  I chose to move the  
supporting logic into joinrels.c where the latter functions are.  
  
Back-patch to 9.3 where LATERAL support was introduced.  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix commit timestamp initialization

commit   : 0f2c089d3423bcf2bb11d1e5d2d38638cc31fec4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 14:30:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Dec 2015 14:30:43 -0300    

Click here for diff

This module needs explicit initialization in order to replay WAL records  
in recovery, but we had broken this recently following changes to make  
other (stranger) scenarios work correctly.  To fix, rework the  
initialization sequence so that it always takes place before WAL replay  
commences for both master and standby.  
  
I could have gone for a more localized fix that just added a "startup"  
call for the master server, but it seemed better to restructure the  
existing callers as well so that the whole thing made more sense.  As a  
drawback, there is more control logic in xlog.c now than previously, but  
doing otherwise meant passing down the ControlFile flag, which seemed  
uglier as a whole.  
  
This also meant adding a check to not re-execute ActivateCommitTs if it  
had already been called.  
  
Reported by Fujii Masao.  
  
Backpatch to 9.5.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Improve some messages

commit   : 0fc7c4a557752652ebddddb55ad11228129b530e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Dec 2015 22:05:27 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Dec 2015 22:05:27 -0500    

Click here for diff

M src/backend/access/transam/commit_ts.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/policy.c
M src/backend/commands/user.c
M src/backend/executor/nodeCustom.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/object_address.out

Improve ALTER POLICY tab completion.

commit   : dcf5d7fb14b3ec59b436ce27d843574b6407e5b4    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 12:28:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 12:28:46 -0500    

Click here for diff

Complete "ALTER POLICY" with a policy name, as we do for DROP POLICY.  
And, complete "ALTER POLICY polname ON" with a table name that has such  
a policy, as we do for DROP POLICY, rather than with any table name  
at all.  
  
Masahiko Sawada  

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

Fix typo.

commit   : b994acf705bea9840880b1860dca9ceb0f4785ee    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 11:13:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Dec 2015 11:13:24 -0500    

Click here for diff

Etsuro Fujita  

M doc/src/sgml/fdwhandler.sgml

Fix ON CONFLICT UPDATE bug breaking AFTER UPDATE triggers.

commit   : 34263e8e4a679ee785e601566bf144bf1f50a2b6    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:26:45 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:26:45 +0100    

Click here for diff

ExecOnConflictUpdate() passed t_ctid of the to-be-updated tuple to  
ExecUpdate(). That's problematic primarily because of two reason: First  
and foremost t_ctid could point to a different tuple. Secondly, and  
that's what triggered the complaint by Stanislav, t_ctid is changed by  
heap_update() to point to the new tuple version.  The behavior of AFTER  
UPDATE triggers was therefore broken, with NEW.* and OLD.* tuples  
spuriously identical within AFTER UPDATE triggers.  
  
To fix both issues, pass a pointer to t_self of a on-stack HeapTuple  
instead.  
  
Fixing this bug lead to one change in regression tests, which previously  
failed due to the first issue mentioned above. There's a reasonable  
expectation that test fails, as it updates one row repeatedly within one  
INSERT ... ON CONFLICT statement. That is only possible if the second  
update is triggered via ON CONFLICT ... SET, ON CONFLICT ... WHERE, or  
by a WITH CHECK expression, as those are executed after  
ExecOnConflictUpdate() does a visibility check. That could easily be  
prohibited, but given it's allowed for plain UPDATEs and a rare corner  
case, it doesn't seem worthwhile.  
  
Reported-By: Stanislav Grozev  
Author: Andres Freund and Peter Geoghegan  
Discussion: CAA78GVqy1+LisN-8DygekD_Ldfy=BJLarSpjGhytOsgkpMavfQ@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Fix bug leading to restoring unlogged relations from empty files.

commit   : 5b51805fe4b9fec95274924c5733093a5f685a58    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:25:12 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 10 Dec 2015 16:25:12 +0100    

Click here for diff

At the end of crash recovery, unlogged relations are reset to the empty  
state, using their init fork as the template. The init fork is copied to  
the main fork without going through shared buffers. Unfortunately WAL  
replay so far has not necessarily flushed writes from shared buffers to  
disk at that point. In normal crash recovery, and before the  
introduction of 'fast promotions' in fd4ced523 / 9.3, the  
END_OF_RECOVERY checkpoint flushes the buffers out in time. But with  
fast promotions that's not the case anymore.  
  
To fix, force WAL writes targeting the init fork to be flushed  
immediately (using the new FlushOneBuffer() function). In 9.5+ that  
flush can centrally be triggered from the code dealing with restoring  
full page writes (XLogReadBufferForRedoExtended), in earlier releases  
that responsibility is in the hands of XLOG_HEAP_NEWPAGE's replay  
function.  
  
Backpatch to 9.1, even if this currently is only known to trigger in  
9.3+. Flushing earlier is more robust, and it is advantageous to keep  
the branches similar.  
  
Typical symptoms of this bug are errors like  
'ERROR:  index "..." contains unexpected zero page at block 0'  
shortly after promoting a node.  
  
Reported-By: Thom Brown  
Author: Andres Freund and Michael Paquier  
Discussion: [email protected]  
Backpatch: 9.1-  

M src/backend/access/transam/xlogutils.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Accept flex > 2.5.x on Windows, too.

commit   : 2355faae010591febd2b39e74b209a5236f6682a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Dec 2015 10:19:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Dec 2015 10:19:13 -0500    

Click here for diff

Commit 32f15d05c fixed this in configure, but missed the similar check  
in the MSVC scripts.  
  
Michael Paquier, per report from Victor Wagner  

M src/tools/msvc/pgflex.pl

commit   : c3c5c02881d47b3bf8d9e1e1e3460ef348863035    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Dec 2015 18:54:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Dec 2015 18:54:25 -0500    

Click here for diff

While convincing myself that commit 7e19db0c09719d79 would solve both of  
the problems recently reported by Andreas Seltenreich, I realized that  
add_paths_to_joinrel's handling of LATERAL restrictions could be made  
noticeably simpler and faster if we were to retain the minimum possible  
parameterization for each joinrel (that is, the set of relids supplying  
unsatisfied lateral references in it).  We already retain that for  
baserels, in RelOptInfo.lateral_relids, so we can use that field for  
joinrels too.  
  
This is a back-port of commit edca44b1525b3d591263d032dc4fe500ea771e0e.  
I originally intended not to back-patch that, but additional hacking  
in this area turns out to be needed, making it necessary not optional  
to compute lateral_relids for joinrels.  In preparation for those fixes,  
sync the relevant code with HEAD as much as practical.  (I did not risk  
rearranging fields of RelOptInfo in released branches, however.)  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h

Remove redundant sentence.

commit   : 4acee11e660aa5dd22d81a1d1d4476e158c16a59    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Dec 2015 14:11:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Dec 2015 14:11:58 -0500    

Click here for diff

Peter Geoghegan  

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

Make failure to open psql's --log-file fatal.

commit   : e90371d1a79f4398867f4f3bb8547e94259b07b5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 17:14:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 17:14:46 -0500    

Click here for diff

Commit 344cdff2c made failure to open the target of --output fatal.  
For consistency, the --log-file switch should behave similarly.  
Like the previous commit, back-patch to 9.5 but no further.  
  
Daniel Verite  

M src/bin/psql/startup.c

Avoid odd portability problem in TestLib.pm's slurp_file function.

commit   : 59f10ffa5bc1f39a5ce00806b394feb8f207bb33    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 16:58:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Dec 2015 16:58:05 -0500    

Click here for diff

For unclear reasons, this function doesn't always read the expected data  
in some old Perl versions.  Rewriting it to avoid use of ARGV seems to  
dodge the problem, and this version is clearer anyway if you ask me.  
  
In passing, also improve error message in adjacent append_to_file function.  

M src/test/perl/TestLib.pm

Allow foreign and custom joins to handle EvalPlanQual rechecks.

commit   : 325b357bc255149c5ace7d77f5c15c941bafef0a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Dec 2015 12:31:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Dec 2015 12:31:03 -0500    

Click here for diff

Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 provided basic  
infrastructure for allowing a foreign data wrapper or custom scan  
provider to replace a join of one or more tables with a scan.  
However, this infrastructure failed to take into account the need  
for possible EvalPlanQual rechecks, and ExecScanFetch would fail  
an assertion (or just overwrite memory) if such a check was attempted  
for a plan containing a pushed-down join.  To fix, adjust the EPQ  
machinery to skip some processing steps when scanrelid == 0, making  
those the responsibility of scan's recheck method, which also has  
the responsibility in this case of correctly populating the relevant  
slot.  
  
To allow foreign scans to gain control in the right place to make  
use of this new facility, add a new, optional RecheckForeignScan  
method.  Also, allow a foreign scan to have a child plan, which can  
be used to correctly populate the slot (or perhaps for something  
else, but this is the only use currently envisioned).  
  
KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro  
Horiguchi.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execScan.c
M src/backend/executor/nodeForeignscan.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/foreign/fdwapi.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h

Fix another oversight in checking if a join with LATERAL refs is legal.

commit   : 25517ee14c1a018876b64dce73e8f7fb7e937783    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Dec 2015 17:41:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Dec 2015 17:41:45 -0500    

Click here for diff

It was possible for the planner to decide to join a LATERAL subquery to  
the outer side of an outer join before the outer join itself is completed.  
Normally that's fine because of the associativity rules, but it doesn't  
work if the subquery contains a lateral reference to the inner side of the  
outer join.  In such a situation the outer join *must* be done first.  
join_is_legal() missed this consideration and would allow the join to be  
attempted, but the actual path-building code correctly decided that no  
valid join path could be made, sometimes leading to planner errors such as  
"failed to build any N-way joins".  
  
Per report from Andreas Seltenreich.  Back-patch to 9.3 where LATERAL  
support was added.  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/pathnode.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Update xindex.sgml for recent additions to GIST opclass API.

commit   : 9d1839fad945cba7e23e645a3c212f34e56495f7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Dec 2015 12:42:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Dec 2015 12:42:32 -0500    

Click here for diff

Commit d04c8ed9044ec added another support function to the GIST API,  
but overlooked mentioning it in xindex.sgml's summary of index support  
functions.  
  
Anastasia Lubennikova  

M doc/src/sgml/xindex.sgml

Create TestLib.pm's tempdir underneath tmp_check/, not out in the open.

commit   : 20c444f5b5ef155147b8f3ef115f6bc5382fd2c6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Dec 2015 13:23:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Dec 2015 13:23:48 -0500    

Click here for diff

This way, existing .gitignore entries and makefile clean actions will  
automatically apply to the tempdir, should it survive a TAP test run  
(which can happen if the user control-C's out of the run, for example).  
  
Michael Paquier, per a complaint from me  

M src/test/perl/TestLib.pm

Instruct Coverity using an assertion.

commit   : 0d46bdde2b59e67446e10165e487935a54dfd225    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 5 Dec 2015 03:04:17 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 5 Dec 2015 03:04:17 -0500    

Click here for diff

This should make Coverity deduce that plperl_call_perl_func() does not  
dereference NULL argtypes.  Back-patch to 9.5, where the affected code  
was introduced.  
  
Michael Paquier  

M src/pl/plperl/plperl.c

Further improve documentation of the role-dropping process.

commit   : d3762fe6c208c4f5e66db24a10ddc549e9e08e0f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Dec 2015 14:44:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Dec 2015 14:44:13 -0500    

Click here for diff

In commit 1ea0c73c2 I added a section to user-manag.sgml about how to drop  
roles that own objects; but as pointed out by Stephen Frost, I neglected  
that shared objects (databases or tablespaces) may need special treatment.  
Fix that.  Back-patch to supported versions, like the previous patch.  

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

Further tweak commit_timestamp behavior

commit   : 16e8e62d274a6026045bf809da38bc8ac33b9185    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Dec 2015 19:22:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Dec 2015 19:22:31 -0300    

Click here for diff

As pointed out by Fujii Masao, we weren't quite there on a standby  
behaving sanely: first because we were failing to acquire the correct  
state in the case where no XLOG_PARAMETER_CHANGE message was sent  
(because a checkpoint had already happened after the setting was changed  
in the master, and then the standby was restarted); and second because  
promoting the standby with the feature enabled failed to activate it if  
the master had the feature disabled.  
  
This patch fixes both those misbehaviors hopefully without  
re-introducing any old problems.  
  
Also change the hint emitted in a standby together with the error  
message about the feature being disabled, to make it point out that the  
place to chance the setting is the master.  Otherwise, if the setting is  
already enabled in the standby, it is very confusing to have it say that  
the setting must be enabled ...  
  
Authors: Álvaro Herrera, Petr Jelínek.  
Backpatch to 9.5.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Clean up some psql issues around handling of the query output file.

commit   : 07338cb7425ee661ea2b80c1a3826bee1bc1a1de    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Dec 2015 14:29:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Dec 2015 14:29:07 -0500    

Click here for diff

Formerly, if "psql -o foo" failed to open the output file "foo", it would  
print an error message but then carry on as though -o had not been  
specified at all.  This seems contrary to expectation: a program that  
cannot open its output file normally fails altogether.  Make psql do  
exit(1) after reporting the error.  
  
If "\o foo" failed to open "foo", it would print an error message but then  
reset the output file to stdout, as if the argument had been omitted.  
This is likewise pretty surprising behavior.  Make it keep the previous  
output state, instead.  
  
psql keeps SIGPIPE interrupts disabled when it is writing to a pipe, either  
a pipe specified by -o/\o or a transient pipe opened for purposes such as  
using a pager on query output.  The logic for this was too simple and could  
sometimes re-enable SIGPIPE when a -o pipe was still active, thus possibly  
leading to an unexpected psql crash later.  
  
Fixing the last point required getting rid of the kluge in PrintQueryTuples  
and ExecQueryUsingCursor whereby they'd transiently change the global  
queryFout state, but that seems like good cleanup anyway.  
  
Back-patch to 9.5 but not further; these are minor-enough issues that  
changing the behavior in stable branches doesn't seem appropriate.  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/psql/startup.c

psql: Improve spelling

commit   : 28bfdc581a552e2a3b1f0faded352188559e5aca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:23:59 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:23:59 -0500    

Click here for diff

M src/bin/psql/command.c

doc: Fix markup and improve placeholder names

commit   : 0638a62dec88b148b560e5fb240087098fe58887    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:20:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Dec 2015 10:20:54 -0500    

Click here for diff

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

Fix behavior of printTable() and friends with externally-invoked pager.

commit   : 375a3b3397487e46c9c607f23db4851eb5bb9ece    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Dec 2015 18:20:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Dec 2015 18:20:34 -0500    

Click here for diff

The formatting modes that depend on knowledge of the terminal window width  
did not work right when printing a query result that's been fetched in  
sections (as a result of FETCH_SIZE).  ExecQueryUsingCursor() would force  
use of the pager as soon as there's more than one result section, and then  
print.c would see an output file pointer that's not stdout and incorrectly  
conclude that the terminal window width isn't relevant.  
  
This has been broken all along for non-expanded "wrapped" output format,  
and as of 9.5 the issue affects expanded mode as well.  The problem also  
caused "\pset expanded auto" mode to invariably *not* switch to expanded  
output in a segmented result, which seems to me to be exactly backwards.  
  
To fix, we need to pass down an "is_pager" flag to inform the print.c  
subroutines that some calling level has already replaced stdout with a  
pager pipe, so they should (a) not do that again and (b) nonetheless honor  
the window size.  (Notably, this makes the first is_pager test in  
print_aligned_text() not be dead code anymore.)  
  
This patch is a bit invasive because there are so many existing calls of  
printQuery()/printTable(), but fortunately all but a couple can just pass  
"false" for the added parameter.  
  
Back-patch to 9.5 but no further.  Given the lack of field complaints,  
it's not clear that we should change the behavior in stable branches.  
Also, the API change for printQuery()/printTable() might possibly break  
third-party code, again something we don't like to do in stable branches.  
However, it's not quite too late to do this in 9.5, and with the larger  
scope of the problem there, it seems worth doing.  

M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/bin/psql/large_obj.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/scripts/createlang.c
M src/bin/scripts/droplang.c

Make gincostestimate() cope with hypothetical GIN indexes.

commit   : e9986a811cbed36915ce7a7bb76bca8df69ab1d5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 16:24:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 16:24:34 -0500    

Click here for diff

We tried to fetch statistics data from the index metapage, which does not  
work if the index isn't actually present.  If the index is hypothetical,  
instead extrapolate some plausible internal statistics based on the index  
page count provided by the index-advisor plugin.  
  
There was already some code in gincostestimate() to invent internal stats  
in this way, but since it was only meant as a stopgap for pre-9.1 GIN  
indexes that hadn't been vacuumed since upgrading, it was pretty crude.  
If we want it to support index advisors, we should try a little harder.  
A small amount of testing says that it's better to estimate the entry pages  
as 90% of the index, not 100%.  Also, estimating the number of entries  
(keys) as equal to the heap tuple count could be wildly wrong in either  
direction.  Instead, let's estimate 100 entries per entry page.  
  
Perhaps someday somebody will want the index advisor to be able to provide  
these numbers more directly, but for the moment this should serve.  
  
Problem report and initial patch by Julien Rouhaud; modified by me to  
invent less-bogus internal statistics.  Back-patch to all supported  
branches, since we've supported index advisors since 9.0.  

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

Further tweaking of print_aligned_vertical().

commit   : 181346cf9892820c94f51525d2c38684148812bf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 14:47:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 14:47:13 -0500    

Click here for diff

Don't force the data width to extend all the way to the right margin if it  
doesn't need to.  This reverts the behavior in non-wrapping cases to be  
what it was in 9.4.  Also, make the logic that ensures the data line width  
is at least equal to the record-header line width a little less obscure.  
  
In passing, avoid possible calculation of log10(0).  Probably that's  
harmless, given the lack of field complaints, but it seems risky:  
conversion of NaN to an integer isn't well defined.  

M src/bin/psql/print.c
M src/test/regress/expected/psql.out

Use "g" not "f" format in ecpg's PGTYPESnumeric_from_double().

commit   : c79bdc9904afefeee495455be7dea737d714fbb4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:42:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:42:25 -0500    

Click here for diff

The previous coding could overrun the provided buffer size for a very large  
input, or lose precision for a very small input.  Adopt the methodology  
that's been in use in the equivalent backend code for a long time.  
  
Per private report from Bas van Schaik.  Back-patch to all supported  
branches.  

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

Further adjustment to psql's print_aligned_vertical() function.

commit   : 6fe8ca0a2f8ac5ce2656addb0f6741b5315a8a23    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:07:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Dec 2015 11:07:29 -0500    

Click here for diff

We should ignore output_columns unless it's greater than zero.  
A zero means we couldn't get any information from ioctl(TIOCGWINSZ);  
in that case the expected behavior is to print the data at native width,  
not to wrap it at the smallest possible value.  print_aligned_text()  
gets this consideration right, but print_aligned_vertical() lost track  
of this detail somewhere along the line.  

M src/bin/psql/print.c

Rework wrap-width calculation in psql's print_aligned_vertical() function.

commit   : 4122ebcb1056655f23193e4632dccce68c524e43    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Nov 2015 17:53:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Nov 2015 17:53:32 -0500    

Click here for diff

This area was rather heavily whacked around in 6513633b9 and follow-on  
commits, and it was showing it, because the logic to calculate the  
allowable data width in wrapped expanded mode had only the vaguest  
relationship to the logic that was actually printing the data.  It was  
not very close to being right about the conditions requiring overhead  
columns to be added.  Aside from being wrong, it was pretty unreadable  
and under-commented.  Rewrite it so it corresponds to what the printing  
code actually does.  
  
In passing, remove a couple of dead tests in the printing logic, too.  
  
Per a complaint from Jeff Janes, though this doesn't look much like his  
patch because it fixes a number of other corner-case bogosities too.  
One such fix that's visible in the regression test results is that  
although the code was attempting to enforce a minimum data width of  
3 columns, it sometimes left less space than that available.  

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

Avoid caching expression state trees for domain constraints across queries.

commit   : e69d3a82e46461da4c3878487fb99c1294fb1d8f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Nov 2015 18:18:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Nov 2015 18:18:42 -0500    

Click here for diff

In commit 8abb3cda0ddc00a0ab98977a1633a95b97068d4e I attempted to cache  
the expression state trees constructed for domain CHECK constraints for  
the life of the backend (assuming the domain's constraints don't get  
redefined).  However, this turns out not to work very well, because  
execQual.c will run those state trees with ecxt_per_query_memory pointing  
to a query-lifespan context, and in some situations we'll end up with  
pointers into that context getting stored into the state trees.  This  
happens in particular with SQL-language functions, as reported by  
Emre Hasegeli, but there are many other cases.  
  
To fix, keep only the expression plan trees for domain CHECK constraints  
in the typcache's data structure, and revert to performing ExecInitExpr  
(at least) once per query to set up expression state trees in the query's  
context.  
  
Eventually it'd be nice to undo this, but that will require some careful  
thought about memory management for expression state trees, and it seems  
far too late for any such redesign in 9.5.  This way is still much more  
efficient than what happened before 8abb3cda0.  

M src/backend/utils/cache/typcache.c
M src/include/utils/typcache.h
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Fix failure to consider failure cases in GetComboCommandId().

commit   : daefb9810807709d13ce42cc0e7220d77b368be9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Nov 2015 13:23:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Nov 2015 13:23:02 -0500    

Click here for diff

Failure to initially palloc the comboCids array, or to realloc it bigger  
when needed, left combocid's data structures in an inconsistent state that  
would cause trouble if the top transaction continues to execute.  Noted  
while examining a user complaint about the amount of memory used for this.  
(There's not much we can do about that, but it does point up that repalloc  
failure has a non-negligible chance of occurring here.)  
  
In HEAD/9.5, also avoid possible invocation of memcpy() with a null pointer  
in SerializeComboCIDState; cf commit 13bba0227.  

M src/backend/utils/time/combocid.c

Be more paranoid about null return values from libpq status functions.

commit   : 55a2cc844216838d743cae7d94bd4f38acc62d1e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Nov 2015 17:31:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Nov 2015 17:31:53 -0500    

Click here for diff

PQhost() can return NULL in non-error situations, namely when a Unix-socket  
connection has been selected by default.  That behavior is a tad debatable  
perhaps, but for the moment we should make sure that psql copes with it.  
Unfortunately, do_connect() failed to: it could pass a NULL pointer to  
strcmp(), resulting in crashes on most platforms.  This was reported as a  
security issue by ChenQin of Topsec Security Team, but the consensus of  
the security list is that it's just a garden-variety bug with no security  
implications.  
  
For paranoia's sake, I made the keep_password test not trust PQuser or  
PQport either, even though I believe those will never return NULL given  
a valid PGconn.  
  
Back-patch to all supported branches.  

M src/bin/psql/command.c

pg_upgrade: fix CopyFile() on Windows to fail on file existence

commit   : b17dbf26293e3805b5f7ab5a11a8e3f984c476ad    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Nov 2015 17:18:28 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Nov 2015 17:18:28 -0500    

Click here for diff

Also fix getErrorText() to return the right error string on failure.  
This behavior now matches that of other operating systems.  
  
Report by Noah Misch  
  
Backpatch through 9.1  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c

doc: Some improvements on CREATE POLICY and ALTER POLICY documentation

commit   : b542d940c308d35446e86c2bb273823303afb25c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 21:36:57 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 21:36:57 -0500    

Click here for diff

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

Clarify pg_rewind connection requirements.

commit   : f01fcd0e41721510ca76906c670ddb051e628bc1    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 23 Nov 2015 19:30:36 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 23 Nov 2015 19:30:36 +0300    

Click here for diff

Per http://www.postgresql.org/message-id/flat/[email protected]  
Pavel Luzanov <[email protected]>  

M doc/src/sgml/ref/pg_rewind.sgml

doc: Add more documentation about wal_retrieve_retry_interval

commit   : f1824e55137fc7a30d5ac11aafdaba533fc1a6b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 09:13:44 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Nov 2015 09:13:44 -0500    

Click here for diff

from Michael Paquier  

M doc/src/sgml/config.sgml

Adopt the GNU convention for handling tar-archive members exceeding 8GB.

commit   : 5f5e68b087e557fcddb7d28b096eead417623375    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Nov 2015 20:21:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Nov 2015 20:21:32 -0500    

Click here for diff

The POSIX standard for tar headers requires archive member sizes to be  
printed in octal with at most 11 digits, limiting the representable file  
size to 8GB.  However, GNU tar and apparently most other modern tars  
support a convention in which oversized values can be stored in base-256,  
allowing any practical file to be a tar member.  Adopt this convention  
to remove two limitations:  
* pg_dump with -Ft output format failed if the contents of any one table  
exceeded 8GB.  
* pg_basebackup failed if the data directory contained any file exceeding  
8GB.  (This would be a fatal problem for installations configured with a  
table segment size of 8GB or more, and it has also been seen to fail when  
large core dump files exist in the data directory.)  
  
File sizes under 8GB are still printed in octal, so that no compatibility  
issues are created except in cases that would have failed entirely before.  
  
In addition, this patch fixes several bugs in the same area:  
  
* In 9.3 and later, we'd defined tarCreateHeader's file-size argument as  
size_t, which meant that on 32-bit machines it would write a corrupt tar  
header for file sizes between 4GB and 8GB, even though no error was raised.  
This broke both "pg_dump -Ft" and pg_basebackup for such cases.  
  
* pg_restore from a tar archive would fail on tables of size between 4GB  
and 8GB, on machines where either "size_t" or "unsigned long" is 32 bits.  
This happened even with an archive file not affected by the previous bug.  
  
* pg_basebackup would fail if there were files of size between 4GB and 8GB,  
even on 64-bit machines.  
  
* In 9.3 and later, "pg_basebackup -Ft" failed entirely, for any file size,  
on 64-bit big-endian machines.  
  
In view of these potential data-loss bugs, back-patch to all supported  
branches, even though removal of the documented 8GB limit might otherwise  
be considered a new feature rather than a bug fix.  

M doc/src/sgml/ref/pg_dump.sgml
M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_tar.c
M src/include/pgtar.h
M src/port/tar.c

Fix handling of inherited check constraints in ALTER COLUMN TYPE (again).

commit   : a35c5b7c1ffcde123b7b9b717608ed8357af870f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Nov 2015 14:55:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Nov 2015 14:55:28 -0500    

Click here for diff

The previous way of reconstructing check constraints was to do a separate  
"ALTER TABLE ONLY tab ADD CONSTRAINT" for each table in an inheritance  
hierarchy.  However, that way has no hope of reconstructing the check  
constraints' own inheritance properties correctly, as pointed out in  
bug #13779 from Jan Dirk Zijlstra.  What we should do instead is to do  
a regular "ALTER TABLE", allowing recursion, at the topmost table that  
has a particular constraint, and then suppress the work queue entries  
for inherited instances of the constraint.  
  
Annoyingly, we'd tried to fix this behavior before, in commit 5ed6546cf,  
but we failed to notice that it wasn't reconstructing the pg_constraint  
field values correctly.  
  
As long as I'm touching pg_get_constraintdef_worker anyway, tweak it to  
always schema-qualify the target table name; this seems like useful backup  
to the protections installed by commit 5f173040.  
  
In HEAD/9.5, get rid of get_constraint_relation_oids, which is now unused.  
(I could alternatively have modified it to also return conislocal, but that  
seemed like a pretty single-purpose API, so let's not pretend it has some  
other use.)  It's unused in the back branches as well, but I left it in  
place just in case some third-party code has decided to use it.  
  
In HEAD/9.5, also rename pg_get_constraintdef_string to  
pg_get_constraintdef_command, as the previous name did nothing to explain  
what that entry point did differently from others (and its comment was  
equally useless).  Again, that change doesn't seem like material for  
back-patching.  
  
I did a bit of re-pgindenting in tablecmds.c in HEAD/9.5, as well.  
  
Otherwise, back-patch to all supported branches.  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/pg_constraint.h
M src/include/utils/ruleutils.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Dodge a macro-name conflict with Perl.

commit   : 8ee1a776a0c69cbd33b88f1210d1b94dfda18128    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:54:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:54:05 -0500    

Click here for diff

Some versions of Perl export a macro named HS_KEY.  This creates a  
conflict in contrib/hstore_plperl against hstore's macro of the same  
name.  The most future-proof solution seems to be to rename our macro;  
I chose HSTORE_KEY.  For consistency, rename HS_VAL and related macros  
similarly.  
  
Back-patch to 9.5.  contrib/hstore_plperl doesn't exist before that  
so there is no need to worry about the conflict in older releases.  
  
Per reports from Marco Atzeri and Mike Blackwell.  

M contrib/hstore/hstore.h
M contrib/hstore/hstore_compat.c
M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c

doc: Clarify some things on pg_receivexlog reference page

commit   : 04f5622b63d6c368c10ea76b0187858e1468c693    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Nov 2015 14:19:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Nov 2015 14:19:04 -0500    

Click here for diff

M doc/src/sgml/ref/pg_receivexlog.sgml

Fix thinko: errmsg -> ereport.

commit   : bb8b17960386e7026c4b5a63419752f310fa386a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:16:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Nov 2015 14:16:39 -0500    

Click here for diff

Silly mistake in my commit 09cecdf285ea9f51, reported by Erik Rijkers.  
  
The fact that the buildfarm didn't find this implies that we are not  
testing Perl builds that lack MULTIPLICITY, which is a bit disturbing  
from a coverage standpoint.  Until today I'd have said nobody cared  
about such configurations anymore; but maybe not.  

M src/pl/plperl/plperl.c

fix a perl typo

commit   : 3f222b676d5c2fe2a7d869c80b8f840e2ae47b41    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 19 Nov 2015 02:42:02 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 19 Nov 2015 02:42:02 -0500    

Click here for diff

M src/tools/msvc/vcregress.pl

Update docs for vcregress.pl bincheck changes

commit   : bfac7a69ba5d2dd9b77b9de5daa7de9920426377    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 23:32:16 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 23:32:16 -0500    

Click here for diff

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

Improve vcregress.pl's handling of tap tests for client programs

commit   : fed03032e57a3959524aaf22dd358a5cb4ad49e1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 22:47:41 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 18 Nov 2015 22:47:41 -0500    

Click here for diff

The target is now named 'bincheck' rather than 'tapcheck' so that it  
reflects what is checked instead of the test mechanism. Some of the  
logic is improved, making it easier to add further sets of TAP based  
tests in future. Also, the environment setting logic is imrpoved.  
  
As discussed on -hackers a couple of months ago.  

M src/tools/msvc/vcregress.pl

Fix incomplete set_foreignscan_references handling for fdw_recheck_quals

commit   : 5021e3dac9878134ded01806807a9e17f9324425    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 21:17:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Nov 2015 21:17:50 -0500    

Click here for diff

KaiGai Kohei  

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

Improve ON CONFLICT documentation.

commit   : af85779bf72e91ea43be3de8218e45d166dfe200    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 10 Nov 2015 00:02:49 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 10 Nov 2015 00:02:49 +0100    

Click here for diff

Author: Peter Geoghegan and Andres Freund  
Discussion: CAM3SWZScpWzQ-7EJC77vwqzZ1GO8GNmURQ1QqDQ3wRn7AbW1Cg@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Remove function names from some elog() calls in heapam.c.

commit   : 6f8519d130e198c9e924caf678c47903ab0de8b6    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Nov 2015 01:25:58 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Nov 2015 01:25:58 +0100    

Click here for diff

At least one of the names was, due to a function renaming late in the  
development of ON CONFLICT, wrong. Since including function names in  
error messages is against the message style guide anyway, remove them  
from the messages.  
  
Discussion: CAM3SWZT8paz=usgMVHm0XOETkQvzjRtAUthATnmaHQQY0obnGw@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Accept flex > 2.5.x in configure.

commit   : 659d472920e4cbc5f4c42912768e8301af036991    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Nov 2015 17:45:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Nov 2015 17:45:05 -0500    

Click here for diff

Per buildfarm member anchovy, 2.6.0 exists in the wild now.  
Hopefully it works with Postgres; if not, we'll have to do something  
about that, but in any case claiming it's "too old" is pretty silly.  

M config/programs.m4
M configure

Fix possible internal overflow in numeric division.

commit   : 80be41979e3ac2b17a4f985ee9249c78e3bafeb6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Nov 2015 15:46:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Nov 2015 15:46:47 -0500    

Click here for diff

div_var_fast() postpones propagating carries in the same way as mul_var(),  
so it has the same corner-case overflow risk we fixed in 246693e5ae8a36f0,  
namely that the size of the carries has to be accounted for when setting  
the threshold for executing a carry propagation step.  We've not devised  
a test case illustrating the brokenness, but the required fix seems clear  
enough.  Like the previous fix, back-patch to all active branches.  
  
Dean Rasheed  

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

Back-patch fixes to make TAP tests work on Windows.

commit   : 331828b754378733cb5c2e49227603e7354e4e39    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Nov 2015 14:10:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Nov 2015 14:10:24 -0500    

Click here for diff

This back-ports commit 13d856e177e69083 and assorted followon patches  
into 9.4 and 9.5.  9.5 and HEAD are now substantially identical in all  
the files touched by this commit, except that 010_pg_basebackup.pl has  
a few more tests related to the new --slot option.  9.4 has many fewer  
TAP tests, but the test infrastructure files are substantially the same,  
with the exception that 9.4 lacks the single-tmp-install infrastructure  
introduced in 9.5 (commit dcae5faccab64776).  
  
The primary motivation for this patch is to ensure that TAP test case  
fixes can be back-patched without hazards of the kind seen in commits  
34557f544/06dd4b44f.  In principle it should also make the world safe  
for running the TAP tests in the buildfarm in these branches; although  
we might want to think about back-porting dcae5faccab64776 to 9.4 if  
we're going to do that for real, because the TAP tests are quite disk  
space hungry without it.  
  
Michael Paquier did the back-porting work; original patches were by  
him and assorted other people.  

M doc/src/sgml/install-windows.sgml
M src/Makefile.global.in
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/test/perl/SimpleTee.pm
M src/test/perl/TestLib.pm
M src/tools/msvc/clean.bat
M src/tools/msvc/vcregress.pl

Message style fix

commit   : a408bd58a6746f919d96c840331707172cc2bf02    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:53:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Nov 2015 06:53:07 -0500    

Click here for diff

from Euler Taveira  

M src/backend/commands/copy.c
M src/test/regress/expected/rowsecurity.out

Improve message

commit   : b6a6340b170c31d4fd07d9ddae1cfac4e2200884    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 22:26:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 22:26:32 -0500    

Click here for diff

M src/bin/scripts/vacuumdb.c

Message improvements

commit   : 689cabf402c33a69e595a0d25f61b1fb49fb1c78    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 21:16:42 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 21:16:42 -0500    

Click here for diff

M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/copy.c
M src/backend/commands/extension.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/rls.c
M src/port/win32error.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/join.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/rowsecurity.out

doc: Fix commas and improve spacing

commit   : 75c8af902e07a2090df429f410df1e753e3358f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 18:59:55 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Nov 2015 18:59:55 -0500    

Click here for diff

M doc/src/sgml/queries.sgml

Speed up ruleutils' name de-duplication code, and fix overlength-name case.

commit   : 34d4f49bb9792c1dd3f73fcbab15df54c2402fe1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Nov 2015 13:45:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Nov 2015 13:45:17 -0500    

Click here for diff

Since commit 11e131854f8231a21613f834c40fe9d046926387, ruleutils.c has  
attempted to ensure that each RTE in a query or plan tree has a unique  
alias name.  However, the code that was added for this could be quite slow,  
even as bad as O(N^3) if N identical RTE names must be replaced, as noted  
by Jeff Janes.  Improve matters by building a transient hash table within  
set_rtable_names.  The hash table in itself reduces the cost of detecting a  
duplicate from O(N) to O(1), and we can save another factor of N by storing  
the number of de-duplicated names already created for each entry, so that  
we don't have to re-try names already created.  This way is probably a bit  
slower overall for small range tables, but almost by definition, such cases  
should not be a performance problem.  
  
In principle the same problem applies to the column-name-de-duplication  
code; but in practice that seems to be less of a problem, first because  
N is limited since we don't support extremely wide tables, and second  
because duplicate column names within an RTE are fairly rare, so that in  
practice the cost is more like O(N^2) not O(N^3).  It would be very much  
messier to fix the column-name code, so for now I've left that alone.  
  
An independent problem in the same area was that the de-duplication code  
paid no attention to the identifier length limit, and would happily produce  
identifiers that were longer than NAMEDATALEN and wouldn't be unique after  
truncation to NAMEDATALEN.  This could result in dump/reload failures, or  
perhaps even views that silently behaved differently than before.  We can  
fix that by shortening the base name as needed.  Fix it for both the  
relation and column name cases.  
  
In passing, check for interrupts in set_rtable_names, just in case it's  
still slow enough to be an issue.  
  
Back-patch to 9.3 where this code was introduced.  

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

Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES() contexts.

commit   : 0489a048d3914e4d5f89c91ac604350b9392e6fa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Nov 2015 14:41:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Nov 2015 14:41:09 -0500    

Click here for diff

Normally ruleutils prints a whole-row Var as "foo.*".  We already knew that  
that doesn't work at top level of a SELECT list, because the parser would  
treat the "*" as a directive to expand the reference into separate columns,  
not a whole-row Var.  However, Joshua Yanovski points out in bug #13776  
that the same thing happens at top level of a ROW() construct; and some  
nosing around in the parser shows that the same is true in VALUES().  
Hence, apply the same workaround already devised for the SELECT-list case,  
namely to add a forced cast to the appropriate rowtype in these cases.  
(The alternative of just printing "foo" was rejected because it is  
difficult to avoid ambiguity against plain columns named "foo".)  
  
Back-patch to all supported branches.  

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

pg_upgrade: properly detect file copy failure on Windows

commit   : fae58d5bede8b5bf3dd17381e7f6b73c1772577f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 14 Nov 2015 11:47:11 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 14 Nov 2015 11:47:11 -0500    

Click here for diff

Previously, file copy failures were ignored on Windows due to an  
incorrect return value check.  
  
Report by Manu Joye  
  
Backpatch through 9.1  

M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.h

Correct sepgsql docs with regard to RLS

commit   : d324c7226104266bf9fd57380a0703e40ba24fd4    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 13 Nov 2015 11:06:42 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 13 Nov 2015 11:06:42 -0500    

Click here for diff

The sepgsql docs included a comment that PG doesn't support RLS.  That  
is only true for versions prior to 9.5.  
  
Update the docs for 9.5 and master to say that PG supports RLS but that  
sepgsql does not yet.  
  
Pointed out by Heikki.  
  
Back-patch to 9.5  

M doc/src/sgml/sepgsql.sgml

vacuumdb: don't prompt for passwords over and over

commit   : 5094da99b901df42580b6e7494d036ee4be9eb81    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Nov 2015 18:05:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Nov 2015 18:05:23 -0300    

Click here for diff

Having the script prompt for passwords over and over was a preexisting  
problem when it processed multiple databases or when it processed  
multiple analyze stages, but the parallel mode introduced in commit  
a179232047 made it worse.  
  
Fix the annoyance by keeping a copy of the password used by the first  
connection that requires one.  Since users can (currently) only have a  
single password, there's no need for more complex arrangements (such as  
remembering one password per database).  
  
Per bug #13741 reported by Eric Brown.  Patch authored and  
cross-reviewed by Haribabu Kommi and Michael Paquier, slightly tweaked  
by Álvaro Herrera.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  
Backpatch to 9.5, where parallel vacuumdb was introduced.  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createlang.c
M src/bin/scripts/createuser.c
M src/bin/scripts/droplang.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

Fix unwanted flushing of libpq's input buffer when socket EOF is seen.

commit   : 747854f010b168c4f076cf44b61b100b0fe20866    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Nov 2015 13:03:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Nov 2015 13:03:52 -0500    

Click here for diff

In commit 210eb9b743c0645d I centralized libpq's logic for closing down  
the backend communication socket, and made the new pqDropConnection  
routine always reset the I/O buffers to empty.  Many of the call sites  
previously had not had such code, and while that amounted to an oversight  
in some cases, there was one place where it was intentional and necessary  
*not* to flush the input buffer: pqReadData should never cause that to  
happen, since we probably still want to process whatever data we read.  
  
This is the true cause of the problem Robert was attempting to fix in  
c3e7c24a1d60dc6a, namely that libpq no longer reported the backend's final  
ERROR message before reporting "server closed the connection unexpectedly".  
But that only accidentally fixed it, by invoking parseInput before the  
input buffer got flushed; and very likely there are timing scenarios  
where we'd still lose the message before processing it.  
  
To fix, pass a flag to pqDropConnection to tell it whether to flush the  
input buffer or not.  On review I think flushing is actually correct for  
every other call site.  
  
Back-patch to 9.3 where the problem was introduced.  In HEAD, also improve  
the comments added by c3e7c24a1d60dc6a.  

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

Do a round of copy-editing on the 9.5 release notes.

commit   : a8c209fce10b5b3208451987782fd38e0a840624    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 19:19:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 19:19:14 -0500    

Click here for diff

Also fill in the previously empty "major enhancements" list.  YMMV as to  
which items should make the cut, but it's past time we had something more  
than a placeholder here.  
  
(I meant to get this done before beta2 was wrapped, but got distracted by  
PDF build problems.  Better late than never.)  

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

commit   : bcb8f96e6775c649564ac0fb946ab6a1629ff969    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 17:13:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Nov 2015 17:13:38 -0500    

Click here for diff

These were discussed in three different sections of the manual, which  
unsurprisingly had diverged over time; and the descriptions of individual  
variables lacked stylistic consistency even within each section (and  
frequently weren't in very good English anyway).  Clean up the mess, and  
remove some of the redundant information in hopes that future additions  
will be less likely to re-introduce inconsistency.  For instance I see  
no need for maintenance.sgml to include its very own list of all the  
autovacuum storage parameters, especially since that list was already  
incomplete.  

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

Docs: fix misleading example.

commit   : 0819778c43e3bc19364c541c3ea099b5c3b7d224    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 22:11:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 22:11:39 -0500    

Click here for diff

Commit 8457d0beca731bf0 introduced an example which, while not incorrect,  
failed to exhibit the behavior it meant to describe, as a result of omitting  
an E'' prefix that needed to be there.  Noticed and fixed by Peter Geoghegan.  
  
I (tgl) failed to resist the temptation to wordsmith nearby text a bit  
while at it.  

M doc/src/sgml/datatype.sgml

Improve our workaround for 'TeX capacity exceeded' in building PDF files.

commit   : 8d20eaa62b943bd155013aa01e0d6909bf520be0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 15:59:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Nov 2015 15:59:59 -0500    

Click here for diff

In commit a5ec86a7c787832d28d5e50400ec96a5190f2555 I wrote a quick hack  
that reduced the number of TeX string pool entries created while converting  
our documentation to PDF form.  That held the fort for awhile, but as of  
HEAD we're back up against the same limitation.  It turns out that the  
original coding of \FlowObjectSetup actually results in *three* string pool  
entries being generated for every "flow object" (that is, potential  
cross-reference target) in the documentation, and my previous hack only got  
rid of one of them.  With a little more care, we can reduce the string  
count to one per flow object plus one per actually-cross-referenced flow  
object (about 115000 + 5000 as of current HEAD); that should work until  
the documentation volume roughly doubles from where it is today.  
  
As a not-incidental side benefit, this change also causes pdfjadetex to  
stop emitting unreferenced hyperlink anchors (bookmarks) into the PDF file.  
It had been making one willy-nilly for every flow object; now it's just one  
per actually-cross-referenced object.  This results in close to a 2X  
savings in PDF file size.  We will still want to run the output through  
"jpdftweak" to get it to be compressed; but we no longer need removal of  
unreferenced bookmarks, so we might be able to find a quicker tool for  
that step.  
  
Although the failure only affects HEAD and US-format output at the moment,  
9.5 cannot be more than a few pages short of failing likewise, so it  
will inevitably fail after a few rounds of minor-version release notes.  
I don't have a lot of faith that we'll never hit the limit in the older  
branches; and anyway it would be nice to get rid of jpdftweak across the  
board.  Therefore, back-patch to all supported branches.  

M doc/src/sgml/jadetex.cfg

Stamp 9.5beta2.

commit   : eb66ee639e79b9ec85d877746aaca315ca82c2a4    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 14:53:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 9 Nov 2015 14:53:52 -0500    

Click here for diff

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

Translation updates

commit   : 289da0a7a59f60efa1baeadaca750ef2bdb97c78    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Nov 2015 10:21:11 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Nov 2015 10:21:11 -0500    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/ru.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/pg_rewind/po/ru.po
M src/bin/psql/po/de.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/pl/plperl/po/ru.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/tcl/po/ja.po
M src/pl/tcl/po/ru.po

Add paragraph about ON CONFLICT interaction with partitioning.

commit   : 90e074baec2f052120271437a72d2ef6d1de1696    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 9 Nov 2015 05:08:56 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 9 Nov 2015 05:08:56 +0100    

Click here for diff

Author: Peter Geoghegan and Andres Freund  
Discussion: CAM3SWZScpWzQ-7EJC77vwqzZ1GO8GNmURQ1QqDQ3wRn7AbW1Cg@mail.gmail.com,  
    CAHGQGwFUCWwSU7dtc2aRdRk73ztyr_jY5cPOyts+K8xKJ92X4Q@mail.gmail.com  
Backpatch: 9.5, where UPSERT was introduced  

M doc/src/sgml/ddl.sgml

Set replication origin when decoding commit records.

commit   : 04c0b63365c7d4ee584300737afe6ef7df3b1253    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 8 Nov 2015 23:01:53 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 8 Nov 2015 23:01:53 +0100    

Click here for diff

By accident the replication origin was not set properly in  
DecodeCommit(). That's bad because the origin is passed to the output  
plugins origin filter, and accessible from the output plugin via  
ReorderBufferTXN->origin_id.  Accessing the origin of individual changes  
worked before the fix, which is why this wasn't notices earlier.  
  
Reported-By: Craig Ringer  
Author: Craig Ringer  
Discussion: CAMsr+YFhBJLp=qfSz3-J+0P1zLkE8zNXM2otycn20QRMx380gw@mail.gmail.com  
Backpatch: 9.5, where replication origins where introduced  

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

Fix 9.5 version of previous commit to match its log message.

commit   : 40c28678aa65308f27347cd218a09fdc92c483ef    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 8 Nov 2015 17:40:19 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 8 Nov 2015 17:40:19 -0500    

Click here for diff

M src/bin/pg_ctl/pg_ctl.c

Don't connect() to a wildcard address in test_postmaster_connection().

commit   : bdb42bac3c96a5affe5e476a56b85562b2ed0da9    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 8 Nov 2015 17:28:53 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 8 Nov 2015 17:28:53 -0500    

Click here for diff

At least OpenBSD, NetBSD, and Windows don't support it.  This repairs  
pg_ctl for listen_addresses='0.0.0.0' and listen_addresses='::'.  Since  
pg_ctl prefers to test a Unix-domain socket, Windows users are most  
likely to need this change.  Back-patch to 9.1 (all supported versions).  
This could change pg_ctl interaction with loopback-interface firewall  
rules.  Therefore, in 9.4 and earlier (released branches), activate the  
change only on known-affected platforms.  
  
Reported (bug #13611) and designed by Kondo Yuta.  

M src/bin/pg_ctl/pg_ctl.c

Update 9.5 release notes through today.

commit   : 5daafafe74e23f9e6a8971820b4233565a837b77    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 17:09:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 17:09:04 -0500    

Click here for diff

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

Rename PQsslAttributes() to PQsslAttributeNames(), and const-ify fully.

commit   : ab994cc00ec3e3700b2e62de9777d410fbb6ae84    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 16:13:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 16:13:49 -0500    

Click here for diff

Per discussion, the original name was a bit misleading, and  
PQsslAttributeNames() seems more apropos.  It's not quite too late to  
change this in 9.5, so let's change it while we can.  
  
Also, make sure that the pointer array is const, not only the pointed-to  
strings.  
  
Minor documentation wordsmithing while at it.  
  
Lars Kanis, slight adjustments by me  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/release-9.5.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-fe.h

Fix enforcement of restrictions inside regexp lookaround constraints.

commit   : 44fc25153681f0d3814275926f3c626a3f283cc2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 12:43:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Nov 2015 12:43:24 -0500    

Click here for diff

Lookahead and lookbehind constraints aren't allowed to contain backrefs,  
and parentheses within them are always considered non-capturing.  Or so  
says the manual.  But the regexp parser forgot about these rules once  
inside a parenthesized subexpression, so that constructs like (\w)(?=(\1))  
were accepted (but then not correctly executed --- a case like this acted  
like (\w)(?=\w), without any enforcement that the two \w's match the same  
text).  And in (?=((foo))) the innermost parentheses would be counted as  
capturing parentheses, though no text would ever be captured for them.  
  
To fix, properly pass down the "type" argument to the recursive invocation  
of parse().  
  
Back-patch to all supported branches; it was agreed that silent  
misexecution of such patterns is worse than throwing an error, even though  
new errors in minor releases are generally not desirable.  

M src/backend/regex/regcomp.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Set include_realm=1 default in parse_hba_line

commit   : 695012a0d585844130bf3d82ad0b4ebe0b7bf581    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 6 Nov 2015 11:18:33 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 6 Nov 2015 11:18:33 -0500    

Click here for diff

With include_realm=1 being set down in parse_hba_auth_opt, if multiple  
options are passed on the pg_hba line, such as:  
  
host all     all    0.0.0.0/0    gss include_realm=0 krb_realm=XYZ.COM  
  
We would mistakenly reset include_realm back to 1.  Instead, we need to  
set include_realm=1 up in parse_hba_line, prior to parsing any of the  
additional options.  
  
Discovered by Jeff McCormick during testing.  
  
Bug introduced by 9a08841.  
  
Back-patch to 9.5  

M src/backend/libpq/hba.c

Fix erroneous hash calculations in gin_extract_jsonb_path().

commit   : 4d867458fce3743adc95ad6513c9d2dea87cd7f4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 18:15:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Nov 2015 18:15:48 -0500    

Click here for diff

The jsonb_path_ops code calculated hash values inconsistently in some cases  
involving nested arrays and objects.  This would result in queries possibly  
not finding entries that they should find, when using a jsonb_path_ops GIN  
index for the search.  The problem cases involve JSONB values that contain  
both scalars and sub-objects at the same nesting level, for example an  
array containing both scalars and sub-arrays.  To fix, reset the current  
stack->hash after processing each value or sub-object, not before; and  
don't try to be cute about the outermost level's initial hash.  
  
Correcting this means that existing jsonb_path_ops indexes may now be  
inconsistent with the new hash calculation code.  The symptom is the same  
--- searches not finding entries they should find --- but the specific  
rows affected are likely to be different.  Users will need to REINDEX  
jsonb_path_ops indexes to make sure that all searches work as expected.  
  
Per bug #13756 from Daniel Cheng.  Back-patch to 9.4 where the faulty  
logic was introduced.  

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

Pass extra data to bgworkers, and use this to fix parallel contexts.

commit   : c98605cc47fe42fac5f685d611db2a0c1afa2fcf    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Nov 2015 12:05:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Nov 2015 12:05:38 -0500    

Click here for diff

Up until now, the total amount of data that could be passed to a  
background worker at startup was one datum, which can be a small as  
4 bytes on some systems.  That's enough to pass a dsm_handle or an  
array index, but not much else.  Add a bgw_extra flag to the  
BackgroundWorker struct, allowing up to 128 bytes to be passed to  
a new worker on any platform.  
  
Use this to fix a problem I recently discovered with the parallel  
context machinery added in 9.5: the master assigns each worker an  
array index, and each worker subsequently assigns itself an array  
index, and there's nothing to guarantee that the two sets of indexes  
match, leading to chaos.  
  
Normally, I would not back-patch the change to add bgw_extra, since it  
is basically a feature addition.  However, since 9.5 is still in beta  
and there seems to be no other sensible way to repair the broken  
parallel context machinery, back-patch to 9.5.  Existing background  
worker code can ignore the bgw_extra field without a problem, but  
might need to be recompiled since the structure size has changed.  
  
Report and patch by me.  Review by Amit Kapila.  

M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/parallel.c
M src/backend/postmaster/bgworker.c
M src/include/postmaster/bgworker.h

Improve comments about abbreviation abort.

commit   : 1d97b25501470716f5b93b1083d865bb5508b880    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 14:11:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 14:11:49 -0500    

Click here for diff

Peter Geoghegan  

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

Remove obsolete advice about doubling backslashes in regex escapes.

commit   : fdae4a93e9df6b9b0f0ef5b0ccff697e4859710f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:57:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:57:56 -0500    

Click here for diff

Standard-conforming literals have been the default for long enough that  
it no longer seems necessary to go out of our way to tell people to write  
regex escapes illegibly.  

M doc/src/sgml/func.sgml

Code + docs review for unicode linestyle patch.

commit   : f4057cdffc355f5d4a9d8411fb953069be6d72ea    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:49:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Nov 2015 11:49:21 -0500    

Click here for diff

Fix some brain fade in commit a2dabf0e1dda93c8: erroneous variable names  
in docs, rearrangements that made sentences less clear not more so,  
undocumented and poorly-chosen-anyway API behaviors of subroutines,  
bad grammar in error messages, copy-and-paste faults.  
  
Albe Laurenz and Tom Lane  

M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/release-9.5.sgml
M src/bin/psql/command.c

shm_mq: Third attempt at fixing nowait behavior in shm_mq_receive.

commit   : fd5ce6b89b63bdb9632a925a80f6f7d4e7bd2e00    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 09:12:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Nov 2015 09:12:52 -0500    

Click here for diff

Commit a1480ec1d3bacb9acb08ec09f22bc25bc033115b purported to fix the  
problems with commit b2ccb5f4e6c81305386edb34daf7d1d1e1ee112a, but it  
didn't completely fix them.  The problem is that the checks were  
performed in the wrong order, leading to a race condition.  If the  
sender attached, sent a message, and detached after the receiver  
called shm_mq_get_sender and before the receiver called  
shm_mq_counterparty_gone, we'd incorrectly return SHM_MQ_DETACHED  
before all messages were read.  Repair by reversing the order of  
operations, and add a long comment explaining why this new logic is  
(hopefully) correct.  

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

Add RMV to list of commands taking AE lock.

commit   : 67d4738d934e9df455d2f67b2617423319b377d5    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 2 Nov 2015 06:26:28 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 2 Nov 2015 06:26:28 -0600    

Click here for diff

Backpatch to 9.3, where it was initially omitted.  
  
Craig Ringer, with minor adjustment by Kevin Grittner  

M doc/src/sgml/mvcc.sgml

Fix serialization anomalies due to race conditions on INSERT.

commit   : 50ca917d911485aa696a30943fda98f41ff92206    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 31 Oct 2015 14:42:46 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 31 Oct 2015 14:42:46 -0500    

Click here for diff

On insert the CheckForSerializableConflictIn() test was performed  
before the page(s) which were going to be modified had been locked  
(with an exclusive buffer content lock).  If another process  
acquired a relation SIReadLock on the heap and scanned to a page on  
which an insert was going to occur before the page was so locked,  
a rw-conflict would be missed, which could allow a serialization  
anomaly to be missed.  The window between the check and the page  
lock was small, so the bug was generally not noticed unless there  
was high concurrency with multiple processes inserting into the  
same table.  
  
This was reported by Peter Bailis as bug #11732, by Sean Chittenden  
as bug #13667, and by others.  
  
The race condition was eliminated in heap_insert() by moving the  
check down below the acquisition of the buffer lock, which had been  
the very next statement.  Because of the loop locking and unlocking  
multiple buffers in heap_multi_insert() a check was added after all  
inserts were completed.  The check before the start of the inserts  
was left because it might avoid a large amount of work to detect a  
serialization anomaly before performing the all of the inserts and  
the related WAL logging.  
  
While investigating this bug, other SSI bugs which were even harder  
to hit in practice were noticed and fixed, an unnecessary check  
(covered by another check, so redundant) was removed from  
heap_update(), and comments were improved.  
  
Back-patch to all supported branches.  
  
Kevin Grittner and Thomas Munro  

M src/backend/access/heap/heapam.c
M src/backend/storage/lmgr/predicate.c

doc: security_barrier option is a Boolean, not a string.

commit   : 21e634e4b23309ec33dfa27854c0b9901859dda3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 12:18:55 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 12:18:55 +0100    

Click here for diff

Mistake introduced by commit 5bd91e3a835b5d5499fee5f49fc7c0c776fe63dd.  
  
Hari Babu  

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

Fix typo in bgworker.c

commit   : 7852f73bdfe6022c9b23abc950fec63d0d1f4582    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 10:35:33 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Oct 2015 10:35:33 +0100    

Click here for diff

M src/backend/postmaster/bgworker.c

Docs: add example clarifying use of nested JSON containment.

commit   : 9a1a22980d3650e6e232bc4423ec74bfc6d0e7be    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Oct 2015 18:54:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Oct 2015 18:54:35 -0400    

Click here for diff

Show how this can be used in practice to make queries simpler and more  
flexible.  Also, draw an explicit contrast to the existence operator,  
which doesn't work that way.  
  
Peter Geoghegan and Tom Lane  

M doc/src/sgml/json.sgml

Message style improvements

commit   : 0bc3071796b33288cd912db196b90c76fa394c21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Oct 2015 20:23:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Oct 2015 20:23:53 -0400    

Click here for diff

Message style, plurals, quoting, spelling, consistency with similar  
messages  

M contrib/test_decoding/expected/binary.out
M src/backend/access/transam/multixact.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/copy.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execMain.c
M src/backend/parser/parse_clause.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/misc.c
M src/bin/psql/command.c
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/updatable_views.out

Add missing serial comma, for consistency.

commit   : d17d5125f68da155e3a8e555c0699b7679b06e3b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 12:19:14 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 12:19:14 +0100    

Click here for diff

Amit Langote, per Etsuro Fujita  

M src/backend/commands/tablecmds.c

Fix incorrect message in ATWrongRelkindError.

commit   : e53e2a196887a60481bd0bb1b316062027c5f24d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 11:44:47 +0100    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Oct 2015 11:44:47 +0100    

Click here for diff

Mistake introduced by commit 3bf3ab8c563699138be02f9dc305b7b77a724307.  
  
Etsuro Fujita  

M src/backend/commands/tablecmds.c

Fix secondary expected output for commit_ts test

commit   : c56949168cc0aeac703865c3239f7bc7ca670402    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 23:02:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 23:02:04 -0300    

Click here for diff

Per red wall in buildfarm  

M src/test/modules/commit_ts/expected/commit_timestamp_1.out

Document BRIN's inclusion opclass framework

commit   : 3e9e03353966efa5cae5f927a77ba64a93f1ee8c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 19:03:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 19:03:15 -0300    

Click here for diff

Backpatch to 9.5 -- this should have been part of b0b7be61337, but we  
didn't have 38b03caebc5de either at the time.  
  
Author: Emre Hasegeli  
Revised by: Ian Barwick  
Discussion:  
 http://www.postgresql.org/message-id/CAE2gYzyB39Q9up_-TO6FKhH44pcAM1x6n_Cuj15qKoLoFihUVg@mail.gmail.com  
 http://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/brin.sgml

Fix BRIN free space computations

commit   : cf42abcc653817849398b62c321de654ea2b28cc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 18:17:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 18:17:55 -0300    

Click here for diff

A bug in the original free space computation made it possible to  
return a page which wasn't actually able to fit the item.  Since the  
insertion code isn't prepared to deal with PageAddItem failing, a PANIC  
resulted ("failed to add BRIN tuple [to new page]").  Add a macro to  
encapsulate the correct computation, and use it in  
brin_getinsertbuffer's callers before calling that routine, to raise an  
early error.  
  
I became aware of the possiblity of a problem in this area while working  
on ccc4c074994d734.  There's no archived discussion about it, but it's  
easy to reproduce a problem in the unpatched code with something like  
  
CREATE TABLE t (a text);  
CREATE INDEX ti ON t USING brin (a) WITH (pages_per_range=1);  
  
for length in `seq 8000 8196`  
do  
	psql -f - <<EOF  
TRUNCATE TABLE t;  
INSERT INTO t VALUES ('z'), (repeat('a', $length));  
EOF  
done  
  
Backpatch to 9.5, where BRIN was introduced.  

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

Cleanup commit timestamp module activaction, again

commit   : 68cc162e454a166a2a6ca992aeb759edcc56adc3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 15:06:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 15:06:50 -0300    

Click here for diff

Further tweak commit_ts.c so that on a standby the state is completely  
consistent with what that in the master, rather than behaving  
differently in the cases that the settings differ.  Now in standby and  
master the module should always be active or inactive in lockstep.  
  
Author: Petr Jelínek, with some further tweaks by Álvaro Herrera.  
  
Backpatch to 9.5, where commit timestamps were introduced.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/commit_ts.c
M src/backend/commands/vacuum.c
M src/include/access/commit_ts.h

Measure string lengths only once

commit   : 80ae841f2f0c51ea766a75f4abe73c0c48e4ab0c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 13:20:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Oct 2015 13:20:40 -0300    

Click here for diff

Bernd Helmle complained that CreateReplicationSlot() was assigning the  
same value to the same variable twice, so we could remove one of them.  
Code inspection reveals that we can actually remove both assignments:  
according to the author the assignment was there for beauty of the  
strlen line only, and another possible fix to that is to put the strlen  
in its own line, so do that.  
  
To be consistent within the file, refactor all duplicated strlen()  
calls, which is what we do elsewhere in the backend anyway.  In  
basebackup.c, snprintf already returns the right length; no need for  
strlen afterwards.  
  
Backpatch to 9.4, where replication slots were introduced, to keep code  
identical.  Some of this is older, but the patch doesn't apply cleanly  
and it's only of cosmetic value anyway.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  

M src/backend/replication/basebackup.c
M src/backend/replication/walsender.c

shm_mq: Repair breakage from previous commit.

commit   : 44390e30f8531906ed142336f84f172b93073038    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 22:01:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 22:01:11 -0400    

Click here for diff

If the counterparty writes some data into the queue and then detaches,  
it's wrong to return SHM_MQ_DETACHED right away.  If we do that, we  
fail to read whatever was written.  

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

Add two missing cases to ATWrongRelkindError.

commit   : 17b07afae341c05f2dae1b6c588df6b267e699f2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 17:00:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 17:00:53 -0400    

Click here for diff

This way, we produce a better error message if someone tries to do  
something like ALTER INDEX .. ALTER COLUMN .. SET STORAGE.  
  
Amit Langote  

M src/backend/commands/tablecmds.c

shm_mq: Fix failure to notice a dead counterparty when nowait is used.

commit   : ac9a01615c5d45eb08e5b78c3d0155214e0ab498    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 16:33:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Oct 2015 16:33:30 -0400    

Click here for diff

The shm_mq mechanism was intended to optionally notice when the process  
on the other end of the queue fails to attach to the queue.  It does  
this by allowing the user to pass a BackgroundWorkerHandle; if the  
background worker in question is launched and dies without attaching  
to the queue, then we know it never will.  This logic works OK in  
blocking mode, but when called with nowait = true we fail to notice  
that this has happened due to an asymmetry in the logic.  Repair.  
  
Reported off-list by Rushabh Lathia.  Patch by me.  

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

doc: Add advice on updating checkpoint_segments to max_wal_size

commit   : 85e30f57cb33294107fc17704a5d8874439e0ae5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Oct 2015 13:59:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Oct 2015 13:59:58 -0400    

Click here for diff

with suggestion from Michael Paquier  

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

Fix incorrect translation of minus-infinity datetimes for json/jsonb.

commit   : 5fb20a5ba6ce963ad529224ff5359aa1731c4068    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Oct 2015 11:06:24 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Oct 2015 11:06:24 -0700    

Click here for diff

Commit bda76c1c8cfb1d11751ba6be88f0242850481733 caused both plus and  
minus infinity to be rendered as "infinity", which is not only wrong  
but inconsistent with the pre-9.4 behavior of to_json().  Fix that by  
duplicating the coding in date_out/timestamp_out/timestamptz_out more  
closely.  Per bug #13687 from Stepan Perlov.  Back-patch to 9.4, like  
the previous commit.  
  
In passing, also re-pgindent json.c, since it had gotten a bit messed up by  
recent patches (and I was already annoyed by indentation-related problems  
in back-patching this fix ...)  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

doc: Move documentation of max_wal_size to better position

commit   : 2bfd2fe58db88abf86a920fe532b80cf2ea84a7f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Oct 2015 13:33:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Oct 2015 13:33:39 -0400    

Click here for diff

M doc/src/sgml/config.sgml

Fix incorrect comment in plannodes.h

commit   : b3967f89370755176f4da03fb042e7e3e45999b5    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 11:11:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 11:11:35 -0400    

Click here for diff

Etsuro Fujita  

M src/include/nodes/plannodes.h

Put back ssl_renegotiation_limit parameter, but only allow 0.

commit   : b06f1f286d5b9beb10cf7dc365cdb7150064e191    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:56:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Oct 2015 09:56:04 -0400    

Click here for diff

Per a report from Shay Rojansky, Npgsql sends ssl_renegotiation_limit=0  
in the startup packet because it does not support renegotiation; other  
clients which have not attempted to support renegotiation might well  
behave similarly.  The recent removal of this parameter forces them to  
break compatibility with either current PostgreSQL versions, or  
previous ones.  Per discussion, the best solution is to accept the  
parameter but only allow a value of 0.  
  
Shay Rojansky, edited a little by me.  

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

Fix back-patch of commit 8e3b4d9d40244c037bbc6e182ea3fabb9347d482.

commit   : ed6c516728c695477c5b6140ce80bc12641f72e2    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 20 Oct 2015 00:57:25 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 20 Oct 2015 00:57:25 -0400    

Click here for diff

master emits an extra context message compared to 9.5 and earlier.  

M src/test/regress/expected/plpgsql.out

Eschew "RESET statement_timeout" in tests.

commit   : 01a96c77d638aad0d9d5b040ed62248481d3b5a0    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 20 Oct 2015 00:37:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 20 Oct 2015 00:37:22 -0400    

Click here for diff

Instead, use transaction abort.  Given an unlucky bout of latency, the  
timeout would cancel the RESET itself.  Buildfarm members gharial,  
lapwing, mereswine, shearwater, and sungazer witness that.  Back-patch  
to 9.1 (all supported versions).  The query_canceled test still could  
timeout before entering its subtransaction; for whatever reason, that  
has yet to happen on the buildfarm.  

M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/prepared_xacts.sql

Fix incorrect handling of lookahead constraints in pg_regprefix().

commit   : 43e36f8dd065ee2d73d0b010488e624b7e509c3f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Oct 2015 13:54:53 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Oct 2015 13:54:53 -0700    

Click here for diff

pg_regprefix was doing nothing with lookahead constraints, which would  
be fine if it were the right kind of nothing, but it isn't: we have to  
terminate our search for a fixed prefix, not just pretend the LACON arc  
isn't there.  Otherwise, if the current state has both a LACON outarc and a  
single plain-color outarc, we'd falsely conclude that the color represents  
an addition to the fixed prefix, and generate an extracted index condition  
that restricts the indexscan too much.  (See added regression test case.)  
  
Terminating the search is conservative: we could traverse the LACON arc  
(thus assuming that the constraint can be satisfied at runtime) and then  
examine the outarcs of the linked-to state.  But that would be a lot more  
work than it seems worth, because writing a LACON followed by a single  
plain character is a pretty silly thing to do.  
  
This makes a difference only in rather contrived cases, but it's a bug,  
so back-patch to all supported branches.  

M src/backend/regex/regprefix.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Fix order of arguments in ecpg generated typedef command.

commit   : 93726145434c593770e51c129737342fb3634b8a    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 16 Oct 2015 17:29:05 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 16 Oct 2015 17:29:05 +0200    

Click here for diff

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

Miscellaneous cleanup of regular-expression compiler.

commit   : 6a7a2ee77731fa21ef10a6f1cb7c3df727632d5d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:52:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:52:12 -0400    

Click here for diff

Revert our previous addition of "all" flags to copyins() and copyouts();  
they're no longer needed, and were never anything but an unsightly hack.  
  
Improve a couple of infelicities in the REG_DEBUG code for dumping  
the NFA data structure, including adding code to count the total  
number of states and arcs.  
  
Add a couple of missed error checks.  
  
Add some more documentation in the README file, and some regression tests  
illustrating cases that exceeded the state-count limit and/or took  
unreasonable amounts of time before this set of patches.  
  
Back-patch to all supported branches.  

M src/backend/regex/README
M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Improve memory-usage accounting in regular-expression compiler.

commit   : e91cfdead776111b62c3a4f36974544f4136421b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:36:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:36:17 -0400    

Click here for diff

This code previously counted the number of NFA states it created, and  
complained if a limit was exceeded, so as to prevent bizarre regex patterns  
from consuming unreasonable time or memory.  That's fine as far as it went,  
but the code paid no attention to how many arcs linked those states.  Since  
regexes can be contrived that have O(N) states but will need O(N^2) arcs  
after fixempties() processing, it was still possible to blow out memory,  
and take a long time doing it too.  To fix, modify the bookkeeping to count  
space used by both states and arcs.  
  
I did not bother with including the "color map" in the accounting; it  
can only grow to a few megabytes, which is not a lot in comparison to  
what we're allowing for states+arcs (about 150MB on 64-bit machines  
or half that on 32-bit machines).  
  
Looking at some of the larger real-world regexes captured in the Tcl  
regression test suite suggests that the most that is likely to be needed  
for regexes found in the wild is under 10MB, so I believe that the current  
limit has enough headroom to make it okay to keep it as a hard-wired limit.  
  
In connection with this, redefine REG_ETOOBIG as meaning "regular  
expression is too complex"; the previous wording of "nfa has too many  
states" was already somewhat inapropos because of the error code's use  
for stack depth overrun, and it was not very user-friendly either.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/include/regex/regerrs.h
M src/include/regex/regex.h
M src/include/regex/regguts.h

Improve performance of pullback/pushfwd in regular-expression compiler.

commit   : 1bb0fbca39b447d1ce6da5f6bcf9f468a6346a08    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:11:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 15:11:49 -0400    

Click here for diff

The previous coding would create a new intermediate state every time it  
wanted to interchange the ordering of two constraint arcs.  Certain regex  
features such as \Y can generate large numbers of parallel constraint arcs,  
and if we needed to reorder the results of that, we created unreasonable  
numbers of intermediate states.  To improve matters, keep a list of  
already-created intermediate states associated with the state currently  
being considered by the outer loop; we can re-use such states to place all  
the new arcs leading to the same destination or source.  
  
I also took the trouble to redefine push() and pull() to have a less risky  
API: they no longer delete any state or arc that the caller might possibly  
have a pointer to, except for the specifically-passed constraint arc.  
This reduces the risk of re-introducing the same type of error seen in  
the failed patch for CVE-2007-4772.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c

Improve performance of fixempties() pass in regular-expression compiler.

commit   : e9cf3dc30a4ed82f2c284240841678db15491669    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:58:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:58:10 -0400    

Click here for diff

The previous coding took something like O(N^4) time to fully process a  
chain of N EMPTY arcs.  We can't really do much better than O(N^2) because  
we have to insert about that many arcs, but we can do lots better than  
what's there now.  The win comes partly from using mergeins() to amortize  
de-duplication of arcs across multiple source states, and partly from  
exploiting knowledge of the ordering of arcs for each state to avoid  
looking at arcs we don't need to consider during the scan.  We do have  
to be a bit careful of the possible reordering of arcs introduced by  
the sort-merge coding of the previous commit, but that's not hard to  
deal with.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c

Fix O(N^2) performance problems in regular-expression compiler.

commit   : cff9e0659e8b79d4e075d30f04dac5a5587b8ac2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:43:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:43:17 -0400    

Click here for diff

Change the singly-linked in-arc and out-arc lists to be doubly-linked,  
so that arc deletion is constant time rather than having worst-case time  
proportional to the number of other arcs on the connected states.  
  
Modify the bulk arc transfer operations copyins(), copyouts(), moveins(),  
moveouts() so that they use a sort-and-merge algorithm whenever there's  
more than a small number of arcs to be copied or moved.  The previous  
method is O(N^2) in the number of arcs involved, because it performs  
duplicate checking independently for each copied arc.  The new method may  
change the ordering of existing arcs for the destination state, but nothing  
really cares about that.  
  
Provide another bulk arc copying method mergeins(), which is unused as  
of this commit but is needed for the next one.  It basically is like  
copyins(), but the source arcs might not all come from the same state.  
  
Replace the O(N^2) bubble-sort algorithm used in carcsort() with a qsort()  
call.  
  
These changes greatly improve the performance of regex compilation for  
large or complex regexes, at the cost of extra space for arc storage during  
compilation.  The original tradeoff was probably fine when it was made, but  
now we care more about speed and less about memory consumption.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/include/regex/regguts.h

Fix regular-expression compiler to handle loops of constraint arcs.

commit   : 0889e1857f07dea110e07fd7634af1ea773df951    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:14:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Oct 2015 14:14:41 -0400    

Click here for diff

It's possible to construct regular expressions that contain loops of  
constraint arcs (that is, ^ $ AHEAD BEHIND or LACON arcs).  There's no use  
in fully traversing such a loop at execution, since you'd just end up in  
the same NFA state without having consumed any input.  Worse, such a loop  
leads to infinite looping in the pullback/pushfwd stage of compilation,  
because we keep pushing or pulling the same constraints around the loop  
in a vain attempt to move them to the pre or post state.  Such looping was  
previously recognized in CVE-2007-4772; but the fix only handled the case  
of trivial single-state loops (that is, a constraint arc leading back to  
its source state) ... and not only that, it was incorrect even for that  
case, because it broke the admittedly-not-very-clearly-stated API contract  
of the pull() and push() subroutines.  The first two regression test cases  
added by this commit exhibit patterns that result in assertion failures  
because of that (though there seem to be no ill effects in non-assert  
builds).  The other new test cases exhibit multi-state constraint loops;  
in an unpatched build they will run until the NFA state-count limit is  
exceeded.  
  
To fix, remove the code added for CVE-2007-4772, and instead create a  
general-purpose constraint-loop-breaking phase of regex compilation that  
executes before we do pullback/pushfwd.  Since we never need to traverse  
a constraint loop fully, we can just break the loop at any chosen spot,  
if we add clone states that can replicate any sequence of arc transitions  
that would've traversed just part of the loop.  
  
Also add some commentary clarifying why we have to have all these  
machinations in the first place.  
  
This class of problems has been known for some time --- we had a report  
from Marc Mamin about two years ago, for example, and there are related  
complaints in the Tcl bug tracker.  I had discussed a fix of this kind  
off-list with Henry Spencer, but didn't get around to doing something  
about it until the issue was rediscovered by Greg Stark recently.  
  
Back-patch to all supported branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Remove cautions about using volatile from spin.h.

commit   : 22884414cbac345c9143738634123f76e61ca343    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:06:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 14:06:22 -0400    

Click here for diff

Commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0 obsoleted this comment  
but neglected to update it.  
  
Thomas Munro  

M src/include/storage/spin.h

Fix a problem with parallel workers being unable to restore role.

commit   : 73d71cde5751e06d372431178e740835284eb132    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:37:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:37:19 -0400    

Click here for diff

check_role() tries to verify that the user has permission to become the  
requested role, but this is inappropriate in a parallel worker, which  
needs to exactly recreate the master's authorization settings.  So skip  
the check in that case.  
  
This fixes a bug in commit 924bcf4f16d54c55310b28f77686608684734f42.  

M src/backend/access/transam/parallel.c
M src/backend/commands/variable.c
M src/include/access/parallel.h

Invalidate caches after cranking up a parallel worker transaction.

commit   : 14129d1c9e2d3afa064651012a55c9c84aa6821a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:31:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 11:31:23 -0400    

Click here for diff

Starting a parallel worker transaction changes our notion of which XIDs  
are in-progress or committed, and our notion of the current command  
counter ID.  Therefore, our view of these caches prior to starting  
this transaction may no longer valid.  Defend against that by clearing  
them.  
  
This fixes a bug in commit 924bcf4f16d54c55310b28f77686608684734f42.  

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

Tighten up application of parallel mode checks.

commit   : d43e3adc7572d34988967475900dcd4f9e0a7b89    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:59:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:59:57 -0400    

Click here for diff

Commit 924bcf4f16d54c55310b28f77686608684734f42 failed to enforce  
parallel mode checks during the commit of a parallel worker, because  
we exited parallel mode prior to ending the transaction so that we  
could pop the active snapshot.  Re-establish parallel mode during  
parallel worker commit.  Without this, it's far too easy for unsafe  
actions during the pre-commit sequence to crash the server instead of  
hitting the error checks as intended.  
  
Just to be extra paranoid, adjust a couple of the sanity checks in  
xact.c to check not only IsInParallelMode() but also  
IsParallelWorker().  

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

Transfer current command counter ID to parallel workers.

commit   : c451eaf8f628440ad93e933da8f08f7f4545c376    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:53:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:53:34 -0400    

Click here for diff

Commit 924bcf4f16d54c55310b28f77686608684734f42 correctly forbade  
parallel workers to modify the command counter while in parallel mode,  
but it inexplicably neglected to actually transfer the current command  
counter from leader to workers.  This can result in the workers seeing  
a different set of tuples from the leader, which is bad.  Repair.  

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

Don't send protocol messages to a shm_mq that no longer exists.

commit   : 26981d292758c6ee9185332e4abc990ff19c81a2    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:42:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 16 Oct 2015 09:42:33 -0400    

Click here for diff

Commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d introduced a mechanism  
for relaying protocol messages from a background worker to another  
backend via a shm_mq.  However, there was no provision for shutting  
down the communication channel.  Therefore, a protocol message sent  
late in the shutdown sequence, such as a DEBUG message resulting from  
cranking up log_min_messages, could crash the server.  To fix, install  
an on_dsm_detach callback that disables sending messages to the shm_mq  
when the associated DSM is detached.  

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

Fix NULL handling in datum_to_jsonb().

commit   : a93b3782e3358cbb1ad8d65386a2e1478b805649    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Oct 2015 13:46:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Oct 2015 13:46:09 -0400    

Click here for diff

The function failed to adhere to its specification that the "tcategory"  
argument should not be examined when the input value is NULL.  This  
resulted in a crash in some cases.  Per bug #13680 from Boyko Yordanov.  
  
In passing, re-pgindent some recent changes in jsonb.c, and fix a rather  
ungrammatical comment.  
  
Diagnosis and patch by Michael Paquier, cosmetic changes by me  

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

Allow FDWs to push down quals without breaking EvalPlanQual rechecks.

commit   : 5043193b78919a1bd144563aadc2f7f726549913    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Oct 2015 13:00:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Oct 2015 13:00:40 -0400    

Click here for diff

This fixes a long-standing bug which was discovered while investigating  
the interaction between the new join pushdown code and the EvalPlanQual  
machinery: if a ForeignScan appears on the inner side of a paramaterized  
nestloop, an EPQ recheck would re-return the original tuple even if  
it no longer satisfied the pushed-down quals due to changed parameter  
values.  
  
This fix adds a new member to ForeignScan and ForeignScanState and a  
new argument to make_foreignscan, and requires changes to FDWs which  
push down quals to populate that new argument with a list of quals they  
have chosen to push down.  Therefore, I'm only back-patching to 9.5,  
even though the bug is not new in 9.5.  
  
Etsuro Fujita, reviewed by me and by Kyotaro Horiguchi.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/nodeForeignscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h

Fix bogus comments

commit   : 54e07be2dfd314a64dc2ce03a6a7f59cac1c8a13    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Oct 2015 12:20:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Oct 2015 12:20:15 -0300    

Click here for diff

Author: Amit Langote  

M src/backend/commands/tablecmds.c

-- email subject limit ----------------------------------------- -- gitweb summary limit -------------------------- pg_upgrade: reorder controldata checks to match program output

commit   : 41179e7ab328a12870fed942768a89dbe8742bf1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 13 Oct 2015 18:25:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 13 Oct 2015 18:25:32 -0400    

Click here for diff

Also improve comment for how float8_pass_by_value is used.  
  
Backpatch through 9.5  

M src/bin/pg_upgrade/controldata.c

Improve INSERT .. ON CONFLICT error message.

commit   : bf8a361e101d830a6db105982a8527325c2e85fc    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 13 Oct 2015 15:33:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 13 Oct 2015 15:33:07 -0400    

Click here for diff

Peter Geoghegan, reviewed by me.  

M src/backend/executor/execIndexing.c
M src/test/regress/output/constraints.source

On Windows, ensure shared memory handle gets closed if not being used.

commit   : 39ac293940ec022f36510ba72470f23799e21dde    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Oct 2015 11:21:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Oct 2015 11:21:33 -0400    

Click here for diff

Postmaster child processes that aren't supposed to be attached to shared  
memory were not bothering to close the shared memory mapping handle they  
inherit from the postmaster process.  That's mostly harmless, since the  
handle vanishes anyway when the child process exits -- but the syslogger  
process, if used, doesn't get killed and restarted during recovery from a  
backend crash.  That meant that Windows doesn't see the shared memory  
mapping as becoming free, so it doesn't delete it and the postmaster is  
unable to create a new one, resulting in failure to recover from crashes  
whenever logging_collector is turned on.  
  
Per report from Dmitry Vasilyev.  It's a bit astonishing that we'd not  
figured this out long ago, since it's been broken from the very beginnings  
of out native Windows support; probably some previously-unexplained trouble  
reports trace to this.  
  
A secondary problem is that on Cygwin (perhaps only in older versions?),  
exec() may not detach from the shared memory segment after all, in which  
case these child processes did remain attached to shared memory, posing  
the risk of an unexpected shared memory clobber if they went off the rails  
somehow.  That may be a long-gone bug, but we can deal with it now if it's  
still live, by detaching within the infrastructure introduced here to deal  
with closing the handle.  
  
Back-patch to all supported branches.  
  
Tom Lane and Amit Kapila  

M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/include/storage/pg_shmem.h

Sigh, need "use Config" as well.

commit   : c6ab511c224f8775c0d392f8811c0a0a34758b3a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 19:49:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 19:49:22 -0400    

Click here for diff

This time with some manual testing behind it ...  

M src/test/perl/TestLib.pm

Cause TestLib.pm to define $windows_os in all branches.

commit   : 34557f5448e04366e7b64a402c0dd33decb6c346    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 19:35:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 19:35:38 -0400    

Click here for diff

Back-port of a part of commit 690ed2b76ab91eb79ea04ee2bfbdc8a2693f2a37 that  
I'd depended on without realizing that it was only added recently.  Since  
it seems entirely likely that other such tests will need to be back-patched  
in future, providing the flag seems like a better answer than just putting  
a test in-line.  
  
Per buildfarm.  

M src/test/perl/TestLib.pm

Fix "pg_ctl start -w" to test child process status directly.

commit   : a151a5c38510793830a63d74201e2d3561829170    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 18:30:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Oct 2015 18:30:36 -0400    

Click here for diff

pg_ctl start with -w previously relied on a heuristic that the postmaster  
would surely always manage to create postmaster.pid within five seconds.  
Unfortunately, that fails much more often than we would like on some of the  
slower, more heavily loaded buildfarm members.  
  
We have known for quite some time that we could remove the need for that  
heuristic on Unix by using fork/exec instead of system() to launch the  
postmaster.  This allows us to know the exact PID of the postmaster, which  
allows near-certain verification that the postmaster.pid file is the one  
we want and not a leftover, and it also lets us use waitpid() to detect  
reliably whether the child postmaster has exited or not.  
  
What was blocking this change was not wanting to rewrite the Windows  
version of start_postmaster() to avoid use of CMD.EXE.  That's doable  
in theory but would require fooling about with stdout/stderr redirection,  
and getting the handling of quote-containing postmaster switches to  
stay the same might be rather ticklish.  However, we realized that  
we don't have to do that to fix the problem, because we can test  
whether the shell process has exited as a proxy for whether the  
postmaster is still alive.  That doesn't allow an exact check of the  
PID in postmaster.pid, but we're no worse off than before in that  
respect; and we do get to get rid of the heuristic about how long the  
postmaster might take to create postmaster.pid.  
  
On Unix, this change means that a second "pg_ctl start -w" immediately  
after another such command will now reliably fail, whereas previously  
it would succeed if done within two seconds of the earlier command.  
Since that's a saner behavior anyway, it's fine.  On Windows, the case can  
still succeed within the same time window, since pg_ctl can't tell that the  
earlier postmaster's postmaster.pid isn't the pidfile it is looking for.  
To ensure stable test results on Windows, we can insert a short sleep into  
the test script for pg_ctl, ensuring that the existing pidfile looks stale.  
This hack can be removed if we ever do rewrite start_postmaster(), but that  
no longer seems like a high-priority thing to do.  
  
Back-patch to all supported versions, both because the current behavior  
is buggy and because we must do that if we want the buildfarm failures  
to go away.  
  
Tom Lane and Michael Paquier  

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

Use JsonbIteratorToken consistently in automatic variable declarations.

commit   : f75c4fc1dc93d60246df324bf595912d557bcba6    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 23:53:35 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 23:53:35 -0400    

Click here for diff

Many functions stored JsonbIteratorToken values in variables of other  
integer types.  Also, standardize order relative to other declarations.  
Expect compilers to generate the same code before and after this change.  

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

Fix whitespace

commit   : 7109c606d00f972359052bb8c8879a1ecfc1850f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 11 Oct 2015 21:44:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 11 Oct 2015 21:44:27 -0400    

Click here for diff

M src/test/regress/sql/json_encoding.sql

Make prove_installcheck remove the old log directory, if any.

commit   : 2539b9b0831c5642fd21284ce50003f08a313037    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 20:36:07 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 11 Oct 2015 20:36:07 -0400    

Click here for diff

prove_check already has been doing this.  Back-patch to 9.4, like the  
commit that introduced this logging.  

M src/Makefile.global.in

Handle append_rel_list in expand_security_qual

commit   : a26609e470601421b44424d6cc2683c4acabd086    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 9 Oct 2015 10:49:10 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 9 Oct 2015 10:49:10 -0400    

Click here for diff

During expand_security_quals, we take the security barrier quals on an  
RTE and create a subquery which evaluates the quals.  During this, we  
have to replace any variables in the outer query which refer to the  
original RTE with references to the columns from the subquery.  
  
We need to also perform that replacement for any Vars in the  
append_rel_list.  
  
Only backpatching to 9.5 as we only go through this process in 9.4 for  
auto-updatable security barrier views, which UNION ALL queries aren't.  
  
Discovered by Haribabu Kommi  
  
Patch by Dean Rasheed  

M src/backend/optimizer/prep/prepsecurity.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix uninitialized-variable bug.

commit   : e50431aa22e3b894ac107affd358052c20a899f7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Oct 2015 09:12:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Oct 2015 09:12:03 -0500    

Click here for diff

For some reason, neither of the compilers I usually use noticed the  
uninitialized-variable problem I introduced in commit 7e2a18a9161fee7e.  
That's hardly a good enough excuse though.  Committing with brown paper bag  
on head.  
  
In addition to putting the operations in the right order, move the  
declaration of "now" inside the loop; there's no need for it to be  
outside, and that does wake up older gcc enough to notice any similar  
future problem.  
  
Back-patch to 9.4; earlier versions lack the time-to-SIGKILL stanza  
so there's no bug.  

M src/backend/postmaster/postmaster.c

Fix typo in docs.

commit   : 36d4a50a886dacdb9e4a6716aca984edd3add83b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 13:21:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 8 Oct 2015 13:21:03 -0400    

Click here for diff

Pallavi Sontakke  

M doc/src/sgml/func.sgml

Factor out encoding specific tests for json

commit   : 48a78d80c83f7cd341e9761b5404562db6031c7e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 7 Oct 2015 17:41:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 7 Oct 2015 17:41:45 -0400    

Click here for diff

This lets us remove the large alternative results files for the main  
json and jsonb tests, which makes modifying those tests simpler for  
committers and patch submitters.  
  
Backpatch to 9.4 for jsonb and 9.3 for json.  

M src/test/regress/expected/json.out
D src/test/regress/expected/json_1.out
A src/test/regress/expected/json_encoding.out
A src/test/regress/expected/json_encoding_1.out
M src/test/regress/expected/jsonb.out
D src/test/regress/expected/jsonb_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/json.sql
A src/test/regress/sql/json_encoding.sql
M src/test/regress/sql/jsonb.sql

Improve documentation of the role-dropping process.

commit   : fc95734a14e588a847793ce4a734d9bf7fe50d14    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Oct 2015 16:12:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Oct 2015 16:12:05 -0400    

Click here for diff

In general one may have to run both REASSIGN OWNED and DROP OWNED to get  
rid of all the dependencies of a role to be dropped.  This was alluded to  
in the REASSIGN OWNED man page, but not really spelled out in full; and in  
any case the procedure ought to be documented in a more prominent place  
than that.  Add a section to the "Database Roles" chapter explaining this,  
and do a bit of wordsmithing in the relevant commands' man pages.  

M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/drop_user.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M doc/src/sgml/user-manag.sgml

docs: add JSONB containment example of a key and empty object

commit   : c86555fc80bbbf276de42f43761991212b713575    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 10:30:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 10:30:54 -0400    

Click here for diff

Backpatch through 9.5  

M doc/src/sgml/json.sgml

docs: Map operator @> to the proper SGML escape for '>'

commit   : 9445a1cd3cc6dfae3644e2fe95da77046b507491    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:42:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:42:26 -0400    

Click here for diff

Backpatch through 9.5  

M doc/src/sgml/json.sgml
M doc/src/sgml/rangetypes.sgml

docs: clarify JSONB operator descriptions

commit   : 2169e878c4a542e41a7d66cbb40d9c6bfde23f57    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:06:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 7 Oct 2015 09:06:49 -0400    

Click here for diff

No catalog bump as the catalog changes are for SQL operator comments.  
  
Backpatch through 9.5  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml
M src/include/catalog/pg_operator.h

Perform an immediate shutdown if the postmaster.pid file is removed.

commit   : 02580df6c3ac288f2ed5e38ed42532512993d468    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Oct 2015 17:15:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Oct 2015 17:15:27 -0400    

Click here for diff

The postmaster now checks every minute or so (worst case, at most two  
minutes) that postmaster.pid is still there and still contains its own PID.  
If not, it performs an immediate shutdown, as though it had received  
SIGQUIT.  
  
The original goal behind this change was to ensure that failed buildfarm  
runs would get fully cleaned up, even if the test scripts had left a  
postmaster running, which is not an infrequent occurrence.  When the  
buildfarm script removes a test postmaster's $PGDATA directory, its next  
check on postmaster.pid will fail and cause it to exit.  Previously, manual  
intervention was often needed to get rid of such orphaned postmasters,  
since they'd block new test postmasters from obtaining the expected socket  
address.  
  
However, by checking postmaster.pid and not something else, we can provide  
additional robustness: manual removal of postmaster.pid is a frequent DBA  
mistake, and now we can at least limit the damage that will ensue if a new  
postmaster is started while the old one is still alive.  
  
Back-patch to all supported branches, since we won't get the desired  
improvement in buildfarm reliability otherwise.  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Stamp 9.5beta1.

commit   : b96df2c61710b39d24e98767cfe17b920b9319a6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 15:09:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 15:09:44 -0400    

Click here for diff

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

docs: update guidelines on when to use GIN and GiST indexes

commit   : 7d88b3d154444fe102ef6a006f1234025e91c7fa    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 13:38:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Oct 2015 13:38:36 -0400    

Click here for diff

Report by Tomas Vondra  
  
Backpatch through 9.5  

M doc/src/sgml/textsearch.sgml

Docs: explain contrib/pg_stat_statements' handling of GC failure.

commit   : d62359144da19297b13b2abf6c7d5d9220cfdf28    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:44:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:44:12 -0400    

Click here for diff

Failure to perform garbage collection now has a user-visible effect, so  
explain that and explain that reducing pgss_max is the way to prevent it.  
Per gripe from Andrew Dunstan.  

M doc/src/sgml/pgstatstatements.sgml

Fix insufficiently-portable regression test case.

commit   : c0f058e4d2c8dab6f6290dc85d2ad440691d562d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:19:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 12:19:14 -0400    

Click here for diff

Some of the buildfarm members are evidently miserly enough of stack space  
to pass the originally-committed form of this test.  Increase the  
requirement 10X to hopefully ensure that it fails as-expected everywhere.  
  
Security: CVE-2015-5289  

M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Translation updates

commit   : 149a8cdd7a299ce25eea9157baa636c3f00f2c5f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Oct 2015 10:59:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Oct 2015 10:59:53 -0400    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/it.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/pl.po
M src/bin/initdb/po/pt_BR.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/pl.po
M src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/pt_BR.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/pl.po
M src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_resetxlog/po/es.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/pg_resetxlog/po/pt_BR.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/de.po
A src/bin/pg_rewind/po/es.po
A src/bin/pg_rewind/po/pl.po
M src/bin/psql/po/de.po
M src/bin/psql/po/es.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/pt_BR.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/pt_BR.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/pt_BR.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/it.po
M src/interfaces/libpq/po/pl.po
M src/interfaces/libpq/po/pt_BR.po
M src/pl/plperl/po/de.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/it.po
M src/pl/plperl/po/pl.po
M src/pl/plperl/po/pt_BR.po
M src/pl/plpgsql/src/po/de.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/pl.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/pl.po
M src/pl/plpython/po/pt_BR.po
M src/pl/tcl/po/de.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/it.po
M src/pl/tcl/po/pl.po
M src/pl/tcl/po/pt_BR.po

Last-minute updates for release notes.

commit   : 808f1bdb3d9f662c4a46a43c6cf14a6ce33b4df5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 10:57:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Oct 2015 10:57:15 -0400    

Click here for diff

Add entries for security and not-quite-security issues.  
  
Security: CVE-2015-5288, CVE-2015-5289  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Remove outdated comment about relation level autovacuum freeze limits.

commit   : 56805a428cb95394eee7c853cfcb96c066e81256    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 16:09:13 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 16:09:13 +0200    

Click here for diff

The documentation for the autovacuum_multixact_freeze_max_age and  
autovacuum_freeze_max_age relation level parameters contained:  
"Note that while you can set autovacuum_multixact_freeze_max_age very  
small, or even zero, this is usually unwise since it will force frequent  
vacuuming."  
which hasn't been true since these options were made relation options,  
instead of residing in the pg_autovacuum table (834a6da4f7).  
  
Remove the outdated sentence. Even the lowered limits from 2596d70 are  
high enough that this doesn't warrant calling out the risk in the CREATE  
TABLE docs.  
  
Per discussion with Tom Lane and Alvaro Herrera  
  
Discussion: [email protected]  
Backpatch: 9.0- (in parts)  

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

Add regression tests for INSERT/UPDATE+RETURNING

commit   : f9bb9c0a8a736efb567a676ad678d05a8dc35780    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 10:14:51 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 10:14:51 -0400    

Click here for diff

This adds regressions tests which are specific to INSERT+RETURNING and  
UPDATE+RETURNING to ensure that the SELECT policies are added as  
WithCheckOptions (and should therefore throw an error when the policy is  
violated).  
  
Per suggestion from Andres.  
  
Back-patch to 9.5 as the prior commit was.  

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

Prevent stack overflow in query-type functions.

commit   : 7bed97d486bda5761ba7e7982e4133aeded6b852    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:30 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:30 -0400    

Click here for diff

The tsquery, ltxtquery and query_int data types have a common ancestor.  
Having acquired check_stack_depth() calls independently, each was  
missing at least one call.  Back-patch to 9.0 (all supported versions).  

M contrib/intarray/_int_bool.c
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/ltxtquery_op.c
M src/backend/utils/adt/tsquery_cleanup.c

Prevent stack overflow in container-type functions.

commit   : acf0da1e6476fd3217781065c7e7654873376568    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    

Click here for diff

A range type can name another range type as its subtype, and a record  
type can bear a column of another record type.  Consequently, functions  
like range_cmp() and record_recv() are recursive.  Functions at risk  
include operator family members and referents of pg_type regproc  
columns.  Treat as recursive any such function that looks up and calls  
the same-purpose function for a record column type or the range subtype.  
Back-patch to 9.0 (all supported versions).  
  
An array type's element type is never itself an array type, so array  
functions are unaffected.  Recursion depth proportional to array  
dimensionality, found in array_dim_to_jsonb(), is fine thanks to MAXDIM.  

M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rowtypes.c

commit   : 98f30d2e55d530ff47b2756b395a2048200a5ea4    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    

Click here for diff

Sufficiently-deep recursion heretofore elicited a SIGSEGV.  If an  
application constructs PostgreSQL json or jsonb values from arbitrary  
user input, application users could have exploited this to terminate all  
active database connections.  That applies to 9.3, where the json parser  
adopted recursive descent, and later versions.  Only row_to_json() and  
array_to_json() were at risk in 9.2, both in a non-security capacity.  
Back-patch to 9.2, where the json type was introduced.  
  
Oskari Saarenmaa, reviewed by Michael Paquier.  
  
Security: CVE-2015-5289  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

pgcrypto: Detect and report too-short crypt() salts.

commit   : 4d6752277e792386e54b036aee8f64ee4fa84cf1    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Oct 2015 10:06:29 -0400    

Click here for diff

Certain short salts crashed the backend or disclosed a few bytes of  
backend memory.  For existing salt-induced error conditions, emit a  
message saying as much.  Back-patch to 9.0 (all supported versions).  
  
Josh Kupershmidt  
  
Security: CVE-2015-5288  

M contrib/pgcrypto/crypt-blowfish.c
M contrib/pgcrypto/crypt-des.c
M contrib/pgcrypto/expected/crypt-blowfish.out
M contrib/pgcrypto/expected/crypt-des.out
M contrib/pgcrypto/expected/crypt-xdes.out
M contrib/pgcrypto/px-crypt.c
M contrib/pgcrypto/sql/crypt-blowfish.sql
M contrib/pgcrypto/sql/crypt-des.sql
M contrib/pgcrypto/sql/crypt-xdes.sql

Apply SELECT policies in INSERT/UPDATE+RETURNING

commit   : bd9014768035dd70f8cc33c215a8b929c2e13a35    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:55:11 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:55:11 -0400    

Click here for diff

Similar to 7d8db3e, given that INSERT+RETURNING requires SELECT rights  
on the table, apply the SELECT policies as WCOs to the tuples being  
inserted.  Apply the same logic to UPDATE+RETURNING.  
  
Back-patch to 9.5 where RLS was added.  

M src/backend/rewrite/rowsecurity.c

Do not write out WCOs in Query

commit   : 31fb4df69d1364c79cfab0a2bd4470d0c48e942e    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:38:56 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 5 Oct 2015 07:38:56 -0400    

Click here for diff

The WithCheckOptions list in Query are only populated during rewrite and  
do not need to be written out or read in as part of a Query structure.  
  
Further, move WithCheckOptions to the bottom and add comments to clarify  
that it is only populated during rewrite.  
  
Back-patch to 9.5 with a catversion bump, as we are still in alpha.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Re-Align *_freeze_max_age reloption limits with corresponding GUC limits.

commit   : 0577821b57253d0ae43ffdddc8f94f07866830ae    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 11:53:43 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Oct 2015 11:53:43 +0200    

Click here for diff

In 020235a5754 I lowered the autovacuum_*freeze_max_age minimums to  
allow for easier testing of wraparounds. I did not touch the  
corresponding per-table limits. While those don't matter for the purpose  
of wraparound, it seems more consistent to lower them as well.  
  
It's noteworthy that the previous reloption lower limit for  
autovacuum_multixact_freeze_max_age was too high by one magnitude, even  
before 020235a5754.  
  
Discussion: [email protected]  
Backpatch: back to 9.0 (in parts), like the prior patch  

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

ALTER TABLE .. FORCE ROW LEVEL SECURITY

commit   : 90f334d2ca1a8bae2d0cd8a0898fb8ef90257565    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 4 Oct 2015 21:05:18 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 4 Oct 2015 21:05:18 -0400    

Click here for diff

To allow users to force RLS to always be applied, even for table owners,  
add ALTER TABLE .. FORCE ROW LEVEL SECURITY.  
  
row_security=off overrides FORCE ROW LEVEL SECURITY, to ensure pg_dump  
output is complete (by default).  
  
Also add SECURITY_NOFORCE_RLS context to avoid data corruption when  
ALTER TABLE .. FORCE ROW SECURITY is being used. The  
SECURITY_NOFORCE_RLS security context is used only during referential  
integrity checks and is only considered in check_enable_rls() after we  
have already checked that the current user is the owner of the relation  
(which should always be the case during referential integrity checks).  
  
Back-patch to 9.5 where RLS was added.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/rls.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/miscadmin.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/output/misc.source
M src/test/regress/sql/rowsecurity.sql

Release notes for 9.5beta1, 9.4.5, 9.3.10, 9.2.14, 9.1.19, 9.0.23.

commit   : e78dc6b829219cacaccc59957b5375585e919099    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 19:38:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 19:38:00 -0400    

Click here for diff

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml

Improve contrib/pg_stat_statements' handling of garbage collection failure.

commit   : 39a716d93300eeb28b959a0b248009a10fa49d3c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 17:58:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 17:58:30 -0400    

Click here for diff

If we can't read the query texts file (whether because out-of-memory, or  
for some other reason), give up and reset the file to empty, discarding all  
stored query texts, though not the statistics per se.  We used to leave  
things alone and hope for better luck next time, but the problem is that  
the file is only going to get bigger and even harder to slurp into memory.  
Better to do something that will get us out of trouble.  
  
Likewise reset the file to empty for any other failure within gc_qtexts().  
The previous behavior after a write error was to discard query texts but  
not do anything to truncate the file, which is just weird.  
  
Also, increase the maximum supported file size from MaxAllocSize to  
MaxAllocHugeSize; this makes it more likely we'll be able to do a garbage  
collection successfully.  
  
Also, fix recalculation of mean_query_len within entry_dealloc() to match  
the calculation in gc_qtexts().  The previous coding overlooked the  
possibility of dropped texts (query_len == -1) and would underestimate the  
mean of the remaining entries in such cases, thus possibly causing excess  
garbage collection cycles.  
  
In passing, add some errdetail to the log entry that complains about  
insufficient memory to read the query texts file, which after all was  
Jim Nasby's original complaint.  
  
Back-patch to 9.4 where the current handling of query texts was  
introduced.  
  
Peter Geoghegan, rather editorialized upon by me  

M contrib/pg_stat_statements/pg_stat_statements.c

Further twiddling of nodeHash.c hashtable sizing calculation.

commit   : e5c94c7bbcf091617f0720a3ccbe898cd8beff17    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 15:55:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 15:55:07 -0400    

Click here for diff

On reflection, the submitted patch didn't really work to prevent the  
request size from exceeding MaxAllocSize, because of the fact that we'd  
happily round nbuckets up to the next power of 2 after we'd limited it to  
max_pointers.  The simplest way to enforce the limit correctly is to  
round max_pointers down to a power of 2 when it isn't one already.  
  
(Note that the constraint to INT_MAX / 2, if it were doing anything useful  
at all, is properly applied after that.)  

M src/backend/executor/nodeHash.c

Fix some issues in new hashtable size calculations in nodeHash.c.

commit   : ca5b42d85486f814b3b510e436157f443fd73683    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 14:06:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Oct 2015 14:06:40 -0400    

Click here for diff

Limit the size of the hashtable pointer array to not more than  
MaxAllocSize, per reports from Kouhei Kaigai and others of "invalid memory  
alloc request size" failures.  There was discussion of allowing the array  
to get larger than that by using the "huge" palloc API, but so far no proof  
that that is actually a good idea, and at this point in the 9.5 cycle major  
changes from old behavior don't seem like the way to go.  
  
Fix a rather serious secondary bug in the new code, which was that it  
didn't ensure nbuckets remained a power of 2 when recomputing it for the  
multiple-batch case.  
  
Clean up sloppy division of labor between ExecHashIncreaseNumBuckets and  
its sole call site.  

M src/backend/executor/nodeHash.c
M src/include/executor/hashjoin.h

Disallow invalid path elements in jsonb_set

commit   : 544ccf644288132f805260c4eb9fd12029c5cf8c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 4 Oct 2015 13:28:16 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 4 Oct 2015 13:28:16 -0400    

Click here for diff

Null path elements and, where the object is an array, invalid integer  
elements now cause an error.  
  
Incorrect behaviour noted by Thom Brown, patch from Dmitry Dolgov.  
  
Backpatch to 9.5 where jsonb_set was introduced  

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

Group cluster_name and update_process_title settings together

commit   : e45f8f882055d5f864815aa29ffcd2b5e3c2013b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 4 Oct 2015 11:14:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 4 Oct 2015 11:14:28 -0400    

Click here for diff

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

Document that row_security is a boolean GUC.

commit   : 4365d9c18fc1ebb14de92595aa0340c5b8301547    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:20:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:20:22 -0400    

Click here for diff

Oversight in commit 537bd178c73b1d25938347b17e9e3e62898fc231.  
Back-patch to 9.5, like that commit.  

M doc/src/sgml/config.sgml

Make BYPASSRLS behave like superuser RLS bypass.

commit   : 01ba7894f3f72ea57d1cfdc4f40f6231bc6cd9cd    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:19:57 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 3 Oct 2015 20:19:57 -0400    

Click here for diff

Specifically, make its effect independent from the row_security GUC, and  
make it affect permission checks pertinent to views the BYPASSRLS role  
owns.  The row_security GUC thereby ceases to change successful-query  
behavior; it can only make a query fail with an error.  Back-patch to  
9.5, where BYPASSRLS was introduced.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_role.sgml
M src/backend/utils/misc/rls.c
M src/include/catalog/pg_authid.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Improve errhint() about replication slot naming restrictions.

commit   : cfddb5df5a84923160b23890d6086bcbcd1fd655    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:29:08 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:29:08 +0200    

Click here for diff

The existing hint talked about "may only contain letters", but the  
actual requirement is more strict: only lower case letters are allowed.  
  
Reported-By: Rushabh Lathia  
Author: Rushabh Lathia  
Discussion: AGPqQf2x50qcwbYOBKzb4x75sO_V3g81ZsA8+Ji9iN5t_khFhQ@mail.gmail.com  
Backpatch: 9.4-, where replication slots were added  

M contrib/test_decoding/expected/ddl.out
M src/backend/replication/slot.c

commit   : 7285d66494a4c588ccf743a81f93b85b6995214f    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:12:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Oct 2015 15:12:10 +0200    

Click here for diff

Four related issues:  
  
1) attnos/varnos/resnos for EXCLUDED were out of sync when a column  
   after one dropped in the underlying relation was referenced.  
2) References to whole-row variables (i.e. EXCLUDED.*) lead to errors.  
3) It was possible to reference system columns in the EXCLUDED pseudo  
   relations, even though they would not have valid contents.  
4) References to EXCLUDED were rewritten by the RLS machinery, as  
   EXCLUDED was treated as if it were the underlying relation.  
  
To fix the first two issues, generate the excluded targetlist with  
dropped columns in mind and add an entry for whole row  
variables. Instead of unconditionally adding a wholerow entry we could  
pull up the expression if needed, but doing it unconditionally seems  
simpler. The wholerow entry is only really needed for ruleutils/EXPLAIN  
support anyway.  
  
The remaining two issues are addressed by changing the EXCLUDED RTE to  
have relkind = composite. That fits with EXCLUDED not actually being a  
real relation, and allows to treat it differently in the relevant  
places. scanRTEForColumn now skips looking up system columns when the  
RTE has a composite relkind; fireRIRrules() already had a corresponding  
check, thereby preventing RLS expansion on EXCLUDED.  
  
Also add tests for these issues, and improve a few comments around  
excluded handling in setrefs.c.  
  
Reported-By: Peter Geoghegan, Geoff Winkless  
Author: Andres Freund, Amit Langote, Peter Geoghegan  
Discussion: CAEzk6fdzJ3xYQZGbcuYM2rBd2BuDkUksmK=mY9UYYDugg_GgZg@mail.gmail.com,  
   CAM3SWZS+CauzbiCEcg-GdE6K6ycHE_Bz6Ksszy8AoixcMHOmsA@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_relation.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/rules.sql

doc: Update URLs of external projects

commit   : 0777a887c24197d1d9d611ecc4b85a2d74b616b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:50:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:50:59 -0400    

Click here for diff

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

doc: Make some index terms and terminology more consistent

commit   : 5f904924bc270fd2d8dcc29f8267515e79a07baf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:22:44 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Oct 2015 21:22:44 -0400    

Click here for diff

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

Update time zone data files to tzdata release 2015g.

commit   : 19b06cc669fe128ad6181a97a00bcc26889ad0da    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 19:15:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 19:15:39 -0400    

Click here for diff

DST law changes in Cayman Islands, Fiji, Moldova, Morocco, Norfolk Island,  
North Korea, Turkey, Uruguay.  New zone America/Fort_Nelson for Canadian  
Northern Rockies.  

M src/timezone/data/africa
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/iso3166.tab
M src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Clarify FDW documentation about ON CONFLICT.

commit   : 63e86ecacd505f2e1c125ff2361f47754f3e18c0    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 2 Oct 2015 16:55:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 2 Oct 2015 16:55:47 -0400    

Click here for diff

Etsuro Fujita, reviewed by Peter Geoghegan  

M doc/src/sgml/fdwhandler.sgml

Add recursion depth protection to LIKE matching.

commit   : bdc5d95b60bc1f17962a6b6184924b3672bd2f60    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 15:00:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 15:00:52 -0400    

Click here for diff

Since MatchText() recurses, it could in principle be driven to stack  
overflow, although quite a long pattern would be needed.  

M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c

Add recursion depth protections to regular expression matching.

commit   : 20c627707c44deaed92c5d67b350f27e06e24228    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:51:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:51:58 -0400    

Click here for diff

Some of the functions in regex compilation and execution recurse, and  
therefore could in principle be driven to stack overflow.  The Tcl crew  
has seen this happen in practice in duptraverse(), though their fix was  
to put in a hard-wired limit on the number of recursive levels, which is  
not too appetizing --- fortunately, we have enough infrastructure to check  
the actually available stack.  Greg Stark has also seen it in other places  
while fuzz testing on a machine with limited stack space.  Let's put guards  
in to prevent crashes in all these places.  
  
Since the regex code would leak memory if we simply threw elog(ERROR),  
we have to introduce an API that checks for stack depth without throwing  
such an error.  Fortunately that's not difficult.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c
M src/backend/tcop/postgres.c
M src/include/miscadmin.h
M src/include/regex/regguts.h

Fix potential infinite loop in regular expression execution.

commit   : 51f235931dd25d704cb2f257eaa97ee2cd13c3e6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:26:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 14:26:36 -0400    

Click here for diff

In cfindloop(), if the initial call to shortest() reports that a  
zero-length match is possible at the current search start point, but then  
it is unable to construct any actual match to that, it'll just loop around  
with the same start point, and thus make no progress.  We need to force the  
start point to be advanced.  This is safe because the loop over "begin"  
points has already tried and failed to match starting at "close", so there  
is surely no need to try that again.  
  
This bug was introduced in commit e2bd904955e2221eddf01110b1f25002de2aaa83,  
wherein we allowed continued searching after we'd run out of match  
possibilities, but evidently failed to think hard enough about exactly  
where we needed to search next.  
  
Because of the way this code works, such a match failure is only possible  
in the presence of backrefs --- otherwise, shortest()'s judgment that a  
match is possible should always be correct.  That probably explains how  
come the bug has escaped detection for several years.  
  
The actual fix is a one-liner, but I took the trouble to add/improve some  
comments related to the loop logic.  
  
After fixing that, the submitted test case "()*\1" didn't loop anymore.  
But it reported failure, though it seems like it ought to match a  
zero-length string; both Tcl and Perl think it does.  That seems to be from  
overenthusiastic optimization on my part when I rewrote the iteration match  
logic in commit 173e29aa5deefd9e71c183583ba37805c8102a72: we can't just  
"declare victory" for a zero-length match without bothering to set match  
data for capturing parens inside the iterator node.  
  
Per fuzz testing by Greg Stark.  The first part of this is a bug in all  
supported branches, and the second part is a bug since 9.2 where the  
iteration rewrite happened.  

M src/backend/regex/regexec.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Add some more query-cancel checks to regular expression matching.

commit   : bb704a781ada30b34b377937e8e39c2dae532cec    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:45:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:45:39 -0400    

Click here for diff

Commit 9662143f0c35d64d7042fbeaf879df8f0b54be32 added infrastructure to  
allow regular-expression operations to be terminated early in the event  
of SIGINT etc.  However, fuzz testing by Greg Stark disclosed that there  
are still cases where regex compilation could run for a long time without  
noticing a cancel request.  Specifically, the fixempties() phase never  
adds new states, only new arcs, so it doesn't hit the cancel check I'd put  
in newstate().  Add one to newarc() as well to cover that.  
  
Some experimentation of my own found that regex execution could also run  
for a long time despite a pending cancel.  We'd put a high-level cancel  
check into cdissect(), but there was none inside the core text-matching  
routines longest() and shortest().  Ordinarily those inner loops are very  
very fast ... but in the presence of lookahead constraints, not so much.  
As a compromise, stick a cancel check into the stateset cache-miss  
function, which is enough to guarantee a cancel check at least once per  
lookahead constraint test.  
  
Making this work required more attention to error handling throughout the  
regex executor.  Henry Spencer had apparently originally intended longest()  
and shortest() to be incapable of incurring errors while running, so  
neither they nor their subroutines had well-defined error reporting  
behaviors.  However, that was already broken by the lookahead constraint  
feature, since lacon() can surely suffer an out-of-memory failure ---  
which, in the code as it stood, might never be reported to the user at all,  
but just silently be treated as a non-match of the lookahead constraint.  
Normalize all that by inserting explicit error tests as needed.  I took the  
opportunity to add some more comments to the code, too.  
  
Back-patch to all supported branches, like the previous patch.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c

Docs: add disclaimer about hazards of using regexps from untrusted sources.

commit   : c56b2aa6efd1c0d090a9747a8220bf5110e9f9fd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:30:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 13:30:42 -0400    

Click here for diff

It's not terribly hard to devise regular expressions that take large  
amounts of time and/or memory to process.  Recent testing by Greg Stark has  
also shown that machines with small stack limits can be driven to stack  
overflow by suitably crafted regexps.  While we intend to fix these things  
as much as possible, it's probably impossible to eliminate slow-execution  
cases altogether.  In any case we don't want to treat such things as  
security issues.  The history of that code should already discourage  
prudent DBAs from allowing execution of regexp patterns coming from  
possibly-hostile sources, but it seems like a good idea to warn about the  
hazard explicitly.  
  
Currently, similar_escape() allows access to enough of the underlying  
regexp behavior that the warning has to apply to SIMILAR TO as well.  
We might be able to make it safer if we tightened things up to allow only  
SQL-mandated capabilities in SIMILAR TO; but that would be a subtly  
non-backwards-compatible change, so it requires discussion and probably  
could not be back-patched.  
  
Per discussion among pgsql-security list.  

M doc/src/sgml/func.sgml

Docs: add another example of creating a range type.

commit   : 1dc6f557e7020269436cbf8a66e68bc6e66def0c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 12:20:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Oct 2015 12:20:01 -0400    

Click here for diff

The "floatrange" example is a bit too simple because float8mi can be  
used without any additional type conversion.  Add an example that does  
have to account for that, and do some minor other wordsmithing.  

M doc/src/sgml/rangetypes.sgml

Don't disable commit_ts in standby if enabled locally

commit   : 65dc1fc99a257a98961bfb964a1a95b2f521cd74    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 2 Oct 2015 12:49:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 2 Oct 2015 12:49:01 -0300    

Click here for diff

Bug noticed by Fujii Masao  

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

pg_rewind: Improve some messages

commit   : 0f51a848ab98325e497a227155648facd9d0cf9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:42:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:42:00 -0400    

Click here for diff

The output of a typical pg_rewind run contained a mix of capitalized and  
not-capitalized and punctuated and not-punctuated phrases for no  
apparent reason.  Make that consistent.  Also fix some problems in other  
messages.  

M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c

Fix message punctuation according to style guide

commit   : 867bc6849f141e17cd4d3b416f48cc46839f2d76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:39:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Oct 2015 21:39:56 -0400    

Click here for diff

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

Fix pg_dump to handle inherited NOT VALID check constraints correctly.

commit   : 5ea47e8f2a7d524eb491b1ffffbc98a012745409    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 16:19:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 16:19:49 -0400    

Click here for diff

This case seems to have been overlooked when unvalidated check constraints  
were introduced, in 9.2.  The code would attempt to dump such constraints  
over again for each child table, even though adding them to the parent  
table is sufficient.  
  
In 9.2 and 9.3, also fix contrib/pg_upgrade/Makefile so that the "make  
clean" target fully cleans up after a failed test.  This evidently got  
dealt with at some point in 9.4, but it wasn't back-patched.  I ran into  
it while testing this fix ...  
  
Per bug #13656 from Ingmar Brouns.  

M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix commit_ts for standby

commit   : a742ef86c228d8a0e9d174c651cfc4f96ac77e61    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Oct 2015 15:06:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Oct 2015 15:06:55 -0300    

Click here for diff

Module initialization was still not completely correct after commit  
6b61955135e9, per crash report from Takashi Ohnishi.  To fix, instead of  
trying to monkey around with the value of the GUC setting directly, add  
a separate boolean flag that enables the feature on a standby, but only  
for the startup (recovery) process, when it sees that its master server  
has the feature enabled.  
Discussion: http://www.postgresql.org/message-id/ca44c6c7f9314868bdc521aea4f77cbf@MP-MSGSS-MBX004.msg.nttdata.co.jp  
  
Also change the deactivation routine to delete all segment files rather  
than leaving the last one around.  (This doesn't need separate  
WAL-logging, because on recovery we execute the same deactivation  
routine anyway.)  
  
In passing, clean up the code structure somewhat, particularly so that  
xlog.c doesn't know so much about when to activate/deactivate the  
feature.  
  
Thanks to Fujii Masao for testing and Petr Jelínek for off-list discussion.  
  
Back-patch to 9.5, where commit_ts was introduced.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Fix documentation error in commit 8703059c6b55c427100e00a09f66534b6ccbfaa1.

commit   : d312cc37e4e4081149d3874974d9d7618ca574af    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 10:31:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Oct 2015 10:31:22 -0400    

Click here for diff

Etsuro Fujita spotted a thinko in the README commentary.  

M src/backend/optimizer/README

Fix mention of htup.h in storage.sgml

commit   : c9a8d05465b5ed662235966554cb70d61d00707c    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 1 Oct 2015 23:00:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 1 Oct 2015 23:00:52 +0900    

Click here for diff

Previously it was documented that the details on HeapTupleHeaderData  
struct could be found in htup.h. This is not correct because it's now  
defined in htup_details.h.  
  
Back-patch to 9.3 where the definition of HeapTupleHeaderData struct  
was moved from htup.h to htup_details.h.  
  
Michael Paquier  

M doc/src/sgml/storage.sgml

Improve LISTEN startup time when there are many unread notifications.

commit   : 8c8a834b14712de5252858aebbd4c5900c105c78    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Sep 2015 23:32:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Sep 2015 23:32:23 -0400    

Click here for diff

If some existing listener is far behind, incoming new listener sessions  
would start from that session's read pointer and then need to advance over  
many already-committed notification messages, which they have no interest  
in.  This was expensive in itself and also thrashed the pg_notify SLRU  
buffers a lot more than necessary.  We can improve matters considerably  
in typical scenarios, without much added cost, by starting from the  
furthest-ahead read pointer, not the furthest-behind one.  We do have to  
consider only sessions in our own database when doing this, which requires  
an extra field in the data structure, but that's a pretty small cost.  
  
Back-patch to 9.0 where the current LISTEN/NOTIFY logic was introduced.  
  
Matt Newell, slightly adjusted by me  

M src/backend/commands/async.c

Don't dump core when destroying an unused ParallelContext.

commit   : 91d97f03ca2a9ed56b322b69dde0392db835f722    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Sep 2015 18:36:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Sep 2015 18:36:31 -0400    

Click here for diff

If a transaction or subtransaction creates a ParallelContext but ends  
without calling InitializeParallelDSM, the previous code would  
seg fault.  Fix that.  

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

Include policies based on ACLs needed

commit   : 75096c458aa8e27160112cc20a18fec3a111e4b0    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 30 Sep 2015 07:39:24 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 30 Sep 2015 07:39:24 -0400    

Click here for diff

When considering which policies should be included, rather than look at  
individual bits of the query (eg: if a RETURNING clause exists, or if a  
WHERE clause exists which is referencing the table, or if it's a  
FOR SHARE/UPDATE query), consider any case where we've determined  
the user needs SELECT rights on the relation while doing an UPDATE or  
DELETE to be a case where we apply SELECT policies, and any case where  
we've deteremind that the user needs UPDATE rights on the relation while  
doing a SELECT to be a case where we apply UPDATE policies.  
  
This simplifies the logic and addresses concerns that a user could use  
UPDATE or DELETE with a WHERE clauses to determine if rows exist, or  
they could use SELECT .. FOR UPDATE to lock rows which they are not  
actually allowed to modify through UPDATE policies.  
  
Use list_append_unique() to avoid adding the same quals multiple times,  
as, on balance, the cost of checking when adding the quals will almost  
always be cheaper than keeping them and doing busywork for each tuple  
during execution.  
  
Back-patch to 9.5 where RLS was added.  

M src/backend/rewrite/rowsecurity.c
M src/test/regress/expected/rowsecurity.out

Fix incorrect tps number calculation in "excluding connections establishing".

commit   : 3c4c5acc40720a178e06da6258ce20d3c6e025ab    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Sep 2015 10:36:23 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 30 Sep 2015 10:36:23 +0900    

Click here for diff

The tolerance (larger than actual tps number) increases as the number  
of threads decreases.  The bug has been there since the thread support  
was introduced in 9.0. Because back patching introduces incompatible  
behavior changes regarding the tps number, the fix is committed to  
master and 9.5 stable branches only.  
  
Problem spotted by me and fix proposed by Fabien COELHO. Note that his  
original patch included more than fixes (a code re-factoring) which is  
not related to the problem and I omitted the part.  

M src/bin/pgbench/pgbench.c

Code review for transaction commit timestamps

commit   : d8c7bb21ea2a3122cac96b2996d3122f25c160c3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Sep 2015 14:40:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Sep 2015 14:40:56 -0300    

Click here for diff

There are three main changes here:  
  
1. No longer cause a start failure in a standby if the feature is  
disabled in postgresql.conf but enabled in the master.  This reverts one  
part of commit 4f3924d9cd43; what we keep is the ability of the standby  
to activate/deactivate the module (which includes creating and removing  
segments as appropriate) during replay of such actions in the master.  
  
2. Replay WAL records affecting commitTS even if the feature is  
disabled.  This means the standby will always have the same state as the  
master after replay.  
  
3. Have COMMIT PREPARE record the transaction commit time as well.  We  
were previously only applying it in the normal transaction commit path.  
  
Author: Petr Jelínek  
Discussion: http://www.postgresql.org/message-id/CAHGQGwHereDzzzmfxEBYcVQu3oZv6vZcgu1TPeERWbDc+gQ06g@mail.gmail.com  
Discussion: http://www.postgresql.org/message-id/CAHGQGwFuzfO4JscM9LCAmCDCxp_MfLvN4QdB+xWsS-FijbjTYQ@mail.gmail.com  
  
Additionally, I cleaned up nearby code related to replication origins,  
which I found a bit hard to follow, and fixed a couple of typos.  
  
Backpatch to 9.5, where this code was introduced.  
  
Per bug reports from Fujii Masao and subsequent discussion.  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/include/access/commit_ts.h

Fix plperl to handle non-ASCII error message texts correctly.

commit   : a16b9b19389d1832286f4d8f259dab0d5be88856    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Sep 2015 10:52:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Sep 2015 10:52:22 -0400    

Click here for diff

We were passing error message texts to croak() verbatim, which turns out  
not to work if the text contains non-ASCII characters; Perl mangles their  
encoding, as reported in bug #13638 from Michal Leinweber.  To fix, convert  
the text into a UTF8-encoded SV first.  
  
It's hard to test this without risking failures in different database  
encodings; but we can follow the lead of plpython, which is already  
assuming that no-break space (U+00A0) has an equivalent in all encodings  
we care about running the regression tests in (cf commit 2dfa15de5).  
  
Back-patch to 9.1.  The code is quite different in 9.0, and anyway it seems  
too risky to put something like this into 9.0's final minor release.  
  
Alex Hunsaker, with suggestions from Tim Bunce and Tom Lane  

M src/pl/plperl/SPI.xs
M src/pl/plperl/Util.xs
M src/pl/plperl/expected/plperl_elog.out
M src/pl/plperl/expected/plperl_elog_1.out
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl_helpers.h
M src/pl/plperl/sql/plperl_elog.sql

Comment update for join pushdown.

commit   : 9a6fbc2ac709aa8152e6d5d44a107d2d7c67b6f4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Sep 2015 07:42:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Sep 2015 07:42:30 -0400    

Click here for diff

Etsuro Fujita  

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

Fix compiler warning for non-TIOCGWINSZ case

commit   : 60fcee9e5e77dc748a9787fae34328917683b95e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:42:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:42:30 -0400    

Click here for diff

Backpatch to 9.5 where the error was introduced.  

M src/bin/psql/print.c

Fix compiler warning about unused function in non-readline case.

commit   : c4e6d506c6b028d6ccdac4e2a23b3484fba6c39e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:29:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Sep 2015 18:29:20 -0400    

Click here for diff

Backpatch to all live branches to keep the code in sync.  

M src/bin/psql/input.c

Fix "sesssion" typo

commit   : aea76d128ad85f38aa0f4255fb9d46d95b835755    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Sep 2015 19:13:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Sep 2015 19:13:42 -0300    

Click here for diff

It was introduced alongside replication origins, by commit  
5aa2350426c, so backpatch to 9.5.  
  
Pointed out by Fujii Masao  

M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/origin.c
M src/include/replication/origin.h

Fix poor errno handling in libpq's version of our custom OpenSSL BIO.

commit   : b67c9c1939f10e94186d2736039ff623dbb2ce3f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Sep 2015 18:02:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Sep 2015 18:02:38 -0400    

Click here for diff

Thom Brown reported that SSL connections didn't seem to work on Windows in  
9.5.  Asif Naeem figured out that the cause was my_sock_read() looking at  
"errno" when it needs to look at "SOCK_ERRNO".  This mistake was introduced  
in commit 680513ab79c7e12e402a2aad7921b95a25a4bcc8, which cloned the  
backend's custom SSL BIO code into libpq, and didn't translate the errno  
handling properly.  Moreover, it introduced unnecessary errno save/restore  
logic, which was particularly confusing because it was incomplete; and it  
failed to check for all three of EINTR, EAGAIN, and EWOULDBLOCK in  
my_sock_write.  (That might not be necessary; but since we're copying  
well-tested backend code that does do that, it seems prudent to copy it  
faithfully.)  

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

Ensure a few policies remain for pg_upgrade

commit   : ce585027ebc26554d77cde9d8f2721a8cca55381    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 28 Sep 2015 15:48:36 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 28 Sep 2015 15:48:36 -0400    

Click here for diff

To make sure that pg_dump/pg_restore function properly with RLS  
policies, arrange to have a few of them left around at the end of the  
regression tests.  
  
Back-patch to 9.5 where RLS was added.  

M src/test/regress/expected/rowsecurity.out
M src/test/regress/output/misc.source
M src/test/regress/sql/rowsecurity.sql

Fix ON CONFLICT DO UPDATE for tables with oids.

commit   : 90586ef127c593002897ee0bcafdf2adb6a18c7d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Sep 2015 19:12:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Sep 2015 19:12:48 +0200    

Click here for diff

When taking the UPDATE path in an INSERT .. ON CONFLICT .. UPDATE tables  
with oids were not supported. The tuple generated by the update target  
list was projected without space for an oid - a simple oversight.  
  
Reported-By: Peter Geoghegan  
Author: Andres Freund  
Backpatch: 9.5, where ON CONFLICT was introduced  

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

Don't try to create a temp install without abs_top_builddir.

commit   : 80e2694b284cd9395b1ee8ef476f5f720ee50566    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 10:47:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Sep 2015 10:47:05 -0400    

Click here for diff

Otherwise, we effectively act as if abs_top_builddir were the root  
directory, which is quite dangerous if the user happens to have  
permissions to do things there.  This can crop up in PGXS builds,  
for example.  
  
Report by Sandro Santilli, patch by me, review by Noah Misch.  

M src/Makefile.global.in

pg_dump: Fix some messages

commit   : 27af56b59515a676e733a143e0ebaf9e0c921be6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 20:29:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 20:29:40 -0400    

Click here for diff

Make quoting style match existing style.  Improve plural support.  

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

reindexdb: Fix mistake in help output

commit   : 90d037772ec161436590699c5c6b057d1a0170d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 11:22:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Sep 2015 11:22:16 -0400    

Click here for diff

M src/bin/scripts/reindexdb.c

pg_ctl: Improve help formatting and order

commit   : 63ab1a398166daafcea2aaebbf0c48cb78b5be32    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:09:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:09:52 -0400    

Click here for diff

M src/bin/pg_ctl/pg_ctl.c

doc: Tweak "cube" index entry

commit   : 0160c1d23910a71def6166c6fd3d4586216b7305    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:00:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Sep 2015 21:00:59 -0400    

Click here for diff

With the arrival of the CUBE key word/feature, the index entries for the  
cube extension and the CUBE feature were collapsed into one.  Tweak the  
entry for the cube extension so they are separate entries.  

M doc/src/sgml/cube.sgml

Remove legacy multixact truncation support.

commit   : 6e8af37643099310e5d47a12152872e325b930f0    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    

Click here for diff

In 9.5 and master there is no need to support legacy truncation. This is  
just committed separately to make it easier to backpatch the WAL logged  
multixact truncation to 9.3 and 9.4 if we later decide to do so.  
  
I bumped master's magic from 0xD086 to 0xD088 and 9.5's from 0xD085 to  
0xD087 to avoid 9.5 reusing a value that has been in use on master while  
keeping the numbers increasing between major versions.  
  
Discussion: [email protected]  
Backpatch: 9.5  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/include/access/multixact.h
M src/include/access/xlog_internal.h

Rework the way multixact truncations work.

commit   : bd7c348d83a4576163b635010e49dbcac7126f01    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Sep 2015 19:04:25 +0200    

Click here for diff

The fact that multixact truncations are not WAL logged has caused a fair  
share of problems. Amongst others it requires to do computations during  
recovery while the database is not in a consistent state, delaying  
truncations till checkpoints, and handling members being truncated, but  
offset not.  
  
We tried to put bandaids on lots of these issues over the last years,  
but it seems time to change course. Thus this patch introduces WAL  
logging for multixact truncations.  
  
This allows:  
1) to perform the truncation directly during VACUUM, instead of delaying it  
   to the checkpoint.  
2) to avoid looking at the offsets SLRU for truncation during recovery,  
   we can just use the master's values.  
3) simplify a fair amount of logic to keep in memory limits straight,  
   this has gotten much easier  
  
During the course of fixing this a bunch of additional bugs had to be  
fixed:  
1) Data was not purged from memory the member's SLRU before deleting  
   segments. This happened to be hard or impossible to hit due to the  
   interlock between checkpoints and truncation.  
2) find_multixact_start() relied on SimpleLruDoesPhysicalPageExist - but  
   that doesn't work for offsets that haven't yet been flushed to  
   disk. Add code to flush the SLRUs to fix. Not pretty, but it feels  
   slightly safer to only make decisions based on actual on-disk state.  
3) find_multixact_start() could be called concurrently with a truncation  
   and thus fail. Via SetOffsetVacuumLimit() that could lead to a round  
   of emergency vacuuming. The problem remains in  
   pg_get_multixact_members(), but that's quite harmless.  
  
For now this is going to only get applied to 9.5+, leaving the issues in  
the older branches in place. It is quite possible that we need to  
backpatch at a later point though.  
  
For the case this gets backpatched we need to handle that an updated  
standby may be replaying WAL from a not-yet upgraded primary. We have to  
recognize that situation and use "old style" truncation (i.e. looking at  
the SLRUs) during WAL replay. In contrast to before, this now happens in  
the startup process, when replaying a checkpoint record, instead of the  
checkpointer. Doing truncation in the restartpoint is incorrect, they  
can happen much later than the original checkpoint, thereby leading to  
wraparound.  To avoid "multixact_redo: unknown op code 48" errors  
standbys would have to be upgraded before primaries.  
  
A later patch will bump the WAL page magic, and remove the legacy  
truncation codepaths. Legacy truncation support is just included to make  
a possible future backpatch easier.  
  
Discussion: [email protected]  
Reviewed-By: Robert Haas, Alvaro Herrera, Thomas Munro  
Backpatch: 9.5 for now  

M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/include/access/multixact.h
M src/include/access/slru.h
M src/include/storage/lwlock.h
M src/tools/pgindent/typedefs.list

Second try at fixing O(N^2) problem in foreign key references.

commit   : c9645f75785c607a31ba4acebf87d0ad38446aeb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 13:16:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 13:16:30 -0400    

Click here for diff

This replaces ill-fated commit 5ddc72887a012f6a8b85707ef27d85c274faf53d,  
which was reverted because it broke active uses of FK cache entries.  In  
this patch, we still do nothing more to invalidatable cache entries than  
mark them as needing revalidation, so we won't break active uses.  To keep  
down the overhead of InvalidateConstraintCacheCallBack(), keep a list of  
just the currently-valid cache entries.  (The entries are large enough that  
some added space for list links doesn't seem like a big problem.)  This  
would still be O(N^2) when there are many valid entries, though, so when  
the list gets too long, just force the "sinval reset" behavior to remove  
everything from the list.  I set the threshold at 1000 entries, somewhat  
arbitrarily.  Possibly that could be fine-tuned later.  Another item for  
future study is whether it's worth adding reference counting so that we  
could safely remove invalidated entries.  As-is, problem cases are likely  
to end up with large and mostly invalid FK caches.  
  
Like the previous attempt, backpatch to 9.3.  
  
Jan Wieck and Tom Lane  

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

Further fix for psql's code for locale-aware formatting of numeric output.

commit   : 5eb7024379ec0701ce2fae242ae90d7d56ee72bb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 12:20:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 12:20:45 -0400    

Click here for diff

(Third time's the charm, I hope.)  
  
Additional testing disclosed that this code could mangle already-localized  
output from the "money" datatype.  We can't very easily skip applying it  
to "money" values, because the logic is tied to column right-justification  
and people expect "money" output to be right-justified.  Short of  
decoupling that, we can fix it in what should be a safe enough way by  
testing to make sure the string doesn't contain any characters that would  
not be expected in plain numeric output.  

M src/bin/psql/print.c

Further fix for psql's code for locale-aware formatting of numeric output.

commit   : da4af91cefaabe493577f1d6d17ee78f2e66389c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 00:00:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Sep 2015 00:00:33 -0400    

Click here for diff

On closer inspection, those seemingly redundant atoi() calls were not so  
much inefficient as just plain wrong: the author of this code either had  
not read, or had not understood, the POSIX specification for localeconv().  
The grouping field is *not* a textual digit string but separate integers  
encoded as chars.  
  
We'll follow the existing code as well as the backend's cash.c in only  
honoring the first group width, but let's at least honor it correctly.  
  
This doesn't actually result in any behavioral change in any of the  
locales I have installed on my Linux box, which may explain why nobody's  
complained; grouping width 3 is close enough to universal that it's barely  
worth considering other cases.  Still, wrong is wrong, so back-patch.  

M src/bin/psql/print.c

Fix psql's code for locale-aware formatting of numeric output.

commit   : f1ee153dcf1a3bd64889f56bee6a863f54e97d99    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 23:01:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 23:01:04 -0400    

Click here for diff

This code did the wrong thing entirely for numbers with an exponent  
but no decimal point (e.g., '1e6'), as reported by Jeff Janes in  
bug #13636.  More generally, it made lots of unverified assumptions  
about what the input string could possibly look like.  Rearrange so  
that it only fools with leading digits that it's directly verified  
are there, and an immediately adjacent decimal point.  While at it,  
get rid of some useless inefficiencies, like converting the grouping  
count string to integer over and over (and over).  
  
This has been broken for a long time, so back-patch to all supported  
branches.  

M src/bin/psql/print.c

Allow planner to use expression-index stats for function calls in WHERE.

commit   : 45d256c2792e20c52235470e62a70c9c80a96274    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 18:35:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 18:35:46 -0400    

Click here for diff

Previously, a function call appearing at the top level of WHERE had a  
hard-wired selectivity estimate of 0.3333333, a kludge conveniently dated  
in the source code itself to July 1992.  The expectation at the time was  
that somebody would soon implement estimator support functions analogous  
to those for operators; but no such code has appeared, nor does it seem  
likely to in the near future.  We do have an alternative solution though,  
at least for immutable functions on single relations: creating an  
expression index on the function call will allow ANALYZE to gather stats  
about the function's selectivity.  But the code in clause_selectivity()  
failed to make use of such data even if it exists.  
  
Refactor so that that will happen.  I chose to make it try this technique  
for any clause type for which clause_selectivity() doesn't have a special  
case, not just functions.  To avoid adding unnecessary overhead in the  
common case where we don't learn anything new, make selfuncs.c provide an  
API that hooks directly to examine_variable() and then var_eq_const(),  
rather than the previous coding which laboriously constructed an OpExpr  
only so that it could be expensively deconstructed again.  
  
I preserved the behavior that the default estimate for a function call  
is 0.3333333.  (For any other expression node type, it's 0.5, as before.)  
I had originally thought to make the default be 0.5 across the board, but  
changing a default estimate that's survived for twenty-three years seems  
like something not to do without a lot more testing than I care to put  
into it right now.  
  
Per a complaint from Jehan-Guillaume de Rorthais.  Back-patch into 9.5,  
but not further, at least for the moment.  

M src/backend/optimizer/path/clausesel.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Improve handling of collations in contrib/postgres_fdw.

commit   : 59d765b6554093701329be935b52d82d9af01401    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 12:47:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Sep 2015 12:47:30 -0400    

Click here for diff

If we have a local Var of say varchar type with default collation, and  
we apply a RelabelType to convert that to text with default collation, we  
don't want to consider that as creating an FDW_COLLATE_UNSAFE situation.  
It should be okay to compare that to a remote Var, so long as the remote  
Var determines the comparison collation.  (When we actually ship such an  
expression to the remote side, the local Var would become a Param with  
default collation, meaning the remote Var would in fact control the  
comparison collation, because non-default implicit collation overrides  
default implicit collation in parse_collate.c.)  To fix, be more precise  
about what FDW_COLLATE_NONE means: it applies either to a noncollatable  
data type or to a collatable type with default collation, if that collation  
can't be traced to a remote Var.  (When it can, FDW_COLLATE_SAFE is  
appropriate.)  We were essentially using that interpretation already at  
the Var/Const/Param level, but we weren't bubbling it up properly.  
  
An alternative fix would be to introduce a separate FDW_COLLATE_DEFAULT  
value to describe the second situation, but that would add more code  
without changing the actual behavior, so it didn't seem worthwhile.  
  
Also, since we're clarifying the rule to be that we care about whether  
operator/function input collations match, there seems no need to fail  
immediately upon seeing a Const/Param/non-foreign-Var with nondefault  
collation.  We only have to reject if it appears in a collation-sensitive  
context (for example, "var IS NOT NULL" is perfectly safe from a collation  
standpoint, whatever collation the var has).  So just set the state to  
UNSAFE rather than failing immediately.  
  
Per report from Jeevan Chalke.  This essentially corrects some sloppy  
thinking in commit ed3ddf918b59545583a4b374566bc1148e75f593, so back-patch  
to 9.3 where that logic appeared.  

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

Make pg_controldata report newest XID with valid commit timestamp

commit   : eac3b3365e6220ce03bc05914c8e7f5430341373    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 24 Sep 2015 23:31:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 24 Sep 2015 23:31:17 +0900    

Click here for diff

Previously pg_controldata didn't report newestCommitTs and this was  
an oversight in commit 73c986a.  
  
Also this patch changes pg_resetxlog so that it uses the same sentences  
as pg_controldata does, regarding oldestCommitTs and newestCommitTs,  
for the sake of consistency.  
  
Back-patch to 9.5 where track_commit_timestamp was added.  
  
Euler Taveira  

M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c

Lower *_freeze_max_age minimum values.

commit   : ef4fccd2b6a60bdf89a4300741028218e36461aa    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Sep 2015 14:53:33 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Sep 2015 14:53:33 +0200    

Click here for diff

The old minimum values are rather large, making it time consuming to  
test related behaviour. Additionally the current limits, especially for  
multixacts, can be problematic in space-constrained systems. 10000000  
multixacts can contain a lot of members.  
  
Since there's no good reason for the current limits, lower them a good  
bit. Setting them to 0 would be a bad idea, triggering endless vacuums,  
so still retain a limit.  
  
While at it fix autovacuum_multixact_freeze_max_age to refer to  
multixact.c instead of varsup.c.  
  
Reviewed-By: Robert Haas  
Discussion: CA+TgmoYmQPHcrc3GSs7vwvrbTkbcGD9Gik=OztbDGGrovkkEzQ@mail.gmail.com  
Backpatch: back to 9.0 (in parts)  

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

Make ANALYZE compute basic statistics even for types with no "=" operator.

commit   : cfb2024ae40e3bbf7a7390bbb053504b757705c2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Sep 2015 18:26:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Sep 2015 18:26:49 -0400    

Click here for diff

Previously, ANALYZE simply ignored columns of datatypes that have neither  
a btree nor hash opclass (which means they have no recognized equality  
operator).  Without a notion of equality, we can't identify most-common  
values nor estimate the number of distinct values.  But we can still  
count nulls and compute the average physical column width, and those  
stats might be of value.  Moreover there are some tools out there that  
don't work so well if rows are missing from pg_statistic.  So let's  
add suitable logic for this case.  
  
While this is arguably a bug fix, it also has the potential to change  
query plans, and the gain seems not worth taking a risk of that in  
stable branches.  So back-patch into 9.5 but not further.  
  
Oleksandr Shulgin, rewritten a bit by me.  

M src/backend/commands/analyze.c

Docs: fix typo in to_char() example.

commit   : fe6d2ab473fdbe4b9408d8da3e97a5091171c743    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Sep 2015 10:40:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Sep 2015 10:40:25 -0400    

Click here for diff

Per bug #13631 from KOIZUMI Satoru.  

M doc/src/sgml/func.sgml

test_decoding: Protect against rare spurious test failures.

commit   : 55728ea501de5a153e4dc55c21fb4b6f4d0f44c4    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 15:33:30 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 15:33:30 +0200    

Click here for diff

A bunch of tests missed specifying that empty transactions shouldn't be  
displayed. That causes problems when e.g. autovacuum runs in an  
unfortunate moment. The tests in question only run for a very short  
time, making this quite unlikely.  
  
Reported-By: Buildfarm member axolotl  
Backpatch: 9.4, where logical decoding was introduced  

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

Correct value of LW_SHARED_MASK.

commit   : 62e503b0c29bbb9e0ac7ebce6990bf3c7c3c9a89    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 11:05:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Sep 2015 11:05:48 +0200    

Click here for diff

The previous wrong value lead to wrong LOCK_DEBUG output, never showing  
any shared lock holders.  
  
Reported-By: Alexander Korotkov  
Discussion: CAPpHfdsPmWqz9FB0AnxJrwp1=KLF0n=-iB+QvR0Q8GSmpFVdUQ@mail.gmail.com  
Backpatch: 9.5, where the bug was introduced.  

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

doc: Tweak synopsis indentation for consistency

commit   : 265728e1b60858f9db8a3e7fb538477a28fc74a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 23:31:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 23:31:43 -0400    

Click here for diff

M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/import_foreign_schema.sgml

Fix whitespace

commit   : a8bb248141c14911b5748bad6130e7de0cbba92e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 13:39:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2015 13:39:34 -0400    

Click here for diff

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

Fix possible internal overflow in numeric multiplication.

commit   : 3dfffac701cf95e3d9b86f12a3875f9b1b531231    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2015 12:11:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2015 12:11:32 -0400    

Click here for diff

mul_var() postpones propagating carries until it risks overflow in its  
internal digit array.  However, the logic failed to account for the  
possibility of overflow in the carry propagation step, allowing wrong  
results to be generated in corner cases.  We must slightly reduce the  
when-to-propagate-carries threshold to avoid that.  
  
Discovered and fixed by Dean Rasheed, with small adjustments by me.  
  
This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b,  
so back-patch to all supported branches.  

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

Remove the SECURITY_ROW_LEVEL_DISABLED security context bit.

commit   : bbdb9dfbc3c722b4c811c5cbfa03ce79b7b74824    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:47:17 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:47:17 -0400    

Click here for diff

This commit's parent made superfluous the bit's sole usage.  Referential  
integrity checks have long run as the subject table's owner, and that  
now implies RLS bypass.  Safe use of the bit was tricky, requiring  
strict control over the SQL expressions evaluating therein.  Back-patch  
to 9.5, where the bit was introduced.  
  
Based on a patch by Stephen Frost.  

M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/rls.c
M src/include/miscadmin.h
M src/include/utils/plancache.h

Remove the row_security=force GUC value.

commit   : 6dae6edcd88cf3be06acf247c10de925bc065274    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:45:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:45:41 -0400    

Click here for diff

Every query of a single ENABLE ROW SECURITY table has two meanings, with  
the row_security GUC selecting between them.  With row_security=force  
available, every function author would have been advised to either set  
the GUC locally or test both meanings.  Non-compliance would have  
threatened reliability and, for SECURITY DEFINER functions, security.  
Authors already face an obligation to account for search_path, and we  
should not mimic that example.  With this change, only BYPASSRLS roles  
need exercise the aforementioned care.  Back-patch to 9.5, where the  
row_security GUC was introduced.  
  
Since this narrows the domain of pg_db_role_setting.setconfig and  
pg_proc.proconfig, one might bump catversion.  A row_security=force  
setting in one of those columns will elicit a clear message, so don't.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/rls.c
M src/include/utils/plancache.h
M src/include/utils/rls.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Restrict file mode creation mask during tmpfile().

commit   : 1be9d65e17abc6215a6faae9bc3f714dd3d040b6    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:42:27 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 20 Sep 2015 20:42:27 -0400    

Click here for diff

Per Coverity.  Back-patch to 9.0 (all supported versions).  
  
Michael Paquier, reviewed (in earlier versions) by Heikki Linnakangas.  

M src/bin/pg_dump/pg_backup_tar.c

Be more wary about partially-valid LOCALLOCK data in RemoveLocalLock().

commit   : 3d3bc2905f2ed6a4858501031c086383be7bcf6a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Sep 2015 16:48:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Sep 2015 16:48:44 -0400    

Click here for diff

RemoveLocalLock() must consider the possibility that LockAcquireExtended()  
failed to palloc the initial space for a locallock's lockOwners array.  
I had evidently meant to cope with this hazard when the code was originally  
written (commit 1785acebf2ed14fd66955e2d9a55d77a025f418d), but missed that  
the pfree needed to be protected with an if-test.  Just to make sure things  
are left in a clean state, reset numLockOwners as well.  
  
Per low-memory testing by Andreas Seltenreich.  Back-patch to all supported  
branches.  

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

Let compiler handle size calculation of bool types.

commit   : b46f5ebd9c8f6ec37e27c56749266fc2e362902b    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 17 Sep 2015 15:41:04 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 17 Sep 2015 15:41:04 +0200    

Click here for diff

Back in the day this did not work, but modern compilers should handle it themselves.  

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

Simplify GETTEXT_FILES list

commit   : 866a034c3f9f2b6c3ef23df0f1d9e2e4b7533a3a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:41 -0400    

Click here for diff

M src/bin/pg_rewind/nls.mk

Add missing serial comma

commit   : bd313ba8a91a19659bf92014df96f7e58bfdd2fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:10 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Sep 2015 22:40:10 -0400    

Click here for diff

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

Cache argument type information in json(b) aggregate functions.

commit   : 1e1ae6e0b0c11e6044c0dacd61cb17c8d8bc87f1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 Sep 2015 14:39:39 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 Sep 2015 14:39:39 -0400    

Click here for diff

These functions have been looking up type info for every row they  
process. Instead of doing that we only look them up the first time  
through and stash the information in the aggregate state object.  
  
Affects json_agg, json_object_agg, jsonb_agg and jsonb_object_agg.  
  
There is plenty more work to do in making these more efficient,  
especially the jsonb functions, but this is a virtually cost free  
improvement that can be done right away.  
  
Backpatch to 9.5 where the jsonb variants were introduced.  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c

Fix low-probability memory leak in regex execution.

commit   : a39331fa573fc2bd6f93322ff190da26ddc477b5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Sep 2015 13:55:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Sep 2015 13:55:17 -0400    

Click here for diff

After an internal failure in shortest() or longest() while pinning down the  
exact location of a match, find() forgot to free the DFA structure before  
returning.  This is pretty unlikely to occur, since we just successfully  
ran the "search" variant of the DFA; but it could happen, and it would  
result in a session-lifespan memory leak since this code uses malloc()  
directly.  Problem seems to have been aboriginal in Spencer's library,  
so back-patch all the way.  
  
In passing, correct a thinko in a comment I added awhile back about the  
meaning of the "ntree" field.  
  
I happened across these issues while comparing our code to Tcl's version  
of the library.  

M src/backend/regex/regcomp.c
M src/backend/regex/regexec.c
M src/include/regex/regguts.h

Order some new options on man pages more sensibly, minor improvements

commit   : e8e2999470bd8148e8caf2c86a24b7a6fd4085f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Sep 2015 20:56:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Sep 2015 20:56:58 -0400    

Click here for diff

M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_receivexlog.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/vacuumdb.sgml

Honour TEMP_CONFIG when testing pg_upgrade

commit   : 104184d9562365432479691b917ebab45e55e214    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 17 Sep 2015 11:57:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 17 Sep 2015 11:57:00 -0400    

Click here for diff

This setting contains extra configuration for the temp instance, as used  
in pg_regress' --temp-config flag.  
  
Backpatch to 9.2 where test.sh was introduced.  

M src/bin/pg_upgrade/test.sh

Fix documentation of regular expression character-entry escapes.

commit   : d97bdb082690980a78ca6e2bbe0c6d863caef32f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 14:50:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 14:50:12 -0400    

Click here for diff

The docs claimed that \uhhhh would be interpreted as a Unicode value  
regardless of the database encoding, but it's never been implemented  
that way: \uhhhh and \xhhhh actually mean exactly the same thing, namely  
the character that pg_mb2wchar translates to 0xhhhh.  Moreover we were  
falsely dismissive of the usefulness of Unicode code points above FFFF.  
Fix that.  
  
It's been like this for ages, so back-patch to all supported branches.  

M doc/src/sgml/func.sgml

Don't use "#" as an abbreviation for "number" in PL/Tcl error messages.

commit   : 3047a9b9ef0db126c7f40acde51f78a1bbaa6dd6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 12:08:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 12:08:57 -0400    

Click here for diff

Also, rewrite one error message to make it follow our message style  
guidelines better.  
  
Euler Taveira and Tom Lane  

M src/pl/tcl/pltcl.c

Remove no-longer-used T_PrivGrantee node tag.

commit   : 5b7aef85139f9f103b5a369261c538769da64c90    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 10:48:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2015 10:48:11 -0400    

Click here for diff

Oversight in commit 31eae6028eca4365e7165f5f33fee1ed0486aee0, which  
replaced PrivGrantee nodes with RoleSpec nodes.  Spotted by Yugo Nagata.  

M src/include/nodes/nodes.h

Review program help output for wording and formatting

commit   : ea00ff5f1058d2ede0b3ddda47b8713f11a6832a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Sep 2015 00:37:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Sep 2015 00:37:39 -0400    

Click here for diff

M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/help.c
M src/bin/scripts/vacuumdb.c

Enforce ALL/SELECT policies in RETURNING for RLS

commit   : 68b5201128c2d0c8a3a0051ff7c2534b037e1eab    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:40 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:40 -0400    

Click here for diff

For the UPDATE/DELETE RETURNING case, filter the records which are not  
visible to the user through ALL or SELECT policies from those considered  
for the UPDATE or DELETE.  This is similar to how the GRANT system  
works, which prevents RETURNING unless the caller has SELECT rights on  
the relation.  
  
Per discussion with Robert, Dean, Tom, and Kevin.  
  
Back-patch to 9.5 where RLS was introduced.  

M src/backend/rewrite/rowsecurity.c
M src/test/regress/expected/rowsecurity.out

RLS refactoring

commit   : 23a4b897f731e1a2be7fe989a34016d7a6287148    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:40 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 15:49:40 -0400    

Click here for diff

This refactors rewrite/rowsecurity.c to simplify the handling of the  
default deny case (reducing the number of places where we check for and  
add the default deny policy from three to one) by splitting up the  
retrival of the policies from the application of them.  
  
This also allowed us to do away with the policy_id field.  A policy_name  
field was added for WithCheckOption policies and is used in error  
reporting, when available.  
  
Patch by Dean Rasheed, with various mostly cosmetic changes by me.  
  
Back-patch to 9.5 where RLS was introduced to avoid unnecessary  
differences, since we're still in alpha, per discussion with Robert.  

M src/backend/commands/policy.c
M src/backend/executor/execMain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/parsenodes.h
M src/include/rewrite/rowsecurity.h
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Revert "Fix an O(N^2) problem in foreign key references".

commit   : ed301d6dbe32eaad4f226903d430336e5a0d72aa    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2015 11:08:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2015 11:08:56 -0400    

Click here for diff

Commit 5ddc72887a012f6a8b85707ef27d85c274faf53d does not actually work  
because it will happily blow away ri_constraint_cache entries that are  
in active use in outer call levels.  In any case, it's a very ugly,  
brute-force solution to the problem of limiting the cache size.  
Revert until it can be redesigned.  

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

Add POLICY to COMMENT documentation

commit   : 225f539bd00ad58bac41d8d30bd0bd112f8c6a29    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 10:56:29 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 15 Sep 2015 10:56:29 -0400    

Click here for diff

COMMENT supports POLICY but the documentation hadn't caught up with  
that fact.  
  
Patch by Charles Clavadetscher  
  
Back-patch to 9.5 where POLICY was added.  

M doc/src/sgml/ref/comment.sgml

commit   : fb98859ea0cac3f85041ca052bfdd0b1c8814932    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 15 Sep 2015 23:21:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 15 Sep 2015 23:21:51 +0900    

Click here for diff

This patch changes the log message which is logged when the server  
successfully renames backup_label file to *.old but fails to rename  
tablespace_map file during the shutdown. Previously the WARNING  
message "online backup mode was not canceled" was logged in that case.  
However this message is confusing because the backup mode is treated  
as canceled whenever backup_label is successfully renamed. So this  
commit makes the server log the message "online backup mode canceled"  
in that case.  
  
Also this commit changes errdetail messages so that they follow the  
error message style guide.  
  
Back-patch to 9.5 where tablespace_map file is introduced.  
  
Original patch by Amit Kapila, heavily modified by me.  

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

Fix the fastpath rule for jsonb_concat with an empty operand.

commit   : f243072a9ca3d135745441ab016996a00d183bd2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 13 Sep 2015 17:06:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 13 Sep 2015 17:06:45 -0400    

Click here for diff

To prevent perverse results, we now only return the other operand if  
it's not scalar, and if both operands are of the same kind (array or  
object).  
  
Original bug complaint and patch from Oskari Saarenmaa, extended by me  
to cover the cases of different kinds of jsonb.  
  
Backpatch to 9.5 where jsonb_concat was introduced.  

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

doc: Remove dead links

commit   : 63c0f5b20b7012633bbd85cea039e9d44c054953    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 23:49:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 23:49:11 -0400    

Click here for diff

The web pages of Andy Dong at Berkeley don't exist anymore, and he is no  
longer there.  

M doc/src/sgml/cube.sgml

Fix typo in create_policy.sgml

commit   : dc3573b5d310eb42f478892870a0889a50693530    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 12 Sep 2015 17:17:03 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 12 Sep 2015 17:17:03 -0400    

Click here for diff

WTIH -> WITH  
  
Pointed out by Dmitriy Olshevskiy  
  
Backpatch to 9.5 where create_policy.sgml was added.  

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

Update SQL features list

commit   : d96c80c1d6f513f0588a19af8a00f4df9eba7837    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 00:07:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Sep 2015 00:07:56 -0400    

Click here for diff

M src/backend/catalog/sql_features.txt

pg_dump, pg_upgrade: allow postgres/template1 tablespace moves

commit   : 3243fce882d4a4dc294e331289e873f9246d7c68    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 11 Sep 2015 15:51:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 11 Sep 2015 15:51:11 -0400    

Click here for diff

Modify pg_dump to restore postgres/template1 databases to non-default  
tablespaces by switching out of the database to be moved, then switching  
back.  
  
Also, to fix potentially cases where the old/new tablespaces might not  
match, fix pg_upgrade to process new/old tablespaces separately in all  
cases.  
  
Report by Marti Raudsepp  
  
Patch by Marti Raudsepp, me  
  
Backpatch through 9.0  

M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/info.c

Add missing ReleaseBuffer call in BRIN revmap code

commit   : 25b3ddd1de54563b631484f6d56bd56bef906102    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2015 15:29:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2015 15:29:46 -0300    

Click here for diff

I think this particular branch is actually dead, but the analysis to  
prove that is not trivial, so instead take the weasel way.  
  
Reported by Jinyu Zhang  
Backpatch to 9.5, where BRIN was introduced.  

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

Fix an O(N^2) problem in foreign key references.

commit   : 974f910b64511ace9d00a9458577fe439b63ec01    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 11 Sep 2015 13:20:17 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 11 Sep 2015 13:20:17 -0500    

Click here for diff

Commit 45ba424f improved foreign key lookups during bulk updates  
when the FK value does not change.  When restoring a schema dump  
from a database with many (say 100,000) foreign keys, this cache  
would grow very big and every ALTER TABLE command was causing an  
InvalidateConstraintCacheCallBack(), which uses a sequential hash  
table scan.  This could cause a severe performance regression in  
restoring a schema dump (including during pg_upgrade).  
  
The patch uses a heuristic method of detecting when the hash table  
should be destroyed and recreated.  
InvalidateConstraintCacheCallBack() adds the current size of the  
hash table to a counter.  When that sum reaches 1,000,000, the hash  
table is flushed.  This fixes the regression without noticeable  
harm to the bulk update use case.  
  
Jan Wieck  
Backpatch to 9.3 where the performance regression was introduced.  

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

Correct description of PageHeaderData layout in documentation

commit   : 5b0317b5af58eb6ba42614104644589a0be7c569    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 11 Sep 2015 13:02:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 11 Sep 2015 13:02:15 +0900    

Click here for diff

Back-patch to 9.3 where PageHeaderData layout was changed.  
  
Michael Paquier  

M doc/src/sgml/storage.sgml

doc: Spell checking

commit   : 683bfbdb99b4168652a7b536b0ccc7217de8ba36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Sep 2015 21:22:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Sep 2015 21:22:21 -0400    

Click here for diff

M doc/src/sgml/backup.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/replication-origins.sgml

Fix setrefs.c comment properly.

commit   : edebc04dbd564fd738df1f1ca4f2c05c5cad123d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2015 10:23:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2015 10:23:56 -0400    

Click here for diff

The "typo" alleged in commit 1e460d4bd was actually a comment that was  
correct when written, but I missed updating it in commit b5282aa89.  
Use a slightly less specific (and hopefully more future-proof) description  
of what is collected.  Back-patch to 9.2 where that commit appeared, and  
revert the comment to its then-entirely-correct state before that.  

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

Fix typo in setrefs.c

commit   : 9adaccab2a9e44cf53d2d5c2d3b780ac10e10a5f    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 10 Sep 2015 09:22:11 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 10 Sep 2015 09:22:11 -0400    

Click here for diff

We're adding OIDs, not TIDs, to invalItems.  
  
Pointed out by Etsuro Fujita.  
  
Back-patch to all supported branches.  

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

Fix minor bug in regexp makesearch() function.

commit   : d76113dda77417d176e299b167e95db0266986d5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2015 20:14:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2015 20:14:58 -0400    

Click here for diff

The list-wrangling here was done wrong, allowing the same state to get  
put into the list twice.  The following loop then would clone it twice.  
The second clone would wind up with no inarcs, so that there was no  
observable misbehavior AFAICT, but a useless state in the finished NFA  
isn't an especially good thing.  

M src/backend/regex/regcomp.c

Remove files signaling a standby promotion request at postmaster startup

commit   : 65f37b3e9b0aea59cc98a2e23f45bb8fb6a56395    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 22:51:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 22:51:44 +0900    

Click here for diff

This commit makes postmaster forcibly remove the files signaling  
a standby promotion request. Otherwise, the existence of those files  
can trigger a promotion too early, whether a user wants that or not.  
  
This removal of files is usually unnecessary because they can exist  
only during a few moments during a standby promotion. However  
there is a race condition: if pg_ctl promote is executed and creates  
the files during a promotion, the files can stay around even after  
the server is brought up to new master. Then, if new standby starts  
by using the backup taken from that master, the files can exist  
at the server startup and should be removed in order to avoid  
an unexpected promotion.  
  
Back-patch to 9.1 where promote signal file was introduced.  
  
Problem reported by Feike Steenbergen.  
Original patch by Michael Paquier, modified by me.  
  
Discussion: [email protected]  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/include/access/xlog.h

Lock all relations referred to in updatable views

commit   : 9801bae217e9d3f72e2d1f3dd780bf0bf9365dae    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 8 Sep 2015 17:02:53 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 8 Sep 2015 17:02:53 -0400    

Click here for diff

Even views considered "simple" enough to be automatically updatable may  
have mulitple relations involved (eg: in a where clause).  We need to  
make sure and lock those relations when rewriting the query.  
  
Back-patch to 9.3 where updatable views were added.  
  
Pointed out by Andres, patch thanks to Dean Rasheed.  

M src/backend/rewrite/rewriteHandler.c

Add gin_fuzzy_search_limit to postgresql.conf.sample.

commit   : 97b7b9560f3dbe1c48dfb4630f50444eb7e8adc8    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 02:25:50 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 9 Sep 2015 02:25:50 +0900    

Click here for diff

This was forgotten in 8a3631f (commit that originally added the parameter)  
and 0ca9907 (commit that added the documentation later that year).  
  
Back-patch to all supported versions.  

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

Fix error message wording in previous sslinfo commit

commit   : bbbe5a9d8a35f0f7a983488d35dd86006229ea0c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2015 11:10:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2015 11:10:20 -0300    

Click here for diff

M contrib/sslinfo/sslinfo.c

In the pg_rewind test suite, receive WAL fully before promoting.

commit   : 58feb1a94a5ea0ae3395b1818ba76ab68485a7a4    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 7 Sep 2015 19:01:00 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 7 Sep 2015 19:01:00 -0400    

Click here for diff

If a transaction never reaches the standby, later tests find unexpected  
cluster state.  A "tail-copy: query result matches" test failure has  
been the usual symptom.  Among the buildfarm members having run this  
test suite, most have exhibited that symptom at least once.  Back-patch  
to 9.5, where pg_rewind was introduced.  
  
Michael Paquier, reported by Christoph Berg.  

M src/bin/pg_rewind/RewindTest.pm

Add more sanity checks in contrib/sslinfo

commit   : 73d2d2e6a1721f94e4d01d7502bf99452008170e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 7 Sep 2015 19:18:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 7 Sep 2015 19:18:29 -0300    

Click here for diff

We were missing a few return checks on OpenSSL calls.  Should be pretty  
harmless, since we haven't seen any user reports about problems, and  
this is not a high-traffic module anyway; still, a bug is a bug, so  
backpatch this all the way back to 9.0.  
  
Author: Michael Paquier, while reviewing another sslinfo patch  

M contrib/sslinfo/sslinfo.c

Change type of DOW/DOY to UNITS

commit   : a1242402854178eded9bd4f2b8cd8ef46d1e9864    
  
author   : Greg Stark <[email protected]>    
date     : Mon, 7 Sep 2015 13:35:09 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Mon, 7 Sep 2015 13:35:09 +0100    

Click here for diff

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

Make GIN's cleanup pending list process interruptable

commit   : d592a8745fd0320fd5e691b59bf5a95d9834a286    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 17:17:15 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 17:17:15 +0300    

Click here for diff

Cleanup process could be called by ordinary insert/update and could take a lot  
of time. Add vacuum_delay_point() to make this process interruptable. Under  
vacuum this call will also throttle a vacuum process to decrease system load,  
called from insert/update it will not throttle, and that reduces a latency.  
  
Backpatch for all supported branches.  
  
Jeff Janes <[email protected]>  

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

Update site address of Snowball project

commit   : 552723a3bf6d3caefafaa0afe9afcde31ccdb481    
  
author   : Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 15:21:34 +0300    
  
committer: Teodor Sigaev <[email protected]>    
date     : Mon, 7 Sep 2015 15:21:34 +0300    

Click here for diff

M doc/src/sgml/textsearch.sgml

Move DTK_ISODOW DTK_DOW and DTK_DOY to be type UNITS rather than RESERV. RESERV is meant for tokens like "now" and having them in that category throws errors like these when used as an input date:

commit   : c11100d0fa46b5a0c3c796b8d538060ce7d14ac9    
  
author   : Greg Stark <[email protected]>    
date     : Sun, 6 Sep 2015 02:04:37 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Sun, 6 Sep 2015 02:04:37 +0100    

Click here for diff

stark=# SELECT 'doy'::timestamptz;  
ERROR:  unexpected dtype 33 while parsing timestamptz "doy"  
LINE 1: SELECT 'doy'::timestamptz;  
               ^  
stark=# SELECT 'dow'::timestamptz;  
ERROR:  unexpected dtype 32 while parsing timestamptz "dow"  
LINE 1: SELECT 'dow'::timestamptz;  
               ^  
  
Found by LLVM's Libfuzzer  

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

Fix CreateTableSpace() so it will compile without HAVE_SYMLINK.

commit   : 5692b4acb26fea7c834c9ad0712cce2ec251d512    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Sep 2015 16:15:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Sep 2015 16:15:38 -0400    

Click here for diff

This has been broken since 9.3 (commit 82b1b213cad3a69c to be exact),  
which suggests that nobody is any longer using a Windows build system that  
doesn't provide a symlink emulation.  Still, it's wrong on its own terms,  
so repair.  
  
YUriy Zhuravlev  

M src/backend/commands/tablespace.c

Fix misc typos.

commit   : 25600c42e078e0d10eedf2794a0c7d02178232e0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 5 Sep 2015 11:35:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 5 Sep 2015 11:35:49 +0300    

Click here for diff

Oskari Saarenmaa. Backpatch to stable branches where applicable.  

M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/sources.sgml
M src/backend/access/brin/brin_revmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gist/gistproc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xact.c
M src/backend/optimizer/path/costsize.c
M src/backend/replication/logical/origin.c
M src/backend/utils/adt/regproc.c
M src/include/storage/lwlock.h

Fix brin index summarizing while vacuuming.

commit   : b1cbc8529d076b71c9c2f8403139f7235072a357    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sat, 5 Sep 2015 09:19:25 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sat, 5 Sep 2015 09:19:25 +0900    

Click here for diff

If the number of heap blocks is not multiples of pages per range, the  
summarizing produces wrong summary information for the last brin index  
tuple while vacuuming.  
  
Problem reported by Tatsuo Ishii and fixed by Amit Langote.  
  
Discussion at "[HACKERS] BRIN INDEX value (message id :[email protected])  
Backpatched to 9.5 in which brin index was added.  

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

Fix subtransaction cleanup after an outer-subtransaction portal fails.

commit   : a2538da89f664671d1790cb8dbb4b94849ed923c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2015 13:36:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2015 13:36:49 -0400    

Click here for diff

Formerly, we treated only portals created in the current subtransaction as  
having failed during subtransaction abort.  However, if the error occurred  
while running a portal created in an outer subtransaction (ie, a cursor  
declared before the last savepoint), that has to be considered broken too.  
  
To allow reliable detection of which ones those are, add a bookkeeping  
field to struct Portal that tracks the innermost subtransaction in which  
each portal has actually been executed.  (Without this, we'd end up  
failing portals containing functions that had called the subtransaction,  
thereby breaking plpgsql exception blocks completely.)  
  
In addition, when we fail an outer-subtransaction Portal, transfer its  
resources into the subtransaction's resource owner, so that they're  
released early in cleanup of the subxact.  This fixes a problem reported by  
Jim Nasby in which a function executed in an outer-subtransaction cursor  
could cause an Assert failure or crash by referencing a relation created  
within the inner subtransaction.  
  
The proximate cause of the Assert failure is that AtEOSubXact_RelationCache  
assumed it could blow away a relcache entry without first checking that the  
entry had zero refcount.  That was a bad idea on its own terms, so add such  
a check there, and to the similar coding in AtEOXact_RelationCache.  This  
provides an independent safety measure in case there are still ways to  
provoke the situation despite the Portal-level changes.  
  
This has been broken since subtransactions were invented, so back-patch  
to all supported branches.  
  
Tom Lane and Michael Paquier  

M src/backend/access/transam/xact.c
M src/backend/commands/portalcmds.c
M src/backend/tcop/pquery.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/mmgr/portalmem.c
M src/include/utils/portal.h
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

Document that max_worker_processes must be high enough in standby.

commit   : cb9cc382b41de4fab2d718f0f8de3441c85aa7f7    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 3 Sep 2015 22:30:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 3 Sep 2015 22:30:16 +0900    

Click here for diff

The setting values of some parameters including max_worker_processes  
must be equal to or higher than the values on the master. However,  
previously max_worker_processes was not listed as such parameter  
in the document. So this commit adds it to that list.  
  
Back-patch to 9.4 where max_worker_processes was added.  

M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlog.c

Disable fsync throughout TAP test suites.

commit   : 8d60549d6d39fbc1501f11a31f007c36975891e8    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 3 Sep 2015 00:29:11 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 3 Sep 2015 00:29:11 -0400    

Click here for diff

Most suites already did so via start_test_server(), but the pg_rewind,  
pg_ctl and pg_controldata suites ran a postmaster or initdb with fsync  
enabled.  This halves the pg_rewind suite's runtime on buildfarm member  
tern.  It makes tern and that machine's other buildfarm members less  
vulnerable to noise failures from postmaster startup overrunning the 60s  
pg_ctl timeout.  Back-patch to 9.5, where pg_rewind was introduced.  

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

Document that PL/Python now returns floats using repr() not str().

commit   : e2e78acccaa94e7d64dc2bc0b124cfcf23520918    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Sep 2015 19:25:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Sep 2015 19:25:58 -0400    

Click here for diff

Commit 1ce7a57ca neglected to update the user-facing documentation,  
which described the old behavior precisely.  

M doc/src/sgml/plpython.sgml

pg_upgrade docs: clarify rsync and move verification step

commit   : 813e08123bd9eb7d7eb7bc6eac43b74f5a9a1ef8    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 1 Sep 2015 16:42:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 1 Sep 2015 16:42:43 -0400    

Click here for diff

These are adjustments based on someone using the new standby upgrade  
steps.  
  
Report by Andy Colson  
  
Backpatch through 9.5  

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

Allow notifications to bgworkers without database connections.

commit   : b8a439b650c4791575720dec847be61467a710a4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Sep 2015 15:30:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Sep 2015 15:30:19 -0400    

Click here for diff

Previously, if one background worker registered another background  
worker and set bgw_notify_pid while for the second background worker,  
it would not receive notifications from the postmaster unless, at the  
time the "parent" was registered, BGWORKER_BACKEND_DATABASE_CONNECTION  
was set.  
  
To fix, instead instead of including only those background workers that  
requested database connections in the postmater's BackendList, include  
them all.  There doesn't seem to be any reason not do this, and indeed  
it removes a significant amount of duplicated code.  The other option  
is to make PostmasterMarkPIDForWorkerNotify look at BackgroundWorkerList  
in addition to BackendList, but that adds more code duplication instead  
of getting rid of it.  
  
Patch by me.  Review and testing by Ashutosh Bapat.  

M src/backend/postmaster/postmaster.c

Use <substeps> in pg_upgrade's procedure

commit   : c1564b3928e527c799bd41c2c80c4d6851bb5e15    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2015 14:58:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2015 14:58:28 -0300    

Click here for diff

For clarity, so that the substeps are not numbered identically to the  
outer procedure's steps.  
  
Per report from Andy Colson in  
http://www.postgresql.org/message-id/[email protected]  

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

docs: remove outdated note about unique indexes

commit   : 06502185d8352258560b7fad82571d159dff8658    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 17:05:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 17:05:22 -0400    

Click here for diff

Patch by Josh Kupershmidt  
  
Backpatch through 9.5  

M doc/src/sgml/indices.sgml

psql: print longtable as a possible \pset option

commit   : bda58e98d535762b46a9d6315f4e49d9c93e81d8    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 12:24:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2015 12:24:16 -0400    

Click here for diff

For some reason this message was not updated when the longtable option  
was added.  
  
Backpatch through 9.3  

M src/bin/psql/command.c

Small grammar fix

commit   : bafeb010b2500b31d303f4c2879cec54481dafdd    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 31 Aug 2015 14:07:17 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 31 Aug 2015 14:07:17 +0200    

Click here for diff

Josh Kupershmidt  

M doc/src/sgml/pgprewarm.sgml

Fix sepgsql regression tests.

commit   : 1c419abffba7a105948495f498780f1cf9ab7fc4    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 30 Aug 2015 11:09:19 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 30 Aug 2015 11:09:19 -0700    

Click here for diff

The regression tests for sepgsql were broken by changes in the  
base distro as-shipped policies. Specifically, definition of  
unconfined_t in the system default policy was changed to bypass  
multi-category rules, which the regression test depended on.  
Fix that by defining a custom privileged domain  
(sepgsql_regtest_superuser_t) and using it instead of system's  
unconfined_t domain. The new sepgsql_regtest_superuser_t domain  
performs almost like the current unconfined_t, but restricted by  
multi-category policy as the traditional unconfined_t was.  
  
The custom policy module is a self defined domain, and so should not  
be affected by related future system policy changes. However, it still  
uses the unconfined_u:unconfined_r pair for selinux-user and role.  
Those definitions have not been changed for several years and seem  
less risky to rely on than the unconfined_t domain. Additionally, if  
we define custom user/role, they would need to be manually defined  
at the operating system level, adding more complexity to an already  
non-standard and complex regression test.  
  
Back-patch to 9.3. The regression tests will need more work before  
working correctly on 9.2. Starting with 9.2, sepgsql has had dependencies  
on libselinux versions that are only available on newer distros with  
the changed set of policies (e.g. RHEL 7.x). On 9.1 sepgsql works  
fine with the older distros with original policy set (e.g. RHEL 6.x),  
and on which the existing regression tests work fine. We might want  
eventually change 9.1 sepgsql regression tests to be more independent  
from the underlying OS policies, however more work will be needed to  
make that happen and it is not clear that it is worth the effort.  
  
Kohei KaiGai with review by Adam Brightwell and me, commentary by  
Stephen, Alvaro, Tom, Robert, and others.  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/sepgsql/expected/dml.out
M contrib/sepgsql/expected/label.out
M contrib/sepgsql/expected/misc.out
M contrib/sepgsql/launcher
M contrib/sepgsql/sepgsql-regtest.te
M contrib/sepgsql/sql/alter.sql
M contrib/sepgsql/sql/ddl.sql
M contrib/sepgsql/sql/dml.sql
M contrib/sepgsql/sql/label.sql

Fix s_lock.h PPC assembly code to be compatible with native AIX assembler.

commit   : ffbc387bfc57b47ec7f120582cfff54f6434f3d4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Aug 2015 16:09:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Aug 2015 16:09:25 -0400    

Click here for diff

On recent AIX it's necessary to configure gcc to use the native assembler  
(because the GNU assembler hasn't been updated to handle AIX 6+).  This  
caused PG builds to fail with assembler syntax errors, because we'd try  
to compile s_lock.h's gcc asm fragment for PPC, and that assembly code  
relied on GNU-style local labels.  We can't substitute normal labels  
because it would fail in any file containing more than one inlined use of  
tas().  Fortunately, that code is stable enough, and the PPC ISA is simple  
enough, that it doesn't seem like too much of a maintenance burden to just  
hand-code the branch offsets, removing the need for any labels.  
  
Note that the AIX assembler only accepts "$" for the location counter  
pseudo-symbol.  The usual GNU convention is "."; but it appears that all  
versions of gas for PPC also accept "$", so in theory this patch will not  
break any other PPC platforms.  
  
This has been reported by a few people, but Steve Underwood gets the credit  
for being the first to pursue the problem far enough to understand why it  
was failing.  Thanks also to Noah Misch for additional testing.  

M src/include/storage/s_lock.h

Ensure locks are acquired on RLS-added relations

commit   : d03f3314b35cc4ac2be832cf63ae67a69ee4d93c    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 28 Aug 2015 11:39:43 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 28 Aug 2015 11:39:43 -0400    

Click here for diff

During fireRIRrules(), get_row_security_policies can add to  
securityQuals and withCheckOptions.  Make sure to lock any relations  
added at that point and before firing RIR rules on those expressions.  
  
Back-patch to 9.5 where RLS was added.  

M src/backend/rewrite/rewriteHandler.c

Simplify Perl chmod calls

commit   : aed688eb730f0e46bc7950589d7577db6bb2d724    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 25 Aug 2015 09:58:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 25 Aug 2015 09:58:49 -0400    

Click here for diff

The Perl chmod function already takes multiple file arguments, so we  
don't need a separate looping function.  

M src/test/ssl/ServerSetup.pm

commit   : 440fc48cac7f450bb71d1f06f0d1326c63e3e42f    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 27 Aug 2015 13:43:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 27 Aug 2015 13:43:10 -0400    

Click here for diff

This makes the parameter names match the documented prototype names.  
  
Report by Erwin Brandstetter  
  
Backpatch through 9.0  

M doc/src/sgml/dblink.sgml

release notes: abbreviated key speedup only for varchar/text

commit   : ce56a649cf0b9aba41d68481895b3da0a82981d4    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 14:46:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 14:46:48 -0400    

Click here for diff

Report by Peter Geoghegan  
  
Backpatch through 9.5  

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

release notes: backpatch removal of xpath item to 9.5 tree

commit   : aa9630cce04d3512e1ca5131013a0a669b39fcac    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 14:40:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 14:40:53 -0400    

Click here for diff

Backpatch a93545e13f832d457e00420d44ccce1f88f899d4 to the 9.5 tree  
  
Backpatch to 9.5 only  

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

9.5 release notes: mention lack of char() sort improvements

commit   : 63c6522dae38e3cf6d1af795db441686e716b331    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 10:33:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Aug 2015 10:33:02 -0400    

Click here for diff

Report by Peter Geoghegan  
  
Backpatch through 9.5  

M doc/src/sgml/datatype.sgml

Reestablish alignment of pg_controldata output.

commit   : bff62dfb873be1f2469402c6e22cfb93b639f9cd    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 25 Aug 2015 18:46:02 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 25 Aug 2015 18:46:02 -0700    

Click here for diff

Until 9.4, pg_controldata output was all aligned. At some point  
during 9.5 development, a new item was added, namely  
"Current track_commit_timestamp setting:" which is two characters  
too long to be aligned with the rest of the output. Fix this by  
removing the noise word "Current" and adding the requisite number  
of padding spaces. Since the six preceding items are also similar  
in nature, remove "Current" and pad those as well in order to  
maintain overall consistency. Backpatch to 9.5 where new offending  
item was added.  

M src/bin/pg_controldata/pg_controldata.c

Docs: be explicit about datatype matching for lead/lag functions.

commit   : 7c0c4d07e777957a5fad54e81b4f42f420031060    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 19:11:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 19:11:17 -0400    

Click here for diff

The default argument, if given, has to be of exactly the same datatype  
as the first argument; but this was not stated in so many words, and  
the error message you get about it might not lead your thought in the  
right direction.  Per bug #13587 from Robert McGehee.  
  
A quick scan says that these are the only two built-in functions with two  
anyelement arguments and no other polymorphic arguments.  There are plenty  
of cases of, eg, anyarray and anyelement, but those seem less likely to  
confuse.  For instance this doesn't seem terribly hard to figure out:  
"function array_remove(integer[], numeric) does not exist".  So I've  
contented myself with fixing these two cases.  

M doc/src/sgml/func.sgml

Fix potential platform dependence in gist regression test.

commit   : b8c91352a2e168e1c24cc33862a0d95f13fd0957    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 11:43:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Aug 2015 11:43:37 -0400    

Click here for diff

The results of the KNN-search test cases were indeterminate, as they asked  
the system to sort pairs of points that are exactly equidistant from the  
query reference point.  It's a bit surprising that we've seen no  
platform-specific failures from this in the buildfarm.  Perhaps IEEE-float  
math is well enough standardized that no such failures will ever occur on  
supported platforms ... but since this entire regression test has yet to be  
shipped in any non-alpha release, that seems like an unduly optimistic  
assumption.  Tweak the queries so that the correct output is uniquely  
defined.  
  
(The other queries in this test are also underdetermined; but it looks like  
they are regurgitating index rows in insertion order, so for the moment  
assume that that behavior is stable enough.)  
  
Per Greg Stark's experiments with VAX.  Back-patch to 9.5 where this test  
script was introduced.  

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

Avoid use of float arithmetic in bipartite_match.c.

commit   : 4022f94c350f96fc5feff0503d3e2f2f6f9086cc    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 13:02:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Aug 2015 13:02:13 -0400    

Click here for diff

Since the distances used in this algorithm are small integers (not more  
than the size of the U set, in fact), there is no good reason to use float  
arithmetic for them.  Use short ints instead: they're smaller, faster, and  
require no special portability assumptions.  
  
Per testing by Greg Stark, which disclosed that the code got into an  
infinite loop on VAX for lack of IEEE-style float infinities.  We don't  
really care all that much whether Postgres can run on a VAX anymore,  
but there seems sufficient reason to change this code anyway.  
  
In passing, make a few other small adjustments to make the code match  
usual Postgres coding style a bit better.  

M src/backend/lib/bipartite_match.c
M src/include/lib/bipartite_match.h

Fix typo in C comment.

commit   : 57823244ad087a2dc807a6e60fefce26f81bd5dc    
  
author   : Kevin Grittner <[email protected]>    
date     : Sun, 23 Aug 2015 10:41:08 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sun, 23 Aug 2015 10:41:08 -0500    

Click here for diff

Merlin Moncure  
Backpatch to 9.5, where the misspelling was introduced  

M src/backend/commands/trigger.c

Improve whitespace

commit   : 27347c4841ca880af61f1b767f24c6e248686c99    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:29 -0400    

Click here for diff

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

Improve spelling

commit   : 63b04a37626ab5982c14438e408e35d88328ad87    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:13 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Aug 2015 21:41:13 -0400    

Click here for diff

M contrib/btree_gist/Makefile

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

commit   : 68a14ca74be03ab189b83c2bbf0b68c5d1daba44    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 20:32:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 20:32:11 -0400    

Click here for diff

For no obvious reason, spi_printtup() was coded to enlarge the tuple  
pointer table by just 256 slots at a time, rather than doubling the size at  
each reallocation, as is our usual habit.  For very large SPI results, this  
makes for O(N^2) time spent in repalloc(), which of course soon comes to  
dominate the runtime.  Use the standard doubling approach instead.  
  
This is a longstanding performance bug, so back-patch to all active  
branches.  
  
Neil Conway  

M src/backend/executor/spi.c

Clean up roles from roleattributes test

commit   : 93fcb4ae3e4b20e8562f0a8cab3a3a486ad84e76    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 15:51:29 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 15:51:29 -0400    

Click here for diff

Having the roles remain after the test ends up causing repeated 'make  
installcheck' runs to fail and may be risky from a security perspective  
also, so remove them at the end of the test.  

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

Do not allow *timestamp to be passed as NULL

commit   : d6968e625770d021c8db15094ea732b40be2c5aa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 21 Aug 2015 14:36:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 21 Aug 2015 14:36:54 -0300    

Click here for diff

The code had bugs that would cause crashes if NULL was passed as that  
argument (originally intended to mean not to bother returning its  
value), and after inspection it turns out that nothing seems interested  
in the case that *ts is NULL anyway.  Therefore, remove the partial  
checks intended to support that case.  
  
Author: Michael Paquier  
though I didn't include a proposed Assert.  
  
Backpatch to 9.5.  

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

Fix plpython crash when returning string representation of a RECORD result.

commit   : 19446280fce0b9aebef40c6b5390cf1170c5c770    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 12:21:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 12:21:37 -0400    

Click here for diff

PLyString_ToComposite() blithely overwrote proc->result.out.d, even though  
for a composite result type the other union variant proc->result.out.r is  
the one that should be valid.  This could result in a crash if out.r had  
in fact been filled in (proc->result.is_rowtype == 1) and then somebody  
later attempted to use that data; as per bug #13579 from Paweł Michalak.  
  
Just to add insult to injury, it didn't work for RECORD results anyway,  
because record_in() would refuse the case.  
  
Fix by doing the I/O function lookup in a local PLyTypeInfo variable,  
as we were doing already in PLyObject_ToComposite().  This is not a great  
technique because any fn_extra data allocated by the input function will  
be leaked permanently (thanks to using TopMemoryContext as fn_mcxt).  
But that's a pre-existing issue that is much less serious than a crash,  
so leave it to be fixed separately.  
  
This bug would be a potential security issue, except that plpython is  
only available to superusers and the crash requires coding the function  
in a way that didn't work before today's patches.  
  
Add regression test cases covering all the supported methods of converting  
composite results.  
  
Back-patch to 9.1 where the faulty coding was introduced.  

M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_composite.sql

Allow record_in() and record_recv() to work for transient record types.

commit   : 20bef3fe2ed180c64a5140b8ebeba439afd1bb95    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 11:19:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2015 11:19:33 -0400    

Click here for diff

If we have the typmod that identifies a registered record type, there's no  
reason that record_in() should refuse to perform input conversion for it.  
Now, in direct SQL usage, record_in() will always be passed typmod = -1  
with type OID RECORDOID, because no typmodin exists for type RECORD, so the  
case can't arise.  However, some InputFunctionCall users such as PLs may be  
able to supply the right typmod, so we should allow this to support them.  
  
Note: the previous coding and comment here predate commit 59c016aa9f490b53.  
There has been no case since 8.1 in which the passed type OID wouldn't be  
valid; and if it weren't, this error message wouldn't be apropos anyway.  
Better to let lookup_rowtype_tupdesc complain about it.  
  
Back-patch to 9.1, as this is necessary for my upcoming plpython fix.  
I'm committing it separately just to make it a bit more visible in the  
commit history.  

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

Rename 'cmd' to 'cmd_name' in CreatePolicyStmt

commit   : 49f9a2831b8c5c8941eec9baa5d44b471971704e    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:29 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:29 -0400    

Click here for diff

To avoid confusion, rename CreatePolicyStmt's 'cmd' to 'cmd_name',  
parse_policy_command's 'cmd' to 'polcmd', and AlterPolicy's 'cmd_datum'  
to 'polcmd_datum', per discussion with Noah and as a follow-up to his  
correction of copynodes/equalnodes handling of the CreatePolicyStmt  
'cmd' field.  
  
Back-patch to 9.5 where the CreatePolicyStmt was introduced, as we  
are still only in alpha.  

M src/backend/commands/policy.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

In AlterRole, make bypassrls an int

commit   : 0070fd8d3c1c8a733c041bfcedd41e38cee0a963    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:29 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 21 Aug 2015 08:22:29 -0400    

Click here for diff

When reworking bypassrls in AlterRole to operate the same way the other  
attribute handling is done, I missed that the variable was incorrectly a  
bool rather than an int.  This meant that on platforms with an unsigned  
char, we could end up with incorrect behavior during ALTER ROLE.  
  
Pointed out by Andres thanks to tests he did changing our bool to be the  
one from stdbool.h which showed this and a number of other issues.  
  
Add regression tests to test CREATE/ALTER role for the various role  
attributes.  Arrange to leave roles behind for testing pg_dumpall, but  
none which have the LOGIN attribute.  
  
Back-patch to 9.5 where the AlterRole bug exists.  

M src/backend/commands/user.c
A src/test/regress/expected/roleattributes.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/roleattributes.sql

doc: Whitespace and formatting fixes

commit   : 338a8622560f45062958dd290abed66c6004e0ef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Aug 2015 22:34:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Aug 2015 22:34:35 -0400    

Click here for diff

M doc/src/sgml/brin.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/syntax.sgml

Update config.guess and config.sub

commit   : f17e2471734c73da8079451c17a2212884979168    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Aug 2015 11:45:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Aug 2015 11:45:52 -0400    

Click here for diff

M config/config.guess
M config/config.sub

Fix bug in calculations of hash join buckets.

commit   : 24bf2ee22233244eb9e2c71de754b1c71258d004    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 19 Aug 2015 08:31:13 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 19 Aug 2015 08:31:13 -0500    

Click here for diff

Commit 8cce08f168481c5fc5be4e7e29b968e314f1b41e used a left-shift  
on a literal of 1 that could (in large allocations) be shifted by  
31 or more bits.  This was assigned to a local variable that was  
already declared to be a long to protect against overruns of int,  
but the literal in this shift needs to be declared long to allow it  
to work correctly in some compilers.  
  
Backpatch to 9.5, where the bug was introduced.  
  
Report and patch by KaiGai Kohei, slighly modified based on  
discussion.  

M src/backend/executor/nodeHash.c

Fix a few bogus statement type names in plpgsql error messages.

commit   : 4c3754ffe0f5f85cdecd01d7c1ab55df94559302    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Aug 2015 19:22:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Aug 2015 19:22:37 -0400    

Click here for diff

plpgsql's error location context messages ("PL/pgSQL function fn-name line  
line-no at stmt-type") would misreport a CONTINUE statement as being an  
EXIT, and misreport a MOVE statement as being a FETCH.  These are clear  
bugs that have been there a long time, so back-patch to all supported  
branches.  
  
In addition, in 9.5 and HEAD, change the description of EXECUTE from  
"EXECUTE statement" to just plain EXECUTE; there seems no good reason why  
this statement type should be described differently from others that have  
a well-defined head keyword.  And distinguish GET STACKED DIAGNOSTICS from  
plain GET DIAGNOSTICS.  These are a bit more of a judgment call, and also  
affect existing regression-test outputs, so I did not back-patch into  
stable branches.  
  
Pavel Stehule and Tom Lane  

M src/pl/plpgsql/src/pl_funcs.c
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/triggers.out

psql: Make EXECUTE PROCEDURE tab completion a bit narrower.

commit   : f25087d26aa9c63ce90cd8e87131b6dbe943ba86    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 18 Aug 2015 12:49:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 18 Aug 2015 12:49:04 -0400    

Click here for diff

If the user has typed GRANT EXECUTE, the correct completion is "ON",  
not "PROCEDURE".  
  
Daniel Verite  

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

Improve configure test for the sse4.2 crc instruction.

commit   : 2c5c11ae9e0c5f4605fb9cdd2e8bd94fe0a06d95    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Aug 2015 11:15:46 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Aug 2015 11:15:46 +0200    

Click here for diff

With optimizations enabled at least one compiler, clang 3.7, optimized  
away the crc intrinsics knowing that the result went on unused and has  
no side effects. That can trigger errors in code generation when the  
intrinsic is used, as we chose to use the intrinsics without any  
additional compiler flag. Return the computed value to prevent that.  
  
With some more pedantic warning flags (-Wold-style-definition) the  
configure test failed to recognize the existence of _mm_crc32_u*  
intrinsics due to an independent warning in the test because the test  
turned on -Werror, but that's not actually needed here.  
  
Discussion: [email protected]  
Backpatch: 9.5, where the use of crc intrinsics was integrated.  

M config/c-compiler.m4
M configure

Add docs about postgres_fdw's setting of search_path and other GUCs.

commit   : 9a18a2bfb9f93e4a1aa405e752608746e04619f2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 14:31:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 14:31:04 -0400    

Click here for diff

This behavior wasn't documented, but it should be because it's user-visible  
in triggers and other functions executed on the remote server.  
Per question from Adam Fuchs.  
  
Back-patch to 9.3 where postgres_fdw was added.  

M doc/src/sgml/postgres-fdw.sgml

Improve documentation about MVCC-unsafe utility commands.

commit   : 656363d83970195e875c5c2153ef097e112b859f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 13:30:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 13:30:16 -0400    

Click here for diff

The table-rewriting forms of ALTER TABLE are MVCC-unsafe, in much the same  
way as TRUNCATE, because they replace all rows of the table with newly-made  
rows with a new xmin.  (Ideally, concurrent transactions with old snapshots  
would continue to see the old table contents, but the data is not there  
anymore --- and if it were there, it would be inconsistent with the table's  
updated rowtype, so there would be serious implementation problems to fix.)  
This was nowhere documented though, and the problem was only documented for  
TRUNCATE in a note in the TRUNCATE reference page.  Create a new "Caveats"  
section in the MVCC chapter that can be home to this and other limitations  
on serializable consistency.  
  
In passing, fix a mistaken statement that VACUUM and CLUSTER would reclaim  
space occupied by a dropped column.  They don't reconstruct existing tuples  
so they couldn't do that.  
  
Back-patch to all supported branches.  

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

Repair unsafe use of shared typecast-lookup table in plpgsql DO blocks.

commit   : 1f6a7eba466d0cb31cd2f374603799935fcb9df8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 12:00:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2015 12:00:36 -0400    

Click here for diff

DO blocks use private simple_eval_estates to avoid intra-transaction memory  
leakage, cf commit c7b849a89.  I had forgotten about that while writing  
commit 0fc94a5ba, but it means that expression execution trees created  
within a DO block disappear immediately on exiting the DO block, and hence  
can't safely be linked into plpgsql's session-wide cast hash table.  
To fix, give a DO block a private cast hash table to go with its private  
simple_eval_estate.  This is less efficient than one could wish, since  
DO blocks can no longer share any cast lookup work with other plpgsql  
execution, but it shouldn't be too bad; in any case it's no worse than  
what happened in DO blocks before commit 0fc94a5ba.  
  
Per bug #13571 from Feike Steenbergen.  Preliminary analysis by  
Oleksandr Shulgin.  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Correct type of waitMode variable in ExecInsertIndexTuples().

commit   : 6942663d1bde1e6d6e6da38710d3e6aade900e63    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 15 Aug 2015 17:02:47 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 15 Aug 2015 17:02:47 +0200    

Click here for diff

It was a bool, even though it should be CEOUC_WAIT_MODE. That's unlikely  
to have a negative effect with the current definition of bool (char),  
but it's definitely wrong.  
  
Discussion: [email protected]  
Backpatch: 9.5, where ON CONFLICT was merged  

M src/backend/executor/execIndexing.c

vacuumdb: Don't assign negative values to a boolean.

commit   : 32951f9aa9acfd4b6318f6daf39c3d1c10a264ba    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:49:36 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:49:36 +0200    

Click here for diff

Since a17923204736 (vacuumdb: enable parallel mode) -1 has been assigned  
to a boolean. That can, justifiedly, trigger compiler warnings. There's  
also no need for ternary logic, result was only ever set to 0 or -1. So  
don't.  
  
Discussion: [email protected]  
Backpatch: 9.5  

M src/bin/scripts/vacuumdb.c

Don't use 'bool' as a struct member name in help_config.c.

commit   : d19c1b0b24d53f41222bf808dc6b40404b2954a1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:02:20 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 16:02:20 +0200    

Click here for diff

Doing so doesn't work if bool is a macro rather than a typedef.  
  
Although c.h spends some effort to support configurations where bool is  
a preexisting macro, help_config.c has existed this way since  
2003 (b700a6), and there have not been any reports of  
problems. Backpatch anyway since this is as riskless as it gets.  
  
Discussion: [email protected]  
Backpatch: 9.0-master  

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

Use the correct type for TableInfo->relreplident.

commit   : feb473a57acb648f29e1520b07b146ba1dc4e22d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 15:52:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 15:52:10 +0200    

Click here for diff

Mistakenly relreplident was stored as a bool. That works today as c.h  
typedefs bool to a char, but isn't very future proof.  
  
Discussion: [email protected]  
Backpatch: 9.4 where replica identity was introduced.  

M src/bin/pg_dump/pg_dump.h

Encoding PG_UHC is code page 949.

commit   : f19ad6fbe46afe5005fb0f38ebd436c7cfcbb9ec    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:13 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:13 -0400    

Click here for diff

This fixes presentation of non-ASCII messages to the Windows event log  
and console in rare cases involving Korean locale.  Processes like the  
postmaster and checkpointer, but not processes attached to databases,  
were affected.  Back-patch to 9.4, where MessageEncoding was introduced.  
The problem exists in all supported versions, but this change has no  
effect in the absence of the code recognizing PG_UHC MessageEncoding.  
  
Noticed while investigating bug #13427 from Dmitri Bourlatchkov.  

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

Restore old pgwin32_message_to_UTF16() behavior outside transactions.

commit   : 92516bf1954bd53914f0423bd2817487bd367596    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:09 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 14 Aug 2015 20:23:09 -0400    

Click here for diff

Commit 49c817eab78c6f0ce8c3bf46766b73d6cf3190b7 replaced with a hard  
error the dubious pg_do_encoding_conversion() behavior when outside a  
transaction.  Reintroduce the historic soft failure locally within  
pgwin32_message_to_UTF16().  This fixes errors when writing messages in  
less-common encodings to the Windows event log or console.  Back-patch  
to 9.4, where the aforementioned commit first appeared.  
  
Per bug #13427 from Dmitri Bourlatchkov.  

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

Update key words table for 9.5

commit   : b435f191abbdd09bb97bc386ffe71d24d6934f57    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Aug 2015 12:10:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Aug 2015 12:10:35 -0400    

Click here for diff

M doc/src/sgml/keywords.sgml

MSVC: Exclude 'brin' contrib module

commit   : 7321841b7c7edc1fd9f6545638e890fdb963aea3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 19:28:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 19:28:54 -0300    

Click here for diff

The build script is not able to parse the Makefile, so remove it.  

M src/tools/msvc/Mkvcbuild.pm

Re-add BRIN isolation test

commit   : ae372e60b98990863058edc596df8a20207b08d0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 14:41:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 14:41:52 -0300    

Click here for diff

This time, instead of using a core isolation test, put it on its own  
test module; this way it can require the pageinspect module to be  
present before running.  
  
The module's Makefile is loosely modeled after test_decoding's, so that  
it's easy to add further tests for either pg_regress or isolationtester  
later.  
  
Backpatch to 9.5.  

M src/test/modules/Makefile
A src/test/modules/brin/.gitignore
A src/test/modules/brin/Makefile
A src/test/modules/brin/expected/summarization-and-inprogress-insertion.out
A src/test/modules/brin/specs/summarization-and-inprogress-insertion.spec

Improve regression test case to avoid depending on system catalog stats.

commit   : 657cdb3a21b09a7f02497b8c2e9f46b7bfc59993    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Aug 2015 13:25:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Aug 2015 13:25:01 -0400    

Click here for diff

In commit 95f4e59c32866716 I added a regression test case that examined  
the plan of a query on system catalogs.  That isn't a terribly great idea  
because the catalogs tend to change from version to version, or even  
within a version if someone makes an unrelated regression-test change that  
populates the catalogs a bit differently.  Usually I try to make planner  
test cases rely on test tables that have not changed since Berkeley days,  
but I got sloppy in this case because the submitted crasher example queried  
the catalogs and I didn't spend enough time on rewriting it.  But it was a  
problem waiting to happen, as I was rudely reminded when I tried to port  
that patch into Salesforce's Postgres variant :-(.  So spend a little more  
effort and rewrite the query to not use any system catalogs.  I verified  
that this version still provokes the Assert if 95f4e59c32866716's code fix  
is reverted.  
  
I also removed the EXPLAIN output from the test, as it turns out that the  
assertion occurs while considering a plan that isn't the one ultimately  
selected anyway; so there's no value in risking any cross-platform  
variation in that printout.  
  
Back-patch to 9.2, like the previous patch.  

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

Use materialize SRF mode in brin_page_items

commit   : 1136971daef209a40eb495b4bd74ce50fbd0fe63    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 13:02:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 13:02:10 -0300    

Click here for diff

This function was using the single-value-per-call mechanism, but the  
code relied on a relcache entry that wasn't kept open across calls.  
This manifested as weird errors in buildfarm during the short time that  
the "brin-1" isolation test lived.  
  
Backpatch to 9.5, where it was introduced.  

M contrib/pageinspect/brinfuncs.c

Fix declaration of isarray variable.

commit   : edebddbb845575206d07145af2d718609b01f6ad    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 13 Aug 2015 13:22:29 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 13 Aug 2015 13:22:29 +0200    

Click here for diff

Found and fixed by Andres Freund.  

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

Fix unitialized variables

commit   : 652ca927ca4d9553691b9c6385111bea353070d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 00:12:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2015 00:12:07 -0300    

Click here for diff

As complained by clang, reported by Andres Freund.  Brown paper bag bug  
in ccc4c074994d.  
  
Add some comments, too.  
  
Backpatch to 9.5, like that one.  

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

Undo mistaken tightening in join_is_legal().

commit   : ec94bc1473475128ef4e7b62636e66effd314102    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 21:18:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 21:18:45 -0400    

Click here for diff

One of the changes I made in commit 8703059c6b55c427 turns out not to have  
been such a good idea: we still need the exception in join_is_legal() that  
allows a join if both inputs already overlap the RHS of the special join  
we're checking.  Otherwise we can miss valid plans, and might indeed fail  
to find a plan at all, as in recent report from Andreas Seltenreich.  
  
That code was added way back in commit c17117649b9ae23d, but I failed to  
include a regression test case then; my bad.  Put it back with a better  
explanation, and a test this time.  The logic does end up a bit different  
than before though: I now believe it's appropriate to make this check  
first, thereby allowing such a case whether or not we'd consider the  
previous SJ(s) to commute with this one.  (Presumably, we already decided  
they did; but it was confusing to have this consideration in the middle  
of the code that was handling the other case.)  
  
Back-patch to all active branches, like the previous patch.  

M src/backend/optimizer/path/joinrels.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Close some holes in BRIN page assignment

commit   : fc0a6402306db3cc93a5f760acabab687998be1d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Aug 2015 14:20:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Aug 2015 14:20:38 -0300    

Click here for diff

In some corner cases, it is possible for the BRIN index relation to be  
extended by brin_getinsertbuffer but the new page not be used  
immediately for anything by its callers; when this happens, the page is  
initialized and the FSM is updated (by brin_getinsertbuffer) with the  
info about that page, but these actions are not WAL-logged.  A later  
index insert/update can use the page, but since the page is already  
initialized, the initialization itself is not WAL-logged then either.  
Replay of this sequence of events causes recovery to fail altogether.  
  
There is a related corner case within brin_getinsertbuffer itself, in  
which we extend the relation to put a new index tuple there, but later  
find out that we cannot do so, and do not return the buffer; the page  
obtained from extension is not even initialized.  The resulting page is  
lost forever.  
  
To fix, shuffle the code so that initialization is not the  
responsibility of brin_getinsertbuffer anymore, in normal cases;  
instead, the initialization is done by its callers (brin_doinsert and  
brin_doupdate) once they're certain that the page is going to be used.  
When either those functions determine that the new page cannot be used,  
before bailing out they initialize the page as an empty regular page,  
enter it in FSM and WAL-log all this.  This way, the page is usable for  
future index insertions, and WAL replay doesn't find trying to insert  
tuples in pages whose initialization didn't make it to the WAL.  The  
same strategy is used in brin_getinsertbuffer when it cannot return the  
new page.  
  
Additionally, add a new step to vacuuming so that all pages of the index  
are scanned; whenever an uninitialized page is found, it is initialized  
as empty and WAL-logged.  This closes the hole that the relation is  
extended but the system crashes before anything is WAL-logged about it.  
We also take this opportunity to update the FSM, in case it has gotten  
out of date.  
  
Thanks to Heikki Linnakangas for finding the problem that kicked some  
additional analysis of BRIN page assignment code.  
  
Backpatch to 9.5, where BRIN was introduced.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h

Handle PQresultErrorField(PG_DIAG_SQLSTATE) returning NULL in streamutil.c.

commit   : 2e6f6f3abe6fd249cc8a4d5eb194295ac3988b19    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:09:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:09:35 +0200    

Click here for diff

In ff27db5d I missed that PQresultErrorField() may return NULL if  
there's no sqlstate associated with an error.  
  
Spotted-By: Coverity  
Reported-By: Michael Paquier  
Discussion: CAB7nPqQ3o10SY6NVdU4pjq85GQTN5tbbkq2gnNUh2fBNU3rKyQ@mail.gmail.com  
Backpatch: 9.5, like ff27db5d  

M src/bin/pg_basebackup/streamutil.c

Fix two off-by-one errors in bufmgr.c.

commit   : 43a8ed26c97e36d971b6018d1bc94ad5c52d169b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:09:34 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Aug 2015 17:09:34 +0200    

Click here for diff

In 4b4b680c I passed a buffer index number (starting from 0) instead of  
a proper Buffer id (which start from 1 for shared buffers) in two  
places.  
  
This wasn't noticed so far as one of those locations isn't compiled at  
all (PrintPinnedBufs) and the other one (InvalidBuffer) requires a  
unlikely, but possible, set of circumstances to trigger a symptom.  
  
To reduce the likelihood of such incidents a bit also convert existing  
open coded mappings from buffer descriptors to buffer ids with  
BufferDescriptorGetBuffer().  
  
Author: Qingqing Zhou  
Reported-By: Qingqing Zhou  
Discussion: CAJjS0u2ai9ooUisKtkV8cuVUtEkMTsbK8c7juNAjv8K11zeCQg@mail.gmail.com  
Backpatch: 9.5 where the private ref count infrastructure was introduced  

M src/backend/storage/buffer/bufmgr.c

Fix some possible low-memory failures in regexp compilation.

commit   : c5bfcc18a09b3f56ae0fd434ff6c72bd185949c1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 00:48:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Aug 2015 00:48:11 -0400    

Click here for diff

newnfa() failed to set the regex error state when malloc() fails.  
Several places in regcomp.c failed to check for an error after calling  
subre().  Each of these mistakes could lead to null-pointer-dereference  
crashes in memory-starved backends.  
  
Report and patch by Andreas Seltenreich.  Back-patch to all branches.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c

commit   : 58d2e7fb70584598e026a39f515c5f3c5e589857    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:32:49 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Aug 2015 12:32:49 +0200    

Click here for diff

Fix a bunch of typos, and remove two superflous includes.  
  
Author: Gurjeet Singh  
Discussion: CABwTF4Wh_dBCzTU=49pFXR6coR4NW1ynb+vBqT+Po=7fuq5iCw@mail.gmail.com  
Backpatch: 9.4  

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

Fix privilege dumping from servers too old to have that type of privilege.

commit   : 1cd46851678b304b684f7ab68b4ae888828027f4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 20:10:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 20:10:15 -0400    

Click here for diff

pg_dump produced fairly silly GRANT/REVOKE commands when dumping types from  
pre-9.2 servers, and when dumping functions or procedural languages from  
pre-7.3 servers.  Those server versions lack the typacl, proacl, and/or  
lanacl columns respectively, and pg_dump substituted default values that  
were in fact incorrect.  We ended up revoking all the owner's own  
privileges for the object while granting all privileges to PUBLIC.  
Of course the owner would then have those privileges again via PUBLIC, so  
long as she did not try to revoke PUBLIC's privileges; which may explain  
the lack of field reports.  Nonetheless this is pretty silly behavior.  
  
The stakes were raised by my recent patch to make pg_dump dump shell types,  
because 9.2 and up pg_dump would proceed to emit bogus GRANT/REVOKE  
commands for a shell type if dumping from a pre-9.2 server; and the server  
will not accept GRANT/REVOKE commands for a shell type.  (Perhaps it  
should, but that's a topic for another day.)  So the resulting dump script  
wouldn't load without errors.  
  
The right thing to do is to act as though these objects have default  
privileges (null ACL entries), which causes pg_dump to print no  
GRANT/REVOKE commands at all for them.  That fixes the silly results  
and also dodges the problem with shell types.  
  
In passing, modify getProcLangs() to be less creatively different about  
how to handle missing columns when dumping from older server versions.  
Every other data-acquisition function in pg_dump does that by substituting  
appropriate default values in the version-specific SQL commands, and I see  
no reason why this one should march to its own drummer.  Its use of  
"SELECT *" was likewise not conformant with anyplace else, not to mention  
it's not considered good SQL style for production queries.  
  
Back-patch to all supported versions.  Although 9.0 and 9.1 pg_dump don't  
have the issue with typacl, they are more likely than newer versions to be  
used to dump from ancient servers, so we ought to fix the proacl/lanacl  
issues all the way back.  

M src/bin/pg_dump/pg_dump.c

Accept alternate spellings of __sparcv7 and __sparcv8.

commit   : f8e4e0e3f3fe261317c4fd751ea4b9379ac54e94    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:34:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:34:51 -0400    

Click here for diff

Apparently some versions of gcc prefer __sparc_v7__ and __sparc_v8__.  
Per report from Waldemar Brodkorb.  

M src/include/storage/s_lock.h

commit   : fda25b22018095fa86bee5a31920344976eb7479    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:18:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 17:18:17 -0400    

Click here for diff

Commit 85e5e222b1dd02f135a8c3bf387d0d6d88e669bd turns out not to have taken  
care of all cases of the partially-evaluatable-PlaceHolderVar problem found  
by Andreas Seltenreich's fuzz testing.  I had set it up to check for risky  
PHVs only in the event that we were making a star-schema-based exception to  
the param_source_rels join ordering heuristic.  However, it turns out that  
the problem can occur even in joins that satisfy the param_source_rels  
heuristic, in which case allow_star_schema_join() isn't consulted.  
Refactor so that we check for risky PHVs whenever the proposed join has  
any remaining parameterization.  
  
Back-patch to 9.2, like the previous patch (except for the regression test  
case, which only works back to 9.3 because it uses LATERAL).  
  
Note that this discovery implies that problems of this sort could've  
occurred in 9.2 and up even before the star-schema patch; though I've not  
tried to prove that experimentally.  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Temporarily(?) remove BRIN isolation test.

commit   : 0ae43b6a631ce8507ef4bd68ce297853a8986fe8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 10:22:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2015 10:22:37 -0400    

Click here for diff

Commit 2834855cb added a not-very-carefully-thought-out isolation test  
to check a BRIN index bug fix.  The test depended on the availability  
of the pageinspect contrib module, which meant it did not work in  
several common testing scenarios such as "make check-world".  It's not  
clear whether we want a core test depending on a contrib module like  
that, but in any case, failing to deal with the possibility that the  
module isn't present in the installation-under-test is not acceptable.  
  
Remove that test pending some better solution.  

D src/test/isolation/expected/brin-1.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/brin-1.spec

Fix copy & paste mistake in pg_get_replication_slots().

commit   : 2949987d37cf8d13ca0582610c17a4ddbc246193    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:19 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:19 +0200    

Click here for diff

XLogRecPtr was compared with InvalidTransactionId instead of  
InvalidXLogRecPtr. As both are defined to the same value this doesn't  
cause any actual problems, but it's still wrong.  
  
Backpatch: 9.4-master, bug was introduced in 9.4  

M src/backend/replication/slotfuncs.c

Don't start to stream after pg_receivexlog --create-slot.

commit   : 86baf3c24dfb6f351d0a1653552d0973ad7c4e3d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:19 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Aug 2015 13:28:19 +0200    

Click here for diff

Immediately starting to stream after --create-slot is inconvenient in a  
number of situations (e.g. when configuring a slot for use in  
recovery.conf) and it's easy to just call pg_receivexlog twice in the  
rest of the cases.  
  
Author: Michael Paquier  
Discussion: CAB7nPqQ9qEtuDiKY3OpNzHcz5iUA+DUX9FcN9K8GUkCZvG7+Ew@mail.gmail.com  
Backpatch: 9.5, where the option was introduced  

M doc/src/sgml/ref/pg_receivexlog.sgml
M src/bin/pg_basebackup/pg_receivexlog.c

Remove gram.y's precedence declaration for OVERLAPS.

commit   : 6e03d476c93458203c1c0307abaf9068d5793aeb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2015 19:01:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2015 19:01:04 -0400    

Click here for diff

The allowed syntax for OVERLAPS, viz "row OVERLAPS row", is sufficiently  
constrained that we don't actually need a precedence declaration for  
OVERLAPS; indeed removing this declaration does not change the generated  
gram.c file at all.  Let's remove it to avoid confusion about whether  
OVERLAPS has precedence or not.  If we ever generalize what we allow for  
OVERLAPS, we might need to put back a precedence declaration for it,  
but we might want some other level than what it has today --- and leaving  
the declaration there would just risk confusion about whether that would  
be an incompatible change.  
  
Likewise, remove OVERLAPS from the documentation's precedence table.  
  
Per discussion with Noah Misch.  Back-patch to 9.5 where we hacked up some  
nearby precedence decisions.  

M doc/src/sgml/syntax.sgml
M src/backend/parser/gram.y

Fix typo in LDAP example

commit   : 64ac985b5946de4bf7cae21383508477023e0688    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 9 Aug 2015 14:49:47 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 9 Aug 2015 14:49:47 +0200    

Click here for diff

Reported by William Meitzen  

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

Fix broken multibyte regression tests.

commit   : 479cb1e420c40d78b49535c0ceeaa5f65c7d6797    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 9 Aug 2015 10:55:41 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 9 Aug 2015 10:55:41 +0900    

Click here for diff

commit 9043Fe390f4f0b4586cfe59cbd22314b9c3e2957 broke multibyte  
regression tests because the commit removes the warning message when  
temporary hash indexes is created, which has been added by commit  
07af523870bcfe930134054febd3a6a114942e5b.  
  
Back patched to 9.5 stable tree.  

M src/test/mb/expected/big5.out
M src/test/mb/expected/euc_jp.out
M src/test/mb/expected/euc_kr.out
M src/test/mb/expected/euc_tw.out
M src/test/mb/expected/gb18030.out
M src/test/mb/expected/mule_internal.out
M src/test/mb/expected/sjis.out
M src/test/mb/expected/utf8.out

docs: fix typo in rules.sgml

commit   : 5e0cef8a667746d4abaec16f395b150f46493d80    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 20:40:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 20:40:53 -0400    

Click here for diff

Report by Dean Rasheed  
  
Patch by Dean Rasheed  
  
Backpatch through 9.5  

M doc/src/sgml/rules.sgml

9.5 release notes: add increase buffer mapping partitions item

commit   : 966aa524edfe8bac837caf0e48ca00d08d8dd5df    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 13:38:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 8 Aug 2015 13:38:31 -0400    

Click here for diff

Report by Robert Haas, Andres Freund  
  
Backpatch through 9.5  

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

Further adjustments to PlaceHolderVar removal.

commit   : 085338822a2364b5d3afbb13c635b00df43ade45    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Aug 2015 14:13:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Aug 2015 14:13:38 -0400    

Click here for diff

A new test case from Andreas Seltenreich showed that we were still a bit  
confused about removing PlaceHolderVars during join removal.  Specifically,  
remove_rel_from_query would remove a PHV that was used only underneath  
the removable join, even if the place where it's used was the join partner  
relation and not the join clause being deleted.  This would lead to a  
"too late to create a new PlaceHolderInfo" error later on.  We can defend  
against that by checking ph_eval_at to see if the PHV could possibly be  
getting used at some partner rel.  
  
Also improve some nearby LATERAL-related logic.  I decided that the check  
on ph_lateral needed to take precedence over the check on ph_needed, in  
case there's a lateral reference underneath the join being considered.  
(That may be impossible, but I'm not convinced of it, and it's easy enough  
to defend against the case.)  Also, I realized that remove_rel_from_query's  
logic for updating LateralJoinInfos is dead code, because we don't build  
those at all until after join removal.  
  
Back-patch to 9.3.  Previous versions didn't have the LATERAL issues, of  
course, and they also didn't attempt to remove PlaceHolderInfos during join  
removal.  (I'm starting to wonder if changing that was really such a great  
idea.)  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

commit   : caf89b31aa79b472a451a5b13657db0da43decee    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Aug 2015 09:04:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Aug 2015 09:04:07 -0500    

Click here for diff

Spotted by Antonin Houska.  

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

Address points made in post-commit review of replication origins.

commit   : 37163e22bddb30a235c9748f49ad54d5e99db142    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Aug 2015 15:08:51 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Aug 2015 15:08:51 +0200    

Click here for diff

Amit reviewed the replication origins patch and made some good  
points. Address them. This fixes typos in error messages, docs and  
comments and adds a missing error check (although in a  
should-never-happen scenario).  
  
Discussion: CAA4eK1JqUBVeWWKwUmBPryFaje4190ug0y-OAUHWQ6tD83V4xg@mail.gmail.com  
Backpatch: 9.5, where replication origins were introduced.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/replication-origins.sgml
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/origin.c

9.5 release notes: updates from Andres Freund and Jeff Janes

commit   : 892a18ebf0eb2d4182efbcfe12e2ddc142da3693    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 22:33:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 22:33:15 -0400    

Click here for diff

Report by Andres Freund and Jeff Janes  
  
Backpatch through 9.5  

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

Fix old oversight in join removal logic.

commit   : de0227d8aef18c1013b26ab193e48a5122435154    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 22:14:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 22:14:07 -0400    

Click here for diff

Commit 9e7e29c75ad441450f9b8287bd51c13521641e3b introduced an Assert that  
join removal didn't reduce the eval_at set of any PlaceHolderVar to empty.  
At first glance it looks like join_is_removable ensures that's true --- but  
actually, the loop in join_is_removable skips PlaceHolderVars that are not  
referenced above the join due to be removed.  So, if we don't want any  
empty eval_at sets, the right thing to do is to delete any now-unreferenced  
PlaceHolderVars from the data structure entirely.  
  
Per fuzz testing by Andreas Seltenreich.  Back-patch to 9.3 where the  
aforesaid Assert was added.  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

9.5 release notes: mention ON CONFLICT DO NOTHING for FDWs

commit   : e663f7561683c8ba7663a8c2115e5a00f84f17c2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 21:08:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 21:08:08 -0400    

Click here for diff

Report by Peter Geoghegan  
  
Backpatch through 9.5  

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

Fix eclass_useful_for_merging to give valid results for appendrel children.

commit   : a8725c2bade5cb5c51b1203f8037614b49f0c3f7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 20:14:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 20:14:37 -0400    

Click here for diff

Formerly, this function would always return "true" for an appendrel child  
relation, because it would think that the appendrel parent was a potential  
join target for the child.  In principle that should only lead to some  
inefficiency in planning, but fuzz testing by Andreas Seltenreich disclosed  
that it could lead to "could not find pathkey item to sort" planner errors  
in odd corner cases.  Specifically, we would think that all columns of a  
child table's multicolumn index were interesting pathkeys, causing us to  
generate a MergeAppend path that sorts by all the columns.  However, if any  
of those columns weren't actually used above the level of the appendrel,  
they would not get added to that rel's targetlist, which would result in  
being unable to resolve the MergeAppend's sort keys against its targetlist  
during createplan.c.  
  
Backpatch to 9.3.  In older versions, columns of an appendrel get added  
to its targetlist even if they're not mentioned above the scan level,  
so that the failure doesn't occur.  It might be worth back-patching this  
fix to older versions anyway, but I'll refrain for the moment.  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/include/optimizer/paths.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

9.5 release notes: mention change to CRC-32C

commit   : 054d33fd012c7b61518f2552b49e7c3653882605    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 18:03:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 18:03:39 -0400    

Click here for diff

Report by Andres Freund  
  
Backpatch through 9.5  

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

9.5 release notes: adjustments suggested by Andres Freund

commit   : 3e2a3727333441e3aa166639adbe735ab7b17712    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 17:34:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 17:34:38 -0400    

Click here for diff

Report by Andres Freund  
  
Backpatch through 9.5  

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

9.5 release notes: add non-LEAKPROOF view pushdown mention

commit   : 5437eba2eefb32895b912c92535012471701121c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 16:07:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Aug 2015 16:07:27 -0400    

Click here for diff

Report by Dean Rasheed  
  
Backpatch through 9.5  

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

Further fixes for degenerate outer join clauses.

commit   : df3b0f47b9766ff14f50c3e381d8c00a9c2b7a4f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 15:35:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Aug 2015 15:35:27 -0400    

Click here for diff

Further testing revealed that commit f69b4b9495269cc4 was still a few  
bricks shy of a load: minor tweaking of the previous test cases resulted  
in the same wrong-outer-join-order problem coming back.  After study  
I concluded that my previous changes in make_outerjoininfo() were just  
accidentally masking the problem, and should be reverted in favor of  
forcing syntactic join order whenever an upper outer join's predicate  
doesn't mention a lower outer join's LHS.  This still allows the  
chained-outer-joins style that is the normally optimizable case.  
  
I also tightened things up some more in join_is_legal().  It seems to me  
on review that what's really happening in the exception case where we  
ignore a mismatched special join is that we're allowing the proposed join  
to associate into the RHS of the outer join we're comparing it to.  As  
such, we should *always* insist that the proposed join be a left join,  
which eliminates a bunch of rather dubious argumentation.  The case where  
we weren't enforcing that was the one that was already known buggy anyway  
(it had a violatable Assert before the aforesaid commit) so it hardly  
deserves a lot of deference.  
  
Back-patch to all active branches, like the previous patch.  The added  
regression test case failed in all branches back to 9.1, and I think it's  
only an unrelated change in costing calculations that kept 9.0 from  
choosing a broken plan.  

M src/backend/optimizer/README
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix incorrect calculation in shm_mq_receive.

commit   : 6d9864d900e3651413a94e1f86a93f6a03f4dc42    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 6 Aug 2015 13:25:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 6 Aug 2015 13:25:45 -0400    

Click here for diff

If some, but not all, of the length word has already been read, and the  
next attempt to read sees exactly the number of bytes needed to complete  
the length word, or fewer, then we'll incorrectly read less than all of  
the available data.  
  
Antonin Houska  

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

Fix `make installcheck` for serializable transactions.

commit   : 680b82eea87291e7e14c03a647de654a65617f04    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 6 Aug 2015 10:35:14 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 6 Aug 2015 10:35:14 -0500    

Click here for diff

Commit e5550d5fec66aa74caad1f79b79826ec64898688 added some new  
tests for ALTER TABLE which involved table scans.  When  
default_transaction_isolation = 'serializable' these acquire  
relation-level SIReadLocks.  The test results didn't cope with  
that.  Add SIReadLock as the minimum lock level for purposes of  
these tests.  
  
This could also be fixed by excluding this type of lock from the  
my_locks view, but it would be a bug for SIReadLock to show up for  
a relation which was not otherwise locked, so do it this way to  
allow that sort of condition to cause a regression test failure.  
  
There is some question whether we could avoid taking SIReadLocks  
during these operations, but confirming the safety of that and  
figuring out how to avoid the locks is not trivial, and would be  
a separate patch.  
  
Backpatch to 9.4 where the new tests were added.  

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

Improve includes introduced in the replication origins patch.

commit   : 449b13313caf63c2db936cc46d8a25cfcd9a0d04    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Aug 2015 12:38:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Aug 2015 12:38:35 +0200    

Click here for diff

pg_resetxlog.h contained two superfluous includes, origin.h superfluously  
depended on logical.h, and pg_xlogdump's rmgrdesc.h only indirectly  
included origin.h.  
  
Backpatch: 9.5, where replication origins were introduced.  

M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_xlogdump/rmgrdesc.c
M src/include/replication/origin.h

Reconcile nodes/*funcs.c with recent work.

commit   : 4877281f3a1640577bedd1e92a83931469284368    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:44:27 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:44:27 -0400    

Click here for diff

A few of the discrepancies had semantic significance, but I did not  
track down the resulting user-visible bugs, if any.  Back-patch to 9.5,  
where all but one discrepancy appeared.  The _equalCreateEventTrigStmt()  
situation dates to 9.3 but does not affect semantics.  
  
catversion bump due to readfuncs.c field order changes.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h

commit   : 2fcedad3cac54ec01034f3e225dd7915e59ff8ff    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:43:07 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 5 Aug 2015 20:43:07 -0400    

Click here for diff

Commit 0ffc201a51395ca71fe429ef86c872850a5850ee included this object  
unconditionally.  Being unprepared for that, most external, single-file  
modules failed to build.  This better aligns the GNU make build system  
with the heuristic in the MSVC build's Project::AddDirResourceFile().  
In-tree, installed modules set PGFILEDESC, so they will see no change.  
Also, under PGXS, omit the nonfunctioning rule to build win32ver.rc.  
Back-patch to 9.5, where the aforementioned commit first appeared.  

M src/makefiles/Makefile.win32
M src/makefiles/pgxs.mk

Fix BRIN to use SnapshotAny during summarization

commit   : 94a8b45feb3019d2e6b04806415dd8bc85994706    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Aug 2015 16:20:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Aug 2015 16:20:50 -0300    

Click here for diff

For correctness of summarization results, it is critical that the  
snapshot used during the summarization scan is able to see all tuples  
that are live to all transactions -- including tuples inserted or  
deleted by in-progress transactions.  Otherwise, it would be possible  
for a transaction to insert a tuple, then idle for a long time while a  
concurrent transaction executes summarization of the range: this would  
result in the inserted value not being considered in the summary.  
Previously we were trying to use a MVCC snapshot in conjunction with  
adding a "placeholder" tuple in the index: the snapshot would see all  
committed tuples, and the placeholder tuple would catch insertions by  
any new inserters.  The hole is that prior insertions by transactions  
that are still in progress by the time the MVCC snapshot was taken were  
ignored.  
  
Kevin Grittner reported this as a bogus error message during vacuum with  
default transaction isolation mode set to repeatable read (because the  
error report mentioned a function name not being invoked during), but  
the problem is larger than that.  
  
To fix, tweak IndexBuildHeapRangeScan to have a new mode that behaves  
the way we need using SnapshotAny visibility rules.  This change  
simplifies the BRIN code a bit, mainly by removing large comments that  
were mistaken.  Instead, rely on the SnapshotAny semantics to provide  
what it needs.  (The business about a placeholder tuple needs to remain:  
that covers the case that a transaction inserts a a tuple in a page that  
summarization already scanned.)  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
  
In passing, remove a couple of unused declarations from brin.h and  
reword a comment to be proper English.  This part submitted by Kevin  
Grittner.  
  
Backpatch to 9.5, where BRIN was introduced.  

M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/include/access/brin.h
M src/include/catalog/index.h
A src/test/isolation/expected/brin-1.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/brin-1.spec

Make real sure we don't reassociate joins into or out of SEMI/ANTI joins.

commit   : 06663971bba43ea967daf00fff0b70ee066c3a13    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Aug 2015 14:39:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Aug 2015 14:39:07 -0400    

Click here for diff

Per the discussion in optimizer/README, it's unsafe to reassociate anything  
into or out of the RHS of a SEMI or ANTI join.  An example from Piotr  
Stefaniak showed that join_is_legal() wasn't sufficiently enforcing this  
rule, so lock it down a little harder.  
  
I couldn't find a reasonably simple example of the optimizer trying to  
do this, so no new regression test.  (Piotr's example involved the random  
search in GEQO accidentally trying an invalid case and triggering a sanity  
check way downstream in clause selectivity estimation, which did not seem  
like a sequence of events that would be useful to memorialize in a  
regression test as-is.)  
  
Back-patch to all active branches.  

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

Fix debug message output when connecting to a logical slot.

commit   : 34a4318e7d64d93d48add738257ae0f6289799f6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:26:01 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:26:01 +0200    

Click here for diff

Previously the message erroneously printed the same LSN twice as the  
assignment to the start_lsn variable was before the message. Correct  
that.  
  
Reported-By: Marko Tiikkaja  
Author: Marko Tiikkaja  
Backpatch: 9.5, where logical decoding was introduced  

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

Fix comment atomics.h.

commit   : 04521eba3f024fdc226d6f0465e2bba7d37828a7    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:06:04 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Aug 2015 13:06:04 +0200    

Click here for diff

I appear to accidentally have switched the comments for  
pg_atomic_write_u32 and pg_atomic_read_u32 around. Also fix some minor  
typos I found while fixing.  
  
Noticed-By: Amit Kapila  
Backpatch: 9.5  

M src/include/port/atomics.h

Docs: add an explicit example about controlling overall greediness of REs.

commit   : 5c499d5cd2da2fd67f1b234a2994dd940f28fbc2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 21:09:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 21:09:12 -0400    

Click here for diff

Per discussion of bug #13538.  

M doc/src/sgml/func.sgml

Fix pg_dump to dump shell types.

commit   : 1f507c7e9dc5b2e8373018fea2f002531c9c1d3a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 19:34:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 19:34:12 -0400    

Click here for diff

Per discussion, it really ought to do this.  The original choice to  
exclude shell types was probably made in the dark ages before we made  
it harder to accidentally create shell types; but that was in 7.3.  
  
Also, cause the standard regression tests to leave a shell type behind,  
for convenience in testing the case in pg_dump and pg_upgrade.  
  
Back-patch to all supported branches.  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/test/regress/expected/create_type.out
M src/test/regress/sql/create_type.sql

Fix bogus "out of memory" reports in tuplestore.c.

commit   : e2035dc9a7a8056eab7c33a1c677cd25312eb312    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 18:18:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 18:18:46 -0400    

Click here for diff

The tuplesort/tuplestore memory management logic assumed that the chunk  
allocation overhead for its memtuples array could not increase when  
increasing the array size.  This is and always was true for tuplesort,  
but we (I, I think) blindly copied that logic into tuplestore.c without  
noticing that the assumption failed to hold for the much smaller array  
elements used by tuplestore.  Given rather small work_mem, this could  
result in an improper complaint about "unexpected out-of-memory situation",  
as reported by Brent DeSpain in bug #13530.  
  
The easiest way to fix this is just to increase tuplestore's initial  
array size so that the assumption holds.  Rather than relying on magic  
constants, though, let's export a #define from aset.c that represents  
the safe allocation threshold, and make tuplestore's calculation depend  
on that.  
  
Do the same in tuplesort.c to keep the logic looking parallel, even though  
tuplesort.c isn't actually at risk at present.  This will keep us from  
breaking it if we ever muck with the allocation parameters in aset.c.  
  
Back-patch to all supported versions.  The error message doesn't occur  
pre-9.3, not so much because the problem can't happen as because the  
pre-9.3 tuplestore code neglected to check for it.  (The chance of  
trouble is a great deal larger as of 9.3, though, due to changes in the  
array-size-increasing strategy.)  However, allowing LACKMEM() to become  
true unexpectedly could still result in less-than-desirable behavior,  
so let's patch it all the way back.  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/include/utils/memutils.h

commit   : a6f43986bf5a6a5b36c899aa9b12f26e5fab687e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 14:55:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2015 14:55:32 -0400    

Click here for diff

In commit b514a7460d9127ddda6598307272c701cbb133b7, I changed the planner  
so that it would allow nestloop paths to remain partially parameterized,  
ie the inner relation might need parameters from both the current outer  
relation and some upper-level outer relation.  That's fine so long as we're  
talking about distinct parameters; but the patch also allowed creation of  
nestloop paths for cases where the inner relation's parameter was a  
PlaceHolderVar whose eval_at set included the current outer relation and  
some upper-level one.  That does *not* work.  
  
In principle we could allow such a PlaceHolderVar to be evaluated at the  
lower join node using values passed down from the upper relation along with  
values from the join's own outer relation.  However, nodeNestloop.c only  
supports simple Vars not arbitrary expressions as nestloop parameters.  
createplan.c is also a few bricks shy of being able to handle such cases;  
it misplaces the PlaceHolderVar parameters in the plan tree, which is why  
the visible symptoms of this bug are "plan should not reference subplan's  
variable" and "failed to assign all NestLoopParams to plan nodes" planner  
errors.  
  
Adding the necessary complexity to make this work doesn't seem like it  
would be repaid in significantly better plans, because in cases where such  
a PHV exists, there is probably a corresponding join order constraint that  
would allow a good plan to be found without using the star-schema exception.  
Furthermore, adding complexity to nodeNestloop.c would create a run-time  
penalty even for plans where this whole consideration is irrelevant.  
So let's just reject such paths instead.  
  
Per fuzz testing by Andreas Seltenreich; the added regression test is based  
on his example query.  Back-patch to 9.2, like the previous patch.  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Cap wal_buffers to avoid a server crash when it's set very large.

commit   : cd52e4a2b945403659219350c4d4c6e6539a1e11    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 12:58:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 12:58:54 -0400    

Click here for diff

It must be possible to multiply wal_buffers by XLOG_BLCKSZ without  
overflowing int, or calculations in StartupXLOG will go badly wrong  
and crash the server.  Avoid that by imposing a maximum value on  
wal_buffers.  This will be just under 2GB, assuming the usual value  
for XLOG_BLCKSZ.  
  
Josh Berkus, per an analysis by Andrew Gierth.  

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

Update comment to match behavior of latest code.

commit   : 9d7d0e640c21bfa36e1eeb7e7c9fcdbb2cfb9763    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 11:45:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Aug 2015 11:45:29 -0400    

Click here for diff

Peter Geoghegan  

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

Stamp 9.5alpha2.

commit   : 6bd01f082b2de4a502173e2d48a728c131f35a02    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 16:34:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 16:34:55 -0400    

Click here for diff

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

RLS: Keep deny policy when only restrictive exist

commit   : 8f439658524d4a3566682ff9e25d4791c5498e53    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 3 Aug 2015 15:32:49 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 3 Aug 2015 15:32:49 -0400    

Click here for diff

Only remove the default deny policy when a permissive policy exists  
(either from the hook or defined by the user).  If only restrictive  
policies exist then no rows will be visible, as restrictive policies  
shouldn't make rows visible.  To address this requirement, a single  
"USING (true)" permissive policy can be created.  
  
Update the test_rls_hooks regression tests to create the necessary  
"USING (true)" permissive policy.  
  
Back-patch to 9.5 where RLS was added.  
  
Per discussion with Dean.  

M src/backend/rewrite/rowsecurity.c
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/modules/test_rls_hooks/sql/test_rls_hooks.sql
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Translation updates

commit   : 58b30d9829ce9c3273e8ca32be62ebc2fd0e8153    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Aug 2015 14:10:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Aug 2015 14:10:33 -0400    

Click here for diff

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

M src/backend/po/es.po
M src/backend/po/it.po
M src/backend/po/ru.po
M src/bin/initdb/po/it.po
M src/bin/initdb/po/ru.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/it.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_resetxlog/po/it.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/po/it.po
A src/bin/pg_rewind/po/ru.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/it.po
M src/bin/scripts/po/ru.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/it.po
M src/interfaces/libpq/po/ru.po
M src/pl/plpgsql/src/po/it.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpython/po/it.po

Update 9.5 release notes through today.

commit   : 11daccb445260de9ce03e4408ac7d908545b3319    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 12:29:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 12:29:11 -0400    

Click here for diff

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

Fix psql \d output of policies.

commit   : 8f45a58d394bbe83c54306ba769ac02c9239c259    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 3 Aug 2015 09:08:01 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 3 Aug 2015 09:08:01 -0700    

Click here for diff

psql neglected to wrap parenthesis around USING and WITH CHECK  
expressions -- fixed. Back-patched to 9.5 where RLS policies were  
introduced.  

M src/bin/psql/describe.c

Make recovery rename tablespace_map to *.old if backup_label is not present.

commit   : 46e9019bbce96c309d27d4b164bf9a2d0d8292eb    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 3 Aug 2015 23:04:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 3 Aug 2015 23:04:41 +0900    

Click here for diff

If tablespace_map file is present without backup_label file, there is  
no use of such file.  There is no harm in retaining it, but it is better  
to get rid of the map file so that we don't have any redundant file  
in data directory and it will avoid any sort of confusion. It seems  
prudent though to just rename the file out of the way rather than  
delete it completely, also we ignore any error that occurs in rename  
operation as even if map file is present without backup_label file,  
it is harmless.  
  
Back-patch to 9.5 where tablespace_map file was introduced.  
  
Amit Kapila, reviewed by Robert Haas, Alvaro Herrera and me.  

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

Fix pg_rewind when pg_xlog is a symlink.

commit   : 615b69595525385bbf050a170912b7671cacc5c8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 15:23:56 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 15:23:56 +0300    

Click here for diff

pg_xlog is often a symlink, typically to a different filesystem. Don't  
get confused and comlain about by that, and just always pretend that it's a  
normal directory, even if it's really a symlink.  
  
Also add a test case for this.  
  
Backpatch to 9.5.  

M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
A src/bin/pg_rewind/t/004_pg_xlog_symlink.pl

Clean up pg_rewind regression test script.

commit   : 2b917a58aec17ca5cf64196ee1d5d77ef8635caf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 13:06:47 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 3 Aug 2015 13:06:47 +0300    

Click here for diff

Since commit 01f6bb4b2, TestLib.pm has exported path to tmp_check directory,  
so let's use that also for the pg_rewind test clusters etc.  
  
Also, in master, the $tempdir_short variable has not been used since commit  
13d856e17, which moved the initdb-running code to TestLib.pm.  
  
Backpatch to 9.5.  

M src/bin/pg_rewind/RewindTest.pm

Make modules/test_ddl_deparse/.gitignore match its siblings.

commit   : 642ae4ee7dcb9b48a4abd1f02a46ff4d71aef931    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 00:02:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2015 00:02:26 -0400    

Click here for diff

Not sure why /tmp_check/ was omitted from this one, but even if it  
isn't really needed right now, it's inconsistent not to include it.  

M src/test/modules/test_ddl_deparse/.gitignore

contrib/isn now needs a .gitignore file.

commit   : 61015249259462020629703a4990234c4629cbee    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:57:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:57:32 -0400    

Click here for diff

Oversight in commit cb3384a0cb4cf900622b77865f60e31259923079.  
Back-patch to 9.1, like that commit.  

A contrib/isn/.gitignore

Fix a number of places that produced XX000 errors in the regression tests.

commit   : 89e80b03297555277473fc3978b83c68ec9847b8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:49:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 23:49:19 -0400    

Click here for diff

It's against project policy to use elog() for user-facing errors, or to  
omit an errcode() selection for errors that aren't supposed to be "can't  
happen" cases.  Fix all the violations of this policy that result in  
ERRCODE_INTERNAL_ERROR log entries during the standard regression tests,  
as errors that can reliably be triggered from SQL surely should be  
considered user-facing.  
  
I also looked through all the files touched by this commit and fixed  
other nearby problems of the same ilk.  I do not claim to have fixed  
all violations of the policy, just the ones in these files.  
  
In a few places I also changed existing ERRCODE choices that didn't  
seem particularly appropriate; mainly replacing ERRCODE_SYNTAX_ERROR  
by something more specific.  
  
Back-patch to 9.5, but no further; changing ERRCODE assignments in  
stable branches doesn't seem like a good idea.  

M contrib/tablefunc/tablefunc.c
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/commands/copy.c
M src/backend/commands/vacuum.c
M src/backend/executor/execQual.c
M src/backend/utils/adt/txid.c
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/tcl/pltcl.c
M src/test/regress/expected/txid.out
M src/test/regress/regress.c

Avoid calling memcpy() with a NULL source pointer and count == 0.

commit   : c75b1f75b3d159c0e71c1ec7f42c922bce448d89    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 15:48:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 15:48:27 -0400    

Click here for diff

As in commit 0a52d378b03b7d5a, avoid doing something that has undefined  
results according to the C standard, even though in practice there does  
not seem to be any problem with it.  
  
This fixes two places in numeric.c that demonstrably could call memcpy()  
with such arguments.  I looked through that file and didn't see any other  
places with similar hazards; this is not to claim that there are not such  
places in other files.  
  
Per report from Piotr Stefaniak.  Back-patch to 9.5 which is where the  
previous commit was added.  We're more or less setting a precedent that  
we will not worry about this type of issue in pre-9.5 branches unless  
someone demonstrates a problem in the field.  

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

Fix output of ISBN-13 numbers beginning with 979.

commit   : ea8385df6ce95507951f6c12fa4defb5b3ba9cda    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 22:12:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 22:12:33 +0300    

Click here for diff

An EAN beginning with 979 (but not 9790 - those are ISMN's) are accepted  
as ISBN numbers, but they cannot be represented in the old, 10-digit ISBN  
format. They must be output in the new 13-digit ISBN-13 format. We printed  
out an incorrect value for those.  
  
Also add a regression test, to test this and some other basic functionality  
of the module.  
  
Patch by Fabien Coelho. This fixes bug #13442, reported by B.Z. Backpatch  
to 9.1, where we started to recognize ISBN-13 numbers.  

M contrib/isn/Makefile
A contrib/isn/expected/isn.out
M contrib/isn/isn.c
A contrib/isn/sql/isn.sql

Fix incorrect order of lock file removal and failure to close() sockets.

commit   : 72697d2ba77074713cd4008995a97cf284de1712    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 14:54:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2015 14:54:44 -0400    

Click here for diff

Commit c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 accidentally broke the  
order of operations during postmaster shutdown: it resulted in removing  
the per-socket lockfiles after, not before, postmaster.pid.  This creates  
a race-condition hazard for a new postmaster that's started immediately  
after observing that postmaster.pid has disappeared; if it sees the  
socket lockfile still present, it will quite properly refuse to start.  
This error appears to be the explanation for at least some of the  
intermittent buildfarm failures we've seen in the pg_upgrade test.  
  
Another problem, which has been there all along, is that the postmaster  
has never bothered to close() its listen sockets, but has just allowed them  
to close at process death.  This creates a different race condition for an  
incoming postmaster: it might be unable to bind to the desired listen  
address because the old postmaster is still incumbent.  This might explain  
some odd failures we've seen in the past, too.  (Note: this is not related  
to the fact that individual backends don't close their client communication  
sockets.  That behavior is intentional and is not changed by this patch.)  
  
Fix by adding an on_proc_exit function that closes the postmaster's ports  
explicitly, and (in 9.3 and up) reshuffling the responsibility for where  
to unlink the Unix socket files.  Lock file unlinking can stay where it  
is, but teach it to unlink the lock files in reverse order of creation.  

M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/libpq.h

Fix race condition that lead to WALInsertLock deadlock with commit_delay.

commit   : 54f23a45f3742e9533dbfa7c1177f02f116b0457    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 20:08:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 2 Aug 2015 20:08:10 +0300    

Click here for diff

If a call to WaitForXLogInsertionsToFinish() returned a value in the middle  
of a page, and another backend then started to insert a record to the same  
page, and then you called WaitXLogInsertionsToFinish() again, the second  
call might return a smaller value than the first call. The problem was in  
GetXLogBuffer(), which always updated the insertingAt value to the  
beginning of the requested page, not the actual requested location. Because  
of that, the second call might return a xlog pointer to the beginning of  
the page, while the first one returned a later position on the same page.  
XLogFlush() performs two calls to WaitXLogInsertionsToFinish() in  
succession, and holds WALWriteLock on the second call, which can deadlock  
if the second call to WaitXLogInsertionsToFinish() blocks.  
  
Reported by Spiros Ioannou. Backpatch to 9.4, where the more scalable  
WALInsertLock mechanism, and this bug, was introduced.  

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

Micro optimize LWLockAttemptLock() a bit.

commit   : 9074e41dbd41bc45ef79aeac1b6496bf087509a7    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:50:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:50:35 +0200    

Click here for diff

LWLockAttemptLock pointlessly read the lock's state in every loop  
iteration, even though pg_atomic_compare_exchange_u32() returns the old  
value. Instead do that only once before the loop iteration.  
  
Additionally there's no need to have the expected_state variable,  
old_state mostly had the same value anyway.  
  
Noticed-By: Heikki Linnakangas  
Backpatch: 9.5, no reason to let the branches diverge at this point  

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

Fix issues around the "variable" support in the lwlock infrastructure.

commit   : 27b719173516b54df63a1bba4266798e9f77bbb9    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:20:43 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 Jul 2015 20:20:43 +0200    

Click here for diff

The lwlock scalability work introduced two race conditions into the  
lwlock variable support provided for xlog.c. First, and harmlessly on  
most platforms, it set/read the variable without the spinlock in some  
places. Secondly, due to the removal of the spinlock, it was possible  
that a backend missed changes to the variable's state if it changed in  
the wrong moment because checking the lock's state, the variable's state  
and the queuing are not protected by a single spinlock acquisition  
anymore.  
  
To fix first move resetting the variable's from LWLockAcquireWithVar to  
WALInsertLockRelease, via a new function LWLockReleaseClearVar. That  
prevents issues around waiting for a variable's value to change when a  
new locker has acquired the lock, but not yet set the value. Secondly  
re-check that the variable hasn't changed after enqueing, that prevents  
the issue that the lock has been released and already re-acquired by the  
time the woken up backend checks for the lock's state.  
  
Reported-By: Jeff Janes  
Analyzed-By: Heikki Linnakangas  
Reviewed-By: Heikki Linnakangas  
Discussion: [email protected]  
Backpatch: 9.5, where the lwlock scalability went in  

M src/backend/access/transam/xlog.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Fix some planner issues with degenerate outer join clauses.

commit   : 7968238eb17ed5f2f1123271549b7921fa1d3aba    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 20:57:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 20:57:41 -0400    

Click here for diff

An outer join clause that didn't actually reference the RHS (perhaps only  
after constant-folding) could confuse the join order enforcement logic,  
leading to wrong query results.  Also, nested occurrences of such things  
could trigger an Assertion that on reflection seems incorrect.  
  
Per fuzz testing by Andreas Seltenreich.  The practical use of such cases  
seems thin enough that it's not too surprising we've not heard field  
reports about it.  
  
This has been broken for a long time, so back-patch to all active branches.  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Teach predtest.c that "foo" implies "foo IS NOT NULL".

commit   : 8dccf030e884ea8c723275a070acf8a8ed1eebe1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 14:31:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Aug 2015 14:31:46 -0400    

Click here for diff

Per complaint from Peter Holzer.  It's useful to cover this special case,  
since for a boolean variable "foo", earlier parts of the planner will have  
reduced variants like "foo = true" to just "foo", and thus we may fail  
to recognize the applicability of a partial index with predicate  
"foo IS NOT NULL".  
  
Back-patch to 9.5, but not further; given the lack of previous complaints  
this doesn't seem like behavior to change in stable branches.  

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

Fix an oversight in checking whether a join with LATERAL refs is legal.

commit   : edf26ed033f18bddc9bfe5c239388330150766a1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2015 19:26:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2015 19:26:33 -0400    

Click here for diff

In many cases, we can implement a semijoin as a plain innerjoin by first  
passing the righthand-side relation through a unique-ification step.  
However, one of the cases where this does NOT work is where the RHS has  
a LATERAL reference to the LHS; that makes the RHS dependent on the LHS  
so that unique-ification is meaningless.  joinpath.c understood this,  
and so would not generate any join paths of this kind ... but join_is_legal  
neglected to check for the case, so it would think that we could do it.  
The upshot would be a "could not devise a query plan for the given query"  
failure once we had failed to generate any join paths at all for the bogus  
join pair.  
  
Back-patch to 9.3 where LATERAL was added.  

M src/backend/optimizer/path/joinrels.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Consolidate makefile code for setting top_srcdir, srcdir and VPATH.

commit   : c7446194fa8fbbb9e8d948668bb47563ab58f45f    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 30 Jul 2015 20:48:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 30 Jul 2015 20:48:41 -0400    

Click here for diff

Responsibility was formerly split between Makefile.global and pgxs.mk.  
As a result of commit b58233c71b93a32fcab7219585cafc25a27eb769, in the  
PGXS case, these variables were unset while parsing Makefile.global and  
callees.  Inclusion of Makefile.custom did not work from PGXS, and the  
subtle difference seemed like a recipe for future bugs.  Back-patch to  
9.4, where that commit first appeared.  

M src/Makefile.global.in
M src/makefiles/pgxs.mk

Fix volatility marking of commit timestamp functions

commit   : 71b66e78e432d99325db6356f056cb3f03b3d7b7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:19:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:19:49 -0300    

Click here for diff

They are marked stable, but since they act on instantaneous state and it  
is possible to consult state of transactions as they commit, the results  
could change mid-query.  They need to be marked volatile, and this  
commit does so.  
  
There would normally be a catversion bump here, but this is so much a  
niche feature and I don't believe there's real damage from the incorrect  
marking, that I refrained.  
  
Backpatch to 9.5, where commit timestamps where introduced.  
  
Per note from Fujii Masao.  

M src/include/catalog/pg_proc.h

Fix broken assertion in BRIN code

commit   : 244c378e243e3649efc99fe96ec9f123bbe9ffbc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:07:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jul 2015 15:07:19 -0300    

Click here for diff

The code was assuming that any NULL value in scan keys was due to IS  
NULL or IS NOT NULL, but it turns out to be possible to get them with  
other operators too, if they are used in contrived-enough ways.  Easiest  
way out of the problem seems to check explicitely for the IS NOT NULL  
flag, instead of assuming it must be set if the IS NULL flag is not set,  
when a null scan key is found; if neither flag is set, follow the lead  
of other index AMs and assume that all indexable operators must be  
strict, and thus the query is never satisfiable.  
  
Also, add a comment to try and lure some future hacker into improving  
analysis of scan keys in brin.  
  
Per report from Andreas Seltenreich; diagnosis by Tom Lane.  
Backpatch to 9.5.  
  
Discussion: http://www.postgresql.org/message-id/[email protected]  

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

Improve CREATE FUNCTION doc WRT to LEAKPROOF RLS interaction.

commit   : 7be60a2459135199f8edff7f553b6d551729d79f    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 10:16:49 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 10:16:49 -0700    

Click here for diff

Patch by Dean Rasheed. Back-patched to 9.5 where RLS was introduced.  

M doc/src/sgml/ref/create_function.sgml

Use appropriate command type when retrieving relation's policies.

commit   : 23b5e726da6ef5ebbc1dbc821320ee35fa1d0737    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 09:38:13 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 30 Jul 2015 09:38:13 -0700    

Click here for diff

When retrieving policies, if not working on the root target relation,  
we actually want the relation's SELECT policies, regardless of  
the top level query command type. For example in UPDATE t1...FROM t2  
we need to apply t1's UPDATE policies and t2's SELECT policies.  
Previously top level query command type was applied to all relations,  
which was wrong. Add some regression coverage to ensure we don't  
violate this principle in the future.  
  
Report and patch by Dean Rasheed. Cherry picked from larger refactoring  
patch and tweaked by me. Back-patched to 9.5 where RLS was introduced.  

M src/backend/rewrite/rowsecurity.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Avoid some zero-divide hazards in the planner.

commit   : e91a1643ac723477d6ec2d47c8486cd0013660bb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jul 2015 12:11:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jul 2015 12:11:23 -0400    

Click here for diff

Although I think on all modern machines floating division by zero  
results in Infinity not SIGFPE, we still don't want infinities  
running around in the planner's costing estimates; too much risk  
of that leading to insane behavior.  
  
grouping_planner() failed to consider the possibility that final_rel  
might be known dummy and hence have zero rowcount.  (I wonder if it  
would be better to set a rows estimate of 1 for dummy relations?  
But at least in the back branches, changing this convention seems  
like a bad idea, so I'll leave that for another day.)  
  
Make certain that get_variable_numdistinct() produces a nonzero result.  
The case that can be shown to be broken is with stadistinct < 0.0 and  
small ntuples; we did not prevent the result from rounding to zero.  
For good luck I applied clamp_row_est() to all the nonconstant return  
values.  
  
In ExecChooseHashTableSize(), Assert that we compute positive nbuckets  
and nbatch.  I know of no reason to think this isn't the case, but it  
seems like a good safety check.  
  
Per reports from Piotr Stefaniak.  Back-patch to all active branches.  

M src/backend/executor/nodeHash.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/adt/selfuncs.c

Fix calculation of latency of pgbench backslash commands.

commit   : 2e75be6660dbaaf2da09b98c54d47c9fe0ac8cfa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Jul 2015 14:50:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Jul 2015 14:50:51 +0300    

Click here for diff

When we loop back to the top of doCustom after processing a backslash  
command, we must reset the "now" timestamp, because that's used to  
calculate the time spent executing the previous command.  
  
Report and fix by Fabien Coelho. Backpatch to 9.5, where this was broken.  

M src/bin/pgbench/pgbench.c

Blacklist xlc 32-bit inlining.

commit   : a664d4790e5f93726f264c77c044a7ce4c1a675c    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:48 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:48 -0400    

Click here for diff

Per a suggestion from Tom Lane.  Back-patch to 9.0 (all supported  
versions).  While only 9.4 and up have code known to elicit this  
compiler bug, we were disabling inlining by accident until commit  
43d89a23d59c487bc9258fad7a6187864cb8c0c0.  

M config/test_quiet_include.h

Remove redundant "make install" from pg_upgrade test suite.

commit   : 1471c0e27c2f71bed551463e8072da9c01c63dae    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:36 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:49:36 -0400    

Click here for diff

A top-level "make install" includes pg_upgrade since commit  
9fa8b0ee90c44c0f97d16bf65e94322988c94864.  Back-patch to 9.5, where that  
commit first appeared.  

M src/bin/pg_upgrade/test.sh

MSVC: Revert most 9.5 changes to pre-9.5 vcregress.pl tests.

commit   : fdb8ea9366785d7e2a31469c1389ca8a6f11889f    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:56 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:56 -0400    

Click here for diff

The reverted changes did not narrow the semantic gap between the MSVC  
build system and the GNU make build system.  For targets old and new  
that run multiple suites (contribcheck, modulescheck, tapcheck), restore  
vcregress.pl to mimicking "make -k" rather than the "make -S" default.  
Lack of "-k" would be more burdensome than lack of "-S".  Keep changes  
reflecting contemporary changes to the GNU make build system, and keep  
updates to Makefile parsing.  Keep the loss of --psqldir in "check" and  
"ecpgcheck" targets; it had been a no-op when used alongside  
--temp-install.  No log message mentioned any of the reverted changes.  
Based on a germ by Michael Paquier.  Back-patch to 9.5.  

M src/tools/msvc/vcregress.pl

MSVC: Remove duplicate PATH entry in test harness.

commit   : 95eb4b265502c26c9f72f0f554df41e273551858    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:43 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:43 -0400    

Click here for diff

Back-patch to 9.5, where commit 4cb7d671fddc8855c8def2de51fb23df1c8ac0af  
introduced it.  

M src/tools/msvc/vcregress.pl

MSVC: Future-proof installation file skip logic.

commit   : f7dca86fc3a2c423824a2056994319c348992913    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:25 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 29 Jul 2015 22:48:25 -0400    

Click here for diff

This code relied on knowing exactly where in the source tree temporary  
installations might appear.  A reasonable hacker may not think to update  
this code when adding use of a temporary installation, making it  
fragile.  Observe that commit 9fa8b0ee90c44c0f97d16bf65e94322988c94864  
broke it unnoticed, and commit dcae5faccab64776376d354decda0017c648bb53  
fixed it unnoticed.  Back-patch to 9.5 only; use of temporary  
installations is unlikely to change in released versions.  

M src/tools/msvc/Install.pm

Create new ParseExprKind for use by policy expressions.

commit   : 43797ed42a7c0365c9143ad6efdc566ac9d93fd8    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 15:41:00 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 15:41:00 -0700    

Click here for diff

Policy USING and WITH CHECK expressions were using EXPR_KIND_WHERE for  
parse analysis, which results in inappropriate ERROR messages when  
the expression contains unsupported constructs such as aggregates.  
Create a new ParseExprKind called EXPR_KIND_POLICY and tailor the  
related messages to fit.  
  
Reported by Noah Misch. Reviewed by Dean Rasheed, Alvaro Herrera,  
and Robert Haas. Back-patch to 9.5 where RLS was introduced.  

M src/backend/commands/policy.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/include/parser/parse_node.h
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Add some test coverage of EvalPlanQual with non-locked tables.

commit   : 3ef1a682d5e4a919dcaddc8256ea65de91654d1c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jul 2015 13:27:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jul 2015 13:27:15 -0400    

Click here for diff

A Salesforce colleague of mine griped that the regression tests don't  
exercise EvalPlanQualFetchRowMarks() and allied routines.  Which is  
a fair complaint.  Add test cases that go through the REFERENCE and COPY  
code paths.  Unfortunately we don't have sufficient infrastructure right  
now to exercise the FDW code path in the isolation tests, but this is  
surely better than before.  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Add missing post create and alter hooks to policy objects.

commit   : 0bfbf14f93c30ec8f505baba79625f5a3b010405    
  
author   : Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 09:39:28 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Wed, 29 Jul 2015 09:39:28 -0700    

Click here for diff

AlterPolicy() and CreatePolicy() lacked their respective hook invocations.  
Noted by Noah Misch, review by Dean Rasheed. Back-patch to 9.5 where  
RLS was introduced.  

M src/backend/commands/policy.c

Remove outdated comment in LWLockDequeueSelf's header.

commit   : 81191f65820d3cf29ea94fe7f65c065e8c6a296c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Jul 2015 10:14:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Jul 2015 10:14:32 +0200    

Click here for diff

Noticed-By: Robert Haas  
Backpatch: 9.5, where the function was added  

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

Fix typo in comment.

commit   : 6f1789a475fe2726f8ade5ecd3aa14223b130fb1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 10:55:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Jul 2015 10:55:43 +0300    

Click here for diff

Amit Langote  

M src/backend/commands/tablecmds.c

Prevent platform-dependent output row ordering in a new test query.

commit   : d7f0bb8cc7f4b43830499e89384befc3690b1560    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 20:00:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 20:00:13 -0400    

Click here for diff

Buildfarm indicates this is necessary.  

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

Suppress "variable may be used uninitialized" warning.

commit   : cab23771eb0250fe8e2ad179cf10ef965658f3e7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 19:55:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 19:55:59 -0400    

Click here for diff

Also re-pgindent, just because I'm a neatnik.  

M src/backend/commands/policy.c

Disallow converting a table to a view if row security is present.

commit   : 344703bcc453ac3ce0060785d4958ddec7d2dbe9    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:24:09 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:24:09 -0700    

Click here for diff

When DefineQueryRewrite() is about to convert a table to a view, it checks  
the table for features unavailable to views.  For example, it rejects tables  
having triggers.  It omits to reject tables having relrowsecurity or a  
pg_policy record. Fix that. To faciliate the repair, invent  
relation_has_policies() which indicates the presence of policies on a  
relation even when row security is disabled for that relation.  
  
Reported by Noah Misch. Patch by me, review by Stephen Frost. Back-patch  
to 9.5 where RLS was introduced.  

M src/backend/commands/policy.c
M src/backend/rewrite/rewriteDefine.c
M src/include/commands/policy.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Create a pg_shdepend entry for each role in TO clause of policies.

commit   : 992c9d345f6607c5b2cab2787f7cf72fba96673d    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:01:56 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 16:01:56 -0700    

Click here for diff

CreatePolicy() and AlterPolicy() omit to create a pg_shdepend entry for  
each role in the TO clause. Fix this by creating a new shared dependency  
type called SHARED_DEPENDENCY_POLICY and assigning it to each role.  
  
Reported by Noah Misch. Patch by me, reviewed by Alvaro Herrera.  
Back-patch to 9.5 where RLS was introduced.  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/policy.c
M src/include/catalog/dependency.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Update our documentation concerning where to create data directories.

commit   : 28b11bd1069ed35f45125b4057780cc55b9d716a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 18:42:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 18:42:59 -0400    

Click here for diff

Although initdb has long discouraged use of a filesystem mount-point  
directory as a PG data directory, this point was covered nowhere in the  
user-facing documentation.  Also, with the popularity of pg_upgrade,  
we really need to recommend that the PG user own not only the data  
directory but its parent directory too.  (Without a writable parent  
directory, operations such as "mv data data.old" fail immediately.  
pg_upgrade itself doesn't do that, but wrapper scripts for it often do.)  
  
Hence, adjust the "Creating a Database Cluster" section to address  
these points.  I also took the liberty of wordsmithing the discussion  
of NFS a bit.  
  
These considerations aren't by any means new, so back-patch to all  
supported branches.  

M doc/src/sgml/runtime.sgml

Only adjust negative indexes in json_get up to the length of the path.

commit   : 40a50a17b905dae233ddb8bb36b7deff9e3abb16    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 17:54:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 17:54:13 -0400    

Click here for diff

The previous code resulted in memory access beyond the path bounds. The  
cure is to move it into a code branch that checks the value of lex_level  
is within the correct bounds.  
  
Bug reported and diagnosed by Piotr Stefaniak.  

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

Reduce chatter from signaling of autovacuum workers.

commit   : 116be6c17102a4b300037d3c565694cac0bcba90    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 17:34:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 17:34:00 -0400    

Click here for diff

Don't print a WARNING if we get ESRCH from a kill() that's attempting  
to cancel an autovacuum worker.  It's possible (and has been seen in the  
buildfarm) that the worker is already gone by the time we are able to  
execute the kill, in which case the failure is harmless.  About the only  
plausible reason for reporting such cases would be to help debug corrupted  
lock table contents, but this is hardly likely to be the most important  
symptom if that happens.  Moreover issuing a WARNING might scare users  
more than is warranted.  
  
Also, since sending a signal to an autovacuum worker is now entirely a  
routine thing, and the worker will log the query cancel on its end anyway,  
reduce the message saying we're doing that from LOG to DEBUG1 level.  
  
Very minor cosmetic cleanup as well.  
  
Since the main practical reason for doing this is to avoid unnecessary  
buildfarm failures, back-patch to all active branches.  

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

commit   : cfa928ff6f944ac101802718f64db942060187b1    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 13:21:37 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 28 Jul 2015 13:21:37 -0700    

Click here for diff

The pg_stats view is supposed to be restricted to only show rows  
about tables the user can read. However, it sometimes can leak  
information which could not otherwise be seen when row level security  
is enabled. Fix that by not showing pg_stats rows to users that would  
be subject to RLS on the table the row is related to. This is done  
by creating/using the newly introduced SQL visible function,  
row_security_active().  
  
Along the way, clean up three call sites of check_enable_rls(). The second  
argument of that function should only be specified as other than  
InvalidOid when we are checking as a different user than the current one,  
as in when querying through a view. These sites were passing GetUserId()  
instead of InvalidOid, which can cause the function to return incorrect  
results if the current user has the BYPASSRLS privilege and row_security  
has been set to OFF.  
  
Additionally fix a bug causing RI Trigger error messages to unintentionally  
leak information when RLS is enabled, and other minor cleanup and  
improvements. Also add WITH (security_barrier) to the definition of pg_stats.  
  
Bumped CATVERSION due to new SQL functions and pg_stats view definition.  
  
Back-patch to 9.5 where RLS was introduced. Reported by Yaroslav.  
Patch by Joe Conway and Dean Rasheed with review and input by  
Michael Paquier and Stephen Frost.  

M doc/src/sgml/func.sgml
M src/backend/access/index/genam.c
M src/backend/catalog/system_views.sql
M src/backend/executor/execMain.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/rls.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/miscadmin.h
M src/include/utils/builtins.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rowsecurity.sql

Remove ssl renegotiation support.

commit   : 6087d952b31fce56642e1c63cfed243aeb4d09bd    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 28 Jul 2015 21:39:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 28 Jul 2015 21:39:32 +0200    

Click here for diff

While postgres' use of SSL renegotiation is a good idea in theory, it  
turned out to not work well in practice. The specification and openssl's  
implementation of it have lead to several security issues. Postgres' use  
of renegotiation also had its share of bugs.  
  
Additionally OpenSSL has a bunch of bugs around renegotiation, reported  
and open for years, that regularly lead to connections breaking with  
obscure error messages. We tried increasingly complex workarounds to get  
around these bugs, but we didn't find anything complete.  
  
Since these connection breakages often lead to hard to debug problems,  
e.g. spuriously failing base backups and significant latency spikes when  
synchronous replication is used, we have decided to change the default  
setting for ssl renegotiation to 0 (disabled) in the released  
backbranches and remove it entirely in 9.5 and master.  
  
Author: Andres Freund  
Discussion: [email protected]  
Backpatch: 9.5 and master, 9.0-9.4 get a different patch  

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

Make tap tests store postmaster logs and handle vpaths correctly

commit   : da7db24cc22e3f0d96cfda134f3ed194279bb513    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 16:04:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 16:04:05 -0400    

Click here for diff

Given this it is possible that the buildfarm animals running these tests  
will be able to capture adequate logging to allow diagnosis of failures.  

M src/Makefile.global.in
M src/bin/pg_rewind/RewindTest.pm
M src/test/perl/TestLib.pm

Remove an unsafe Assert, and explain join_clause_is_movable_into() better.

commit   : f7cdc518e613b08831ccd798257df3ba3556ea21    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 13:20:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jul 2015 13:20:39 -0400    

Click here for diff

join_clause_is_movable_into() is approximate, in the sense that it might  
sometimes return "false" when actually it would be valid to push the given  
join clause down to the specified level.  This is okay ... but there was  
an Assert in get_joinrel_parampathinfo() that's only safe if the answers  
are always exact.  Comment out the Assert, and add a bunch of commentary  
to clarify what's going on.  
  
Per fuzz testing by Andreas Seltenreich.  The added regression test is  
a pretty silly query, but it's based on his crasher example.  
  
Back-patch to 9.2 where the faulty logic was introduced.  

M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Improve logging of TAP tests.

commit   : fa4a4df93c8c28d5684cacb1677fbd13f58bb9f2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 12:22:21 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Jul 2015 12:22:21 -0400    

Click here for diff

Create a log file for each test run. Stdout and stderr of the test script,  
as well as any subprocesses run as part of the test, are redirected to  
the log file. This makes it a lot easier to debug test failures. Also print  
the test output (ok 12 - ... messages) to the log file, and the command  
line of any external programs executed with the system_or_bail and run_log  
functions. This makes it a lot easier to debug failing tests.  
  
Modify some of the pg_ctl and other command invocations to not use 'silent'  
or 'quiet' options, and don't redirect output to /dev/null, so that you get  
all the information in the log instead.  
  
In the passing, construct some command lines in a way that works if $tempdir  
contains quote-characters. I haven't systematically gone through all of  
them or tested that, so I don't know if this is enough to make that work.  
  
pg_rewind tests had a custom mechanism for creating a similar log file. Use  
the new generic facility instead.  
  
Michael Paquier and Heikki Linnakangas.  
  
This is a backpatch of Heikki's commit 1ea06203b82b98b5098808667f6ba652181ef5b2.  

M src/Makefile.global.in
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_rewind/.gitignore
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
A src/test/perl/SimpleTee.pm
M src/test/perl/TestLib.pm
M src/test/ssl/ServerSetup.pm

Another attempt at fixing memory leak in xlogreader.

commit   : beebb259d2a994cd2021a1506b7af1716b16f476    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jul 2015 09:05:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jul 2015 09:05:46 +0300    

Click here for diff

max_block_id is also reset between reading records.  
  
Michael Paquier  

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

Fix pg_dump output of policies.

commit   : 510aad31eaf2129d28ae3dbfc58f98775192ee94    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 27 Jul 2015 20:24:27 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 27 Jul 2015 20:24:27 -0700    

Click here for diff

pg_dump neglected to wrap parenthesis around USING and WITH CHECK  
expressions -- fixed. Reported by Noah Misch.  

M src/bin/pg_dump/pg_dump.c

Improve RLS handling in copy.c

commit   : 5d179a28fb4c819f3812c40fa7e626b1d3081982    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 27 Jul 2015 16:48:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 27 Jul 2015 16:48:26 -0400    

Click here for diff

To avoid a race condition where the relation being COPY'd could be  
changed into a view or otherwise modified, keep the original lock  
on the relation.  Further, fully qualify the relation when building  
the query up.  
  
Also remove the poorly thought-out Assert() and check the entire  
relationOids list as, post-RLS, there can certainly be multiple  
relations involved and the planner does not guarantee their ordering.  
  
Per discussion with Noah and Andres.  
  
Back-patch to 9.5 where RLS was introduced.  

M src/backend/commands/copy.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Further code review for pg_stat_ssl patch.

commit   : cb0bb53204d84cecf51022313fe47d625de8f01e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 16:29:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 16:29:14 -0400    

Click here for diff

Fix additional bogosity in commit 9029f4b37406b21a.  Include the  
BackendSslStatusBuffer in the BackendStatusShmemSize calculation,  
avoid ugly and error-prone casts to char* and back, put related  
code stanzas into a consistent order (and fix a couple of previous  
instances of that sin).  All cosmetic except for the size oversight.  

M src/backend/postmaster/pgstat.c

Fix pointer-arithmetic thinko in pg_stat_ssl patch.

commit   : f3cf8b6b6edc69f94fa1bcaa5b9b806e14281098    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 15:58:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jul 2015 15:58:46 -0400    

Click here for diff

Nasty memory-stomp bug in commit 9029f4b37406b21a.  It's not apparent how  
this survived even cursory testing :-(.  Per report from Peter Holzer.  

M src/backend/postmaster/pgstat.c

Don't assume that 'char' is signed.

commit   : 1b7f125bf7e74fb3b128b3bcbe593d9e7327ff50    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 21:48:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 21:48:51 +0300    

Click here for diff

On some platforms, notably ARM and PowerPC, 'char' is unsigned by  
default. This fixes an assertion failure at WAL replay on such platforms.  
  
Reported by Noah Misch. Backpatch to 9.5, where this was broken.  

M src/include/access/spgist_private.h

Fix memory leaks in pg_rewind. Several PQclear() calls were missing.

commit   : d09c873f637b783ef36770c88de551efb08c9e4a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 20:38:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 20:38:44 +0300    

Click here for diff

Originally reported by Vladimir Borodin in the pg_rewind github project,  
patch by Michael Paquier.  

M src/bin/pg_rewind/libpq_fetch.c

Don't assume that PageIsEmpty() returns true on an all-zeros page.

commit   : 9c88e06b5a24341e0e82fbab7b02de271adf1f47    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:54:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:54:09 +0300    

Click here for diff

It does currently, and I don't see us changing that any time soon, but we  
don't make that assumption anywhere else.  
  
Per Tom Lane's suggestion. Backpatch to 9.2, like the previous patch that  
added this assumption.  

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

Fix memory leak in xlogreader facility.

commit   : 03a0a3532b47b2a634cd2700d49edc086af748a0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:27:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 18:27:27 +0300    

Click here for diff

XLogReaderFree failed to free the per-block data buffers, when they  
happened to not be used by the latest read WAL record.  
  
Michael Paquier. Backpatch to 9.5, where the per-block buffers were added.  

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

Reuse all-zero pages in GIN.

commit   : 202aea62a84135256c6aa394af2c4dbfa1700c85    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:30:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:30:26 +0300    

Click here for diff

In GIN, an all-zeros page would be leaked forever, and never reused. Just  
add them to the FSM in vacuum, and they will be reinitialized when grabbed  
from the FSM. On master and 9.5, attempting to access the page's opaque  
struct also caused an assertion failure, although that was otherwise  
harmless.  
  
Reported by Jeff Janes. Backpatch to all supported versions.  

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

Fix handling of all-zero pages in SP-GiST vacuum.

commit   : 2fa8ba34804211714a6e0a7fcf5512423c77f8dd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:28:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:28:21 +0300    

Click here for diff

SP-GiST initialized an all-zeros page at vacuum, but that was not  
WAL-logged, which is not safe. You might get a torn page write, when it gets  
flushed to disk, and end-up with a half-initialized index page. To fix,  
leave it in the all-zeros state, and add it to the FSM. It will be  
initialized when reused. Also don't set the page-deleted flag when recycling  
an empty page. That was also not WAL-logged, and a torn write of that would  
cause the page to have an invalid checksum.  
  
Backpatch to 9.2, where SP-GiST indexes were added.  

M src/backend/access/spgist/spgvacuum.c
M src/include/access/spgist_private.h

Avoid calling PageGetSpecialPointer() on an all-zeros page.

commit   : 6a0a388c202098db207fff8e571f599296aa57d8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:24:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 12:24:27 +0300    

Click here for diff

That was otherwise harmless, but tripped the new assertion in  
PageGetSpecialPointer().  
  
Reported by Amit Langote. Backpatch to 9.5, where the assertion was added.  

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

Remove false comment about speculative insertion.

commit   : dd20a97219b569b92bdcbd0c195c214340298b4a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 11:46:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jul 2015 11:46:11 +0300    

Click here for diff

There is no full discussion of speculative insertions in the executor  
README. There is a high-level explanation in execIndexing.c, but it doesn't  
seem necessary to refer it from here.  
  
Peter Geoghegan  

M src/backend/executor/nodeModifyTable.c

Fix oversight in flattening of subqueries with empty FROM.

commit   : 8fb61e0b5430b8dada0eca18b99e3956f4eaf6cd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 17:44:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 17:44:27 -0400    

Click here for diff

I missed a restriction that commit f4abd0241de20d5d6a79b84992b9e88603d44134  
should have enforced: we can't pull up an empty-FROM subquery if it's under  
an outer join, because then we'd need to wrap its output columns in  
PlaceHolderVars.  As the code currently stands, the PHVs end up with empty  
relid sets, which doesn't work (and is correctly caught by an Assert).  
  
It's possible that this could be fixed by assigning the PHVs the relid  
sets of the parent FromExpr/JoinExpr, but getting that to work is more  
complication than I care to add right now; indeed it's likely that  
we'll never bother, since pulling up empty-FROM subqueries is a rather  
marginal optimization anyway.  
  
Per report from Andreas Seltenreich.  Back-patch to 9.5 where the faulty  
code was added.  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Make entirely-dummy appendrels get marked as such in set_append_rel_size.

commit   : 7481c6c2aa379f8d3427819fcaa0eac5c93b1dcf    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 16:19:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jul 2015 16:19:08 -0400    

Click here for diff

The planner generally expects that the estimated rowcount of any relation  
is at least one row, *unless* it has been proven empty by constraint  
exclusion or similar mechanisms, which is marked by installing a dummy path  
as the rel's cheapest path (cf. IS_DUMMY_REL).  When I split up  
allpaths.c's processing of base rels into separate set_base_rel_sizes and  
set_base_rel_pathlists steps, the intention was that dummy rels would get  
marked as such during the "set size" step; this is what justifies an Assert  
in indxpath.c's get_loop_count that other relations should either be dummy  
or have positive rowcount.  Unfortunately I didn't get that quite right  
for append relations: if all the child rels have been proven empty then  
set_append_rel_size would come up with a rowcount of zero, which is  
correct, but it didn't then do set_dummy_rel_pathlist.  (We would have  
ended up with the right state after set_append_rel_pathlist, but that's  
too late, if we generate indexpaths for some other rel first.)  
  
In addition to fixing the actual bug, I installed an Assert enforcing this  
convention in set_rel_size; that then allows simplification of a couple  
of now-redundant tests for zero rowcount in set_append_rel_size.  
  
Also, to cover the possibility that third-party FDWs have been careless  
about not returning a zero rowcount estimate, apply clamp_row_est to  
whatever an FDW comes up with as the rows estimate.  
  
Per report from Andreas Seltenreich.  Back-patch to 9.2.  Earlier branches  
did not have the separation between set_base_rel_sizes and  
set_base_rel_pathlists steps, so there was no intermediate state where an  
appendrel would have had inconsistent rowcount and pathlist.  It's possible  
that adding the Assert to set_rel_size would be a good idea in older  
branches too; but since they're not under development any more, it's likely  
not worth the trouble.  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Check the relevant index element in ON CONFLICT unique index inference.

commit   : 13d0053f98390ad17e373cefb95e27273c0c345c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 18:20:41 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 18:20:41 +0200    

Click here for diff

ON CONFLICT unique index inference had a thinko that could affect cases  
where the user-supplied inference clause required that an attribute  
match a particular (user specified) collation and/or opclass.  
  
infer_collation_opclass_match() has to check for opclass and/or  
collation matches and that the attribute is in the list of attributes or  
expressions known to be in the definition of the index under  
consideration. The bug was that these two conditions weren't necessarily  
evaluated for the same index attribute.  
  
Author: Peter Geoghegan  
Discussion: CAM3SWZR4uug=WvmGk7UgsqHn2MkEzy9YU-+8jKGO4JPhesyeWg@mail.gmail.com  
Backpatch: 9.5, where ON CONFLICT was introduced  

M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Fix flattening of nested grouping sets.

commit   : b17ae36ba9521014c5ae30cb3a3f77c439b41bb3    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 16:37:49 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 16:37:49 +0200    

Click here for diff

Previously nested grouping set specifications accidentally weren't  
flattened, but instead contained the nested specification as a element  
in the outer list.  
  
Fix this by, as actually documented in comments, concatenating the  
nested set specification into the outer one. Also add tests to prevent  
this from breaking again.  
  
Author: Andrew Gierth, with tests from Jeevan Chalke  
Reported-By: Jeevan Chalke  
Discussion: CAM2+6=V5YvuxB+EyN4iH=GbD-XTA435TCNvnDFSD--YvXs+pww@mail.gmail.com  
Backpatch: 9.5, where grouping sets were introduced  

M src/backend/parser/parse_clause.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Allow to push down clauses from HAVING to WHERE when grouping sets are used.

commit   : 29e4455d7139d0b1bf8d3b62e566e7bb20cf0ec6    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:56:26 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:56:26 +0200    

Click here for diff

Previously we disallowed pushing down quals to WHERE in the presence of  
grouping sets. That's overly restrictive.  
  
We now instead copy quals to WHERE if applicable, leaving the  
one in HAVING in place. That's because, at that stage of the planning  
process, it's nontrivial to determine if it's safe to remove the one in  
HAVING.  
  
Author: Andrew Gierth  
Discussion: [email protected]  
Backpatch: 9.5, where grouping sets were introduced. This isn't exactly  
    a bugfix, but it seems better to keep the branches in sync at this point.  

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

Recognize GROUPING() as a aggregate expression.

commit   : 3500d1cc78f61927e05c0e73158b87ff24f81c09    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:34:29 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:34:29 +0200    

Click here for diff

Previously GROUPING() was not recognized as a aggregate expression,  
erroneously allowing the planner to move it from HAVING to WHERE.  
  
Author: Jeevan Chalke  
Reviewed-By: Andrew Gierth  
Discussion: CAM2+6=WG9omG5rFOMAYBweJxmpTaapvVp5pCeMrE6BfpCwr4Og@mail.gmail.com  
Backpatch: 9.5, where grouping sets were introduced  

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

Build column mapping for grouping sets in all required cases.

commit   : 65b86c1767a7dac0cc79dcfba7ba4cbd326dc03f    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:17:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Jul 2015 15:17:44 +0200    

Click here for diff

The previous coding frequently failed to fail because for one it's  
unusual to have rollup clauses with one column, and for another  
sometimes the wrong mapping didn't cause obvious problems.  
  
Author: Jeevan Chalke  
Reviewed-By: Andrew Gierth  
Discussion: CAM2+6=W=9=hQOipH0HAPbkun3Z3TFWij_EiHue0_6UX=oR=1kw@mail.gmail.com  
Backpatch: 9.5, where grouping sets were introduced  

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

Improve markup for row_security.

commit   : 60624f45fc12a249fd48ac7557238c974d8e5011    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 25 Jul 2015 17:46:33 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 25 Jul 2015 17:46:33 -0700    

Click here for diff

Wrap the literals on, off, force, and BYPASSRLS with appropriate  
markup. Per Kevin Grittner.  

M doc/src/sgml/config.sgml

Dodge portability issue (apparent compiler bug) in new tablesample code.

commit   : d5b132bb626d126b6d0696f2f4068815053da115    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 19:42:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 19:42:32 -0400    

Click here for diff

Some of the older OS X critters in the buildfarm are failing regression,  
with symptoms showing that a request for 100% sampling in BERNOULLI or  
SYSTEM methods actually gets only around 50% of the table.  gdb revealed  
that the computation of the "cutoff" number was producing 0x7FFFFFFF  
rather than the expected 0x100000000.  Inspecting the assembly code,  
it looks like gcc is trying to use lrint() instead of rint() and then  
fumbling the conversion from long double to uint64.  This seems like a  
clear compiler bug, but assigning the intermediate result into a plain  
double variable works around it, so let's just do that.  (Another idea  
would be to give up one bit of hash width so that we don't need to use  
a uint64 cutoff, but let's see if this is enough.)  

M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c

Restore use of zlib default compression in pg_dump directory mode.

commit   : 08012455cd31a4148c5072a6aac1ad41a89e6d4b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 25 Jul 2015 17:14:36 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 25 Jul 2015 17:14:36 -0400    

Click here for diff

This was broken by commit 0e7e355f27302b62af3e1add93853ccd45678443 and  
friends, which ignored the fact that gzopen() will treat "-1" in the  
mode argument as an invalid character, which it ignores, and a flag for  
compression level 1. Now, when this value is encountered no compression  
level flag is passed  to gzopen, leaving it to use the zlib default.  
  
Also, enforce the documented allowed range for pg_dump's -Z option,  
namely 0 .. 9, and remove some consequently dead code from  
pg_backup_tar.c.  
  
Problem reported by Marc Mamin.  
  
Backpatch to 9.1, like the patch that introduced the bug.  

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

Some platforms now need contrib/tsm_system_time to be linked with libm.

commit   : 62005e9465a409d317a7a41d821afc5ed235670b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 16:37:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 16:37:12 -0400    

Click here for diff

Buildfarm member hornet, at least, seems to want -lm in the link command.  
Probably this is due to the just-added use of isnan().  

M contrib/tsm_system_time/Makefile

In pg_ctl, report unexpected failure to stat() the postmaster.pid file.

commit   : 87221867e8b8fedb347e32d3d919e62ae85edc81    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:58:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:58:14 -0400    

Click here for diff

Any error other than ENOENT is a bit suspicious here, and perhaps should  
not be grounds for assuming the postmaster has failed.  For the moment  
though, just report it, and don't change the behavior otherwise.  The  
intent is mainly to try to determine why we are seeing intermittent  
failures in this area on some buildfarm members.  
  
Back-patch to 9.5 where some of these failures have happened.  

M src/bin/pg_ctl/pg_ctl.c

Update oidjoins regression test for 9.5.

commit   : 68c3549fb56834f47d57ef010ffbd3bdbd80b941    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:46:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 15:46:26 -0400    

Click here for diff

New FK relationships for pg_transform.  Also findoidjoins now detects a few  
relationships it didn't before for pre-existing catalogs, as a result of  
new regression tests leaving entries in those catalogs that weren't there  
before.  

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

Redesign tablesample method API, and do extensive code review.

commit   : 6fcb337fa507723d6940ed8e5658d3da1fac6195    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 14:39:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jul 2015 14:39:00 -0400    

Click here for diff

The original implementation of TABLESAMPLE modeled the tablesample method  
API on index access methods, which wasn't a good choice because, without  
specialized DDL commands, there's no way to build an extension that can  
implement a TSM.  (Raw inserts into system catalogs are not an acceptable  
thing to do, because we can't undo them during DROP EXTENSION, nor will  
pg_upgrade behave sanely.)  Instead adopt an API more like procedural  
language handlers or foreign data wrappers, wherein the only SQL-level  
support object needed is a single handler function identified by having  
a special return type.  This lets us get rid of the supporting catalog  
altogether, so that no custom DDL support is needed for the feature.  
  
Adjust the API so that it can support non-constant tablesample arguments  
(the original coding assumed we could evaluate the argument expressions at  
ExecInitSampleScan time, which is undesirable even if it weren't outright  
unsafe), and discourage sampling methods from looking at invisible tuples.  
Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatable  
within and across queries, as required by the SQL standard, and deal more  
honestly with methods that can't support that requirement.  
  
Make a full code-review pass over the tablesample additions, and fix  
assorted bugs, omissions, infelicities, and cosmetic issues (such as  
failure to put the added code stanzas in a consistent ordering).  
Improve EXPLAIN's output of tablesample plans, too.  
  
Back-patch to 9.5 so that we don't have to support the original API  
in production.  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/tsm_system_rows/Makefile
M contrib/tsm_system_rows/expected/tsm_system_rows.out
M contrib/tsm_system_rows/sql/tsm_system_rows.sql
M contrib/tsm_system_rows/tsm_system_rows–1.0.sql
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_rows/tsm_system_rows.control
M contrib/tsm_system_time/Makefile
M contrib/tsm_system_time/expected/tsm_system_time.out
M contrib/tsm_system_time/sql/tsm_system_time.sql
M contrib/tsm_system_time/tsm_system_time–1.0.sql
M contrib/tsm_system_time/tsm_system_time.c
M contrib/tsm_system_time/tsm_system_time.control
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/tablesample-method.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/tablesample/Makefile
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/catalog/Makefile
M src/backend/catalog/dependency.c
M src/backend/commands/explain.c
M src/backend/executor/execAmi.c
M src/backend/executor/nodeSamplescan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_func.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/misc/sampling.c
M src/bin/psql/tab-complete.c
M src/include/access/heapam.h
D src/include/access/tablesample.h
A src/include/access/tsmapi.h
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_proc.h
D src/include/catalog/pg_tablesample_method.h
M src/include/catalog/pg_type.h
M src/include/executor/nodeSamplescan.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/cost.h
M src/include/parser/parse_func.h
M src/include/port.h
M src/include/utils/builtins.h
M src/include/utils/lsyscache.h
M src/include/utils/syscache.h
M src/port/erand48.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/tablesample.out
M src/test/regress/output/misc.source
M src/test/regress/serial_schedule
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/tablesample.sql

Make RLS work with UPDATE ... WHERE CURRENT OF

commit   : 7d4240d6cd91d83d263a45501cc2f44fb1d0a537    
  
author   : Joe Conway <[email protected]>    
date     : Fri, 24 Jul 2015 12:56:25 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Fri, 24 Jul 2015 12:56:25 -0700    

Click here for diff

UPDATE ... WHERE CURRENT OF would not work in conjunction with  
RLS. Arrange to allow the CURRENT OF expression to be pushed down.  
Issue noted by Peter Geoghegan. Patch by Dean Rasheed. Back patch  
to 9.5 where RLS was introduced.  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix treatment of nulls in jsonb_agg and jsonb_object_agg

commit   : 016f28ad3dbf3bec14319cf2a49925b0063251aa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 24 Jul 2015 09:40:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 24 Jul 2015 09:40:46 -0400    

Click here for diff

The wrong is_null flag was being passed to datum_to_json. Also, null  
object key values are not permitted, and this was not being checked  
for. Add regression tests covering these cases, and also add those tests  
to the json set, even though it was doing the right thing.  
  
Fixes bug #13514, initially diagnosed by Tom Lane.  

M src/backend/utils/adt/jsonb.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Fix bug around assignment expressions containing indirections.

commit   : bb0203f26fa5f09fe2689a9db4bc632c1435edec    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Jul 2015 11:48:53 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Jul 2015 11:48:53 +0200    

Click here for diff

Handling of assigned-to expressions with indirection (e.g. set f1[1] =  
3) was broken for ON CONFLICT DO UPDATE.  The problem was that  
ParseState was consulted to determine if an INSERT-appropriate or  
UPDATE-appropriate behavior should be used when transforming expressions  
with indirections. When the wrong path was taken the old row was  
substituted with NULL, leading to wrong results..  
  
To fix remove p_is_update and only use p_is_insert to decide how to  
transform the assignment expression, and uset p_is_insert while parsing  
the on conflict statement. This isn't particularly pretty, but it's not  
any worse than before.  
  
Author: Peter Geoghegan, slightly edited by me  
Discussion: CAM3SWZS8RPvA=KFxADZWw3wAHnnbxMxDzkEC6fNaFc7zSm411w@mail.gmail.com  
Backpatch: 9.5, where the feature was introduced  

M src/backend/parser/analyze.c
M src/include/parser/parse_node.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Redirect install output of make check into a log file

commit   : fbf8dc21738749470f73f91a95ac01912c9deb10    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 23 Jul 2015 09:44:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 23 Jul 2015 09:44:20 -0400    

Click here for diff

dbf2ec1a changed make check so that the installation logs get directed  
to stdout and stderr. Per discussion on -hackers, this patch restores  
saving it to a file. It is now saved in /tmp_install/log, which is  
created once per invocation of any make target doing regression tests.  
  
Along the way, add a missing /log/ entry to test_ddl_deparse's  
.gitignore.  
  
Michael Paquier.  

M src/Makefile.global.in
M src/test/modules/test_ddl_deparse/.gitignore

Fix off-by-one error in calculating subtrans/multixact truncation point.

commit   : a9b3a22aa18345451a20696fe272b6e02f5a2bbb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Jul 2015 01:30:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Jul 2015 01:30:07 +0300    

Click here for diff

If there were no subtransactions (or multixacts) active, we would calculate  
the oldestxid == next xid. That's correct, but if next XID happens to be  
on the next pg_subtrans (pg_multixact) page, the page does not exist yet,  
and SimpleLruTruncate will produce an "apparent wraparound" warning. The  
warning is harmless in this case, but looks very alarming to users.  
  
Backpatch to all supported versions. Patch and analysis by Thomas Munro.  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/subtrans.c

Fix add_rte_to_flat_rtable() for recent feature additions.

commit   : 41ae3b74d987d5d42f2c432812285c7d12d6f4c1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 20:03:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 20:03:58 -0400    

Click here for diff

The TABLESAMPLE and row security patches each overlooked this function,  
though their errors of omission were opposite: RLS failed to zero out the  
securityQuals field, leading to wasteful copying of useless expression  
trees in finished plans, while TABLESAMPLE neglected to add a comment  
saying that it intentionally *isn't* deleting the tablesample subtree.  
There probably should be a similar comment about ctename, too.  
  
Back-patch as appropriate.  

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

Fix some oversights in BRIN patch.

commit   : 35ac618a7c4602b792160ae0d77b6dfb289f517e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 13:38:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2015 13:38:24 -0400    

Click here for diff

Remove HeapScanDescData.rs_initblock, which wasn't being used for anything  
in the final version of the patch.  
  
Fix IndexBuildHeapScan so that it supports syncscan again; the patch  
broke synchronous scanning for index builds by forcing rs_startblk  
to zero even when the caller did not care about that and had asked  
for syncscan.  
  
Add some commentary and usage defenses to heap_setscanlimits().  
  
Fix heapam so that asking for rs_numblocks == 0 does what you would  
reasonably expect.  As coded it amounted to requesting a whole-table  
scan, because those "--x <= 0" tests on an unsigned variable would  
behave surprisingly.  

M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/include/access/relscan.h

Fix location of output logs of pg_regress

commit   : 29f171c81a0d064ab556417374b8809a8ebe2c08    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 21 Jul 2015 09:53:16 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 21 Jul 2015 09:53:16 -0400    

Click here for diff

initdb.log and postmaster.log were moved to within the temporary instance  
path by commit dcae5fa. This directory now gets removed at the end  
of the run of pg_regress when there are no failures found, which makes  
analysis of after-run issues difficult in some cases, and reduces the  
output verbosity of the buildfarm after a run.  
  
Fix by Michael Paquier  
  
Backpatch to 9.5  

M src/test/regress/pg_regress.c

Fix omission of OCLASS_TRANSFORM in object_classes[]

commit   : d6ec181cf14a1d3f3d8ca9400a404b9828776ca3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Jul 2015 13:20:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Jul 2015 13:20:53 +0200    

Click here for diff

This was forgotten in cac76582053e (and its fixup ad89a5d115).  Since it  
seems way too easy to miss this, this commit also introduces a mechanism  
to enforce that the array is consistent with the enum.  
  
Problem reported independently by Robert Haas and Jaimin Pan.  
Patches proposed by Jaimin Pan, Jim Nasby, Michael Paquier and myself,  
though I didn't use any of these and instead went with a cleaner  
approach suggested by Tom Lane.  
  
Backpatch to 9.5.  
  
Discussion:  
https://www.postgresql.org/message-id/CA+Tgmoa6SgDaxW_n_7SEhwBAc=mniYga+obUj5fmw4rU9_mLvA@mail.gmail.com  
https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/commands/event_trigger.c
M src/include/catalog/dependency.h

Sanity-check that a page zeroed by redo routine is marked with WILL_INIT.

commit   : e015c3e51f76a05cc026c8323c51a373172adaa3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 16:02:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 16:02:28 +0300    

Click here for diff

There was already a sanity-check in the other direction: if a page was  
marked with WILL_INIT, it had to be initialized by the redo routine. It's  
not strictly necessary for correctness that a page is marked with WILL_INIT  
if it's going to be initialized at redo, but it's a missed optimization if  
nothing else.  
  
Fix a few instances of this issue in SP-GiST, where a block in WAL record  
was not marked with WILL_INIT, but was in fact always initialized at redo.  
We were creating a full-page image of the page unnecessarily in those  
cases.  
  
Backpatch to 9.5, where the new WILL_INIT flag was added.  

M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/transam/xlogutils.c

Don't handle PUBLIC/NONE separately

commit   : 869eb8416255da99fe5ba1f6d98e52a41999d30e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 18:47:15 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 18:47:15 +0200    

Click here for diff

Since those role specifiers are checked in the grammar, there's no need  
for the old checks to remain in place after 31eae6028ec.  Remove them.  
  
Backpatch to 9.5.  
  
Noted and patch by Jeevan Chalke  

M src/backend/commands/user.c

Improve tab-completion for DROP POLICY

commit   : 691c32f69a7efd6af9cda100c7e5ebf3b0c1937c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 15:37:17 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 15:37:17 +0200    

Click here for diff

Backpatch to 9.5.  
  
Author: Pavel Stěhule  

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

Fix (some of) pltcl memory usage

commit   : b0b6f8d71f03463854576b30c1b01e5d772076d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 14:18:08 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 14:18:08 +0200    

Click here for diff

As reported by Bill Parker, PL/Tcl did not validate some malloc() calls  
against NULL return.  Fix by using palloc() in a new long-lived memory  
context instead.  This allows us to simplify error handling too, by  
simply deleting the memory context instead of doing retail frees.  
  
There's still a lot that could be done to improve PL/Tcl's memory  
handling ...  
  
This is pretty ancient, so backpatch all the way back.  
  
Author: Michael Paquier and Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/CAFrbyQwyLDYXfBOhPfoBGqnvuZO_Y90YgqFM11T2jvnxjLFmqw@mail.gmail.com  

M src/pl/tcl/pltcl.c

Improve BRIN documentation somewhat

commit   : 38b03caebc5de44704567d8422f256c3e66b4784    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 12:16:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 12:16:40 +0200    

Click here for diff

This removes some info about support procedures being used, which was  
obsoleted by commit db5f98ab4f, as well as add some more documentation  
on how to create new opclasses using the Minmax infrastructure.  
(Hopefully we can get something similar for Inclusion as well.)  
  
In passing, fix some obsolete mentions of "mmtuples" in source code  
comments.  
  
Backpatch to 9.5, where BRIN was introduced.  

M doc/src/sgml/brin.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_xlog.c

Fix mis-merge in previous commit

commit   : b2f01a731647b84d7c88d2028e8dc7be5599740f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:59:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:59:31 +0200    

Click here for diff

M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Add some comments to test_ddl_deparse and a README

commit   : f1f3434f210450af2e3dab08fbc05a9edd0b67a4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:20:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Jul 2015 11:20:40 +0200    

Click here for diff

Per comments from Heikki Linnakangas.  
  
Backpatch to 9.5, where this module was introduced.  

A src/test/modules/test_ddl_deparse/README
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Handle AT_ReAddComment in test_ddl_deparse, and add a catch-all default.

commit   : e66e31958fc5f5346394099a6481a7949cc1f02a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 10:19:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jul 2015 10:19:22 +0300    

Click here for diff

In the passing, also move AT_ReAddComment to more logical position in the  
enum, after all the Constraint-related subcommands.  
  
This fixes a compiler warning, added by commit e42375fc. Backpatch to 9.5,  
like that patch.  

M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Remove dead code.

commit   : 0ed1e572b644e064e480e14d2f6afe03d11638a7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 19 Jul 2015 13:19:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 19 Jul 2015 13:19:38 -0400    

Click here for diff

Defect noticed by Coverity.  

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

Make WaitLatchOrSocket's timeout detection more robust.

commit   : fd735e976cab3a95374c710ff5d2865102e3145a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jul 2015 11:47:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jul 2015 11:47:13 -0400    

Click here for diff

In the previous coding, timeout would be noticed and reported only when  
poll() or socket() returned zero (or the equivalent behavior on Windows).  
Ordinarily that should work well enough, but it seems conceivable that we  
could get into a state where poll() always returns a nonzero value --- for  
example, if it is noticing a condition on one of the file descriptors that  
we do not think is reason to exit the loop.  If that happened, we'd be in a  
busy-wait loop that would fail to terminate even when the timeout expires.  
  
We can make this more robust at essentially no cost, by deciding to exit  
of our own accord if we compute a zero or negative time-remaining-to-wait.  
Previously the code noted this but just clamped the time-remaining to zero,  
expecting that we'd detect timeout on the next loop iteration.  
  
Back-patch to 9.2.  While 9.1 had a version of WaitLatchOrSocket, it was  
primitive compared to later versions, and did not guarantee reliable  
detection of timeouts anyway.  (Essentially, this is a refinement of  
commit 3e7fdcffd6f77187, which was back-patched only as far as 9.2.)  

M src/backend/port/unix_latch.c
M src/backend/port/win32_latch.c

Enable transforms modules to build and test on Cygwin.

commit   : d27fad73e8de2f3f9b68096926735d53d87e7f6a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 18 Jul 2015 10:09:04 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 18 Jul 2015 10:09:04 -0400    

Click here for diff

This still doesn't work correctly with Python 3, but I am committing  
this so we can get Cygwin buildfarm members building with Python 2.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile

Release note compatibility item

commit   : 0beef5af3a4821155251d8d445b9ba1296381645    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 21:08:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 21:08:03 -0400    

Click here for diff

Note that json and jsonb extraction operators no longer consider a  
negative subscript to be invalid.  

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

Support JSON negative array subscripts everywhere

commit   : 89ddd29bbd70c31652c6e7a179473753b89a3cac    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 20:56:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jul 2015 20:56:13 -0400    

Click here for diff

Previously, there was an inconsistency across json/jsonb operators that  
operate on datums containing JSON arrays -- only some operators  
supported negative array count-from-the-end subscripting.  Specifically,  
only a new-to-9.5 jsonb deletion operator had support (the new "jsonb -  
integer" operator).  This inconsistency seemed likely to be  
counter-intuitive to users.  To fix, allow all places where the user can  
supply an integer subscript to accept a negative subscript value,  
including path-orientated operators and functions, as well as other  
extraction operators.  This will need to be called out as an  
incompatibility in the 9.5 release notes, since it's possible that users  
are relying on certain established extraction operators changed here  
yielding NULL in the event of a negative subscript.  
  
For the json type, this requires adding a way of cheaply getting the  
total JSON array element count ahead of time when parsing arrays with a  
negative subscript involved, necessitating an ad-hoc lex and parse.  
This is followed by a "conversion" from a negative subscript to its  
equivalent positive-wise value using the count.  From there on, it's as  
if a positive-wise value was originally provided.  
  
Note that there is still a minor inconsistency here across jsonb  
deletion operators.  Unlike the aforementioned new "-" deletion operator  
that accepts an integer on its right hand side, the new "#-" path  
orientated deletion variant does not throw an error when it appears like  
an array subscript (input that could be recognized by as an integer  
literal) is being used on an object, which is wrong-headed.  The reason  
for not being stricter is that it could be the case that an object pair  
happens to have a key value that looks like an integer; in general,  
these two possibilities are impossible to differentiate with rhs path  
text[] argument elements.  However, we still don't allow the "#-"  
path-orientated deletion operator to perform array-style subscripting.  
Rather, we just return the original left operand value in the event of a  
negative subscript (which seems analogous to how the established  
"jsonb/json #> text[]" path-orientated operator may yield NULL in the  
event of an invalid subscript).  
  
In passing, make SetArrayPath() stricter about not accepting cases where  
there is trailing non-numeric garbage bytes rather than a clean NUL  
byte.  This means, for example, that strings like "10e10" are now not  
accepted as an array subscript of 10 by some new-to-9.5 path-orientated  
jsonb operators (e.g. the new #- operator).  Finally, remove dead code  
for jsonb subscript deletion; arguably, this should have been done in  
commit b81c7b409.  
  
Peter Geoghegan and Andrew Dunstan  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonapi.h
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Repair mishandling of cached cast-expression trees in plpgsql.

commit   : 9a5f369adc734e0a8d45192d1b790a6849a391dd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2015 15:53:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2015 15:53:10 -0400    

Click here for diff

In commit 1345cc67bbb014209714af32b5681b1e11eaf964, I introduced caching  
of expressions representing type-cast operations into plpgsql.  However,  
I supposed that I could cache both the expression trees and the evaluation  
state trees derived from them for the life of the session.  This doesn't  
work, because we execute the expressions in plpgsql's simple_eval_estate,  
which has an ecxt_per_query_memory that is only transaction-lifespan.  
Therefore we can end up putting pointers into the evaluation state tree  
that point to transaction-lifespan memory; in particular this happens if  
the cast expression calls a SQL-language function, as reported by Geoff  
Winkless.  
  
The minimum-risk fix seems to be to treat the state trees the same way  
we do for "simple expression" trees in plpgsql, ie create them in the  
simple_eval_estate's ecxt_per_query_memory, which means recreating them  
once per transaction.  
  
Since I had to introduce bookkeeping overhead for that anyway, I bought  
back some of the added cost by sharing the read-only expression trees  
across all functions in the session, instead of using a per-function  
table as originally.  The simple-expression bookkeeping takes care of  
the recursive-usage risk that I was concerned about avoiding before.  
  
At some point we should take a harder look at how all this works,  
and see if we can't reduce the amount of tree reinitialization needed.  
But that won't happen for 9.5.  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

AIX: Test the -qlonglong option before use.

commit   : eb3b93b534e153b0e71ce17a2f48126e3a772167    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 17 Jul 2015 03:01:14 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 17 Jul 2015 03:01:14 -0400    

Click here for diff

xlc provides "long long" unconditionally at C99-compatible language  
levels, and this option provokes a warning.  The warning interferes with  
"configure" tests that fail in response to any warning.  Notably, before  
commit 85a2a8903f7e9151793308d0638621003aded5ae, it interfered with the  
test for -qnoansialias.  Back-patch to 9.0 (all supported versions).  

M configure
M configure.in
M src/template/aix

Fix a low-probability crash in our qsort implementation.

commit   : fd415ffc9cca3d938d21b24c8513e409af7b751c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jul 2015 22:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jul 2015 22:57:46 -0400    

Click here for diff

It's standard for quicksort implementations, after having partitioned the  
input into two subgroups, to recurse to process the smaller partition and  
then handle the larger partition by iterating.  This method guarantees  
that no more than log2(N) levels of recursion can be needed.  However,  
Bentley and McIlroy argued that checking to see which partition is smaller  
isn't worth the cycles, and so their code doesn't do that but just always  
recurses on the left partition.  In most cases that's fine; but with  
worst-case input we might need O(N) levels of recursion, and that means  
that qsort could be driven to stack overflow.  Such an overflow seems to  
be the only explanation for today's report from Yiqing Jin of a SIGSEGV  
in med3_tuple while creating an index of a couple billion entries with a  
very large maintenance_work_mem setting.  Therefore, let's spend the few  
additional cycles and lines of code needed to choose the smaller partition  
for recursion.  
  
Also, fix up the qsort code so that it properly uses size_t not int for  
some intermediate values representing numbers of items.  This would only  
be a live risk when sorting more than INT_MAX bytes (in qsort/qsort_arg)  
or tuples (in qsort_tuple), which I believe would never happen with any  
caller in the current core code --- but perhaps it could happen with  
call sites in third-party modules?  In any case, this is trouble waiting  
to happen, and the corrected code is probably if anything shorter and  
faster than before, since it removes sign-extension steps that had to  
happen when converting between int and size_t.  
  
In passing, move a couple of CHECK_FOR_INTERRUPTS() calls so that it's  
not necessary to preserve the value of "r" across them, and prettify  
the output of gen_qsort_tuple.pl a little.  
  
Back-patch to all supported branches.  The odds of hitting this issue  
are probably higher in 9.4 and up than before, due to the new ability  
to allocate sort workspaces exceeding 1GB, but there's no good reason  
to believe that it's impossible to crash older branches this way.  

M src/backend/utils/sort/gen_qsort_tuple.pl
M src/port/qsort.c
M src/port/qsort_arg.c

Fix spelling error

commit   : 095b8e158b064b67239cf7030dba8a3c83c11c85    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:31:58 +0300    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:31:58 +0300    

Click here for diff

David Rowley  

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

Fix copy/past error in comment

commit   : 34a6c6172e99cb12dd9f079111231052510b78be    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:28:44 +0300    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 16 Jul 2015 10:28:44 +0300    

Click here for diff

David Christensen  

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

commit   : 525a6a0d4580f52c13f0c9b7c9d82a4f96ef92fa    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    

Click here for diff

The result closely resembles linking of these modules for the "win32"  
port.  Augment the $(exports_file) header so the file is also usable as  
an import file.  Unfortunately, relocating an AIX installation will now  
require adding $(pkglibdir) to LD_LIBRARY_PATH.  Back-patch to 9.5,  
where the modules were introduced.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile
M src/Makefile.shlib

commit   : c2b824e34e2ba9a26e914a41f4dd53f27304dc70    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    

Click here for diff

This allows PostgreSQL modules and their dependencies to have undefined  
symbols, resolved at runtime.  Perl module shared objects rely on that  
in Perl 5.8.0 and later.  This fixes the crash when PL/PerlU loads such  
modules, as the hstore_plperl test suite does.  Module authors can link  
using -Wl,-G to permit undefined symbols; by default, linking will fail  
as it has.  Back-patch to 9.0 (all supported versions).  

M src/backend/Makefile

commit   : 21a101848b269e4fff9ccd3a5b5f777911399091    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 15 Jul 2015 21:00:26 -0400    

Click here for diff

The MSVC build system already did this, and building against Python 3  
requires it.  Back-patch to 9.5, where the module was introduced.  

M contrib/ltree_plpython/Makefile

Mention table_rewrite as valid event trigger tag

commit   : 8bc8dd81ed215130ab88f12e8ea736d042692630    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jul 2015 17:08:46 +0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jul 2015 17:08:46 +0300    

Click here for diff

This was forgotten in 618c9430a8.  

M doc/src/sgml/event-trigger.sgml

Remove regression test added on auto-pilot.

commit   : 70446994959d67880373b6478ff3fb5f5efd2c87    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Jul 2015 16:19:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Jul 2015 16:19:44 -0400    

Click here for diff

Test does not match the comment which precedes it.  
  
Peter Geoghegan  

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

Prevent pgstattuple() from reporting BRIN as unknown index.

commit   : 5658b0dc0425f987c3272a792ea0944bce23a959    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 14 Jul 2015 22:36:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 14 Jul 2015 22:36:51 +0900    

Click here for diff

Also this patch removes obsolete comment.  
  
Back-patch to 9.5 where BRIN index was added.  

M contrib/pgstattuple/pgstattuple.c

Make regression test output stable.

commit   : fe92a72a2bf6f485fc9f08c3e6191838ac3c6441    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 16:16:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 16:16:23 +0300    

Click here for diff

In the test query I added for ALTER TABLE retaining comments, the order of  
the result rows was not stable, and varied across systems. Add an ORDER BY  
to make the order predictable. This should fix the buildfarm failures.  

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

Retain comments on indexes and constraints at ALTER TABLE ... TYPE ...

commit   : 9dee48c94b6eb544dd334ec021ff224454f2020f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:40:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:40:22 +0300    

Click here for diff

When a column's datatype is changed, ATExecAlterColumnType() rebuilds all  
the affected indexes and constraints, and the comments from the old  
indexes/constraints were not carried over.  
  
To fix, create a synthetic COMMENT ON command in the work queue, to re-add  
any comments on constraints. For indexes, there's a comment field in  
IndexStmt that is used.  
  
This fixes bug #13126, reported by Kirill Simonov. Original patch by  
Michael Paquier, reviewed by Petr Jelinek and me. This bug is present in  
all versions, but only backpatch to 9.5. Given how minor the issue is, it  
doesn't seem worth the work and risk to backpatch further than that.  

M src/backend/commands/tablecmds.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Reformat code in ATPostAlterTypeParse.

commit   : 6d5031efcbb4bfadc6a7c2f3c68f05a9281315f4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:38:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Jul 2015 11:38:08 +0300    

Click here for diff

The code in ATPostAlterTypeParse was very deeply indented, mostly because  
there were two nested switch-case statements, which add a lot of  
indentation. Use if-else blocks instead, to make the code less indented  
and more readable.  
  
This is in preparation for next patch that makes some actualy changes to  
the function. These cosmetic parts have been separated to make it easier  
to see the real changes in the other patch.  

M src/backend/commands/tablecmds.c

release notes: markup: vacuumdb is an application, not command

commit   : 3096ff924a9d58be7de56e0cae5c8713a51c6b46    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 12 Jul 2015 17:41:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 12 Jul 2015 17:41:57 -0400    

Click here for diff

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

Fix assorted memory leaks.

commit   : 0e78a610f24463f64d8a03b39f06e995581c923a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Jul 2015 16:25:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Jul 2015 16:25:51 -0400    

Click here for diff

Per Coverity (not that any of these are so non-obvious that they should not  
have been caught before commit).  The extent of leakage is probably minor  
to unnoticeable, but a leak is a leak.  Back-patch as necessary.  
  
Michael Paquier  

M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/scripts/vacuumdb.c

For consistency add a pfree to ON CONFLICT set_plan_refs code.

commit   : 1884708e25c444eb9de6b0665b94c268bab25689    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:18:57 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:18:57 +0200    

Click here for diff

Backpatch to 9.5 where ON CONFLICT was introduced.  
  
Author: Peter Geoghegan  

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

Optionally don't error out due to preexisting slots in commandline utilities.

commit   : 0e8e48b0da6ea00f3dbcb659542b0c81a97d1253    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:06:27 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 12 Jul 2015 22:06:27 +0200    

Click here for diff

pg_receivexlog and pg_recvlogical error out when --create-slot is  
specified and a slot with the same name already exists. In some cases,  
especially with pg_receivexlog, that's rather annoying and requires  
additional scripting.  
  
Backpatch to 9.5 as slot control functions have newly been added to  
pg_receivexlog, and there doesn't seem much point leaving it in a less  
useful state.  
  
Discussion: [email protected]  

M doc/src/sgml/ref/pg_receivexlog.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h

Add now-required #include.

commit   : ccd062cfb90e68f7e80c4b31c474db9087289b7d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Jul 2015 23:34:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Jul 2015 23:34:41 -0400    

Click here for diff

Fixes compiler warning induced by 808ea8fc7bb259ddd810353719cac66e85a608c8.  

M src/backend/commands/policy.c

doc: fix typo in CREATE POLICY manual page

commit   : 5181fc57dfb98b39d059908e04a0628ee6e65efc    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Jul 2015 22:46:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Jul 2015 22:46:28 -0400    

Click here for diff

Backpatch through 9.5  

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

Add assign_expr_collations() to CreatePolicy() and AlterPolicy().

commit   : 7236f5b068ca78bb3e771f62ee1365ba945d4869    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 11 Jul 2015 14:20:01 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 11 Jul 2015 14:20:01 -0700    

Click here for diff

As noted by Noah Misch, CreatePolicy() and AlterPolicy() omit to call  
assign_expr_collations() on the node trees. Fix the omission and add  
his test case to the rowsecurity regression test.  

M src/backend/commands/policy.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Copy-edit the docs changes of OWNER TO CURRENT/SESSION_USER additions.

commit   : ebe8bcd94e7191025e0309718284983891a89064    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Jul 2015 14:28:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Jul 2015 14:28:34 +0300    

Click here for diff

Commit 31eae602 added new syntax to many DDL commands to use CURRENT_USER  
or SESSION_USER instead of role name in ALTER ... OWNER TO, but because  
of a misplaced '{', the syntax in the docs implied that the syntax was  
"ALTER ... CURRENT_USER", instead of "ALTER ... OWNER TO CURRENT_USER".  
Fix that, and also the funny indentation in some of the modified syntax  
blurps.  

M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_opfamily.sgml

Improve documentation about array concat operator vs. underlying functions.

commit   : 5acc7730c8c93d5755bc6a0bf36df407f48b2b27    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 18:50:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 18:50:31 -0400    

Click here for diff

The documentation implied that there was seldom any reason to use the  
array_append, array_prepend, and array_cat functions directly.  But that's  
not really true, because they can help make it clear which case is meant,  
which the || operator can't do since it's overloaded to represent all three  
cases.  Add some discussion and examples illustrating the potentially  
confusing behavior that can ensue if the parser misinterprets what was  
meant.  
  
Per a complaint from Michael Herold.  Back-patch to 9.2, which is where ||  
started to behave this way.  

M doc/src/sgml/array.sgml

Fix postmaster's handling of a startup-process crash.

commit   : 193e0270752b07f8d0700710a39c4ec367f57339    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 13:22:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2015 13:22:23 -0400    

Click here for diff

Ordinarily, a failure (unexpected exit status) of the startup subprocess  
should be considered fatal, so the postmaster should just close up shop  
and quit.  However, if we sent the startup process a SIGQUIT or SIGKILL  
signal, the failure is hardly "unexpected", and we should attempt restart;  
this is necessary for recovery from ordinary backend crashes in hot-standby  
scenarios.  I attempted to implement the latter rule with a two-line patch  
in commit 442231d7f71764b8c628044e7ce2225f9aa43b67, but it now emerges that  
that patch was a few bricks shy of a load: it failed to distinguish the  
case of a signaled startup process from the case where the new startup  
process crashes before reaching database consistency.  That resulted in  
infinitely respawning a new startup process only to have it crash again.  
  
To handle this properly, we really must track whether we have sent the  
*current* startup process a kill signal.  Rather than add yet another  
ad-hoc boolean to the postmaster's state, I chose to unify this with the  
existing RecoveryError flag into an enum tracking the startup process's  
state.  That seems more consistent with the postmaster's general state  
machine design.  
  
Back-patch to 9.0, like the previous patch.  

M src/backend/postmaster/postmaster.c

Make wal_compression PGC_SUSET rather than PGC_USERSET.

commit   : 19a65458159ca5f46d8ac154e62273fa2a8cf13f    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2015 22:30:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2015 22:30:52 +0900    

Click here for diff

When enabling wal_compression, there is a risk to leak data similarly to  
the BREACH and CRIME attacks on SSL where the compression ratio of  
a full page image gives a hint of what is the existing data of this page.  
This vulnerability is quite cumbersome to exploit in practice, but doable.  
  
So this patch makes wal_compression PGC_SUSET in order to prevent  
non-superusers from enabling it and exploiting the vulnerability while  
DBA thinks the risk very seriously and disables it in postgresql.conf.  
  
Back-patch to 9.5 where wal_compression was introduced.  

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

commit   : 1a0959b3887f05e55712e1ef27b7d1b3c75d645f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 16:00:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 16:00:14 +0300    

Click here for diff

Tom fixed another one of these in commit 7f32dbcd, but there was another  
almost identical one in libpq docs. Per his comment:  
  
HP's web server has apparently become case-sensitive sometime recently.  
Per bug #13479 from Daniel Abraham.  Corrected link identified by Alvaro.  

M doc/src/sgml/libpq.sgml

Revert changes to pthread configure tests on REL9_5_STABLE.

commit   : 7f06c7082a34f4ea564e31ee01114784a788b9fa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 10:58:24 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 10:58:24 +0300    

Click here for diff

Some buildfarm animals are still unhappy. These changes are becoming too  
invasive for backpatch, for little benefit. This reverts commits  
080c4dab3d9575449b81604051b160597cfd55c3 and  
ce0da6261004ac15f01c21d8b94f11af7a098243.  

M aclocal.m4
A config/acx_pthread.m4
D config/ax_pthread.m4
M configure
M configure.in

commit   : c1fb42127944d5613df2f3d330c19448fc10ed01    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:22 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:22 -0400    

Click here for diff

The AIX 7.1 libm is static, and AIX postgres executables do not export  
symbols acquired from libraries.  Back-patch to 9.5, where commit  
cfe12763c32437bc708a64ce88a90c7544f16185 added a sqrt() call.  

M contrib/pg_stat_statements/Makefile

Given a gcc-compatible xlc compiler, prefer xlc-style atomics.

commit   : c0d7342f1650b6fdefc865c6da33e1f092778af0    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

This evades a ppc64le "IBM XL C/C++ for Linux" compiler bug.  Back-patch  
to 9.5, where the atomics facility was introduced.  

M src/include/port/atomics.h

Finish generic-xlc.h draft atomics implementation.

commit   : abf5190c07a7e4de2b10b01dc38723aaa28339f6    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

Back-patch to 9.5, where commit b64d92f1a5602c55ee8b27a7ac474f03b7aee340  
introduced this file.  

M src/include/port/atomics/generic-xlc.h

Revoke support for strxfrm() that write past the specified array length.

commit   : aaf15ee33a63c582fbb61b67befdd620e85da2ce    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

This formalizes a decision implicit in commit  
4ea51cdfe85ceef8afabceb03c446574daa0ac23 and adds clean detection of  
affected systems.  Vendor updates are available for each such known bug.  
Back-patch to 9.5, where the aforementioned commit first appeared.  

M src/backend/main/main.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/init/postinit.c
M src/include/utils/pg_locale.h

Replace use of "diff -q".

commit   : 8ed6e70ace8e8d2f0747c16a796a21147ffaf404    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

POSIX does not specify the -q option, and many implementations do not  
offer it.  Don't bother changing the MSVC build system, because having  
non-GNU diff on Windows is vanishingly unlikely.  Back-patch to 9.2,  
where this invocation was introduced.  

M src/bin/pg_upgrade/test.sh

Fix null pointer dereference in "\c" psql command.

commit   : fb990ce6c7d99d329843e5d70d4cdaf8d0825b38    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 8 Jul 2015 20:44:21 -0400    

Click here for diff

The psql crash happened when no current connection existed.  (The second  
new check is optional given today's undocumented NULL argument handling  
in PQhost() etc.)  Back-patch to 9.0 (all supported versions).  

M src/bin/psql/command.c

Move pthread-tests earlier in the autoconf script.

commit   : 080c4dab3d9575449b81604051b160597cfd55c3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 00:05:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Jul 2015 00:05:45 +0300    

Click here for diff

On some Linux systems, "-lrt" exposed pthread-functions, so that linking  
with -lrt was seemingly enough to make a program that uses pthreads to  
work. However, when linking libpq, the dependency to libpthread was not  
marked correctly, so that when an executable was linked with -lpq but  
without -pthread, you got errors about undefined pthread_* functions from  
libpq.  
  
To fix, test for the flags required to use pthreads earlier in the autoconf  
script, before checking any other libraries.  
  
This should fix the failure on buildfarm member shearwater. gharial is also  
failing; hopefully this fixes that too although the failure looks somewhat  
different.  

M configure
M configure.in

Replace our hacked version of ax_pthread.m4 with latest upstream version.

commit   : ce0da6261004ac15f01c21d8b94f11af7a098243    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Jul 2015 20:36:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Jul 2015 20:36:06 +0300    

Click here for diff

Our version was different from the upstream version in that we tried to use  
all possible pthread-related flags that the compiler accepts, rather than  
just the first one that works. That change was made in commit  
e48322a6d6cfce1ec52ab303441df329ddbc04d1, to work-around a bug affecting GCC  
versions 3.2 and below (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8888),  
although we didn't realize that it was a GCC bug at the time. We hardly care  
about that old GCC versions anymore, so we no longer need that workaround.  
  
This fixes the macro for compilers that print warnings with the chosen  
flags. That's pretty annoying on its own right, but it also inconspicuously  
disabled thread-safety, because we refused to use any pthread-related flags  
if the compiler produced warnings. Max Filippov reported that problem when  
linking with uClibc and OpenSSL. The warnings-check was added because the  
workaround for the GCC bug caused warnings otherwise, so it's no longer  
needed either. We can just use the upstream version as is.  
  
If you really want to compile with GCC version 3.2 or older, you can still  
work-around it manually by setting PTHREAD_CFLAGS="-pthread -lpthread"  
manually on the configure command line.  
  
Backpatch to 9.5. I don't want to unnecessarily rock the boat on stable  
branches, but 9.5 seems like fair game.  

M aclocal.m4
D config/acx_pthread.m4
A config/ax_pthread.m4
M configure
M configure.in

Improve regression test coverage of table lock modes vs permissions.

commit   : d5f551abcf78cb4e3f6c5d195bd260893443414b    
  
author   : Joe Conway <[email protected]>    
date     : Tue, 7 Jul 2015 14:36:03 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Tue, 7 Jul 2015 14:36:03 -0700    

Click here for diff

Test the interactions with permissions and LOCK TABLE. Specifically  
ROW EXCLUSIVE, ACCESS SHARE, and ACCESS EXCLUSIVE modes against  
SELECT, INSERT, UPDATE, DELETE, and TRUNCATE permissions. Discussed  
by Stephen Frost and Michael Paquier, patch by the latter. Backpatch  
to 9.5 where matching behavior was first committed.  

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

Fix incorrect path in pg_regress log messages.

commit   : de184e57e894b13f51c4f30788d20f385b547048    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Jul 2015 01:54:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Jul 2015 01:54:17 +0900    

Click here for diff

Back-patch to 9.5 where the bug was introduced.  
  
David Christensen  

M src/test/regress/pg_regress.c

Fix portability issue in pg_upgrade test script: avoid $PWD.

commit   : bb67e357b2607eea3e7c929520945a61b8cff546    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Jul 2015 12:49:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Jul 2015 12:49:18 -0400    

Click here for diff

SUSv2-era shells don't set the PWD variable, though anything more modern  
does.  In the buildfarm environment this could lead to test.sh executing  
with PWD pointing to $HOME or another high-level directory, so that there  
were conflicts between concurrent executions of the test in different  
branch subdirectories.  This appears to be the explanation for recent  
intermittent failures on buildfarm members binturong and dingo (and might  
well have something to do with the buildfarm script's failure to capture  
log files from pg_upgrade tests, too).  
  
To fix, just use `pwd` in place of $PWD.  AFAICS test.sh is the only place  
in our source tree that depended on $PWD.  Back-patch to all versions  
containing this script.  
  
Per buildfarm.  Thanks to Oskari Saarenmaa for diagnosing the problem.  

M src/bin/pg_upgrade/test.sh

Improve handling of out-of-memory in libpq.

commit   : 28c38396eda2d923974b99013b27e89a9093c766    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Jul 2015 18:37:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Jul 2015 18:37:45 +0300    

Click here for diff

If an allocation fails in the main message handling loop, pqParseInput3  
or pqParseInput2, it should not be treated as "not enough data available  
yet". Otherwise libpq will wait indefinitely for more data to arrive from  
the server, and gets stuck forever.  
  
This isn't a complete fix - getParamDescriptions and getCopyStart still  
have the same issue, but it's a step in the right direction.  
  
Michael Paquier and me. Backpatch to all supported versions.  

M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c

Add tab-completion for psql meta-commands.

commit   : 162ae5b9bb6542809453fbe9cfbb6468cb8eb06e    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 7 Jul 2015 23:24:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 7 Jul 2015 23:24:02 +0900    

Click here for diff

Based on the original code from David Christensen, modified by me.  

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

Turn install.bat into a pure one line wrapper fort he perl script.

commit   : e5460aa02fd0e3e51b57aac1d15b3d2b494aac57    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Jul 2015 16:31:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Jul 2015 16:31:52 +0300    

Click here for diff

Build.bat and vcregress.bat got similar treatment years ago. I'm not sure  
why install.bat wasn't treated at the same time, but it seems like a good  
idea anyway.  
  
The immediate problem with the old install.bat was that it had quoting  
issues, and wouldn't work if the target directory's name contained spaces.  
This fixes that problem.  
  
I committed this to master yesterday, this is a backpatch of the same for  
all supported versions.  

M src/tools/msvc/install.bat
M src/tools/msvc/install.pl

Fix logical decoding bug leading to inefficient reopening of files.

commit   : cf051c4f9d4e990e5fce0a00bacb47b4e64261d6    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 13:13:15 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 13:13:15 +0200    

Click here for diff

When spilling transaction data to disk a simple typo caused the output  
file to be closed and reopened for every serialized change. That happens  
to not have a huge impact on linux, which is why it probably wasn't  
noticed so far, but on windows that appears to trigger actual disk  
writes after every change. Not fun.  
  
The bug fortunately does not have any impact besides speed. A change  
could end up being in the wrong segment (last instead of next), but  
since we read all files to the end, that's just ugly, not really  
problematic. It's not a problem to upgrade, since transaction spill  
files do not persist across restarts.  
  
Bug: #13484  
Reported-By: Olivier Gosseaume  
Discussion: [email protected]  
  
Backpatch to 9.4, where logical decoding was added.  

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

Fix pg_recvlogical not to fsync output when it's a tty or pipe.

commit   : 8022b0a35f7c4e71908a878c8c412b5c2ae8536c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 12:47:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Jul 2015 12:47:44 +0200    

Click here for diff

The previous coding tried to handle possible failures when fsyncing a  
tty or pipe fd by accepting EINVAL - but apparently some  
platforms (windows, OSX) don't reliably return that. So instead check  
whether the output fd refers to a pipe or a tty when opening it.  
  
Reported-By: Olivier Gosseaume, Marko Tiikkaja  
Discussion: [email protected]  
  
Backpatch to 9.4, where pg_recvlogical was added.  

M src/bin/pg_basebackup/pg_recvlogical.c

commit   : 2867f26fecafc6d9930eb751abdd7b80359a6f51    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 6 Jul 2015 19:17:57 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 6 Jul 2015 19:17:57 -0700    

Click here for diff

Also updated regression expected output to match. Noted and patch by Daniele Varrazzo.  

M src/backend/commands/policy.c
M src/backend/commands/user.c
M src/test/regress/expected/rowsecurity.out

Remove incorrect warning from pg_archivecleanup document.

commit   : a830c83c9b71b78c65c5ddd71db2ecd68601ce73    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 6 Jul 2015 20:58:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 6 Jul 2015 20:58:58 +0900    

Click here for diff

The .backup file name can be passed to pg_archivecleanup even if  
it includes the extension which is specified in -x option.  
However, previously the document incorrectly warned a user  
not to do that.  
  
Back-patch to 9.2 where pg_archivecleanup's -x option and  
the warning were added.  

M doc/src/sgml/ref/pgarchivecleanup.sgml

Make a editorial pass over pgbench's error messages.

commit   : c7673d2b1fd54caa82c9870927d0bef6518bb461    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 19:36:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 19:36:57 -0400    

Click here for diff

The lack of consistency, and lack of attention to our message style  
guidelines, was a bit striking.  Try to make 'em better.  

M src/bin/pgbench/pgbench.c

Fix some typos in regression test comments.

commit   : 486d3a2bb4b9e4c1cc64241f4b36643a22da8693    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 13:14:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 13:14:38 -0400    

Click here for diff

Back-patch to avoid unnecessary cross-branch differences.  
  
CharSyam  

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

Fix bad grammar in brin.sgml.

commit   : 9a92ad4b9eec0051296d6475feb9c9955c860a9d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:08:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:08:15 -0400    

Click here for diff

Christoph Berg  

M doc/src/sgml/brin.sgml

Make numeric form of PG version number readily available in Makefiles.

commit   : d1fec374f716ffbfb9f9a758c9b5b23c00f01fcb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:01:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jul 2015 12:01:01 -0400    

Click here for diff

Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for  
consistency with the other Make variables holding similar info,  
call the variable just VERSION_NUM not PG_VERSION_NUM.  
  
There was some discussion of making this value available as a pg_config  
value as well.  However, that would entail substantially more work than  
this two-line patch.  Given that there was not exactly universal consensus  
that we need this at all, let's just do a minimal amount of work for now.  
  
Back-patch of commit a5d489ccb7e613c7ca3be6141092b8c1d2c13fa7, so that this  
variable is actually useful for its intended purpose sometime before 2020.  
  
Michael Paquier, reviewed by Pavel Stehule  

M configure
M configure.in
M src/Makefile.global.in

Fix pgbench progress report behaviour when pgbench or a query gets stuck.

commit   : 5174ca17a2479e9f9844d72cc6e777f473f83566    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 11:04:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Jul 2015 11:04:57 +0300    

Click here for diff

There were two issues here. First, if a query got stuck so that it took  
e.g. 5 seconds, and progress interval was 1 second, no progress reports were  
printed until the query returned. Fix so that we wake up specifically to  
print the progress report. Secondly, if pgbench got stuck so that it would  
nevertheless not print a progress report on time, and enough time passes  
that it's already time to print the next progress report, just skip the one  
that was missed. Before this patch, it would print the missed one with 0 TPS  
immediately after the previous one.  
  
Fabien Coelho. Backpatch to 9.4, where progress reports were added.  

M src/bin/pgbench/pgbench.c

commit   : eeaf1b6afacba0fc0a0e1878c2ed23f4fceef039    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2015 11:53:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2015 11:53:58 +0900    

Click here for diff

Commit de76884 changed an archive recovery so that the last WAL  
segment with old timeline was renamed with suffix .partial. It should  
have updated WAL-related utilities so that they can handle such  
.paritial WAL files, but we forgot that.  
  
This patch changes pg_archivecleanup so that it can clean up even  
archived WAL files with .partial suffix. Also it allows us to specify  
.partial WAL file name as the command-line argument "oldestkeptwalfile".  
  
This patch also changes pg_resetxlog so that it can remove .partial  
WAL files in pg_xlog directory.  
  
pg_xlogdump cannot handle .partial WAL files. Per discussion,  
we decided only to document that limitation instead of adding the fix.  
Because a user can easily work around the limitation (i.e., just remove  
.partial suffix from the file name) and the fix seems complicated for  
very narrow use case.  
  
Back-patch to 9.5 where the problem existed.  
  
Review by Michael Paquier.  
Discussion: http://www.postgresql.org/message-id/CAHGQGwGxMKnVHGgTfiig2Bt_2djec0in3-DLJmtg7+nEiidFdQ@mail.gmail.com  

M doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_resetxlog/pg_resetxlog.c

Fix misuse of TextDatumGetCString().

commit   : 69e9f9639d5c569a71c82f99550e7bf2912664f1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 17:02:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jul 2015 17:02:08 -0400    

Click here for diff

"TextDatumGetCString(PG_GETARG_TEXT_P(x))" is formally wrong: a text*  
is not a Datum.  Although this coding will accidentally fail to fail on  
all known platforms, it risks leaking memory if a detoast step is needed,  
unlike "TextDatumGetCString(PG_GETARG_DATUM(x))" which is what's used  
elsewhere.  Make pg_get_object_address() fall in line with other uses.  
  
Noted while reviewing two-arg current_setting() patch.  

M src/backend/catalog/objectaddress.c

Whitespace fix - replace tab with spaces in CREATE TABLE command.

commit   : cf2b5f9b33fda1cbeb8efdfd3989b5e88af74167    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 2 Jul 2015 09:46:34 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 2 Jul 2015 09:46:34 -0700    

Click here for diff

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

Don't emit a spurious space at end of line in pg_dump of event triggers.

commit   : bcac470d5b8762629132428ddf8fc8f1baa701f3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:50:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:50:29 +0300    

Click here for diff

Backpatch to 9.3 and above, where event triggers were added.  

M src/bin/pg_dump/pg_dump.c

Use appendStringInfoString/Char et al where appropriate.

commit   : 02ec4cd179099fc409288bb55c40fea308a51204    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:32:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:32:48 +0300    

Click here for diff

Patch by David Rowley. Backpatch to 9.5, as some of the calls were new in  
9.5, and keeping the code in sync with master makes future backpatching  
easier.  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/xlog.c
M src/backend/lib/pairingheap.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c

Fix name of argument to pg_stat_file.

commit   : 00ccea9e9dcee7b4f103674d274fadc8b09075f7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:12:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:12:05 +0300    

Click here for diff

It's called "missing_ok" in the docs and in the C code.  
  
I refrained from doing a catversion bump for this, because the name of an  
input argument is just documentation, it has no effect on any callers.  
  
Michael Paquier  

M src/include/catalog/pg_proc.h

Use American spelling for "behavior".

commit   : 6c29ef48811d33fece01962b3be72511f1b1014e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:11:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Jul 2015 12:11:32 +0300    

Click here for diff

For consistency with the rest of the docs.  
  
Michael Paquier  

M doc/src/sgml/func.sgml

Allow MSVC's contribcheck and modulescheck to run independently.

commit   : e1d273efde7828947e52bb531851f67f91c628c3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 1 Jul 2015 23:28:41 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 1 Jul 2015 23:28:41 -0400    

Click here for diff

These require a temp install to have been done, so we now make sure it  
is done before proceeding.  
  
Michael Paquier.  

M src/tools/msvc/vcregress.pl

commit   : 163e29dc380137127cf7e9c23b1596b78ad0ce81    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 2 Jul 2015 10:35:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 2 Jul 2015 10:35:38 +0900    

Click here for diff

Commit 179cdd09 added macros to check if a filename is a WAL segment  
or other such file. However there were still some instances of the  
strlen + strspn combination to check for that in WAL-related utilities  
like pg_archivecleanup. Those checks can be replaced with the macros.  
  
This patch makes use of the macros in those utilities and  
which would make the code a bit easier to read.  
  
Back-patch to 9.5.  
  
Michael Paquier  

M contrib/pg_standby/pg_standby.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/xlog_internal.h

Make sampler_random_fract() actually obey its API contract.

commit   : cd7030ff085f5c378e837b392cb719cf23df9d0b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jul 2015 18:07:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jul 2015 18:07:48 -0400    

Click here for diff

This function is documented to return a value in the range (0,1),  
which is what its predecessor anl_random_fract() did.  However, the  
new version depends on pg_erand48() which returns a value in [0,1).  
The possibility of returning zero creates hazards of division by zero  
or trying to compute log(0) at some call sites, and it might well  
break third-party modules using anl_random_fract() too.  So let's  
change it to never return zero.  Spotted by Coverity.  
  
Michael Paquier, cosmetically adjusted by me  

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

Make XLogFileCopy() look the same as in 9.4.

commit   : 6cfb6d987419ce1e7bec0cf3ad22830ed3c2dc08    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Jul 2015 10:54:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Jul 2015 10:54:47 +0900    

Click here for diff

XLogFileCopy() was changed heavily in commit de76884. However it was  
partially reverted in commit 7abc685 and most of those changes to  
XLogFileCopy() were no longer needed. Then commit 7cbee7c removed  
those unnecessary code, but XLogFileCopy() looked different in master  
and 9.4 though the contents are almost the same.  
  
This patch makes XLogFileCopy() look the same in master and back-branches,  
which makes back-patching easier, per discussion on pgsql-hackers.  
Back-patch to 9.5.  
  
Discussion: [email protected]  
  
Michael Paquier  

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

commit   : 31380b900ee427e86ffff2d873c3fe0f4417f8c9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 18:47:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 18:47:32 -0400    

Click here for diff

HP's web server has apparently become case-sensitive sometime recently.  
Per bug #13479 from Daniel Abraham.  Corrected link identified by Alvaro.  

M doc/src/sgml/runtime.sgml

Test -lrt for sched_yield

commit   : ab93f90cd3a4fcdd891cee9478941c3cc65795b8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Jun 2015 14:20:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Jun 2015 14:20:38 -0300    

Click here for diff

Apparently, this is needed in some Solaris versions.  
  
Author: Oskari Saarenmaa  

M configure
M configure.in

Remove useless check for NULL subexpression.

commit   : 131926a52da0fbd77678cbd887914c83b48faa2d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 12:53:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Jun 2015 12:53:54 -0400    

Click here for diff

Coverity rightly gripes that it's silly to have a test here when  
the adjacent ExecEvalExpr() would choke on a NULL expression pointer.  
  
Petr Jelinek  

M src/backend/access/tablesample/tablesample.c

Add assertion to check the special size is sane before dereferencing it.

commit   : 302ac7f27197855afa8c89fae36c85c124ae156b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jun 2015 13:44:04 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jun 2015 13:44:04 +0300    

Click here for diff

This seems useful to catch errors of the sort I just fixed, where  
PageGetSpecialPointer is called before initializing the page.  

M src/include/storage/bufpage.h

Don't call PageGetSpecialPointer() on page until it's been initialized.

commit   : fdf28853ae6a397497b79fea69f89f4f7b9aa991    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jun 2015 13:37:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jun 2015 13:37:16 +0300    

Click here for diff

After calling XLogInitBufferForRedo(), the page might be all-zeros if it was  
not in page cache already. btree_xlog_unlink_page initialized the page  
correctly, but it called PageGetSpecialPointer before initializing it, which  
would lead to a corrupt page at WAL replay, if the unlinked page is not in  
page cache.  
  
Backpatch to 9.4, the bug came with the rewrite of B-tree page deletion.  

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

In bttext_abbrev_convert, move pfree to the right place.

commit   : b48ecf862b3896631660ee8d38054aded82a4f8b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 29 Jun 2015 23:53:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 29 Jun 2015 23:53:05 -0400    

Click here for diff

Without this, we might access memory that's already been freed, or  
leak memory if in the C locale.  
  
Peter Geoghegan  

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

Initialize GIN metapage correctly when replaying metapage-update WAL record.

commit   : 47fe4d25d57c81b9d7b2ac88783a12ee487db220    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jun 2015 00:06:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jun 2015 00:06:00 +0300    

Click here for diff

I broke this with my WAL format refactoring patch. Before that, the metapage  
was read from disk, and modified in-place regardless of the LSN. That was  
always a bit silly, as there's no need to read the old page version from  
disk disk when we're overwriting it anyway. So that was changed in 9.5, but  
I failed to add a GinInitPage call to initialize the page-headers correctly.  
Usually you wouldn't notice, because the metapage is already in the page  
cache and is not zeroed.  
  
One way to reproduce this is to perform a VACUUM on an already vacuumed  
table (so that the vacuum has no real work to do), immediately after a  
checkpoint, and then perform an immediate shutdown. After recovery, the  
page headers of the metapage will be incorrectly all-zeroes.  
  
Reported by Jeff Janes  

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

Stamp 9.5alpha1.

commit   : f78329d594c2fe893f9174d5b3da7d3fbc6dd8b6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2015 15:42:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2015 15:42:18 -0400    

Click here for diff

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

Desultory review of 9.5 release notes.

commit   : 85c25fdbd7d624928bb8a1f1fd1e5043ec35dd74    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2015 15:38:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2015 15:38:46 -0400    

Click here for diff

Minor corrections and clarifications.  Notably, for stuff that got moved  
out of contrib, make sure it's documented somewhere other than "Additional  
Modules".  
  
I'm sure these need more work, but that's all I have time for today.  

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

Code + docs review for escaping of option values (commit 11a020eb6).

commit   : cbc8d65639344c390a1d1a7f646c186ff3ad8693    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2015 12:42:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2015 12:42:52 -0400    

Click here for diff

Avoid memory leak from incorrect choice of how to free a StringInfo  
(resetStringInfo doesn't do it).  Now that pg_split_opts doesn't scribble  
on the optstr, mark that as "const" for clarity.  Attach the commentary in  
protocol.sgml to the right place, and add documentation about the  
user-visible effects of this change on postgres' -o option and libpq's  
PGOPTIONS option.  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

Replace ia64 S_UNLOCK compiler barrier with a full memory barrier.

commit   : 07cb8b02ab4c8b65bb2e3b87ad2402fdc6cce978    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Jun 2015 14:53:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Jun 2015 14:53:32 +0200    

Click here for diff

_Asm_sched_fence() is just a compiler barrier, not a memory barrier. But  
spinlock release on IA64 needs, at the very least, release  
semantics. Use a full barrier instead.  
  
This might be the cause for the occasional failures on buildfarm member  
anole.  
  
Discussion: [email protected]  

M src/include/storage/s_lock.h

Translation updates

commit   : c5e5d444de85a7caff462443c5915544d4406a62    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 28 Jun 2015 23:56:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 28 Jun 2015 23:56:55 -0400    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/fr.po
M src/backend/po/ru.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/fr.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_resetxlog/po/fr.po
M src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/po/de.po
M src/bin/psql/po/de.po
M src/bin/psql/po/fr.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/fr.po
M src/interfaces/ecpg/ecpglib/po/fr.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/fr.po
M src/pl/plperl/po/fr.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpython/po/fr.po
M src/pl/tcl/po/fr.po

Run the C portions of guc-file.l through pgindent.

commit   : 2bdc51a2946f9a66688eb705cd0cb584ebd8240a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Jun 2015 20:49:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Jun 2015 20:49:35 -0400    

Click here for diff

Yeah, I know, pretty anal-retentive of me.  But we oughta find some  
way to automate this for the .y and .l files.  

M src/backend/utils/misc/guc-file.l

Improve design and implementation of pg_file_settings view.

commit   : 62d16c7fc5614d9f4d0dd1a9f164b232c273c128    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Jun 2015 18:06:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Jun 2015 18:06:14 -0400    

Click here for diff

As first committed, this view reported on the file contents as they were  
at the last SIGHUP event.  That's not as useful as reporting on the current  
contents, and what's more, it didn't work right on Windows unless the  
current session had serviced at least one SIGHUP.  Therefore, arrange to  
re-read the files when pg_show_all_settings() is called.  This requires  
only minor refactoring so that we can pass changeVal = false to  
set_config_option() so that it won't actually apply any changes locally.  
  
In addition, add error reporting so that errors that would prevent the  
configuration files from being loaded, or would prevent individual settings  
from being applied, are visible directly in the view.  This makes the view  
usable for pre-testing whether edits made in the config files will have the  
desired effect, before one actually issues a SIGHUP.  
  
I also added an "applied" column so that it's easy to identify entries that  
are superseded by later entries; this was the main use-case for the original  
design, but it seemed unnecessarily hard to use for that.  
  
Also fix a 9.4.1 regression that allowed multiple entries for a  
PGC_POSTMASTER variable to cause bogus complaints in the postmaster log.  
(The issue here was that commit bf007a27acd7b2fb unintentionally reverted  
3e3f65973a3c94a6, which suppressed any duplicate entries within  
ParseConfigFp.  However, since the original coding of the pg_file_settings  
view depended on such suppression *not* happening, we couldn't have fixed  
this issue now without first doing something with pg_file_settings.  
Now we suppress duplicates by marking them "ignored" within  
ProcessConfigFileInternal, which doesn't hide them in the view.)  
  
Lesser changes include:  
  
Drive the view directly off the ConfigVariable list, instead of making a  
basically-equivalent second copy of the data.  There's no longer any need  
to hang onto the data permanently, anyway.  
  
Convert show_all_file_settings() to do its work in one call and return a  
tuplestore; this avoids risks associated with assuming that the GUC state  
will hold still over the course of query execution.  (I think there were  
probably latent bugs here, though you might need something like a cursor  
on the view to expose them.)  
  
Arrange to run SIGHUP processing in a short-lived memory context, to  
forestall process-lifespan memory leaks.  (There is one known leak in this  
code, in ProcessConfigDirectory; it seems minor enough to not be worth  
back-patching a specific fix for.)  
  
Remove mistaken assignment to ConfigFileLineno that caused line counting  
after an include_dir directive to be completely wrong.  
  
Add missed failure check in AlterSystemSetConfigFile().  We don't really  
expect ParseConfigFp() to fail, but that's not an excuse for not checking.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/release-9.5.sgml
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/guc.h
M src/test/regress/expected/rules.out

Also trigger restartpoints based on max_wal_size on standby.

commit   : d661532e27b34e9c89d0700c6ce246731e70072c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jun 2015 00:09:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jun 2015 00:09:10 +0300    

Click here for diff

When archive recovery and restartpoints were initially introduced,  
checkpoint_segments was ignored on the grounds that the files restored from  
archive don't consume any space in the recovery server. That was changed in  
later releases, but even then it was arguably a feature rather than a bug,  
as performing restartpoints as often as checkpoints during normal operation  
might be excessive, but you might nevertheless not want to waste a lot of  
space for pre-allocated WAL by setting checkpoint_segments to a high value.  
But now that we have separate min_wal_size and max_wal_size settings, you  
can bound WAL usage with max_wal_size, and still avoid consuming excessive  
space usage by setting min_wal_size to a lower value, so that argument is  
moot.  
  
There are still some issues with actually limiting the space usage to  
max_wal_size: restartpoints in recovery can only start after seeing the  
checkpoint record, while a checkpoint starts flushing buffers as soon as  
the redo-pointer is set. Restartpoint is paced to happen at the same  
leisurily speed, determined by checkpoint_completion_target, as checkpoints,  
but because they are started later, max_wal_size can be exceeded by upto  
one checkpoint cycle's worth of WAL, depending on  
checkpoint_completion_target. But that seems better than not trying at all,  
and max_wal_size is a soft limit anyway.  
  
The documentation already claimed that max_wal_size is obeyed in recovery,  
so this just fixes the behaviour to match the docs. However, add some  
weasel-words there to mention that max_wal_size may well be exceeded by  
some amount in recovery.  

M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/checkpointer.c

Fix markup in docs.

commit   : 6ab4d38ab085b0177d7ce63f7e1f2fb3f3a8e4a5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jun 2015 00:01:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jun 2015 00:01:26 +0300    

Click here for diff

Oops. I could swear I built the docs before pushing, but I guess not..  

M doc/src/sgml/func.sgml

Promote the assertion that XLogBeginInsert() is not called twice into ERROR.

commit   : a32c3ec893cafbd3a4b42c34270a80198f28f123    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 22:25:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 22:25:55 +0300    

Click here for diff

Seems like cheap insurance for WAL bugs. A spurious call to  
XLogBeginInsert() in itself would be fairly harmless, but if there is any  
data registered and the insertion is not completed/cancelled properly, there  
is a risk that the data ends up in a wrong WAL record.  
  
Per Jeff Janes's suggestion.  

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

Fix double-XLogBeginInsert call in GIN page splits.

commit   : a45c70acf35e43257d86313dcbb7bb0e5201fab1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 21:59:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 21:59:29 +0300    

Click here for diff

If data checksums or wal_log_hints is on, and a GIN page is split, the code  
to find a new, empty, block was called after having already called  
XLogBeginInsert(). That causes an assertion failure or PANIC, if finding the  
new block involves updating a FSM page that had not been modified since last  
checkpoint, because that update is WAL-logged, which calls XLogBeginInsert  
again. Nested XLogBeginInsert calls are not supported.  
  
To fix, rearrange GIN code so that XLogBeginInsert is called later, after  
finding the victim buffers.  
  
Reported by Jeff Janes.  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c

Don't choke on files that are removed while pg_rewind runs.

commit   : b36805f3c54fe0e50e58bb9e6dad66daca46fbf6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 21:35:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 21:35:51 +0300    

Click here for diff

If a file is removed from the source server, while pg_rewind is running, the  
invocation of pg_read_binary_file() will fail. Use the just-added missing_ok  
option to that function, to have it return NULL instead, and handle that  
gracefully. And similarly for pg_ls_dir and pg_stat_file.  
  
Reported by Fujii Masao, fix by Michael Paquier.  

M src/bin/pg_rewind/libpq_fetch.c

Add missing_ok option to the SQL functions for reading files.

commit   : cb2acb1081e13b4b27a76c6b5311115528e49c59    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 21:35:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 28 Jun 2015 21:35:46 +0300    

Click here for diff

This makes it possible to use the functions without getting errors, if there  
is a chance that the file might be removed or renamed concurrently.  
pg_rewind needs to do just that, although this could be useful for other  
purposes too. (The changes to pg_rewind to use these functions will come in  
a separate commit.)  
  
The read_binary_file() function isn't very well-suited for extensions.c's  
purposes anymore, if it ever was. So bite the bullet and make a copy of it  
in extension.c, tailored for that use case. This seems better than the  
accidental code reuse, even if it's a some more lines of code.  
  
Michael Paquier, with plenty of kibitzing by me.  

M doc/src/sgml/func.sgml
M src/backend/commands/extension.c
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Fix comment for GetCurrentIntegerTimestamp().

commit   : cca8ba9529f8815acd23fe88c32763765d0e1b68    
  
author   : Kevin Grittner <[email protected]>    
date     : Sun, 28 Jun 2015 12:43:59 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sun, 28 Jun 2015 12:43:59 -0500    

Click here for diff

The unit of measure is microseconds, not milliseconds.  
  
Backpatch to 9.3 where the function and its comment were added.  

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

Fix function declaration style to respect the coding standard.

commit   : 527e6d3f099df22783465ca7046fc0c8a534c921    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 28 Jun 2015 18:54:27 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 28 Jun 2015 18:54:27 +0900    

Click here for diff

M src/bin/pgbench/pgbench.c

Avoid passing NULL to memcmp() in lookups of zero-argument functions.

commit   : 0a52d378b03b7d5ab1d64627a87edaf5ed311c6c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2015 17:47:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2015 17:47:39 -0400    

Click here for diff

A few places assumed they could pass NULL for the argtypes array when  
looking up functions known to have zero arguments.  At first glance  
it seems that this should be safe enough, since memcmp() is surely not  
allowed to fetch any bytes if its count argument is zero.  However,  
close reading of the C standard says that such calls have undefined  
behavior, so we'd probably best avoid it.  
  
Since the number of places doing this is quite small, and some other  
places looking up zero-argument functions were already passing dummy  
arrays, let's standardize on the latter solution rather than hacking  
the function lookup code to avoid calling memcmp() in these cases.  
I also added Asserts to catch any future violations of the new rule.  
  
Given the utter lack of any evidence that this actually causes any  
problems in the field, I don't feel a need to back-patch this change.  
  
Per report from Piotr Stefaniak, though this is not his patch.  

M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c

Fix test_decoding's handling of nonexistant columns in old tuple versions.

commit   : d47a1136e441cebe7ae7fe72d70eb8ce278d5cd6    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 27 Jun 2015 18:49:00 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 27 Jun 2015 18:49:00 +0200    

Click here for diff

test_decoding used fastgetattr() to extract column values. That's wrong  
when decoding updates and deletes if a table's replica identity is set  
to FULL and new columns have been added since the old version of the  
tuple was created. Due to the lack of a crosscheck with the datum's  
natts values an invalid value will be output, leading to errors or  
worse.  
  
Bug: #13470  
Reported-By: Krzysztof Kotlarski  
Discussion: [email protected]  
  
Backpatch to 9.4, where the feature, including the bug, was added.  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/test_decoding.c

Add opaque declaration of HTAB to tqual.h.

commit   : 604e99396de02f6f23950ee373c13335d2ccdf05    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 27 Jun 2015 09:55:06 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 27 Jun 2015 09:55:06 -0500    

Click here for diff

Commit b89e151054a05f0f6d356ca52e3b725dd0505e53 added the  
ResolveCminCmaxDuringDecoding declaration to tqual.h, which uses an  
HTAB parameter, without declaring HTAB.  It accidentally fails to  
fail to build with current sources because a declaration happens to  
be included, directly or indirectly, in all source files that  
currently use tqual.h before tqual.h is first included, but we  
shouldn't count on that.  Since an opaque declaration is enough  
here, just use that, as was done in snapmgr.h.  
  
Backpatch to 9.4, where the HTAB reference was added to tqual.h.  

M src/include/utils/tqual.h

Fix typo in comment

commit   : 7845db2aa778aa751b41cff72c41c94993e975e3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 27 Jun 2015 10:17:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 27 Jun 2015 10:17:42 +0300    

Click here for diff

Etsuro Fujita  

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

Avoid hot standby cancels from VAC FREEZE

commit   : 66fbcb0d2e1b201477dd2977b6eb93b1cfd9dd6c    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 27 Jun 2015 00:41:47 +0100    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 27 Jun 2015 00:41:47 +0100    

Click here for diff

VACUUM FREEZE generated false cancelations of standby queries on an  
otherwise idle master. Caused by an off-by-one error on cutoff_xid  
which goes back to original commit.  
  
Backpatch to all versions 9.0+  
  
Analysis and report by Marco Nenciarini  
  
Bug fix by Simon Riggs  

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

Fix DDL command collection for TRANSFORM

commit   : 7d60b2af34842ae89b1abdd31fb5d303bd43c514    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jun 2015 18:17:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jun 2015 18:17:54 -0300    

Click here for diff

Commit b488c580ae, which added the DDL command collection feature,  
neglected to update the code that commit cac76582053e had previously  
added two weeks earlier for the TRANSFORM feature.  
  
Reported by Michael Paquier.  

M src/backend/commands/functioncmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/test/modules/test_ddl_deparse/Makefile
A src/test/modules/test_ddl_deparse/expected/create_transform.out
A src/test/modules/test_ddl_deparse/sql/create_transform.sql

Fix BRIN xlog replay

commit   : 402822246866e1094d35a617775a65b4be93d322    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jun 2015 18:13:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jun 2015 18:13:05 -0300    

Click here for diff

There was a confusion about which block number to use when storing an  
item's pointer in the revmap -- the revmap page's blkno was being used,  
not the data page's blkno.  
  
Spotted-by: Jeff Janes  

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

Fix grammar.

commit   : 7c02d48e698ad38bec1399a9dcc543c80b8f5b8f    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 16:04:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 16:04:46 -0400    

Click here for diff

Reported by Peter Geoghegan.  

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

Be more conservative about removing tablespace "symlinks".

commit   : 8f15f74a44f68f9cb3a644786d3c732a5eeb237a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 15:53:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 15:53:13 -0400    

Click here for diff

Don't apply rmtree(), which will gleefully remove an entire subtree,  
and don't even apply unlink() unless it's symlink or a directory,  
the only things that we expect to find.  
  
Amit Kapila, with minor tweaks by me, per extensive discussions  
involving Andrew Dunstan, Fujii Masao, and Heikki Linnakangas,  
at least some of whom also reviewed the code.  

M src/backend/access/transam/xlog.c
M src/backend/commands/tablespace.c
M src/include/commands/tablespace.h

release notes: Add entry for commit 5ea86e6e6.

commit   : c66bc72e8a1318e43ea657ffa3798fa95f491650    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 14:48:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 14:48:52 -0400    

Click here for diff

Peter Geoghegan and Robert Haas  

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

Remove unnecessary NULL test.

commit   : 8a8c581a8c99b9beecbdc517957da866f427f297    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 14:45:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 14:45:32 -0400    

Click here for diff

Spotted by Coverity and reported by Michael Paquier.  Per discussion,  
we don't necessarily care about making Coverity happy in all such  
instances, but we can go ahead and change them where it otherwise  
seems to improve the code.  

M src/bin/pg_upgrade/controldata.c

release notes: Combine items for pg_upgrade and pg_upgrade_support moves.

commit   : 31c018ecda9f40fe80055d8ba95248c023593fb4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 14:20:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 14:20:29 -0400    

Click here for diff

Per suggestions from Amit Langote and Álvaro Herrera.  

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

Don't warn about creating temporary or unlogged hash indexes.

commit   : 9043ef390f4f0b4586cfe59cbd22314b9c3e2957    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 11:37:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 11:37:32 -0400    

Click here for diff

Warning people that no WAL-logging will be done doesn't make sense  
in this case.  
  
Michael Paquier  

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

Reduce log level for background worker events from LOG to DEBUG1.

commit   : 91118f1a59f2038f072552fdbb98e01363e30b59    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 11:23:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 11:23:32 -0400    

Click here for diff

Per discussion, LOG is just too chatty for something that will happen  
as routinely as this.  
  
Pavel Stehule  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c

Fix the fallback memory barrier implementation to be reentrant.

commit   : 1b468a131bd260c9041484f78b8580c7f232d580    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Jun 2015 17:00:01 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Jun 2015 17:00:01 +0200    

Click here for diff

This was essentially "broken" since 0c8eda62; but until more  
recently (14e8803f) barriers usage in signal handlers was infrequent.  
  
The failure to be reentrant was noticed because the test_shm_mq, which  
uses memory barriers at a high frequency, occasionally got stuck on some  
solaris buildfarm animals. Turns out, those machines use sun studio  
12.1, which doesn't yet have efficient memory barrier support. A machine  
with a newer sun studio did not fail.  Forcing the barrier fallback to  
be used on x86 allows to reproduce the problem.  
  
The new fallback is to use kill(PostmasterPid, 0) based on the theory  
that that'll always imply a barrier due to checking the liveliness of  
PostmasterPid on systems old enough to need fallback support. It's hard  
to come up with a good and performant fallback.  
  
I'm not backpatching this for now - the problem isn't active in the back  
branches, and we haven't backpatched barrier changes for  
now. Additionally master looks entirely different than the back branches  
due to the new atomics abstraction. It seems better to let this rest in  
master, where the non-reentrancy actively causes a problem, and then  
consider backpatching.  
  
Found-By: Robert Haas  
Discussion: [email protected]  

M src/backend/port/atomics.c

Improve handling of CustomPath/CustomPlan(State) children.

commit   : 5ca611841bcd37c7ee8448c46c8398ef8d8edcc4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 09:40:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jun 2015 09:40:47 -0400    

Click here for diff

Allow CustomPath to have a list of paths, CustomPlan a list of plans,  
and CustomPlanState a list of planstates known to the core system, so  
that custom path/plan providers can more reasonably use this  
infrastructure for nodes with multiple children.  
  
KaiGai Kohei, per a design suggestion from Tom Lane, with some  
further kibitzing by me.  

M doc/src/sgml/custom-scan.sgml
M src/backend/commands/explain.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

Fix a couple of bugs with wal_log_hints.

commit   : 4b8e24b9ad308c30dbe2184e06848e638e018114    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Jun 2015 12:38:24 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Jun 2015 12:38:24 +0300    

Click here for diff

1. Replay of the WAL record for setting a bit in the visibility map  
contained an assertion that a full-page image of that record type can only  
occur with checksums enabled. But it can also happen with wal_log_hints, so  
remove the assertion. Unlike checksums, wal_log_hints can be changed on the  
fly, so it would be complicated to figure out if it was enabled at the time  
that the WAL record was generated.  
  
2. wal_log_hints has the same effect on the locking needed to read the LSN  
of a page as data checksums. BufferGetLSNAtomic() didn't get the memo.  
  
Backpatch to 9.4, where wal_log_hints was added.  

M src/backend/access/heap/heapam.c
M src/backend/storage/buffer/bufmgr.c

Allow background workers to connect to no particular database.

commit   : f7bb7f0625771bc71869cdadafcf54450b2db08f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 25 Jun 2015 15:52:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 25 Jun 2015 15:52:13 -0400    

Click here for diff

The documentation claims that this is supported, but it didn't  
actually work.  Fix that.  
  
Reported by Pavel Stehule; patch by me.  

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

Fix the logic for putting relations into the relcache init file.

commit   : 5d1ff6bd559ea8df1b7302e245e690b01b9a4fa4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jun 2015 14:39:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jun 2015 14:39:05 -0400    

Click here for diff

Commit f3b5565dd4e59576be4c772da364704863e6a835 was a couple of bricks shy  
of a load; specifically, it missed putting pg_trigger_tgrelid_tgname_index  
into the relcache init file, because that index is not used by any  
syscache.  However, we have historically nailed that index into cache for  
performance reasons.  The upshot was that load_relcache_init_file always  
decided that the init file was busted and silently ignored it, resulting  
in a significant hit to backend startup speed.  
  
To fix, reinstantiate RelationIdIsInInitFile() as a wrapper around  
RelationSupportsSysCache(), which can know about additional relations  
that should be in the init file despite being unknown to syscache.c.  
  
Also install some guards against future mistakes of this type: make  
write_relcache_init_file Assert that all nailed relations get written to  
the init file, and make load_relcache_init_file emit a WARNING if it takes  
the "wrong number of nailed relations" exit path.  Now that we remove the  
init files during postmaster startup, that case should never occur in the  
field, even if we are starting a minor-version update that added or removed  
rels from the nailed set.  So the warning shouldn't ever be seen by end  
users, but it will show up in the regression tests if somebody breaks this  
logic.  
  
Back-patch to all supported branches, like the previous commit.  

M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/include/utils/relcache.h

Docs: fix claim that to_char('FM') removes trailing zeroes.

commit   : d759b7eb6aee12bd52516905d790072845b4356f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jun 2015 10:44:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jun 2015 10:44:03 -0400    

Click here for diff

Of course, what it removes is leading zeroes.  Seems to have been a thinko  
in commit ffe92d15d53625d5ae0c23f4e1984ed43614a33d.  Noted by Hubert Depesz  
Lubaczewski.  

M doc/src/sgml/func.sgml

Add index terms for functions jsonb_set and jsonb_pretty.

commit   : 0b157a0dad4f88f6f4420faa4cddab1e5112988f    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 24 Jun 2015 22:30:19 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 24 Jun 2015 22:30:19 +0900    

Click here for diff

M doc/src/sgml/func.sgml

Update get_relation_info comment.

commit   : 51d0fe5d5682a65e3bce7aa62d8666509fd08aa2    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 23 Jun 2015 10:08:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 23 Jun 2015 10:08:30 -0400    

Click here for diff

Thomas Munro  

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

Add missing newline to debug-message.

commit   : 9cb36981fbbf2f298db2476101f4475c52d00fbb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 23 Jun 2015 15:49:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 23 Jun 2015 15:49:28 +0300    

Click here for diff

Michael Paquier  

M src/bin/pg_rewind/libpq_fetch.c

pg_rewind: Improve message wording

commit   : e98d635d5dbf25e5cde282af111af9fdffafa557    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jun 2015 20:40:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jun 2015 20:40:01 -0400    

Click here for diff

M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c

pg_basebackup: Remove redundant newline in error message

commit   : 747781f25e7eaa2e5cb5ed69bdae3e5f61795d2e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jun 2015 20:39:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jun 2015 20:39:41 -0400    

Click here for diff

M src/bin/pg_basebackup/streamutil.c

Improve inheritance_planner()'s performance for large inheritance sets.

commit   : 2cb9ec1bcb35dd6b4cf7a4a325aaa9791444e69d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jun 2015 18:53:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jun 2015 18:53:27 -0400    

Click here for diff

Commit c03ad5602f529787968fa3201b35c119bbc6d782 introduced a planner  
performance regression for UPDATE/DELETE on large inheritance sets.  
It required copying the append_rel_list (which is of size proportional to  
the number of inherited tables) once for each inherited table, thus  
resulting in O(N^2) time and memory consumption.  While it's difficult to  
avoid that in general, the extra work only has to be done for  
append_rel_list entries that actually reference subquery RTEs, which  
inheritance-set entries will not.  So we can buy back essentially all of  
the loss in cases without subqueries in FROM; and even for those, the added  
work is mainly proportional to the number of UNION ALL subqueries.  
  
Back-patch to 9.2, like the previous commit.  
  
Tom Lane and Dean Rasheed, per a complaint from Thomas Munro.  

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

psql: Add some tab completion for TABLESAMPLE.

commit   : da9ee026a0ddd100785b00defd1201b317c0797b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Jun 2015 14:13:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Jun 2015 14:13:56 -0400    

Click here for diff

Petr Jelinek, reviewed by Brendan Jurd  

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

Truncate strings in tarCreateHeader() with strlcpy(), not sprintf().

commit   : 4318118edd5582696027f357771e0a8b091fe2bf    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 21 Jun 2015 20:04:36 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 21 Jun 2015 20:04:36 -0400    

Click here for diff

This supplements the GNU libc bug #6530 workarounds introduced in commit  
54cd4f04576833abc394e131288bf3dd7dcf4806.  On affected systems, a  
tar-format pg_basebackup failed when some filename beneath the data  
directory was not valid character data in the postmaster/walsender  
locale.  Back-patch to 9.1, where pg_basebackup was introduced.  Extant,  
bug-prone conversion specifications receive only ASCII bytes or involve  
low-importance messages.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/port/tar.c

Add transforms to pg_get_object_address and friends

commit   : ad89a5d115b3b4025f3c135f95f722e7e4becf13    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 21 Jun 2015 16:08:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 21 Jun 2015 16:08:49 -0300    

Click here for diff

This was missed when transforms were added by commit cac76582053ef8e.  
  
Extracted from a larger patch  
Author: Michael Paquier  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Improve multixact emergency autovacuum logic.

commit   : 667912aee649c3608e003568e4b47d95251b1c8c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 21 Jun 2015 18:57:28 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 21 Jun 2015 18:57:28 +0200    

Click here for diff

Previously autovacuum was not necessarily triggered if space in the  
members slru got tight. The first problem was that the signalling was  
tied to values in the offsets slru, but members can advance much  
faster. Thats especially a problem if old sessions had been around that  
previously prevented the multixact horizon to increase. Secondly the  
skipping logic doesn't work if the database was restarted after  
autovacuum was triggered - that knowledge is not preserved across  
restart. This is especially a problem because it's a common  
panic-reaction to restart the database if it gets slow to  
anti-wraparound vacuums.  
  
Fix the first problem by separating the logic for members from  
offsets. Trigger autovacuum whenever a multixact crosses a segment  
boundary, as the current member offset increases in irregular values, so  
we can't use a simple modulo logic as for offsets.  Add a stopgap for  
the second problem, by signalling autovacuum whenver ERRORing out  
because of boundaries.  
  
Discussion: [email protected]  
  
Backpatch into 9.3, where it became more likely that multixacts wrap  
around.  

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

Add missing check for wal_debug GUC.

commit   : 90231cd5188c43da94f58f7a839eee9286d0f864    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 21 Jun 2015 18:35:59 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 21 Jun 2015 18:35:59 +0200    

Click here for diff

9a20a9b2 added a new elog(), enabled when WAL_DEBUG is defined. The  
other WAL_DEBUG dependant messages check for the wal_debug GUC, but this  
one did not. While at it replace 'upto' with 'up to'.  
  
Discussion: [email protected]  
  
Backpatch to 9.4, the first release containing 9a20a9b2.  

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

PL/Perl: Add alternative expected file for Perl 5.22

commit   : 103382abf87453d6555755da8f9fbef0b9965f81    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 21 Jun 2015 10:37:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 21 Jun 2015 10:37:24 -0400    

Click here for diff

A src/pl/plperl/expected/plperl_elog_1.out

Fix failure to copy setlocale() return value.

commit   : f0a264a362343287051c4737b01aa3ebe36f21a6    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 20 Jun 2015 12:09:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 20 Jun 2015 12:09:29 -0400    

Click here for diff

POSIX permits setlocale() calls to invalidate any previous setlocale()  
return values, but commit 5f538ad004aa00cf0881f179f0cde789aad4f47e  
neglected to account for setlocale(LC_CTYPE, NULL) doing so.  The effect  
was to set the LC_CTYPE environment variable to an unintended value.  
pg_perm_setlocale() sets this variable to assist PL/Perl; without it,  
Perl would undo PostgreSQL's locale settings.  The known-affected  
configurations are 32-bit, release builds using Visual Studio 2012 or  
Visual Studio 2013.  Visual Studio 2010 is unaffected, as were all  
buildfarm-attested configurations.  In principle, this bug could leave  
the wrong LC_CTYPE in effect after PL/Perl use, which could in turn  
facilitate problems like corrupt tsvector datums.  No known platform  
experiences that consequence, because PL/Perl on Windows does not use  
this environment variable.  
  
The bug has been user-visible, as early postmaster failure, on systems  
with Windows ANSI code page set to CP936 for "Chinese (Simplified, PRC)"  
and probably on systems using other multibyte code pages.  
(SetEnvironmentVariable() rejects values containing character data not  
valid under the Windows ANSI code page.)  Back-patch to 9.4, where the  
faulty commit first appeared.  
  
Reported by Didi Hu and 林鹏程.  Reviewed by Tom Lane, though this fix  
strategy was not his first choice.  

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

Revert "Detect setlocale(LC_CTYPE, NULL) clobbering previous return values."

commit   : 1f2a378de41bf3e516b8d2c4d65790aeefbfb89d    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 20 Jun 2015 12:08:48 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 20 Jun 2015 12:08:48 -0400    

Click here for diff

This reverts commit b76e76be460a240e99c33f6fb470dd1d5fe01a2a.  The  
buildfarm yielded no related failures.  

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

Fix BRIN supported operators table

commit   : 1443a165db007462c5044ad8d03d919ac4323e6d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 20 Jun 2015 12:26:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 20 Jun 2015 12:26:36 -0300    

Click here for diff

Some of the entries in the inclusion opclasses where missing operators,  
and we had an entry for inet_inclusion_ops instead of  
network_inclusion_ops.  Sort the operators within each opclass by  
strategy number, just to make it easier to spot mistakes.  
  
Also sort the rows by data type name, rather than OID.  

M doc/src/sgml/brin.sgml

Fix thinko in comment (launcher -> worker)

commit   : 3c400a3f2bf4bb93a60cefc09416d37fc3dab8ed    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 20 Jun 2015 11:45:59 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 20 Jun 2015 11:45:59 -0300    

Click here for diff

M src/backend/postmaster/autovacuum.c

In immediate shutdown, postmaster should not exit till children are gone.

commit   : 48913db887e6a41fa3f1b6cdf80ee89e38f21d9d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Jun 2015 14:23:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Jun 2015 14:23:39 -0400    

Click here for diff

This adjusts commit 82233ce7ea42d6ba519aaec63008aff49da6c7af so that the  
postmaster does not exit until all its child processes have exited, even  
if the 5-second timeout elapses and we have to send SIGKILL.  There is no  
great value in having the postmaster process quit sooner, and doing so can  
mislead onlookers into thinking that the cluster is fully terminated when  
actually some child processes still survive.  
  
This effect might explain recent test failures on buildfarm member hamster,  
wherein we failed to restart a cluster just after shutting it down with  
"pg_ctl stop -m immediate".  
  
I also did a bit of code review/beautification, including fixing a faulty  
use of the Max() macro on a volatile expression.  
  
Back-patch to 9.4.  In older branches, the postmaster never waited for  
children to exit during immediate shutdowns, and changing that would be  
too much of a behavioral change.  

M doc/src/sgml/runtime.sgml
M src/backend/postmaster/postmaster.c

Clamp autovacuum launcher sleep time to 5 minutes

commit   : da1a9d0f5bed1f93908be9233a4fef39b988e505    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jun 2015 12:44:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jun 2015 12:44:36 -0300    

Click here for diff

This avoids the problem that it might go to sleep for an unreasonable  
amount of time in unusual conditions like the server clock moving  
backwards an unreasonable amount of time.  
  
(Simply moving the server clock forward again doesn't solve the problem  
unless you wake up the autovacuum launcher manually, say by sending it  
SIGHUP).  
  
Per trouble report from Prakash Itnal in  
https://www.postgresql.org/message-id/CAHC5u79-UqbapAABH2t4Rh2eYdyge0Zid-X=Xz-ZWZCBK42S0Q@mail.gmail.com  
  
Analyzed independently by Haribabu Kommi and Tom Lane.  

M src/backend/postmaster/autovacuum.c

Fix bogus range_table_mutator() logic for RangeTblEntry.tablesample.

commit   : be87143fe90adf8862791aeddd76151e88ce5603    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Jun 2015 11:41:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Jun 2015 11:41:45 -0400    

Click here for diff

Must make a copy of the TableSampleClause node; the previous coding  
modified the input data structure in-place.  
  
Petr Jelinek  

M src/backend/nodes/nodeFuncs.c

Fix corner case in autovacuum-forcing logic for multixact wraparound.

commit   : ed16f73c574660aa0902caa1c0adeba07f8c70a5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Jun 2015 11:28:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Jun 2015 11:28:30 -0400    

Click here for diff

Since find_multixact_start() relies on SimpleLruDoesPhysicalPageExist(),  
and that function looks only at the on-disk state, it's possible for it  
to fail to find a page that exists in the in-memory SLRU that has not  
been written yet.  If that happens, SetOffsetVacuumLimit() will  
erroneously decide to force emergency autovacuuming immediately.  
  
We should probably fix find_multixact_start() to consider the data  
cached in memory as well as on the on-disk state, but that's no excuse  
for SetOffsetVacuumLimit() to be stupid about the case where it can  
no longer read the value after having previously succeeded in doing so.  
  
Report by Andres Freund.  

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

Add PASSWORD to tab completions for CREATE/ALTER ROLE/USER/GROUP.

commit   : 86e4751786bb0dcb29528ef49b067d0e393e4934    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Jun 2015 11:11:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Jun 2015 11:11:22 -0400    

Click here for diff

Jeevan Chalke  

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

Change TAP test framework to not rely on having a chmod executable.

commit   : ca3f43aa48a83013ea50aeee7cd193a5859c4587    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Jun 2015 10:46:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Jun 2015 10:46:30 -0400    

Click here for diff

This might not work at all on Windows, and is not ever efficient.  
  
Michael Paquier  

M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl

Detect setlocale(LC_CTYPE, NULL) clobbering previous return values.

commit   : b76e76be460a240e99c33f6fb470dd1d5fe01a2a    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 17 Jun 2015 08:13:33 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 17 Jun 2015 08:13:33 -0400    

Click here for diff

POSIX permits setlocale() calls to invalidate any previous setlocale()  
return values.  Commit 5f538ad004aa00cf0881f179f0cde789aad4f47e  
neglected to account for that.  In advance of fixing that bug, switch to  
failing hard on affected configurations.  This is a planned temporary  
commit to assay buildfarm-represented configurations.  

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

Fix comment in fmgr.h to refer to actual function used.

commit   : 41d798a139b5c94ad8ce10b192141b5bcc03dda3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 15 Jun 2015 23:21:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 15 Jun 2015 23:21:03 -0400    

Click here for diff

FunctionLookup() is long gone if it ever existed, and fmgr_info() is  
what's now used, so the comments now reflect that.  

M src/include/fmgr.h

Check for out of memory when allocating sqlca.

commit   : 94a484222caece19e381a6941b8d826027ac2e75    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 15 Jun 2015 14:21:03 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 15 Jun 2015 14:21:03 +0200    

Click here for diff

Patch by Michael Paquier  

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/misc.c

Fix memory leak in ecpglib's connect function.

commit   : af0b49fc98cb3494d1e444a4f5c3364627a3ed5f    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 15 Jun 2015 14:20:09 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 15 Jun 2015 14:20:09 +0200    

Click here for diff

Patch by Michael Paquier  

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

release notes: fix Petr's name typos

commit   : 2bed1cd7519fb9f017a8e2ce9881086f14a31d7c    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 14 Jun 2015 13:41:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 14 Jun 2015 13:41:37 -0400    

Click here for diff

Report by Alvaro Herrera  

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

doc: Add note to pg_dump man page about pg_dumpall

commit   : a85054181b3e60d44d896168127b7f7e204ea9f4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jun 2015 21:45:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jun 2015 21:45:56 -0400    

Click here for diff

suggested by Joshua Drake  

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

Remove stray character

commit   : 340c74dfdfb91d521fbdb20e5601973266da3428    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jun 2015 21:41:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jun 2015 21:41:34 -0400    

Click here for diff

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

release notes: consistently name "Alexander Shulgin"

commit   : 74cb688525e347121978a502368c76cd6af1bdd6    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 21:10:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 21:10:48 -0400    

Click here for diff

Report by Alvaro Herrera  

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

release notes: move/remove/adjust items

commit   : 62331ef3f67ec9ad16a26dec276b634f704de8d4    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 21:07:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 21:07:24 -0400    

Click here for diff

Report by Alvaro Herrera  

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

release notes: add accent to Petr Jelínek last name

commit   : 305f815ccd059fb31193939a060fc524ddd5a0ea    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 21:00:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 21:00:30 -0400    

Click here for diff

Report by Alvaro Herrera  

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

release notes: remove mention of pg_basebackup non-compat

commit   : 31cda8bf3c3209e0740dd2c8fa5aa1d0319f7292    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 20:56:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 13 Jun 2015 20:56:30 -0400    

Click here for diff

Report by Amit Kapila  

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

release notes: add Petr Jelinek to JSON function item

commit   : 29d80d5fa8c61e635e5be4c0be859438e4209117    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:34:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:34:31 -0400    

Click here for diff

Report by Petr Jelinek  

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

release notes: fixes from Fujii Masao

commit   : 230ff9383c63ebfef11bfd6ba89aed7329b96c7e    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:31:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:31:17 -0400    

Click here for diff

Report by Fujii Masao  

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

release notes: reorder hash performance authors, again

commit   : 644ac3e678f43402da3fbcbd6aa8e6c5915ad9c0    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:25:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:25:30 -0400    

Click here for diff

Report by Robert Haas  

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

release notes: reorder sort performance authors

commit   : 51b47c5c095c53be4cda81e322b428167c81c6f2    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:23:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:23:40 -0400    

Click here for diff

Report by Peter Geoghegan  

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

release notes: split apart hash items

commit   : 8bf51ad0cc26e80cbd082c111f45428db7a2f73b    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:16:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 22:16:08 -0400    

Click here for diff

Report by Tom Lane, Robert Haas  

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

release notes: add two optimizer items

commit   : 89fe9bfc4ed3b5dc8e02119cc1fd39c975ffdea0    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 21:47:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Jun 2015 21:47:08 -0400    

Click here for diff

Report by Tom Lane  

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

Fix "path" infrastructure bug affecting jsonb_set()

commit   : 2271d002d5c305441398e8f7a295f18ec3c132a9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 Jun 2015 19:26:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 Jun 2015 19:26:03 -0400    

Click here for diff

jsonb_set() and other clients of the setPathArray() utility function  
could get spurious results when an array integer subscript is provided  
that is not within the range of int.  
  
To fix, ensure that the value returned by strtol() within setPathArray()  
is within the range of int;  when it isn't, assume an invalid input in  
line with existing, similar cases.  The path-orientated operators that  
appeared in PostgreSQL 9.3 and 9.4 do not call setPathArray(), and  
already independently take this precaution, so no change there.  
  
Peter Geoghegan  

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

Fix failure to cover scalar-vs-rowtype cases in exec_stmt_return().

commit   : ae58f1430abb4b0c309c40b377f91bf9d080334b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jun 2015 13:44:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jun 2015 13:44:06 -0400    

Click here for diff

In commit 9e3ad1aac52454569393a947c06be0d301749362 I modified plpgsql  
to use exec_stmt_return's simple-variables fast path in more cases.  
However, I overlooked that there are really two different return  
conventions in use here, depending on whether estate->retistuple is true,  
and the existing fast-path code had only bothered to handle one of them.  
So trying to return a scalar in a function returning composite, or vice  
versa, could lead to unexpected error messages (typically "cache lookup  
failed for type 0") or to a null-pointer-dereference crash.  
  
In the DTYPE_VAR case, we can just throw error if retistuple is true,  
corresponding to what happens in the general-expression code path that was  
being used previously.  (Perhaps someday both of these code paths should  
attempt a coercion, but today is not that day.)  
  
In the REC and ROW cases, just hand the problem to exec_eval_datum()  
when not retistuple.  Also clean up the ROW coding slightly so it looks  
more like exec_eval_datum().  
  
The previous commit also caused exec_stmt_return_next() to be used in  
more cases, but that code seems to be OK as-is.  
  
Per off-list report from Serge Rielau.  This bug is new in 9.5 so no need  
to back-patch.  

M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Improve error message and hint for ALTER COLUMN TYPE can't-cast failure.

commit   : b00982344a73d9cb626430dd17a6da84c15c9980    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jun 2015 11:54:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jun 2015 11:54:03 -0400    

Click here for diff

We already tried to improve this once, but the "improved" text was rather  
off-target if you had provided a USING clause.  Also, it seems helpful  
to provide the exact text of a suggested USING clause, so users can just  
copy-and-paste it when needed.  Per complaint from Keith Rarick and a  
suggestion from Merlin Moncure.  
  
Back-patch to 9.2 where the current wording was adopted.  

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

Make postmaster restart archiver soon after it dies, even during recovery.

commit   : b5fe62038f49f92c4a4f189c7cdacf3739effcdc    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 12 Jun 2015 23:11:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 12 Jun 2015 23:11:51 +0900    

Click here for diff

After the archiver dies, postmaster tries to start a new one immediately.  
But previously this could happen only while server was running normally  
even though archiving was enabled always (i.e., archive_mode was set to  
always). So the archiver running during recovery could not restart soon  
after it died. This is an oversight in commit ffd3774.  
  
This commit changes reaper(), postmaster's signal handler to cleanup  
after a child process dies, so that it tries to a new archiver even during  
recovery if necessary.  
  
Patch by me. Review by Alvaro Herrera.  

M src/backend/postmaster/postmaster.c
M src/include/access/xlog.h

Fixed some memory leaks in ECPG.

commit   : 96ad72d1c00fa6526eb4d5e9c2a747b44752b4ee    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 12 Jun 2015 14:52:55 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 12 Jun 2015 14:52:55 +0200    

Click here for diff

Patch by Michael Paquier  

M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/variable.c

Fix intoasc() in Informix compat lib. This function used to be a noop.

commit   : 82be1bf5099c0f6d1ef482ba3ca9cf1741db1eb3    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 12 Jun 2015 14:50:47 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 12 Jun 2015 14:50:47 +0200    

Click here for diff

Patch by Michael Paquier  

M src/interfaces/ecpg/compatlib/informix.c

Fix alphabetization in catalogs.sgml.

commit   : 091c02a958fd0ae02b96492d9728efe8526385e6    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 12 Jun 2015 12:59:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 12 Jun 2015 12:59:29 +0900    

Click here for diff

System catalogs and views should be listed alphabetically  
in catalog.sgml, but only pg_file_settings view not.  
  
This patch also fixes typos in pg_file_settings comments.  

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

Clean up useless mention of RMGRDESCSOURCES in pg_rewind Makefile.

commit   : cd3cff4778e011c584e1481a6803dec5d4756a6e    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 12 Jun 2015 12:32:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 12 Jun 2015 12:32:48 +0900    

Click here for diff

RMGRDESCSOURCES is defined and used only in pg_xlogdump Makefile,  
but pg_rewind Makefile mentioned it as extra files to remove in "make clean".  
This patch removes that useless mention from pg_rewind Makefile.  
  
Michael Paquier  

M src/bin/pg_rewind/Makefile

commit   : 66447916f719130212c7930c47e902586a4bf054    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 23:04:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 23:04:46 -0400    

Click here for diff

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

release notes: update hash item

commit   : 778fed04cd175510e9e75509033e2b985cf49e30    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 11:32:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 11:32:32 -0400    

Click here for diff

Report by Tomas Vondra  

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

release notes: move pg_buffercache item to the right section

commit   : 7b7be78a12ea98c7cb9653d78c156a83d322df6e    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 11:13:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 11:13:49 -0400    

Click here for diff

Report by Amit Langote  

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

release notes: implement suggestions

commit   : bab74070b325704f7b7a86c4bd72f9a6b3318ed7    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 11:11:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 11:11:43 -0400    

Click here for diff

Report by Michael Paquier  

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

release notes: explain meaning of pg_stat_get_snapshot_timestamp()

commit   : 1cc9f8ccd9b7406c52fb85e48435cb6d265d006e    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 10:58:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 10:58:38 -0400    

Click here for diff

Report by Michael Paquier  

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

release notes: update for pg_basebackup in tar format

commit   : 5a4ea8e2004db269497ef18048ed5238c2c6e5cb    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 10:51:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 10:51:18 -0400    

Click here for diff

Report by Amit Kapila  

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

Rename jsonb - text[] operator to #- to avoid ambiguity.

commit   : 908e234733574545866045c7d5f93d4dd50ef66d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 11 Jun 2015 10:06:58 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 11 Jun 2015 10:06:58 -0400    

Click here for diff

Following recent discussion  on -hackers. The underlying function is  
also renamed to jsonb_delete_path. The regression tests now don't need  
ugly type casts to avoid the ambiguity, so they are also removed.  
  
Catalog version bumped.  

M doc/src/sgml/func.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/jsonb.sql

Fix some issues in pg_rewind.

commit   : 966c37fdb5ed9b87f3e91eace4dbbed7909f6769    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 11 Jun 2015 22:31:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 11 Jun 2015 22:31:18 +0900    

Click here for diff

* Remove invalid option character "N" from the third argument (valid option  
string) of getopt_long().  
  
* Use pg_free() or pfree() to free the memory allocated by pg_malloc() or  
palloc() instead of always using free().  
  
* Assume problem is no disk space if write() fails but doesn't set errno.  
  
* Fix several typos.  
  
Patch by me. Review by Michael Paquier.  

M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/pg_rewind.c

First draft of 9.5 release notes

commit   : aacb8b9277ec63ee848442ccc1aa4b3f6eab1893    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 00:08:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2015 00:08:55 -0400    

Click here for diff

M doc/src/sgml/filelist.sgml
A doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release.sgml

doc: Use "connections" instead of "slots" to avoid confusion

commit   : e80f619acf018a9f79dc6188472ac94ba6742ab5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 21:34:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 21:34:03 -0400    

Click here for diff

The text was written before replication slots existed, but now "slot" is  
best not used for anything else in the space of replication.  

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

doc: Fix typo

commit   : 28d17269a1fff9fa9c4dd2c588a586a028fa4798    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 21:33:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 21:33:35 -0400    

Click here for diff

M doc/src/sgml/ref/pg_receivexlog.sgml

Fix typo

commit   : 385522c7dc6351a57e459b17cc66912daf4ab90e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 21:30:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 21:30:17 -0400    

Click here for diff

M src/backend/replication/slot.c

doc: Call xmllint for validity also in the fop build

commit   : 75a49ba550bae7a44bc1c4b2b7413a1768f70829    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 19:54:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2015 19:54:28 -0400    

Click here for diff

This was somehow missed in commit  
5d93ce2d0c619ba1b408eb749715e7223e23f6ae.  

M doc/src/sgml/Makefile

Fix typo in comment.

commit   : 870681017a9e39e25aca14a2426cdbc57e3ce2af    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 10 Jun 2015 17:03:56 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 10 Jun 2015 17:03:56 -0500    

Click here for diff

Backpatch to 9.4 to minimize possible conflicts.  

M src/include/utils/tqual.h

docs: update release note regex suggestions

commit   : 1e87d4d0680b950eabf3e050071559a6f04fa07a    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Jun 2015 16:33:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Jun 2015 16:33:46 -0400    

Click here for diff

M doc/src/sgml/release.sgml

Fix typo in comment.

commit   : ea9c4c1e4a7a9b602d867dcb02e07ef1fe51f6ec    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 10 Jun 2015 15:26:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 10 Jun 2015 15:26:02 +0900    

Click here for diff

David Rowley  

M src/include/catalog/pg_class.h

Release notes for 9.4.4, 9.3.9, 9.2.13, 9.1.18, 9.0.22.

commit   : b94085920b016e64ee40a0f6c50199889565cc56    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2015 14:33:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2015 14:33:43 -0400    

Click here for diff

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Report more information if pg_perm_setlocale() fails at startup.

commit   : f6e9cbfd9153958226b27e31d658e7b64351c71f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2015 13:37:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2015 13:37:08 -0400    

Click here for diff

We don't know why a few Windows users have seen this fail, but the  
taciturnity of the error message certainly isn't helping debug it.  
Let's at least find out which LC category isn't working.  

M src/backend/main/main.c

First-draft release notes for 9.4.4, 9.3.9, 9.2.13, 9.1.18, 9.0.22.

commit   : 21187cfc7dfd82461db9119377a76366c00d27c3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2015 13:07:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2015 13:07:15 -0400    

Click here for diff

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

Fix typos

commit   : 94232c909da4e39273efd66fc7c9c4a3fd9ef51a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 8 Jun 2015 15:35:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 8 Jun 2015 15:35:43 -0300    

Click here for diff

tablesapce -> tablespace  
there -> their  
  
These were introduced in 72d422a52, so no need to backpatch.  

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

Refactor WAL segment copying code.

commit   : 7abc68597436da1475b4d9b08f4fa9f3c5ed6185    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 9 Jun 2015 03:03:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 9 Jun 2015 03:03:24 +0900    

Click here for diff

* Remove unused argument "dstfname" and related code from XLogFileCopy().  
  
* Previously XLogFileCopy() returned a pstrdup'd string so that  
InstallXLogFileSegment() used it later. Since the pstrdup'd string was never  
free'd, there could be a risk of memory leak. It was almost harmless because  
the startup process exited just after calling XLogFileCopy(), it existed.  
This commit changes XLogFileCopy() so that it directly calls  
InstallXLogFileSegment() and doesn't call pstrdup() at all. Which fixes that  
memory leak problem.  
  
* Extend InstallXLogFileSegment() so that the caller can specify the log level.  
Which allows us to emit an error when InstallXLogFileSegment() fails a disk  
file access like link() and rename(). Previously it was always logged with  
LOG level and additionally needed to be logged with ERROR when we wanted  
to treat it as an error.  
  
Michael Paquier  

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

Allow HotStandbyActiveInReplay() to be called in single user mode.

commit   : d1b958218ac183d0e88348341ff6ba31397086ad    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2015 00:30:26 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2015 00:30:26 +0200    

Click here for diff

HotStandbyActiveInReplay, introduced in 061b079f, only allowed WAL  
replay to happen in the startup process, missing the single user case.  
  
This buglet is fairly harmless as it only causes problems when single  
user mode in an assertion enabled build is used to replay a btree vacuum  
record.  
  
Backpatch to 9.2. 061b079f was backpatched further, but the assertion  
was not.  

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

Clarify documentation of jsonb - text

commit   : 94d6727dbe61117addd9c24eea28440a2151ccf4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 7 Jun 2015 21:31:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 7 Jun 2015 21:31:52 -0400    

Click here for diff

Peter Geoghegan  

M doc/src/sgml/func.sgml

Desupport jsonb subscript deletion on objects

commit   : b81c7b4098f52e64df89efe1461ba00a54649a10    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 7 Jun 2015 20:46:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 7 Jun 2015 20:46:00 -0400    

Click here for diff

Supporting deletion of JSON pairs within jsonb objects using an  
array-style integer subscript allowed for surprising outcomes.  This was  
mostly due to the implementation-defined ordering of pairs within  
objects for jsonb.  
  
It also seems desirable to make jsonb integer subscript deletion  
consistent with the 9.4 era general purpose integer subscripting  
operator for jsonb (although that operator returns NULL when an object  
is encountered, while we prefer here to throw an error).  
  
Peter Geoghegan, following discussion on -hackers.  

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

commit   : d23a3a603b8eed5e8e34b193d43e9ca5f380ef3f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2015 20:27:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2015 20:27:27 -0400    

Click here for diff

FOP doesn't handle links to table rows, so put the link to a cell  
instead.  

M doc/src/sgml/func.sgml

Use a safer method for determining whether relcache init file is stale.

commit   : f3b5565dd4e59576be4c772da364704863e6a835    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2015 15:32:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2015 15:32:09 -0400    

Click here for diff

When we invalidate the relcache entry for a system catalog or index, we  
must also delete the relcache "init file" if the init file contains a copy  
of that rel's entry.  The old way of doing this relied on a specially  
maintained list of the OIDs of relations present in the init file: we made  
the list either when reading the file in, or when writing the file out.  
The problem is that when writing the file out, we included only rels  
present in our local relcache, which might have already suffered some  
deletions due to relcache inval events.  In such cases we correctly decided  
not to overwrite the real init file with incomplete data --- but we still  
used the incomplete initFileRelationIds list for the rest of the current  
session.  This could result in wrong decisions about whether the session's  
own actions require deletion of the init file, potentially allowing an init  
file created by some other concurrent session to be left around even though  
it's been made stale.  
  
Since we don't support changing the schema of a system catalog at runtime,  
the only likely scenario in which this would cause a problem in the field  
involves a "vacuum full" on a catalog concurrently with other activity, and  
even then it's far from easy to provoke.  Remarkably, this has been broken  
since 2002 (in commit 786340441706ac1957a031f11ad1c2e5b6e18314), but we had  
never seen a reproducible test case until recently.  If it did happen in  
the field, the symptoms would probably involve unexpected "cache lookup  
failed" errors to begin with, then "could not open file" failures after the  
next checkpoint, as all accesses to the affected catalog stopped working.  
Recovery would require manually removing the stale "pg_internal.init" file.  
  
To fix, get rid of the initFileRelationIds list, and instead consult  
syscache.c's list of relations used in catalog caches to decide whether a  
relation is included in the init file.  This should be a tad more efficient  
anyway, since we're replacing linear search of a list with ~100 entries  
with a binary search.  It's a bit ugly that the init file contents are now  
so directly tied to the catalog caches, but in practice that won't make  
much difference.  
  
Back-patch to all supported branches.  

M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/include/utils/relcache.h
M src/include/utils/syscache.h

Get rid of a //-style comment.

commit   : 1497369e5df8bb129256f677a85327f80d3767d3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2015 17:04:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2015 17:04:07 -0400    

Click here for diff

Not sure how "//XXX" got into a committed patch in the first place,  
as it's both content-free and against project style.  pgindent made a  
bit of a hash of it, too.  
  
Going forward, we should have at least one buildfarm member using  
"gcc -ansi" to catch such things, at least till such time as we  
decide the project target language isn't C90 any more.  I've turned  
this option on on dromedary.  

M src/test/regress/pg_regress.c

Fix incorrect order of database-locking operations in InitPostgres().

commit   : ac23b711dd6ccb82fb70ca0f153fe755fd809a46    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2015 13:22:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2015 13:22:27 -0400    

Click here for diff

We should set MyProc->databaseId after acquiring the per-database lock,  
not beforehand.  The old way risked deadlock against processes trying to  
copy or delete the target database, since they would first acquire the lock  
and then wait for processes with matching databaseId to exit; that left a  
window wherein an incoming process could set its databaseId and then block  
on the lock, while the other process had the lock and waited in vain for  
the incoming process to exit.  
  
CountOtherDBBackends() would time out and fail after 5 seconds, so this  
just resulted in an unexpected failure not a permanent lockup, but it's  
still annoying when it happens.  A real-world example of a use-case is that  
short-duration connections to a template database should not cause CREATE  
DATABASE to fail.  
  
Doing it in the other order should be fine since the contract has always  
been that processes searching the ProcArray for a database ID must hold the  
relevant per-database lock while searching.  Thus, this actually removes  
the former race condition that required an assumption that storing to  
MyProc->databaseId is atomic.  
  
It's been like this for a long time, so back-patch to all active branches.  

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

Cope with possible failure of the oldest MultiXact to exist.

commit   : 068cfadf9e2190bdd50a30d19efc7c9f0b825b5e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Jun 2015 08:34:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Jun 2015 08:34:52 -0400    

Click here for diff

Recent commits, mainly b69bf30b9bfacafc733a9ba77c9587cf54d06c0c and  
53bb309d2d5a9432d2602c93ed18e58bd2924e15, introduced mechanisms to  
protect against wraparound of the MultiXact member space: the number  
of multixacts that can exist at one time is limited to 2^32, but the  
total number of members in those multixacts is also limited to 2^32,  
and older code did not take care to enforce the second limit,  
potentially allowing old data to be overwritten while it was still  
needed.  
  
Unfortunately, these new mechanisms failed to account for the fact  
that the code paths in which they run might be executed during  
recovery or while the cluster was in an inconsistent state.  Also,  
they failed to account for the fact that users who used pg_upgrade  
to upgrade a PostgreSQL version between 9.3.0 and 9.3.4 might have  
might oldestMultiXid = 1 in the control file despite the true value  
being larger.  
  
To fix these problems, first, avoid unnecessarily examining the  
mmembers of MultiXacts when the cluster is not known to be consistent.  
TruncateMultiXact has done this for a long time, and this patch does  
not fix that.  But the new calls used to prevent member wraparound  
are not needed until we reach normal running, so avoid calling them  
earlier.  (SetMultiXactIdLimit is actually called before InRecovery  
is set, so we can't rely on that; we invent our own multixact-specific  
flag instead.)  
  
Second, make failure to look up the members of a MultiXact a non-fatal  
error.  Instead, if we're unable to determine the member offset at  
which wraparound would occur, postpone arming the member wraparound  
defenses until we are able to do so.  If we're unable to determine the  
member offset that should force autovacuum, force it continuously  
until we are able to do so.  If we're unable to deterine the member  
offset at which we should truncate the members SLRU, log a message and  
skip truncation.  
  
An important consequence of these changes is that anyone who does have  
a bogus oldestMultiXid = 1 value in pg_control will experience  
immediate emergency autovacuuming when upgrading to a release that  
contains this fix.  The release notes should highlight this fact.  If  
a user has no pg_multixact/offsets/0000 file, but has oldestMultiXid = 1  
in the control file, they may wish to vacuum any tables with  
relminmxid = 1 prior to upgrading in order to avoid an immediate  
emergency autovacuum after the upgrade.  This must be done with a  
PostgreSQL version 9.3.5 or newer and with vacuum_multixact_freeze_min_age  
and vacuum_multixact_freeze_table_age set to 0.  
  
This patch also adds an additional log message at each database server  
startup, indicating either that protections against member wraparound  
have been engaged, or that they have not.  In the latter case, once  
autovacuum has advanced oldestMultiXid to a sane value, the message  
indicating that the guards have been engaged will appear at the next  
checkpoint.  A few additional messages have also been added at the DEBUG1  
level so that the correct operation of this code can be properly audited.  
  
Along the way, this patch fixes another, related bug in TruncateMultiXact  
that has existed since PostgreSQL 9.3.0: when no MultiXacts exist at  
all, the truncation code looks up NextMultiXactId, which doesn't exist  
yet.  This can lead to TruncateMultiXact removing every file in  
pg_multixact/offsets instead of keeping one around, as it should.  
This in turn will cause the database server to refuse to start  
afterwards.  
  
Patch by me.  Review by Álvaro Herrera, Andres Freund, Noah Misch, and  
Thomas Munro.  

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

doc: Session identifiers truncate, not round, the backend start time.

commit   : 99cfd5e136e2a20c77021390a1378d18a24b7388    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Jun 2015 17:57:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Jun 2015 17:57:39 -0400    

Click here for diff

Joel Jacobson  

M doc/src/sgml/config.sgml

docs: Fix list of object types pg_table_is_visible() can handle.

commit   : 1c645da8ebb5532105481ad77bb1d9a671b1f086    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Jun 2015 17:48:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Jun 2015 17:48:00 -0400    

Click here for diff

Materialized views and foreign tables were missing from the list,  
probably because they are newer than the other object types that were  
mentioned.  
  
Etsuro Fujita  

M doc/src/sgml/func.sgml

Second try at stabilizing query plans in rowsecurity regression test.

commit   : 1d27842519999cbac7e1cca8beaef053be9c7825    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 16:42:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 16:42:23 -0400    

Click here for diff

This reverts commit 5cdf25e16843dff33dbc2ddc02941458032e3ad4,  
which was almost immediately proven insufficient by the buildfarm.  
  
On second thought, the tables involved are not large enough that  
autovacuum or autoanalyze would notice them; what seems far more  
likely to be the culprit is the database-wide "vacuum analyze"  
in the concurrent gist test.  That thing has given us one headache  
too many, so get rid of it in favor of targeted vacuuming of that  
test's own tables only.  

M src/test/regress/expected/gist.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/gist.sql
M src/test/regress/sql/rowsecurity.sql

Fix brin regression test so it actually tests cidr.

commit   : 1676e4381f48f7bf211f0965ad23abe10a683818    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 15:24:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 15:24:22 -0400    

Click here for diff

The problem noted in my previous commit was simpler than I thought:  
we weren't getting an index plan because the column wasn't indexed.  

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

Tighten the per-operator testing done in brin regression test.

commit   : 79454c696bd3346a9f00f5e940398fb01a337fad    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 14:39:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 14:39:52 -0400    

Click here for diff

Verify that the number of matches is exactly what it should be, not just  
that it not be zero.  This should help us detect any environment-dependent  
issues.  
  
Also, verify that we're getting the expected type of scan plan (either  
bitmap or seqscan as appropriate).  Right now, this is failing on the  
cidrcol test cases, as shown in the output file.  I'll look into that  
in a bit, but it seems good to commit this as-is temporarily to verify  
that it behaves as expected on the buildfarm.  

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

Fix brin "char" test to actually test what it meant to test.

commit   : 78e72794a76fef3233c06800c6046aaad0704a22    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 13:50:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 13:50:32 -0400    

Click here for diff

Casting to char, without quotes, does not give the same results as casting  
to "char".  That meant we were not testing the brin "char" paths at all,  
since we ended up with a text operator not a "char" operator.  

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

Stabilize results of brin regression test.

commit   : bac99475eb6e9e6d69a91fee30b5420b8e0115be    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 13:46:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 13:46:34 -0400    

Click here for diff

This test used seqscans on tenk1, with LIMIT, to build test data.  
That works most of the time, but if the synchronized-seqscan logic  
kicks in, we get varying test data.  This seems likely to explain  
the erratic test failures on buildfarm member chipmunk, which uses  
smaller-than-default shared_buffers.  To fix, add ORDER BY clauses to  
force the ordering to be what it was implicitly being assumed to be.  
  
Peter Geoghegan had noticed this with respect to one of the trouble  
spots, though not the ones actually causing the chipmunk issue.  

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

Stabilize query plans in rowsecurity regression test.

commit   : 5cdf25e16843dff33dbc2ddc02941458032e3ad4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 10:37:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2015 10:37:06 -0400    

Click here for diff

Some recent buildfarm failures can be explained by supposing that  
autovacuum or autoanalyze fired on the tables created by this test,  
resulting in plan changes.  Do a proactive VACUUM ANALYZE on the  
test's principal tables to try to forestall such changes.  

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

Remove -i/--ignore-version option from pg_dump, pg_dumpall and pg_restore.

commit   : 232cd63b1f26e2ee3b3e03da8fc7348f4b067946    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 4 Jun 2015 19:54:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 4 Jun 2015 19:54:43 +0900    

Click here for diff

The commit c22ed3d523782c43836c163c16fa5a7bb3912826 turned  
the -i/--ignore-version options into no-ops and marked as deprecated.  
Considering we shipped that in 8.4, it's time to remove all trace of  
those switches, per discussion. We'd still have to wait a couple releases  
before it'd be safe to use -i for something else, but it'd be a start.  

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

Fix some issues in pg_class.relminmxid and pg_database.datminmxid documentation.

commit   : 38d500ac2e5d4d4f3468b505962fb85850c1ff4b    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 4 Jun 2015 13:22:49 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 4 Jun 2015 13:22:49 +0900    

Click here for diff

- Correct the name of directory which those catalog columns allow to be shrunk.  
- Correct the name of symbol which is used as the value of pg_class.relminmxid  
  when the relation is not a table.  
- Fix "ID ID" typo.  
  
Backpatch to 9.3 where those cataog columns were introduced.  

M doc/src/sgml/catalogs.sgml

doc: Fix PDF build with FOP

commit   : afae1f78547b8ff02cd2d07fe845a28e37a3b272    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jun 2015 20:19:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Jun 2015 20:19:47 -0400    

Click here for diff

Because of a bug in the DocBook XSL FO style sheet, an xref to a  
varlistentry whose term includes an indexterm fails to build.  One such  
instance was introduced in commit  
5086dfceba79ecd5d1eb28b8f4ed5221838ff3a6.  Fix by adding the upstream  
bug fix to our customization layer.  

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

Fix some questionable edge-case behaviors in add_path() and friends.

commit   : 3b0f77601b9f9f3a2e36a813e4cd32c00e0864d6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jun 2015 18:02:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jun 2015 18:02:39 -0400    

Click here for diff

add_path_precheck was doing exact comparisons of path costs, but it really  
needs to do them fuzzily to be sure it won't reject paths that could  
survive add_path's comparisons.  (This can only matter if the initial cost  
estimate is very close to the final one, but that turns out to often be  
true.)  
  
Also, it should ignore startup cost for this purpose if and only if  
compare_path_costs_fuzzily would do so.  The previous coding always ignored  
startup cost for parameterized paths, which is wrong as of commit  
3f59be836c555fa6; it could result in improper early rejection of paths that  
we care about for SEMI/ANTI joins.  It also always considered startup cost  
for unparameterized paths, which is just as wrong though the only effect is  
to waste planner cycles on paths that can't survive.  Instead, it should  
consider startup cost only when directed to by the consider_startup/  
consider_param_startup relation flags.  
  
Likewise, compare_path_costs_fuzzily should have symmetrical behavior  
for parameterized and unparameterized paths.  In this case, the best  
answer seems to be that after establishing that total costs are fuzzily  
equal, we should compare startup costs whether or not the consider_xxx  
flags are on.  That is what it's always done for unparameterized paths,  
so let's make the behavior for parameterized  paths match.  
  
These issues were noted while developing the SEMI/ANTI join costing fix  
of commit 3f59be836c555fa6, but we chose not to back-patch these fixes,  
because they can cause changes in the planner's choices among  
nearly-same-cost plans.  (There is in fact one minor change in plan choice  
within the core regression tests.)  Destabilizing plan choices in back  
branches without very clear improvements is frowned on, so we'll just fix  
this in HEAD.  

M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/join.out

Fix planner's cost estimation for SEMI/ANTI joins with inner indexscans.

commit   : 3f59be836c555fa679bbe0ec76de50a8b5cb23e0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jun 2015 11:58:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jun 2015 11:58:47 -0400    

Click here for diff

When the inner side of a nestloop SEMI or ANTI join is an indexscan that  
uses all the join clauses as indexquals, it can be presumed that both  
matched and unmatched outer rows will be processed very quickly: for  
matched rows, we'll stop after fetching one row from the indexscan, while  
for unmatched rows we'll have an indexscan that finds no matching index  
entries, which should also be quick.  The planner already knew about this,  
but it was nonetheless charging for at least one full run of the inner  
indexscan, as a consequence of concerns about the behavior of materialized  
inner scans --- but those concerns don't apply in the fast case.  If the  
inner side has low cardinality (many matching rows) this could make an  
indexscan plan look far more expensive than it actually is.  To fix,  
rearrange the work in initial_cost_nestloop/final_cost_nestloop so that we  
don't add the inner scan cost until we've inspected the indexquals, and  
then we can add either the full-run cost or just the first tuple's cost as  
appropriate.  
  
Experimentation with this fix uncovered another problem: add_path and  
friends were coded to disregard cheap startup cost when considering  
parameterized paths.  That's usually okay (and desirable, because it thins  
the path herd faster); but in this fast case for SEMI/ANTI joins, it could  
result in throwing away the desired plain indexscan path in favor of a  
bitmap scan path before we ever get to the join costing logic.  In the  
many-matching-rows cases of interest here, a bitmap scan will do a lot more  
work than required, so this is a problem.  To fix, add a per-relation flag  
consider_param_startup that works like the existing consider_startup flag,  
but applies to parameterized paths, and set it for relations that are the  
inside of a SEMI or ANTI join.  
  
To make this patch reasonably safe to back-patch, care has been taken to  
avoid changing the planner's behavior except in the very narrow case of  
SEMI/ANTI joins with inner indexscans.  There are places in  
compare_path_costs_fuzzily and add_path_precheck that are not terribly  
consistent with the new approach, but changing them will affect planner  
decisions at the margins in other cases, so we'll leave that for a  
HEAD-only fix.  
  
Back-patch to 9.3; before that, the consider_startup flag didn't exist,  
meaning that the second aspect of the patch would be too invasive.  
  
Per a complaint from Peter Holzer and analysis by Tomas Vondra.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h

Minor improvement to txid_current() documentation.

commit   : 37013621f3b0e296aa71b812ca9d46871ead95e2    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 3 Jun 2015 12:12:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 3 Jun 2015 12:12:48 +0900    

Click here for diff

Michael Paquier, reviewed by Christoph Berg and Naoya Anzai  

M doc/src/sgml/func.sgml

Release notes for 9.4.3, 9.3.8, 9.2.12, 9.1.17, 9.0.21.

commit   : 82ec7d28211b97a2c9917b7a71edbe6b019578da    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jun 2015 13:27:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jun 2015 13:27:43 -0400    

Click here for diff

Also sneak entries for commits 97ff2a564 et al into the sections for  
the previous releases in the relevant branches.  Those fixes did go out  
in the previous releases, but missed getting documented.  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

pgindent: add typedef blog URL

commit   : ab959cc0ea7ee143e017e18fae23e4269a1ba435    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 1 Jun 2015 11:27:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 1 Jun 2015 11:27:30 -0400    

Click here for diff

M src/tools/pgindent/README

Avoid naming a variable "new", and remove bogus initializer.

commit   : 50ab76d3c19c95589f4eb19683e25cb88a2506e2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2015 22:56:53 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2015 22:56:53 -0400    

Click here for diff

Per gripe from Tom Lane.  

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

Add a couple of missing JsonbValue type initialisers.

commit   : 28b29f7e44534339f88ea914794f8b64e13bc528    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2015 22:51:58 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2015 22:51:58 -0400    

Click here for diff

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

Rename jsonb_replace to jsonb_set and allow it to add new values

commit   : 37def4224505f3a23a5eef000f0d05daea59c5b5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2015 20:34:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2015 20:34:10 -0400    

Click here for diff

The function is given a fourth parameter, which defaults to true. When  
this parameter is true, if the last element of the path is missing  
in the original json, jsonb_set creates it in the result and assigns it  
the new value. If it is false then the function does nothing unless all  
elements of the path are present, including the last.  
  
Based on some original code from Dmitry Dolgov, heavily modified by me.  
  
Catalog version bumped.  

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

Make Python tests more portable

commit   : 75f9d17638c9c6bec34f80326c35010c47924728    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 31 May 2015 07:10:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 31 May 2015 07:10:45 -0400    

Click here for diff

Newer Python versions randomize the hash seed for dictionaries,  
resulting in a random output order, which messes up the regression test  
diffs.  
  
Instead, use Python assert to compare the dictionaries with their  
expected value.  

M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql

pg_upgrade: add missing period in C comment

commit   : ac6f22957d2f2999034b6a14d0d4bee25ba95f04    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 29 May 2015 17:44:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 29 May 2015 17:44:14 -0400    

Click here for diff

M src/bin/pg_upgrade/pg_upgrade.c

initdb -S should now have an explicit check that $PGDATA is valid.

commit   : 1943c000b7a22d3ca334196cfe3f7b8159b210c2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 17:02:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 17:02:58 -0400    

Click here for diff

The fsync code from the backend essentially assumes that somebody's already  
validated PGDATA, at least to the extent of it being a readable directory.  
That's safe enough for initdb's normal code path too, but "initdb -S"  
doesn't have any other processing at all that touches the target directory.  
To have reasonable error-case behavior, add a pg_check_dir call.  
Per gripe from Peter E.  

M src/bin/initdb/initdb.c

Remove special cases for ETXTBSY from new fsync'ing logic.

commit   : 57e1138bcc621ffeb8b1f1379ac4016a5c34d43e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 15:11:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 15:11:36 -0400    

Click here for diff

The argument that this is a sufficiently-expected case to be silently  
ignored seems pretty thin.  Andres had brought it up back when we were  
still considering that most fsync failures should be hard errors, and it  
probably would be legit not to fail hard for ETXTBSY --- but the same is  
true for EROFS and other cases, which is why we gave up on hard failures.  
ETXTBSY is surely not a normal case, so logging the failure seems fine  
from here.  

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

Check that all aliases of a built-in function have same leakproof property.

commit   : 1c8c656b3c217aaffc503ad703dcc60cdabe7445    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 13:26:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 13:26:21 -0400    

Click here for diff

opr_sanity.sql has a test checking that relevant properties of built-in  
functions match when the same C function is referenced by multiple pg_proc  
entries.  The test neglected to check proleakproof, though, and when  
I added that condition it exposed that xideqint4 hadn't been updated to  
match xideq.  So fix that as well, and in consequence bump catversion.  
  
This isn't very critical, so no need to worry about fixing back branches.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Adjust initdb to also not consider fsync'ing failures fatal.

commit   : c07d8c963e39980f192e8daca73b7585ef76cc9b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 13:05:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 13:05:16 -0400    

Click here for diff

Make initdb's version of this logic look as much like the backend's  
as possible.  This is much less critical than in the backend since not  
so many people use "initdb -S", but we want the same corner-case error  
handling in both cases.  
  
Back-patch to 9.3 where initdb -S option was introduced.  Before that,  
initdb only had to deal with freshly-created data directories, wherein  
no failures should be expected.  
  
Abhijit Menon-Sen  

M src/bin/initdb/initdb.c

Revert exporting of internal GUC variable "data_directory".

commit   : da33a3894e0fc440ac53cdc0f2e360e703b13b8c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 11:57:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 May 2015 11:57:33 -0400    

Click here for diff

This undoes a poorly-thought-out choice in commit 970a18687f9b3058, namely  
to export guc.c's internal variable data_directory.  The authoritative  
variable so far as C code is concerned is DataDir; there is no reason for  
anything except specific bits of GUC code to look at the GUC variable.  
  
After yesterday's commits fixing the fsync-on-restart patch, the only  
remaining misuse of data_directory was in AlterSystemSetConfigFile(),  
which would be much better off just using a relative path anyhow: it's  
less code and it doesn't break if the DBA moves the data directory of a  
running system, which is a case we've taken some pains over in the past.  
  
This is mostly cosmetic, so no need for a back-patch (and I'd be hesitant  
to remove a global variable in stable branches anyway).  

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

Fix fsync-at-startup code to not treat errors as fatal.

commit   : d8179b001ae574da00c8f4549577095bf90f3337    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 17:33:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 17:33:03 -0400    

Click here for diff

Commit 2ce439f3379aed857517c8ce207485655000fc8e introduced a rather serious  
regression, namely that if its scan of the data directory came across any  
un-fsync-able files, it would fail and thereby prevent database startup.  
Worse yet, symlinks to such files also caused the problem, which meant that  
crash restart was guaranteed to fail on certain common installations such  
as older Debian.  
  
After discussion, we agreed that (1) failure to start is worse than any  
consequence of not fsync'ing is likely to be, therefore treat all errors  
in this code as nonfatal; (2) we should not chase symlinks other than  
those that are expected to exist, namely pg_xlog/ and tablespace links  
under pg_tblspc/.  The latter restriction avoids possibly fsync'ing a  
much larger part of the filesystem than intended, if the user has left  
random symlinks hanging about in the data directory.  
  
This commit takes care of that and also does some code beautification,  
mainly moving the relevant code into fd.c, which seems a much better place  
for it than xlog.c, and making sure that the conditional compilation for  
the pre_sync_fname pass has something to do with whether pg_flush_data  
works.  
  
I also relocated the call site in xlog.c down a few lines; it seems a  
bit silly to be doing this before ValidateXLOGDirectoryStructure().  
  
The similar logic in initdb.c ought to be made to match this, but that  
change is noncritical and will be dealt with separately.  
  
Back-patch to all active branches, like the prior commit.  
  
Abhijit Menon-Sen and Tom Lane  

M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/include/storage/fd.h

Remove *pgaudit* references also.

commit   : d5442cb2434c303fa2afc747cdac65df958ff8ac    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 28 May 2015 13:02:09 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 28 May 2015 13:02:09 -0400    

Click here for diff

Fixes the docs build.  

M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Finish removing pg_audit

commit   : cde9cf170cf0f6fbd06b24930dab22d4445e3fb6    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 28 May 2015 12:48:25 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 28 May 2015 12:48:25 -0400    

Click here for diff

M contrib/Makefile
D doc/src/sgml/pgaudit.sgml

Fix pg_rewind's handling of top-level symlinks.

commit   : 0381fefaa44f04e17dffb7e46e7677374a4fb2c7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 12:44:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 12:44:31 -0400    

Click here for diff

The previous coding suffered a null-pointer dereference if it found any  
symlink at the top level of $PGDATA.  Fix that, and teach it to recurse  
into a symlink for pg_xlog, but not anything else.  
  
Per note from Abhijit Menon-Sen.  

M src/bin/pg_rewind/copy_fetch.c

Remove pg_audit

commit   : e5f1a4f1e350f1e72531d032eaa9095ba5baeb51    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 28 May 2015 12:41:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 28 May 2015 12:41:26 -0400    

Click here for diff

This removes pg_audit, per discussion:  
  
[email protected]  

D contrib/pg_audit/.gitignore
D contrib/pg_audit/Makefile
D contrib/pg_audit/expected/pg_audit.out
D contrib/pg_audit/pg_audit–1.0.sql
D contrib/pg_audit/pg_audit.c
D contrib/pg_audit/pg_audit.control
D contrib/pg_audit/sql/pg_audit.sql

Fix assorted inconsistencies in our calls of readlink().

commit   : 32f628be74d8ab43423ca7913b81f7eb21b312d4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 12:17:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 12:17:22 -0400    

Click here for diff

Ensure that we null-terminate the result string (one place in pg_rewind).  
Be paranoid about out-of-range results from readlink() (should not happen,  
but there is no good reason for some call sites to be careful about it and  
others not).  Consistently use the whole buffer, not sometimes one byte  
less.  Ensure we emit an appropriate errcode() in all cases.  Spell the  
error messages the same way.  
  
The only serious bug here is the missing null-termination in pg_rewind,  
which is new code, so no need for a back-patch.  
  
Abhijit Menon-Sen and Tom Lane  

M src/backend/replication/basebackup.c
M src/backend/storage/file/fd.c
M src/backend/utils/adt/misc.c
M src/bin/pg_rewind/copy_fetch.c

Fix pg_get_functiondef() to print a function's LEAKPROOF property.

commit   : f46edf479e2468a08caca2a03ec7e258930a7161    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 11:24:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 May 2015 11:24:37 -0400    

Click here for diff

Seems to have been an oversight in the original leakproofness patch.  
Per report and patch from Jeevan Chalke.  
  
In passing, prettify some awkward leakproof-related code in AlterFunction.  

M src/backend/commands/functioncmds.c
M src/backend/utils/adt/ruleutils.c

Fix portability issue in isolationtester grammar.

commit   : aa9eac45ea868e6ddabc4eb076d18be10ce84c6a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 May 2015 19:14:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 May 2015 19:14:39 -0400    

Click here for diff

specparse.y and specscanner.l used "string" as a token name.  Now, bison  
likes to define each token name as a macro for the token code it assigns,  
which means those names are basically off-limits for any other use within  
the grammar file or included headers.  So names as generic as "string" are  
dangerous.  This is what was causing the recent failures on protosciurus:  
some versions of Solaris' sys/kstat.h use "string" as a field name.  
With late-model bison we don't see this problem because the token macros  
aren't defined till later (that is why castoroides didn't show the problem  
even though it's on the same machine).  But protosciurus uses bison 1.875  
which defines the token macros up front.  
  
This land mine has been there from day one; we'd have found it sooner  
except that protosciurus wasn't trying to run the isolation tests till  
recently.  
  
To fix, rename the token to "string_literal" which is hopefully less  
likely to collide with names used by system headers.  Back-patch to  
all branches containing the isolation tests.  

M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l

Revert "Add all structured objects passed to pushJsonbValue piecewise."

commit   : f41042cea0619eaa812e630f87472e805b0dfdb0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 22:54:55 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 22:54:55 -0400    

Click here for diff

This reverts commit 54547bd87f49326d67051254c363e6597d16ffda.  
  
This appears to have been a thinko on my part. I will try to come up  
wioth a better solution.  

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

Revert "Simplify addJsonbToParseState()"

commit   : 956cc4434c3a8e69813b325618402508d1dbdcd9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 22:54:11 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 22:54:11 -0400    

Click here for diff

This reverts commit fba12c8c6c4159e1923958a4006b26f3cf873254.  
  
This relied on a commit that is also being reverted.  

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

Remove configure check prohibiting threaded libpython on OpenBSD.

commit   : 86832eb8912b9cac0f4961facb9efda81828e214    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 May 2015 22:14:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 May 2015 22:14:59 -0400    

Click here for diff

According to recent tests, this case now works fine, so there's no reason  
to reject it anymore.  (Even if there are still some OpenBSD platforms  
in the wild where it doesn't work, removing the check won't break any case  
that worked before.)  
  
We can actually remove the entire test that discovers whether libpython  
is threaded, since without the OpenBSD case there's no need to know that  
at all.  
  
Per report from Davin Potts.  Back-patch to all active branches.  

M config/python.m4
M configure

Suppress occasional failures in brin regression test.

commit   : 1f303fd1be51f26553e7c95d8696aa4e28ece1c6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 May 2015 14:10:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 May 2015 14:10:46 -0400    

Click here for diff

brin.sql included a call of brin_summarize_new_values(), and expected  
it to always report exactly 5 summarization events.  This failed sometimes  
during parallel regression tests, as a consequence of the database-wide  
VACUUM in gist.sql getting there first.  The most future-proof way  
to avoid variation in the test results is to forget about using  
brin_summarize_new_values() and just do a plain "VACUUM brintest",  
which will exercise the same code anyway.  
  
Having done that, there's no need for preventing autovacuum on brintest;  
doing so just reduces the scope of test coverage, so let's not.  

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

Simplify addJsonbToParseState()

commit   : fba12c8c6c4159e1923958a4006b26f3cf873254    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 11:46:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 11:46:02 -0400    

Click here for diff

This function no longer needs to walk non-scalar structures passed to  
it, following commit 54547bd87f49326d67051254c363e6597d16ffda.  

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

Add all structured objects passed to pushJsonbValue piecewise.

commit   : 54547bd87f49326d67051254c363e6597d16ffda    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 11:16:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 26 May 2015 11:16:52 -0400    

Click here for diff

Commit 9b74f32cdbff8b9be47fc69164eae552050509ff did this for objects of  
type jbvBinary, but in trying further to simplify some of the new jsonb  
code I discovered that objects of type jbvObject or jbvArray passed as  
WJB_ELEM or WJB_VALUE also caused problems. These too are now added  
component by component.  
  
Backpatch to 9.4.  

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

Fix valgrind's "unaddressable bytes" whining about BRIN code.

commit   : 79f2b5d583e2e2a7ccd13e31d0e20a900c8f2f61    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 May 2015 21:56:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 May 2015 21:56:19 -0400    

Click here for diff

brin_form_tuple calculated an exact tuple size, then palloc'd and  
filled just that much.  Later, brin_doinsert or brin_doupdate would  
MAXALIGN the tuple size and tell PageAddItem that that was the size  
of the tuple to insert.  If the original tuple size wasn't a multiple  
of MAXALIGN, the net result would be that PageAddItem would memcpy  
a few more bytes than the palloc request had been for.  
  
AFAICS, this is totally harmless in the real world: the error is a  
read overrun not a write overrun, and palloc would certainly have  
rounded the request up to a MAXALIGN multiple internally, so there's  
no chance of the memcpy fetching off the end of memory.  Valgrind,  
however, is picky to the byte level not the MAXALIGN level.  
  
Fix it by pushing the MAXALIGN step back to brin_form_tuple.  (The other  
possible source of tuples in this code, brin_form_placeholder_tuple,  
was already producing a MAXALIGN'd result.)  
  
In passing, be a bit more paranoid about internal allocations in  
brin_form_tuple.  

M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_tuple.c

pgindent: document location of "all" typedef lists

commit   : 3503003eb70c5a56c59afb20b4c7abec6cf9eb86    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2015 16:53:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2015 16:53:48 -0400    

Click here for diff

M src/tools/pgindent/README

Explain CHECK constraint handling in postgres_fdw's IMPORT FOREIGN SCHEMA.

commit   : e70ec8230a2c0e7363bb7abf4d55dddbdec89fe1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 May 2015 14:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 May 2015 14:12:51 -0400    

Click here for diff

The existing documentation could easily be misinterpreted, and it failed to  
explain the inconsistent-evaluation hazard that deterred us from supporting  
automatic importing of check constraints.  Revise it.  
  
Etsuro Fujita, further expanded by me  

M doc/src/sgml/postgres-fdw.sgml

Update README.tuplock

commit   : cdbdc4382743fcfabb3437ea7c4d103adaa01324    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 May 2015 15:09:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 May 2015 15:09:05 -0300    

Click here for diff

Multixact truncation is now handled differently, and this file hadn't  
gotten the memo.  
  
Per note from Amit Langote.  I didn't use his patch, though.  
  
Also update the description of infomask bits, which weren't completely up  
to date either.  This commit also propagates b01a4f6838 back to 9.3 and  
9.4, which apparently I failed to do back then.  

M src/backend/access/heap/README.tuplock

Clean up and simplify jsonb_concat code.

commit   : 6739aa298b5e3260481a2d5723a75b057d6119c6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 25 May 2015 11:43:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 25 May 2015 11:43:06 -0400    

Click here for diff

Some of this is made possible by commit  
9b74f32cdbff8b9be47fc69164eae552050509ff which lets pushJsonbValue  
handle binary Jsonb values, meaning that clients no longer have to, and  
some is just doing things in simpler and more straightforward ways.  

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

pgindent: fix typo

commit   : 8339e70da6682059f7ab40f0c0b0dfcdcb78761d    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2015 08:08:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2015 08:08:05 -0400    

Click here for diff

Report by Michael Paquier  

M src/tools/pgindent/README

Fix rescan of IndexScan node with the new lossy GiST distance functions.

commit   : 12e6c5a6cae1e34da2d320390993010b6e15ba9e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 May 2015 14:42:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 May 2015 14:42:21 +0300    

Click here for diff

Must reset the "reached end" flag and reorder queue at rescan.  
  
Per report from Regina Obe, bug #13349  

M src/backend/executor/nodeIndexscan.c

pgindent: more doc updates for skipping __asm__ files

commit   : 266b6984cd7391e42770ca3a9922a9e8b1d4d7d3    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 24 May 2015 21:51:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 24 May 2015 21:51:42 -0400    

Click here for diff

M src/tools/pgindent/README

Revert 9.5 pgindent changes to atomics directory files

commit   : befa3e648ce018d84cd2a0df701927c56fe3da4e    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 24 May 2015 21:44:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 24 May 2015 21:44:57 -0400    

Click here for diff

This is because there are many __asm__ blocks there that pgindent messes  
up.  Also configure pgindent to skip that directory in the future.  

M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/tools/pgindent/exclude_file_patterns

Manual cleanup of pgindent results.

commit   : 2aa0476dc38f7e510b8cde627e83b4c76fa05d61    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 15:04:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 15:04:10 -0400    

Click here for diff

Fix some places where pgindent did silly stuff, often because project  
style wasn't followed to begin with.  (I've not touched the atomics  
headers, though.)  

M contrib/pg_audit/pg_audit.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/tablesample.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/optimizer/plan/planner.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/ruleutils.c

Rename pg_shdepend.c's typedef "objectType" to SharedDependencyObjectType.

commit   : 17b48a1a9f87f7479d38dcc78a27c23f1f8124f8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 13:03:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 13:03:45 -0400    

Click here for diff

The name objectType is widely used as a field name, and it's pure luck that  
this conflict has not caused pgindent to go crazy before.  It messed up  
pg_audit.c pretty good though.  Since pg_shdepend.c doesn't export this  
typedef and only uses it in three places, changing that seems saner than  
changing the field usages.  
  
Back-patch because we're contemplating using the union of all branch  
typedefs for future pgindent runs, so this won't fix anything if it  
stays the same in back branches.  

M src/backend/catalog/pg_shdepend.c

Add a bit more commentary about regex's colormap tree data structure.

commit   : 23116d5437d0e8d077e7fd5391f5fa0fc781b7d2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 12:40:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 12:40:38 -0400    

Click here for diff

Per an off-list question from Piotr Stefaniak.  

M src/include/regex/regguts.h

Remove no-longer-required function declarations.

commit   : 91e79260f636ab4d5a43910b6a38bc75651ad14c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 12:20:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 May 2015 12:20:23 -0400    

Click here for diff

Remove a bunch of "extern Datum foo(PG_FUNCTION_ARGS);" declarations that  
are no longer needed now that PG_FUNCTION_INFO_V1(foo) provides that.  
  
Some of these were evidently missed in commit e7128e8dbb305059, but others  
were cargo-culted in in code added since then.  Possibly that can be blamed  
in part on the fact that we'd not fixed relevant documentation examples,  
which I've now done.  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M contrib/pg_audit/pg_audit.c
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/trigger.sgml
M src/backend/snowball/dict_snowball.c
M src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/include/utils/jsonb.h
M src/tutorial/complex.c
M src/tutorial/funcs_new.c

pgindent run for 9.5

commit   : 807b9e0dff663c5da875af7907a5106c0ff90673    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 May 2015 21:35:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 May 2015 21:35:49 -0400    

Click here for diff

M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/hstore/hstore_gist.c
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/ltree/crc32.c
M contrib/ltree_plpython/ltree_plpython.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pg_audit/pg_audit.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pgcrypto/pgp-armor.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp.h
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/postgres_fdw.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 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_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistutil.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/spgist/spgscan.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/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/matview.c
M src/backend/commands/policy.c
M src/backend/commands/schemacmds.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/executor/execAmi.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execQual.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.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/nodeSamplescan.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/pairingheap.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqmq.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/port/atomics.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_latch.c
M src/backend/port/win32_sema.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rowsecurity.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/smgr/md.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_xlogdump/pg_xlogdump.c
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/common.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/vacuumdb.c
M src/common/restricted_token.c
M src/include/access/brin_page.h
M src/include/access/commit_ts.h
M src/include/access/gin.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/htup_details.h
M src/include/access/multixact.h
M src/include/access/parallel.h
M src/include/access/relscan.h
M src/include/access/stratnum.h
M src/include/access/tablesample.h
M src/include/access/xact.h
M src/include/access/xlog.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/catalog/binary_upgrade.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/objectaddress.h
M src/include/catalog/opfam_internal.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_tablesample_method.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_type.h
M src/include/commands/defrem.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/vacuum.h
M src/include/common/fe_memutils.h
M src/include/common/pg_lzcompress.h
M src/include/common/restricted_token.h
M src/include/common/string.h
M src/include/executor/executor.h
M src/include/executor/hashjoin.h
M src/include/fmgr.h
M src/include/funcapi.h
M src/include/lib/bipartite_match.h
M src/include/lib/hyperloglog.h
M src/include/lib/pairingheap.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/include/libpq/pqmq.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/prep.h
M src/include/optimizer/tlist.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_func.h
M src/include/parser/parse_relation.h
M src/include/pgstat.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/include/port/pg_crc32c.h
M src/include/postmaster/bgworker.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/walsender.h
M src/include/rewrite/rowsecurity.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/shm_mq.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/fastpath.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/builtins.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/lsyscache.h
M src/include/utils/palloc.h
M src/include/utils/pg_crc.h
M src/include/utils/plancache.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/snapshot.h
M src/include/utils/sortsupport.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_typeio.c
M src/port/gettimeofday.c
M src/port/pg_crc32c_choose.c
M src/port/pg_crc32c_sse42.c
M src/port/win32setlocale.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/perl/TestLib.pm
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/test/ssl/ServerSetup.pm
M src/test/ssl/t/001_ssltests.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VCBuildProject.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/config_default.pl
M src/tools/msvc/vcregress.pl

Update typedef file in preparation for pgindent run

commit   : 225892552bd3052982d2b97b749e5945ea71facc    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 May 2015 21:20:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 May 2015 21:20:37 -0400    

Click here for diff

M src/tools/pgindent/typedefs.list

Improve pgindent instructions regarding Perl backup files

commit   : 58affdfb88a7705df477f0cfc0710bf638ccd3e9    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 23 May 2015 21:09:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 23 May 2015 21:09:00 -0400    

Click here for diff

M src/tools/pgindent/README

Add error check for lossy distance functions in index-only scans.

commit   : f84c8601d604811a530dadb53ddb52f08639e72b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 May 2015 16:24:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 May 2015 16:24:31 -0400    

Click here for diff

Maybe we should actually support this, but for the moment let's just  
throw an error if the opclass tries it.  

M src/backend/executor/nodeIndexonlyscan.c

Fix incorrect snprintf() limit.

commit   : 72809480d658fbc0654239b2f089991c077c676a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 May 2015 16:05:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 May 2015 16:05:52 -0400    

Click here for diff

Typo in commit 7cbee7c0a.  No practical effect since the buffer should  
never actually be overrun, but various compilers and static analyzers will  
whine about it.  
  
Petr Jelinek  

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

Still more fixes for lossy-GiST-distance-functions patch.

commit   : 821b821a2421beaa58225ff000833df69fb962c5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 May 2015 15:22:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 May 2015 15:22:25 -0400    

Click here for diff

Fix confusion in documentation, substantial memory leakage if float8 or  
float4 are pass-by-reference, and assorted comments that were obsoleted  
by commit 98edd617f3b62a02cb2df9b418fcc4ece45c7ec0.  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/executor/nodeIndexscan.c
M src/include/access/relscan.h

Fix yet another bug in ON CONFLICT rule deparsing.

commit   : 284bef297733e553c73f1c858e0ce1532f754d18    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 23 May 2015 02:16:24 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 23 May 2015 02:16:24 +0200    

Click here for diff

Expand testing of rule deparsing a good bit, it's evidently needed.  
  
Author: Peter Geoghegan, Andres Freund  
Discussion: CAM3SWZQmXxZhQC32QVEOTYfNXJBJ_Q2SDENL7BV14Cq-zL0FLg@mail.gmail.com  

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

Remove the new UPSERT command tag and use INSERT instead.

commit   : 631d7490074cdaef8026db57a5f2772b8730f600    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 23 May 2015 00:49:27 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 23 May 2015 00:49:27 +0200    

Click here for diff

Previously, INSERT with ON CONFLICT DO UPDATE specified used a new  
command tag -- UPSERT.  It was introduced out of concern that INSERT as  
a command tag would be a misrepresentation for ON CONFLICT DO UPDATE, as  
some affected rows may actually have been updated.  
  
Alvaro Herrera noticed that the implementation of that new command tag  
was incomplete; in subsequent discussion we concluded that having it  
doesn't provide benefits that are in line with the compatibility breaks  
it requires.  
  
Catversion bump due to the removal of PlannedStmt->isUpsert.  
  
Author: Peter Geoghegan  
Discussion: [email protected]  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/insert.sgml
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/tcop/pquery.c
M src/bin/psql/common.c
M src/include/catalog/catversion.h
M src/include/nodes/plannodes.h

Fix recently-introduced crash in array_contain_compare().

commit   : 49ad32d5d99cb4a79bf648c0b7f9eca19b54cf1d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 May 2015 18:36:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 May 2015 18:36:48 -0400    

Click here for diff

Silly oversight in commit 1dc5ebc9077ab742079ce5dac9a6664248d42916:  
when array2 is an expanded array, it might have array2->xpn.dnulls equal  
to NULL, indicating the array is known null-free.  The code wasn't  
expecting that, because it formerly always used deconstruct_array() which  
always delivers a nulls array.  
  
Per bug #13334 from Regina Obe.  

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

Unpack jbvBinary objects passed to pushJsonbValue

commit   : 5302760a50332a684e35b9865ff47ff5fd4970c2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 22 May 2015 10:21:41 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 22 May 2015 10:21:41 -0400    

Click here for diff

pushJsonbValue was accepting jbvBinary objects passed as WJB_ELEM or  
WJB_VALUE data. While this succeeded, when those objects were later  
encountered in attempting to convert the result to Jsonb, errors  
occurred. With this change we ghuarantee that a JSonbValue constructed  
from calls to pushJsonbValue does not contain any jbvBinary objects.  
This cures a problem observed with jsonb_delete.  
  
This means callers of pushJsonbValue no longer need to perform this  
unpacking themselves. A subsequent patch will perform some cleanup in  
that area.  
  
The error was not triggered by any 9.4 code, but this is a publicly  
visible routine, and so the error could be exercised by third party  
code, therefore backpatch to 9.4.  
  
Bug report from Peter Geoghegan, fix by me.  

M src/backend/utils/adt/jsonb_util.c
M src/include/utils/jsonb.h

Minor enhancement of readability of ALTER TABLE syntax in the doc.

commit   : 6d1733fa90a3f8037c7c815ed6ab4d97c295e525    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 22 May 2015 21:42:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 22 May 2015 21:42:15 +0900    

Click here for diff

Fabrízio Mello  

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

At promotion, don't leave behind a partial segment on the old timeline.

commit   : 7cbee7c0a1db668c60c020a3fd1e3234daa562a9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 21 May 2015 15:28:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 21 May 2015 15:28:22 +0300    

Click here for diff

With commit de768844, a copy of the partial segment was archived with the  
.partial suffix, but the original file was still left in pg_xlog, so it  
didn't actually solve the problems with archiving the partial segment that  
it was supposed to solve. With this patch, the partial segment is renamed  
rather than copied, so we only archive it with the .partial suffix.  
  
Also be more robust in detecting if the last segment is already being  
archived. Previously I used XLogArchiveIsBusy() for that, but that's not  
quite right. With archive_mode='always', there might be a .ready file for  
it, and we don't want to rename it to .partial in that case.  
  
The old segment is needed until we're fully committed to the new timeline,  
i.e. until we've written the end-of-recovery WAL record and updated the  
min recovery point and timeline in the control file. So move the renaming  
later in the startup sequence, after all that's been done.  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/include/access/xlog_internal.h

More fixes for lossy-GiST-distance-functions patch.

commit   : c5dd8ead403f85bd041590d2e3e79b72830472d4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 May 2015 19:47:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 May 2015 19:47:48 -0400    

Click here for diff

Paul Ramsey reported that commit 35fcb1b3d038a501f3f4c87c05630095abaaadab  
induced a core dump on commuted ORDER BY expressions, because it was  
assuming that the indexorderby expression could be found verbatim in the  
relevant equivalence class, but it wasn't there.  We really don't need  
anything that complicated anyway; for the data types likely to be used for  
index ORDER BY operators in the foreseeable future, the exprType() of the  
ORDER BY expression will serve fine.  (The case where we'd have to work  
harder is where the ORDER BY expression's result is only binary-compatible  
with the declared input type of the ordering operator; long before worrying  
about that, one would need to get rid of GiST's hard-wired assumption that  
said datatype is float8.)  
  
Aside from fixing that crash and adding a regression test for the case,  
I did some desultory code review:  
  
nodeIndexscan.c was likewise overthinking how hard it ought to work to  
identify the datatype of the ORDER BY expressions.  
  
Add comments explaining how come nodeIndexscan.c can get away with  
simplifying assumptions about NULLS LAST ordering and no backward scan.  
  
Revert no-longer-needed changes of find_ec_member_for_tle(); while the  
new definition was no worse than the old, it wasn't better either, and  
it might cause back-patching pain.  
  
Revert entirely bogus additions to genam.h.  

M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/plan/createplan.c
M src/include/access/genam.h
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

Improve packing/alignment annotation for ItemPointerData.

commit   : d4b538ea367de43b2f2b939621272682417cd290    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 May 2015 17:21:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 May 2015 17:21:46 -0400    

Click here for diff

We want this struct to be exactly a series of 3 int16 words, no more  
and no less.  Historically, at least, some ARM compilers preferred to  
pad it to 8 bytes unless coerced.  Our old way of doing that was just  
to use __attribute__((packed)), but as pointed out by Piotr Stefaniak,  
that does too much: it also licenses the compiler to give the struct  
only byte-alignment.  We don't want that because it adds access overhead,  
possibly quite significant overhead.  According to the GCC manual, what  
we want requires also specifying __attribute__((align(2))).  It's not  
entirely clear if all the relevant compilers accept this pragma as well,  
but we can hope the buildfarm will tell us if not.  We can also add a  
static assertion that should fire if the compiler padded the struct.  
  
Since the combination of these pragmas should define exactly what we  
want on any compiler that accepts them, let's try using them wherever  
we think they exist, not only for __arm__.  (This is likely to expose  
that the conditional definitions in c.h are inadequate, but finding  
that out would be a good thing.)  
  
The immediate motivation for this is that the current definition of  
ExecRowMark allows its curCtid field to be misaligned.  It is not clear  
whether there are any other uses of ItemPointerData with a similar hazard.  
We could change the definition of ExecRowMark if this doesn't work, but  
it would be far better to have a future-proof fix.  
  
Piotr Stefaniak, some further hacking by me  

M src/backend/storage/page/itemptr.c
M src/include/storage/itemptr.h

Correct two mistakes in the ALTER FOREIGN TABLE reference page.

commit   : 160a9aaabf400106232e7e6fce0966ee5fdf84e2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 May 2015 11:16:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 May 2015 11:16:33 -0400    

Click here for diff

Etsuro Fujita  

M doc/src/sgml/ref/alter_foreign_table.sgml

Correct the names of pgstattuple_approx output columns in the doc.

commit   : cad3708960ef2da237b93f835d706197f16e5492    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 May 2015 20:51:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 May 2015 20:51:52 +0900    

Click here for diff

M doc/src/sgml/pgstattuple.sgml

Make recovery_target_action = pause work.

commit   : 85d0e661aae656d3ec710dab24f883c4b4ef90da    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 May 2015 13:56:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 May 2015 13:56:17 +0900    

Click here for diff

Previously even if recovery_target_action was set to pause and  
the recovery target was reached, the recovery could never be paused.  
Because the setting of pause was *always* overridden with that of  
shutdown unexpectedly. This override is valid and intentional  
if hot_standby is not enabled because there is no way to resume  
the paused recovery in this case and the setting of pause is  
completely useless. But not if hot_standby is enabled.  
  
This patch changes the code so that the setting of pause is overridden  
with that of shutdown only when hot_standby is not enabled.  
  
Bug reported by Andres Freund  

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

Another typo fix.

commit   : a6a66bd647d471aeb55d8ba3e24d197ccd8a5abb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 May 2015 14:50:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 May 2015 14:50:22 -0400    

Click here for diff

In the spirit of the season.  

M src/backend/parser/gram.y

Fix more typos in comments.

commit   : fa60fb63e511e7bbcf57ce972338711593a5e7c9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 20 May 2015 19:44:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 20 May 2015 19:44:46 +0300    

Click here for diff

Patch by CharSyam, plus a few more I spotted with grep.  

M src/backend/access/brin/brin_pageops.c
M src/backend/access/heap/README.tuplock
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/commands/event_trigger.c
M src/backend/commands/vacuumlazy.c
M src/backend/postmaster/bgwriter.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/psql/print.c
M src/include/c.h
M src/include/utils/rel.h
M src/interfaces/libpq/fe-auth.c
M src/tools/pgindent/pgindent

Collection of typo fixes.

commit   : 4fc72cc7bb9d2105261b8ee45558af50d788cd19    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 20 May 2015 16:18:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 20 May 2015 16:18:11 +0300    

Click here for diff

Use "a" and "an" correctly, mostly in comments. Two error messages were  
also fixed (they were just elogs, so no translation work required). Two  
function comments in pg_proc.h were also fixed. Etsuro Fujita reported one  
of these, but I found a lot more with grep.  
  
Also fix a few other typos spotted while grepping for the a/an typos.  
For example, "consists out of ..." -> "consists of ...". Plus a "though"/  
"through" mixup reported by Euler Taveira.  
  
Many of these typos were in old code, which would be nice to backpatch to  
make future backpatching easier. But much of the code was new, and I didn't  
feel like crafting separate patches for each branch. So no backpatching.  

M contrib/isn/isn.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/spi/timetravel.c
M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/specs/ondisk_startup.spec
M contrib/test_decoding/sql/decoding_in_xact.sql
M doc/src/sgml/ref/insert.sgml
M src/backend/access/brin/brin_pageops.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/catalog.c
M src/backend/catalog/storage.c
M src/backend/commands/copy.c
M src/backend/commands/event_trigger.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execIndexing.c
M src/backend/optimizer/README
M src/backend/optimizer/path/indxpath.c
M src/backend/parser/gram.y
M src/backend/port/atomics.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/lmgr/predicate.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/misc/sampling.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/access/gin_private.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/xact.h
M src/include/catalog/pg_proc.h
M src/include/port/atomics/generic-gcc.h
M src/include/replication/reorderbuffer.h
M src/include/rewrite/prs2lock.h
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/pl/plpython/plpy_procedure.c

Fix spelling in comment

commit   : f6a54fefc299b933052885bb0532c476d382cc71    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 19 May 2015 18:37:46 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 19 May 2015 18:37:46 -0400    

Click here for diff

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

Last-minute updates for release notes.

commit   : 5cb8519ceb62516636362a7e8e06b99b3e1bf138    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 18:33:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 18:33:58 -0400    

Click here for diff

Revise description of CVE-2015-3166, in line with scaled-back patch.  
Change release date.  
  
Security: CVE-2015-3166  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Revert error-throwing wrappers for the printf family of functions.

commit   : 0c071936e94c6859afb2ec8d2c8dddf7bcdab7ee    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 18:14:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 18:14:52 -0400    

Click here for diff

This reverts commit 16304a013432931e61e623c8d85e9fe24709d9ba, except  
for its changes in src/port/snprintf.c; as well as commit  
cac18a76bb6b08f1ecc2a85e46c9d2ab82dd9d23 which is no longer needed.  
  
Fujii Masao reported that the previous commit caused failures in psql on  
OS X, since if one exits the pager program early while viewing a query  
result, psql sees an EPIPE error from fprintf --- and the wrapper function  
thought that was reason to panic.  (It's a bit surprising that the same  
does not happen on Linux.)  Further discussion among the security list  
concluded that the risk of other such failures was far too great, and  
that the one-size-fits-all approach to error handling embodied in the  
previous patch is unlikely to be workable.  
  
This leaves us again exposed to the possibility of the type of failure  
envisioned in CVE-2015-3166.  However, that failure mode is strictly  
hypothetical at this point: there is no concrete reason to believe that  
an attacker could trigger information disclosure through the supposed  
mechanism.  In the first place, the attack surface is fairly limited,  
since so much of what the backend does with format strings goes through  
stringinfo.c or psprintf(), and those already had adequate defenses.  
In the second place, even granting that an unprivileged attacker could  
control the occurrence of ENOMEM with some precision, it's a stretch to  
believe that he could induce it just where the target buffer contains some  
valuable information.  So we concluded that the risk of non-hypothetical  
problems induced by the patch greatly outweighs the security risks.  
We will therefore revert, and instead undertake closer analysis to  
identify specific calls that may need hardening, rather than attempt a  
universal solution.  
  
We have kept the portion of the previous patch that improved snprintf.c's  
handling of errors when it calls the platform's sprintf().  That seems to  
be an unalloyed improvement.  
  
Security: CVE-2015-3166  

M src/include/port.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/.gitignore
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/bcc32.mak
M src/interfaces/libpq/win32.mak
M src/pl/plperl/plperl.h
M src/pl/plpython/plpython.h
M src/port/Makefile
M src/port/snprintf.c
D src/port/syswrap.c
M src/tools/msvc/Mkvcbuild.pm

Various fixes around ON CONFLICT for rule deparsing.

commit   : 9bc77c45199c7d2e525cd5b1457d5a57f6e9edb0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 May 2015 21:07:28 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 May 2015 21:07:28 +0200    

Click here for diff

Neither the deparsing of the new alias for INSERT's target table, nor of  
the inference clause was supported. Also fixup a typo in an error  
message.  
  
Add regression tests to test those code paths.  
  
Author: Peter Geoghegan  

M src/backend/parser/parse_clause.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Refactor ON CONFLICT index inference parse tree representation.

commit   : 0740cbd7593d871858c352fab29a59cf7fa54b00    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 May 2015 21:17:52 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 May 2015 21:17:52 +0200    

Click here for diff

Defer lookup of opfamily and input type of a of a user specified opclass  
until the optimizer selects among available unique indexes; and store  
the opclass in the parse analyzed tree instead.  The primary reason for  
doing this is that for rule deparsing it's easier to use the opclass  
than the previous representation.  
  
While at it also rename a variable in the inference code to better fit  
it's purpose.  
  
This is separate from the actual fixes for deparsing to make review  
easier.  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_clause.c
M src/include/nodes/primnodes.h

Fix off-by-one error in Assertion.

commit   : b48437d11b9389d724c037385a5cae824d4f8049    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 19 May 2015 19:21:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 19 May 2015 19:21:46 +0300    

Click here for diff

The point of the assertion is to ensure that the arrays allocated in stack  
are large enough, but the check was one item short.  
  
This won't matter in practice because MaxIndexTuplesPerPage is an  
overestimate, so you can't have that many items on a page in reality.  
But let's be tidy.  
  
Spotted by Anastasia Lubennikova. Backpatch to all supported versions, like  
the patch that added the assertion.  

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

Avoid collation dependence in indexes of system catalogs.

commit   : 0b28ea79c044a0d3779081dc909a6dc0ce93b991    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 11:47:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 11:47:42 -0400    

Click here for diff

No index in template0 should have collation-dependent ordering, especially  
not indexes on shared catalogs.  For most textual columns we avoid this  
issue by using type "name" (which sorts per strcmp()).  However there are a  
few indexed columns that we'd prefer to use "text" for, and for that, the  
default opclass text_ops is unsafe.  Fortunately, text_pattern_ops is safe  
(it sorts per memcmp()), and it has no real functional disadvantage for our  
purposes.  So change the indexes on pg_seclabel.provider and  
pg_shseclabel.provider to use text_pattern_ops.  
  
In passing, also mark pg_replication_origin.roname as using  
text_pattern_ops --- for some reason it was labeled varchar_pattern_ops  
which is just wrong, even though it accidentally worked.  
  
Add regression test queries to catch future errors of these kinds.  
  
We still can't do anything about the misdeclared pg_seclabel and  
pg_shseclabel indexes in back branches :-(  

M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Revert "Change pg_seclabel.provider and pg_shseclabel.provider to type "name"."

commit   : afee04352bc01b79cde33c018a82c2eeb1ce84eb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 10:40:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 May 2015 10:40:04 -0400    

Click here for diff

This reverts commit b82a7be603f1811a0a707b53c62de6d5d9431740.  There  
is a better (less invasive) way to fix it, which I will commit next.  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/seclabel.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shseclabel.h

Message string improvements

commit   : 55c0da38be611899ae6d185b72b5ffcadc9d78c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 May 2015 23:01:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 May 2015 23:01:48 -0400    

Click here for diff

M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/interfaces/libpq/fe-secure-openssl.c

Fix parse tree of DROP TRANSFORM and COMMENT ON TRANSFORM

commit   : 0779f2ba2db6787259f3ea82f999e08552724218    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 May 2015 22:55:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 May 2015 22:55:14 -0400    

Click here for diff

The plain C string language name needs to be wrapped in makeString() so  
that the parse tree is copyable.  This is detectable by  
-DCOPY_PARSE_PLAN_TREES.  Add a test case for the COMMENT case.  
  
Also make the quoting in the error messages more consistent.  
  
discovered by Tom Lane  

M contrib/hstore_plperl/expected/create_transform.out
M contrib/hstore_plperl/sql/create_transform.sql
M src/backend/catalog/objectaddress.c
M src/backend/commands/dropcmds.c
M src/backend/commands/functioncmds.c
M src/backend/parser/gram.y

Change pg_seclabel.provider and pg_shseclabel.provider to type "name".

commit   : b82a7be603f1811a0a707b53c62de6d5d9431740    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 20:07:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 20:07:44 -0400    

Click here for diff

These were "text", but that's a bad idea because it has collation-dependent  
ordering.  No index in template0 should have collation-dependent ordering,  
especially not indexes on shared catalogs.  There was general agreement  
that provider names don't need to be longer than other identifiers, so we  
can fix this at a small waste of table space by changing from text to name.  
  
There's no way to fix the problem in the back branches, but we can hope  
that security labels don't yet have widespread-enough usage to make it  
urgent to fix.  
  
There needs to be a regression sanity test to prevent us from making this  
same mistake again; but before putting that in, we'll need to get rid of  
similar brain fade in the recently-added pg_replication_origin catalog.  
  
Note: for lack of a suitable testing environment, I've not really exercised  
this change.  I trust the buildfarm will show up any mistakes.  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/seclabel.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shseclabel.h

Attach ON CONFLICT SET ... WHERE to the correct planstate.

commit   : e4942f7a56efcfaabed5db7bde29ee21bef2f6e2    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 May 2015 01:55:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 May 2015 01:55:10 +0200    

Click here for diff

The previous coding was a leftover from attempting to hang all the on  
conflict logic onto modify table's child nodes. It appears to not have  
actually caused problems except for explain.  
  
Add test exercising the broken and some other code paths.  
  
Author: Peter Geoghegan and Andres Freund  

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

Put back a backwards-compatible version of sampling support functions.

commit   : 4db485e75b9672126963ae4052b50f473b30a097    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 18:34:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 18:34:37 -0400    

Click here for diff

Commit 83e176ec18d2a91dbea1d0d1bd94c38dc47cd77c removed the longstanding  
support functions for block sampling without any consideration of the  
impact this would have on third-party FDWs.  The new API is not notably  
more functional for FDWs than the old, so forcing them to change doesn't  
seem like a good thing.  We can provide the old API as a wrapper (more  
or less) around the new one for a minimal amount of extra code.  

M src/backend/utils/misc/sampling.c
M src/include/commands/vacuum.h
M src/include/utils/sampling.h

Recognize "REGRESS_OPTS += ..." syntax in MSVC build scripts.

commit   : f5916bb7b53f8a77c95c00c5b287659958891178    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 13:40:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 13:40:06 -0400    

Click here for diff

Necessitated by commit b14cf229f4bd7238be2e31d873dc5dd241d3871e.  
Per buildfarm.  

M src/tools/msvc/vcregress.pl

Fix error message in pre_sync_fname.

commit   : 922de19ef25e559b1a7ad5c583ee4439e53cae98    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 18 May 2015 12:53:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 18 May 2015 12:53:09 -0400    

Click here for diff

The old one didn't include %m anywhere, and required extra  
translation.  
  
Report by Peter Eisentraut. Fix by me. Review by Tom Lane.  

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

Last-minute updates for release notes.

commit   : 19d47ed2da1e4d08ffab7e8ba1b1c4c614e7f296    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 12:09:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 May 2015 12:09:02 -0400    

Click here for diff

Add entries for security issues.  
  
Security: CVE-2015-3165 through CVE-2015-3167  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

pgcrypto: Report errant decryption as "Wrong key or corrupt data".

commit   : 85270ac7a24a50d43ba4bd4d7af1e28b14dee7ee    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    

Click here for diff

This has been the predominant outcome.  When the output of decrypting  
with a wrong key coincidentally resembled an OpenPGP packet header,  
pgcrypto could instead report "Corrupt data", "Not text data" or  
"Unsupported compression algorithm".  The distinct "Corrupt data"  
message added no value.  The latter two error messages misled when the  
decrypted payload also exhibited fundamental integrity problems.  Worse,  
error message variance in other systems has enabled cryptologic attacks;  
see RFC 4880 section "14. Security Considerations".  Whether these  
pgcrypto behaviors are likewise exploitable is unknown.  
  
In passing, document that pgcrypto does not resist side-channel attacks.  
Back-patch to 9.0 (all supported versions).  
  
Security: CVE-2015-3167  

M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/expected/pgp-pubkey-decrypt.out
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
M contrib/pgcrypto/sql/pgp-decrypt.sql
M doc/src/sgml/pgcrypto.sgml

Check return values of sensitive system library calls.

commit   : fd97bd411d1da45b79e63c2124741f8e82cc5a5c    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    

Click here for diff

PostgreSQL already checked the vast majority of these, missing this  
handful that nearly cannot fail.  If putenv() failed with ENOMEM in  
pg_GSS_recvauth(), authentication would proceed with the wrong keytab  
file.  If strftime() returned zero in cache_locale_time(), using the  
unspecified buffer contents could lead to information exposure or a  
crash.  Back-patch to 9.0 (all supported versions).  
  
Other unchecked calls to these functions, especially those in frontend  
code, pose negligible security concern.  This patch does not address  
them.  Nonetheless, it is always better to check return values whose  
specification provides for indicating an error.  
  
In passing, fix an off-by-one error in strftime_win32()'s invocation of  
WideCharToMultiByte().  Upon retrieving a value of exactly MAX_L10N_DATA  
bytes, strftime_win32() would overrun the caller's buffer by one byte.  
MAX_L10N_DATA is chosen to exceed the length of every possible value, so  
the vulnerable scenario probably does not arise.  
  
Security: CVE-2015-3166  

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

Add error-throwing wrappers for the printf family of functions.

commit   : 16304a013432931e61e623c8d85e9fe24709d9ba    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    

Click here for diff

All known standard library implementations of these functions can fail  
with ENOMEM.  A caller neglecting to check for failure would experience  
missing output, information exposure, or a crash.  Check return values  
within wrappers and code, currently just snprintf.c, that bypasses the  
wrappers.  The wrappers do not return after an error, so their callers  
need not check.  Back-patch to 9.0 (all supported versions).  
  
Popular free software standard library implementations do take pains to  
bypass malloc() in simple cases, but they risk ENOMEM for floating point  
numbers, positional arguments, large field widths, and large precisions.  
No specification demands such caution, so this commit regards every call  
to a printf family function as a potential threat.  
  
Injecting the wrappers implicitly is a compromise between patch scope  
and design goals.  I would prefer to edit each call site to name a  
wrapper explicitly.  libpq and the ECPG libraries would, ideally, convey  
errors to the caller rather than abort().  All that would be painfully  
invasive for a back-patched security fix, hence this compromise.  
  
Security: CVE-2015-3166  

M src/include/port.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/.gitignore
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/bcc32.mak
M src/interfaces/libpq/win32.mak
M src/pl/plperl/plperl.h
M src/pl/plpython/plpython.h
M src/port/Makefile
M src/port/snprintf.c
A src/port/syswrap.c
M src/tools/msvc/Mkvcbuild.pm

Permit use of vsprintf() in PostgreSQL code.

commit   : cac18a76bb6b08f1ecc2a85e46c9d2ab82dd9d23    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    

Click here for diff

The next commit needs it.  Back-patch to 9.0 (all supported versions).  

M src/include/port.h
M src/port/snprintf.c

Prevent a double free by not reentering be_tls_close().

commit   : b0ce385032d72d6acf1e330f733013553fe6affe    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 May 2015 10:02:31 -0400    

Click here for diff

Reentering this function with the right timing caused a double free,  
typically crashing the backend.  By synchronizing a disconnection with  
the authentication timeout, an unauthenticated attacker could achieve  
this somewhat consistently.  Call be_tls_close() solely from within  
proc_exit_prepare().  Back-patch to 9.0 (all supported versions).  
  
Benkocs Norbert Attila  
  
Security: CVE-2015-3165  

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

Fix typo in comment.

commit   : 8cc7a4c5fdbe43b9b16b4cf3e07c8115107a8d4e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 May 2015 10:38:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 May 2015 10:38:52 +0300    

Click here for diff

Jim Nasby  

M src/backend/executor/nodeIndexscan.c

Put back stats-collector restarting code, removed accidentally.

commit   : 4df132895016c6a99355776a8df284ff011a2e94    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 May 2015 10:18:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 May 2015 10:18:46 +0300    

Click here for diff

Removed that code snippet accidentally in the archive_mode='always' patch.  
  
Also, use varname-tags for archive_command in the docs.  
  
Fujii Masao  

M doc/src/sgml/high-availability.sgml
M src/backend/postmaster/postmaster.c

Don't classify REINDEX command as DDL in the pg_audit doc.

commit   : d773b55713e44b7d4a67411b09e1f21f195b420f    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 18 May 2015 14:55:07 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 18 May 2015 14:55:07 +0900    

Click here for diff

The commit a936743 changed the class of REINDEX but forgot to update the doc.  

M doc/src/sgml/pgaudit.sgml

Add new files to nls.mk

commit   : 382b479ab7b4afb0d661ee24104d418758dc2a36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 May 2015 22:55:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 May 2015 22:55:17 -0400    

Click here for diff

M src/bin/initdb/nls.mk
M src/bin/pg_resetxlog/nls.mk
M src/interfaces/libpq/nls.mk

Fix failure to copy IndexScan.indexorderbyops in copyfuncs.c.

commit   : 424661913c06af76a46fdff9cc24cc57abf14fb3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 May 2015 21:22:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 May 2015 21:22:12 -0400    

Click here for diff

This oversight results in a crash at executor startup if the plan has  
been copied.  outfuncs.c was missed as well.  
  
While we could probably have taught both those files to cope with the  
originally chosen representation of an Oid array, it would have been  
painful, not least because there'd be no easy way to verify the array  
length.  An Oid List is far easier to work with.  And AFAICS, there is  
no particular notational benefit to using an array rather than a list  
in the existing parts of the patch either.  So just change it to a list.  
  
Error in commit 35fcb1b3d038a501f3f4c87c05630095abaaadab, which is new,  
so no need for back-patch.  

M src/backend/executor/nodeIndexscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/include/nodes/plannodes.h

Use += not = to set makefile variables after including base makefiles.

commit   : b14cf229f4bd7238be2e31d873dc5dd241d3871e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 May 2015 20:04:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 May 2015 20:04:42 -0400    

Click here for diff

The previous coding in hstore_plpython and ltree_plpython wiped out any  
values set by the base makefiles.  This at least had the effect of running  
the tests in "regression" not "contrib_regression" as expected.  These  
being pretty new modules, there might be other bad effects we'd not  
noticed yet.  

M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile

Release notes for 9.4.2, 9.3.7, 9.2.11, 9.1.16, 9.0.20.

commit   : a0891d2d0136ea06cde957635338c0c238df87de    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 May 2015 15:54:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 May 2015 15:54:20 -0400    

Click here for diff

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Fix wording error caused by recent typo fixes

commit   : de6109b8cc42be11e40aeeafff90ee145367fa00    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 17 May 2015 19:06:08 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 17 May 2015 19:06:08 +0200    

Click here for diff

It wasn't just a typo, but bad wording. This should make it  
more clear. Pointed out by Tom Lane.  

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

pg_audit Makefile, REINDEX changes

commit   : a936743b336ed0b53f1ddb28b4535f4c27bd2b23    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 17 May 2015 09:56:57 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 17 May 2015 09:56:57 -0400    

Click here for diff

Clean up the Makefile, per Michael Paquier.  
  
Classify REINDEX as we do in core, use '1.0' for the version, per Fujii.  

M contrib/pg_audit/Makefile
R094 contrib/pg_audit/pg_audit–1.0.0.sql contrib/pg_audit/pg_audit–1.0.sql
M contrib/pg_audit/pg_audit.c
M contrib/pg_audit/pg_audit.control

Fix typos in comments

commit   : 3b075e9d7be0181f8434e7b24007d87b618934c0    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 17 May 2015 14:57:30 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 17 May 2015 14:57:30 +0200    

Click here for diff

Dmitriy Olshevskiy  

M contrib/tsm_system_time/tsm_system_time.c
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/README
M src/backend/access/transam/xact.c
M src/backend/replication/logical/snapbuild.c
M src/backend/tsearch/dict_synonym.c
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Minor docs fixes for pg_audit

commit   : 6b665454e38580a72f355dcae37952cf1c82f119    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 17 May 2015 11:07:19 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 17 May 2015 11:07:19 +0200    

Click here for diff

Peter Geoghegan  

M doc/src/sgml/pgaudit.sgml

hstore_plpython: Fix regression tests under Python 3

commit   : fab6ca23eaf114d1ae12377c7f5c8c952b5e0159    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 May 2015 23:35:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 May 2015 23:35:29 -0400    

Click here for diff

M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql

Fix whitespace

commit   : e6dc503445e729d23ea12144db60d87e953ace95    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 May 2015 20:43:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 May 2015 20:43:32 -0400    

Click here for diff

M contrib/tsm_system_rows/tsm_system_rows–1.0.sql
M contrib/tsm_system_time/tsm_system_time–1.0.sql
M src/backend/access/transam/multixact.c
M src/test/modules/test_ddl_deparse/sql/alter_sequence.sql
M src/test/modules/test_ddl_deparse/sql/create_extension.sql
M src/test/modules/test_ddl_deparse/sql/create_sequence_1.sql
M src/test/modules/test_ddl_deparse/sql/opfamily.sql

First-draft release notes for 9.4.2 et al.

commit   : 0563b4c0c3b7cc2323cfb63e11d723764e2d5f7d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2015 18:09:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2015 18:09:39 -0400    

Click here for diff

As usual, the release notes for older branches will be made by cutting  
these down, but put them up for community review first.  

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

pg_upgrade: no need to check for matching float8_pass_by_value

commit   : 750ccaef2964cfb8b0530e0e3628038fce343786    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 16 May 2015 15:27:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 16 May 2015 15:27:14 -0400    

Click here for diff

Report by Noah Misch  

M src/bin/pg_upgrade/controldata.c

Fix docs typo

commit   : c65aa7a87e4232d7eefea3d78ec7e1d9f8b4708b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2015 13:28:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2015 13:28:26 -0400    

Click here for diff

I don't think "respectfully" is what was meant here ...  

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

More portability fixing for bipartite_match.c.

commit   : 26058bf0dc5fca0a5107b2ee136a81a86cf36049    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2015 11:35:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2015 11:35:42 -0400    

Click here for diff

<float.h> is required for isinf() on some platforms.  Per buildfarm.  

M src/backend/lib/bipartite_match.c

pg_upgrade: force timeline 1 in the new cluster

commit   : 4c5e060049a3714dd27b7f4732fe922090edea69    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 16 May 2015 00:40:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 16 May 2015 00:40:18 -0400    

Click here for diff

Previously, this prevented promoted standby servers from being upgraded  
because of a missing WAL history file.  (Timeline 1 doesn't need a  
history file, and we don't copy WAL files anyway.)  
  
Report by Christian Echerer(?), Alexey Klyukin  
  
Backpatch through 9.0  

M src/bin/pg_upgrade/pg_upgrade.c

pg_upgrade: only allow template0 to be non-connectable

commit   : fb694d959c97c912b49ec47326e6a05a8c0da11d    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 16 May 2015 00:10:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 16 May 2015 00:10:03 -0400    

Click here for diff

This patch causes pg_upgrade to error out during its check phase if:  
  
(1) template0 is marked connectable  
or  
(2) any other database is marked non-connectable  
  
This is done because, in the first case, pg_upgrade would fail because  
the pg_dumpall --globals restore would fail, and in the second case, the  
database would not be restored, leading to data loss.  
  
Report by Matt Landry (1), Stephen Frost (2)  
  
Backpatch through 9.0  

M src/bin/pg_upgrade/check.c

Avoid direct use of INFINITY.

commit   : 12cc299c65ba6124c7d459f2605404ad43909db3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 22:15:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 22:15:01 -0400    

Click here for diff

It's not very portable.  Per buildfarm.  

M src/backend/lib/bipartite_match.c

Add docs for tablesample system_time()

commit   : f941d033296eb99eeac60f22fc70938893bf7a30    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 21:54:18 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 21:54:18 -0400    

Click here for diff

A doc/src/sgml/tsm-system-time.sgml

Support GROUPING SETS, CUBE and ROLLUP.

commit   : f3d3118532175541a9a96ed78881a3b04a057128    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 16 May 2015 03:40:59 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 16 May 2015 03:40:59 +0200    

Click here for diff

This SQL standard functionality allows to aggregate data by different  
GROUP BY clauses at once. Each grouping set returns rows with columns  
grouped by in other sets set to NULL.  
  
This could previously be achieved by doing each grouping as a separate  
query, conjoined by UNION ALLs. Besides being considerably more concise,  
grouping sets will in many cases be faster, requiring only one scan over  
the underlying data.  
  
The current implementation of grouping sets only supports using sorting  
for input. Individual sets that share a sort order are computed in one  
pass. If there are sets that don't share a sort order, additional sort &  
aggregation steps are performed. These additional passes are sourced by  
the previous sort step; thus avoiding repeated scans of the source data.  
  
The code is structured in a way that adding support for purely using  
hash aggregation or a mix of hashing and sorting is possible. Sorting  
was chosen to be supported first, as it is the most generic method of  
implementation.  
  
Instead of, as in an earlier versions of the patch, representing the  
chain of sort and aggregation steps as full blown planner and executor  
nodes, all but the first sort are performed inside the aggregation node  
itself. This avoids the need to do some unusual gymnastics to handle  
having to return aggregated and non-aggregated tuples from underlying  
nodes, as well as having to shut down underlying nodes early to limit  
memory usage.  The optimizer still builds Sort/Agg node to describe each  
phase, but they're not part of the plan tree, but instead additional  
data for the aggregation node. They're a convenient and preexisting way  
to describe aggregation and sorting.  The first (and possibly only) sort  
step is still performed as a separate execution step. That retains  
similarity with existing group by plans, makes rescans fairly simple,  
avoids very deep plans (leading to slow explains) and easily allows to  
avoid the sorting step if the underlying data is sorted by other means.  
  
A somewhat ugly side of this patch is having to deal with a grammar  
ambiguity between the new CUBE keyword and the cube extension/functions  
named cube (and rollup). To avoid breaking existing deployments of the  
cube extension it has not been renamed, neither has cube been made a  
reserved keyword. Instead precedence hacking is used to make GROUP BY  
cube(..) refer to the CUBE grouping sets feature, and not the function  
cube(). To actually group by a function cube(), unlikely as that might  
be, the function name has to be quoted.  
  
Needs a catversion bump because stored rules may change.  
  
Author: Andrew Gierth and Atri Sharma, with contributions from Andres Freund  
Reviewed-By: Andres Freund, Noah Misch, Tom Lane, Svenne Krap, Tomas  
    Vondra, Erik Rijkers, Marti Raudsepp, Pavel Stehule  
Discussion: CAOeZVidmVRe2jU6aMk_5qkxnB7dfmPROzM7Ur8JPW5j8Y5X-Lw@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/func.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/select.sgml
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/executor/execQual.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/lib/Makefile
A src/backend/lib/bipartite_match.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.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/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/include/catalog/catversion.h
M src/include/commands/explain.h
A src/include/lib/bipartite_match.h
M src/include/nodes/execnodes.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/planmain.h
M src/include/optimizer/tlist.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/utils/selfuncs.h
A src/test/regress/expected/groupingsets.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/groupingsets.sql

Add docs for tablesample system_rows()

commit   : 6e4415c6aa428132dd41c8bf23a0885fca0f2271    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 21:44:53 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 21:44:53 -0400    

Click here for diff

A doc/src/sgml/tsm-system-rows.sgml

Update time zone data files to tzdata release 2015d.

commit   : 9d366c1f3d758c3b80cd482a6d4528960c4fc325    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 19:35:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 19:35:29 -0400    

Click here for diff

DST law changes in Egypt, Mongolia, Palestine.  
Historical corrections for Canada and Chile.  
Revised zone abbreviation for America/Adak (HST/HDT not HAST/HADT).  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backward
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Add BRIN infrastructure for "inclusion" opclasses

commit   : b0b7be61337fc64147f2ad0af5bf2c0e6b8a709f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2015 18:05:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2015 18:05:22 -0300    

Click here for diff

This lets BRIN be used with R-Tree-like indexing strategies.  
  
Also provided are operator classes for range types, box and inet/cidr.  
The infrastructure provided here should be sufficient to create operator  
classes for similar datatypes; for instance, opclasses for PostGIS  
geometries should be doable, though we didn't try to implement one.  
  
(A box/point opclass was also submitted, but we ripped it out before  
commit because the handling of floating point comparisons in existing  
code is inconsistent and would generate corrupt indexes.)  
  
Author: Emre Hasegeli.  Cosmetic changes by me  
Review: Andreas Karlsson  

M doc/src/sgml/brin.sgml
M src/backend/access/brin/Makefile
M src/backend/access/brin/brin.c
A src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/utils/adt/network_gist.c
M src/include/access/brin_internal.h
M src/include/access/stratnum.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/brin.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/brin.sql

Improve test for CONVERT() with GB18030 <-> UTF8.

commit   : 199f5973c50fe94e128508ff2218c42126fd0ee1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 17:03:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 17:03:18 -0400    

Click here for diff

Add a bit of coverage of high code points.  
  
Arjen Nienhuis  

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

Move strategy numbers to include/access/stratnum.h

commit   : 26df7066cc229887d4defdf1d105c0a22b8a88fb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2015 17:03:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2015 17:03:16 -0300    

Click here for diff

For upcoming BRIN opclasses, it's convenient to have strategy numbers  
defined in a single place.  Since there's nothing appropriate, create  
it.  The StrategyNumber typedef now lives there, as well as existing  
strategy numbers for B-trees (from skey.h) and R-tree-and-friends (from  
gist.h).  skey.h is forced to include stratnum.h because of the  
StrategyNumber typedef, but gist.h is not; extensions that currently  
rely on gist.h for rtree strategy numbers might need to add a new  
  
A few .c files can stop including skey.h and/or gist.h, which is a nice  
side benefit.  
  
Per discussion:  
https://www.postgresql.org/message-id/[email protected]  
  
Authored by Emre Hasegeli and Álvaro.  
  
(It's not clear to me why bootscanner.l has any #include lines at all.)  

M contrib/btree_gin/btree_gin.c
M contrib/cube/cube.c
M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/ltree_gist.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/seg/seg.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gist/gistproc.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/predtest.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/include/access/gist.h
M src/include/access/nbtree.h
M src/include/access/skey.h
A src/include/access/stratnum.h
M src/include/utils/rangetypes.h

SQLStandard feature T613 Sampling now Supported

commit   : 1e98fa0bf8de9d25d97fb346755a9c9c17bba549    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:51:31 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:51:31 -0400    

Click here for diff

M src/backend/catalog/sql_features.txt

Fix uninitialized variable.

commit   : 66493dd7aa02e19e93f7d5687acaab70075db34f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 15:45:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 15:45:20 -0400    

Click here for diff

Per compiler warnings.  

M src/backend/commands/explain.c

Tablesample method API docs

commit   : 910baf0a96a43a629c3d469b97f31e1f5103ff9e    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:40:52 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:40:52 -0400    

Click here for diff

Petr Jelinek  

M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml
A doc/src/sgml/tablesample-method.sgml

Add to contrib/Makefile

commit   : df259759fbd0a18e8c64f551824a0ec941ba067b    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:33:37 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:33:37 -0400    

Click here for diff

M contrib/Makefile

contrib/tsm_system_time

commit   : 56e121a508a1745c6b0c66ad2f237e9b5f03b19d    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:31:50 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:31:50 -0400    

Click here for diff

A contrib/tsm_system_time/.gitignore
A contrib/tsm_system_time/Makefile
A contrib/tsm_system_time/expected/tsm_system_time.out
A contrib/tsm_system_time/sql/tsm_system_time.sql
A contrib/tsm_system_time/tsm_system_time–1.0.sql
A contrib/tsm_system_time/tsm_system_time.c
A contrib/tsm_system_time/tsm_system_time.control

contrib/tsm_system_rows

commit   : 4d40494b11883f154e40f3996ad414fb0933bc12    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:31:14 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:31:14 -0400    

Click here for diff

A contrib/tsm_system_rows/.gitignore
A contrib/tsm_system_rows/Makefile
A contrib/tsm_system_rows/expected/tsm_system_rows.out
A contrib/tsm_system_rows/sql/tsm_system_rows.sql
A contrib/tsm_system_rows/tsm_system_rows–1.0.sql
A contrib/tsm_system_rows/tsm_system_rows.c
A contrib/tsm_system_rows/tsm_system_rows.control

TABLESAMPLE system_time(limit)

commit   : 149f6f15768e731c760392679ef8ddaf00dae6c8    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:18:57 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:18:57 -0400    

Click here for diff

Contrib module implementing a tablesample method  
that allows you to limit the sample by a hard time  
limit.  
  
Petr Jelinek  
  
Reviewed by Michael Paquier, Amit Kapila and  
Simon Riggs  

M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

TABLESAMPLE system_rows(limit)

commit   : 9689290ff0c065f9bdc4e3a76e7931e84554224b    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:14:22 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 15:14:22 -0400    

Click here for diff

Contrib module implementing a tablesample method  
that allows you to limit the sample by a hard row  
limit.  
  
Petr Jelinek  
  
Reviewed by Michael Paquier, Amit Kapila and  
Simon Riggs  

M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Extend GB18030 encoding conversion to cover full Unicode range.

commit   : 8d3e0906df5496b853cc763f87b9ffd2ae27adbe    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 15:01:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 15:01:59 -0400    

Click here for diff

Our previous code for GB18030 <-> UTF8 conversion only covered Unicode code  
points up to U+FFFF, but the actual spec defines conversions for all code  
points up to U+10FFFF.  That would be rather impractical as a lookup table,  
but fortunately there is a simple algorithmic conversion between the  
additional code points and the equivalent GB18030 byte patterns.  Make use  
of the just-added callback facility in LocalToUtf/UtfToLocal to perform the  
additional conversions.  
  
Having created the infrastructure to do that, we can use the same code to  
map certain linearly-related subranges of the Unicode space below U+FFFF,  
allowing removal of the corresponding lookup table entries.  This more  
than halves the lookup table size, which is a substantial savings;  
utf8_and_gb18030.so drops from nearly a megabyte to about half that.  
  
In support of doing that, replace ISO10646-GB18030.TXT with the data file  
gb-18030-2000.xml (retrieved from  
http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/ )  
in which these subranges have been deleted from the simple lookup entries.  
  
Per bug #12845 from Arjen Nienhuis.  The conversion code added here is  
based on his proposed patch, though I whacked it around rather heavily.  

D src/backend/utils/mb/Unicode/ISO10646-GB18030.TXT
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
A src/backend/utils/mb/Unicode/gb-18030-2000.xml
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.map
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c

doc: CREATE FOREIGN TABLE now allows CHECK ( ... ) NO INHERIT

commit   : 92edba2665ae7bf43ed03538311e63652f9e2373    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 15 May 2015 14:38:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 15 May 2015 14:38:27 -0400    

Click here for diff

Etsuro Fujita  

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

TABLESAMPLE, SQL Standard and extensible

commit   : f6d208d6e51810c73f0e02c477984a6b44627f11    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 14:37:10 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 14:37:10 -0400    

Click here for diff

Add a TABLESAMPLE clause to SELECT statements that allows  
user to specify random BERNOULLI sampling or block level  
SYSTEM sampling. Implementation allows for extensible  
sampling functions to be written, using a standard API.  
Basic version follows SQLStandard exactly. Usable  
concrete use cases for the sampling API follow in later  
commits.  
  
Petr Jelinek  
  
Reviewed by Michael Paquier and Simon Riggs  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/select.sgml
M src/backend/access/Makefile
M src/backend/access/heap/heapam.c
A src/backend/access/tablesample/Makefile
A src/backend/access/tablesample/bernoulli.c
A src/backend/access/tablesample/system.c
A src/backend/access/tablesample/tablesample.c
M src/backend/catalog/Makefile
M src/backend/commands/analyze.c
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execProcnode.c
A src/backend/executor/nodeSamplescan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_func.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/sampling.c
M src/include/access/heapam.h
M src/include/access/relscan.h
A src/include/access/tablesample.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_proc.h
A src/include/catalog/pg_tablesample_method.h
A src/include/executor/nodeSamplescan.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/parser/kwlist.h
M src/include/parser/parse_func.h
M src/include/port.h
M src/include/utils/lsyscache.h
M src/include/utils/rel.h
M src/include/utils/sampling.h
M src/include/utils/syscache.h
M src/port/erand48.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/sanity_check.out
A src/test/regress/expected/tablesample.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/rowsecurity.sql
A src/test/regress/sql/tablesample.sql

Silence another create_index regression test failure.

commit   : 11a83bbedd73800db70f6f2af5a8eb10d15d39d7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 21:24:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 21:24:23 +0300    

Click here for diff

More platform differences in the less-significant digits in output.  
  
Per buildfarm member rover_firefly, still.  

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

Fix outdated src/test/mb/ tests, and add a GB18030 test.

commit   : 07af523870bcfe930134054febd3a6a114942e5b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 13:47:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 13:47:42 -0400    

Click here for diff

The expected-output files for these tests were broken by the recent  
addition of a warning for hash indexes.  Update them.  
  
Also add a test case for GB18030 encoding, similar to the other ones.  
This is a pretty weak test, but it's better than nothing.  

M src/test/mb/expected/big5.out
M src/test/mb/expected/euc_jp.out
M src/test/mb/expected/euc_kr.out
M src/test/mb/expected/euc_tw.out
A src/test/mb/expected/gb18030.out
M src/test/mb/expected/mule_internal.out
M src/test/mb/expected/sjis.out
M src/test/mb/expected/utf8.out
M src/test/mb/mbregress.sh
A src/test/mb/sql/gb18030.sql

Fix docs build. Oops.

commit   : 8b0f105d2d179dc1085b16f0594c8fa78d13267d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 19:58:56 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 19:58:56 +0300    

Click here for diff

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

Add archive_mode='always' option.

commit   : ffd37740ee6fcd434416ec0c5461f7040e0a11de    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 18:55:24 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 18:55:24 +0300    

Click here for diff

In 'always' mode, the standby independently archives all files it receives  
from the primary.  
  
Original patch by Fujii Masao, docs and review by me.  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/postmaster.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/access/xlog.h

docs: consistently uppercase index method and add spacing

commit   : f6d65f0c7068bab6a9ca55a82f18fd52e8fd1e5e    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2015 11:42:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2015 11:42:29 -0400    

Click here for diff

Consistently uppercase index method names, e.g. GIN, and add space after  
the index method name and the parentheses enclosing the column names.  

M doc/src/sgml/btree-gin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/rangetypes.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/textsearch.sgml

Silence create_index regression test failure.

commit   : 9feaba28e27820f91d13c3de6581bb3b8c3234c6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 18:20:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 18:20:16 +0300    

Click here for diff

The expected output contained some floating point values which might get  
rounded slightly differently on different platforms. The exact output isn't  
very interesting in this test, so just round it.  
  
Per buildfarm member rover_firefly.  

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

Fix datatype confusion with the new lossy GiST distance functions.

commit   : 98edd617f3b62a02cb2df9b418fcc4ece45c7ec0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 17:59:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 17:59:46 +0300    

Click here for diff

We can only support a lossy distance function when the distance function's  
datatype is comparable with the original ordering operator's datatype.  
The distance function always returns a float8, so we are limited to float8,  
and float4 (by a hard-coded cast of the float8 to float4).  
  
In light of this limitation, it seems like a good idea to have a separate  
'recheck' flag for the ORDER BY expressions, so that if you have a non-lossy  
distance function, it still works with lossy quals. There are cases like  
that with the build-in or contrib opclasses, but it's plausible.  
  
There was a hidden assumption that the ORDER BY values returned by GiST  
match the original ordering operator's return type, but there are plenty  
of examples where that's not true, e.g. in btree_gist and pg_trgm. As long  
as the distance function is not lossy, we can tolerate that and just not  
return the distance to the executor (or rather, always return NULL). The  
executor doesn't need the distances if there are no lossy results.  
  
There was another little bug: the recheck variable was not initialized  
before calling the distance function. That revealed the bigger issue,  
as the executor tried to reorder tuples that didn't need reordering, and  
that failed because of the datatype mismatch.  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/executor/nodeIndexscan.c
M src/include/access/gist_private.h
M src/include/access/relscan.h

Fix insufficiently-paranoid GB18030 encoding verifier.

commit   : a868931fecdf93f3ceb1c9431bb93757b706269d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 11:03:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2015 11:03:54 -0400    

Click here for diff

The previous coding effectively only verified that the second byte of a  
multibyte character was in the expected range; moreover, it wasn't careful  
to make sure that the second byte even exists in the buffer before touching  
it.  The latter seems unlikely to cause any real problems in the field  
(in particular, it could never be a problem with null-terminated input),  
but it's still a bug.  
  
Since GB18030 is not a supported backend encoding, the only thing we'd  
really be doing with GB18030 text is converting it to UTF8 in LocalToUtf,  
which would fail anyway on any invalid character for lack of a match in  
its lookup table.  So the only user-visible consequence of this change  
should be that you'll get "invalid byte sequence for encoding" rather than  
"character has no equivalent" for malformed GB18030 input.  However,  
impending changes to the GB18030 conversion code will require these tighter  
up-front checks to avoid producing bogus results.  

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

Remove useless pg_audit.conf

commit   : aff27e33797c5161a322a10b44a260d848b73154    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 15 May 2015 10:41:53 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 15 May 2015 10:41:53 -0400    

Click here for diff

No need to have pg_audit.conf any longer since the regression tests are  
just loading the module at the start of each session (to simulate being  
in shared_preload_libraries, which isn't something we can actually make  
happen on the buildfarm itself, it seems).  
  
Pointed out by Tom  

D contrib/pg_audit/pg_audit.conf

Support --verbose option in reindexdb.

commit   : 458a07701e2e464558238aeb6058b5179b133921    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 15 May 2015 21:45:55 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 15 May 2015 21:45:55 +0900    

Click here for diff

Sawada Masahiko, reviewed by Fabrízio Mello  

M doc/src/sgml/ref/reindexdb.sgml
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl

Allow GiST distance function to return merely a lower-bound.

commit   : 35fcb1b3d038a501f3f4c87c05630095abaaadab    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 14:26:51 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 May 2015 14:26:51 +0300    

Click here for diff

The distance function can now set *recheck = false, like index quals. The  
executor will then re-check the ORDER BY expressions, and use a queue to  
reorder the results on the fly.  
  
This makes it possible to do kNN-searches on polygons and circles, which  
don't store the exact value in the index, but just a bounding box.  
  
Alexander Korotkov and me  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/plan/createplan.c
M src/backend/utils/adt/geo_ops.c
M src/include/access/genam.h
M src/include/access/relscan.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/utils/geo_decls.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Support VERBOSE option in REINDEX command.

commit   : ecd222e770d352121590363ffdf981147a43e976    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 15 May 2015 20:09:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 15 May 2015 20:09:57 +0900    

Click here for diff

When this option is specified, a progress report is printed as each index  
is reindexed.  
  
Per discussion, we agreed on the following syntax for the extensibility of  
the options.  
  
    REINDEX (flexible options) { INDEX | ... } name  
  
Sawada Masahiko.  
Reviewed by Robert Haas, Fabrízio Mello, Alvaro Herrera, Kyotaro Horiguchi,  
Jim Nasby and me.  
  
Discussion: CAD21AoA0pK3YcOZAFzMae+2fcc3oGp5zoRggDyMNg5zoaWDhdQ@mail.gmail.com  

M doc/src/sgml/ref/reindex.sgml
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/catalog/index.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Honor traditional SGML NAMELEN limit.

commit   : 4b8f797f672bef07b4e87b4650b4035731b61d84    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 22:34:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 22:34:28 -0400    

Click here for diff

We've conformed to this limit in the past, so might as well continue to.  
  
Aaron Swenson  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/replication-origins.sgml

Teach UtfToLocal/LocalToUtf to support algorithmic encoding conversions.

commit   : 7730f48ede0d222e7f750541d3d5f0f74d75d99b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 22:27:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 22:27:07 -0400    

Click here for diff

Until now, these functions have only supported encoding conversions using  
lookup tables, which is fine as long as there's not too many code points  
to convert.  However, GB18030 expects all 1.1 million Unicode code points  
to be convertible, which would require a ridiculously-sized lookup table.  
Fortunately, a large fraction of those conversions can be expressed through  
arithmetic, ie the conversions are one-to-one in certain defined ranges.  
To support that, provide a callback function that is used after consulting  
the lookup tables.  (This patch doesn't actually change anything about the  
GB18030 conversion behavior, just provide infrastructure for fixing it.)  
  
Since this requires changing the APIs of UtfToLocal/LocalToUtf anyway,  
take the opportunity to rearrange their argument lists into what seems  
to me a saner order.  And beautify the call sites by using lengthof()  
instead of error-prone sizeof() arithmetic.  
  
In passing, also mark all the lookup tables used by these calls "const".  
This moves an impressive amount of stuff into the text segment, at least  
on my machine, and is safer anyhow.  

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_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/big5_to_utf8.map
M src/backend/utils/mb/Unicode/euc_cn_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8_combined.map
M src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
M src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
M src/backend/utils/mb/Unicode/euc_tw_to_utf8.map
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/gbk_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map
M src/backend/utils/mb/Unicode/johab_to_utf8.map
M src/backend/utils/mb/Unicode/koi8r_to_utf8.map
M src/backend/utils/mb/Unicode/koi8u_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8_combined.map
M src/backend/utils/mb/Unicode/sjis_to_utf8.map
M src/backend/utils/mb/Unicode/uhc_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_big5.map
M src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
M src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
M src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.map
M src/backend/utils/mb/Unicode/utf8_to_gbk.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_10.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_13.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_14.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_15.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_16.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_2.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_3.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_4.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_5.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_6.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_7.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_8.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_9.map
M src/backend/utils/mb/Unicode/utf8_to_johab.map
M src/backend/utils/mb/Unicode/utf8_to_koi8r.map
M src/backend/utils/mb/Unicode/utf8_to_koi8u.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004_combined.map
M src/backend/utils/mb/Unicode/utf8_to_sjis.map
M src/backend/utils/mb/Unicode/utf8_to_uhc.map
M src/backend/utils/mb/Unicode/utf8_to_win1250.map
M src/backend/utils/mb/Unicode/utf8_to_win1251.map
M src/backend/utils/mb/Unicode/utf8_to_win1252.map
M src/backend/utils/mb/Unicode/utf8_to_win1253.map
M src/backend/utils/mb/Unicode/utf8_to_win1254.map
M src/backend/utils/mb/Unicode/utf8_to_win1255.map
M src/backend/utils/mb/Unicode/utf8_to_win1256.map
M src/backend/utils/mb/Unicode/utf8_to_win1257.map
M src/backend/utils/mb/Unicode/utf8_to_win1258.map
M src/backend/utils/mb/Unicode/utf8_to_win866.map
M src/backend/utils/mb/Unicode/utf8_to_win874.map
M src/backend/utils/mb/Unicode/win1250_to_utf8.map
M src/backend/utils/mb/Unicode/win1251_to_utf8.map
M src/backend/utils/mb/Unicode/win1252_to_utf8.map
M src/backend/utils/mb/Unicode/win1253_to_utf8.map
M src/backend/utils/mb/Unicode/win1254_to_utf8.map
M src/backend/utils/mb/Unicode/win1255_to_utf8.map
M src/backend/utils/mb/Unicode/win1256_to_utf8.map
M src/backend/utils/mb/Unicode/win1257_to_utf8.map
M src/backend/utils/mb/Unicode/win1258_to_utf8.map
M src/backend/utils/mb/Unicode/win866_to_utf8.map
M src/backend/utils/mb/Unicode/win874_to_utf8.map
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/include/mb/pg_wchar.h

Separate block sampling functions

commit   : 83e176ec18d2a91dbea1d0d1bd94c38dc47cd77c    
  
author   : Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 04:02:54 +0200    
  
committer: Simon Riggs <[email protected]>    
date     : Fri, 15 May 2015 04:02:54 +0200    

Click here for diff

Refactoring ahead of tablesample patch  
  
Requested and reviewed by Michael Paquier  
  
Petr Jelinek  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/analyze.c
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/sampling.c
M src/include/commands/vacuum.h
A src/include/utils/sampling.h

pg_upgrade: make controldata checks more consistent

commit   : 5a3022fde018aca9b23b7f7506233b437d943de2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2015 21:56:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2015 21:56:10 -0400    

Click here for diff

Also add missing float8_pass_by_value check.  

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

Add pg_settings.pending_restart column

commit   : a486e35706eaea17e27e5fa0a2de6bc98546de1e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 May 2015 20:08:51 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 May 2015 20:08:51 -0400    

Click here for diff

with input from David G. Johnston, Robert Haas, Michael Paquier  

M doc/src/sgml/catalogs.sgml
M src/backend/utils/misc/guc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/guc_tables.h
M src/test/regress/expected/rules.out

doc: list bigint as mapping to int8 and int64

commit   : 333a870f94ac23f29befa346324f9dab7f3265e9    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2015 17:37:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2015 17:37:53 -0400    

Click here for diff

Report by Paul Jungwirth  

M doc/src/sgml/xfunc.sgml

Make repeated 'make installcheck' runs work

commit   : b22b770683806db0a1c0a52a4601a3b6755891e0    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 15:41:39 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 15:41:39 -0400    

Click here for diff

In pg_audit, set client_min_messages up to warning, then reset the role  
attributes, to completely reset the session while not making the  
regression tests depend on being run by any particular user.  

M contrib/pg_audit/expected/pg_audit.out
M contrib/pg_audit/sql/pg_audit.sql

Improve pg_audit regression tests

commit   : ed6ea8e815b4331c94f827f45054817e7e1a7784    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 15:16:27 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 15:16:27 -0400    

Click here for diff

Instead of creating a new superuser role, extract out what the current  
user is and use that user instead.  Further, clean up and drop all  
objects created by the regression test.  
  
Pointed out by Tom.  

M contrib/pg_audit/expected/pg_audit.out
M contrib/pg_audit/sql/pg_audit.sql

Docs: fix erroneous claim about max byte length of GB18030.

commit   : 333d0779627a6c6125c018ea39da4427d3bdd93f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 14:59:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 14:59:00 -0400    

Click here for diff

This encoding has characters up to 4 bytes long, not 2.  

M doc/src/sgml/charset.sgml

Fix portability issue in pg_audit.

commit   : 35a1e1d1593f4355c9d87bbc8208a8736801a607    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 13:19:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 13:19:26 -0400    

Click here for diff

"%ld" is not a portable way to print int64's.  This may explain the  
buildfarm crashes we're seeing --- it seems to make dromedary happy,  
at least.  

M contrib/pg_audit/pg_audit.c

Suppress uninitialized-variable warning.

commit   : 6c9e93d3ffbf99435636103ad69d6469c64e2aef    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 12:16:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 12:16:06 -0400    

Click here for diff

M contrib/pg_audit/pg_audit.c

Support "expanded" objects, particularly arrays, for better performance.

commit   : 1dc5ebc9077ab742079ce5dac9a6664248d42916    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 12:08:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2015 12:08:40 -0400    

Click here for diff

This patch introduces the ability for complex datatypes to have an  
in-memory representation that is different from their on-disk format.  
On-disk formats are typically optimized for minimal size, and in any case  
they can't contain pointers, so they are often not well-suited for  
computation.  Now a datatype can invent an "expanded" in-memory format  
that is better suited for its operations, and then pass that around among  
the C functions that operate on the datatype.  There are also provisions  
(rudimentary as yet) to allow an expanded object to be modified in-place  
under suitable conditions, so that operations like assignment to an element  
of an array need not involve copying the entire array.  
  
The initial application for this feature is arrays, but it is not hard  
to foresee using it for other container types like JSON, XML and hstore.  
I have hopes that it will be useful to PostGIS as well.  
  
In this initial implementation, a few heuristics have been hard-wired  
into plpgsql to improve performance for arrays that are stored in  
plpgsql variables.  We would like to generalize those hacks so that  
other datatypes can obtain similar improvements, but figuring out some  
appropriate APIs is left as a task for future work.  (The heuristics  
themselves are probably not optimal yet, either, as they sometimes  
force expansion of arrays that would be better left alone.)  
  
Preliminary performance testing shows impressive speed gains for plpgsql  
functions that do element-by-element access or update of large arrays.  
There are other cases that get a little slower, as a result of added array  
format conversions; but we can hope to improve anything that's annoyingly  
bad.  In any case most applications should see a net win.  
  
Tom Lane, reviewed by Andres Freund  

M doc/src/sgml/storage.sgml
M doc/src/sgml/xtypes.sgml
M src/backend/access/common/heaptuple.c
M src/backend/access/heap/tuptoaster.c
M src/backend/executor/execQual.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/spi.c
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datum.c
A src/backend/utils/adt/expandeddatum.c
M src/backend/utils/mmgr/mcxt.c
M src/include/executor/spi.h
M src/include/executor/tuptable.h
M src/include/nodes/primnodes.h
M src/include/postgres.h
M src/include/utils/array.h
A src/include/utils/arrayaccess.h
M src/include/utils/datum.h
A src/include/utils/expandeddatum.h
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Further fixes for the buildfarm for pg_audit

commit   : 8a2e1edd2ba0817313c1c0ef76b03a5ab819d17f    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 11:55:36 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 11:55:36 -0400    

Click here for diff

Also, use a function to load the extension ahead of all other calls,  
simulating load from shared_libraries_preload, to make sure the  
hooks are in place before logging start.  

M contrib/pg_audit/Makefile
M contrib/pg_audit/expected/pg_audit.out
M contrib/pg_audit/sql/pg_audit.sql

Further fixes for the buildfarm for pg_audit

commit   : c703b1e689010961c6bb7ede1e88c2ae296858b6    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 11:44:16 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 11:44:16 -0400    

Click here for diff

The database built by the buildfarm is specific to the extension, use  
\connect - instead.  

M contrib/pg_audit/expected/pg_audit.out
M contrib/pg_audit/sql/pg_audit.sql

Fix buildfarm with regard to pg_audit

commit   : dfb7624a13277e7662a2c983e4440dcd522c16f1    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 10:57:12 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 10:57:12 -0400    

Click here for diff

Remove the check that pg_audit be installed by  
shared_preload_libraries as that's not going to work when running the  
regressions tests in the buildfarm.  That check was primairly a nice to  
have and isn't required anyway.  

M contrib/pg_audit/pg_audit.c

Add pg_audit, an auditing extension

commit   : ac52bb0442f79076b14acd8ad5b696946c1053b8    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 10:36:16 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 14 May 2015 10:36:16 -0400    

Click here for diff

This extension provides detailed logging classes, ability to control  
logging at a per-object level, and includes fully-qualified object  
names for logged statements (DML and DDL) in independent fields of the  
log output.  
  
Authors: Ian Barwick, Abhijit Menon-Sen, David Steele  
Reviews by: Robert Haas, Tatsuo Ishii, Sawada Masahiko, Fujii Masao,  
Simon Riggs  
  
Discussion with: Josh Berkus, Jaime Casanova, Peter Eisentraut,  
David Fetter, Yeb Havinga, Alvaro Herrera, Petr Jelinek, Tom Lane,  
MauMau, Bruce Momjian, Jim Nasby, Michael Paquier,  
Fabrízio de Royes Mello, Neil Tiffin  

M contrib/Makefile
A contrib/pg_audit/.gitignore
A contrib/pg_audit/Makefile
A contrib/pg_audit/expected/pg_audit.out
A contrib/pg_audit/pg_audit–1.0.0.sql
A contrib/pg_audit/pg_audit.c
A contrib/pg_audit/pg_audit.conf
A contrib/pg_audit/pg_audit.control
A contrib/pg_audit/sql/pg_audit.sql
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
A doc/src/sgml/pgaudit.sgml

Fix distclean/maintainer-clean targets to remove top-level tmp_install dir.

commit   : 9660710e2f5bbbf1b18640fbc5edcceafe7a10ad    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 May 2015 18:48:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 May 2015 18:48:05 -0400    

Click here for diff

The top-level makefile removes tmp_install in its "clean" target, but the  
distclean and maintainer-clean targets overlooked that (and they don't  
simply invoke clean, because that would result in an extra tree traversal).  
  
While at it, let's just make sure that removing GNUmakefile itself is the  
very last step of the recipe.  

M GNUmakefile.in

Fix comment.

commit   : 61f68e0bed63aa5090e8be7c912843e49b30fc1e    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 May 2015 15:27:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 May 2015 15:27:41 -0400    

Click here for diff

Commit 78efd5c1edb59017f06ef96773e64e6539bfbc86 overlooked this.  
  
Report by Peter Geoghegan.  

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

Extend abbreviated key infrastructure to datum tuplesorts.

commit   : 78efd5c1edb59017f06ef96773e64e6539bfbc86    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 May 2015 14:36:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 May 2015 14:36:26 -0400    

Click here for diff

Andrew Gierth, reviewed by Peter Geoghegan and by me.  

M src/backend/executor/nodeAgg.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/sort/tuplesort.c

Fix postgres_fdw to return the right ctid value in EvalPlanQual cases.

commit   : 0bb8528b5c738b45d0b65844750588c16bf75c52    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 May 2015 14:05:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 May 2015 14:05:17 -0400    

Click here for diff

If a postgres_fdw foreign table is a non-locked source relation in an  
UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, and the query selects its  
ctid column, the wrong value would be returned if an EvalPlanQual  
recheck occurred.  This happened because the foreign table's result row  
was copied via the ROW_MARK_COPY code path, and EvalPlanQualFetchRowMarks  
just unconditionally set the reconstructed tuple's t_self to "invalid".  
  
To fix that, we can have EvalPlanQualFetchRowMarks copy the composite  
datum's t_ctid field, and be sure to initialize that along with t_self  
when postgres_fdw constructs a tuple to return.  
  
If we just did that much then EvalPlanQualFetchRowMarks would start  
returning "(0,0)" as ctid for all other ROW_MARK_COPY cases, which perhaps  
does not matter much, but then again maybe it might.  The cause of that is  
that heap_form_tuple, which is the ultimate source of all composite datums,  
simply leaves t_ctid as zeroes in newly constructed tuples.  That seems  
like a bad idea on general principles: a field that's really not been  
initialized shouldn't appear to have a valid value.  So let's eat the  
trivial additional overhead of doing "ItemPointerSetInvalid(&(td->t_ctid))"  
in heap_form_tuple.  
  
This closes out our handling of Etsuro Fujita's report that tableoid and  
ctid weren't correctly set in postgres_fdw EvalPlanQual cases.  Along the  
way we did a great deal of work to improve FDWs' ability to control row  
locking behavior; which was not wasted effort by any means, but it didn't  
end up being a fix for this problem because that feature would be too  
expensive for postgres_fdw to use all the time.  
  
Although the fix for the tableoid misbehavior was back-patched, I'm  
hesitant to do so here; it seems far less likely that people would care  
about remote ctid than tableoid, and even such a minor behavioral change  
as this in heap_form_tuple is perhaps best not back-patched.  So commit  
to HEAD only, at least for the moment.  
  
Etsuro Fujita, with some adjustments by me  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/common/heaptuple.c
M src/backend/executor/execMain.c

Fix jsonb replace and delete on scalars and empty structures

commit   : 3f2cec797ecceb7467e365410506c0817f9d0163    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 13 May 2015 13:52:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 13 May 2015 13:52:08 -0400    

Click here for diff

These operations now error out if attempted on scalars, and simply  
return the input if attempted on empty arrays or objects. Along the way  
we remove the unnecessary cloning of the input when it's known to be  
unchanged. Regression tests covering these cases are added.  

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

Remove useless assertion.

commit   : ae6157164faf5ec1636a9acfe18bfd28a31db098    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 May 2015 11:01:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 May 2015 11:01:10 -0400    

Click here for diff

Here, snapshot->xcnt is an unsigned type, so it will always be  
non-negative.  

M src/backend/utils/time/snapmgr.c

Add pgstattuple_approx() to the pgstattuple extension.

commit   : 5850b20f58a594ac69f4f77b24cad94fc3bfd946    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 May 2015 07:31:04 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 May 2015 07:31:04 +0200    

Click here for diff

The new function allows to estimate bloat and other table level statics  
in a faster, but approximate, way. It does so by using information from  
the free space map for pages marked as all visible in the visibility  
map. The rest of the table is actually read and free space/bloat is  
measured accurately.  In many cases that allows to get bloat information  
much quicker, causing less IO.  
  
Author: Abhijit Menon-Sen  
Reviewed-By: Andres Freund, Amit Kapila and Tomas Vondra  
Discussion: [email protected]  

M contrib/pgstattuple/Makefile
A contrib/pgstattuple/pgstatapprox.c
A contrib/pgstattuple/pgstattuple–1.2–1.3.sql
R072 contrib/pgstattuple/pgstattuple–1.2.sql contrib/pgstattuple/pgstattuple–1.3.sql
M contrib/pgstattuple/pgstattuple.control
M doc/src/sgml/pgstattuple.sgml

PL/Python: Remove procedure cache invalidation

commit   : dcf5e319089e750d726a0e18a8c90b258c39362c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 May 2015 22:52:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 May 2015 22:52:18 -0400    

Click here for diff

This was added to react to changes in the pg_transform catalog, but  
building with CLOBBER_CACHE_ALWAYS showed that PL/Python was not  
prepared for having its procedure cache cleared.  Since this is a  
marginal use case, and we don't do this for other catalogs anyway, we  
can postpone this to another day.  

M src/pl/plpython/plpy_procedure.c

Fix ON CONFLICT bugs that manifest when used in rules.

commit   : 4af6e61a363246cf7fff3368a76603b0ce9945dd    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 May 2015 00:13:22 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 May 2015 00:13:22 +0200    

Click here for diff

Specifically the tlist and rti of the pseudo "excluded" relation weren't  
properly treated by expression_tree_walker, which lead to errors when  
excluded was referenced inside a rule because the varnos where not  
properly adjusted.  Similar omissions in OffsetVarNodes and  
expression_tree_mutator had less impact, but should obviously be fixed  
nonetheless.  
  
A couple tests of for ON CONFLICT UPDATE into INSERT rule bearing  
relations have been added.  
  
In passing I updated a couple comments.  

M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/rewrite/rewriteManip.c
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Fix some errors from jsonb functions patch.

commit   : 5c7df74204e2fb9440b576518d40fcf3ac65c8ac    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 16:54:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 16:54:38 -0400    

Click here for diff

The catalog version should have been bumped, and the alternative  
regression result file was not up to date with the name of jsonb_pretty.  

M src/include/catalog/catversion.h
M src/test/regress/expected/jsonb_1.out

Additional functions and operators for jsonb

commit   : c6947010ceb42143d9f047c65c1eac2b38928ab7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 15:52:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 15:52:45 -0400    

Click here for diff

jsonb_pretty(jsonb) produces nicely indented json output.  
jsonb || jsonb concatenates two jsonb values.  
jsonb - text removes a key and its associated value from the json  
jsonb - int removes the designated array element  
jsonb - text[] removes a key and associated value or array element at  
the designated path  
jsonb_replace(jsonb,text[],jsonb) replaces the array element designated  
by the path or the value associated with the key designated by the path  
with the given value.  
  
Original work by Dmitry Dolgov, adapted and reworked for PostgreSQL core  
by Andrew Dunstan, reviewed and tidied up by Petr Jelinek.  

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

Add support for doing late row locking in FDWs.

commit   : afb9249d06f47d7a6d4a89fea0c3625fe43c5a5d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 May 2015 14:10:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 May 2015 14:10:10 -0400    

Click here for diff

Previously, FDWs could only do "early row locking", that is lock a row as  
soon as it's fetched, even though local restriction/join conditions might  
discard the row later.  This patch adds callbacks that allow FDWs to do  
late locking in the same way that it's done for regular tables.  
  
To make use of this feature, an FDW must support the "ctid" column as a  
unique row identifier.  Currently, since ctid has to be of type TID,  
the feature is of limited use, though in principle it could be used by  
postgres_fdw.  We may eventually allow FDWs to specify another data type  
for ctid, which would make it possible for more FDWs to use this feature.  
  
This commit does not modify postgres_fdw to use late locking.  We've  
tested some prototype code for that, but it's not in committable shape,  
and besides it's quite unclear whether it actually makes sense to do late  
locking against a remote server.  The extra round trips required are likely  
to outweigh any benefit from improved concurrency.  
  
Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me  

M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/planner.c
M src/include/executor/executor.h
M src/include/foreign/fdwapi.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h

pgbench: Don't fail during startup

commit   : aa4a0b9571232f44e4b8d9effca3c540e657cebb    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 12 May 2015 13:13:12 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 12 May 2015 13:13:12 -0400    

Click here for diff

In pgbench, report, but ignore, any errors returned when attempting to  
vacuum/truncate the default tables during startup.  If the tables are  
needed, we'll error out soon enough anyway.  
  
Per discussion with Tatsuo, David Rowley, Jim Nasby, Robert, Andres,  
Fujii, Fabrízio de Royes Mello, Tomas Vondra, Michael Paquier, Peter,  
based on a suggestion from Jeff Janes, patch from Robert, additional  
message wording from Tom.  

M src/bin/pgbench/pgbench.c

commit   : 97e0aa697983cf7f7f79e69f2dc248fdefb7dbf6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 13:09:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 13:09:34 -0400    

Click here for diff

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

doc build: use unique Makefile variable to control temp install

commit   : ea12b3ca8cf4d5d4a35f6ca49f8e5128f716fa90    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 12 May 2015 12:30:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 12 May 2015 12:30:50 -0400    

Click here for diff

M doc/src/sgml/Makefile
M src/Makefile.global.in

"Fix" test_ddl_deparse regress test schedule

commit   : 007c932e5aaf6d68087f134b8557bbb7db149e94    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 May 2015 12:12:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 May 2015 12:12:39 -0300    

Click here for diff

MSVC is not smart enough to figure it out, so dumb down the Makefile and  
remove the schedule file.  
  
Also add a .gitignore file.  
  
Author: Michael Paquier  

A src/test/modules/test_ddl_deparse/.gitignore
M src/test/modules/test_ddl_deparse/Makefile
D src/test/modules/test_ddl_deparse/regress_schedule

doc: prevent SGML 'make check' from building temp install

commit   : e8c19263e45ce1f3133d2d403de9d380cdcd1fce    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 12 May 2015 11:01:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 12 May 2015 11:01:25 -0400    

Click here for diff

Report by Alvaro Herrera  

M src/Makefile.global.in

Map basebackup tablespaces using a tablespace_map file

commit   : 72d422a5227ef6f76f412486a395aba9f53bf3f0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 09:29:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 12 May 2015 09:29:10 -0400    

Click here for diff

Windows can't reliably restore symbolic links from a tar format, so  
instead during backup start we create a tablespace_map file, which is  
used by the restoring postgres to create the correct links in pg_tblspc.  
The backup protocol also now has an option to request this file to be  
included in the backup stream, and this is used by pg_basebackup when  
operating in tar mode.  
  
This is done on all platforms, not just Windows.  
  
This means that pg_basebackup will not not work in tar mode against 9.4  
and older servers, as this protocol option isn't implemented there.  
  
Amit Kapila, reviewed by Dilip Kumar, with a little editing from me.  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/replication/basebackup.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/bin/pg_basebackup/pg_basebackup.c
M src/include/access/xlog.h
M src/include/replication/basebackup.h

Replace some appendStringInfo* calls with more appropriate variants

commit   : d02f16470f117db3038dbfd87662d5f0eb5a2a9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 May 2015 20:38:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 May 2015 20:38:55 -0400    

Click here for diff

Author: David Rowley <[email protected]>  

M contrib/postgres_fdw/postgres_fdw.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/catalog/namespace.c
M src/backend/utils/adt/ruleutils.c

Allow on-the-fly capture of DDL event details

commit   : b488c580aef4e05f39be5daaab6464da5b22a494    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 May 2015 19:14:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 May 2015 19:14:31 -0300    

Click here for diff

This feature lets user code inspect and take action on DDL events.  
Whenever a ddl_command_end event trigger is installed, DDL actions  
executed are saved to a list which can be inspected during execution of  
a function attached to ddl_command_end.  
  
The set-returning function pg_event_trigger_ddl_commands can be used to  
list actions so captured; it returns data about the type of command  
executed, as well as the affected object.  This is sufficient for many  
uses of this feature.  For the cases where it is not, we also provide a  
"command" column of a new pseudo-type pg_ddl_command, which is a  
pointer to a C structure that can be accessed by C code.  The struct  
contains all the info necessary to completely inspect and even  
reconstruct the executed command.  
  
There is no actual deparse code here; that's expected to come later.  
What we have is enough infrastructure that the deparsing can be done in  
an external extension.  The intention is that we will add some deparsing  
code in a later release, as an in-core extension.  
  
A new test module is included.  It's probably insufficient as is, but it  
should be sufficient as a starting point for a more complete and  
future-proof approach.  
  
Authors: Álvaro Herrera, with some help from Andres Freund, Ian Barwick,  
Abhijit Menon-Sen.  
  
Reviews by Andres Freund, Robert Haas, Amit Kapila, Michael Paquier,  
Craig Ringer, David Steele.  
Additional input from Chris Browne, Dimitri Fontaine, Stephen Frost,  
Petr Jelínek, Tom Lane, Jim Nasby, Steven Singer, Pavel Stěhule.  
  
Based on original work by Dimitri Fontaine, though I didn't use his  
code.  
  
Discussion:  
  https://www.postgresql.org/message-id/[email protected]  
  https://www.postgresql.org/message-id/[email protected]  
  https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/aclchk.c
M src/backend/commands/event_trigger.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tsearchcmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/pseudotypes.c
M src/include/catalog/catversion.h
A src/include/catalog/opfam_internal.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_type.h
M src/include/commands/defrem.h
M src/include/commands/event_trigger.h
M src/include/commands/extension.h
M src/include/nodes/parsenodes.h
A src/include/tcop/deparse_utility.h
A src/include/utils/aclchk_internal.h
M src/include/utils/builtins.h
M src/test/modules/Makefile
A src/test/modules/test_ddl_deparse/Makefile
A src/test/modules/test_ddl_deparse/expected/alter_extension.out
A src/test/modules/test_ddl_deparse/expected/alter_function.out
A src/test/modules/test_ddl_deparse/expected/alter_sequence.out
A src/test/modules/test_ddl_deparse/expected/alter_table.out
A src/test/modules/test_ddl_deparse/expected/alter_type_enum.out
A src/test/modules/test_ddl_deparse/expected/comment_on.out
A src/test/modules/test_ddl_deparse/expected/create_conversion.out
A src/test/modules/test_ddl_deparse/expected/create_domain.out
A src/test/modules/test_ddl_deparse/expected/create_extension.out
A src/test/modules/test_ddl_deparse/expected/create_function.out
A src/test/modules/test_ddl_deparse/expected/create_operator.out
A src/test/modules/test_ddl_deparse/expected/create_rule.out
A src/test/modules/test_ddl_deparse/expected/create_schema.out
A src/test/modules/test_ddl_deparse/expected/create_sequence_1.out
A src/test/modules/test_ddl_deparse/expected/create_table.out
A src/test/modules/test_ddl_deparse/expected/create_trigger.out
A src/test/modules/test_ddl_deparse/expected/create_type.out
A src/test/modules/test_ddl_deparse/expected/create_view.out
A src/test/modules/test_ddl_deparse/expected/defprivs.out
A src/test/modules/test_ddl_deparse/expected/matviews.out
A src/test/modules/test_ddl_deparse/expected/opfamily.out
A src/test/modules/test_ddl_deparse/expected/test_ddl_deparse.out
A src/test/modules/test_ddl_deparse/regress_schedule
A src/test/modules/test_ddl_deparse/sql/alter_function.sql
A src/test/modules/test_ddl_deparse/sql/alter_sequence.sql
A src/test/modules/test_ddl_deparse/sql/alter_table.sql
A src/test/modules/test_ddl_deparse/sql/alter_type_enum.sql
A src/test/modules/test_ddl_deparse/sql/comment_on.sql
A src/test/modules/test_ddl_deparse/sql/create_conversion.sql
A src/test/modules/test_ddl_deparse/sql/create_domain.sql
A src/test/modules/test_ddl_deparse/sql/create_extension.sql
A src/test/modules/test_ddl_deparse/sql/create_rule.sql
A src/test/modules/test_ddl_deparse/sql/create_schema.sql
A src/test/modules/test_ddl_deparse/sql/create_sequence_1.sql
A src/test/modules/test_ddl_deparse/sql/create_table.sql
A src/test/modules/test_ddl_deparse/sql/create_trigger.sql
A src/test/modules/test_ddl_deparse/sql/create_type.sql
A src/test/modules/test_ddl_deparse/sql/create_view.sql
A src/test/modules/test_ddl_deparse/sql/defprivs.sql
A src/test/modules/test_ddl_deparse/sql/matviews.sql
A src/test/modules/test_ddl_deparse/sql/opfamily.sql
A src/test/modules/test_ddl_deparse/sql/test_ddl_deparse.sql
A src/test/modules/test_ddl_deparse/test_ddl_deparse–1.0.sql
A src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/modules/test_ddl_deparse/test_ddl_deparse.control

Allow LOCK TABLE .. ROW EXCLUSIVE MODE with INSERT

commit   : fa2642438f189c2b169ace3ac1df19533b9c7781    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 11 May 2015 15:44:12 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 11 May 2015 15:44:12 -0400    

Click here for diff

INSERT acquires RowExclusiveLock during normal operation and therefore  
it makes sense to allow LOCK TABLE .. ROW EXCLUSIVE MODE to be executed  
by users who have INSERT rights on a table (even if they don't have  
UPDATE or DELETE).  
  
Not back-patching this as it's a behavior change which, strictly  
speaking, loosens security restrictions.  
  
Per discussion with Tom and Robert (circa 2013).  

M doc/src/sgml/ref/lock.sgml
M src/backend/commands/lockcmds.c

pg_upgrade: use single or double-quotes in command-line strings

commit   : 9d15292cfc581d2916778b79df0f0e86e032a677    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 12:57:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 12:57:48 -0400    

Click here for diff

This is platform-dependent.  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.h

Fix incorrect checking of deferred exclusion constraint after a HOT update.

commit   : 20781765f77c1fb6465aba97d211636ce92e7a0e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 May 2015 12:25:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 May 2015 12:25:28 -0400    

Click here for diff

If a row that potentially violates a deferred exclusion constraint is  
HOT-updated later in the same transaction, the exclusion constraint would  
be reported as violated when the check finally occurs, even if the row(s)  
the new row originally conflicted with have since been removed.  This  
happened because the wrong TID was passed to check_exclusion_constraint(),  
causing the live HOT-updated row to be seen as a conflicting row rather  
than recognized as the row-under-test.  
  
Per bug #13148 from Evan Martin.  It's been broken since exclusion  
constraints were invented, so back-patch to all supported branches.  

M src/backend/commands/constraint.c
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source

Increase threshold for multixact member emergency autovac to 50%.

commit   : b4d4ce1d50bbdf82cd2e2c1c7172b936df01c01d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 11 May 2015 12:07:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 11 May 2015 12:07:13 -0400    

Click here for diff

Analysis by Noah Misch shows that the 25% threshold set by commit  
53bb309d2d5a9432d2602c93ed18e58bd2924e15 is lower than any other,  
similar autovac threshold.  While we don't know exactly what value  
will be optimal for all users, it is better to err a little on the  
high side than on the low side.  A higher value increases the risk  
that users might exhaust the available space and start seeing errors  
before autovacuum can clean things up sufficiently, but a user who  
hits that problem can compensate for it by reducing  
autovacuum_multixact_freeze_max_age to a value dependent on their  
average multixact size.  On the flip side, if the emergency cap  
imposed by that patch kicks in too early, the user will experience  
excessive wraparound scanning and will be unable to mitigate that  
problem by configuration.  The new value will hopefully reduce the  
risk of such bad experiences while still providing enough headroom  
to avoid multixact member exhaustion for most users.  
  
Along the way, adjust the documentation to reflect the effects of  
commit 04e6d3b877e060d8445eb653b7ea26b1ee5cec6b, which taught  
autovacuum to run for multixact wraparound even when autovacuum  
is configured off.  

M doc/src/sgml/maintenance.sgml
M src/backend/access/transam/multixact.c

initdb: only recommend pg_ctl to start the server

commit   : 2200713aa8bb857ae2737f659073907628c9e2ca    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 12:14:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 12:14:57 -0400    

Click here for diff

Previously we mentioned the 'postgres' binary method as well.  

M src/bin/initdb/initdb.c

docs: add "serialization anomaly" to transaction isolation table

commit   : 23c33198b961f27c80655a7cf439d49ef5a1833d    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 12:02:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 12:02:10 -0400    

Click here for diff

Also distinguish between SQL-standard and Postgres behavior.  
  
Report by David G. Johnston  

M doc/src/sgml/mvcc.sgml

pg_dump: suppress "Tablespace:" comment for default tablespaces

commit   : c71e273402bbb4262a3d09f045880d485076cd40    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 11:45:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2015 11:45:43 -0400    

Click here for diff

Report by Hans Ginzel  

M src/bin/pg_dump/pg_backup_archiver.c

Even when autovacuum=off, force it for members as we do in other cases.

commit   : 04e6d3b877e060d8445eb653b7ea26b1ee5cec6b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 11 May 2015 10:51:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 11 May 2015 10:51:14 -0400    

Click here for diff

Thomas Munro, with some adjustments by me.  

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

Advance the stop point for multixact offset creation only at checkpoint.

commit   : f6a6c46d7fd72878d37c75d4a3215d5a62128d0b    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 10 May 2015 22:21:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 10 May 2015 22:21:20 -0400    

Click here for diff

Commit b69bf30b9bfacafc733a9ba77c9587cf54d06c0c advanced the stop point  
at vacuum time, but this has subsequently been shown to be unsafe as a  
result of analysis by myself and Thomas Munro and testing by Thomas  
Munro.  The crux of the problem is that the SLRU deletion logic may  
get confused about what to remove if, at exactly the right time during  
the checkpoint process, the head of the SLRU crosses what used to be  
the tail.  
  
This patch, by me, fixes the problem by advancing the stop point only  
following a checkpoint.  This has the additional advantage of making  
the removal logic work during recovery more like the way it works during  
normal running, which is probably good.  
  
At least one of the calls to DetermineSafeOldestOffset which this patch  
removes was already dead, because MultiXactAdvanceOldest is called only  
during recovery and DetermineSafeOldestOffset was set up to do nothing  
during recovery.  That, however, is inconsistent with the principle that  
recovery and normal running should work similarly, and was confusing to  
boot.  
  
Along the way, fix some comments that previous patches in this area  
neglected to update.  It's not clear to me whether there's any  
concrete basis for the decision to use only half of the multixact ID  
space, but it's neither necessary nor sufficient to prevent multixact  
member wraparound, so the comments should not say otherwise.  

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

Fix DetermineSafeOldestOffset for the case where there are no mxacts.

commit   : 312747c224be4c0a880b5172a010e980f8b654ca    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 10 May 2015 21:34:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 10 May 2015 21:34:26 -0400    

Click here for diff

Commit b69bf30b9bfacafc733a9ba77c9587cf54d06c0c failed to take into  
account the possibility that there might be no multixacts in existence  
at all.  
  
Report by Thomas Munro; patch by me.  

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

Code review for foreign/custom join pushdown patch.

commit   : 1a8a4e5cde2b7755e11bde2ea7897bd650622d3e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 May 2015 14:36:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 May 2015 14:36:30 -0400    

Click here for diff

Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 included some design  
decisions that seem pretty questionable to me, and there was quite a lot  
of stuff not to like about the documentation and comments.  Clean up  
as follows:  
  
* Consider foreign joins only between foreign tables on the same server,  
rather than between any two foreign tables with the same underlying FDW  
handler function.  In most if not all cases, the FDW would simply have had  
to apply the same-server restriction itself (far more expensively, both for  
lack of caching and because it would be repeated for each combination of  
input sub-joins), or else risk nasty bugs.  Anyone who's really intent on  
doing something outside this restriction can always use the  
set_join_pathlist_hook.  
  
* Rename fdw_ps_tlist/custom_ps_tlist to fdw_scan_tlist/custom_scan_tlist  
to better reflect what they're for, and allow these custom scan tlists  
to be used even for base relations.  
  
* Change make_foreignscan() API to include passing the fdw_scan_tlist  
value, since the FDW is required to set that.  Backwards compatibility  
doesn't seem like an adequate reason to expect FDWs to set it in some  
ad-hoc extra step, and anyway existing FDWs can just pass NIL.  
  
* Change the API of path-generating subroutines of add_paths_to_joinrel,  
and in particular that of GetForeignJoinPaths and set_join_pathlist_hook,  
so that various less-used parameters are passed in a struct rather than  
as separate parameter-list entries.  The objective here is to reduce the  
probability that future additions to those parameter lists will result in  
source-level API breaks for users of these hooks.  It's possible that this  
is even a small win for the core code, since most CPU architectures can't  
pass more than half a dozen parameters efficiently anyway.  I kept root,  
joinrel, outerrel, innerrel, and jointype as separate parameters to reduce  
code churn in joinpath.c --- in particular, putting jointype into the  
struct would have been problematic because of the subroutines' habit of  
changing their local copies of that variable.  
  
* Avoid ad-hocery in ExecAssignScanProjectionInfo.  It was probably all  
right for it to know about IndexOnlyScan, but if the list is to grow  
we should refactor the knowledge out to the callers.  
  
* Restore nodeForeignscan.c's previous use of the relcache to avoid  
extra GetFdwRoutine lookups for base-relation scans.  
  
* Lots of cleanup of documentation and missed comments.  Re-order some  
code additions into more logical places.  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/commands/explain.c
M src/backend/executor/execScan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/foreign/foreign.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/executor.h
M src/include/foreign/fdwapi.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h

Add missing "static" marker.

commit   : c594c750789fd98a19dcdf974b87ba9833995cf5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 May 2015 23:39:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 May 2015 23:39:36 -0400    

Click here for diff

Per buildfarm member pademelon.  

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

Correct reindexdb documentation

commit   : f0a4b20bb9f91bdc0d60ff8732ee0195b0dfdd73    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 9 May 2015 14:45:54 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 9 May 2015 14:45:54 -0400    

Click here for diff

--schema takes a schema, not a table.  
  
Author: Sawada Masahiko  

M doc/src/sgml/ref/reindexdb.sgml

doc: adjust ordering of pg_stat_statement paragraphs

commit   : da31c5ed79d93bb02d6ff9cd81497e5151de7b63    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 9 May 2015 14:11:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 9 May 2015 14:11:31 -0400    

Click here for diff

Clarify installation instructions  
  
Patch by Ian Barwick  

M doc/src/sgml/pgstatstatements.sgml

Add new OID alias type regnamespace

commit   : cb9fa802b32b222b43e28866c20ebb7125779ec3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 9 May 2015 13:36:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 9 May 2015 13:36:52 -0400    

Click here for diff

Catalog version bumped  
  
Kyotaro HORIGUCHI  

M doc/src/sgml/datatype.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/catcache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_type.h
M src/include/utils/builtins.h
M src/test/regress/expected/regproc.out
M src/test/regress/sql/regproc.sql

Add new OID alias type regrole

commit   : 0c90f6769de6a60f842c916d49b404d03bcc503a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 9 May 2015 13:06:49 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 9 May 2015 13:06:49 -0400    

Click here for diff

The new type has the scope of whole the database cluster so it doesn't  
behave the same as the existing OID alias types which have database  
scope,  
concerning object dependency. To avoid confusion constants of the new  
type are prohibited from appearing where dependencies are made involving  
it.  
  
Also, add a note to the docs about possible MVCC violation and  
optimization issues, which are general over the all reg* types.  
  
Kyotaro Horiguchi  

M contrib/spi/insert_username.c
M contrib/spi/timetravel.c
M doc/src/sgml/datatype.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/init/miscinit.c
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_type.h
M src/include/foreign/foreign.h
M src/include/miscadmin.h
M src/include/utils/builtins.h
M src/test/regress/expected/regproc.out
M src/test/regress/sql/regproc.sql

Improve ParseConfigFp comment wrt head/tail

commit   : 0cf56f14dd15532fec930b502cb6457023b01ef8    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 9 May 2015 11:13:37 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 9 May 2015 11:13:37 -0400    

Click here for diff

The head_p and tail_p pointers passed to ParseConfigFp() are actually  
input/output parameters, not strictly output paramaters.  This updates  
the function comment to reflect that.  
  
Per discussion with Tom.  

M src/backend/utils/misc/guc-file.l

Change default for include_realm to 1

commit   : 9a0884176fdfa51551d6a3b26fa0e1b216c3e4c2    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:39:42 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:39:42 -0400    

Click here for diff

The default behavior for GSS and SSPI authentication methods has long  
been to strip the realm off of the principal, however, this is not a  
secure approach in multi-realm environments and the use-case for the  
parameter at all has been superseded by the regex-based mapping support  
available in pg_ident.conf.  
  
Change the default for include_realm to be '1', meaning that we do  
NOT remove the realm from the principal by default.  Any installations  
which depend on the existing behavior will need to update their  
configurations (ideally by leaving include_realm set to 1 and adding a  
mapping in pg_ident.conf, but alternatively by explicitly setting  
include_realm=0 prior to upgrading).  Note that the mapping capability  
exists in all currently supported versions of PostgreSQL and so this  
change can be done today.  Barring that, existing users can update their  
configurations today to explicitly set include_realm=0 to ensure that  
the prior behavior is maintained when they upgrade.  
  
This needs to be noted in the release notes.  
  
Per discussion with Magnus and Peter.  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/hba.c

Modify pg_stat_get_activity to build a tuplestore

commit   : f91feba8776eb66008cdb73b3a8c0c7c08cc54d9    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:25:30 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:25:30 -0400    

Click here for diff

This updates pg_stat_get_activity() to build a tuplestore for its  
results instead of using the old-style multiple-call method.  This  
simplifies the function, though that wasn't the primary motivation for  
the change, which is that we may turn it into a helper function which  
can filter the results (or not) much more easily.  

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

Bump catversion for pg_file_settings

commit   : 4b342fb591ebb556cab18fc999c8710e9733e5bb    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:14:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:14:32 -0400    

Click here for diff

Pointed out by Andres (thanks!)  
  
Apologies for not including it in the initial patch.  

M src/include/catalog/catversion.h

Add pg_file_settings view and function

commit   : a97e0c3354ace5d74c6873cd5e98444757590be8    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:09:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 19:09:26 -0400    

Click here for diff

The function and view added here provide a way to look at all settings  
in postgresql.conf, any #include'd files, and postgresql.auto.conf  
(which is what backs the ALTER SYSTEM command).  
  
The information returned includes the configuration file name, line  
number in that file, sequence number indicating when the parameter is  
loaded (useful to see if it is later masked by another definition of the  
same parameter), parameter name, and what it is set to at that point.  
This information is updated on reload of the server.  
  
This is unfiltered, privileged, information and therefore access is  
restricted to superusers through the GRANT system.  
  
Author: Sawada Masahiko, various improvements by me.  
Reviewers: David Steele  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/test/regress/expected/rules.out

Fix two problems in infer_arbiter_indexes().

commit   : bab64ef9e8bc56fa5db9bd41cefb54c3d8051dbe    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 22:22:05 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 22:22:05 +0200    

Click here for diff

The first is a pretty simple bug where a relcache entry is used after  
the relation is closed. In this particular situation it does not appear  
to have bad consequences unless compiled with RELCACHE_FORCE_RELEASE.  
  
The second is that infer_arbiter_indexes() skipped indexes that aren't  
yet valid according to indcheckxmin. That's not required here, because  
uniqueness checks don't care about visibility according to an older  
snapshot.  While thats not really a bug, it makes things undesirably  
non-deterministic.  There is some hope that this explains a test failure  
on buildfarm member jaguarundi.  
  
Discussion: [email protected]  

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

At promotion, archive last segment from old timeline with .partial suffix.

commit   : de7688442f5aaa03da60416a6aa3474738718803    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 8 May 2015 21:59:01 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 8 May 2015 21:59:01 +0300    

Click here for diff

Previously, we would archive the possible-incomplete WAL segment with its  
normal filename, but that causes trouble if the server owning that timeline  
is still running, and tries to archive the same segment later. It's not nice  
for the standby to trip up the master's archival like that. And it's pretty  
confusing, anyway, to have an incomplete segment in the archive that's  
indistinguishable from a normal, complete segment.  
  
To avoid such confusion, add a .partial suffix to the file. Or to be more  
precise, make a copy of the old segment under the .partial suffix, and  
archive that instead of the original file. pg_receivexlog also uses the  
.partial suffix for the same purpose, to tell apart incompletely streamed  
files from complete ones.  
  
There is no automatic mechanism to use the .partial files at recovery, so  
they will go unused, unless the administrator manually copies to them to  
the pg_xlog directory (and removes the .partial suffix). Recovery won't  
normally need the WAL - when recovering to the new timeline, it will find  
the same WAL on the first segment on the new timeline instead - but it  
nevertheless feels better to archive the file with the .partial suffix, for  
debugging purposes if nothing else.  

M src/backend/access/transam/xlog.c
M src/include/access/xlog_internal.h
M src/include/postmaster/pgarch.h

Add macros to check if a filename is a WAL segment or other such file.

commit   : 179cdd098196338880bdbb39c39a788abdad4dd8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 8 May 2015 21:58:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 8 May 2015 21:58:57 +0300    

Click here for diff

We had many instances of the strlen + strspn combination to check for that.  
This makes the code a bit easier to read.  

M src/backend/access/transam/xlog.c
M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/xlog_internal.h

Fix whitespace

commit   : 16c73e773bc5f2eee6a71c5ec311b8691bf9e832    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 May 2015 14:45:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 May 2015 14:45:53 -0400    

Click here for diff

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

commit   : e8898e9169c851c2b8c98f981c1c4755a5758f8e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 18:00:01 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 18:00:01 +0200    

Click here for diff

Geoff Winkless, Stephen Frost, Peter Geoghegan and me.  

M doc/src/sgml/ref/insert.sgml
M src/backend/access/heap/heapam.c
M src/backend/commands/trigger.c
M src/include/nodes/execnodes.h

Teach autovacuum about multixact member wraparound.

commit   : 53bb309d2d5a9432d2602c93ed18e58bd2924e15    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 May 2015 12:09:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 May 2015 12:09:14 -0400    

Click here for diff

The logic introduced in commit b69bf30b9bfacafc733a9ba77c9587cf54d06c0c  
and repaired in commits 669c7d20e6374850593cb430d332e11a3992bbcf and  
7be47c56af3d3013955c91c2877c08f2a0e3e6a2 helps to ensure that we don't  
overwrite old multixact member information while it is still needed,  
but a user who creates many large multixacts can still exhaust the  
member space (and thus start getting errors) while autovacuum stands  
idly by.  
  
To fix this, progressively ramp down the effective value (but not the  
actual contents) of autovacuum_multixact_freeze_max_age as member space  
utilization increases.  This makes autovacuum more aggressive and also  
reduces the threshold for a manual VACUUM to perform a full-table scan.  
  
This patch leaves unsolved the problem of ensuring that emergency  
autovacuums are triggered even when autovacuum=off.  We'll need to fix  
that via a separate patch.  
  
Thomas Munro and Robert Haas  

M doc/src/sgml/maintenance.sgml
M src/backend/access/transam/multixact.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/include/access/multixact.h

Remove reference to src/tools/backend/index.html

commit   : 195fbd40123b85ba8a44ca273b17d699e30ec6a8    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 07:14:18 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 8 May 2015 07:14:18 -0400    

Click here for diff

src/tools/backend was removed back in 63f1ccd, but  
backend/storage/lmgr/README didn't get the memo.  
  
Author: Amit Langote  

M src/backend/storage/lmgr/README

Remove dependency on ordering in logical decoding upsert test.

commit   : 581f4f9657fc3ab08199d02c0a4ea89c658882a6    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 06:06:03 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 06:06:03 +0200    

Click here for diff

Buildfarm member magpie sorted the output differently than intended by  
Peter. "Resolve" the problem by simply not aggregating, it's not that  
many lines.  

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

Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.

commit   : 168d5805e4c08bed7b95d351bf097cff7c07dd65    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 05:31:36 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 05:31:36 +0200    

Click here for diff

The newly added ON CONFLICT clause allows to specify an alternative to  
raising a unique or exclusion constraint violation error when inserting.  
ON CONFLICT refers to constraints that can either be specified using a  
inference clause (by specifying the columns of a unique constraint) or  
by naming a unique or exclusion constraint.  DO NOTHING avoids the  
constraint violation, without touching the pre-existing row.  DO UPDATE  
SET ... [WHERE ...] updates the pre-existing tuple, and has access to  
both the tuple proposed for insertion and the existing tuple; the  
optional WHERE clause can be used to prevent an update from being  
executed.  The UPDATE SET and WHERE clauses have access to the tuple  
proposed for insertion using the "magic" EXCLUDED alias, and to the  
pre-existing tuple using the table name or its alias.  
  
This feature is often referred to as upsert.  
  
This is implemented using a new infrastructure called "speculative  
insertion". It is an optimistic variant of regular insertion that first  
does a pre-check for existing tuples and then attempts an insert.  If a  
violating tuple was inserted concurrently, the speculatively inserted  
tuple is deleted and a new attempt is made.  If the pre-check finds a  
matching tuple the alternative DO NOTHING or DO UPDATE action is taken.  
If the insertion succeeds without detecting a conflict, the tuple is  
deemed inserted.  
  
To handle the possible ambiguity between the excluded alias and a table  
named excluded, and for convenience with long relation names, INSERT  
INTO now can alias its target table.  
  
Bumps catversion as stored rules change.  
  
Author: Peter Geoghegan, with significant contributions from Heikki  
    Linnakangas and Andres Freund. Testing infrastructure by Jeff Janes.  
Reviewed-By: Heikki Linnakangas, Andres Freund, Robert Haas, Simon Riggs,  
    Dean Rasheed, Stephen Frost and many others.  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/toast.sql
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/keywords.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_rule.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/trigger.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/constraint.c
M src/backend/commands/copy.c
M src/backend/commands/explain.c
M src/backend/commands/trigger.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_target.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/time/tqual.c
M src/bin/psql/common.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup_details.h
M src/include/catalog/catversion.h
M src/include/catalog/index.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/prep.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/replication/reorderbuffer.h
M src/include/rewrite/rowsecurity.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/utils/snapshot.h
A src/test/isolation/expected/insert-conflict-do-nothing.out
A src/test/isolation/expected/insert-conflict-do-update-2.out
A src/test/isolation/expected/insert-conflict-do-update-3.out
A src/test/isolation/expected/insert-conflict-do-update.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-do-nothing.spec
A src/test/isolation/specs/insert-conflict-do-update-2.spec
A src/test/isolation/specs/insert-conflict-do-update-3.spec
A src/test/isolation/specs/insert-conflict-do-update.spec
M src/test/regress/expected/errors.out
A src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/returning.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/triggers.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/input/constraints.source
M src/test/regress/output/constraints.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/returning.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/subselect.sql
M src/test/regress/sql/triggers.sql
M src/test/regress/sql/updatable_views.sql
M src/test/regress/sql/update.sql
M src/test/regress/sql/with.sql

Represent columns requiring insert and update privileges indentently.

commit   : 2c8f4836db058d0715bc30a30655d646287ba509    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 00:20:46 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 May 2015 00:20:46 +0200    

Click here for diff

Previously, relation range table entries used a single Bitmapset field  
representing which columns required either UPDATE or INSERT privileges,  
despite the fact that INSERT and UPDATE privileges are separately  
cataloged, and may be independently held.  As statements so far required  
either insert or update privileges but never both, that was  
sufficient. The required permission could be inferred from the top level  
statement run.  
  
The upcoming INSERT ... ON CONFLICT UPDATE feature needs to  
independently check for both privileges in one statement though, so that  
is not sufficient anymore.  
  
Bumps catversion as stored rules change.  
  
Author: Peter Geoghegan  
Reviewed-By: Andres Freund  

M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/dml.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepsecurity.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteHandler.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Improve BRIN infra, minmax opclass and regression test

commit   : db5f98ab4fa44bc563ec62d7b1aada4fc276d9b2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 May 2015 13:02:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 May 2015 13:02:22 -0300    

Click here for diff

The minmax opclass was using the wrong support functions when  
cross-datatypes queries were run.  Instead of trying to fix the  
pg_amproc definitions (which apparently is not possible), use the  
already correct pg_amop entries instead.  This requires jumping through  
more hoops (read: extra syscache lookups) to obtain the underlying  
functions to execute, but it is necessary for correctness.  
  
Author: Emre Hasegeli, tweaked by Álvaro  
Review: Andreas Karlsson  
  
Also change BrinOpcInfo to record each stored type's typecache entry  
instead of just the OID.  Turns out that the full type cache is  
necessary in brin_deform_tuple: the original code used the indexed  
type's byval and typlen properties to extract the stored tuple, which is  
correct in Minmax; but in other implementations that want to store  
something different, that's wrong.  The realization that this is a bug  
comes from Emre also, but I did not use his patch.  
  
I also adopted Emre's regression test code (with smallish changes),  
which is more complete.  

M contrib/pageinspect/brinfuncs.c
M doc/src/sgml/brin.sgml
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_tuple.c
M src/include/access/brin_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Fix incorrect math in DetermineSafeOldestOffset.

commit   : 7be47c56af3d3013955c91c2877c08f2a0e3e6a2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 May 2015 11:00:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 May 2015 11:00:47 -0400    

Click here for diff

The old formula didn't have enough parentheses, so it would do the wrong  
thing, and it used / rather than % to find a remainder.  The effect of  
these oversights is that the stop point chosen by the logic introduced in  
commit b69bf30b9bfacafc733a9ba77c9587cf54d06c0c might be rather  
meaningless.  
  
Thomas Munro, reviewed by Kevin Grittner, with a whitespace tweak by me.  

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

Makefile: Add comment that doc uninstall clears man directories

commit   : 82ec7c95b701d18530eb4eed923a305a0d82bdaf    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2015 10:26:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2015 10:26:08 -0400    

Click here for diff

Report by Mario Valdez  

M doc/src/sgml/Makefile

Properly send SCM status updates when shutting down service on Windows

commit   : 1a241d22ae9f170ac32937dd053676564e58fbc3    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 7 May 2015 15:04:13 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 7 May 2015 15:04:13 +0200    

Click here for diff

The Service Control Manager should be notified regularly during a shutdown  
that takes a long time. Previously we would increaes the counter, but forgot  
to actually send the notification to the system. The loop counter was also  
incorrectly initalized in the event that the startup of the system took long  
enough for it to increase, which could cause the shutdown process not to wait  
as long as expected.  
  
Krystian Bigaj, reviewed by Michael Paquier  

M src/bin/pg_ctl/pg_ctl.c

Fix indentation that could mask a future bug

commit   : d678bde655892392878fdfa8a8d4e9390227ab64    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 7 May 2015 11:41:26 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 7 May 2015 11:41:26 +0200    

Click here for diff

Michael Paquier, spotted using Coverity  

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

Fix minor resource leak in pg_dump

commit   : aa7cf3eef4aa994cca086c091782c322f7c416b2    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 7 May 2015 11:40:15 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 7 May 2015 11:40:15 +0200    

Click here for diff

Michael Paquier, spotted using Coverity  

M src/bin/pg_dump/pg_dump.c

Avoid using a C++ keyword as a structure member name.

commit   : 1998261034ec7a948bb9b25b7cb88d014d371da1    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 May 2015 22:41:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 May 2015 22:41:03 -0400    

Click here for diff

Per request from Peter Eisentraut.  

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

citext's regexp_matches() functions weren't documented, either.

commit   : 929ca96584bef1cc7d09a8e57d26d8c3f25a92a4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 May 2015 16:11:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 May 2015 16:11:01 -0400    

Click here for diff

M doc/src/sgml/citext.sgml

Fix incorrect declaration of citext's regexp_matches() functions.

commit   : b22527f29dba6395a9e950fc655d34914c960f89    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 May 2015 15:50:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 May 2015 15:50:53 -0400    

Click here for diff

These functions should return SETOF TEXT[], like the core functions they  
are wrappers for; but they were incorrectly declared as returning just  
TEXT[].  This mistake had two results: first, if there was no match you got  
a scalar null result, whereas what you should get is an empty set (zero  
rows).  Second, the 'g' flag was effectively ignored, since you would get  
only one result array even if there were multiple matches, as reported by  
Jeff Certain.  
  
While ignoring 'g' is a clear bug, the behavior for no matches might well  
have been thought to be the intended behavior by people who hadn't compared  
it carefully to the core regexp_matches() functions.  So we should tread  
carefully about introducing this change in the back branches.  Still, it  
clearly is a bug and so providing some fix is desirable.  
  
After discussion, the conclusion was to introduce the change in a 1.1  
version of the citext extension (as we would need to do anyway); 1.0 still  
contains the incorrect behavior.  1.1 is the default and only available  
version in HEAD, but it is optional in the back branches, where 1.0 remains  
the default version.  People wishing to adopt the fix in back branches will  
need to explicitly do ALTER EXTENSION citext UPDATE TO '1.1'.  (I also  
provided a downgrade script in the back branches, so people could go back  
to 1.0 if necessary.)  
  
This should be called out as an incompatible change in the 9.5 release  
notes, although we'll also document it in the next set of back-branch  
release notes.  The notes should mention that any views or rules that use  
citext's regexp_matches() functions will need to be dropped before  
upgrading to 1.1, and then recreated again afterwards.  
  
Back-patch to 9.1.  The bug goes all the way back to citext's introduction  
in 8.4, but pre-9.1 there is no extension mechanism with which to manage  
the change.  Given the lack of previous complaints it seems unnecessary to  
change this behavior in 9.0, anyway.  

M contrib/citext/Makefile
A contrib/citext/citext–1.0–1.1.sql
R097 contrib/citext/citext–1.0.sql contrib/citext/citext–1.1.sql
M contrib/citext/citext.control
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql

doc: Update installation instructions for new shared libperl/libpython handling

commit   : 53f09657676782d5f6ccf563907fde48a6bea13c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 May 2015 14:41:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 May 2015 14:41:39 -0400    

Click here for diff

M doc/src/sgml/installation.sgml

Add geometry/range functions to support BRIN inclusion

commit   : 3b6db1f445e14bd189ebc99ce1e5535a1c624613    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 May 2015 15:22:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 May 2015 15:22:24 -0300    

Click here for diff

This commit adds the following functions:  
    box(point) -> box  
    bound_box(box, box) -> box  
    inet_same_family(inet, inet) -> bool  
    inet_merge(inet, inet) -> cidr  
    range_merge(anyrange, anyrange) -> anyrange  
  
The first of these is also used to implement a new assignment cast from  
point to box.  
  
These functions are the first part of a base to implement an "inclusion"  
operator class for BRIN, for multidimensional data types.  
  
Author: Emre Hasegeli  
Reviewed by: Andreas Karlsson  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/rangetypes.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/include/utils/geo_decls.h
M src/include/utils/rangetypes.h
M src/test/regress/expected/geometry.out
M src/test/regress/expected/geometry_1.out
M src/test/regress/expected/geometry_2.out
M src/test/regress/expected/inet.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/geometry.sql
M src/test/regress/sql/inet.sql
M src/test/regress/sql/rangetypes.sql

Fix some problems with patch to fsync the data directory.

commit   : 456ff0863851d70dce679ca3f631392589e31a33    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 May 2015 08:30:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 May 2015 08:30:28 -0400    

Click here for diff

pg_win32_is_junction() was a typo for pgwin32_is_junction().  open()  
was used not only in a two-argument form, which breaks on Windows,  
but also where BasicOpenFile() should have been used.  
  
Per reports from Andrew Dunstan and David Rowley.  

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

hstore_plpython: Support tests on Python 2.3

commit   : c0574cd5aa96b988bb1f0287914dcc8b52fb01bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 May 2015 22:30:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 May 2015 22:30:21 -0400    

Click here for diff

Python 2.3 does not have the sorted() function, so do it the long way.  

M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql

Fix typos

commit   : ad8d6d064cbcc165e3033a6ed56818f711b0ffae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 May 2015 20:40:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 May 2015 20:40:19 -0400    

Click here for diff

Author: Erik Rijkers <[email protected]>  

M doc/src/sgml/func.sgml
M src/backend/replication/logical/origin.c

Use outerPlanState macro instead of referring to leffttree.

commit   : 40f42d2a34329b0b71a1287d6fd2554298dbb713    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 May 2015 16:13:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 May 2015 16:13:07 -0400    

Click here for diff

This makes the executor code more consistent.  It also removes  
an apparently superfluous NULL test in nodeGroup.c.  
  
Qingqing Zhou, reviewed by Tom Lane, and further revised by me.  

M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeWindowAgg.c

Improve procost estimates for some text search functions.

commit   : 2503982be4ca48f48d2bb6e1d46160b23e4bb268    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 May 2015 15:38:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 May 2015 15:38:57 -0400    

Click here for diff

The text search functions that involve parsing raw text into lexemes are  
remarkably CPU-intensive, so estimating them at the same cost as most other  
built-in functions seems like a mistake; moreover, doing so turns out to  
discourage the optimizer from using functional indexes on these functions.  
After some debate, we've agreed to raise procost from 1 to 100 for  
to_tsvector(), plainto_tsvector(), to_tsquery(), ts_headline(),  
ts_match_tt(), and ts_match_tq(), which are all the text search functions  
that parse raw text.  
  
Also increase procost for the 2-argument form of ts_rewrite()  
(tsquery_rewrite_query); while this function doesn't do text parsing,  
it does execute a user-supplied SQL query, so its previous procost of 1 is  
clearly a drastic underestimate.  It seems reasonable to assign it the same  
cost we assign to PL functions by default, so 100 is the number here too.  
  
I did not bother bumping catversion for this change, since it does not  
break catalog compatibility with the server executable nor result in  
any regression test changes.  
  
Per complaint from Andrew Gierth and subsequent discussion.  

M src/include/catalog/pg_proc.h

Recursively fsync() the data directory after a crash.

commit   : 2ce439f3379aed857517c8ce207485655000fc8e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 May 2015 14:13:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 May 2015 14:13:53 -0400    

Click here for diff

Otherwise, if there's another crash, some writes from after the first  
crash might make it to disk while writes from before the crash fail  
to make it to disk.  This could lead to data corruption.  
  
Back-patch to all supported versions.  
  
Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised  
by me.  

M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/include/storage/fd.h

Fix the same-rel optimization when creating WAL records.

commit   : ec3d976bce7e322c29f1007d19b63b7a3a1a6ee4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 May 2015 20:58:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 May 2015 20:58:42 +0300    

Click here for diff

prev_regbuf was never set, and therefore the same-rel flag was never set on  
WAL records.  
  
Report and fix by Zhanq Zq  

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

Fix two small bugs in json's populate_record_worker

commit   : 3c000fd9a68dae9ebd9d1507ab3995cc178de1e5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 4 May 2015 12:38:58 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 4 May 2015 12:38:58 -0400    

Click here for diff

The first bug is not releasing a tupdesc when doing an early return out  
of the function. The second bug is a logic error in choosing when to do  
an early return if given an empty jsonb object.  
  
Bug reports from Pavel Stehule and Tom Lane respectively.  
  
Backpatch to 9.4 where these were introduced.  

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

Second try at fixing warnings caused by commit 9b43d73b3f9bef27.

commit   : c90b85e4d9e4ae3bc26459cc54697e1adaa4315f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 May 2015 23:44:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 May 2015 23:44:52 -0400    

Click here for diff

Commit ef3f9e642d2b2bba suppressed one cause of warnings here, but  
recent clang on OS X is still unhappy because we're passing a "long"  
to abs().  The fact that tm_gmtoff is declared as long is no doubt a  
hangover from days when int might be only 16 bits; but Postgres has  
never been able to run on such machines, so we can just cast it to int  
with no worries.  For consistency, also cast to int in the other  
uses of tm_gmtoff in this stanza.  
  
Note: this code is still broken on machines that don't follow C99  
integer-division-truncates-towards-zero rules.  Given the lack of  
complaints about it, I don't feel a large desire to complicate things  
enough to cope with the pre-C99 rules.  

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

Fix overlooked relcache invalidation in ALTER TABLE ... ALTER CONSTRAINT.

commit   : a4820434c1a62e0c5f4051a31ad8b4a11f0a6ad7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 May 2015 11:30:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 May 2015 11:30:24 -0400    

Click here for diff

When altering the deferredness state of a foreign key constraint, we  
correctly updated the catalogs and then invalidated the relcache state for  
the target relation ... but that's not the only relation with relevant  
triggers.  Must invalidate the other table as well, or the state change  
fails to take effect promptly for operations triggered on the other table.  
Per bug #13224 from Christian Ullrich.  
  
In passing, reorganize regression test case for this feature so that it  
isn't randomly injected into the middle of an unrelated test sequence.  
  
Oversight in commit f177cbfe676dc2c7ca2b206c54d6bf819feeea8b.  Back-patch  
to 9.4 where the faulty code was added.  

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

fix escaping of brackets for m4 broken in b6b2149e48aa61981ae0199c963d5145a37c258c

commit   : f707b53449f3ab6998c615b746ad01f5775723a3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 May 2015 09:37:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 May 2015 09:37:15 -0400    

Click here for diff

M config/python.m4
M configure

Enable transforms modules to build and run with Mingw builds.

commit   : f802c6ddba143bd88512b5fc34e84ae0b4883284    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 May 2015 09:10:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 May 2015 09:10:47 -0400    

Click here for diff

These modules were all missing essential Windows scaffolding, including  
resources files and descriptions, and links to the relevant library  
import files. This latter item means that the modules can't be built  
with pgxs on Windows, as we don't install the import files. If we ever  
decide to install them this restriction could probably be removed.  
  
Also, as with plperl we need to make sure that perl's CORE directory is  
last on the include list, as on Windows it appears to contain some  
headers with names that clash with names of some headers we include.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/ltree_plpython/Makefile

Fix python_includespec on Windows at configure time

commit   : b6b2149e48aa61981ae0199c963d5145a37c258c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 May 2015 08:17:04 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 May 2015 08:17:04 -0400    

Click here for diff

By converting to using forward slashes at configure time we avoid  
having to repeat the logic anywhere that this is needed, such as  
in transforms modules for plpython.  

M config/python.m4
M configure
M src/pl/plpython/Makefile

Combine initdb tests that successfully create a data directory.

commit   : 1a629c1b161a2b43a2f81241a8f4c5f79e5b8ecf    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 May 2015 16:47:28 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 May 2015 16:47:28 -0400    

Click here for diff

This eliminates many seconds of test duration and the cause to invoke  
"rm -rf", which is typically unavailable on Windows.  
  
Michael Paquier and Noah Misch  

M src/bin/initdb/t/001_initdb.pl

Fix one more TAP test to use standard command-line argument ordering.

commit   : 84c08a7649b8c6dd488dfe0e37ab017e8059cd33    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 May 2015 16:46:52 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 May 2015 16:46:52 -0400    

Click here for diff

Commit c67a86f7da90c30b81f91957023fb752f06f0598 caught most of these,  
but this negative test escaped notice.  The test did pass, for the wrong  
reason, under affected configurations.  
  
Michael Paquier  

M src/bin/initdb/t/001_initdb.pl

Rename coerce_type() local variable.

commit   : b339a5cf900bb3e72f58a7a96903e3a0d557a85a    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 May 2015 16:46:23 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 May 2015 16:46:23 -0400    

Click here for diff

coerce_type() has local variables named targetTypeId, baseTypeId, and  
targetType.  targetType has been the Type structure for baseTypeId, so  
rename it to baseType.  

M src/backend/parser/parse_coerce.c

Windows also needs an override of the shared libpython detection

commit   : 67df9782e94765a281a82a7672d39ebb4bf58828    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 May 2015 13:23:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 May 2015 13:23:16 -0400    

Click here for diff

M configure
M configure.in
M src/pl/plpython/Makefile

hstore_plperl: Move port-specific parts to later in the makefile

commit   : e30a864963c5f98bafeaf3005f258ff90916da7c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 May 2015 08:03:47 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 May 2015 08:03:47 -0400    

Click here for diff

PORTNAME isn't set until the global makefiles have been included.  

M contrib/hstore_plperl/Makefile

Fix shared libpython detection on OS X

commit   : 010aa420b9dd5393490c8793f43949dca269a753    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2015 23:12:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2015 23:12:45 -0400    

Click here for diff

Apparently, looking for an appropriately named file doesn't work on some  
older versions, so put the back the explicit platform detection.  

M configure
M configure.in

Make hstore_plperl's build even more like plperl's

commit   : 0fd764647a9910a340359bb319929b70317b2ae4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2015 22:16:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2015 22:16:58 -0400    

Click here for diff

Combine the two places that set CPPFLAGS into one.  Also, some settings  
should be restricted to Windows only.  More precisely, -Wno-comment is  
a GCC-only option, but Windows in a makefile implies GCC at the moment.  
  
Also, since -Wno-comment is more properly a preprocessor option, move it  
to CPPFLAGS to simplify things a bit.  

M contrib/hstore_plperl/Makefile
M src/pl/plperl/GNUmakefile

Move interpreter shared library detection to configure

commit   : d664a10f9623fd2198b257e513bce849d439a773    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2015 21:38:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2015 21:38:21 -0400    

Click here for diff

For building PL/Perl, PL/Python, and PL/Tcl, we need a shared library of  
libperl, libpython, and libtcl, respectively.  Previously, this was  
checked in the makefiles, skipping the PL build with a warning if no  
shared library was available.  Now this is checked in configure, with an  
error if no shared library is available.  
  
The previous situation arose because in the olden days, the configure  
options --with-perl, --with-python, and --with-tcl controlled whether  
frontend interfaces for those languages would be built.  The procedural  
languages were added later, and shared libraries were often not  
available in the beginning.  So it was decided skip the builds of the  
procedural languages in those cases.  The frontend interfaces have since  
been removed from the tree, and shared libraries are now available most  
of the time, so that setup makes much less sense now.  
  
Also, the new setup allows contrib modules and pgxs users to rely on the  
respective PLs being available based on configure flags.  

M config/python.m4
M configure
M configure.in
M src/Makefile.global.in
M src/pl/plperl/GNUmakefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile

Make hstore_plperl's build more like plperl's

commit   : 77477e745be534c5925cf7cb8b9c6a7698c575a3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 1 May 2015 15:36:44 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 1 May 2015 15:36:44 -0400    

Click here for diff

This involves moving perl's CORE library to the end of the include list,  
and adding other compilation settings that plperl uses. This won't  
completely fix the breakage currently being seen by gcc builds on  
Windows, but it will let the build get further, and should be wholly  
benign, if not beneficial, on *nix.  

M contrib/hstore_plperl/Makefile

Mark views created from tables as replication identity 'nothing'

commit   : b2f95c34f4e6ab1585af6f10d9d1351978ef15f7    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 1 May 2015 13:03:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 1 May 2015 13:03:23 -0400    

Click here for diff

pg_dump turns tables into views using a method that was not setting  
pg_class.relreplident properly.  
  
Patch by Marko Tiikkaja  
  
Backpatch through 9.4  

M src/backend/rewrite/rewriteDefine.c

Deparse named arguments to use the new => operator instead of :=

commit   : e044a44949c5b9c9f548e8a1cd4bf0b50fb2a1cc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 May 2015 09:37:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 May 2015 09:37:10 -0400    

Click here for diff

Tom Lane pointed out that this wasn't done, and asked whether that was  
intentional.  Subsequent discussion was in favor of making the change,  
so here we go.  

M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/polymorphism.out

Allow FDWs and custom scan providers to replace joins with scans.

commit   : e7cb7ee14555cc9c5773e2c102efd6371f6f2005    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 May 2015 08:50:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 May 2015 08:50:35 -0400    

Click here for diff

Foreign data wrappers can use this capability for so-called "join  
pushdown"; that is, instead of executing two separate foreign scans  
and then joining the results locally, they can generate a path which  
performs the join on the remote server and then is scanned locally.  
This commit does not extend postgres_fdw to take advantage of this  
capability; it just provides the infrastructure.  
  
Custom scan providers can use this in a similar way.  Previously,  
it was only possible for a custom scan provider to scan a single  
relation.  Now, it can scan an entire join tree, provided of course  
that it knows how to produce the same results that the join would  
have produced if executed normally.  
  
KaiGai Kohei, reviewed by Shigeru Hanada, Ashutosh Bapat, and me.  

M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/fdwhandler.sgml
M src/backend/commands/explain.c
M src/backend/executor/execScan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/foreign/foreign.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/adt/ruleutils.c
M src/include/foreign/fdwapi.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h

Copy editing of the replication origins patch.

commit   : 2b22795b32576fa7173b501b646581a17de35902    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 May 2015 12:22:13 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 May 2015 12:22:13 +0200    

Click here for diff

Michael Paquier and myself.  

M doc/src/sgml/func.sgml
M doc/src/sgml/replication-origins.sgml
M src/backend/replication/logical/origin.c
M src/include/catalog/pg_replication_origin.h

Fix unaligned memory access in xlog parsing due to replication origin patch.

commit   : 1db12da85bee7a01abfbbf2798904347e4d9515a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 May 2015 11:36:14 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 May 2015 11:36:14 +0200    

Click here for diff

ParseCommitRecord() accessed xl_xact_origin directly. But the chunks in  
the commit record's data only have 4 byte alignment, whereas  
xl_xact_origin's members require 8 byte alignment on some  
platforms. Update comments to make not of that and copy the record to  
stack local storage before reading.  
  
With help from Stefan Kaltenbrunner in pinning down the buildfarm and  
verifying the fix.  

M src/backend/access/rmgrdesc/xactdesc.c
M src/include/access/xact.h

Fix pg_rewind regression failure after "fast promotion"

commit   : 484a848a73fc5a76c16bc73626b290154b6a57b4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Apr 2015 21:57:18 -0700    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Apr 2015 21:57:18 -0700    

Click here for diff

pg_rewind looks at the control file to determine the server's timeline. If  
the standby performs a "fast promotion", the timeline ID in the control  
file is not updated until the next checkpoint. The startup process requests  
a checkpoint immediately after promotion, so this is unlikely to be an  
issue in the real world, but the regression suite ran pg_rewind so quickly  
after promotion that the checkpoint had not yet completed.  
  
Reported by Stephen Frost  

M src/bin/pg_rewind/RewindTest.pm

Fix up some loose ends for CURRENT_USER as RoleSpec

commit   : 9d396af46357df1243aff4a9ca4f4987e4fe6024    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Apr 2015 16:57:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Apr 2015 16:57:05 -0300    

Click here for diff

In commit 31eae6028eca4, some documents were not updated to show the new  
capability; fix that.  Also, the error message you get when CURRENT_USER  
and SESSION_USER are used in a context that doesn't accept them could be  
clearer about it being a problem only in those contexts; so add the  
word "here".  
  
Author: Kyotaro HORIGUCHI  
  
His patch submission also included changes to GRANT/REVOKE, but those  
seemed more controversial, so I left them out.  We can reconsider these  
changes later.  

M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/reassign_owned.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/rolenames.out

Create an infrastructure for parallel computation in PostgreSQL.

commit   : 924bcf4f16d54c55310b28f77686608684734f42    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Apr 2015 15:02:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Apr 2015 15:02:14 -0400    

Click here for diff

This does four basic things.  First, it provides convenience routines  
to coordinate the startup and shutdown of parallel workers.  Second,  
it synchronizes various pieces of state (e.g. GUCs, combo CID  
mappings, transaction snapshot) from the parallel group leader to the  
worker processes.  Third, it prohibits various operations that would  
result in unsafe changes to that state while parallelism is active.  
Finally, it propagates events that would result in an ErrorResponse,  
NoticeResponse, or NotifyResponse message being sent to the client  
from the parallel workers back to the master, from which they can then  
be sent on to the client.  
  
Robert Haas, Amit Kapila, Noah Misch, Rushabh Lathia, Jeevan Chalke.  
Suggestions and review from Andres Freund, Heikki Linnakangas, Noah  
Misch, Simon Riggs, Euler Taveira, and Jim Nasby.  

M contrib/postgres_fdw/connection.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/Makefile
A src/backend/access/transam/README.parallel
A src/backend/access/transam/parallel.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/catalog/namespace.c
M src/backend/commands/copy.c
M src/backend/commands/sequence.c
M src/backend/executor/execMain.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/libpq/pqmq.c
M src/backend/postmaster/bgworker.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/lmgr/predicate.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
A src/include/access/parallel.h
M src/include/access/xact.h
M src/include/catalog/namespace.h
M src/include/fmgr.h
M src/include/libpq/pqmq.h
M src/include/miscadmin.h
M src/include/postmaster/bgworker.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/utils/combocid.h
M src/include/utils/snapmgr.h

Fix pg_upgrade's multixact handling (again)

commit   : 669c7d20e6374850593cb430d332e11a3992bbcf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Apr 2015 13:55:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Apr 2015 13:55:06 -0300    

Click here for diff

We need to create the pg_multixact/offsets file deleted by pg_upgrade  
much earlier than we originally were: it was in TrimMultiXact(), which  
runs after we exit recovery, but it actually needs to run earlier than  
the first call to SetMultiXactIdLimit (before recovery), because that  
routine already wants to read the first offset segment.  
  
Per pg_upgrade trouble report from Jeff Janes.  
  
While at it, silence a compiler warning about a pointless assert that an  
unsigned variable was being tested non-negative.  This was a signed  
constant in Thomas Munro's patch which I changed to unsigned before  
commit.  Pointed out by Andres Freund.  

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

Fix typo

commit   : da114099afd47b95831514d3a8785c7726eefe03    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 30 Apr 2015 09:52:34 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 30 Apr 2015 09:52:34 +0200    

Click here for diff

Amit Langote  

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

Fix parallel make risk with new check temp-install setup

commit   : dbf2ec1a1c053379e2f9a5913979a1ca4dccbd43    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Apr 2015 20:34:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Apr 2015 20:34:22 -0400    

Click here for diff

The "check" target no longer needs to depend on "all", because it now  
runs "install" directly, which in turn depends on "all".  Doing both  
will cause problems with parallel make, because two builds will run next  
to each other.  
  
Also remove the redirection of the temp-install output into a log file.  
This was appropriate when this was done from within pg_regress, but now  
it's just a regular make run, and especially with the above changes this  
will now take the place of running the "all" target before the test  
suites.  
  
problem report by Jeff Janes, patch in part by Michael Paquier  

M GNUmakefile.in
M contrib/test_decoding/Makefile
M src/Makefile.global.in
M src/bin/initdb/Makefile
M src/bin/pg_basebackup/Makefile
M src/bin/pg_config/Makefile
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/scripts/Makefile
M src/interfaces/ecpg/Makefile
M src/makefiles/pgxs.mk
M src/pl/plperl/GNUmakefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile

Correct replication origin's use of UINT16_MAX to PG_UINT16_MAX.

commit   : e0f26fc76532defd06caf79d711fa99cea83c532    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Apr 2015 00:19:36 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Apr 2015 00:19:36 +0200    

Click here for diff

We can't rely on UINT16_MAX being present, which is why we introduced  
PG_UINT16_MAX...  
  
Buildfarm animal bowerbird via Andrew Gierth.  

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

Add <literal> markup, for consistency.

commit   : 49601ab1a6df9059f7000f78af43f2e74afefa59    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 18:03:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 18:03:18 -0400    

Click here for diff

This file isn't entirely consistent about whether "on" and "off"  
should be marked up with <literal>, but it doesn't make much sense  
to be inconsistent within a single sentence.  
  
Etsuro Fujita  

M doc/src/sgml/config.sgml

Update .gitignore for new rmgr, changed paths.

commit   : fe72c4c55bd65772aa5a4130309150ffca1749ab    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 15:53:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 15:53:00 -0400    

Click here for diff

M src/bin/pg_xlogdump/.gitignore

commit   : 9b6a0ce5f060315f900de7b398d5197a2e42f2f2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 15:48:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 15:48:44 -0400    

Click here for diff

When this code was written, catalog scans were normally performed using  
SnapshotNow, making special handling necessary here.  Now, however, all  
catalog scans use MVCC snapshots, so we can change these cases to look  
more like what we do for catalog scans elsewhere in the code.  
  
Per discussion with Tom Lane and a reminder from Bruce Momjian.  

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

Attempt to fix some compiler warnings.

commit   : ef3f9e642d2b2bba8933b4cff4039ce0d354ce08    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 14:02:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 14:02:01 -0400    

Click here for diff

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

Enable transforms tests for python 2 on MSVC builds

commit   : eb010637dd47be65e5d8b22d6965c2e96f6937b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 29 Apr 2015 13:49:24 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 29 Apr 2015 13:49:24 -0400    

Click here for diff

Currently regression tests for python 3 are disabled on MSVC, and these  
tests fail with python 3, too, so we have some work to do to enable  
both. Meanwhile, all the buildfarm hosts seem to be building with python  
2 anyway, so this at least gets us some coverage.  
  
Original patch from Michael Paquier, significantly modified by me.  

M src/tools/msvc/vcregress.pl

Introduce replication progress tracking infrastructure.

commit   : 5aa2350426c4fdb3d04568b65aadac397012bbcb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Apr 2015 19:30:53 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Apr 2015 19:30:53 +0200    

Click here for diff

When implementing a replication solution ontop of logical decoding, two  
related problems exist:  
* How to safely keep track of replication progress  
* How to change replication behavior, based on the origin of a row;  
  e.g. to avoid loops in bi-directional replication setups  
  
The solution to these problems, as implemented here, consist out of  
three parts:  
  
1) 'replication origins', which identify nodes in a replication setup.  
2) 'replication progress tracking', which remembers, for each  
   replication origin, how far replay has progressed in a efficient and  
   crash safe manner.  
3) The ability to filter out changes performed on the behest of a  
   replication origin during logical decoding; this allows complex  
   replication topologies. E.g. by filtering all replayed changes out.  
  
Most of this could also be implemented in "userspace", e.g. by inserting  
additional rows contain origin information, but that ends up being much  
less efficient and more complicated.  We don't want to require various  
replication solutions to reimplement logic for this independently. The  
infrastructure is intended to be generic enough to be reusable.  
  
This infrastructure also replaces the 'nodeid' infrastructure of commit  
timestamps. It is intended to provide all the former capabilities,  
except that there's only 2^16 different origins; but now they integrate  
with logical decoding. Additionally more functionality is accessible via  
SQL.  Since the commit timestamp infrastructure has also been introduced  
in 9.5 (commit 73c986add) changing the API is not a problem.  
  
For now the number of origins for which the replication progress can be  
tracked simultaneously is determined by the max_replication_slots  
GUC. That GUC is not a perfect match to configure this, but there  
doesn't seem to be sufficient reason to introduce a separate new one.  
  
Bumps both catversion and wal page magic.  
  
Author: Andres Freund, with contributions from Petr Jelinek and Craig Ringer  
Reviewed-By: Heikki Linnakangas, Petr Jelinek, Robert Haas, Steve Singer  
Discussion: [email protected],  
    [email protected],  
    [email protected]  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/replorigin.out
A contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/postgres.sgml
A doc/src/sgml/replication-origins.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/Makefile
A src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/Makefile
M src/backend/catalog/catalog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
A src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/commit_ts.h
M src/include/access/rmgrlist.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/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_proc.h
A src/include/catalog/pg_replication_origin.h
M src/include/replication/logical.h
A src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/storage/lwlock.h
M src/include/utils/syscache.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out

psql: Improve tab completion for ALTER FOREIGN TABLE.

commit   : c6e96a2f986e4dad72c14b14d4cc17d02b2a6aad    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 12:49:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Apr 2015 12:49:10 -0400    

Click here for diff

Etsuro Fujita  

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

to_char(): have format 'OF' only show the leading negative sign

commit   : 9b43d73b3f9bef276a46660920a01f0421c4323a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 21:02:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 21:02:57 -0400    

Click here for diff

Previously both hours and minutes displayed as negative.  
  
Report by David Pozsar  

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

doc: recommend use of GUC server_version_num for version checks

commit   : 5086dfceba79ecd5d1eb28b8f4ed5221838ff3a6    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 20:31:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 20:31:08 -0400    

Click here for diff

Patch by Craig Ringer  

M doc/src/sgml/func.sgml

pg_basebackup: canonicalize old and new tablespace paths

commit   : f19d8f14c776b0fa144227ecb2fc17e868a2cc5c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 20:12:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 20:12:10 -0400    

Click here for diff

This avoids problems with double-slash-specified paths.  
  
Patch by Ian Barwick  

M src/bin/pg_basebackup/pg_basebackup.c

Warn about tablespace creation in PGDATA

commit   : 33cb8ff6aa1159f0a359691ca563c98b85d3d723    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 17:35:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Apr 2015 17:35:12 -0400    

Click here for diff

Also add warning to pg_upgrade  
  
Report by Josh Berkus  

M src/backend/commands/tablespace.c
M src/bin/pg_upgrade/check.c

Fix another test for RELKIND_RELATION that should allow foreign tables now.

commit   : 290713e31a1ee04eed7877985a4c28a30fd0d1db    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Apr 2015 12:34:35 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Apr 2015 12:34:35 -0700    

Click here for diff

I thought I'd gone through all of these before, but a fresh review found  
this one too.  (Perhaps it would be better to just delete this test and  
let the failure occur later, but for the moment I'll preserve the logic.)  
  
The case that this was rejecting is like  
	CREATE FOREIGN TABLE ft (f1 int ...) ...;  
	CREATE TABLE c1 (UNIQUE(f1)) INHERITS(ft);  

M src/backend/parser/parse_utilcmd.c

Fix ATSimpleRecursion() to allow recursion from a foreign table.

commit   : ad9f08f70636051b5d5fe8d57062994b7335a960    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Apr 2015 12:25:00 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Apr 2015 12:25:00 -0700    

Click here for diff

This is necessary in view of the changes to allow foreign tables to be  
full members of inheritance hierarchies, but I (tgl) unaccountably missed  
it in commit cb1ca4d800621dcae67ca6c799006de99fa4f0a5.  
  
Noted by Amit Langote, patch by Etsuro Fujita  

M src/backend/commands/tablecmds.c

Code review for multixact bugfix

commit   : d3821e70c9b6d76083f4eb0f4cc25716e961c89d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 Apr 2015 14:52:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 Apr 2015 14:52:29 -0300    

Click here for diff

Reword messages, rename a confusingly named function.  
  
Per Robert Haas.  

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

Fix MSVC builds for contrib transforms modules.

commit   : cbf9f0ec312e54481e777ffbe941b548d909081e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Apr 2015 11:47:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Apr 2015 11:47:08 -0400    

Click here for diff

With this patch the MSVC build and installation will work correctly with  
the transforms. However the python transform tests for hstore and ltree  
are still disabled pending some further adjustments.  
  
Michael Paquier with some tweaks from me.  

M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/vcregress.pl

Protect against multixact members wraparound

commit   : b69bf30b9bfacafc733a9ba77c9587cf54d06c0c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 Apr 2015 11:32:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 Apr 2015 11:32:53 -0300    

Click here for diff

Multixact member files are subject to early wraparound overflow and  
removal: if the average multixact size is above a certain threshold (see  
note below) the protections against offset overflow are not enough:  
during multixact truncation at checkpoint time, some  
pg_multixact/members files would be removed because the server considers  
them to be old and not needed anymore.  This leads to loss of files that  
are critical to interpret existing tuples's Xmax values.  
  
To protect against this, since we don't have enough info in pg_control  
and we can't modify it in old branches, we maintain shared memory state  
about the oldest value that we need to keep; we use this during new  
multixact creation to abort if an old still-needed file would get  
overwritten.  This value is kept up to date by checkpoints, which makes  
it not completely accurate but should be good enough.  We start emitting  
warnings sometime earlier, so that the eventual multixact-shutdown  
doesn't take DBAs completely by surprise (more precisely: once 20  
members SLRU segments are remaining before shutdown.)  
  
On troublesome average multixact size: The threshold size depends on the  
multixact freeze parameters. The oldest age is related to the greater of  
multixact_freeze_table_age and multixact_freeze_min_age: anything  
older than that should be removed promptly by autovacuum.  If autovacuum  
is keeping up with multixact freezing, the troublesome multixact average  
size is  
	(2^32-1) / Max(freeze table age, freeze min age)  
or around 28 members per multixact.  Having an average multixact size  
larger than that will eventually cause new multixact data to overwrite  
the data area for older multixacts.  (If autovacuum is not able to keep  
up, or there are errors in vacuuming, the actual maximum is  
multixact_freeeze_max_age instead, at which point multixact generation  
is stopped completely.  The default value for this limit is 400 million,  
which means that the multixact size that would cause trouble is about 10  
members).  
  
Initial bug report by Timothy Garnett, bug #12990  
Backpatch to 9.3, where the problem was introduced.  
  
Authors: Álvaro Herrera, Thomas Munro  
Reviews: Thomas Munro, Amit Kapila, Robert Haas, Kevin Grittner  

M src/backend/access/transam/multixact.c
M src/backend/bootstrap/bootstrap.c

Use a fd opened for read/write when syncing slots during startup.

commit   : dfbaed459754e71e01bb0cc90a12802bba3f9786    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 28 Apr 2015 00:12:38 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 28 Apr 2015 00:12:38 +0200    

Click here for diff

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 I have no way of verifying the  
fix, but we've seen similar problems in the past.  
  
This bug goes back to 9.4 where slots were introduced. Backpatch  
accordingly.  
  
Reported-By: Patrice Drolet  
Bug: #13143:  
Discussion: [email protected]  

M src/backend/replication/slot.c

Improve qual pushdown for RLS and SB views

commit   : dcbf5948e12aa60b4d6ab65b6445897dfc971e01    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 27 Apr 2015 12:29:42 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 27 Apr 2015 12:29:42 -0400    

Click here for diff

The original security barrier view implementation, on which RLS is  
built, prevented all non-leakproof functions from being pushed down to  
below the view, even when the function was not receiving any data from  
the view.  This optimization improves on that situation by, instead of  
checking strictly for non-leakproof functions, it checks for Vars being  
passed to non-leakproof functions and allows functions which do not  
accept arguments or whose arguments are not from the current query level  
(eg: constants can be particularly useful) to be pushed down.  
  
As discussed, this does mean that a function which is pushed down might  
gain some idea that there are rows meeting a certain criteria based on  
the number of times the function is called, but this isn't a  
particularly new issue and the documentation in rules.sgml already  
addressed similar covert-channel risks.  That documentation is updated  
to reflect that non-leakproof functions may be pushed down now, if  
they meet the above-described criteria.  
  
Author: Dean Rasheed, with a bit of rework to make things clearer,  
along with comment and documentation updates from me.  

M doc/src/sgml/rules.sgml
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/clauses.c
M src/include/optimizer/clauses.h
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/select_views.out
M src/test/regress/expected/select_views_1.out
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/select_views.sql

Fix vcbuild failures and chkpass dependency caused by 854adb8

commit   : 06ca28d5ab2f810ef25e718e0d71f2233542c151    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 27 Apr 2015 10:50:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 27 Apr 2015 10:50:46 -0400    

Click here for diff

Switching the Windows build scripts to use forward slashes instead of  
backslashes has caused a couple of issues in VC builds:  
- The file tree list was not correctly generated, build script  
  generating vcproj file missing tree dependencies when listing items in  
  Filter.  
- VC builds do not accept file paths with forward slashes, perhaps it  
  could be possible to use a Condition but it seems safer to simply  
  enforce the file paths to use backslashes in the vcproj files.  
- chkpass had an unneeded dependency with libpgport and libpgcommon to  
  make build succeed but actually it is not necessary as crypt.c is  
  already listed for this project and should be replaced with a fake name  
  as it is a unique file.  
  
Michael Paquier  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/VCBuildProject.pm

Fix hstore_plperl regression tests on some platforms

commit   : f95425478aea3797f841e253cc9b216c50560c68    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Apr 2015 16:09:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Apr 2015 16:09:22 -0400    

Click here for diff

On some platforms, plperl and plperlu cannot be loaded at the same  
time.  So split the test into two separate test files.  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plperl/expected/hstore_plperl.out
A contrib/hstore_plperl/expected/hstore_plperlu.out
M contrib/hstore_plperl/sql/hstore_plperl.sql
A contrib/hstore_plperl/sql/hstore_plperlu.sql

Also correct therefor to therefore.

commit   : 2e3ca04e2ee711cf8b87030b04f257316d990bde    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Apr 2015 19:05:39 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Apr 2015 19:05:39 +0200    

Click here for diff

Since both forms are arguably legal I wasn't sure about changing  
this. But then Tom argued for 'therefore'...  
  
Author: Dmitriy Olshevskiy  
Discussion: [email protected]  

M src/backend/libpq/pqcomm.c
M src/backend/optimizer/geqo/geqo_erx.c

Fix various typos and grammar errors in comments.

commit   : 6aab1f45acaa4cf90e62357ebdf5e6a38829204e    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Apr 2015 18:42:31 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Apr 2015 18:42:31 +0200    

Click here for diff

Author: Dmitriy Olshevskiy  
Discussion: [email protected]  

M src/backend/access/brin/brin_tuple.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/transam/twophase.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/indexcmds.c
M src/backend/executor/nodeModifyTable.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/snapbuild.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/cache/inval.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/relfilenode.c
M src/include/access/attnum.h
M src/include/access/xact.h
M src/include/mb/pg_wchar.h
M src/include/storage/s_lock.h
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/port/pgmkdirp.c

Fix possible division by zero in pg_xlogdump.

commit   : 9fe1d9ac6820cff354a5402114b96dae1221eba3    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 26 Apr 2015 18:02:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 26 Apr 2015 18:02:32 +0200    

Click here for diff

When displaying stats it was possible that a floating point division by  
zero occured when no FPIs were issued for a type of record.  
  
Author: Abhijit Menon-Sen  
Discussion: [email protected]  

M src/bin/pg_xlogdump/pg_xlogdump.c

Add transforms feature

commit   : cac76582053ef8ea07df65fed0757f352da23705    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Apr 2015 10:33:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Apr 2015 10:33:14 -0400    

Click here for diff

This provides a mechanism for specifying conversions between SQL data  
types and procedural languages.  As examples, there are transforms  
for hstore and ltree for PL/Perl and PL/Python.  
  
reviews by Pavel Stěhule and Andres Freund  

M contrib/Makefile
A contrib/hstore_plperl/.gitignore
A contrib/hstore_plperl/Makefile
A contrib/hstore_plperl/expected/create_transform.out
A contrib/hstore_plperl/expected/hstore_plperl.out
A contrib/hstore_plperl/hstore_plperl–1.0.sql
A contrib/hstore_plperl/hstore_plperl.c
A contrib/hstore_plperl/hstore_plperl.control
A contrib/hstore_plperl/hstore_plperlu–1.0.sql
A contrib/hstore_plperl/hstore_plperlu.control
A contrib/hstore_plperl/sql/create_transform.sql
A contrib/hstore_plperl/sql/hstore_plperl.sql
A contrib/hstore_plpython/.gitignore
A contrib/hstore_plpython/Makefile
A contrib/hstore_plpython/expected/hstore_plpython.out
A contrib/hstore_plpython/hstore_plpython.c
A contrib/hstore_plpython/hstore_plpython2u–1.0.sql
A contrib/hstore_plpython/hstore_plpython2u.control
A contrib/hstore_plpython/hstore_plpython3u–1.0.sql
A contrib/hstore_plpython/hstore_plpython3u.control
A contrib/hstore_plpython/hstore_plpythonu–1.0.sql
A contrib/hstore_plpython/hstore_plpythonu.control
A contrib/hstore_plpython/sql/hstore_plpython.sql
A contrib/ltree_plpython/.gitignore
A contrib/ltree_plpython/Makefile
A contrib/ltree_plpython/expected/ltree_plpython.out
A contrib/ltree_plpython/ltree_plpython.c
A contrib/ltree_plpython/ltree_plpython2u–1.0.sql
A contrib/ltree_plpython/ltree_plpython2u.control
A contrib/ltree_plpython/ltree_plpython3u–1.0.sql
A contrib/ltree_plpython/ltree_plpython3u.control
A contrib/ltree_plpython/ltree_plpythonu–1.0.sql
A contrib/ltree_plpython/ltree_plpythonu.control
A contrib/ltree_plpython/sql/ltree_plpython.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/alter_extension.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_function.sgml
A doc/src/sgml/ref/create_transform.sgml
A doc/src/sgml/ref/drop_transform.sgml
M doc/src/sgml/reference.sgml
M src/Makefile.shlib
M src/backend/catalog/Makefile
M src/backend/catalog/dependency.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/typecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/fmgr/funcapi.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
A src/include/catalog/pg_transform.h
M src/include/commands/defrem.h
M src/include/funcapi.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/lsyscache.h
M src/include/utils/syscache.h
M src/interfaces/ecpg/preproc/ecpg.tokens
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg_keywords.c
M src/pl/plperl/GNUmakefile
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl_helpers.h
M src/pl/plpython/Makefile
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_procedure.h
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.c
M src/pl/plpython/plpy_util.h
M src/pl/plpython/plpython.h
A src/pl/plpython/regress-python3-mangle.mk
M src/test/regress/expected/sanity_check.out

Fix typo in linux startup script.

commit   : f320cbb615e0374b18836337713239da58705cf3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Apr 2015 09:43:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Apr 2015 09:43:15 -0400    

Click here for diff

Missed a "$" in what was meant to be a variable substitution.  Careless  
mistake in commit f23425fa950fec3aff458de117037c9caadbc35c.  

M contrib/start-scripts/linux

Add comments warning against generalizing default_with_oids.

commit   : 0bd11d9711b88e72d2022e25b9227c480aca4978    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Apr 2015 21:37:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Apr 2015 21:37:39 -0400    

Click here for diff

pg_dump has historically assumed that default_with_oids affects only plain  
tables and not other relkinds.  Conceivably we could make it apply to some  
newly invented relkind if we did so from the get-go, but changing the  
behavior for existing object types will break existing dump scripts.  
Add code comments warning about this interaction.  
  
Also, make sure that default_with_oids doesn't cause parse_utilcmd.c to  
think that CREATE FOREIGN TABLE will create an OID column.  I think this is  
only a latent bug right now, since we don't allow UNIQUE/PKEY constraints  
in CREATE FOREIGN TABLE, but it's better to be consistent and future-proof.  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c

Try to unbreak some MSVC builds following forward slash change.

commit   : 04f1542d390fdd95dadc66e86c623ecdc1bca401    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 25 Apr 2015 21:28:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 25 Apr 2015 21:28:02 -0400    

Click here for diff

Michael Paquier.  

M src/tools/msvc/VCBuildProject.pm

Revert: Honor OID status of CREATE LIKE'd tables

commit   : 764ce22af30df3d62524d41815c41b4d696f3c10    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Apr 2015 21:10:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Apr 2015 21:10:45 -0400    

Click here for diff

Reverts d992f8a8961c09ec219373ffe2b5e6473febd065  
  
Report by Tom Lane  

M src/backend/parser/parse_utilcmd.c

Don't overwrite EXTRA_INSTALL

commit   : ee8d392765f29b1b8adb52f75008e301823f094b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Apr 2015 20:57:58 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Apr 2015 20:57:58 -0400    

Click here for diff

The temp-install target sets EXTRA_INSTALL to install the current  
directory.  But when doing so, it should append instead of overwrite,  
otherwise settings of EXTRA_INSTALL from a makefile won't take effect.  
This would cause the earthdistance test to fail when called directly,  
because it would miss installing the cube module.  

M src/makefiles/pgxs.mk

Prevent improper reordering of antijoins vs. outer joins.

commit   : 3cf8686014f91174018f20e01dbb0dafdcad0473    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Apr 2015 16:44:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Apr 2015 16:44:27 -0400    

Click here for diff

An outer join appearing within the RHS of an antijoin can't commute with  
the antijoin, but somehow I missed teaching make_outerjoininfo() about  
that.  In Teodor Sigaev's recent trouble report, this manifests as a  
"could not find RelOptInfo for given relids" error within eqjoinsel();  
but I think silently wrong query results are possible too, if the planner  
misorders the joins and doesn't happen to trigger any internal consistency  
checks.  It's broken as far back as we had antijoins, so back-patch to all  
supported branches.  

M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Replace backslashes by forward slashes in MSVC build code

commit   : 854adb83711da8fda2a8f028c27ad8956179c04a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 25 Apr 2015 08:52:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 25 Apr 2015 08:52:03 -0400    

Click here for diff

This makes it possible to run some stages of these build scripts on  
non-Windows systems.  That way, we can more easily test whether file  
moves or makefile changes might break the MSVC build.  
  
Peter Eisentraut and Michael Paquier  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm

Fix file comment for test_rls_hooks.c

commit   : 410cbfd6dd778e8f388fd0d7ee9d84f833700da5    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 24 Apr 2015 20:44:53 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 24 Apr 2015 20:44:53 -0400    

Click here for diff

The file-level comment wasn't updated when it was copied from the shared  
memory queue test module.  Fixed.  
  
Noted by Dean Rasheed.  

M src/test/modules/test_rls_hooks/test_rls_hooks.c

Perform RLS WITH CHECK before constraints, etc

commit   : e89bd02f58ac07e44e0388a32b7ee1b42f1fd7c6    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 24 Apr 2015 20:34:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 24 Apr 2015 20:34:26 -0400    

Click here for diff

The RLS capability is built on top of the WITH CHECK OPTION  
system which was added for auto-updatable views, however, unlike  
WCOs on views (which are mandated by the SQL spec to not fire until  
after all other constraints and checks are done), it makes much more  
sense for RLS checks to happen earlier than constraint and uniqueness  
checks.  
  
This patch reworks the structure which holds the WCOs a bit to be  
explicitly either VIEW or RLS checks and the RLS-related checks are  
done prior to the constraint and uniqueness checks.  This also allows  
better error reporting as we are now reporting when a violation is due  
to a WITH CHECK OPTION and when it's due to an RLS policy violation,  
which was independently noted by Craig Ringer as being confusing.  
  
The documentation is also updated to include a paragraph about when RLS  
WITH CHECK handling is performed, as there have been a number of  
questions regarding that and the documentation was previously silent on  
the matter.  
  
Author: Dean Rasheed, with some kabitzing and comment changes by me.  

M doc/src/sgml/ref/create_policy.sgml
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Remove obsolete -I options from ECPG library compilation.

commit   : c8aa893862275614d54a0657d1fb336020c98f60    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 24 Apr 2015 19:29:09 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 24 Apr 2015 19:29:09 -0400    

Click here for diff

The MSVC build system already omitted these.  

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile

Remove superfluous -DFRONTEND.

commit   : bcd7e8897cd5345b38232efdbeb3ed12d8790ed5    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 24 Apr 2015 19:29:05 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 24 Apr 2015 19:29:05 -0400    

Click here for diff

The majority practice is to add -DFRONTEND in directories building files  
that are, at other times, built for the backend.  Some directories  
lacking that property added a noise -DFRONTEND in one build system.  
Remove the excess flags, for consistency.  

M src/bin/pg_upgrade/Makefile
M src/tools/msvc/Mkvcbuild.pm

Build every ECPG library with -DFRONTEND.

commit   : 151e74719b0cc5c040bd3191b51b95f925773dd1    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 24 Apr 2015 19:29:02 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 24 Apr 2015 19:29:02 -0400    

Click here for diff

Each of the libraries incorporates src/port files, which often check  
FRONTEND.  Build systems disagreed on whether to build libpgtypes this  
way.  Only libecpg incorporates files that rely on it today.  Back-patch  
to 9.0 (all supported versions) to forestall surprises.  

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/tools/msvc/Mkvcbuild.pm

Fix up .gitignore and cleanup actions in some src/test/ subdirectories.

commit   : 732b33f8ae4ecc9d7a9f07fd4cb74a60a2a5e2c2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2015 17:13:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2015 17:13:06 -0400    

Click here for diff

examples/, locale/, and thread/ lacked .gitignore files and were also  
not connected up to top-level "make clean" etc.  This had escaped notice  
because none of those directories are built in normal scenarios.  Still,  
they have working Makefiles, so if someone does a "make" in one of these  
directories it would be good if (a) git doesn't bleat about the product  
files and (b) cleaning up removes them.  
  
This is a longstanding oversight, but since this behavior is probably  
only of interest to developers, there seems no need for back-patching.  
  
Michael Paquier and Tom Lane  

M src/test/Makefile
A src/test/examples/.gitignore
M src/test/examples/Makefile
A src/test/locale/.gitignore
M src/test/locale/Makefile
A src/test/thread/.gitignore

Fix obsolete comment in set_rel_size().

commit   : 70d44dd9de2b781436ef1d55906614d241e02249    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2015 15:18:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2015 15:18:07 -0400    

Click here for diff

The cross-reference to set_append_rel_pathlist() was obsoleted by  
commit e2fa76d80ba571d4de8992de6386536867250474, which split what  
had been set_rel_pathlist() and child routines into two sets of  
functions.  But I (tgl) evidently missed updating this comment.  
  
Back-patch to 9.2 to avoid unnecessary divergence among branches.  
  
Amit Langote  

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

Add comments explaining how unique and exclusion constraints are enforced.

commit   : 61a553a09177c4f0a5570168e3b667eff87e354c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Apr 2015 21:12:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Apr 2015 21:12:32 +0300    

Click here for diff

M src/backend/executor/execIndexing.c

doc: Move ALTER TABLE IF EXISTS description to better place

commit   : d64a9c8c833c497a926208c7ca898e270ecc6990    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Apr 2015 13:22:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Apr 2015 13:22:18 -0400    

Click here for diff

It was previously mixed in with the description of ALTER TABLE  
subcommands.  Move it to the Parameters section, which is where it is on  
other reference pages.  
  
pointed out by Amit Langote  

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

Fix misspellings

commit   : 9ba978c8cc80d6f9e78b2ceef7f94834317b46aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Apr 2015 12:00:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Apr 2015 12:00:49 -0400    

Click here for diff

Amit Langote and Thom Brown  

M doc/src/sgml/ddl.sgml
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Copy the relation name for error reporting in WCOs

commit   : cb087ec03bbb1d52845a4de83a6bf634dac2639f    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 24 Apr 2015 09:38:10 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 24 Apr 2015 09:38:10 -0400    

Click here for diff

In get_row_security_policies(), we need to make a copy of the relation  
name when building the WithCheckOptions structure, since  
RelationGetRelationName just returns a pointer into the local Relation  
structure.  The relation name in the WCO structure is only used for  
error reporting.  
  
Pointed out by Robert and Christian Ullrich, who noted that the  
buildfarm members with -DCLOBBER_CACHE_ALWAYS were failing.  

M src/backend/rewrite/rowsecurity.c

commit   : 62420ae7d6675453a48e408b62030b6f0780e878    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Apr 2015 09:33:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Apr 2015 09:33:23 +0300    

Click here for diff

There is enough code here to deserve a file of their own, not be buried  
in the middle of execUtils.c.  

M src/backend/executor/Makefile
A src/backend/executor/execIndexing.c
M src/backend/executor/execUtils.c
M src/include/executor/executor.h

Fix deadlock at startup, if max_prepared_transactions is too small.

commit   : 2c47fe16a709e01dea403643a1ff4d00c8c8c1ad    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Apr 2015 21:25:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Apr 2015 21:25:44 +0300    

Click here for diff

When the startup process recovers transactions by scanning pg_twophase  
directory, it should clear MyLockedGxact after it's done processing each  
transaction. Like we do during normal operation, at PREPARE TRANSACTION.  
Otherwise, if the startup process exits due to an error, it will try to  
clear the locking_backend field of the last recovered transaction. That's  
usually harmless, but if the error happens in MarkAsPreparing, while  
holding TwoPhaseStateLock, the shmem-exit hook will try to acquire  
TwoPhaseStateLock again, and deadlock with itself.  
  
This fixes bug #13128 reported by Grant McAlister. The bug was introduced  
by commit bb38fb0d, so backpatch to all supported versions like that  
commit.  

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

Fix shell error on Solaris

commit   : 2aa0fb032ecdc5624a3706a2db0a7ca42bbaf211    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Apr 2015 13:09:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Apr 2015 13:09:18 -0400    

Click here for diff

Apparently, the Bourne shell on Solaris doesn't like "for" loops with an  
empty list, so have "make" skip the loop in that case.  

M src/Makefile.global.in

Improve speed of make check-world

commit   : dcae5faccab64776376d354decda0017c648bb53    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Apr 2015 08:59:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Apr 2015 08:59:52 -0400    

Click here for diff

Before, make check-world would create a new temporary installation for  
each test suite, which is slow and wasteful.  Instead, we now create one  
test installation that is used by all test suites that are part of a  
make run.  
  
The management of the temporary installation is removed from pg_regress  
and handled in the makefiles.  This allows for better control, and  
unifies the code with that of test suites not run through pg_regress.  
  
review and msvc support by Michael Paquier <[email protected]>  
  
more review by Fabien Coelho <[email protected]>  

M .gitignore
M GNUmakefile.in
M contrib/earthdistance/Makefile
M contrib/test_decoding/Makefile
M src/Makefile.global.in
M src/bin/pg_upgrade/test.sh
M src/interfaces/ecpg/test/Makefile
M src/makefiles/pgxs.mk
M src/pl/plperl/GNUmakefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile
M src/test/isolation/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/tools/msvc/vcregress.pl

Use the right type OID after creating a shell type

commit   : 50a16e30ebd76e70fc76abb2c8f0cd1e71deac41    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 22 Apr 2015 16:23:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 22 Apr 2015 16:23:02 -0300    

Click here for diff

Commit a2e35b53c39b2a neglected to update the type OID to use further  
down in DefineType when TypeShellMake was changed to return  
ObjectAddress instead of OID (it got it right in DefineRange, however.)  
This resulted in an internal error message being issued when looking up  
I/O functions.  
  
Author: Michael Paquier  
  
Also add Asserts() to a couple of other places to ensure that the type  
OID being used is as expected.  

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

Fix installcheck for test_rls_hooks

commit   : 450fa1b5ba0e986a20d8c017500c0c0bbf1e0b4b    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 22 Apr 2015 12:43:57 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 22 Apr 2015 12:43:57 -0400    

Click here for diff

As pointed out by the buildfarm, test_rls_hooks wasn't functioning  
properly with a clean installcheck.  test_rls_hooks needs to explicitly  
load the library with the hooks in it, to allow installcheck to work;  
using the --temp-config doesn't help since that isn't used when running  
installcheck and it isn't exactly fair to the buildfarm to modify the  
installed config prior to calling installcheck.  
  
Also, have test_rls_hooks clean up after itself.  

M src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
M src/test/modules/test_rls_hooks/sql/test_rls_hooks.sql

RLS fixes, new hooks, and new test module

commit   : 0bf22e0c8b1114ae37939c500535307abefd38e1    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 22 Apr 2015 12:01:06 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 22 Apr 2015 12:01:06 -0400    

Click here for diff

In prepend_row_security_policies(), defaultDeny was always true, so if  
there were any hook policies, the RLS policies on the table would just  
get discarded.  Fixed to start off with defaultDeny as false and then  
properly set later if we detect that only the default deny policy exists  
for the internal policies.  
  
The infinite recursion detection in fireRIRrules() didn't properly  
manage the activeRIRs list in the case of WCOs, so it would incorrectly  
report infinite recusion if the same relation with RLS appeared more  
than once in the rtable, for example "UPDATE t ... FROM t ...".  
  
Further, the RLS expansion code in fireRIRrules() was handling RLS in  
the main loop through the rtable, which lead to RTEs being visited twice  
if they contained sublink subqueries, which  
prepend_row_security_policies() attempted to handle by exiting early if  
the RTE already had securityQuals.  That doesn't work, however, since  
if the query involved a security barrier view on top of a table with  
RLS, the RTE would already have securityQuals (from the view) by the  
time fireRIRrules() was invoked, and so the table's RLS policies would  
be ignored.  This is fixed in fireRIRrules() by handling RLS in a  
separate loop at the end, after dealing with any other sublink  
subqueries, thus ensuring that each RTE is only visited once for RLS  
expansion.  
  
The inheritance planner code didn't correctly handle non-target  
relations with RLS, which would get turned into subqueries during  
planning. Thus an update of the form "UPDATE t1 ... FROM t2 ..." where  
t1 has inheritance and t2 has RLS quals would fail.  Fix by making sure  
to copy in and update the securityQuals when they exist for non-target  
relations.  
  
process_policies() was adding WCOs to non-target relations, which is  
unnecessary, and could lead to a lot of wasted time in the rewriter and  
the planner. Fix by only adding WCO policies when working on the result  
relation.  Also in process_policies, we should be copying the USING  
policies to the WITH CHECK policies on a per-policy basis, fix by moving  
the copying up into the per-policy loop.  
  
Lastly, as noted by Dean, we were simply adding policies returned by the  
hook provided to the list of quals being AND'd, meaning that they would  
actually restrict records returned and there was no option to have  
internal policies and hook-based policies work together permissively (as  
all internal policies currently work).  Instead, explicitly add support  
for both permissive and restrictive policies by having a hook for each  
and combining the results appropriately.  To ensure this is all done  
correctly, add a new test module (test_rls_hooks) to test the various  
combinations of internal, permissive, and restrictive hook policies.  
  
Largely from Dean Rasheed (thanks!):  
  
CAEZATCVmFUfUOwwhnBTcgi6AquyjQ0-1fyKd0T3xBWJvn+xsFA@mail.gmail.com  
  
Author: Dean Rasheed, though I added the new hooks and test module.  

M src/backend/optimizer/plan/planner.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/include/rewrite/rowsecurity.h
M src/test/modules/Makefile
A src/test/modules/test_rls_hooks/.gitignore
A src/test/modules/test_rls_hooks/Makefile
A src/test/modules/test_rls_hooks/README
A src/test/modules/test_rls_hooks/expected/test_rls_hooks.out
A src/test/modules/test_rls_hooks/rls_hooks.conf
A src/test/modules/test_rls_hooks/sql/test_rls_hooks.sql
A src/test/modules/test_rls_hooks/test_rls_hooks.c
A src/test/modules/test_rls_hooks/test_rls_hooks.control
A src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Pull in tableoid for inheiritance with rowMarks

commit   : 4ccc5bd28e7f0c0d1b221683398ae178515b9f76    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 22 Apr 2015 11:29:35 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 22 Apr 2015 11:29:35 -0400    

Click here for diff

As noted by Etsuro Fujita [1] and Dean Rasheed[2],  
cb1ca4d800621dcae67ca6c799006de99fa4f0a5 changed ExecBuildAuxRowMark()  
to always look for the tableoid in the target list, but didn't also  
change preprocess_targetlist() to always include the tableoid.  This  
resulted in errors with soon-to-be-added RLS with inheritance tests,  
and errors when using inheritance with foreign tables.  
  
Authors: Etsuro Fujita and Dean Rasheed (independently)  
  
Minor word-smithing on the comments by me.  
  
[1] [email protected]  
[2] CAEZATCVmFUfUOwwhnBTcgi6AquyjQ0-1fyKd0T3xBWJvn+xsFA@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/prep/preptlist.c

Make the pg_rewind regression tests more robust on slow systems.

commit   : 54a16df0100da445be7c79eb81dfb96fd0685e6d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Apr 2015 14:28:37 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Apr 2015 14:28:37 +0300    

Click here for diff

There were a couple of hard-coded sleeps in the tests: to wait for standby  
to catch up with master, and to wait for promotion with "pg_ctl promote"  
to complete. Instead of a fixed, hard-coded sleep, poll the server with a  
query once a second. This isn't ideal either, and I wish we had a better  
solution for real-world applications too, but this should fix the  
immediate problem.  
  
Patch by Michael Paquier, with some editing by me.  

M src/bin/pg_rewind/RewindTest.pm

Rename pg_replication_slot's new active_in to active_pid.

commit   : cef939c3470006c1195a17c2ca3861360587fe15    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 22 Apr 2015 09:42:36 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 22 Apr 2015 09:42:36 +0200    

Click here for diff

In d811c037ce active_in was added but discussion since showed that  
active_pid is preferred as a name.  
  
Discussion: CAMsr+YFKgZca5_7_ouaMWxA5PneJC9LNViPzpDHusaPhU9pA7g@mail.gmail.com  

M contrib/test_decoding/expected/ddl.out
M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/pg_proc.h
M src/test/regress/expected/rules.out

Don't leave 'tmp_check' directory behind in pg_rewind regression tests.

commit   : 4d930eee89954ef8ac5402f3d568c11ff6256035    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Apr 2015 10:14:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Apr 2015 10:14:44 +0300    

Click here for diff

M src/bin/pg_rewind/RewindTest.pm

Move pg_xlogdump from contrib/ to src/bin/

commit   : b0a738f428ca4e52695c0f019c1560c64cc59aef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/allfiles.sgml
R100 doc/src/sgml/pg_xlogdump.sgml doc/src/sgml/ref/pg_xlogdump.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
R100 contrib/pg_xlogdump/.gitignore src/bin/pg_xlogdump/.gitignore
R053 contrib/pg_xlogdump/Makefile src/bin/pg_xlogdump/Makefile
R098 contrib/pg_xlogdump/compat.c src/bin/pg_xlogdump/compat.c
R099 contrib/pg_xlogdump/pg_xlogdump.c src/bin/pg_xlogdump/pg_xlogdump.c
R096 contrib/pg_xlogdump/rmgrdesc.c src/bin/pg_xlogdump/rmgrdesc.c
R091 contrib/pg_xlogdump/rmgrdesc.h src/bin/pg_xlogdump/rmgrdesc.h
M src/tools/msvc/Mkvcbuild.pm

Update FDW docs to reflect existence of CHECK constraints.

commit   : 0275ecf31cda9329ee822a6a806a2018144520ed    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 Apr 2015 17:46:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 Apr 2015 17:46:47 -0400    

Click here for diff

Generalize the remarks previously made about NOT NULL constraints to  
CHECK constraints.  
  
Etsuro Fujita  

M doc/src/sgml/fdwhandler.sgml

Add missing installcheck target to pg_rewind's Makefile

commit   : 060a1224af3f66c172cfb14e5ca9d0ffa575201a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 21 Apr 2015 14:09:25 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 21 Apr 2015 14:09:25 +0300    

Click here for diff

Michael Paquier  

M src/bin/pg_rewind/Makefile

Add 'active_in' column to pg_replication_slots.

commit   : d811c037cea2e929ee5823aab6e1bca0df8be245    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 21 Apr 2015 11:51:06 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 21 Apr 2015 11:51:06 +0200    

Click here for diff

Right now it is visible whether a replication slot is active in any  
session, but not in which.  Adding the active_in column, containing the  
pid of the backend having acquired the slot, makes it much easier to  
associate pg_replication_slots entries with the corresponding  
pg_stat_replication/pg_stat_activity row.  
  
This should have been done from the start, but I (Andres) dropped the  
ball there somehow.  
  
Author: Craig Ringer, revised by me Discussion:  
CAMsr+YFKgZca5_7_ouaMWxA5PneJC9LNViPzpDHusaPhU9pA7g@mail.gmail.com  

M contrib/test_decoding/expected/ddl.out
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/catalog/pg_proc.h
M src/include/replication/slot.h
M src/test/regress/expected/rules.out

Move pg_test_timing from contrib/ to src/bin/

commit   : 528c2e44ab0a5ba49a5a04689dae3f674b71c15e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
D contrib/pg_test_timing/Makefile
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/allfiles.sgml
R098 doc/src/sgml/pgtesttiming.sgml doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
R100 contrib/pg_test_timing/.gitignore src/bin/pg_test_timing/.gitignore
A src/bin/pg_test_timing/Makefile
R100 contrib/pg_test_timing/pg_test_timing.c src/bin/pg_test_timing/pg_test_timing.c
M src/tools/msvc/Mkvcbuild.pm

Honor OID status of CREATE LIKE'd tables

commit   : d992f8a8961c09ec219373ffe2b5e6473febd065    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 Apr 2015 16:11:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 Apr 2015 16:11:25 -0400    

Click here for diff

Previously, tables created by CREATE LIKE never had OIDs.  
  
Report by Tom Lane  

M src/backend/parser/parse_utilcmd.c

Move pg_test_fsync from contrib/ to src/bin/

commit   : 00882d9e5ce7b693aa536346f68a826064c8683a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
D contrib/pg_test_fsync/Makefile
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/allfiles.sgml
R095 doc/src/sgml/pgtestfsync.sgml doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
R100 contrib/pg_test_fsync/.gitignore src/bin/pg_test_fsync/.gitignore
A src/bin/pg_test_fsync/Makefile
R100 contrib/pg_test_fsync/pg_test_fsync.c src/bin/pg_test_fsync/pg_test_fsync.c
M src/tools/msvc/Mkvcbuild.pm

pg_upgrade: binary_upgrade_create_empty_extension() is strict

commit   : f92fc4c95ddcc25978354a8248d3df22269201bc    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 17 Apr 2015 20:08:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 17 Apr 2015 20:08:42 -0400    

Click here for diff

Was broken by commit 30982be4e5019684e1772dd9170aaa53f5a8e894.  
  
Patch by Jeff Janes  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Fix typo in relcache's equalPolicy()

commit   : ab6d1cd26ebfbfce275cd31af82814c0620e70a2    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 17 Apr 2015 16:37:11 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 17 Apr 2015 16:37:11 -0400    

Click here for diff

The USING policies were not being checked for differences as the same  
policy was being passed in to both sides of the equal().  This could  
result in backends not realizing that a policy had been changed, if  
none of the other attributes had been changed.  
  
Fix by passing to equal() the policy1 and policy2 using quals for  
comparison.  
  
No need to back-patch as this is not yet released.  Noticed while  
testing changes to RLS proposed by Dean Rasheed.  

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

Add new target modulescheck in vcregress.pl

commit   : 4cb7d671fddc8855c8def2de51fb23df1c8ac0af    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Apr 2015 23:39:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Apr 2015 23:39:52 -0300    

Click here for diff

This allows an MSVC build to run regression tests related to modules in  
src/test/modules.  
  
Author: Michael Paquier  
Reviewed by: Andrew Dunstan  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/vcregress.pl

pg_upgrade: document need for text search files to be copied

commit   : 2e5d52a644a4cad9f37a1b2a1e61be8eb631b901    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 16 Apr 2015 19:51:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 16 Apr 2015 19:51:12 -0400    

Click here for diff

Report by CJ Estel  
  
Backpatch through 9.4  

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

MSVC: install src/test/modules together with contrib

commit   : 22d005323f917d0189bcee8e6cbbbcf5906b2358    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Apr 2015 16:40:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Apr 2015 16:40:14 -0300    

Click here for diff

These modules have to be installed so that the testing module can access  
them.  (We don't have that yet, but will soon have it.)  
  
Author: Michael Paquier  
Reviewed by: Andrew Dunstan  

M src/tools/msvc/Install.pm

Fix assertion failure in logical decoding.

commit   : e2999abcd14540e66b72deeff75662c1672d7744    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 16 Apr 2015 21:00:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 16 Apr 2015 21:00:55 +0300    

Click here for diff

Logical decoding set SnapshotData's regd_count field to avoid the  
snapshot manager from prematurely freeing snapshots that are generated  
by the decoding system. That was always an abuse of the field, as it was  
never supposed to be used outside the snapshot manager. Commit 94028691  
made snapshot manager's tracking of the snapshots smarter, and that scheme  
fell apart. The snapshot manager got confused and hit the assertion, when  
a snapshot that was marked with regd_count==1 was not found in the heap,  
where the snapshot manager tracks registered the snapshots.  
  
To fix, don't abuse the regd_count field like that. Logical decoding still  
abuses the active_count field for similar purposes, but that's currently  
harmless.  
  
The assertion failure was first reported by Michael Paquier  

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

MSVC: Include modules of src/test/modules in build

commit   : 90898af30bb287a512bef743253770fc24886da6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Apr 2015 15:17:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Apr 2015 15:17:26 -0300    

Click here for diff

commit_ts, being only a module used for test purposes, is ignored in the  
process for now.  
  
Author: Michael Paquier  
Reviewed by: Andrew Dunstan  

M src/tools/msvc/Mkvcbuild.pm

Add missing newlines to error messages.

commit   : b5e384e374657ead815a3393ca59333910611a24    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 16 Apr 2015 09:18:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 16 Apr 2015 09:18:00 +0300    

Click here for diff

M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/parsexlog.c

Error out in pg_rewind if lstat() fails.

commit   : b5e560c24603e5325a81055c8f36cc45d48609e4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 23:13:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 23:13:32 +0300    

Click here for diff

A "file not found" is expected if the source server is running, so don't  
complain about that. But any other error is definitely not expected.  

M src/bin/pg_rewind/copy_fetch.c

Minor cleanup of pg_rewind.

commit   : 41457fcf970f0ec78004cc0f7b29f1d37021fbfb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 22:52:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 22:52:00 +0300    

Click here for diff

Update comments and function names to use the terms "source" and "target"  
consistently. Some places were calling them remote and local instead, which  
was confusing.  
  
Fix incorrect comment in extractPageInfo on database creation record - it  
was wrong on what happens for databases created in the target that don't  
exist in source.  

M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/logging.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c

Shut down test servers after pg_rewind regression tests.

commit   : 0d8a22a9ac6a61b7993abb642cb7e4645f4087b0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 19:54:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 19:54:38 +0300    

Click here for diff

Now that the test servers are initialized twice in each .pl script,  
the single END block is not enough to stop them. Add a new clean_rewind_test  
function that is called at the end of each test.  
  
Michael Paquier  

M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl

Fix logic to skip checkpoint if no records have been inserted.

commit   : 3d80a1e0e3e278edc6022d642478dcbd089d4483    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 17:21:04 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 15 Apr 2015 17:21:04 +0300    

Click here for diff

After the WAL format changes, the calculation of the size of a checkpoint  
record became incorrect. Instead of trying to fix the math, check that the  
previous record, i.e. the xl_prev value that we'd write for the next  
record, matches the last checkpoint's redo pointer. That way it's not  
dependent on the size of the checkpoint record at all.  
  
The old logic was actually slightly wrong all along: if the previous  
checkpoint record crossed a page boundary, the page headers threw off the  
record size calculation, and the checkpoint was not skipped. The new  
checkpoint would not cross a page boundary, so this only resulted in at  
most one extra checkpoint after the system became idle. The new logic fixes  
that. (It's not worth fixing in backbranches).  
  
However, it makes some sense to try to keep the latest checkpoint contained  
fully in a page, or at least in a single WAL segment, just on general  
robustness grounds. If something goes awfully wrong, it's more likely that  
you can recover the latest WAL segment, than the last two WAL segments. So  
I added an extra check that the checkpoint is not skipped if the previous  
checkpoint crossed a WAL segment.  
  
Reported by Jeff Janes.  

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

Move pg_upgrade from contrib/ to src/bin/

commit   : 9fa8b0ee90c44c0f97d16bf65e94322988c94864    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:25 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
D contrib/pg_upgrade/Makefile
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/allfiles.sgml
R098 doc/src/sgml/pgupgrade.sgml doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
R100 contrib/pg_upgrade/.gitignore src/bin/pg_upgrade/.gitignore
R099 contrib/pg_upgrade/IMPLEMENTATION src/bin/pg_upgrade/IMPLEMENTATION
A src/bin/pg_upgrade/Makefile
R099 contrib/pg_upgrade/TESTING src/bin/pg_upgrade/TESTING
R099 contrib/pg_upgrade/check.c src/bin/pg_upgrade/check.c
R099 contrib/pg_upgrade/controldata.c src/bin/pg_upgrade/controldata.c
R099 contrib/pg_upgrade/dump.c src/bin/pg_upgrade/dump.c
R099 contrib/pg_upgrade/exec.c src/bin/pg_upgrade/exec.c
R099 contrib/pg_upgrade/file.c src/bin/pg_upgrade/file.c
R099 contrib/pg_upgrade/function.c src/bin/pg_upgrade/function.c
R099 contrib/pg_upgrade/info.c src/bin/pg_upgrade/info.c
R099 contrib/pg_upgrade/option.c src/bin/pg_upgrade/option.c
R099 contrib/pg_upgrade/page.c src/bin/pg_upgrade/page.c
R099 contrib/pg_upgrade/parallel.c src/bin/pg_upgrade/parallel.c
R099 contrib/pg_upgrade/pg_upgrade.c src/bin/pg_upgrade/pg_upgrade.c
R099 contrib/pg_upgrade/pg_upgrade.h src/bin/pg_upgrade/pg_upgrade.h
R099 contrib/pg_upgrade/relfilenode.c src/bin/pg_upgrade/relfilenode.c
R099 contrib/pg_upgrade/server.c src/bin/pg_upgrade/server.c
R098 contrib/pg_upgrade/tablespace.c src/bin/pg_upgrade/tablespace.c
R097 contrib/pg_upgrade/test.sh src/bin/pg_upgrade/test.sh
R099 contrib/pg_upgrade/util.c src/bin/pg_upgrade/util.c
R099 contrib/pg_upgrade/version.c src/bin/pg_upgrade/version.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/vcregress.pl

Integrate pg_upgrade_support module into backend

commit   : 30982be4e5019684e1772dd9170aaa53f5a8e894    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:25 -0400    

Click here for diff

Previously, these functions were created in a schema "binary_upgrade",  
which was deleted after pg_upgrade was finished.  Because we don't want  
to keep that schema around permanently, move them to pg_catalog but  
rename them with a binary_upgrade_... prefix.  
  
The provided functions are only small wrappers around global variables  
that were added specifically for pg_upgrade use, so keeping the module  
separate does not create any modularity.  
  
The functions still check that they are only called in binary upgrade  
mode, so it is not possible to call these during normal operation.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
M contrib/pg_upgrade/dump.c
M contrib/pg_upgrade/function.c
M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_upgrade/pg_upgrade.h
M contrib/pg_upgrade/test.sh
D contrib/pg_upgrade_support/Makefile
M doc/src/sgml/pgupgrade.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/utils/adt/Makefile
R073 contrib/pg_upgrade_support/pg_upgrade_support.c src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/pg_proc.h

Optimize pg_comp_crc32c_sse42 routine slightly, and also use it on x86.

commit   : 936546dcbc24ad1f2b3d33e73aa5c5fde4d2be84    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 23:58:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 23:58:16 +0300    

Click here for diff

Eliminate the separate 'len' variable from the loops, and also use the 4  
byte instruction. This shaves off a few more cycles. Even though this  
routine that uses the special SSE 4.2 instructions is much faster than a  
generic routine, it's still a hot spot, so let's make it as fast as  
possible.  
  
Change the configure test to not test _mm_crc32_u64. That variant is only  
available in the 64-bit x86-64 architecture, not in 32-bit x86. Modify  
pg_comp_crc32c_sse42 so that it only uses _mm_crc32_u64 on x86-64. With  
these changes, the SSE accelerated CRC-32C implementation can also be used  
on 32-bit x86 systems.  
  
This also fixes the 32-bit MSVC build.  

M config/c-compiler.m4
M configure
M src/port/pg_crc32c_sse42.c

Oops, fix misspelled #endif

commit   : b73e7a0716264e5159947b1a755b9ab864142489    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 22:00:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 22:00:52 +0300    

Click here for diff

I hope this fixes the Windows builfarm failures.  

M src/include/pg_config.h.win32

Try to fix the CRC-32C autoconf magic for icc compiler.

commit   : b4eb2d168d2c426978a02de8b9b6ccdb85e1b442    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 19:56:03 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 19:56:03 +0300    

Click here for diff

On gcc and clang, the _mm_crc32_u8 and _mm_crc32_u64 intrinsics are not  
defined at all, when not building with -msse4.2. But on icc, they are.  
So we cannot assume that if those intrinsics are defined, we can always use  
them safely, we might still need the runtime check.  
  
To fix, check if the __SSE_4_2__ preprocessor symbol is defined. That's  
supposed to be defined only when the compiler is targeting a processor that  
has SSE 4.2 support.  
  
Per buildfarm members fulmar and okapi.  

M configure
M configure.in

Fix typo in comment

commit   : 0a52fafce42e47d151d1108a44b25152a908c732    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 14 Apr 2015 12:12:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 14 Apr 2015 12:12:18 -0300    

Click here for diff

SLRU_SEGMENTS_PER_PAGE -> SLRU_PAGES_PER_SEGMENT  
  
I introduced this ancient typo in subtrans.c and later propagated it to  
multixact.c.  I fixed the latter in f741300c, but only back to 9.3;  
backpatch to all supported branches for consistency.  

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

Use Intel SSE 4.2 CRC instructions where available.

commit   : 3dc2d62d0486325bf263655c2d9a96aee0b02abe    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 17:05:03 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 17:05:03 +0300    

Click here for diff

Modern x86 and x86-64 processors with SSE 4.2 support have special  
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly  
speed up CRC calculation.  
  
Whether the instructions can be used or not depends on the compiler and the  
target architecture. If generation of SSE 4.2 instructions is allowed for  
the target (-msse4.2 flag on gcc and clang), use them. If they are not  
allowed by default, but the compiler supports the -msse4.2 flag to enable  
them, compile just the CRC-32C function with -msse4.2 flag, and check at  
runtime whether the processor we're running on supports it. If it doesn't,  
fall back to the slicing-by-8 algorithm. (With the common defaults on  
current operating systems, the runtime-check variant is what you get in  
practice.)  
  
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.  

M config/c-compiler.m4
M configure
M configure.in
M src/Makefile.global.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port/pg_crc32c.h
M src/port/Makefile
A src/port/pg_crc32c_choose.c
A src/port/pg_crc32c_sse42.c
M src/tools/msvc/Mkvcbuild.pm

Reorganize our CRC source files again.

commit   : 4f700bcd20c087f60346cb8aefd0e269be8e2157    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 17:03:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Apr 2015 17:03:42 +0300    

Click here for diff

Now that we use CRC-32C in WAL and the control file, the "traditional" and  
"legacy" CRC-32 variants are not used in any frontend programs anymore.  
Move the code for those back from src/common to src/backend/utils/hash.  
  
Also move the slicing-by-8 implementation (back) to src/port. This is in  
preparation for next patch that will add another implementation that uses  
Intel SSE 4.2 instructions to calculate CRC-32C, where available.  

M contrib/hstore/hstore_gist.c
M contrib/ltree/crc32.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/hash/Makefile
A src/backend/utils/hash/pg_crc.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/common/Makefile
M src/include/access/xlogrecord.h
M src/include/catalog/pg_control.h
A src/include/port/pg_crc32c.h
R069 src/include/common/pg_crc.h src/include/utils/pg_crc.h
M src/port/Makefile
R092 src/common/pg_crc.c src/port/pg_crc32c_sb8.c
M src/tools/msvc/Mkvcbuild.pm

pgbench: Attempt fix build on Windows

commit   : d577bb868dfb595aa8df95974cd1c79e1baba924    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Apr 2015 15:32:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Apr 2015 15:32:57 -0400    

Click here for diff

M src/tools/msvc/Mkvcbuild.pm

Remove duplicated word in README

commit   : b5213e14a4759b8f6817359c827950bae5452136    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Apr 2015 14:28:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Apr 2015 14:28:21 -0300    

Click here for diff

M src/backend/access/nbtree/README

Move pgbench from contrib/ to src/bin/

commit   : 81134af3ec09d67043833f8d614fd688f17cb213    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:24 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
D contrib/pgbench/Makefile
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/allfiles.sgml
R099 doc/src/sgml/pgbench.sgml doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
R100 contrib/pgbench/.gitignore src/bin/pgbench/.gitignore
A src/bin/pgbench/Makefile
R100 contrib/pgbench/exprparse.y src/bin/pgbench/exprparse.y
R100 contrib/pgbench/exprscan.l src/bin/pgbench/exprscan.l
R099 contrib/pgbench/pgbench.c src/bin/pgbench/pgbench.c
R100 contrib/pgbench/pgbench.h src/bin/pgbench/pgbench.h
M src/tools/msvc/Mkvcbuild.pm

Fix pg_rewind regression tests in VPATH builds

commit   : b22a36a62ce312c1df9477382d1da602b0c24f6f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Apr 2015 18:28:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Apr 2015 18:28:42 +0300    

Click here for diff

Should call just "pg_rewind", instead of "./pg_rewind". The tests are called  
so that PATH contains the temporariy installation bin dir.  
  
Per report from Alvaro Herrera  

M src/bin/pg_rewind/RewindTest.pm

Refactor and fix TAP tests of pg_rewind

commit   : 53ba10770a315361770efdc17d2c01f6a30e3e3d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Apr 2015 18:06:12 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Apr 2015 18:06:12 +0300    

Click here for diff

* Don't pass arguments to prove, since that's not supported on perl 5.8  
which is the minimum version supported by the TAP tests. Refactor the  
test files themselves to run the tests twice, in both local and remote mode.  
  
* Use eq rather than == for string comparison. This thinko caused the remote  
versions of the tests to never run.  
  
* Add "use strict" and "use warnings", and fix warnings that that produced.  
  
* Increase the delay after standby promotion, to make the tests more robust.  
  
* In remote mode, the connection string to the promoted standby was  
incorrect, leading to connection errors.  
  
Patch by Michael Paquier, to address Peter Eisentraut's report.  

M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl

Don't archive bogus recycled or preallocated files after timeline switch.

commit   : b2a5545bd63fc94a71b1e97ecdd03c605d97a438    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Apr 2015 16:53:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Apr 2015 16:53:49 +0300    

Click here for diff

After a timeline switch, we would leave behind recycled WAL segments that  
are in the future, but on the old timeline. After promotion, and after they  
become old enough to be recycled again, we would notice that they don't have  
a .ready or .done file, create a .ready file for them, and archive them.  
That's bogus, because the files contain garbage, recycled from an older  
timeline (or prealloced as zeros). We shouldn't archive such files.  
  
This could happen when we're following a timeline switch during replay, or  
when we switch to new timeline at end-of-recovery.  
  
To fix, whenever we switch to a new timeline, scan the data directory for  
WAL segments on the old timeline, but with a higher segment number, and  
remove them. Those don't belong to our timeline history, and are most  
likely bogus recycled or preallocated files. They could also be valid files  
that we streamed from the primary ahead of time, but in any case, they're  
not needed to recover to the new timeline.  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/include/access/xlog_internal.h

Silence gettext warning about '\r' escape sequence in translatable string.

commit   : 1f94bec7a9e3e6b4fa5468236cf531fec16d1093    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 13 Apr 2015 13:30:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 13 Apr 2015 13:30:59 +0900    

Click here for diff

gettext was unhappy about the commit b216ad7 because it revealed  
the problem that internationalized messages may contain '\r' escape  
sequence in pg_rewind. This commit moves '\r' to a separate printf() call.  
  
Michael Paquier, bug reported by Peter Eisentraut  

M src/bin/pg_rewind/logging.c

emacs: Set indent-tabs-mode in perl-mode

commit   : 442663f133f1caec51919402463e6e31362baee3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 12 Apr 2015 23:53:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 12 Apr 2015 23:53:23 -0400    

Click here for diff

This matches existing practice, but makes the setup complete and  
consistent with the C code setup.  

M .dir-locals.el
M src/tools/editors/emacs.samples

Free leaked result set in pg_rewind

commit   : 74a68e37d059295e97cc55683c9342912a0ec81f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 12 Apr 2015 22:42:01 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 12 Apr 2015 22:42:01 +0300    

Click here for diff

It was not significant in practice, it was just one instance of a small  
result set, but let's pacify Coverity.  
  
Michael Paquier  

M src/bin/pg_rewind/libpq_fetch.c

Add system view pg_stat_ssl

commit   : 9029f4b37406b21abb7516a2fd5643e0961810f8    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 12 Apr 2015 19:07:46 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 12 Apr 2015 19:07:46 +0200    

Click here for diff

This view shows information about all connections, such as if the  
connection is using SSL, which cipher is used, and which client  
certificate (if any) is used.  
  
Reviews by Alex Shulgin, Heikki Linnakangas, Andres Freund & Michael Paquier  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/be-secure-openssl.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/libpq/libpq-be.h
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Remove duplicated words in comments.

commit   : a10589a5128e841d3faf94a2d8417a4f5497c4ac    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 12 Apr 2015 10:46:17 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 12 Apr 2015 10:46:17 +0300    

Click here for diff

David Rowley  

M src/backend/replication/walsender.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/misc/guc.c
M src/bin/pg_basebackup/pg_basebackup.c

Move pg_archivecleanup from contrib/ to src/bin/

commit   : 83aca89f7c3f913d960e2ea2d4d93b7d8e7a691d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2015 22:33:23 -0400    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  

M contrib/Makefile
D contrib/pg_archivecleanup/Makefile
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/ref/allfiles.sgml
R097 doc/src/sgml/pgarchivecleanup.sgml doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
R100 contrib/pg_archivecleanup/.gitignore src/bin/pg_archivecleanup/.gitignore
A src/bin/pg_archivecleanup/Makefile
R099 contrib/pg_archivecleanup/pg_archivecleanup.c src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/tools/msvc/Mkvcbuild.pm

Optimize locking a tuple already locked by another subxact

commit   : 27846f02c176eebe7e08ce51ed4d52140454e196    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 10 Apr 2015 13:47:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 10 Apr 2015 13:47:15 -0300    

Click here for diff

Locking and updating the same tuple repeatedly led to some strange  
multixacts being created which had several subtransactions of the same  
parent transaction holding locks of the same strength.  However,  
once a subxact of the current transaction holds a lock of a given  
strength, it's not necessary to acquire the same lock again.  This made  
some coding patterns much slower than required.  
  
The fix is twofold.  First we change HeapTupleSatisfiesUpdate to return  
HeapTupleBeingUpdated for the case where the current transaction is  
already a single-xid locker for the given tuple; it used to return  
HeapTupleMayBeUpdated for that case.  The new logic is simpler, and the  
change to pgrowlocks is a testament to that: previously we needed to  
check for the single-xid locker separately in a very ugly way.  That  
test is simpler now.  
  
As fallout from the HTSU change, some of its callers need to be amended  
so that tuple-locked-by-own-transaction is taken into account in the  
BeingUpdated case rather than the MayBeUpdated case.  For many of them  
there is no difference; but heap_delete() and heap_update now check  
explicitely and do not grab tuple lock in that case.  
  
The HTSU change also means that routine MultiXactHasRunningRemoteMembers  
introduced in commit 11ac4c73cb895 is no longer necessary and can be  
removed; the case that used to require it is now handled naturally as  
result of the changes to heap_delete and heap_update.  
  
The second part of the fix to the performance issue is to adjust  
heap_lock_tuple to avoid the slowness:  
  
1. Previously we checked for the case that our own transaction already  
held a strong enough lock and returned MayBeUpdated, but only in the  
multixact case.  Now we do it for the plain Xid case as well, which  
saves having to LockTuple.  
  
2. If the current transaction is the only locker of the tuple (but with  
a lock not as strong as what we need; otherwise it would have been  
caught in the check mentioned above), we can skip sleeping on the  
multixact, and instead go straight to create an updated multixact with  
the additional lock strength.  
  
3. Most importantly, make sure that both the single-xid-locker case and  
the multixact-locker case optimization are applied always.  We do this  
by checking both in a single place, rather than them appearing in two  
separate portions of the routine -- something that is made possible by  
the HeapTupleSatisfiesUpdate API change.  Previously we would only check  
for the single-xid case when HTSU returned MayBeUpdated, and only  
checked for the multixact case when HTSU returned BeingUpdated.  This  
was at odds with what HTSU actually returned in one case: if our own  
transaction was locker in a multixact, it returned MayBeUpdated, so the  
optimization never applied.  This is what led to the large multixacts in  
the first place.  
  
Per bug report #8470 by Oskari Saarenmaa.  

M contrib/pgrowlocks/pgrowlocks.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/multixact.c
M src/backend/utils/time/tqual.c
M src/include/access/multixact.h

libpq: Don't overwrite existing OpenSSL thread callbacks

commit   : 8a0d34e4e45d44884ebdc6cb9d9ad9c3891d8505    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Apr 2015 20:45:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Apr 2015 20:45:34 -0400    

Click here for diff

If someone else already set the callbacks, don't overwrite them with  
ours.  When unsetting the callbacks, only unset them if they point to  
ours.  
  
Author: Jan Urbański <[email protected]>  

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

Show owner of types in psql \dT+

commit   : a6f3c1f1e2c365dd7dee1e944389d62bf62aa22e    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 9 Apr 2015 21:39:35 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 9 Apr 2015 21:39:35 +0200    

Click here for diff

M src/bin/psql/describe.c

Make SSL regression test suite more portable by avoiding cp.

commit   : 5d79b67bdd57c2fed3e66f5102bd79e88ecb5af3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Apr 2015 22:07:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Apr 2015 22:07:18 +0300    

Click here for diff

Use perl 'glob' and File::Copy instead of "cp". This takes us one step  
closer to running the suite on Windows.  
  
Michael Paquier  

M src/test/ssl/ServerSetup.pm

Gitignore temp files generated by SSL regression suite

commit   : 0fb256dc8291657489e75ebb9cedc9a5012348ef    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Apr 2015 21:58:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Apr 2015 21:58:10 +0300    

Click here for diff

Michael Paquier  

A src/test/ssl/.gitignore

Fix typo

commit   : c9970ab937d53a169e3e9e6522963db7a530b7ee    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 9 Apr 2015 14:15:39 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 9 Apr 2015 14:15:39 +0200    

Click here for diff

Michael Paquier  

M src/tools/msvc/Mkvcbuild.pm

Fix incorrect punctuation

commit   : 8ae4600cd9a079981168def863edb38ef237da6c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 9 Apr 2015 13:35:30 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 9 Apr 2015 13:35:30 +0200    

Click here for diff

Amit Langote  

M doc/src/sgml/mvcc.sgml

Fix typo in eb68379c3.

commit   : 06d36fa40c5bf86004f9c968552f7cdb8f606d6d    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 9 Apr 2015 13:29:22 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 9 Apr 2015 13:29:22 +0200    

Click here for diff

I'd accidentally missed to rename PG_FORCE_NULL to BKI_FORCE_NULL in one  
place.  
  
Author: Jeevan Chalke  
Discussion: CAM2+6=VPoow5PqgqiTjPX4QNeokb7op8aD_8Zg3QnHZMvvU0GQ@mail.gmail.com  

M src/backend/catalog/Catalog.pm

Remove obsolete FORCE option from REINDEX.

commit   : 17d436d2e894a91f3e8a9eb1bb1688cb515f1546    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2015 11:31:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2015 11:31:42 +0900    

Click here for diff

FORCE option has been marked "obsolete" since very old version 7.4  
but existed for backwards compatibility. Per discussion on pgsql-hackers,  
we concluded that it's no longer worth keeping supporting the option.  

M doc/src/sgml/ref/reindex.sgml
M src/backend/parser/gram.y

Change SQLSTATE for event triggers "wrong context" message

commit   : 73206812cd97436cffd8f331dbb09d38a2728162    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Apr 2015 15:26:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Apr 2015 15:26:50 -0300    

Click here for diff

When certain event-trigger-only functions are called when not in the  
wrong context, they were reporting the "feature not supported" SQLSTATE,  
which is somewhat misleading.  Create a new custom error code for such  
uses instead.  
  
Not backpatched since it may be seen as an undesirable behavioral  
change.  
  
Author: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAB7nPqQ-5NAkHQHh_NOm7FPep37NCiLKwPoJ2Yxb8TDoGgbYYA@mail.gmail.com  

M src/backend/commands/event_trigger.c
M src/backend/utils/errcodes.txt

Fix autovacuum launcher shutdown sequence

commit   : 5df64f298d2863c9fb39437abb3ae6f988aedc0a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Apr 2015 13:19:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Apr 2015 13:19:49 -0300    

Click here for diff

It was previously possible to have the launcher re-execute its main loop  
before shutting down if some other signal was received or an error  
occurred after getting SIGTERM, as reported by Qingqing Zhou.  
  
While investigating, Tom Lane further noticed that if autovacuum had  
been disabled in the config file, it would misbehave by trying to start  
a new worker instead of bailing out immediately -- it would consider  
itself as invoked in emergency mode.  
  
Fix both problems by checking the shutdown flag in a few more places.  
These problems have existed since autovacuum was introduced, so  
backpatch all the way back.  

M src/backend/postmaster/autovacuum.c

libpq: add newlines to SSPI error messages

commit   : e4f1e0d842fa8e52d5972b19677ede5c36f44e98    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 8 Apr 2015 10:28:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 8 Apr 2015 10:28:47 -0400    

Click here for diff

Report by Tom Lane  

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

libpq: issue clear error message for nested service files

commit   : 90a8b1f82b826ebe18a70e47dec3b342d7fcd8d9    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 8 Apr 2015 10:26:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 8 Apr 2015 10:26:21 -0400    

Click here for diff

Previously an odd error message was generated.  Nested service files are  
not supported.  
  
Report by David Johnston  

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

Fix typo in comment.

commit   : 026fafde9159046ad26d0ccba92be0e802c70e92    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2015 20:55:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2015 20:55:43 +0900    

Click here for diff

M src/backend/catalog/index.c

Add file_ops.c to GETTEXT_FILES in nls.mk.

commit   : 29407f97746ba2543b1845afe8ae22af09d43e45    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2015 13:46:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2015 13:46:58 +0900    

Click here for diff

Since file_ops.c contains translatable strings, it should have been listed  
in GETTEXT_FILES.  

M src/bin/pg_rewind/nls.mk

Make trace_sort control abbreviation debug output for the text opclass.

commit   : aea652abd3b6e41eeab58e14dfe3d3120592b443    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Apr 2015 22:45:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Apr 2015 22:45:17 -0400    

Click here for diff

This is consistent with what the new numeric suppor for abbreviated keys  
now does, and seems much more convenient than having a separate compiler  
define to control this debug output.  
  
Peter Geoghegan  

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

Mark the second argument of pg_log as the translatable string in nls.mk.

commit   : b216ad7bf1a9308c97d2032d4793010e8c8aa7ec    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2015 11:06:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2015 11:06:25 +0900    

Click here for diff

M src/bin/pg_rewind/nls.mk

Fix assorted inconsistent function declarations.

commit   : 393de3a09868458dfb7ef765c544c34624ea1da2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2015 16:56:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2015 16:56:21 -0400    

Click here for diff

While gcc doesn't complain if you declare a function "static" and then  
define it not-static, other compilers do; and in any case the code is  
highly misleading this way.  Add the missing "static" keywords to a  
couple of recent patches.  Per buildfarm member pademelon.  

M src/bin/pg_rewind/parsexlog.c

Fix reporting of missing or invalid command line arguments in pg_rewind.

commit   : ee075fcb130f834bd5913940b97ad53fd4d21e93    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Apr 2015 23:28:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Apr 2015 23:28:28 +0300    

Click here for diff

pg_fatal never returns, so a multi-line message cannot be printed by  
calling it twice.  
  
Michael Paquier and Fujii Masao  

M src/bin/pg_rewind/pg_rewind.c

Remove variable shadowing

commit   : 4e17e32f53c2de4a862ee5ef8bdcfa9152c11e25    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2015 17:14:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2015 17:14:00 -0300    

Click here for diff

Commit a2e35b53 should have removed the variable declaration in the  
inner block, but didn't.  As a result, the returned address might end up  
not being what was intended.  

M src/backend/commands/alter.c

Fix process startup in pg_rewind.

commit   : 8a06c36aff4a94e5ffc3876cd85a1a16a82c754e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Apr 2015 23:04:25 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Apr 2015 23:04:25 +0300    

Click here for diff

Don't allow pg_rewind to run as root on Unix platforms, as any new or  
replaced files in the data directory would become owned by root. On Windows,  
it can run under a user that has Administrator rights, but a restricted  
token needs to be used. This is the same we do e.g. in pg_resetxlog.  
  
Also, add missing set_pglocale_pgservice() call, to fix localization.  
  
Michael Paquier and Fujii Masao  

M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/pg_rewind.c

Fix spelling of author's name

commit   : 1cdf4d0b6ac41e200d904d3fe293e43e07fd3e3c    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 7 Apr 2015 14:04:29 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 7 Apr 2015 14:04:29 -0400    

Click here for diff

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

pg_event_trigger_dropped_objects: add is_temp column

commit   : e9a077cad3799b41e8deef6fd8cb87e50164a791    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 6 Apr 2015 11:40:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 6 Apr 2015 11:40:55 -0300    

Click here for diff

It now also reports temporary objects dropped that are local to the  
backend.  Previously we weren't reporting any temp objects because it  
was deemed unnecessary; but as it turns out, it is necessary if we want  
to keep close track of DDL command execution inside one session.  Temp  
objects are reported as living in schema pg_temp, which works because  
such a schema-qualification always refers to the temp objects of the  
current session.  

M doc/src/sgml/func.sgml
M src/backend/catalog/objectaddress.c
M src/backend/commands/event_trigger.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Fix object identities for pg_conversion objects

commit   : 70dc2db7f1dfdecdacf595bf00964cb20ad5a835    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 6 Apr 2015 11:15:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 6 Apr 2015 11:15:13 -0300    

Click here for diff

This was already fixed in 0d906798f, but I failed to update the  
array-formatted case.  This is not backpatched, since this only affects  
the code path introduced by commit a676201490c.  

M src/backend/catalog/objectaddress.c

Fix typo in libpq.sgml.

commit   : 5f6a9d056a3ba8ba66cace5d84e46caadc6e3a42    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 6 Apr 2015 12:15:20 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 6 Apr 2015 12:15:20 +0900    

Click here for diff

Back-patch to all supported versions.  
  
Michael Paquier  

M doc/src/sgml/libpq.sgml

Suppress clang's unhelpful gripes about -pthread switch being unused.

commit   : 73b416b2e41237b657d29d8f42a4bb34bf700928    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Apr 2015 13:01:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Apr 2015 13:01:55 -0400    

Click here for diff

Considering the number of cases in which "unused" command line arguments  
are silently ignored by compilers, it's fairly astonishing that anybody  
thought this warning was useful; it's certainly nothing but an annoyance  
when building Postgres.  One such case is that neither gcc nor clang  
complain about unrecognized -Wno-foo switches, making it more difficult  
to figure out whether the switch does anything than one could wish.  
  
Back-patch to 9.3, which is as far back as the patch applies conveniently  
(we'd have to back-patch PGAC_PROG_CC_VAR_OPT to go further, and it doesn't  
seem worth that).  

M configure
M configure.in

Remove extraneous >

commit   : e8fde1f6a0495d52ddfe46e38e9f281fc11400c9    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 5 Apr 2015 12:35:24 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 5 Apr 2015 12:35:24 -0400    

Click here for diff

M doc/src/sgml/mvcc.sgml

Add new test files for lock level patch

commit   : 35ecc244073a25cc99d76e42f99eb9476a2f8ab3    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 5 Apr 2015 12:03:58 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 5 Apr 2015 12:03:58 -0400    

Click here for diff

A src/test/isolation/expected/alter-table-2.out
A src/test/isolation/expected/alter-table-3.out
A src/test/isolation/expected/create-trigger.out
A src/test/isolation/specs/alter-table-2.spec
A src/test/isolation/specs/alter-table-3.spec
A src/test/isolation/specs/create-trigger.spec

Enable float8-byval as the default for 64 bit MSVC builds

commit   : cf376a4adc0805b0960a5f8e8325fae7d4456926    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 5 Apr 2015 11:49:49 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 5 Apr 2015 11:49:49 -0400    

Click here for diff

This is a long-standing inconsistency that was probably just missed when  
we got 64 bit MSVC builds. This brings the platform into line with all  
other systems.  

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

Reduce lock levels of some trigger DDL and add FKs

commit   : 0ef0396ae1687bf738d4703773d55467c36b2bcd    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 5 Apr 2015 11:37:08 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 5 Apr 2015 11:37:08 -0400    

Click here for diff

Reduce lock levels to ShareRowExclusive for the following SQL  
 CREATE TRIGGER (but not DROP or ALTER)  
 ALTER TABLE ENABLE TRIGGER  
 ALTER TABLE DISABLE TRIGGER  
 ALTER TABLE … ADD CONSTRAINT FOREIGN KEY  
  
Original work by Simon Riggs, extracted and refreshed by Andreas Karlsson  
New test cases added by Andreas Karlsson  
Reviewed by Noah Misch, Andres Freund, Michael Paquier and Simon Riggs  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/test/isolation/expected/alter-table-1.out
M src/test/isolation/isolation_schedule
M src/test/regress/expected/alter_table.out

Fix incorrect matching of subexpressions in outer-join plan nodes.

commit   : ca6805338fba010cc3f8b842905d7a62e280b7ab    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Apr 2015 19:55:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Apr 2015 19:55:15 -0400    

Click here for diff

Previously we would re-use input subexpressions in all expression trees  
attached to a Join plan node.  However, if it's an outer join and the  
subexpression appears in the nullable-side input, this is potentially  
incorrect for apparently-matching subexpressions that came from above  
the outer join (ie, targetlist and qpqual expressions), because the  
executor will treat the subexpression value as NULL when maybe it should  
not be.  
  
The case is fairly hard to hit because (a) you need a non-strict  
subexpression (else NULL is correct), and (b) we don't usually compute  
expressions in the outputs of non-toplevel plan nodes.  But we might do  
so if the expressions are sort keys for a mergejoin, for example.  
  
Probably in the long run we should make a more explicit distinction between  
Vars appearing above and below an outer join, but that will be a major  
planner redesign and not at all back-patchable.  For the moment, just hack  
set_join_references so that it will not match any non-Var expressions  
coming from nullable inputs to expressions that came from above the join.  
(This is somewhat overkill, in that a strict expression could still be  
matched, but it doesn't seem worth the effort to check that.)  
  
Per report from Qingqing Zhou.  The added regression test case is based  
on his example.  
  
This has been broken for a very long time, so back-patch to all active  
branches.  

M src/backend/optimizer/plan/setrefs.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix TAP tests to use only standard command-line argument ordering.

commit   : c67a86f7da90c30b81f91957023fb752f06f0598    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Apr 2015 13:34:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Apr 2015 13:34:23 -0400    

Click here for diff

Some of the TAP tests were supposing that PG programs would accept switches  
after non-switch arguments on their command lines.  While GNU getopt_long()  
does allow that, our own implementation does not, and it's nowhere  
suggested in our documentation that such cases should work.  Adjust the  
tests to use only the documented syntax.  
  
Back-patch to 9.4, since without this the TAP tests fail when run with  
src/port's getopt_long() implementation.  
  
Michael Paquier  

M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/090_reindexdb.pl

Fix numeric abbreviation for --disable-float8-byval.

commit   : 368b7c601e3a7ce927602b5399e4b117d71bae31    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2015 22:34:37 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2015 22:34:37 -0400    

Click here for diff

When committing abd94bcac4582903765be7be959d1dbc121df0d0, I tried to make  
it decide what kind of abbreviation to use based only on SIZEOF_DATUM,  
without regard to USE_FLOAT8_BYVAL.  That attempt was a few bricks short  
of a load, so try to fix it, and add a comment explaining what we're  
about.  
  
Patch by me; review (but not a full endorsement) by Andrew Gierth.  

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

Remove unnecessary variables in _hash_splitbucket().

commit   : b7e1652d5de8b618c0204588969c8b59d12e9361    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2015 16:49:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2015 16:49:11 -0400    

Click here for diff

Commit ed9cc2b5df59fdbc50cce37399e26b03ab2c1686 made it unnecessary to pass  
start_nblkno to _hash_splitbucket(), and for that matter unnecessary to  
have the internal nblkno variable either.  My compiler didn't complain  
about that, but some did.  I also rearranged the use of oblkno a bit to  
make that case more parallel.  
  
Report and initial patch by Petr Jelinek, rearranged a bit by me.  
Back-patch to all branches, like the previous patch.  

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

Transform ALTER TABLE/SET TYPE/USING expr during parse analysis

commit   : 9550e8348b7965715789089555bb5a3fda8c269c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2015 17:33:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2015 17:33:05 -0300    

Click here for diff

This lets later stages have access to the transformed expression; in  
particular it allows DDL-deparsing code during event triggers to pass  
the transformed expression to ruleutils.c, so that the complete command  
can be deparsed.  
  
This shuffles the timing of the transform calls a bit: previously,  
nothing was transformed during parse analysis, and only the  
RELKIND_RELATION case was being handled during execution.  After this  
patch, all expressions are transformed during parse analysis (including  
those for relkinds other than RELATION), and the error for other  
relation kinds is thrown only during execution.  So we do more work than  
before to reject some bogus cases.  That seems acceptable.  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c

Add log_min_autovacuum_duration per-table option

commit   : 4ff695b17d32a9c330952192dbc789d31a5e2f5e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2015 11:55:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2015 11:55:50 -0300    

Click here for diff

This is useful to control autovacuum log volume, for situations where  
monitoring only a set of tables is necessary.  
  
Author: Michael Paquier  
Reviewed by: A team led by Naoya Anzai (also including Akira Kurosawa,  
Taiki Kondo, Huong Dangminh), Fujii Masao.  

M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/include/commands/vacuum.h
M src/include/utils/rel.h

Have autovacuum workers listen to SIGHUP, too

commit   : a75fb9b335db0e063ece283ebd207530abe1b53b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2015 11:52:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2015 11:52:55 -0300    

Click here for diff

They have historically ignored it, but it's been said to be useful at  
times to change their settings mid-flight.  
  
Author: Michael Paquier  

M src/backend/postmaster/autovacuum.c

Fix error handling of XLogReaderAllocate in case of OOM

commit   : 6e4bf4ecd3c2a266870139462a079809dfe7ab8c    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 21:55:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 21:55:37 +0900    

Click here for diff

Similarly to previous fix 9b8d478, commit 2c03216 has switched  
XLogReaderAllocate() to use a set of palloc calls instead of malloc,  
causing any callers of this function to fail with an error instead of  
receiving a NULL pointer in case of out-of-memory error. Fix this by  
using palloc_extended with MCXT_ALLOC_NO_OOM that will safely return  
NULL in case of an OOM.  
  
Michael Paquier, slightly modified by me.  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/logical/logical.c
M src/bin/pg_rewind/parsexlog.c

Change the way we decide whether to give up on abbreviated text keys.

commit   : f85155e18cb71a599724536e598e8d6f5e140454    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2015 08:32:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2015 08:32:05 -0400    

Click here for diff

Be more aggressive about aborting early on if it looks like it's not  
helping, but be less aggressive about aborting later on, since it's  
more expensive at that point, and also since we're currently aborting  
in some cases where abbreviation can still deliver a substantial win.  
  
Peter Geoghegan. Extensive testing by Tomas Vondra.  

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

Rework handling of OOM when allocating record buffer in XLOG reader.

commit   : 9b8d4782ba0f75eb0f029c743bb85166999d9fa5    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 18:29:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 18:29:38 +0900    

Click here for diff

Commit 2c03216 changed allocate_recordbuf() so that it uses a palloc to  
allocate the read buffer and fails immediately when an out-of-memory error  
shows up, even though its callers still expect that NULL is returned in that  
case. This bug is fixed making allocate_recordbuf() use a palloc_extended  
with MCXT_ALLOC_NO_OOM flag and return NULL in OOM case.  
  
Michael Paquier  

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

Add palloc_extended for frontend and backend.

commit   : 8c8a886268dfa616193dadc98e44e0715f884614    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 17:36:12 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 17:36:12 +0900    

Click here for diff

This commit also adds pg_malloc_extended for frontend. These interfaces  
can be used to control at a lower level memory allocation using an interface  
similar to MemoryContextAllocExtended. For example, the callers can specify  
MCXT_ALLOC_NO_OOM if they want to suppress the "out of memory" error while  
allocating the memory and handle a NULL return value.  
  
Michael Paquier, reviewed by me.  

M src/backend/utils/mmgr/mcxt.c
M src/common/fe_memutils.c
M src/include/common/fe_memutils.h
M src/include/utils/palloc.h

Fix rare startup failure induced by MVCC-catalog-scans patch.

commit   : bc49d9324a464fce8f60e1bc14531631883021d4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2015 00:07:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2015 00:07:29 -0400    

Click here for diff

While a new backend nominally participates in sinval signaling starting  
from the SharedInvalBackendInit call near the top of InitPostgres, it  
cannot recognize sinval messages for unshared catalogs of its database  
until it has set up MyDatabaseId.  This is not problematic for the catcache  
or relcache, which by definition won't have loaded any data from or about  
such catalogs before that point.  However, commit 568d4138c646cd7c  
introduced a mechanism for re-using MVCC snapshots for catalog scans, and  
made invalidation of those depend on recognizing relevant sinval messages.  
So it's possible to establish a catalog snapshot to read pg_authid and  
pg_database, then before we set MyDatabaseId, receive sinval messages that  
should result in invalidating that snapshot --- but do not, because we  
don't realize they are for our database.  This mechanism explains the  
intermittent buildfarm failures we've seen since commit 31eae6028eca4365.  
That commit was not itself at fault, but it introduced a new regression  
test that does reconnections concurrently with the "vacuum full pg_am"  
command in vacuum.sql.  This allowed the pre-existing error to be exposed,  
given just the right timing, because we'd fail to update our information  
about how to access pg_am.  In principle any VACUUM FULL on a system  
catalog could have created a similar hazard for concurrent incoming  
connections.  Perhaps there are more subtle failure cases as well.  
  
To fix, force invalidation of the catalog snapshot as soon as we've  
set MyDatabaseId.  
  
Back-patch to 9.4 where the error was introduced.  

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

Add markup for replaceable parameters to pg_rewind doc.

commit   : 5e3d289f9b7d7e67ee0294e9221bb681594b7668    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 12:21:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2015 12:21:16 +0900    

Click here for diff

M doc/src/sgml/ref/pg_rewind.sgml

Improve pgbench error reporting.

commit   : e41beea0ddb74ef975f08b917a354ec33cb60830    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 16:26:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 16:26:49 -0400    

Click here for diff

This would have been worth doing on general principle anyway, but the  
recent addition of an expression syntax to pgbench makes it an even  
better idea than it would have been otherwise.  
  
Fabien Coelho  

M contrib/pgbench/exprscan.l
M contrib/pgbench/pgbench.c
M contrib/pgbench/pgbench.h

Repair stupid mistake in preprocessor directive.

commit   : 05cce2f9030abfb5e674afb5cdb98aaa6be3930f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 15:57:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 15:57:17 -0400    

Click here for diff

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

After a crash, don't restart workers with BGW_NEVER_RESTART.

commit   : b3a5e76e126553d2a553694d3c54ac9e48b3a4a2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 14:38:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 14:38:06 -0400    

Click here for diff

Amit Khandekar  

M src/backend/postmaster/bgworker.c

Use abbreviated keys for faster sorting of numeric datums.

commit   : abd94bcac4582903765be7be959d1dbc121df0d0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 14:02:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 14:02:55 -0400    

Click here for diff

Andrew Gierth, reviewed by Peter Geoghegan, with further tweaks by me.  

M src/backend/utils/adt/numeric.c
M src/backend/utils/misc/guc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/include/utils/guc.h

autovacuum: Fix polarity of "wraparound" variable

commit   : 00ee6c7672fe0bf9448bc744b5e3408f5ebffc2e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 2 Apr 2015 13:34:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 2 Apr 2015 13:34:50 -0300    

Click here for diff

Commit 0d831389749a3 inadvertently reversed the meaning of the  
wraparound variable.  This causes vacuums which are not required for  
wraparound to wait for locks to be acquired, and what is worse, it  
allows wraparound vacuums to skip locked pages.  
  
Bug reported by Jeff Janes in  
http://www.postgresql.org/message-id/CAMkU=1xmTEiaY=5oMHsSQo5vd9V1Ze4kNLL0qN2eH0P_GXOaYw@mail.gmail.com  
Analysis and patch by Kyotaro HORIGUCHI  

M src/backend/postmaster/autovacuum.c

Add missing calls to DatumGetUInt32.

commit   : c02ef232c14d65741df939ddd633d8fed538a580    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 11:57:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 11:57:35 -0400    

Click here for diff

These were inadvertently ommitted from the commit that introduced  
abbreviated keys, commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23.  
  
Peter Geoghegan  

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

Define integer limits independently from the system definitions.

commit   : 62e2a8dc2c7f6b1351a0385491933af969ed4265    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 2 Apr 2015 17:43:35 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 2 Apr 2015 17:43:35 +0200    

Click here for diff

In 83ff1618 we defined integer limits iff they're not provided by the  
system. That turns out not to be the greatest idea because there's  
different ways some datatypes can be represented. E.g. on OSX PG's 64bit  
datatype will be a 'long int', but OSX unconditionally uses 'long  
long'. That disparity then can lead to warnings, e.g. around printf  
formats.  
  
One way to fix that would be to back int64 using stdint.h's  
int64_t. While a good idea it's not that easy to implement. We would  
e.g. need to include stdint.h in our external headers, which we don't  
today. Also computing the correct int64 printf formats in that case is  
nontrivial.  
  
Instead simply prefix the integer limits with PG_ and define them  
unconditionally. I've adjusted all the references to them in code, but  
not the ones in comments; the latter seems unnecessary to me.  
  
Discussion: [email protected]  

M contrib/btree_gist/btree_ts.c
M contrib/pgbench/pgbench.c
M src/backend/access/transam/xlog.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/txid.c
M src/include/c.h
M src/include/datatype/timestamp.h
M src/include/executor/instrument.h
M src/include/nodes/parsenodes.h
M src/include/pg_config_manual.h
M src/include/port/atomics.h
M src/include/storage/predicate_internals.h
M src/include/utils/date.h

psql: fix \connect with URIs and conninfo strings

commit   : e146ca682062ca1f5015f3820571c5359f5f9dba    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 2 Apr 2015 12:30:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 2 Apr 2015 12:30:57 -0300    

Click here for diff

This is the second try at this, after fcef1617295 failed miserably and  
had to be reverted: as it turns out, libpq cannot depend on libpgcommon  
after all. Instead of shuffling code in the master branch, make that one  
just like 9.4 and accept the duplication.  (This was all my own mistake,  
not the patch submitter's).  
  
psql was already accepting conninfo strings as the first parameter in  
\connect, but the way it worked wasn't sane; some of the other  
parameters would get the previous connection's values, causing it to  
connect to a completely unexpected server or, more likely, not finding  
any server at all because of completely wrong combinations of  
parameters.  
  
Fix by explicitely checking for a conninfo-looking parameter in the  
dbname position; if one is found, use its complete specification rather  
than mix with the other arguments.  Also, change tab-completion to not  
try to complete conninfo/URI-looking "dbnames" and document that  
conninfos are accepted as first argument.  
  
There was a weak consensus to backpatch this, because while the behavior  
of using the dbname as a conninfo is nowhere documented for \connect, it  
is reasonable to expect that it works because it does work in many other  
contexts.  Therefore this is backpatched all the way back to 9.0.  
  
Author: David Fetter, Andrew Dunstan.  Some editorialization by me  
(probably earning a Gierth's "Sloppy" badge in the process.)  
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,  
Robert Haas, Andrew Dunstan.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/interfaces/libpq/fe-connect.c

Fix another bug in DSM_CREATE_NULL_IF_MAXSEGMENTS handling.

commit   : f272098e91708eecdfafb706b3a3409dd9593f10    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 10:39:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 10:39:24 -0400    

Click here for diff

Amit Kapila  

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

Revert "psql: fix \connect with URIs and conninfo strings"

commit   : 4cd639baf4bd35dd7fc924009203349b81bdcd68    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 10:10:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2015 10:10:22 -0400    

Click here for diff

This reverts commit fcef1617295c074f2684c887627184d2fc26ac04, about  
which both the buildfarm and my local machine are very unhappy.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/common/Makefile
D src/common/connstrings.c
D src/include/common/connstrings.h
M src/interfaces/libpq/fe-connect.c

Correct comment to use RS_EPHEMERAL

commit   : 7dae3cf68cf59c37163df42fb0d2b66fed9996f4    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 2 Apr 2015 07:45:19 -0400    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 2 Apr 2015 07:45:19 -0400    

Click here for diff

M src/backend/replication/slot.c

psql: fix \connect with URIs and conninfo strings

commit   : fcef1617295c074f2684c887627184d2fc26ac04    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Apr 2015 20:00:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Apr 2015 20:00:07 -0300    

Click here for diff

psql was already accepting conninfo strings as the first parameter in  
\connect, but the way it worked wasn't sane; some of the other  
parameters would get the previous connection's values, causing it to  
connect to a completely unexpected server or, more likely, not finding  
any server at all because of completely wrong combinations of  
parameters.  
  
Fix by explicitely checking for a conninfo-looking parameter in the  
dbname position; if one is found, use its complete specification rather  
than mix with the other arguments.  Also, change tab-completion to not  
try to complete conninfo/URI-looking "dbnames" and document that  
conninfos are accepted as first argument.  
  
There was a weak consensus to backpatch this, because while the behavior  
of using the dbname as a conninfo is nowhere documented for \connect, it  
is reasonable to expect that it works because it does work in many other  
contexts.  Therefore this is backpatched all the way back to 9.0.  
  
To implement this, routines previously private to libpq have been  
duplicated so that psql can decide what looks like a conninfo/URI  
string.  In back branches, just duplicate the same code all the way back  
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.  
In master, the routines are moved to src/common and renamed.  
  
Author: David Fetter, Andrew Dunstan.  Some editorialization by me  
(probably earning a Gierth's "Sloppy" badge in the process.)  
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,  
Robert Haas, Andrew Dunstan.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/common/Makefile
A src/common/connstrings.c
A src/include/common/connstrings.h
M src/interfaces/libpq/fe-connect.c

pg_upgrade: call 'postgres' binary to get data directory location

commit   : a0efc714531d3dfd02fafd39e80d058cef6703b0    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 1 Apr 2015 18:25:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 1 Apr 2015 18:25:45 -0400    

Click here for diff

This matches the binary 'pg_ctl' calls.  Previously we called the  
'postmaster'.  
  
Report by Christoph Berg  

M contrib/pg_upgrade/option.c

Provide real selectivity estimators for inet/cidr operators.

commit   : 89840d7d3fa943cb932f6a00707fdb17a9cab001    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2015 17:11:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2015 17:11:21 -0400    

Click here for diff

This patch fills in the formerly-stub networksel() and networkjoinsel()  
estimation functions.  Those are used for << <<= >> >>= and && operators  
on inet/cidr types.  The estimation is not perfect, certainly, because  
we rely on the existing statistics collected for the inet btree operators.  
But it's a long way better than nothing, and it's not clear that asking  
ANALYZE to collect separate stats for these operators would be a win.  
  
Emre Hasegeli, with reviews from Dilip Kumar and Heikki Linnakangas,  
and some further hacking by me  

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

Move inet/cidr GiST opclass functions to correct place in header file.

commit   : f770870d9e4d01f4b255a3df6c2c4a2dcfcbcce0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Apr 2015 19:16:35 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Apr 2015 19:16:35 +0300    

Click here for diff

They were accidentally placed under the GIN heading.  
  
Andreas Karlsson  

M src/include/catalog/pg_amproc.h

Fix incorrect markup in documentation of window frame clauses.

commit   : f6caf5acf1def92d7425151a92fd990c566fdcc3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2015 20:02:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2015 20:02:40 -0400    

Click here for diff

You're required to write either RANGE or ROWS to start a frame clause,  
but the documentation incorrectly implied this is optional.  Noted by  
David Johnston.  

M doc/src/sgml/ref/select.sgml
M doc/src/sgml/syntax.sgml

Make pg_ctl use SIGINT as a default shutdown signal.

commit   : 7a245bfe76125e32bb26f63893ee9f9fb0fa3ce2    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Apr 2015 02:10:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Apr 2015 02:10:24 +0900    

Click here for diff

The commit 0badb06 changed the default shutdown mode from smart to fast,  
but forgot to change the default shutdown signal from SIGTERM to SIGINT.  

M src/bin/pg_ctl/pg_ctl.c

initdb: remove unnecessary VACUUM FULL

commit   : ed7b3b3811c5836a54549caaa217314be3f16fd0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 11:51:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 11:51:39 -0400    

Click here for diff

Report by Peter Eisentraut  

M src/bin/initdb/initdb.c

pg_ctl: change default shutdown mode from 'smart' to 'fast'

commit   : 0badb069bc9f590dbc1306ccbd51e99ed81f228c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 11:46:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 11:46:27 -0400    

Click here for diff

Retain the order of the options in the documentation.  

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

psql: add asciidoc output format

commit   : 9d9991c84e64c0c5f568b3cdaf46bb91a1368b5a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 11:33:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 11:33:25 -0400    

Click here for diff

Patch by Szymon Guz, adjustments by me  
  
Testing by Michael Paquier, Pavel Stehule  

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

btree_gin: properly call DirectFunctionCall1()

commit   : 0cf16b44cb749cac2ff9dcbbe92bfb94f72bb0d0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 10:26:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2015 10:26:45 -0400    

Click here for diff

Previously we called DirectFunctionCall3() with dummy arguments.  Fixed  
version of previous patch.  
  
Report by Jon Nelson  

M contrib/btree_gin/btree_gin.c

Remove spurious semicolons.

commit   : 1d0db8de043c28c1e665451663ec101da5adc5ab    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 31 Mar 2015 15:12:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 31 Mar 2015 15:12:27 +0300    

Click here for diff

Petr Jelinek  

M contrib/postgres_fdw/deparse.c
M src/backend/parser/gram.y
M src/backend/replication/repl_gram.y
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/oracle_compat.c

Run pg_upgrade and pg_resetxlog with restricted token on Windows

commit   : fa1e5afa8a26d467aec7c8b36a0b749b690f636c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 30 Mar 2015 17:07:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 30 Mar 2015 17:07:52 -0400    

Click here for diff

As with initdb these programs need to run with a restricted token, and  
if they don't pg_upgrade will fail when run as a user with Adminstrator  
privileges.  
  
Backpatch to all live branches. On the development branch the code is  
reorganized so that the restricted token code is now in a single  
location. On the stable bramches a less invasive change is made by  
simply copying the relevant code to pg_upgrade.c and pg_resetxlog.c.  
  
Patches and bug report from Muhammad Asif Naeem, reviewed by Michael  
Paquier, slightly edited by me.  

M contrib/pg_upgrade/pg_upgrade.c
M src/bin/initdb/initdb.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/common/Makefile
A src/common/restricted_token.c
A src/include/common/restricted_token.h
M src/test/regress/pg_regress.c
M src/tools/msvc/Mkvcbuild.pm

Fix bogus concurrent use of _hash_getnewbuf() in bucket split code.

commit   : ed9cc2b5df59fdbc50cce37399e26b03ab2c1686    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2015 16:40:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2015 16:40:05 -0400    

Click here for diff

_hash_splitbucket() obtained the base page of the new bucket by calling  
_hash_getnewbuf(), but it held no exclusive lock that would prevent some  
other process from calling _hash_getnewbuf() at the same time.  This is  
contrary to _hash_getnewbuf()'s API spec and could in fact cause failures.  
In practice, we must only call that function while holding write lock on  
the hash index's metapage.  
  
An additional problem was that we'd already modified the metapage's bucket  
mapping data, meaning that failure to extend the index would leave us with  
a corrupt index.  
  
Fix both issues by moving the _hash_getnewbuf() call to just before we  
modify the metapage in _hash_expandtable().  
  
Unfortunately there's still a large problem here, which is that we could  
also incur ENOSPC while trying to get an overflow page for the new bucket.  
That would leave the index corrupt in a more subtle way, namely that some  
index tuples that should be in the new bucket might still be in the old  
one.  Fixing that seems substantially more difficult; even preallocating as  
many pages as we could possibly need wouldn't entirely guarantee that the  
bucket split would complete successfully.  So for today let's just deal  
with the base case.  
  
Per report from Antonin Houska.  Back-patch to all active branches.  

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

Change array_offset to return subscripts, not offsets

commit   : 97690ea6e86c412461dd5dc99953b829564d1a55    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Mar 2015 16:13:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Mar 2015 16:13:21 -0300    

Click here for diff

... and rename it and its sibling array_offsets to array_position and  
array_positions, to account for the changed behavior.  
  
Having the functions return subscripts better matches existing practice,  
and is better suited to using the result value as a subscript into the  
array directly.  For one-based arrays, the new definition is identical  
to what was originally committed.  
  
(We use the term "subscript" in the documentation, which is what we use  
whenever we talk about arrays; but the functions themselves are named  
using the word "position" to match the standard-defined POSITION()  
functions.)  
  
Author: Pavel Stěhule  
Behavioral problem noted by Dean Rasheed.  

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

Fix lost persistence setting during REINDEX INDEX

commit   : 0853630159944bb3652336602ff5f7f62cd27a5a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Mar 2015 16:01:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Mar 2015 16:01:44 -0300    

Click here for diff

ReindexIndex() trusts a parser-built RangeVar with the persistence to  
use for the new copy of the index; but the parser naturally does not  
know what's the persistence of the original index.  To find out the  
correct persistence, grab it from relcache.  
  
This bug was introduced by commit 85b506bbfc2937c9, and therefore no  
backpatch is necessary.  
  
Bug reported by Thom Brown, analysis and patch by Michael Paquier; test  
case provided by Fabrízio de Royes Mello.  

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

Be more careful about printing constants in ruleutils.c.

commit   : 542320c2bd0b3796a8a9a4617cdb23fbad473390    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2015 14:59:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2015 14:59:49 -0400    

Click here for diff

The previous coding in get_const_expr() tried to avoid quoting integer,  
float, and numeric literals if at all possible.  While that looks nice,  
it means that dumped expressions might re-parse to something that's  
semantically equivalent but not the exact same parsetree; for example  
a FLOAT8 constant would re-parse as a NUMERIC constant with a cast to  
FLOAT8.  Though the result would be the same after constant-folding,  
this is problematic in certain contexts.  In particular, Jeff Davis  
pointed out that this could cause unexpected failures in ALTER INHERIT  
operations because of child tables having not-exactly-equivalent CHECK  
expressions.  Therefore, favor correctness over legibility and dump  
such constants in quotes except in the limited cases where they'll  
be interpreted as the same type even without any casting.  
  
This results in assorted small changes in the regression test outputs,  
and will affect display of user-defined views and rules similarly.  
The odds of that causing problems in the field seem non-negligible;  
given the lack of previous complaints, it seems best not to change  
this in the back branches.  

M contrib/btree_gist/expected/float4.out
M contrib/btree_gist/expected/float8.out
M contrib/btree_gist/expected/int2.out
M contrib/btree_gist/expected/int8.out
M contrib/btree_gist/expected/numeric.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/equivclass.out
M src/test/regress/expected/join.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/union.out
M src/test/regress/expected/with.out

Fix rare core dump in BackendIdGetTransactionIds().

commit   : 701dcc983eb4d08dd36bb3a0ddba255819797760    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2015 13:05:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2015 13:05:27 -0400    

Click here for diff

BackendIdGetTransactionIds() neglected the possibility that the PROC  
pointer in a ProcState array entry is null.  In current usage, this could  
only crash if the other backend had exited since pgstat_read_current_status  
saw it as active, which is a pretty narrow window.  But it's reachable in  
the field, per bug #12918 from Vladimir Borodin.  
  
Back-patch to 9.4 where the faulty code was introduced.  

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

Add index-only scan support to range type GiST opclass.

commit   : 0633a60f4d2a2677db45d9261c94be9287e36d7c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 30 Mar 2015 13:21:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 30 Mar 2015 13:21:43 +0300    

Click here for diff

Andreas Karlsson  

M src/backend/utils/adt/rangetypes_gist.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/rangetypes.h
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

Clean up all the cruft after a pg_rewind test run.

commit   : 1c41e2a998a0de16d9d33949a7b98a5be3d2477c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 20:54:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 20:54:37 -0400    

Click here for diff

regress_log temp directory was properly .gitignore'd, which may explain  
why it got left out of the "make clean" action.  

M src/bin/pg_rewind/Makefile

Fix multiple bugs and infelicities in pg_rewind.

commit   : c67f366fa9f748257861ee233b47b80eb5ffa857    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 20:02:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 20:02:14 -0400    

Click here for diff

Bugs all spotted by Coverity, including wrong realloc() size request  
and memory leaks.  Cosmetic improvements by me.  
  
The usage of the global variable "filemap" here is still pretty awful,  
but at least I got rid of the gratuitous aliasing in several routines  
(which was helping to annoy Coverity, as well as being a bug risk).  

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/pg_rewind.c

Add vacuum_delay_point call in compute_index_stats's per-sample-row loop.

commit   : e4cbfd673d530a3e841db26a74f22e11a991205a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 15:04:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 15:04:09 -0400    

Click here for diff

Slow functions in index expressions might cause this loop to take long  
enough to make it worth being cancellable.  Probably it would be enough  
to call CHECK_FOR_INTERRUPTS here, but for consistency with other  
per-sample-row loops in this file, let's use vacuum_delay_point.  
  
Report and patch by Jeff Janes.  Back-patch to all supported branches.  

M src/backend/commands/analyze.c

Make ginbuild's funcCtx be independent of its tmpCtx.

commit   : 1601830ec20d56dc7bf6b60a34f69841429e4825    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 14:02:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 14:02:58 -0400    

Click here for diff

Previously the funcCtx was a child of the tmpCtx, but that was broken  
by commit eaa5808e8ec4e82ce1a87103a6b6f687666e4e4c, which made  
MemoryContextReset() delete, not reset, child contexts.  The behavior of  
having a tmpCtx reset also clear the other context seems rather dubious  
anyway, so let's just disentangle them.  Per report from Erik Rijkers.  
  
In passing, fix badly-inaccurate comments about these contexts.  

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

Remove a couple other vestigial yylex() declarations.

commit   : 9a8e23311cac14168df6644e03d533a4b07f933e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 13:12:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 13:12:28 -0400    

Click here for diff

These were workarounds for a long-gone flex bug; all supported versions  
of flex emit an extern declaration as expected.  

M src/backend/utils/misc/guc-file.l
M src/bin/psql/psqlscan.l

Minor code cleanups in pgbench expression support.

commit   : e9dd03c03aeed6486129e3101695b13d469c2985    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 13:06:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2015 13:06:59 -0400    

Click here for diff

Get rid of unnecessary expr_yylex declaration (we haven't supported  
flex 2.5.4 in a long time, and even if we still did, the declaration in  
pgbench.h makes this one unnecessary and inappropriate).  Fix copyright  
dates, improve some layout choices, etc.  

M contrib/pgbench/exprparse.y
M contrib/pgbench/exprscan.l
M contrib/pgbench/pgbench.h

Better fix for misuse of Float8GetDatumFast().

commit   : 2c33e0fbceb01d0ecd78330feef1315682c64bc4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Mar 2015 13:56:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Mar 2015 13:56:37 -0400    

Click here for diff

We can use that macro as long as we put the value into a local variable.  
Commit 735cd6128 was not wrong on its own terms, but I think this way  
looks nicer, and it should save a few cycles on 32-bit machines.  

M contrib/pg_stat_statements/pg_stat_statements.c

Add a pager_min_lines setting to psql

commit   : 7655f4ccea570d57c4d473cd66b755c03c904942    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 28 Mar 2015 11:07:41 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 28 Mar 2015 11:07:41 -0400    

Click here for diff

If set, the pager will not be used unless this many lines are to be  
displayed, even if that is more than the screen depth. Default is zero,  
meaning it's disabled.  
  
There is probably more work to be done in giving the user control over  
when the pager is used, particularly when wide output forces use of the  
pager regardless of how many lines there are, but this is a start.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/psql/startup.c
M src/test/regress/expected/psql.out

Use standard librart sqrt function in pg_stat_statements

commit   : cfe12763c32437bc708a64ce88a90c7544f16185    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 28 Mar 2015 09:22:51 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 28 Mar 2015 09:22:51 -0400    

Click here for diff

The stddev calculation included a faster but unportable sqrt function.  
This is not worth the extra effort, and won't work everywhere. If the  
standard library function is good enough for the SQL function it  
should be good enough here too.  

M contrib/pg_stat_statements/pg_stat_statements.c

Add index-only scan support to inet GiST opclass.

commit   : 3a20b0e7b6dae48cd6be1257e9017663f1402b91    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 28 Mar 2015 15:11:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 28 Mar 2015 15:11:53 +0200    

Click here for diff

Andreas Karlsson  

M src/backend/utils/adt/network_gist.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/inet.h
M src/test/regress/expected/inet.out
M src/test/regress/sql/inet.sql

Fix whitespace

commit   : 16bbb96a2b48d0f525b7fb2f6a001b16719467a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Mar 2015 19:50:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Mar 2015 19:50:55 -0400    

Click here for diff

M src/bin/psql/print.c

Add index-only scan support to btree_gist.

commit   : e09b48316c22fce727bce3c89fa64fc627787e6a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 27 Mar 2015 23:35:16 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 27 Mar 2015 23:35:16 +0200    

Click here for diff

inet, cidr, and timetz indexes still cannot support index-only scans,  
because they don't store the original unmodified value in the index, but a  
derived approximate value.  

M contrib/btree_gist/Makefile
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
A contrib/btree_gist/btree_gist–1.0–1.1.sql
R092 contrib/btree_gist/btree_gist–1.0.sql contrib/btree_gist/btree_gist–1.1.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/expected/bit.out
M contrib/btree_gist/expected/bytea.out
M contrib/btree_gist/expected/cash.out
M contrib/btree_gist/expected/char.out
M contrib/btree_gist/expected/char_1.out
M contrib/btree_gist/expected/date.out
M contrib/btree_gist/expected/float4.out
M contrib/btree_gist/expected/float8.out
M contrib/btree_gist/expected/int2.out
M contrib/btree_gist/expected/int4.out
M contrib/btree_gist/expected/int8.out
M contrib/btree_gist/expected/interval.out
M contrib/btree_gist/expected/macaddr.out
M contrib/btree_gist/expected/numeric.out
M contrib/btree_gist/expected/text.out
M contrib/btree_gist/expected/text_1.out
M contrib/btree_gist/expected/time.out
M contrib/btree_gist/expected/timestamp.out
M contrib/btree_gist/expected/timestamptz.out
M contrib/btree_gist/expected/varbit.out
M contrib/btree_gist/sql/bit.sql
M contrib/btree_gist/sql/bytea.sql
M contrib/btree_gist/sql/char.sql
M contrib/btree_gist/sql/macaddr.sql
M contrib/btree_gist/sql/numeric.sql
M contrib/btree_gist/sql/text.sql
M contrib/btree_gist/sql/varbit.sql

Fix portability issues with stddev in pg_stat_statements

commit   : 735cd6128a6a401671126443a9af4324932a38d6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 27 Mar 2015 17:29:59 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 27 Mar 2015 17:29:59 -0400    

Click here for diff

Stddev is calculated on the fly, and the code in commit 717f70953264 was  
using Float8GetDatumFast() inappropriately to convert the result to a  
Datum. Mea culpa. It now uses Float8GetDatum().  

M contrib/pg_stat_statements/pg_stat_statements.c

Add stats for min, max, mean, stddev times to pg_stat_statements.

commit   : 717f709532642f5f7756785c9be17b7ffcec8ae8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 27 Mar 2015 15:43:22 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 27 Mar 2015 15:43:22 -0400    

Click here for diff

The new fields are min_time, max_time, mean_time and stddev_time.  
  
Based on an original patch from Mitsumasa KONDO, modified by me. Reviewed by Petr Jelínek.  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/pg_stat_statements–1.2–1.3.sql
R084 contrib/pg_stat_statements/pg_stat_statements–1.2.sql contrib/pg_stat_statements/pg_stat_statements–1.3.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M doc/src/sgml/pgstatstatements.sgml

Minor refactoring of btree_gist code.

commit   : 8816af65e4f8285d3ef73158b09490099921f870    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 23:10:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 23:10:10 +0200    

Click here for diff

The gbt_var_key_copy function was doing two different things depending on  
the boolean argument. Seems cleaner to have two separate functions.  
  
Remove unused argument from gbt_num_compress.  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_utils_var.h

Fix GiST index-only scans for opclasses with different storage type.

commit   : 55b59eda13a742f8af913734e22ecc8a21754414    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 23:07:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 23:07:52 +0200    

Click here for diff

We cannot use the index's tuple descriptor directly to describe the index  
tuples returned in an index-only scan. That's because the index might use  
a different datatype for the values stored on disk than the type originally  
indexed. As long as they were both pass-by-ref, it worked, but will not work  
for pass-by-value types of different sizes. I noticed this as a crash when I  
started hacking a patch to add fetch methods to btree_gist.  

M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistutil.c
M src/include/access/gist_private.h

Tweak __attribute__-wrapping macros for better pgindent results.

commit   : 785941cdc359c6e595201ffb0df9d28f3f7173a4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2015 14:03:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2015 14:03:19 -0400    

Click here for diff

This improves on commit bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4 by  
making two simple changes:  
  
* pg_attribute_noreturn now takes parentheses, ie pg_attribute_noreturn().  
Likewise pg_attribute_unused(), pg_attribute_packed().  This reduces  
pgindent's tendency to misformat declarations involving them.  
  
* attributes are now always attached to function declarations, not  
definitions.  Previously some places were taking creative shortcuts,  
which were not merely candidates for bad misformatting by pgindent  
but often were outright wrong anyway.  (It does little good to put a  
noreturn annotation where callers can't see it.)  In any case, if  
we would like to believe that these macros can be used with non-gcc  
compilers, we should avoid gratuitous variance in usage patterns.  
  
I also went through and manually improved the formatting of a lot of  
declarations, and got rid of excessively repetitive (and now obsolete  
anyway) comments informing the reader what pg_attribute_printf is for.  

M contrib/cube/cube.c
M contrib/cube/cubedata.h
M contrib/cube/cubeparse.y
M contrib/cube/cubescan.l
M contrib/pg_upgrade/pg_upgrade.h
M contrib/pg_upgrade/util.c
M contrib/pg_xlogdump/pg_xlogdump.c
M contrib/pgcrypto/px.h
M contrib/seg/seg.c
M contrib/seg/segdata.h
M contrib/seg/segparse.y
M contrib/seg/segscan.l
M src/backend/access/transam/xlogreader.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_rewind/logging.h
M src/bin/psql/common.h
M src/bin/psql/large_obj.c
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/common/fe_memutils.h
M src/include/lib/stringinfo.h
M src/include/mb/pg_wchar.h
M src/include/parser/parse_relation.h
M src/include/parser/scanner.h
M src/include/pgstat.h
M src/include/port.h
M src/include/postgres.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.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/replication/walreceiver.h
M src/include/replication/walsender_private.h
M src/include/storage/ipc.h
M src/include/storage/itemptr.h
M src/include/storage/lock.h
M src/include/tcop/tcopprot.h
M src/include/utils/datetime.h
M src/include/utils/elog.h
M src/include/utils/help_config.h
M src/include/utils/palloc.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_elog.h
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/pg_regress.c

Add support for index-only scans in GiST.

commit   : d04c8ed9044eccebce043143a930617e3998c005    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 19:12:00 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 19:12:00 +0200    

Click here for diff

This adds a new GiST opclass method, 'fetch', which is used to reconstruct  
the original Datum from the value stored in the index. Also, the 'canreturn'  
index AM interface function gains a new 'attno' argument. That makes it  
possible to use index-only scans on a multi-column index where some of the  
opclasses support index-only scans but some do not.  
  
This patch adds support in the box and point opclasses. Other opclasses  
can added later as follow-on patches (btree_gist would be particularly  
interesting).  
  
Anastasia Lubennikova, with additional fixes and modifications by me.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/indexam.sgml
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistutil.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/spgscan.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/plancat.c
M src/include/access/genam.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/nodes/relation.h
M src/include/utils/geo_decls.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

Minor cleanup of GiST code, for readability.

commit   : 8fa393a6d739796d9f06a7fba91d7e1d0c354879    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 19:11:54 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 26 Mar 2015 19:11:54 +0200    

Click here for diff

Remove the gistcentryinit function, inlining the relevant part of it into  
the only caller.  

M src/backend/access/gist/gistutil.c
M src/include/access/gist_private.h

Suppress some unused-variable complaints in new LOCK_DEBUG code.

commit   : bed756a820a2c1ee359f5f5b44806e3599190e95    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2015 12:00:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2015 12:00:30 -0400    

Click here for diff

Jeff Janes  

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

Make SyncRepWakeQueue to a static function

commit   : 656ea810e5e1111bc4d741275b37310a32ff890c    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 26 Mar 2015 10:34:08 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 26 Mar 2015 10:34:08 +0900    

Click here for diff

It is only used in src/backend/replication/syncrep.c.  
  
Back-patch to all supported branches except 9.1 which declares the  
function as static.  

M src/backend/replication/syncrep.c
M src/include/replication/syncrep.h

Add an ASSERT statement in plpgsql.

commit   : a4847fc3ef139ba9a8ffebb6ffa06ee72078ffa2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2015 19:05:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2015 19:05:20 -0400    

Click here for diff

This is meant to make it easier to insert simple debugging cross-checks  
in plpgsql functions.  
  
Pavel Stehule, reviewed by Jim Nasby  

M doc/src/sgml/plpgsql.sgml
M src/backend/utils/errcodes.txt
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Centralize definition of integer limits.

commit   : 83ff1618bc9d4e530d3ef2a668a71326784a753c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Mar 2015 22:39:42 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Mar 2015 22:39:42 +0100    

Click here for diff

Several submitted and even committed patches have run into the problem  
that C89, our baseline, does not provide minimum/maximum values for  
various integer datatypes. C99's stdint.h does, but we can't rely on  
it.  
  
Several parts of the code defined limits locally, so instead centralize  
the definitions to c.h.  
  
This patch also changes the more obvious usages of literal limit values;  
there's more places that could be changed, but it's less clear whether  
it's beneficial to change those.  
  
Author: Andrew Gierth  
Discussion: [email protected]  

M contrib/btree_gist/btree_ts.c
M contrib/intarray/_int_gist.c
M contrib/pgbench/pgbench.c
M src/backend/access/transam/xlog.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/txid.c
M src/include/c.h
M src/include/datatype/timestamp.h
M src/include/executor/instrument.h
M src/include/nodes/parsenodes.h
M src/include/pg_config_manual.h
M src/include/port/atomics.h
M src/include/storage/predicate_internals.h
M src/include/utils/date.h

Return ObjectAddress in many ALTER TABLE sub-routines

commit   : bdc3d7fa2376a7a1e977383cc3221cfe44c4a893    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 17:17:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 17:17:56 -0300    

Click here for diff

Since commit a2e35b53c39b2a, most CREATE and ALTER commands return the  
ObjectAddress of the affected object.  This is useful for event triggers  
to try to figure out exactly what happened.  This patch extends this  
idea a bit further to cover ALTER TABLE as well: an auxiliary  
ObjectAddress is returned for each of several subcommands of ALTER  
TABLE.  This makes it possible to decode with precision what happened  
during execution of any ALTER TABLE command; for instance, which  
constraint was added by ALTER TABLE ADD CONSTRAINT, or which parent got  
dropped from the parents list by ALTER TABLE NO INHERIT.  
  
As with the previous patch, there is no immediate user-visible change  
here.  
  
This is all really just continuing what c504513f83a9ee8 started.  
  
Reviewed by Stephen Frost.  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/include/catalog/index.h

Upgrade src/port/rint.c to be POSIX-compliant.

commit   : 06bf0dd6e354c765403d1331cc9896b360754521    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2015 15:54:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2015 15:54:08 -0400    

Click here for diff

The POSIX spec says that rint() rounds halfway cases to nearest even.  
Our substitute implementation failed to do that, rather rounding halfway  
cases away from zero; and it also got some other cases (such as minus  
zero) wrong.  This led to observable cross-platform differences, as  
reported in bug #12885 from Rich Schaaf; in particular, casting from  
float to int didn't honor round-to-nearest-even on builds using rint.c.  
  
Implement something that attempts to cover all cases per spec, and add  
some simple regression tests so that we'll notice if any platforms still  
get this wrong.  
  
Although this is a bug fix, no back-patch, as a behavioral change in  
the back branches was agreed not to be a good idea.  
  
Pedro Gimeno Fortea, reviewed by Michael Paquier and myself  

M src/port/rint.c
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8-exp-three-digits.out
M src/test/regress/expected/int8.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql

Reduce pinning and buffer content locking for btree scans.

commit   : 2ed5b87f96d473962ec5230fd820abfeaccb2069    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 25 Mar 2015 14:24:43 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 25 Mar 2015 14:24:43 -0500    

Click here for diff

Even though the main benefit of the Lehman and Yao algorithm for  
btrees is that no locks need be held between page reads in an  
index search, we were holding a buffer pin on each leaf page after  
it was read until we were ready to read the next one.  The reason  
was so that we could treat this as a weak lock to create an  
"interlock" with vacuum's deletion of heap line pointers, even  
though our README file pointed out that this was not necessary for  
a scan using an MVCC snapshot.  
  
The main goal of this patch is to reduce the blocking of vacuum  
processes by in-progress btree index scans (including a cursor  
which is idle), but the code rearrangement also allows for one  
less buffer content lock to be taken when a forward scan steps from  
one page to the next, which results in a small but consistent  
performance improvement in many workloads.  
  
This patch leaves behavior unchanged for some cases, which can be  
addressed separately so that each case can be evaluated on its own  
merits.  These unchanged cases are when a scan uses a non-MVCC  
snapshot, an index-only scan, and a scan of a btree index for which  
modifications are not WAL-logged.  If later patches allow  all of  
these cases to drop the buffer pin after reading a leaf page, then  
the btree vacuum process can be simplified; it will no longer need  
the "super-exclusive" lock to delete tuples from a page.  
  
Reviewed by Heikki Linnakangas and Kyotaro Horiguchi  

M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/storage/buffer/README
M src/include/access/nbtree.h

Add OID output argument to DefineTSConfiguration

commit   : 8217fb1441ce4b4e1785f9acfa0ce50039247a10    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 15:57:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 15:57:08 -0300    

Click here for diff

... which is set to the OID of a copied text search config, whenever the  
COPY clause is used.  
  
This is in the spirit of commit a2e35b53c39.  

M src/backend/commands/tsearchcmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h

Fix bug for array-formatted identities of user mappings

commit   : b3196e65f5bfc997ec7fa3f91645a09289c10dee    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 14:28:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 14:28:34 -0300    

Click here for diff

I failed to realize that server names reported in the object args array  
would get quoted, which is wrong; remove that, making sure that it's  
only quoted in the string-formatted identity.  
  
This bug was introduced by my commit cf34e373, which was backpatched,  
but since object name/args arrays are new in commit a676201490c8, there  
is no need to backpatch this any further.  

M src/backend/catalog/objectaddress.c

Fix gram.y comment to match reality

commit   : dc8e05295ab126bc4c943cab3e8e117489ecb246    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 14:16:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2015 14:16:47 -0300    

Click here for diff

There are other comments in there that don't precisely match what's  
implemented, but this one confused me enough to be worth fixing.  

M src/backend/parser/gram.y

Revert commit 843cd0bfe6246d94d9b34a7f36bbb76fdba87b74

commit   : 11226e3817687fcb70fb49d75fdf592e7f3884f6    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 22:35:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 22:35:05 -0400    

Click here for diff

Report by Tom Lane  

M contrib/btree_gin/btree_gin.c

PL/pgSQL docs: recommend format() for query construction

commit   : 0e1f6d8132b4da3e0727bb4918b9ea51446a9c41    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 21:10:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 21:10:36 -0400    

Click here for diff

Previously only concatenation was recommended.  
  
Report by Pavel Stehule  

M doc/src/sgml/func.sgml
M doc/src/sgml/plpgsql.sgml

psql: show proper row count in \x mode for zero-column output

commit   : 376a0c4547fe98c45476647596ce9c9b394f8415    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 21:04:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 21:04:10 -0400    

Click here for diff

Also, fix pager enable selection for such cases, and other cleanups for  
zero-column output.  
  
Report by Thom Brown  

M src/bin/psql/print.c

docs: clarify when MVCC snapshot is taken

commit   : 66c8040d509c86fd2f215c06eb16d82e570d3fb6    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 20:56:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 20:56:09 -0400    

Click here for diff

Report by Álvaro Hernández Tortosa  

M doc/src/sgml/mvcc.sgml

btree_gin: properly call DirectFunctionCall1()

commit   : 843cd0bfe6246d94d9b34a7f36bbb76fdba87b74    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 20:53:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 20:53:29 -0400    

Click here for diff

Previously we called DirectFunctionCall3() with dummy arguments.  
  
Patch by Jon Nelson  

M contrib/btree_gin/btree_gin.c

doc: update NUMERIC to state that only some ops are exact

commit   : 278edd9ed36c7722cbae27e0e96a08964da69eb5    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 19:57:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 19:57:52 -0400    

Click here for diff

Report by Tom Lane  

M doc/src/sgml/datatype.sgml

Add support for ALTER TABLE IF EXISTS ... RENAME CONSTRAINT

commit   : 1d8198bb44e7e7e3e96d96942f642e9964111628    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 19:52:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Mar 2015 19:52:47 -0400    

Click here for diff

Also add regression test.  Previously this was documented to work, but  
didn't.  

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

Fix ExecOpenScanRelation to take a lock on a ROW_MARK_COPY relation.

commit   : feeb526cfe33657b8aa8b0cdd45b2ef0d9898877    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2015 15:53:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2015 15:53:06 -0400    

Click here for diff

ExecOpenScanRelation assumed that any relation listed in the ExecRowMark  
list has been locked by InitPlan; but this is not true if the rel's  
markType is ROW_MARK_COPY, which is possible if it's a foreign table.  
  
In most (possibly all) cases, failure to acquire a lock here isn't really  
problematic because the parser, planner, or plancache would have taken the  
appropriate lock already.  In principle though it might leave us vulnerable  
to working with a relation that we hold no lock on, and in any case if the  
executor isn't depending on previously-taken locks otherwise then it should  
not do so for ROW_MARK_COPY relations.  
  
Noted by Etsuro Fujita.  Back-patch to all active versions, since the  
inconsistency has been there a long time.  (It's almost certainly  
irrelevant in 9.0, since that predates foreign tables, but the code's  
still wrong on its own terms.)  

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

Apply table and domain CHECK constraints in name order.

commit   : e5f455f59fed0632371cddacddd79895b148dc07    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Mar 2015 16:59:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Mar 2015 16:59:29 -0400    

Click here for diff

Previously, CHECK constraints of the same scope were checked in whatever  
order they happened to be read from pg_constraint.  (Usually, but not  
reliably, this would be creation order for domain constraints and reverse  
creation order for table constraints, because of differing implementation  
details.)  Nondeterministic results of this sort are problematic at least  
for testing purposes, and in discussion it was agreed to be a violation of  
the principle of least astonishment.  Therefore, borrow the principle  
already established for triggers, and apply such checks in name order  
(using strcmp() sort rules).  This lets users control the check order  
if they have a mind to.  
  
Domain CHECK constraints still follow the rule of checking lower nested  
domains' constraints first; the name sort only applies to multiple  
constraints attached to the same domain.  
  
In passing, I failed to resist the temptation to wordsmith a bit in  
create_domain.sgml.  
  
Apply to HEAD only, since this could result in a behavioral change in  
existing applications, and the potential regression test failures have  
not actually been observed in our buildfarm.  

M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/typcache.c
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source

vacuumdb: Check result status of PQsendQuery

commit   : 871293fb7fa869fbe0f202bef2e0d781bfd21b3e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Mar 2015 15:57:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Mar 2015 15:57:11 -0300    

Click here for diff

Noticed by Coverity  

M src/bin/scripts/vacuumdb.c

Try to fix MSVC build of pg_rewind.

commit   : 4babae1a8607ad445cbe761da7f46bb90b156287    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Mar 2015 20:25:35 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Mar 2015 20:25:35 +0200    

Click here for diff

It worked in my Windows VM with VS2013, but buildfarm animal mastodon,  
running MSVC 2005, was not happy. Amit Kapila also reported a similar error  
earlier in his environment. Let's see if this helps.  

M src/tools/msvc/Mkvcbuild.pm

Add pg_rewind, for re-synchronizing a master server after failback.

commit   : 61081e75c6741024f7717ade0450090590e96c85    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Mar 2015 19:47:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Mar 2015 19:47:52 +0200    

Click here for diff

Earlier versions of this tool were available (and still are) on github.  
  
Thanks to Michael Paquier, Alvaro Herrera, Peter Eisentraut, Amit Kapila,  
and Satoshi Nagayasu for review.  

M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
A src/bin/pg_rewind/.gitignore
A src/bin/pg_rewind/Makefile
A src/bin/pg_rewind/RewindTest.pm
A src/bin/pg_rewind/copy_fetch.c
A src/bin/pg_rewind/datapagemap.c
A src/bin/pg_rewind/datapagemap.h
A src/bin/pg_rewind/fetch.c
A src/bin/pg_rewind/fetch.h
A src/bin/pg_rewind/file_ops.c
A src/bin/pg_rewind/file_ops.h
A src/bin/pg_rewind/filemap.c
A src/bin/pg_rewind/filemap.h
A src/bin/pg_rewind/libpq_fetch.c
A src/bin/pg_rewind/logging.c
A src/bin/pg_rewind/logging.h
A src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/parsexlog.c
A src/bin/pg_rewind/pg_rewind.c
A src/bin/pg_rewind/pg_rewind.h
A src/bin/pg_rewind/t/001_basic.pl
A src/bin/pg_rewind/t/002_databases.pl
A src/bin/pg_rewind/t/003_extrafiles.pl
A src/bin/pg_rewind/timeline.c
M src/tools/msvc/Mkvcbuild.pm

Don't delay replication for less than recovery_min_apply_delay's resolution.

commit   : 87cec51d3ad1107f6f224ed7d773e70c8896e4c0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2015 16:40:10 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2015 16:40:10 +0100    

Click here for diff

Recovery delays are implemented by waiting on a latch, and latches take  
milliseconds as a parameter. The required amount of waiting was computed  
using microsecond resolution though and the wait loop's abort condition  
was checking the delay in microseconds as well.  This could lead to  
short spurts of busy looping when the overall wait time was below a  
millisecond, but above 0 microseconds.  
  
Instead just formulate the wait loop's abort condition in millisecond  
granularity as well. Given that that's recovery_min_apply_delay  
resolution, it seems harmless to not wait for less than a millisecond.  
  
Backpatch to 9.4 where recovery_min_apply_delay was introduced.  
  
Discussion: [email protected]  

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

Fix copy & paste error in 4f1b890b137.

commit   : a1105c3dd44c1fb76eb62a708f0421f21b9dde9b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2015 14:51:59 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2015 14:51:59 +0100    

Click here for diff

Due to the bug delayed standbys would not delay when applying prepared  
transactions.  
  
Discussion: CAB7nPqT6BO1cCn+sAyDByBxA4EKZNAiPi2mFJ=ANeZmnmewRyg@mail.gmail.com  
  
Michael Paquier via Coverity.  

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

Remove ill-advised pre-check for DSM segment exhaustion.

commit   : 372b97097e8c9a67326e99a07da30ab44f6f822a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 23 Mar 2015 09:58:56 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 23 Mar 2015 09:58:56 -0400    

Click here for diff

dsm_control->nitems never decreases, so this is testing whether the  
server has *ever* run out of DSM segments, not whether it is  
*currently* out of DSM segments.  
  
Reported off-list by Amit Kapila.  

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

to_char: revert cc0d90b73b2e6dd2f301d46818a7265742c41a14

commit   : 33a2c5ecd60a2cf68cfcdd37916f3989bb956581    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 22 Mar 2015 22:56:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 22 Mar 2015 22:56:52 -0400    

Click here for diff

Revert "to_char(float4/8):  zero pad to specified length".  There are  
too many platform-specific problems, and the proper rounding is missing.  
Also revert companion patch 9d61b9953c1489cbb458ca70013cf5fca1bb7710.  

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

Fix minor copy & pasto in the int128 accumulator patch.

commit   : 59b0a98af07cf8decfe94739f92bf18ebb34ffc6    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Mar 2015 19:51:12 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Mar 2015 19:51:12 +0100    

Click here for diff

It's unlikely that using PG_GETARG_INT16 instead of PG_GETARG_INT32 in  
this pace can cause actual problems, but this still should be fixed.  

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

Allow foreign tables to participate in inheritance.

commit   : cb1ca4d800621dcae67ca6c799006de99fa4f0a5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Mar 2015 13:53:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Mar 2015 13:53:11 -0400    

Click here for diff

Foreign tables can now be inheritance children, or parents.  Much of the  
system was already ready for this, but we had to fix a few things of  
course, mostly in the area of planner and executor handling of row locks.  
  
As side effects of this, allow foreign tables to have NOT VALID CHECK  
constraints (and hence to accept ALTER ... VALIDATE CONSTRAINT), and to  
accept ALTER SET STORAGE and ALTER SET WITH/WITHOUT OIDS.  Continuing to  
disallow these things would've required bizarre and inconsistent special  
cases in inheritance behavior.  Since foreign tables don't enforce CHECK  
constraints anyway, a NOT VALID one is a complete no-op, but that doesn't  
mean we shouldn't allow it.  And it's possible that some FDWs might have  
use for SET STORAGE or SET WITH OIDS, though doubtless they will be no-ops  
for most.  
  
An additional change in support of this is that when a ModifyTable node  
has multiple target tables, they will all now be explicitly identified  
in EXPLAIN output, for example:  
  
 Update on pt1  (cost=0.00..321.05 rows=3541 width=46)  
   Update on pt1  
   Foreign Update on ft1  
   Foreign Update on ft2  
   Update on child3  
   ->  Seq Scan on pt1  (cost=0.00..0.00 rows=1 width=46)  
   ->  Foreign Scan on ft1  (cost=100.00..148.03 rows=1170 width=46)  
   ->  Foreign Scan on ft2  (cost=100.00..148.03 rows=1170 width=46)  
   ->  Seq Scan on child3  (cost=0.00..25.00 rows=1200 width=46)  
  
This was done mainly to provide an unambiguous place to attach "Remote SQL"  
fields, but it is useful for inherited updates even when no foreign tables  
are involved.  
  
Shigeru Hanada and Etsuro Fujita, reviewed by Ashutosh Bapat and Kyotaro  
Horiguchi, some additional hacking by me  

M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ddl.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/truncate.sgml
M src/backend/catalog/heap.c
M src/backend/commands/analyze.c
M src/backend/commands/explain.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeLockRows.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/include/nodes/execnodes.h
M src/include/optimizer/planner.h
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/with.out
M src/test/regress/sql/foreign_data.sql

rm src/test/performance

commit   : 8ac356cde312693aa79f6b2fe7c46b8ed6108787    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 22:21:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 22:21:20 -0400    

Click here for diff

Last changed in 1997.  
  
Report by Andres Freund  

D src/test/performance/results/PgSQL.970926
D src/test/performance/runtests.pl
D src/test/performance/sqls/connection
D src/test/performance/sqls/crtsimple
D src/test/performance/sqls/crtsimpleidx
D src/test/performance/sqls/drpsimple
D src/test/performance/sqls/inssimple
D src/test/performance/sqls/inssimple.data
D src/test/performance/sqls/orbsimple
D src/test/performance/sqls/slcsimple
D src/test/performance/sqls/slcsimple.data
D src/test/performance/sqls/vacuum
D src/test/performance/start-pgsql.sh

Add TOAST table to pg_shseclabel for long label use

commit   : 1c7087af422fcdd6785a8e2dccbfc1ed567171a0    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 22:14:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 22:14:49 -0400    

Click here for diff

Report by Andres Freund  

M src/backend/catalog/catalog.c
M src/include/catalog/toasting.h

Use mmap MAP_NOSYNC option to limit shared memory writes

commit   : 34afbba84e8fd12bbf905d68d1112f51ed584df9    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 22:06:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 22:06:19 -0400    

Click here for diff

mmap() is rarely used for shared memory, but when it is, this option is  
useful, particularly on the BSDs.  
  
Patch by Sean Chittenden  

M src/backend/storage/ipc/dsm_impl.c
M src/include/portability/mem.h

to_char(float4/8): don't print "junk" digits

commit   : 9d61b9953c1489cbb458ca70013cf5fca1bb7710    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 21:50:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 21:50:03 -0400    

Click here for diff

Commit cc0d90b73b2e6dd2f301d46818a7265742c41a14 also avoids printing  
junk digits, which are digits that are beyond the precision of the  
underlying type.  

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

to_char(float4/8): zero pad to specified length

commit   : cc0d90b73b2e6dd2f301d46818a7265742c41a14    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 21:43:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Mar 2015 21:43:15 -0400    

Click here for diff

Previously, zero padding was limited to the internal length, rather than  
the specified length.  This allows it to match to_char(int/numeric), which  
always padded to the specified length.  
  
Regression tests added.  
  
BACKWARD INCOMPATIBILITY  

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

Make pg_xlogdump MSVC build work more like others.

commit   : 1933a5bbc883fd2697c42d82ae12f2d585559b23    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 21 Mar 2015 11:53:47 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 21 Mar 2015 11:53:47 +0200    

Click here for diff

Instead of copying xlogreader.c and *desc.c files into the source directory,  
build them where they are. That's what we do for other binaries that need to  
compile and link in files from elsewhere in the source tree.  
  
The commit history suggests that it was done this way because of issues with  
older versions of MSVC. I think this should work, but we'll see if the  
buildfarm complains.  

M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/clean.bat

pg_recvlogical: update --help description

commit   : 30a5ce8f5da15174f85619963ca0a07e6343f821    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 22:15:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 22:15:48 -0400    

Click here for diff

Patch by Euler Taveira  

M src/bin/pg_basebackup/pg_recvlogical.c

docs: clarify the use of shell types

commit   : 7d60ce80658cd0d3fa9c59681fc3072f664dda80    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 18:48:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 18:48:52 -0400    

Click here for diff

Report by Ondřej Bouda  

M doc/src/sgml/ref/create_type.sgml

C comment: clearify SQL command mention

commit   : 0c8fa710b69afffa2e7926ef3e6c372c2d8609f2    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 18:30:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 18:30:30 -0400    

Click here for diff

Patch by Amit Langote  

M src/bin/pg_dump/pg_dump.c

vacuumdb --help text: clarify analyze-only

commit   : 159134b695f9f2ac4ccefe8c41d5af0aa26bba13    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 17:17:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 17:17:30 -0400    

Click here for diff

Patch by Mats Erik Andersson  

M src/bin/scripts/vacuumdb.c

doc: add comma for clarity

commit   : c863c91e3fd6d7a9547bf3f0a4320320a1fd6261    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 16:58:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 16:58:19 -0400    

Click here for diff

Patch by Etsuro Fujita  

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

C comment: update lock level mention in comment

commit   : 13a10c0ccd984643ef88997ac177da7c4b7e46a6    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 08:31:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2015 08:31:10 -0400    

Click here for diff

Patch by Etsuro Fujita  

M src/backend/commands/tablecmds.c

Use 128-bit math to accelerate some aggregation functions.

commit   : 959277a4f579da5243968c750069570a58e92b38    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Mar 2015 10:26:17 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Mar 2015 10:26:17 +0100    

Click here for diff

On platforms where we support 128bit integers, use them to implement  
faster transition functions for sum(int8), avg(int8),  
var_*(int2/int4),stdev_*(int2/int4). Where not supported continue to use  
numeric as a transition type.  
  
In some synthetic benchmarks this has been shown to provide significant  
speedups.  
  
Bumps catversion.  
  
Discussion: [email protected]  
Author: Andreas Karlsson  
Reviewed-By: Peter Geoghegan, Petr Jelinek, Andres Freund,  
    Oskari Saarenmaa, David Rowley  

M src/backend/utils/adt/numeric.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Add, optional, support for 128bit integers.

commit   : 8122e1437e332e156d971a0274879b0ee76e488a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Mar 2015 10:26:17 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Mar 2015 10:26:17 +0100    

Click here for diff

We will, for the foreseeable future, not expose 128 bit datatypes to  
SQL. But being able to use 128bit math will allow us, in a later patch,  
to use 128bit accumulators for some aggregates; leading to noticeable  
speedups over using numeric.  
  
So far we only detect a gcc/clang extension that supports 128bit math,  
but no 128bit literals, and no *printf support. We might want to expand  
this in the future to further compilers; if there are any that that  
provide similar support.  
  
Discussion: [email protected]  
Author: Andreas Karlsson, with significant editorializing by me  
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa  

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

docs: mention the optimizer can increase the index usage count

commit   : 7e9ed623d9988fcb1497a2a8ca7f676a5bfa136f    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 22:38:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 22:38:12 -0400    

Click here for diff

Report by Marko Tiikkaja  

M doc/src/sgml/monitoring.sgml

Fix whitespace

commit   : 28beb69f8bc4ad7f0d1daca1095e1b47ffeaf011    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Mar 2015 22:18:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Mar 2015 22:18:46 -0400    

Click here for diff

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

regression tests: remove polygon diagrams

commit   : 05d1910c1c1f4195065882aa077114bc590b45e3    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 22:10:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 22:10:52 -0400    

Click here for diff

The diagrams were inaccurate.  
  
Report by Emre Hasegeli  

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

psql: allow DROP INDEX CONCURRENTLY in AUTOCOMMIT off mode

commit   : 788e799ed4ee9a0e87f18e0426418622972a4de4    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 21:16:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 21:16:42 -0400    

Click here for diff

Previously this threw an error.  
  
Patch by Feike Steenbergen  

M src/bin/psql/common.c

GetUserId() changes to has_privs_of_role()

commit   : bf038899965263dbc4aef2b43c8fdfe6f49b788f    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 19 Mar 2015 15:02:33 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 19 Mar 2015 15:02:33 -0400    

Click here for diff

The pg_stat and pg_signal-related functions have been using GetUserId()  
instead of has_privs_of_role() for checking if the current user should  
be able to see details in pg_stat_activity or signal other processes,  
requiring a user to do 'SET ROLE' for inheirited roles for a permissions  
check, unlike other permissions checks.  
  
This patch changes that behavior to, instead, act like most other  
permission checks and use has_privs_of_role(), removing the 'SET ROLE'  
need.  Documentation and error messages updated accordingly.  
  
Per discussion with Alvaro, Peter, Adam (though not using Adam's patch),  
and Robert.  
  
Reviewed by Jeevan Chalke.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/pgstatfuncs.c

Add flags argument to dsm_create.

commit   : 12968cf4085409c50f70c6643d92befdb34008f6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Mar 2015 13:02:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Mar 2015 13:02:16 -0400    

Click here for diff

Right now, there's only one flag, DSM_CREATE_NULL_IF_MAXSEGMENTS,  
which suppresses the error that would normally be thrown when the  
maximum number of segments already exists, instead returning NULL.  
It might be useful to add more flags in the future, such as one to  
ignore allocation errors, but I haven't done that here.  

M src/backend/storage/ipc/dsm.c
M src/include/storage/dsm.h
M src/test/modules/test_shm_mq/setup.c

doc: ALTER DOMAIN VALIDATE CONSTRAINT can also fail

commit   : 5f286c02423f28c8e4c4d07569417a3d4f40f1a0    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 13:02:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2015 13:02:09 -0400    

Click here for diff

Document that ALTER DOMAIN VALIDATE CONSTRAINT can also fail for  
composite types.  
  
Report by Ondřej Bouda  

M doc/src/sgml/ref/alter_domain.sgml

Fix status reporting for terminated bgworkers that were never started.

commit   : bf740ce9e5d82612889d131f34c079215973ca00    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Mar 2015 10:56:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Mar 2015 10:56:34 -0400    

Click here for diff

Previously, GetBackgroundWorkerPid() would return BGWH_NOT_YET_STARTED  
if the slot used for the worker registration had not been reused by  
unrelated activity, and BGWH_STOPPED if it had.  Either way, a process  
that had requested notification when the state of one of its  
background workers changed did not receive such notifications.  Fix  
things so that GetBackgroundWorkerPid() always returns BGWH_STOPPED in  
this situation, so that we do not erroneously give waiters the  
impression that the worker will eventually be started; and send  
notifications just as we would if the process terminated after having  
been started, so that it's possible to wait for the postmaster to  
process a worker termination request without polling.  
  
Discovered by Amit Kapila during testing of parallel sequential scan.  
Analysis and fix by me.  Back-patch to 9.4; there may not be anyone  
relying on this interface yet, but if anyone is, the new behavior is a  
clear improvement.  

M src/backend/postmaster/bgworker.c

pg_upgrade: document use of rsync for slave upgrades

commit   : 417f78a5178815d8c10f86b1561c88c45c53c2d2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 18 Mar 2015 15:48:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 18 Mar 2015 15:48:59 -0400    

Click here for diff

Also document that rsync has one-second granularity for file  
change comparisons.  
  
Report by Stephen Frost  

M doc/src/sgml/backup.sgml
M doc/src/sgml/pgupgrade.sgml

array_offset() and array_offsets()

commit   : 13dbc7a824b3f905904cab51840d37f31a07a9ef    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 16:01:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 16:01:34 -0300    

Click here for diff

These functions return the offset position or positions of a value in an  
array.  
  
Author: Pavel Stěhule  
Reviewed by: Jim Nasby  

M doc/src/sgml/array.sgml
M doc/src/sgml/func.sgml
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/array.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Install shared libraries to bin/ in Windows under MSVC

commit   : f9dead5624c63b009fc04229c1e5f660436b747b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 15:16:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 15:16:29 -0300    

Click here for diff

Since commit cb4a3b04 we were already doing this for the Cygwin/mingw  
toolchains, but MSVC had not been updated to do it.  At Install.pm time,  
the Makefile (or GNUmakefile) is inspected, and if a line matching  
SO_MAJOR_VERSION is found (indicating a shared library is being built),  
then files with the .dll extension are set to be installed in bin/  
rather than lib/, while files with .lib extension are installed in lib/.  
This makes the MSVC toolchain up to date with cygwin/mingw.  
  
This removes ad-hoc hacks that were copying files into bin/ or lib/  
manually (libpq.dll in particular was already being copied into bin).  
So while this is a rather ugly kludge, it's still cleaner than what was  
there before.  
  
Author: Michael Paquier  
Reviewed by: Asif Naeem  

M src/tools/msvc/Install.pm

Setup cursor position for schema-qualified elements

commit   : b8d226b4f9691c7afb986dbaaf3f6ff7b203d1b5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 14:48:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 14:48:02 -0300    

Click here for diff

This makes any errors thrown while looking up such schemas report the  
position of the error.  
  
Author: Ryan Kelly  
Reviewed by: Jeevan Chalke, Tom Lane  

M src/backend/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table.out

Rationalize vacuuming options and parameters

commit   : 0d831389749a3baaced7b984205b9894a82444b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 11:52:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2015 11:52:33 -0300    

Click here for diff

We were involving the parser too much in setting up initial vacuuming  
parameters.  This patch moves that responsibility elsewhere to simplify  
code, and also to make future additions easier.  To do this, create a  
new struct VacuumParams which is filled just prior to vacuum execution,  
instead of at parse time; for user-invoked vacuuming this is set up in a  
new function ExecVacuum, while autovacuum sets it up by itself.  
  
While at it, add a new member VACOPT_SKIPTOAST to enum VacuumOption,  
only set by autovacuum, which is used to disable vacuuming of the toast  
table instead of the old do_toast parameter; this relieves the argument  
list of vacuum() and some callees a bit.  This partially makes up for  
having added more arguments in an effort to avoid having autovacuum from  
constructing a VacuumStmt parse node.  
  
Author: Michael Paquier. Some tweaks by Álvaro  
Reviewed by: Robert Haas, Stephen Frost, Álvaro Herrera  

M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/postmaster/autovacuum.c
M src/backend/tcop/utility.c
M src/include/commands/vacuum.h
M src/include/nodes/parsenodes.h

Remove docs missed in 51c11a7025.

commit   : 4559167c6b75be334fabad70d7cc03a38a08d494    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 17 Mar 2015 23:25:52 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 17 Mar 2015 23:25:52 +0100    

Click here for diff

Somehow I misresolved a merge conflict when forward porting Petr's patch  
leading to a section of the docs remaining...  
  
Thankfully Fujii spotted my mistake.  

M doc/src/sgml/recovery-config.sgml

Fix out-of-array-bounds compiler warning

commit   : a190738457353ddb60743e45972f6fe50a75ee77    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2015 22:35:45 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2015 22:35:45 -0300    

Click here for diff

Since the array length check is using a post-increment operator, the  
compiler complains that there's a potential write to one element beyond  
the end of the array.  This is not possible currently: the only path to  
this function is through pg_get_object_address(), which already verifies  
that the input array is no more than two elements in length.  Still, a  
bug is a bug.  
  
No idea why my compiler doesn't complain about this ...  
  
Pointed out by Dead Rasheed and Peter Eisentraut  

M src/backend/catalog/objectaddress.c

Support opfamily members in get_object_address

commit   : a61fd5334eb1040d0dcec0368702398a5b49152c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2015 12:06:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2015 12:06:34 -0300    

Click here for diff

In the spirit of 890192e99af and 4464303405f: have get_object_address  
understand individual pg_amop and pg_amproc objects.  There is no way to  
refer to such objects directly in the grammar -- rather, they are almost  
always considered an integral part of the opfamily that contains them.  
(The only case that deals with them individually is ALTER OPERATOR  
FAMILY ADD/DROP, which carries the opfamily address separately and thus  
does not need it to be part of each added/dropped element's address.)  
In event triggers it becomes possible to become involved with individual  
amop/amproc elements, and this commit enables pg_get_object_address to  
do so as well.  
  
To make the overall coding simpler, this commit also slightly changes  
the get_object_address representation for opclasses and opfamilies:  
instead of having the AM name in the objargs array, I moved it as the  
first element of the objnames array.  This enables the new code to use  
objargs for the type names used by pg_amop and pg_amproc.  
  
Reviewed by: Stephen Frost  

M src/backend/catalog/objectaddress.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Replace insertion sort in contrib/intarray with qsort().

commit   : 8d1f239003d0245dda636dfa6cf0add13bee69d6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 23:22:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 23:22:03 -0400    

Click here for diff

It's all very well to claim that a simplistic sort is fast in easy  
cases, but O(N^2) in the worst case is not good ... especially if the  
worst case is as easy to hit as "descending order input".  Replace that  
bit with our standard qsort.  
  
Per bug #12866 from Maksym Boguk.  Back-patch to all active branches.  

M contrib/intarray/_int_tool.c

Improve representation of PlanRowMark.

commit   : 7b8b8a43317e9e59eca8b511b714a0ab7da5f1cb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 18:41:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 18:41:47 -0400    

Click here for diff

This patch fixes two inadequacies of the PlanRowMark representation.  
  
First, that the original LockingClauseStrength isn't stored (and cannot be  
inferred for foreign tables, which always get ROW_MARK_COPY).  Since some  
PlanRowMarks are created out of whole cloth and don't actually have an  
ancestral RowMarkClause, this requires adding a dummy LCS_NONE value to  
enum LockingClauseStrength, which is fairly annoying but the alternatives  
seem worse.  This fix allows getting rid of the use of get_parse_rowmark()  
in FDWs (as per the discussion around commits 462bd95705a0c23b and  
8ec8760fc87ecde0), and it simplifies some things elsewhere.  
  
Second, that the representation assumed that all child tables in an  
inheritance hierarchy would use the same RowMarkType.  That's true today  
but will soon not be true.  We add an "allMarkTypes" field that identifies  
the union of mark types used in all a parent table's children, and use  
that where appropriate (currently, only in preprocess_targetlist()).  
  
In passing fix a couple of minor infelicities left over from the SKIP  
LOCKED patch, notably that _outPlanRowMark still thought waitPolicy  
is a bool.  
  
Catversion bump is required because the numeric values of enum  
LockingClauseStrength can appear in on-disk rules.  
  
Extracted from a much larger patch to support foreign table inheritance;  
it seemed worth breaking this out, since it's a separable concern.  
  
Shigeru Hanada and Etsuro Fujita, somewhat modified by me  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepsecurity.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/analyze.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/lockoptions.h
M src/include/nodes/plannodes.h
M src/include/parser/analyze.h

Move LockClauseStrength, LockWaitPolicy into new file nodes/lockoptions.h.

commit   : 9fac5fd741ec17ae24dde6b8e82064f13c148ddf    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 15:19:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 15:19:04 -0400    

Click here for diff

Commit df630b0dd5ea2de52972d456f5978a012436115e moved enum LockWaitPolicy  
into its very own header file utils/lockwaitpolicy.h, which does not seem  
like a great idea from here.  First, it's still a node-related declaration,  
and second, a file named like that can never sensibly be used for anything  
else.  I do not think we want to encourage a one-typedef-per-header-file  
approach.  The upcoming foreign table inheritance patch was doubling down  
on this bad idea by moving enum LockClauseStrength into its *own*  
can-never-be-used-for-anything-else file.  Instead, let's put them both in  
a file named nodes/lockoptions.h.  (They do seem to need a separate header  
file because we need them in both parsenodes.h and plannodes.h, and we  
don't want either of those including the other.  Past practice might  
suggest adding them to nodes/nodes.h, but they don't seem sufficiently  
globally useful to justify that.)  
  
Committed separately since there's no functional change here, just some  
header-file refactoring.  

M src/include/access/heapam.h
M src/include/executor/executor.h
A src/include/nodes/lockoptions.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
D src/include/utils/lockwaitpolicy.h

src/port/dirmod.c needs to be built on Cygwin too.

commit   : 80089597730f67927293c410914f3e6bf11ca447    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 14:14:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 14:14:24 -0400    

Click here for diff

Oversight in my commit 91f4a5a976500517e492320e389342d7436cf9d4.  
Per buildfarm member brolga.  

M configure
M configure.in

Add missing documentation for PGC_SU_BACKEND in description of pg_settings.

commit   : d1e9214e4ff5604357d0155467f105825a9e102c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 12:45:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Mar 2015 12:45:35 -0400    

Click here for diff

Commit fe550b2ac249af5fbd8e9e19290a4ba43c882f2d missed updating this list  
of the PGC_XXX values, which in hindsight is not so surprising because  
catalogs.sgml is not a place you'd think to look for them.  In addition to  
adding the missing doco, insert the PGC_XXX C enum names in SGML comments,  
so that grepping for the enum names will find this file.  That might spare  
the next person similar embarrassment.  
  
Spotted by Magnus Hagander.  

M doc/src/sgml/catalogs.sgml

Merge the various forms of transaction commit & abort records.

commit   : 4f1b890b1377744688e43218f975d3c8b2ae39f8    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    

Click here for diff

Since 465883b0a two versions of commit records have existed. A compact  
version that was used when no cache invalidations, smgr unlinks and  
similar were needed, and a full version that could deal with all  
that. Additionally the full version was embedded into twophase commit  
records.  
  
That resulted in a measurable reduction in the size of the logged WAL in  
some workloads. But more recently additions like logical decoding, which  
e.g. needs information about the database something was executed on,  
made it applicable in fewer situations. The static split generally made  
it hard to expand the commit record, because concerns over the size made  
it hard to add anything to the compact version.  
  
Additionally it's not particularly pretty to have twophase.c insert  
RM_XACT records.  
  
Rejigger things so that the commit and abort records only have one form  
each, including the twophase equivalents. The presence of the various  
optional (in the sense of not being in every record) pieces is indicated  
by a bits in the 'xinfo' flag.  That flag previously was not included in  
compact commit records. To prevent an increase in size due to its  
presence, it's only included if necessary; signalled by a bit in the  
xl_info bits available for xact.c, similar to heapam.c's  
XLOG_HEAP_OPMASK/XLOG_HEAP_INIT_PAGE.  
  
Twophase commit/aborts are now the same as their normal  
counterparts. The original transaction's xid is included in an optional  
data field.  
  
This means that commit records generally are smaller, except in the case  
of a transaction with subtransactions, but no other special cases; the  
increase there is four bytes, which seems acceptable given that the more  
common case of not having subtransactions shrank.  The savings are  
especially measurable for twophase commits, which previously always used  
the full version; but will in practice only infrequently have required  
that.  
  
The motivation for this work are not the space savings and and  
deduplication though; it's that it makes it easier to extend commit  
records with additional information. That's just a few lines of code  
now; without impacting the common case where that information is not  
needed.  
  
Discussion: [email protected],  
    235610.92468.qm%40web29004.mail.ird.yahoo.com  
  
Reviewed-By: Heikki Linnakangas, Simon Riggs  

M src/backend/access/rmgrdesc/xactdesc.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/replication/logical/decode.c
M src/include/access/xact.h
M src/include/access/xlog_internal.h

Increase max_wal_size's default from 128MB to 1GB.

commit   : a0f5954af19ddcfea946b15744f2006a789dc4bd    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    

Click here for diff

The introduction of min_wal_size & max_wal_size in 88e982302684 makes it  
feasible to increase the default upper bound in checkpoint  
size. Previously raising the default would lead to a increased disk  
footprint, even if more segments weren't beneficial.  The low default of  
checkpoint size is one of common performance problem users have thus  
increasing the default makes sense.  Setups where the increase in  
maximum disk usage is a problem will very likely have to run with a  
modified configuration anyway.  
  
Discussion: [email protected],  
    CA+TgmoZEAgX5oMGJOHVj8L7XOkAe05Gnf45rP40m-K3FhZRVKg@mail.gmail.com  
  
Author: Josh Berkus, after a discussion involving lots of people.  

M doc/src/sgml/config.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Adjust valgrind suppressions wrt 025c02420.

commit   : 241f088f3632814fe9dbd5bcbc509ec42a268d01    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    

Click here for diff

M src/tools/valgrind.supp

Remove pause_at_recovery_target recovery.conf setting.

commit   : 51c11a7025ecc10c2b922d60a056ad7c6cf147a5    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 15 Mar 2015 17:37:07 +0100    

Click here for diff

The new recovery_target_action (introduced in aedccb1f6/b8e33a85d4)  
replaces it's functionality. Having both seems likely to cause more  
confusion than it saves worry due to the incompatibility.  
  
Discussion: [email protected]  
Author: Petr Jelinek  

M doc/src/sgml/release-9.1.sgml
M src/backend/access/transam/xlog.c

Suppress maybe-uninitialized compiler warnings.

commit   : cd6c45cbeec5e21b470e9a8d19e02f60f1a52807    
  
author   : Fujii Masao <[email protected]>    
date     : Sun, 15 Mar 2015 10:40:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sun, 15 Mar 2015 10:40:43 +0900    

Click here for diff

Previously some compilers were thinking that the variables that  
57aa5b2 added maybe-uninitialized.  
  
Spotted by Andres Freund  

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

Remove obsolete comment.

commit   : 5ff683962ef9a953eeb17ea58d678f0c4ca189ae    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2015 17:07:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2015 17:07:01 -0400    

Click here for diff

Obsoleted by commit 21dcda2713656a7483e3280ac9d2ada20a87a9a9, but I missed  
seeing the cross-reference in the comments for exec_eval_integer().  
  
Also improve the cross-reference in the comments for exec_eval_cleanup().  

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

commit   : 959df4b5fc81397ddc8926d6b756dc044310fa34    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 14 Mar 2015 16:27:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 14 Mar 2015 16:27:12 -0400    

Click here for diff

M doc/src/sgml/monitoring.sgml

Build src/port/dirmod.c only on Windows.

commit   : 91f4a5a976500517e492320e389342d7436cf9d4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2015 14:08:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2015 14:08:45 -0400    

Click here for diff

Since commit ba7c5975adea74c6f17bdb0e0427ad85962092a2, port/dirmod.c  
has contained only Windows-specific functions.  Most platforms don't  
seem to mind uselessly building an empty file, but OS X for one issues  
warnings.  Hence, treat dirmod.c as a Windows-specific file selected  
by configure rather than one that's always built.  We can revert this  
change if dirmod.c ever gains any non-Windows functionality again.  
  
Back-patch to 9.4 where the mentioned commit appeared.  

M configure
M configure.in
M src/include/port.h
M src/port/Makefile

Remove workaround for ancient incompatibility between readline and libedit.

commit   : df9ebf1eeaf98481e00cd77bf6056d42310731b7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2015 13:43:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2015 13:43:00 -0400    

Click here for diff

GNU readline defines the return value of write_history() as "zero if OK,  
else an errno code".  libedit's version of that function used to have a  
different definition (to wit, "-1 if error, else the number of lines  
written to the file").  We tried to work around that by checking whether  
errno had become nonzero, but this method has never been kosher according  
to the published API of either library.  It's reportedly completely broken  
in recent Ubuntu releases: psql bleats about "No such file or directory"  
when saving ~/.psql_history, even though the write worked fine.  
  
However, libedit has been following the readline definition since somewhere  
around 2006, so it seems all right to finally break compatibility with  
ancient libedit releases and trust that the return value is what readline  
specifies.  (I'm not sure when the various Linux distributions incorporated  
this fix, but I did find that OS X has been shipping fixed versions since  
10.5/Leopard.)  
  
If anyone is still using such an ancient libedit, they will find that psql  
complains it can't write ~/.psql_history at exit, even when the file was  
written correctly.  This is no worse than the behavior we're fixing for  
current releases.  
  
Back-patch to all supported branches.  

M src/bin/psql/input.c

Fix integer overflow in debug message of walreceiver

commit   : 364c006c1fba7ba7825fb06ef0166e752546f357    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sat, 14 Mar 2015 08:16:50 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sat, 14 Mar 2015 08:16:50 +0900    

Click here for diff

The message tries to tell the replication apply delay which fails if  
the first WAL record is not applied yet. Fix is, instead of telling  
overflowed minus numeric, showing "N/A" which indicates that the delay  
data is not yet available. Problem reported by me and patch by  
Fabrízio de Royes Mello.  
  
Back patched to 9.4, 9.3 and 9.2 stable branches (9.1 and 9.0 do not  
have the debug message).  

M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c

Document the new custom scan APIs.

commit   : 82fe8b1119e4187f3d991564274607b0b4089aca    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 13 Mar 2015 07:55:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 13 Mar 2015 07:55:39 -0400    

Click here for diff

These APIs changed somewhat subsequent to the initial commit, and may  
change further in the future, but let's document what we have today.  
  
KaiGai Kohei and Robert Haas, reviewed by Tom Lane and Thom Brown  

A doc/src/sgml/custom-scan.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml

Improve documentation of bt_page_items().

commit   : ebc0f5e01d2f4b7d7c3307fd4d40498f6b120898    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Mar 2015 14:18:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Mar 2015 14:18:26 -0400    

Click here for diff

Explain some of the funny conventions used in btree page items.  
  
Peter Geoghegan and Jeff Janes  

M doc/src/sgml/pageinspect.sgml

Ensure tableoid reads correctly in EvalPlanQual-manufactured tuples.

commit   : 443fd0540e298b621be6748dead1fb444556e0d0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Mar 2015 13:38:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Mar 2015 13:38:49 -0400    

Click here for diff

The ROW_MARK_COPY path in EvalPlanQualFetchRowMarks() was just setting  
tableoid to InvalidOid, I think on the assumption that the referenced  
RTE must be a subquery or other case without a meaningful OID.  However,  
foreign tables also use this code path, and they do have meaningful  
table OIDs; so failure to set the tuple field can lead to user-visible  
misbehavior.  Fix that by fetching the appropriate OID from the range  
table.  
  
There's still an issue about whether CTID can ever have a meaningful  
value in this case; at least with postgres_fdw foreign tables, it does.  
But that is a different problem that seems to require a significantly  
different patch --- it's debatable whether postgres_fdw really wants to  
use this code path at all.  
  
Simplified version of a patch by Etsuro Fujita, who also noted the  
problem to begin with.  The issue can be demonstrated in all versions  
having FDWs, so back-patch to 9.1.  

M src/backend/executor/execMain.c

Fix memory leaks in GIN index vacuum.

commit   : 26d2c5dc8dc24febee8c3dd472407d7bbdcc245d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 12 Mar 2015 15:29:58 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 12 Mar 2015 15:29:58 +0100    

Click here for diff

Per bug #12850 by Walter Nordmann. Backpatch to 9.4 where the leak was  
introduced.  

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

Support flattening of empty-FROM subqueries and one-row VALUES tables.

commit   : f4abd0241de20d5d6a79b84992b9e88603d44134    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 23:18:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 23:18:03 -0400    

Click here for diff

We can't handle this in the general case due to limitations of the  
planner's data representations; but we can allow it in many useful cases,  
by being careful to flatten only when we are pulling a single-row subquery  
up into a FROM (or, equivalently, inner JOIN) node that will still have at  
least one remaining relation child.  Per discussion of an example from  
Kyotaro Horiguchi.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/relation.h
M src/include/optimizer/prep.h
M src/test/regress/expected/join.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/rangefuncs.sql

Fix old bug in get_loop_count().

commit   : b746d0c32d4fe749c8d39ccb09d8f0fb38bcc197    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 22:53:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 22:53:32 -0400    

Click here for diff

While poking at David Kubečka's issue I noticed an ancient logic error  
in get_loop_count(): it used 1.0 as a "no data yet" indicator, but since  
that is actually a valid rowcount estimate, this doesn't work.  If we  
have one input relation with 1.0 as rowcount and then another one with  
a larger rowcount, we should use 1.0 as the result, but we picked the  
larger rowcount instead.  (I think when I coded this, I recognized the  
conflict, but mistakenly thought that the logic would pick the desired  
count anyway.)  
  
Fixing this changed the plan for one existing regression test case.  
Since the point of that test is to exercise creation of a particular  
shape of nestloop plan, I tweaked the query a little bit so it still  
results in the same plan choice.  
  
This is definitely a bug, but I'm hesitant to back-patch since it might  
change plan choices unexpectedly, and anyway failure to implement a  
heuristic precisely as intended is a pretty low-grade bug.  

M src/backend/optimizer/path/indxpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Improve planner's cost estimation in the presence of semijoins.

commit   : b55722692ba0ceb934bb32bcddb562e2120f43dd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 21:21:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 21:21:00 -0400    

Click here for diff

If we have a semijoin, say  
	SELECT * FROM x WHERE x1 IN (SELECT y1 FROM y)  
and we're estimating the cost of a parameterized indexscan on x, the number  
of repetitions of the indexscan should not be taken as the size of y; it'll  
really only be the number of distinct values of y1, because the only valid  
plan with y on the outside of a nestloop would require y to be unique-ified  
before joining it to x.  Most of the time this doesn't make that much  
difference, but sometimes it can lead to drastically underestimating the  
cost of the indexscan and hence choosing a bad plan, as pointed out by  
David Kubečka.  
  
Fixing this is a bit difficult because parameterized indexscans are costed  
out quite early in the planning process, before we have the information  
that would be needed to call estimate_num_groups() and thereby estimate the  
number of distinct values of the join column(s).  However we can move the  
code that extracts a semijoin RHS's unique-ification columns, so that it's  
done in initsplan.c rather than on-the-fly in create_unique_path().  That  
shouldn't make any difference speed-wise and it's really a bit cleaner too.  
  
The other bit of information we need is the size of the semijoin RHS,  
which is easy if it's a single relation (we make those estimates before  
considering indexscan costs) but problematic if it's a join relation.  
The solution adopted here is just to use the product of the sizes of the  
join component rels.  That will generally be an overestimate, but since  
estimate_num_groups() only uses this input as a clamp, an overestimate  
shouldn't hurt us too badly.  In any case we don't allow this new logic  
to produce a value larger than we would have chosen before, so that at  
worst an overestimate leaves us no wiser than we were before.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/relation.h

PL/Python: Fix regression tests for Python 3

commit   : ff2faeec5c77539f3c64e6e7d94af1b00a168d10    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2015 18:30:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2015 18:30:34 -0400    

Click here for diff

M src/pl/plpython/expected/plpython_types_3.out

Support default ACLs in get_object_address

commit   : 4464303405f1f886d63f8316386621cd7436c5d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 19:23:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 19:23:47 -0300    

Click here for diff

In the spirit of 890192e99af, this time add support for the things  
living in the pg_default_acl catalog.  These are not really "objects",  
but they show up as such in event triggers.  
  
There is no "DROP DEFAULT PRIVILEGES" or similar command, so it doesn't  
look like the new representation given would be useful anywhere else, so  
I didn't try to use it outside objectaddress.c.  (That might be a bug in  
itself, but that would be material for another commit.)  
  
Reviewed by Stephen Frost.  

M src/backend/catalog/objectaddress.c
M src/backend/commands/event_trigger.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/object_address.out
M src/test/regress/sql/event_trigger.sql
M src/test/regress/sql/object_address.sql

Fix libpq test expected output file

commit   : d4d7777548ed3ea2ca579003e37f9df4d0e0ab9e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 17:01:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 17:01:30 -0300    

Click here for diff

Evidently, this test is not run very frequently ...  

M src/interfaces/libpq/test/expected.out

Support user mappings in get_object_address

commit   : 890192e99af5db1d15d5bb73f3f1044faa1d2758    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 17:01:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 17:01:13 -0300    

Click here for diff

Since commit 72dd233d3ef we were trying to obtain object addressing  
information in sql_drop event triggers, but that caused failures when  
the drops involved user mappings.  This addition enables that to work  
again.  Naturally, pg_get_object_address can work with these objects  
now, too.  
  
I toyed with the idea of removing DropUserMappingStmt as a node and  
using DropStmt instead in the DropUserMappingStmt grammar production,  
but that didn't go very well: for one thing the messages thrown by the  
specific code are specialized (you get "server not found" if you specify  
the wrong server, instead of a generic "user mapping for ... not found"  
which you'd get it we were to merge this with RemoveObjects --- unless  
we added even more special cases).  For another thing, it would require  
to pass RoleSpec nodes through the objname/objargs representation used  
by RemoveObjects, which works in isolation, but gets messy when  
pg_get_object_address is involved.  So I dropped this part for now.  
  
Reviewed by Stephen Frost.  

M src/backend/catalog/objectaddress.c
M src/backend/commands/event_trigger.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/object_address.out
M src/test/regress/sql/event_trigger.sql
M src/test/regress/sql/object_address.sql

PL/Python: Avoid lossiness in float conversion

commit   : 1ce7a57ca6e8c5212fa2ab3bf31d56c74d5b5b8f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2015 15:44:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2015 15:44:17 -0400    

Click here for diff

PL/Python uses str() to convert Python values back to PostgreSQL, but  
str() is lossy for float values, so use repr() instead in that case.  
  
Author: Marko Kreen <[email protected]>  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_types.sql

Require non-NULL pstate for all addRangeTableEntryFor* functions.

commit   : bc93ac12c2544b6b3a68b6cb0282e0828fa14a34    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Mar 2015 15:26:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Mar 2015 15:26:43 -0400    

Click here for diff

Per discussion, it's better to have a consistent coding rule here.  
  
Michael Paquier, per a node from Greg Stark referencing an old post  
from Tom Lane.  

M src/backend/commands/view.c
M src/backend/optimizer/plan/subselect.c
M src/backend/parser/parse_relation.c

Make operator precedence follow the SQL standard more closely.

commit   : c6b3c939b7e0f1d35f4ed4996e71420a993810d2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 13:22:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 13:22:52 -0400    

Click here for diff

While the SQL standard is pretty vague on the overall topic of operator  
precedence (because it never presents a unified BNF for all expressions),  
it does seem reasonable to conclude from the spec for <boolean value  
expression> that OR has the lowest precedence, then AND, then NOT, then IS  
tests, then the six standard comparison operators, then everything else  
(since any non-boolean operator in a WHERE clause would need to be an  
argument of one of these).  
  
We were only sort of on board with that: most notably, while "<" ">" and  
"=" had properly low precedence, "<=" ">=" and "<>" were treated as generic  
operators and so had significantly higher precedence.  And "IS" tests were  
even higher precedence than those, which is very clearly wrong per spec.  
  
Another problem was that "foo NOT SOMETHING bar" constructs, such as  
"x NOT LIKE y", were treated inconsistently because of a bison  
implementation artifact: they had the documented precedence with respect  
to operators to their right, but behaved like NOT (i.e., very low priority)  
with respect to operators to their left.  
  
Fixing the precedence issues is just a small matter of rearranging the  
precedence declarations in gram.y, except for the NOT problem, which  
requires adding an additional lookahead case in base_yylex() so that we  
can attach a different token precedence to NOT LIKE and allied two-word  
operators.  
  
The bulk of this patch is not the bug fix per se, but adding logic to  
parse_expr.c to allow giving warnings if an expression has changed meaning  
because of these precedence changes.  These warnings are off by default  
and are enabled by the new GUC operator_precedence_warning.  It's believed  
that very few applications will be affected by these changes, but it was  
agreed that a warning mechanism is essential to help debug any that are.  

M doc/src/sgml/config.sgml
M doc/src/sgml/syntax.sgml
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/psqlscan.l
M src/include/nodes/parsenodes.h
M src/include/parser/parse_expr.h
M src/include/parser/scanner.h
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/pl/plpgsql/src/pl_gram.y

Allocate ParamListInfo once per plpgsql function, not once per expression.

commit   : 21dcda2713656a7483e3280ac9d2ada20a87a9a9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 12:40:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2015 12:40:43 -0400    

Click here for diff

setup_param_list() was allocating a fresh ParamListInfo for each query or  
expression evaluation requested by a plpgsql function.  There was probably  
once good reason to do it like that, but for a long time we've had a  
convention that there's a one-to-one mapping between the function's  
PLpgSQL_datum array and the ParamListInfo slots, which means that a single  
ParamListInfo can serve all the function's evaluation requests: the data  
that would need to be passed is the same anyway.  
  
In this patch, we retain the pattern of zeroing out the ParamListInfo  
contents during each setup_param_list() call, because some of the slots may  
be stale and we don't know exactly which ones.  So this patch only saves a  
palloc/pfree per evaluation cycle and nothing more; still, that seems to be  
good for a couple percent overall speedup on simple-arithmetic type  
statements.  In future, though, we might be able to improve matters still  
more by managing the param array contents more carefully.  
  
Also, unify the former use of estate->cur_expr with that of  
paramLI->parserSetupArg; they both were used to point to the active  
expression, so we can combine the variables into just one.  

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

sepgsql: Improve error message when unsupported object type is labeled.

commit   : e96b7c6b9fc4d148a22588894245416b63743368    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Mar 2015 12:12:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Mar 2015 12:12:10 -0400    

Click here for diff

KaiGai Kohei, reviewed by Álvaro Herrera and myself  

M contrib/sepgsql/label.c

Suggest to the user the column they may have meant to reference.

commit   : e529cd4ffa605c6f14f1391af5559b3a44da0336    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 Mar 2015 10:44:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 Mar 2015 10:44:04 -0400    

Click here for diff

Error messages informing the user that no such column exists can  
sometimes provoke a perplexed response.  This often happens due to  
a subtle typo in the column name or, perhaps less likely, in the  
alias name.  To speed discovery of what the real issue is in such  
cases, we'll now search the range table for approximate matches.  
If there are one or two such matches that are good enough to think  
that they might be what the user intended to type, and better than  
all other approximate matches, we'll issue a hint suggesting that  
the user might have intended to reference those columns.  
  
Peter Geoghegan and Robert Haas  

M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/utils/adt/levenshtein.c
M src/include/parser/parse_relation.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Add macros wrapping all usage of gcc's __attribute__.

commit   : bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 11 Mar 2015 14:19:54 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 11 Mar 2015 14:19:54 +0100    

Click here for diff

Until now __attribute__() was defined to be empty for all compilers but  
gcc. That's problematic because it prevents using it in other compilers;  
which is necessary e.g. for atomics portability.  It's also just  
generally dubious to do so in a header as widely included as c.h.  
  
Instead add pg_attribute_format_arg, pg_attribute_printf,  
pg_attribute_noreturn macros which are implemented in the compilers that  
understand them. Also add pg_attribute_noreturn and pg_attribute_packed,  
but don't provide fallbacks, since they can affect functionality.  
  
This means that external code that, possibly unwittingly, relied on  
__attribute__ defined to be empty on !gcc compilers may now run into  
warnings or errors on those compilers. But there shouldn't be many  
occurances of that and it's hard to work around...  
  
Discussion: [email protected]  
Author: Oskari Saarenmaa, with some minor changes by me.  

M contrib/cube/cubescan.l
M contrib/pg_upgrade/pg_upgrade.h
M contrib/pg_upgrade/util.c
M contrib/pg_xlogdump/pg_xlogdump.c
M contrib/pgcrypto/px.h
M contrib/seg/segscan.l
M src/backend/access/transam/xlogreader.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/psql/common.h
M src/bin/psql/large_obj.c
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/common/fe_memutils.h
M src/include/lib/stringinfo.h
M src/include/mb/pg_wchar.h
M src/include/parser/parse_relation.h
M src/include/parser/scanner.h
M src/include/pgstat.h
M src/include/port.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/postgres.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.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/replication/walreceiver.h
M src/include/storage/ipc.h
M src/include/storage/itemptr.h
M src/include/storage/lock.h
M src/include/tcop/tcopprot.h
M src/include/utils/datetime.h
M src/include/utils/elog.h
M src/include/utils/help_config.h
M src/include/utils/palloc.h
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpython/plpy_elog.h
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/pg_regress.c

Refactor Mkvcbuild.pm to facilitate modules migrations

commit   : 66ece312f99f384bd33e4342580e78b0eebf0e74    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 10:21:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2015 10:21:01 -0300    

Click here for diff

This is in preparation to "upgrade" some modules from contrib/ to  
src/bin/, per discussion.  
  
Author: Michael Paquier  

M src/tools/msvc/Mkvcbuild.pm

Add GUC to enable compression of full page images stored in WAL.

commit   : 57aa5b2bb11a4dbfdfc0f92370e0742ae5aa367b    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 11 Mar 2015 15:52:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 11 Mar 2015 15:52:24 +0900    

Click here for diff

When newly-added GUC parameter, wal_compression, is on, the PostgreSQL server  
compresses a full page image written to WAL when full_page_writes is on or  
during a base backup. A compressed page image will be decompressed during WAL  
replay. Turning this parameter on can reduce the WAL volume without increasing  
the risk of unrecoverable data corruption, but at the cost of some extra CPU  
spent on the compression during WAL logging and on the decompression during  
WAL replay.  
  
This commit changes the WAL format (so bumping WAL version number) so that  
the one-byte flag indicating whether a full page image is compressed or not is  
included in its header information. This means that the commit increases the  
WAL volume one-byte per a full page image even if WAL compression is not used  
at all. We can save that one-byte by borrowing one-bit from the existing field  
like hole_offset in the header and using it as the flag, for example. But which  
would reduce the code readability and the extensibility of the feature.  
Per discussion, it's not worth paying those prices to save only one-byte, so we  
decided to add the one-byte flag to the header.  
  
This commit doesn't introduce any new compression algorithm like lz4.  
Currently a full page image is compressed using the existing PGLZ algorithm.  
Per discussion, we decided to use it at least in the first version of the  
feature because there were no performance reports showing that its compression  
ratio is unacceptably lower than that of other algorithm. Of course,  
in the future, it's worth considering the support of other compression  
algorithm for the better compression.  
  
Rahila Syed and Michael Paquier, reviewed in various versions by myself,  
Andres Freund, Robert Haas, Abhijit Menon-Sen and many others.  

M contrib/pg_xlogdump/pg_xlogdump.c
M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h

Clean up the mess from => patch.

commit   : 2fbb286647fac2014abdf2fbf6c7b4134be91602    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2015 11:48:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2015 11:48:34 -0400    

Click here for diff

Commit 865f14a2d31af23a05bbf2df04c274629c5d5c4d was quite a few bricks  
shy of a load: psql, ecpg, and plpgsql were all left out-of-step with  
the core lexer.  Of these only the last was likely to be a fatal  
problem; but still, a minimal amount of grepping, or even just reading  
the comments adjacent to the places that were changed, would have found  
the other places that needed to be changed.  

M src/bin/psql/psqlscan.l
M src/include/parser/scanner.h
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/pgc.l
M src/pl/plpgsql/src/pl_gram.y

Fix stray sentence fragment in shared_preload_libraries documentation

commit   : bb7b35caf78de80d2ff1643d042e62a71f83abbb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Mar 2015 12:36:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Mar 2015 12:36:17 -0300    

Click here for diff

The introduction in the Shared Library Preloading section already  
instructs the user to separate multiple library names with commas, so  
just remove the fragment from here.  
  
Author: Dagfinn Ilmari Mannsåker  

M doc/src/sgml/config.sgml

Move BRIN page type to page's last two bytes

commit   : e491bd2ee34860b14ff18abc5602f9aa5b197a2d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Mar 2015 12:26:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Mar 2015 12:26:34 -0300    

Click here for diff

... which is the usual convention among AMs, so that pg_filedump and  
similar utilities can tell apart pages of different AMs.  It was also  
the intent of the original code, but I failed to realize that alignment  
considerations would move the whole thing to the previous-to-last word  
in the page.  
  
The new definition of the associated macro makes surrounding code a bit  
leaner, too.  
  
Per note from Heikki at  
http://www.postgresql.org/message-id/[email protected]  

M contrib/pageinspect/brinfuncs.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/include/access/brin_page.h
M src/include/access/gin_private.h
M src/include/access/spgist_private.h

Allow named parameters to be specified using => in addition to :=

commit   : 865f14a2d31af23a05bbf2df04c274629c5d5c4d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 10 Mar 2015 10:59:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 10 Mar 2015 10:59:11 -0400    

Click here for diff

SQL has standardized on => as the use of to specify named parameters,  
and we've wanted for many years to support the same syntax ourselves,  
but this has been complicated by the possible use of => as an operator  
name.  In PostgreSQL 9.0, we began emitting a warning when an operator  
named => was defined, and in PostgreSQL 9.2, we stopped shipping a  
=>(text, text) operator as part of hstore.  By the time the next major  
version of PostgreSQL is released, => will have been deprecated for a  
full five years, so hopefully there won't be too many people still  
relying on it.  We continue to support := for compatibility with  
previous PostgreSQL releases.  
  
Pavel Stehule, reviewed by Petr Jelinek, with a few documentation  
tweaks by me.  

M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/commands/operatorcmds.c
M src/backend/parser/gram.y
M src/backend/parser/scan.l
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/polymorphism.sql

Keep CommitTs module in sync in standby and master

commit   : 4f3924d9cd438ba4e6fd639460f8c859c65d45a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Mar 2015 17:44:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Mar 2015 17:44:00 -0300    

Click here for diff

We allow this module to be turned off on restarts, so a restart time  
check is enough to activate or deactivate the module; however, if there  
is a standby replaying WAL emitted from a master which is restarted, but  
the standby isn't, the state in the standby becomes inconsistent and can  
easily be crashed.  
  
Fix by activating and deactivating the module during WAL replay on  
parameter change as well as on system start.  
  
Problem reported by Fujii Masao in  
http://www.postgresql.org/message-id/CAHGQGwFhJ3CnHo1CELEfay18yg_RA-XZT-7D8NuWUoYSZ90r4Q@mail.gmail.com  
  
Author: Petr Jelínek  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/include/access/commit_ts.h

Fix crasher bugs in previous commit

commit   : e3f1c24b992acb88e4ccf33118640aee4b11dd47    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Mar 2015 17:00:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Mar 2015 17:00:43 -0300    

Click here for diff

ALTER DEFAULT PRIVILEGES was trying to decode the list of roles in the  
FOR clause as a list of names rather than of RoleSpecs; and the IN  
clause in CREATE ROLE was doing the same thing.  This was evidenced by  
crashes on some buildfarm machines, though on my platform this doesn't  
cause a failure by mere chance; I can reproduce the failures only by  
adding some padding in struct RoleSpecs.  
  
Fix by dereferencing those lists as being of RoleSpecs, not string  
Values.  

M src/backend/catalog/aclchk.c
M src/backend/commands/user.c

Allow CURRENT/SESSION_USER to be used in certain commands

commit   : 31eae6028eca4365e7165f5f33fee1ed0486aee0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Mar 2015 15:41:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Mar 2015 15:41:54 -0300    

Click here for diff

Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the  
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to  
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause  
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT  
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as  
user specifiers in place of an explicit user name.  
  
This commit also fixes some quite ugly handling of special standards-  
mandated syntax in CREATE USER MAPPING, which in particular would fail  
to work in presence of a role named "current_user".  
  
The special role specifiers PUBLIC and NONE also have more consistent  
handling now.  
  
Also take the opportunity to add location tracking to user specifiers.  
  
Authors: Kyotaro Horiguchi.  Heavily reworked by Álvaro Herrera.  
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.  

M doc/src/sgml/ref/alter_aggregate.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_conversion.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_event_trigger.sgml
M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/alter_language.sgml
M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_schema.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_server.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/alter_tsconfig.sgml
M doc/src/sgml/ref/alter_tsdictionary.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/alter_user_mapping.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/grant.sgml
M src/backend/catalog/aclchk.c
M src/backend/commands/alter.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/policy.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/acl.c
M src/include/commands/user.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
A src/test/regress/expected/rolenames.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/rolenames.sql

Ignore leftover artifacts from ecpg testsuite runs on Windows.

commit   : fa83f809458a966dff225d3d266399d48e7b5e6e    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 9 Mar 2015 18:48:44 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 9 Mar 2015 18:48:44 +0100    

Click here for diff

M .gitignore

Revert "Ignore object files generated by ecpg test suite on Windows"

commit   : 2093eb4d4c2b55962df613fdd6f605ce4dc67217    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 9 Mar 2015 18:48:13 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 9 Mar 2015 18:48:13 +0100    

Click here for diff

This reverts commit b9e538b190d9cf4387361214eadc430393ebf852.  

M src/interfaces/ecpg/test/compat_informix/.gitignore
M src/interfaces/ecpg/test/connect/.gitignore
M src/interfaces/ecpg/test/pgtypeslib/.gitignore
M src/interfaces/ecpg/test/preproc/.gitignore
M src/interfaces/ecpg/test/sql/.gitignore
M src/interfaces/ecpg/test/thread/.gitignore

Fix handling of sortKeys field in Tuplesortstate.

commit   : 2720e96a9bd58b2af177c714c0c5402773e1cf30    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 9 Mar 2015 10:35:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 9 Mar 2015 10:35:41 -0400    

Click here for diff

Commit 5cefbf5a6c4466ac6b1cc2a4316b4eba9108c802 introduced an  
assumption that this field would always be non-NULL when doing a merge  
pass, but that's not true.  Without this fix, you can crash the server  
by building a hash index that is sufficiently large relative to  
maintenance_work_mem, or by triggering a large datum sort.  
  
Commit 5ea86e6e65dd2da3e9a3464484985d48328e7fe3 changed the comments  
for that field to say that it would be set in all cases except for the  
hash index case, but that wasn't (and still isn't) true.  
  
The datum-sort failure was spotted by Tomas Vondra; initial analysis  
of that failure was by Peter Geoghegan.  The remaining issues were  
spotted by me during review of the surrounding code, and the patch is  
all my fault.  

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

commit   : f1fd515b393a283d7368ce45a92709d2c7f9a991    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Mar 2015 15:49:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Mar 2015 15:49:10 +0200    

Click here for diff

This makes it easier to write frontend programs that needs to understand  
the WAL record format of CREATE/DROP DATABASE. dbcommands.h cannot easily  
be #included in a frontend program, because it pulls in other header files  
that need backend stuff, but the new dbcommands_xlog.h header file has  
fewer dependencies.  

M contrib/pg_xlogdump/rmgrdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/transam/rmgr.c
M src/backend/commands/dbcommands.c
M src/include/commands/dbcommands.h
A src/include/commands/dbcommands_xlog.h

Ignore object files generated by ecpg test suite on Windows

commit   : b9e538b190d9cf4387361214eadc430393ebf852    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 9 Mar 2015 14:38:22 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 9 Mar 2015 14:38:22 +0100    

Click here for diff

Patch by Michael Paquier  

M src/interfaces/ecpg/test/compat_informix/.gitignore
M src/interfaces/ecpg/test/connect/.gitignore
M src/interfaces/ecpg/test/pgtypeslib/.gitignore
M src/interfaces/ecpg/test/preproc/.gitignore
M src/interfaces/ecpg/test/sql/.gitignore
M src/interfaces/ecpg/test/thread/.gitignore

Fix typo in comment.

commit   : 828599acecdb2929f9b66d6f590c2abbc751b58b    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2015 14:39:46 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2015 14:39:46 +0900    

Click here for diff

M src/include/access/xlogrecord.h

Add missing "goto err" statements in xlogreader.c.

commit   : c74c04b8aa03f05983f940ee94c86a5cc1945393    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2015 14:31:10 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2015 14:31:10 +0900    

Click here for diff

Spotted by Andres Freund.  

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

Sort SUBDIRS variable in src/bin/Makefile

commit   : 5a2a48f0367e24f8f12cfe0a90a886dae0db1ce2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Dec 2014 20:41:58 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Dec 2014 20:41:58 -0500    

Click here for diff

The previous order appears to have been historically grown randomness.  

M src/bin/Makefile

Cast to (void *) rather than (int *) when passing int64's to PQfn().

commit   : ef75508efc789c79c5a5d4acd7ad5da85f1e4f08    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 13:58:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 13:58:28 -0400    

Click here for diff

This is a possibly-vain effort to silence a Coverity warning about  
bogus endianness dependency.  The code's fine, because it takes care  
of endianness issues for itself, but Coverity sees an int64 being  
passed to an int* argument and not unreasonably suspects something's  
wrong.  I'm not sure if putting the void* cast in the way will shut it  
up; but it can't hurt and seems better from a documentation standpoint  
anyway, since the pointer is not used as an int* in this code path.  
  
Just for a bit of additional safety, verify that the result length  
is 8 bytes as expected.  
  
Back-patch to 9.3 where the code in question was added.  

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

Remove struct PQArgBlock from server-side header libpq/libpq.h.

commit   : 01cca2c1b1a0d52c83f250c50942ee00e62637ca    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 13:42:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 13:42:59 -0400    

Click here for diff

This struct is purely a client-side artifact.  Perhaps there was once  
reason for the server to know it, but any such reason is lost in the  
mists of time.  We certainly don't need two independent declarations  
of it.  

M src/include/libpq/libpq.h

Fix documentation for libpq's PQfn().

commit   : 1a0bc4c2bfc278b63965486b1525ad04a1f85989    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 13:35:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 13:35:28 -0400    

Click here for diff

The SGML docs claimed that 1-byte integers could be sent or received with  
the "isint" options, but no such behavior has ever been implemented in  
pqGetInt() or pqPutInt().  The in-code documentation header for PQfn() was  
even less in tune with reality, and the code itself used parameter names  
matching neither the SGML docs nor its libpq-fe.h declaration.  Do a bit  
of additional wordsmithing on the SGML docs while at it.  
  
Since the business about 1-byte integers is a clear documentation bug,  
back-patch to all supported branches.  

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

Code cleanup for REINDEX DATABASE/SCHEMA/SYSTEM.

commit   : 90c35a9ed06c1353a0d3818c259e629ff09dba18    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 12:18:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 12:18:43 -0400    

Click here for diff

Fix some minor infelicities.  Some of these things were introduced in  
commit fe263d115a7dd16095b8b8f1e943aff2bb4574d2, and some are older.  

M src/backend/commands/indexcmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h

Fix erroneous error message for REINDEX SYSTEM.

commit   : ac0914285ac90bd411730c3219f226bbbbc57f3a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 11:51:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2015 11:51:04 -0400    

Click here for diff

Missed case in commit fe263d115a7dd16095b8b8f1e943aff2bb4574d2.  
  
Sawada Masahiko  

M src/backend/tcop/utility.c

Build fls.o only when AC_REPLACE_FUNCS so dictates via $(LIBOBJS).

commit   : 9d265ae77af6f8d99bbd68b6ee644e7572b16754    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 7 Mar 2015 00:48:04 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 7 Mar 2015 00:48:04 -0500    

Click here for diff

By building it unconditionally, libpgport inadvertently replaced any  
libc version of the function.  This is essentially a code cleanup; any  
effect on performance is almost surely too small to notice.  

M src/port/Makefile

Add CHECK_FOR_INTERRUPTS() to the wait_pid() loop.

commit   : 93751570731ba08dca4e791234984c3b1a15e885    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 7 Mar 2015 00:47:38 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 7 Mar 2015 00:47:38 -0500    

Click here for diff

Though the one contemporary caller uses it in a limited way, this  
function could loop indefinitely if pointed to an arbitrary PID.  

M src/test/regress/regress.c

Remove rolcatupdate

commit   : bb8582abf3c4db18b508627a52effd43672f9410    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Mar 2015 23:42:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Mar 2015 23:42:38 -0500    

Click here for diff

This role attribute is an ancient PostgreSQL feature, but could only be  
set by directly updating the system catalogs, and it doesn't have any  
clearly defined use.  
  
Author: Adam Brightwell <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/system_views.sql
M src/backend/commands/user.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.h
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rules.out

Add some more tests on event triggers

commit   : 6510c832bbf91d52541c7aeefa371123abc2d832    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Mar 2015 19:14:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Mar 2015 19:14:28 -0300    

Click here for diff

Fabien Coelho  
Reviewed by Robert Haas  

M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Rethink function argument sorting in pg_dump.

commit   : e3bfe6d84d4919433d8323cfb8194ca60d99f2c4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2015 13:27:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2015 13:27:46 -0500    

Click here for diff

Commit 7b583b20b1c95acb621c71251150beef958bb603 created an unnecessary  
dump failure hazard by applying pg_get_function_identity_arguments()  
to every function in the database, even those that won't get dumped.  
This could result in snapshot-related problems if concurrent sessions are,  
for example, creating and dropping temporary functions, as noted by Marko  
Tiikkaja in bug #12832.  While this is by no means pg_dump's only such  
issue with concurrent DDL, it's unfortunate that we added a new failure  
mode for cases that used to work, and even more so that the failure was  
created for basically cosmetic reasons (ie, to sort overloaded functions  
more deterministically).  
  
To fix, revert that patch and instead sort function arguments using  
information that pg_dump has available anyway, namely the names of the  
argument types.  This will produce a slightly different sort ordering for  
overloaded functions than the previous coding; but applying strcmp  
directly to the output of pg_get_function_identity_arguments really was  
a bit odd anyway.  The sorting will still be name-based and hence  
independent of possibly-installation-specific OID assignments.  A small  
additional benefit is that sorting now works regardless of server version.  
  
Back-patch to 9.3, where the previous commit appeared.  

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

Fix contrib/file_fdw's expected file

commit   : c6ee39bc8587042f018979ddd6ed9825acbbd3d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Mar 2015 11:47:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Mar 2015 11:47:09 -0300    

Click here for diff

I forgot to update it on yesterday's cf34e373fcf.  

M contrib/file_fdw/output/file_fdw.source

Fix user mapping object description

commit   : cf34e373fcf42239a73f36e3054d9e9fbdc1e0de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Mar 2015 18:03:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Mar 2015 18:03:16 -0300    

Click here for diff

We were using "user mapping for user XYZ" as description for user mappings, but  
that's ambiguous because users can have mappings on multiple foreign  
servers; therefore change it to "for user XYZ on server UVW" instead.  
Object identities for user mappings are also updated in the same way, in  
branches 9.3 and above.  
  
The incomplete description string was introduced together with the whole  
SQL/MED infrastructure by commit cae565e503 of 8.4 era, so backpatch all  
the way back.  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/foreign_data.out

Silence warning in non-assert-enabled build

commit   : bf22d2707a2f47a7cc4caa239a14f2bf0a72bfd0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Mar 2015 12:11:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Mar 2015 12:11:26 -0300    

Click here for diff

An OID return value was being used only for a (rather pointless) assert.  
Silence by removing the variable and the assert.  
  
Per note from Peter Geoghegan  

M src/backend/catalog/pg_conversion.c

Remove comment claiming that PARAM_EXTERN Params always have typmod -1.

commit   : 3200b15b20d9248be1b0f436ee787b2077d00298    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2015 13:16:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2015 13:16:27 -0500    

Click here for diff

This hasn't been true in quite some time, cf plpgsql's make_datum_param().  

M src/include/nodes/primnodes.h

Fix typo in comment.

commit   : 934d12268585823c271c1490fc9aa4467c301e9c    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 5 Mar 2015 20:15:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 5 Mar 2015 20:15:16 +0900    

Click here for diff

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

Avoid unused-variable warning in non-assert builds.

commit   : a5c29d37aab00e9e70e72c97f2be29030f6ee84c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 22:00:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 22:00:36 -0500    

Click here for diff

Oversight in my commit b9896198cfbc1b0cd0c631d2af72ffe34bd4c7e5.  

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

Change plpgsql's cast cache to consider source typmod as significant.

commit   : 7f3014dce56c7975113809f2ff5e92cf7c1563a3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 20:23:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 20:23:13 -0500    

Click here for diff

I had thought that there was no need to maintain separate cache entries  
for different source typmods, but further experimentation shows that there  
is an advantage to doing so in some cases.  In particular, if a domain has  
a typmod (say, "CREATE DOMAIN d AS numeric(20,0)"), failing to notice the  
source typmod leads to applying a length-coercion step even when the  
source has the correct typmod.  

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

Need to special-case RECORD as well as UNKNOWN in plpgsql's casting logic.

commit   : 45f2c2fc4e4adcf75cd689e18dab77ebe622fc2e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 19:10:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 19:10:57 -0500    

Click here for diff

This is because can_coerce_type thinks that RECORD can be cast to any  
composite type, but coerce_record_to_complex only works for inputs that are  
RowExprs or whole-row Vars, so we get a hard failure on a CaseTestExpr.  
  
Perhaps these corner cases ought to be fixed so that coerce_to_target_type  
actually returns NULL as per its specification, rather than failing ...  
but for the moment an extra check here is the path of least resistance.  

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

Use standard casting mechanism to convert types in plpgsql, when possible.

commit   : 1345cc67bbb014209714af32b5681b1e11eaf964    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 11:04:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2015 11:04:30 -0500    

Click here for diff

plpgsql's historical method for converting datatypes during assignments was  
to apply the source type's output function and then the destination type's  
input function.  Aside from being miserably inefficient in most cases, this  
method failed outright in many cases where a user might expect it to work;  
an example is that "declare x int; ... x := 3.9;" would fail, not round the  
value to 4.  
  
Instead, let's convert by applying the appropriate assignment cast whenever  
there is one.  To avoid breaking compatibility unnecessarily, fall back to  
the I/O conversion method if there is no assignment cast.  
  
So far as I can tell, there is just one case where this method produces a  
different result than the old code in a case where the old code would not  
have thrown an error.  That is assignment of a boolean value to a string  
variable (type text, varchar, or bpchar); the old way gave boolean's output  
representation, ie 't'/'f', while the new way follows the behavior of the  
bool-to-text cast and so gives 'true' or 'false'.  This will need to be  
called out as an incompatibility in the 9.5 release notes.  
  
Aside from handling many conversion cases more sanely, this method is  
often significantly faster than the old way.  In part that's because  
of more effective caching of the conversion info.  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/typeconv.sgml
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Fix cost estimation for indexscans on expensive indexed expressions.

commit   : b9896198cfbc1b0cd0c631d2af72ffe34bd4c7e5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2015 23:23:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2015 23:23:17 -0500    

Click here for diff

genericcostestimate() and friends used the cost of the entire indexqual  
expressions as the charge for initial evaluation of indexscan arguments.  
But of course the index column is not evaluated, only the other side  
of the qual expression, so this was a bad overestimate if the index  
column was an expensive expression.  
  
To fix, refactor the logic in this area so that there's a single routine  
charged with deconstructing index quals and figuring out what is the index  
column and what is the comparison expression.  This is more or less free in  
the case of btree indexes, since btcostestimate() was doing equivalent  
deconstruction already.  It probably adds a bit of new overhead in the cases  
of other index types, but not a lot.  (In the case of GIN I think I saved  
something by getting rid of code that wasn't aware that the index column  
associations were already available "for free".)  
  
Per recent gripe from Jeff Janes.  
  
Arguably this is a bug fix, but I'm hesitant to back-patch because of the  
possibility of destabilizing plan choices that people may be happy with.  

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

Fix an obsolete reference to SnapshotNow in comment.

commit   : f8b031bca848a21fb9a7c9530f8cdc7eb6919dd9    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 4 Mar 2015 12:25:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 4 Mar 2015 12:25:48 +0900    

Click here for diff

Peter Geoghegan  

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

Fix long-obsolete code for separating filter conditions in cost_index().

commit   : 497bac7d290df13d8b00ba48653a96015ff4741b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2015 21:19:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2015 21:19:42 -0500    

Click here for diff

This code relied on pointer equality to identify which restriction clauses  
also appear in the indexquals (and, therefore, don't need to be applied as  
simple filter conditions).  That was okay once upon a time, years ago,  
before we introduced the equivalence-class machinery.  Now there's about a  
50-50 chance that an equality clause appearing in the indexquals will be  
the mirror image (commutator) of its mate in the restriction list.  When  
that happens, we'd erroneously think that the clause would be re-evaluated  
at each visited row, and therefore inflate the cost estimate for the  
indexscan by the clause's cost.  
  
Add some logic to catch this case.  It seems to me that it continues not to  
be worthwhile to expend the extra predicate-proof work that createplan.c  
will do on the finally-selected plan, but this case is common enough and  
cheap enough to handle that we should do so.  
  
This will make a small difference (about one cpu_operator_cost per row)  
in simple cases; but in situations where there's an expensive function in  
the indexquals, it can make a very large difference, as seen in recent  
example from Jeff Janes.  
  
This is a long-standing bug, but I'm hesitant to back-patch because of the  
possibility of destabilizing plan choices that people may be happy with.  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c

Remove residual NULL-pstate handling in addRangeTableEntry.

commit   : 5223ddacdc737b401ed58184e321f354bdf46686    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Mar 2015 16:31:26 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Mar 2015 16:31:26 -0500    

Click here for diff

Passing a NULL pstate wouldn't actually work, because isLockedRefname()  
isn't prepared to cope with it; and there hasn't been any in-core code  
that tries in over a decade.  So just remove the residual NULL handling.  
  
Spotted by Coverity; analysis and patch by Michael Paquier.  

M src/backend/parser/parse_relation.c

Change many routines to return ObjectAddress rather than OID

commit   : a2e35b53c39b2a27d3e332dc7c506539c306fd44    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Mar 2015 14:10:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Mar 2015 14:10:50 -0300    

Click here for diff

The changed routines are mostly those that can be directly called by  
ProcessUtilitySlow; the intention is to make the affected object  
information more precise, in support for future event trigger changes.  
Originally it was envisioned that the OID of the affected object would  
be enough, and in most cases that is correct, but upon actually  
implementing the event trigger changes it turned out that ObjectAddress  
is more widely useful.  
  
Additionally, some command execution routines grew an output argument  
that's an object address which provides further info about the executed  
command.  To wit:  
  
* for ALTER DOMAIN / ADD CONSTRAINT, it corresponds to the address of  
  the new constraint  
  
* for ALTER OBJECT / SET SCHEMA, it corresponds to the address of the  
  schema that originally contained the object.  
  
* for ALTER EXTENSION {ADD, DROP} OBJECT, it corresponds to the address  
  of the object added to or dropped from the extension.  
  
There's no user-visible change in this commit, and no functional change  
either.  
  
Discussion: [email protected]  
Reviewed-By: Stephen Frost, Andres Freund  

M src/backend/bootstrap/bootparse.y
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/tcop/utility.c
M src/include/catalog/heap.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_conversion_fn.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc_fn.h
M src/include/catalog/pg_type_fn.h
M src/include/commands/alter.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/defrem.h
M src/include/commands/event_trigger.h
M src/include/commands/extension.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/proclang.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/user.h
M src/include/commands/view.h
M src/include/rewrite/rewriteDefine.h

Add comment for "is_internal" parameter

commit   : 6f9d79904748c26a58991942dc6719db558f77b0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Mar 2015 14:03:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Mar 2015 14:03:33 -0300    

Click here for diff

This was missed in my commit f4c4335 of 9.3 vintage, so backpatch to  
that.  

M src/backend/catalog/heap.c

Reduce json <=> jsonb casts from explicit-only to assignment level.

commit   : b67f1ce181910e012b3a8ec7a35ba20a48247757    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2015 11:26:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2015 11:26:04 -0500    

Click here for diff

There's no reason to make users write an explicit cast to store a  
json value in a jsonb column or vice versa.  
  
We could probably even make these implicit, but that might open us up  
to problems with ambiguous function calls, so for now just do this.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.h

pgbench: Fix mistakes in Makefile.

commit   : e5f36902495d0c8d5dee9a5f43fb45d44540f795    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Mar 2015 10:32:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Mar 2015 10:32:08 -0500    

Click here for diff

My commit 878fdcb843e087cc1cdeadc987d6ef55202ddd04 was not quite  
right.  Tom Lane pointed out one of the mistakes fixed here, and I  
noticed the other myself while reviewing what I'd committed.  

M contrib/pgbench/Makefile

Fix busted markup.

commit   : d1479011744d80d80c669b5bd64dc32187f26c1e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Mar 2015 23:28:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Mar 2015 23:28:31 -0500    

Click here for diff

Evidently from commit 878fdcb843e087cc1cdeadc987d6ef55202ddd04.  
Per buildfarm.  

M doc/src/sgml/pgbench.sgml

pgbench: Add a real expression syntax to \set

commit   : 878fdcb843e087cc1cdeadc987d6ef55202ddd04    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 Mar 2015 14:21:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 Mar 2015 14:21:41 -0500    

Click here for diff

Previously, you could do \set variable operand1 operator operand2, but  
nothing more complicated.  Now, you can \set variable expression, which  
makes it much simpler to do multi-step calculations here.  This also  
adds support for the modulo operator (%), with the same semantics as in  
C.  
  
Robert Haas and Fabien Coelho, reviewed by Álvaro Herrera and  
Stephen Frost  

M contrib/pgbench/.gitignore
M contrib/pgbench/Makefile
A contrib/pgbench/exprparse.y
A contrib/pgbench/exprscan.l
M contrib/pgbench/pgbench.c
A contrib/pgbench/pgbench.h
M doc/src/sgml/pgbench.sgml
M src/tools/msvc/Mkvcbuild.pm

Fix pg_dump handling of extension config tables

commit   : ebd092bc2a07787b31b249d62033b9c8140a5d85    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 2 Mar 2015 14:12:21 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 2 Mar 2015 14:12:21 -0500    

Click here for diff

Since 9.1, we've provided extensions with a way to denote  
"configuration" tables- tables created by an extension which the user  
may modify.  By marking these as "configuration" tables, the extension  
is asking for the data in these tables to be pg_dump'd (tables which  
are not marked in this way are assumed to be entirely handled during  
CREATE EXTENSION and are not included at all in a pg_dump).  
  
Unfortunately, pg_dump neglected to consider foreign key relationships  
between extension configuration tables and therefore could end up  
trying to reload the data in an order which would cause FK violations.  
  
This patch teaches pg_dump about these dependencies, so that the data  
dumped out is done so in the best order possible.  Note that there's no  
way to handle circular dependencies, but those have yet to be seen in  
the wild.  
  
The release notes for this should include a caution to users that  
existing pg_dump-based backups may be invalid due to this issue.  The  
data is all there, but restoring from it will require extracting the  
data for the configuration tables and then loading them in the correct  
order by hand.  
  
Discussed initially back in bug #6738, more recently brought up by  
Gilles Darold, who provided an initial patch which was further reworked  
by Michael Paquier.  Further modifications and documentation updates  
by me.  
  
Back-patch to 9.1 where we added the concept of extension configuration  
tables.  

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

Fix targetRelation initializiation in prepsecurity

commit   : ee4ddcb38a0abfdb8f7302bbc332a1cb92888ed1    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 1 Mar 2015 15:26:55 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 1 Mar 2015 15:26:55 -0500    

Click here for diff

In 6f9bd50eabb0a4960e94c83dac8855771c9f340d, we modified  
expand_security_quals() to tell expand_security_qual() about when the  
current RTE was the targetRelation.  Unfortunately, that commit  
initialized the targetRelation variable used outside of the loop over  
the RTEs instead of at the start of it.  
  
This patch moves the variable and the initialization of it into the  
loop, where it should have been to begin with.  
  
Pointed out by Dean Rasheed.  
  
Back-patch to 9.4 as the original commit was.  

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

Use the typcache to cache constraints for domain types.

commit   : 8abb3cda0ddc00a0ab98977a1633a95b97068d4e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Mar 2015 14:06:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Mar 2015 14:06:50 -0500    

Click here for diff

Previously, we cached domain constraints for the life of a query, or  
really for the life of the FmgrInfo struct that was used to invoke  
domain_in() or domain_check().  But plpgsql (and probably other places)  
are set up to cache such FmgrInfos for the whole lifespan of a session,  
which meant they could be enforcing really stale sets of constraints.  
On the other hand, searching pg_constraint once per query gets kind of  
expensive too: testing says that as much as half the runtime of a  
trivial query such as "SELECT 0::domaintype" went into that.  
  
To fix this, delegate the responsibility for tracking a domain's  
constraints to the typcache, which has the infrastructure needed to  
detect syscache invalidation events that signal possible changes.  
This not only removes unnecessary repeat reads of pg_constraint,  
but ensures that we never apply stale constraint data: whatever we  
use is the current data according to syscache rules.  
  
Unfortunately, the current configuration of the system catalogs means  
we have to flush cached domain-constraint data whenever either pg_type  
or pg_constraint changes, which happens rather a lot (eg, creation or  
deletion of a temp table will do it).  It might be worth rearranging  
things to split pg_constraint into two catalogs, of which the domain  
constraint one would probably be very low-traffic.  That's a job for  
another patch though, and in any case this patch should improve matters  
materially even with that handicap.  
  
This patch makes use of the recently-added memory context reset callback  
feature to manage the lifespan of domain constraint caches, so that we  
don't risk deleting a cache that might be in the midst of evaluation.  
  
Although this is a bug fix as well as a performance improvement, no  
back-patch.  There haven't been many if any field complaints about  
stale domain constraint checks, so it doesn't seem worth taking the  
risk of modifying data structures as basic as MemoryContexts in back  
branches.  

M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execQual.c
M src/backend/utils/adt/domains.c
M src/backend/utils/cache/typcache.c
M src/include/commands/typecmds.h
M src/include/nodes/execnodes.h
M src/include/utils/typcache.h
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Add transform functions for AT TIME ZONE.

commit   : b8a18ad4850ea5ad7884aa6ab731fd392e73b4ad    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 1 Mar 2015 13:22:34 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 1 Mar 2015 13:22:34 -0500    

Click here for diff

This makes "ALTER TABLE tabname ALTER tscol TYPE ... USING tscol AT TIME  
ZONE 'UTC'" skip rewriting the table when altering from "timestamp" to  
"timestamptz" or vice versa.  While it would be nicer still to optimize  
this in the absence of the USING clause given timezone==UTC, transform  
functions must consult IMMUTABLE facts only.  

M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/timestamp.h

commit   : 424793fa5dc631254f69d5ee8d7d7d6de2976f60    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 1 Mar 2015 13:05:23 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 1 Mar 2015 13:05:23 -0500    

Click here for diff

When the library already exists in the build directory, "ar" preserves  
members not named on its command line.  This mattered when, for example,  
a "configure" rerun dropped a file from $(LIBOBJS).  libpgport carried  
the obsolete member until "make clean".  Back-patch to 9.0 (all  
supported versions).  

M src/Makefile.shlib
M src/common/Makefile
M src/port/Makefile

Move memory context callback declarations into palloc.h.

commit   : 097fe194aa7c590b4fa43d5e40c083940859c286    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Mar 2015 12:31:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Mar 2015 12:31:32 -0500    

Click here for diff

Initial experience with this feature suggests that instances of  
MemoryContextCallback are likely to propagate into some widely-used headers  
over time.  As things stood, that would result in pulling memutils.h or  
at least memnodes.h into common headers, which does not seem desirable.  
Instead, let's decide that this feature is part of the "ordinary palloc  
user" API rather than the "specialized context management" API, and as  
such should be declared in palloc.h not memutils.h.  

M src/include/nodes/memnodes.h
M src/include/utils/memutils.h
M src/include/utils/palloc.h

Fix intermittent failure in event_trigger test

commit   : e059e02e43cd825616192d010e9e638a96ad4717    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 1 Mar 2015 11:58:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 1 Mar 2015 11:58:07 -0300    

Click here for diff

As evidenced by measles in buildfarm.  Pointed out by Tom.  

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

Track typmods in plpgsql expression evaluation and assignment.

commit   : e524cbdc45ec6d677b1dd49ee64dd403959eda0f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Feb 2015 14:34:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Feb 2015 14:34:35 -0500    

Click here for diff

The main value of this change is to avoid expensive I/O conversions when  
assigning to a variable that has a typmod specification, if the value  
to be assigned is already known to have the right typmod.  This is  
particularly valuable for arrays with typmod specifications; formerly,  
in an assignment to an array element the entire array would invariably  
get put through double I/O conversion to check the typmod, to absolutely  
no purpose since we'd already properly coerced the new element value.  
  
Extracted from my "expanded arrays" patch; this seems worth committing  
separately, whatever becomes of that patch, since it's really an  
independent issue.  
  
As long as we're changing the function signatures, take the opportunity  
to rationalize the argument lists of exec_assign_value, exec_cast_value,  
and exec_simple_cast_value; that is, put the arguments into a saner order,  
and get rid of the bizarre choice to pass exec_assign_value's isNull flag  
by reference.  

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

Fix planning of star-schema-style queries.

commit   : b514a7460d9127ddda6598307272c701cbb133b7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Feb 2015 12:43:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Feb 2015 12:43:04 -0500    

Click here for diff

Part of the intent of the parameterized-path mechanism was to handle  
star-schema queries efficiently, but some overly-restrictive search  
limiting logic added in commit e2fa76d80ba571d4de8992de6386536867250474  
prevented such cases from working as desired.  Fix that and add a  
regression test about it.  Per gripe from Marc Cousin.  
  
This is arguably a bug rather than a new feature, so back-patch to 9.2  
where parameterized paths were introduced.  

M src/backend/optimizer/README
M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Improve mmgr README.

commit   : c4f4c7ca99169ac609df67c2d0eb78162484420c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 20:32:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 20:32:34 -0500    

Click here for diff

Add documentation about the new reset callback mechanism.  
  
Also, at long last, recast the existing text so that it describes the  
current context mechanisms as established fact rather than something  
we're going to implement.  Shoulda done that in 2001 or so ...  

M src/backend/utils/mmgr/README

Suppress uninitialized-variable warning from less-bright compilers.

commit   : d61f1a93271b859938b6cdb301a367cdb8abf81c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 18:19:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 18:19:22 -0500    

Click here for diff

The type variable must get set on first iteration of the while loop,  
but there are reasonably modern gcc versions that don't realize that.  
Initialize it with a dummy value.  This undoes a removal of initialization  
in commit 654809e770ce270c0bb9de726c5df1ab193d60f0.  

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

Redefine MemoryContextReset() as deleting, not resetting, child contexts.

commit   : eaa5808e8ec4e82ce1a87103a6b6f687666e4e4c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 18:09:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 18:09:42 -0500    

Click here for diff

That is, MemoryContextReset() now means what was formerly meant by  
MemoryContextResetAndDeleteChildren(), and the latter is now just a macro  
alias for the former.  If you really want the functionality that was  
formerly provided by MemoryContextReset(), what you have to do is  
MemoryContextResetChildren() plus MemoryContextResetOnly() (which is a  
new API to reset *only* the named context and not touch its children).  
  
The reason for this change is that near fifteen years of experience has  
proven that there is noplace where old-style MemoryContextReset() is  
actually what you want.  Making that the default behavior has led to lots  
of context-leakage bugs, while we've not found anyplace where it's actually  
necessary to keep the child contexts; at least the standard regression  
tests do not reveal anyplace where this change breaks anything.  And there  
are upcoming patches that will introduce additional reasons why child  
contexts need to be removed.  
  
We could change existing calls of MemoryContextResetAndDeleteChildren to be  
just MemoryContextReset, but for the moment I'll leave them alone; they're  
not costing anything.  

M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Make CREATE OR REPLACE VIEW internally more consistent

commit   : fbef4342a86522c98cd605891ad8c1145a61d191    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Feb 2015 19:19:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Feb 2015 19:19:34 -0300    

Click here for diff

The way that columns are added to a view is by calling  
AlterTableInternal with special subtype AT_AddColumnToView; but that  
subtype is changed to AT_AddColumnRecurse by ATPrepAddColumn.  This has  
no visible effect in the current code, since views cannot have  
inheritance children (thus the recursion step is a no-op) and adding a  
column to a view is executed identically to doing it to a table; but it  
does make a difference for future event trigger code keeping track of  
commands, because the current situation leads to confusing the case with  
a normal ALTER TABLE ADD COLUMN.  
  
Fix the problem by passing a flag to ATPrepAddColumn to prevent it from  
changing the command subtype.  The event trigger code can then properly  
ignore the subcommand.  (We could remove the call to ATPrepAddColumn,  
since views are never typed, and there is never a need for recursion,  
which are the two conditions that are checked by ATPrepAddColumn; but it  
seems more future-proof to keep the call in place.)  

M src/backend/commands/tablecmds.c

Invent a memory context reset/delete callback mechanism.

commit   : f65e8270587f3e9b8224e20f7d020ed1f816dfe1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 17:16:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Feb 2015 17:16:40 -0500    

Click here for diff

This allows cleanup actions to be registered to be called just before a  
particular memory context's contents are flushed (either by deletion or  
MemoryContextReset).  The patch in itself has no use-cases for this, but  
several likely reasons for wanting this exist.  
  
In passing, per discussion, rearrange some boolean fields in struct  
MemoryContextData so as to avoid wasted padding space.  For safety,  
this requires making allowInCritSection's existence unconditional;  
but I think that's a better approach than what was there anyway.  

M src/backend/utils/mmgr/mcxt.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h

Fix a couple of trivial issues in jsonb.c

commit   : 654809e770ce270c0bb9de726c5df1ab193d60f0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Feb 2015 18:54:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Feb 2015 18:54:49 -0300    

Click here for diff

Typo "aggreagate" appeared three times, and the return value of function  
JsonbIteratorNext() was being assigned to an int variable in a bunch of  
places.  

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

Fix table_rewrite event trigger for ALTER TYPE/SET DATA TYPE CASCADE

commit   : 3f190f67eb45ae61d696fbce8ab48d246a12f709    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Feb 2015 18:38:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Feb 2015 18:38:33 -0300    

Click here for diff

When a composite type being used in a typed table is modified by way  
of ALTER TYPE, a table rewrite occurs appearing to come from ALTER TYPE.  
The existing event_trigger.c code was unable to cope with that  
and raised a spurious error.  The fix is just to accept that command  
tag for the event, and document this properly.  
  
Noted while fooling with deparsing of DDL commands.  This appears to be  
an oversight in commit 618c9430a.  
  
Thanks to Mark Wong for documentation wording help.  

M doc/src/sgml/event-trigger.sgml
M src/backend/commands/event_trigger.c
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Render infinite date/timestamps as 'infinity' for json/jsonb

commit   : bda76c1c8cfb1d11751ba6be88f0242850481733    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 26 Feb 2015 12:25:21 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 26 Feb 2015 12:25:21 -0500    

Click here for diff

Commit ab14a73a6c raised an error in these cases and later the  
behaviour was copied to jsonb. This is what the XML code, which we  
then adopted, does, as the XSD types don't accept infinite values.  
However, json dates and timestamps are just strings as far as json is  
concerned, so there is no reason not to render these values as  
'infinity'.  
  
The json portion of this is backpatched to 9.4 where the behaviour was  
introduced. The jsonb portion only affects the development branch.  
  
Per gripe on pgsql-general.  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Reconsider when to wait for WAL flushes/syncrep during commit.

commit   : fd6a3f3ad4067f1b8fc28e9de6e99e5936d82161    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 26 Feb 2015 12:50:07 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 26 Feb 2015 12:50:07 +0100    

Click here for diff

Up to now RecordTransactionCommit() waited for WAL to be flushed (if  
synchronous_commit != off) and to be synchronously replicated (if  
enabled), even if a transaction did not have a xid assigned. The primary  
reason for that is that sequence's nextval() did not assign a xid, but  
are worthwhile to wait for on commit.  
  
This can be problematic because sometimes read only transactions do  
write WAL, e.g. HOT page prune records. That then could lead to read only  
transactions having to wait during commit. Not something people expect  
in a read only transaction.  
  
This lead to such strange symptoms as backends being seemingly stuck  
during connection establishment when all synchronous replicas are  
down. Especially annoying when said stuck connection is the standby  
trying to reconnect to allow syncrep again...  
  
This behavior also is involved in a rather complicated <= 9.4 bug where  
the transaction started by catchup interrupt processing waited for  
syncrep using latches, but didn't get the wakeup because it was already  
running inside the same overloaded signal handler. Fix the issue here  
doesn't properly solve that issue, merely papers over the problems. In  
9.5 catchup interrupts aren't processed out of signal handlers anymore.  
  
To fix all this, make nextval() acquire a top level xid, and only wait for  
transaction commit if a transaction both acquired a xid and emitted WAL  
records.  If only a xid has been assigned we don't uselessly want to  
wait just because of writes to temporary/unlogged tables; if only WAL  
has been written we don't want to wait just because of HOT prunes.  
  
The xid assignment in nextval() is unlikely to cause overhead in  
real-world workloads. For one it only happens SEQ_LOG_VALS/32 values  
anyway, for another only usage of nextval() without using the result in  
an insert or similar is affected.  
  
Discussion: [email protected],  
    369698E947874884A77849D8FE3680C2@maumau,  
    5CF4ABBA67674088B3941894E22A0D25@maumau  
  
Per complaint from maumau and Thom Brown  
  
Backpatch all the way back; 9.0 doesn't have syncrep, but it seems  
better to be consistent behavior across all maintained branches.  

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

Add note about how to make the SRF detoasted arguments live accross calls.

commit   : a7920b872fff36668a2d33157609024b851b5c2e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 26 Feb 2015 15:48:07 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 26 Feb 2015 15:48:07 +0900    

Click here for diff

Andrew Gierth and Ali Akbar  

M doc/src/sgml/xfunc.sgml

Free SQLSTATE and SQLERRM no earlier than other PL/pgSQL variables.

commit   : f5ef00aed4c39645716cabb2e4cf1ef3598fcde7    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 25 Feb 2015 23:48:28 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 25 Feb 2015 23:48:28 -0500    

Click here for diff

"RETURN SQLERRM" prompted plpgsql_exec_function() to read from freed  
memory.  Back-patch to 9.0 (all supported versions).  Little code ran  
between the premature free and the read, so non-assert builds are  
unlikely to witness user-visible consequences.  

M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Add hasRowSecurity to copyfuncs/outfuncs

commit   : 62a4a1af5d1d84f0023bc3816c204191b0f4f49f    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 25 Feb 2015 23:32:18 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 25 Feb 2015 23:32:18 -0500    

Click here for diff

The RLS patch added a hasRowSecurity field to PlannerGlobal and  
PlannedStmt but didn't update nodes/copyfuncs.c and nodes/outfuncs.c to  
reflect those additional fields.  
  
Correct that by adding entries to the appropriate functions for those  
fields.  
  
Pointed out by Robert.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c

Add locking clause for SB views for update/delete

commit   : 6f9bd50eabb0a4960e94c83dac8855771c9f340d    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 25 Feb 2015 21:36:29 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 25 Feb 2015 21:36:29 -0500    

Click here for diff

In expand_security_qual(), we were handling locking correctly when a  
PlanRowMark existed, but not when we were working with the target  
relation (which doesn't have any PlanRowMarks, but the subquery created  
for the security barrier quals still needs to lock the rows under it).  
  
Noted by Etsuro Fujita when working with the Postgres FDW, which wasn't  
properly issuing a SELECT ... FOR UPDATE to the remote side under a  
DELETE.  
  
Back-patch to 9.4 where updatable security barrier views were  
introduced.  
  
Per discussion with Etsuro and Dean Rasheed.  

M src/backend/optimizer/prep/prepsecurity.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/updatable_views.out

Fix over-optimistic caching in fetch_array_arg_replace_nulls().

commit   : 77903ede08845e55bd2a6c99b52d8da6926d6e84    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Feb 2015 14:19:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Feb 2015 14:19:13 -0500    

Click here for diff

When I rewrote this in commit 56a79a869bedc4bf6c35853642694cc0b0594dd2,  
I forgot that it's possible for the input array type to change from one  
call to the next (this can happen when applying the function to  
pg_statistic columns, for instance).  Fix that.  

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

Fix dumping of views that are just VALUES(...) but have column aliases.

commit   : e9f1c01b71dcd11c86fc8516c06dae2e784b96fd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Feb 2015 12:01:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Feb 2015 12:01:12 -0500    

Click here for diff

The "simple" path for printing VALUES clauses doesn't work if we need  
to attach nondefault column aliases, because there's noplace to do that  
in the minimal VALUES() syntax.  So modify get_simple_values_rte() to  
detect nondefault aliases and treat that as a non-simple case.  This  
further exposes that the "non-simple" path never actually worked;  
it didn't produce valid syntax.  Fix that too.  Per bug #12789 from  
Curtis McEnroe, and analysis by Andrew Gierth.  
  
Back-patch to all supported branches.  Before 9.3, this also requires  
back-patching the part of commit 092d7ded29f36b0539046b23b81b9f0bf2d637f1  
that created get_simple_values_rte() to begin with; inserting the extra  
test into the old factorization of that logic would've been too messy.  

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

Remove null-pointer checks that are not needed.

commit   : 8794bf1ca164e1be1554197b46c9ffc62d162fb8    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 25 Feb 2015 11:46:15 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 25 Feb 2015 11:46:15 +0100    

Click here for diff

If a pointer is guaranteed to carry information there is no need to check  
for NULL again. Patch by Michael Paquier.  

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

Improve parser's one-extra-token lookahead mechanism.

commit   : d809fd0008a2e26de463f47b7aba0365264078f3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Feb 2015 17:53:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Feb 2015 17:53:42 -0500    

Click here for diff

There are a couple of places in our grammar that fail to be strict LALR(1),  
by requiring more than a single token of lookahead to decide what to do.  
Up to now we've dealt with that by using a filter between the lexer and  
parser that merges adjacent tokens into one in the places where two tokens  
of lookahead are necessary.  But that creates a number of user-visible  
anomalies, for instance that you can't name a CTE "ordinality" because  
"WITH ordinality AS ..." triggers folding of WITH and ORDINALITY into one  
token.  I realized that there's a better way.  
  
In this patch, we still do the lookahead basically as before, but we never  
merge the second token into the first; we replace just the first token by  
a special lookahead symbol when one of the lookahead pairs is seen.  
  
This requires a couple extra productions in the grammar, but it involves  
fewer special tokens, so that the grammar tables come out a bit smaller  
than before.  The filter logic is no slower than before, perhaps a bit  
faster.  
  
I also fixed the filter logic so that when backing up after a lookahead,  
the current token's terminator is correctly restored; this eliminates some  
weird behavior in error message issuance, as is shown by the one change in  
existing regression test outputs.  
  
I believe that this patch entirely eliminates odd behaviors caused by  
lookahead for WITH.  It doesn't really improve the situation for NULLS  
followed by FIRST/LAST unfortunately: those sequences still act like a  
reserved word, even though there are cases where they should be seen as two  
ordinary identifiers, eg "SELECT nulls first FROM ...".  I experimented  
with additional grammar hacks but couldn't find any simple solution for  
that.  Still, this is better than before, and it seems much more likely  
that we *could* somehow solve the NULLS case on the basis of this filter  
behavior than the previous one.  

M src/backend/parser/gram.y
M src/backend/parser/parser.c
M src/include/parser/gramparse.h
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Error when creating names too long for tar format

commit   : 23a78352c0a0dc21d6120bd868f0b2d07395b537    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Feb 2015 13:41:07 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Feb 2015 13:41:07 -0500    

Click here for diff

The tar format (at least the version we are using), does not support  
file names or symlink targets longer than 99 bytes.  Until now, the tar  
creation code would silently truncate any names that are too long.  (Its  
original application was pg_dump, where this never happens.)  This  
creates problems when running base backups over the replication  
protocol.  
  
The most important problem is when a tablespace path is longer than 99  
bytes, which will result in a truncated tablespace path being backed up.  
Less importantly, the basebackup protocol also promises to back up any  
other files it happens to find in the data directory, which would also  
lead to file name truncation if someone put a file with a long name in  
there.  
  
Now both of these cases result in an error during the backup.  
  
Add tests that fail when a too-long file name or symlink is attempted to  
be backed up.  
  
Reviewed-by: Robert Hass <[email protected]>  

M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/include/pgtar.h
M src/port/tar.c

Fix recovery_command -> restore_command typo in 8.3 release notes.

commit   : 347c74320d10bee458d1fec159aeda7143d31bfb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 24 Feb 2015 14:41:13 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 24 Feb 2015 14:41:13 +0200    

Click here for diff

Kyotaro Horiguchi  

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

Fix typo in README.

commit   : dd58c6098f2f2fcea71c7125f9594268a24a38ad    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 24 Feb 2015 14:32:56 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 24 Feb 2015 14:32:56 +0200    

Click here for diff

Kyotaro Horiguchi  

M src/backend/replication/README

Fix invalid DocBook XML

commit   : b007bee1f6962ad1007056f64b9eb2e505fa6806    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Feb 2015 16:57:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Feb 2015 16:57:54 -0500    

Click here for diff

M doc/src/sgml/config.sgml

Fix stupid merge errors in previous commit

commit   : d1712d01d01d2c14355fad497fa7a6ae6e33694f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Feb 2015 15:05:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Feb 2015 15:05:37 -0300    

Click here for diff

Brown paper bag installed permanently.  

M src/backend/tcop/utility.c

Further tweaking of raw grammar output to distinguish different inputs.

commit   : 56be925e4b8f5b1c0e6716ca5cbe0360d1229f50    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Feb 2015 12:46:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Feb 2015 12:46:46 -0500    

Click here for diff

Use a different A_Expr_Kind for LIKE/ILIKE/SIMILAR TO constructs, so that  
they can be distinguished from direct invocation of the underlying  
operators.  Also, postpone selection of the operator name when transforming  
"x IN (select)" to "x = ANY (select)", so that those syntaxes can be told  
apart at parse analysis time.  
  
I had originally thought I'd also have to do something special for the  
syntaxes IS NOT DISTINCT FROM, IS NOT DOCUMENT, and x NOT IN (SELECT...),  
which the grammar translates as though they were NOT (construct).  
On reflection though, we can distinguish those cases reliably by noting  
whether the parse location shown for the NOT is the same as for its child  
node.  This only requires tweaking the parse locations for NOT IN, which  
I've done here.  
  
These changes should have no effect outside the parser; they're just in  
support of being able to give accurate warnings for planned operator  
precedence changes.  

M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Support more commands in event triggers

commit   : 296f3a6053844089bc533630fffafaba8f016384    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Feb 2015 14:22:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Feb 2015 14:22:42 -0300    

Click here for diff

COMMENT, SECURITY LABEL, and GRANT/REVOKE now also fire  
ddl_command_start and ddl_command_end event triggers, when they operate  
on database-local objects.  
  
Reviewed-By: Michael Paquier, Andres Freund, Stephen Frost  

M doc/src/sgml/event-trigger.sgml
M src/backend/commands/event_trigger.c
M src/backend/tcop/utility.c
M src/include/commands/event_trigger.h

Replace checkpoint_segments with min_wal_size and max_wal_size.

commit   : 88e982302684246e8af785e78a467ac37c76dee9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 18:53:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 18:53:02 +0200    

Click here for diff

Instead of having a single knob (checkpoint_segments) that both triggers  
checkpoints, and determines how many checkpoints to recycle, they are now  
separate concerns. There is still an internal variable called  
CheckpointSegments, which triggers checkpoints. But it no longer determines  
how many segments to recycle at a checkpoint. That is now auto-tuned by  
keeping a moving average of the distance between checkpoints (in bytes),  
and trying to keep that many segments in reserve. The advantage of this is  
that you can set max_wal_size very high, but the system won't actually  
consume that much space if there isn't any need for it. The min_wal_size  
sets a floor for that; you can effectively disable the auto-tuning behavior  
by setting min_wal_size equal to max_wal_size.  
  
The max_wal_size setting is now the actual target size of WAL at which a  
new checkpoint is triggered, instead of the distance between checkpoints.  
Previously, you could calculate the actual WAL usage with the formula  
"(2 + checkpoint_completion_target) * checkpoint_segments + 1". With this  
patch, you set the desired WAL usage with max_wal_size, and the system  
calculates the appropriate CheckpointSegments with the reverse of that  
formula. That's a lot more intuitive for administrators to set.  
  
Reviewed by Amit Kapila and Venkata Balaji N.  

M doc/src/sgml/config.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/checkpointer.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
M src/include/utils/guc.h

Renumber GUC_* constants.

commit   : 0fec000365c25fd89ea583673de226e816dba60f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 18:33:16 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 18:33:16 +0200    

Click here for diff

This moves all the regular flags back together (for aesthetic reasons), and  
makes room for more GUC_UNIT_* types.  

M src/include/utils/guc.h

Refactor unit conversions code in guc.c.

commit   : 1b6302647302f459fdb63008c3842a1b0d43d1b7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 18:06:16 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 18:06:16 +0200    

Click here for diff

Replace the if-switch-case constructs with two conversion tables,  
containing all the supported conversions between human-readable unit  
strings and the base units used in GUC variables. This makes the code  
easier to read, and makes adding new units simpler.  

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

Guard against spurious signals in LockBufferForCleanup.

commit   : bc208a5a2f9eb34bf795374fa5381e0c82073255    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Feb 2015 16:11:11 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Feb 2015 16:11:11 +0100    

Click here for diff

When LockBufferForCleanup() has to wait for getting a cleanup lock on a  
buffer it does so by setting a flag in the buffer header and then wait  
for other backends to signal it using ProcWaitForSignal().  
Unfortunately LockBufferForCleanup() missed that ProcWaitForSignal() can  
return for other reasons than the signal it is hoping for. If such a  
spurious signal arrives the wait flags on the buffer header will still  
be set. That then triggers "ERROR: multiple backends attempting to wait  
for pincount 1".  
  
The fix is simple, unset the flag if still set when retrying. That  
implies an additional spinlock acquisition/release, but that's unlikely  
to matter given the cost of waiting for a cleanup lock.  Alternatively  
it'd have been possible to move responsibility for maintaining the  
relevant flag to the waiter all together, but that might have had  
negative consequences due to possible floods of signals. Besides being  
more invasive.  
  
This looks to be a very longstanding bug. The relevant code in  
LockBufferForCleanup() hasn't changed materially since its introduction  
and ProcWaitForSignal() was documented to return for unrelated reasons  
since 8.2.  The master only patch series removing ImmediateInterruptOK  
made it much easier to hit though, as ProcSendSignal/ProcWaitForSignal  
now uses a latch shared with other tasks.  
  
Per discussion with Kevin Grittner, Tom Lane and me.  
  
Backpatch to all supported branches.  
  
Discussion: [email protected]  

M src/backend/storage/buffer/bufmgr.c

Add GUC to control the time to wait before retrieving WAL after failed attempt.

commit   : 5d2b45e3f78a85639f30431181c06d4c3221c5a1    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 23 Feb 2015 20:55:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 23 Feb 2015 20:55:17 +0900    

Click here for diff

Previously when the standby server failed to retrieve WAL files from any sources  
(i.e., streaming replication, local pg_xlog directory or WAL archive), it always  
waited for five seconds (hard-coded) before the next attempt. For example,  
this is problematic in warm-standby because restore_command can fail  
every five seconds even while new WAL file is expected to be unavailable for  
a long time and flood the log files with its error messages.  
  
This commit adds new parameter, wal_retrieve_retry_interval, to control that  
wait time.  
  
Alexey Vasiliev and Michael Paquier, reviewed by Andres Freund and me.  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h

Fix potential deadlock with libpq non-blocking mode.

commit   : 2a3f6e368babdac7b586a7d43105af60fc08b1a3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 13:32:34 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Feb 2015 13:32:34 +0200    

Click here for diff

If libpq output buffer is full, pqSendSome() function tries to drain any  
incoming data. This avoids deadlock, if the server e.g. sends a lot of  
NOTICE messages, and blocks until we read them. However, pqSendSome() only  
did that in blocking mode. In non-blocking mode, the deadlock could still  
happen.  
  
To fix, take a two-pronged approach:  
  
1. Change the documentation to instruct that when PQflush() returns 1, you  
should wait for both read- and write-ready, and call PQconsumeInput() if it  
becomes read-ready. That fixes the deadlock, but applications are not going  
to change overnight.  
  
2. In pqSendSome(), drain the input buffer before returning 1. This  
alleviates the problem for applications that only wait for write-ready. In  
particular, a slow but steady stream of NOTICE messages during COPY FROM  
STDIN will no longer cause a deadlock. The risk remains that the server  
attempts to send a large burst of data and fills its output buffer, and at  
the same time the client also sends enough data to fill its output buffer.  
The application will deadlock if it goes to sleep, waiting for the socket  
to become write-ready, before the server's data arrives. In practice,  
NOTICE messages and such that the server might be sending are usually  
short, so it's highly unlikely that the server would fill its output buffer  
so quickly.  
  
Backpatch to all supported versions.  

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

Add parse location fields to NullTest and BooleanTest structs.

commit   : c063da1769229efa8d8d21f0d068b3199ea3a6b3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Feb 2015 14:40:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Feb 2015 14:40:27 -0500    

Click here for diff

We did not need a location tag on NullTest or BooleanTest before, because  
no error messages referred directly to their locations.  That's planned  
to change though, so add these fields in a separate housekeeping commit.  
  
Catversion bump because stored rules may change.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/rewrite/rewriteManip.c
M src/include/catalog/catversion.h
M src/include/nodes/primnodes.h

Get rid of multiple applications of transformExpr() to the same tree.

commit   : 6a75562ed16b5fa52cfd8830e4546972e647db26    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Feb 2015 13:59:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Feb 2015 13:59:09 -0500    

Click here for diff

transformExpr() has for many years had provisions to do nothing when  
applied to an already-transformed expression tree.  However, this was  
always ugly and of dubious reliability, so we'd be much better off without  
it.  The primary historical reason for it was that gram.y sometimes  
returned multiple links to the same subexpression, which is no longer true  
as of my BETWEEN fixes.  We'd also grown some lazy hacks in CREATE TABLE  
LIKE (failing to distinguish between raw and already-transformed index  
specifications) and one or two other places.  
  
This patch removes the need for and support for re-transforming already  
transformed expressions.  The index case is dealt with by adding a flag  
to struct IndexStmt to indicate that it's already been transformed;  
which has some benefit anyway in that tablecmds.c can now Assert that  
transformation has happened rather than just assuming.  The other main  
reason was some rather sloppy code for array type coercion, which can  
be fixed (and its performance improved too) by refactoring.  
  
I did leave transformJoinUsingClause() still constructing expressions  
containing untransformed operator nodes being applied to Vars, so that  
transformExpr() still has to allow Var inputs.  But that's a much narrower,  
and safer, special case than before, since Vars will never appear in a raw  
parse tree, and they don't have any substructure to worry about.  
  
In passing fix some oversights in the patch that added CREATE INDEX  
IF NOT EXISTS (missing processing of IndexStmt.if_not_exists).  These  
appear relatively harmless, but still sloppy coding practice.  

M src/backend/bootstrap/bootparse.y
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_utilcmd.c
M src/include/nodes/parsenodes.h

Represent BETWEEN as a special node type in raw parse trees.

commit   : 34af082f95aa6adb8af5fbd4da46bd4c3c176856    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Feb 2015 13:57:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Feb 2015 13:57:56 -0500    

Click here for diff

Previously, gram.y itself converted BETWEEN into AND (or AND/OR) nests of  
expression comparisons.  This was always as bogus as could be, but fixing  
it hasn't risen to the top of the to-do list.  The present patch invents an  
A_Expr representation for BETWEEN expressions, and does the expansion to  
comparison trees in parse_expr.c which is at least a slightly saner place  
to be doing semantic conversions.  There should be no change in the post-  
parse-analysis results.  
  
This does nothing for the semantic issues with BETWEEN (dubious connection  
to btree-opclass semantics, and multiple evaluation of possibly volatile  
subexpressions) ... but it's a necessary preliminary step before we could  
fix any of that.  The main immediate benefit is that preserving BETWEEN as  
an identifiable raw-parse-tree construct will enable better error messages.  
  
While at it, fix the code so that multiply-referenced subexpressions are  
physically duplicated before being passed through transformExpr().  This  
gets rid of one of the principal reasons why transformExpr() has  
historically had to allow already-processed input.  

M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/include/nodes/parsenodes.h

Rename variable in AllocSetContextCreate to be consistent.

commit   : 74811c4050921959d54d42e2c15bb79f0e2c37f3    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 21 Feb 2015 23:17:52 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 21 Feb 2015 23:17:52 -0800    

Click here for diff

Everywhere else in the file, "context" is of type MemoryContext and  
"set" is of type AllocSet. AllocSetContextCreate uses a variable of  
type AllocSet, so rename it from "context" to "set".  

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

In array_agg(), don't create a new context for every group.

commit   : b419865a814abbca12bdd6eef6a3d5ed67f432e1    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 21 Feb 2015 17:24:48 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 21 Feb 2015 17:24:48 -0800    

Click here for diff

Previously, each new array created a new memory context that started  
out at 8kB. This is incredibly wasteful when there are lots of small  
groups of just a few elements each.  
  
Change initArrayResult() and friends to accept a "subcontext" argument  
to indicate whether the caller wants the ArrayBuildState allocated in  
a new subcontext or not. If not, it can no longer be released  
separately from the rest of the memory context.  
  
Fixes bug report by Frank van Vugt on 2013-10-19.  
  
Tomas Vondra. Reviewed by Ali Akbar, Tom Lane, and me.  

M src/backend/executor/nodeSubplan.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/xml.c
M src/include/utils/array.h
M src/pl/plperl/plperl.c

Try to fix busted gettimeofday() code.

commit   : e9fd5545de3bb4efe163af4a9c957badac86ccd7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 17:15:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 17:15:13 -0500    

Click here for diff

Per buildfarm, we have to match the _stdcall property of the system  
functions.  

M src/port/gettimeofday.c

Use FLEXIBLE_ARRAY_MEMBER in Windows-specific code.

commit   : 332f02f88beead6365bc2126c95451520bbfe163    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 16:49:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 16:49:28 -0500    

Click here for diff

Be a tad more paranoid about overlength input, too.  

M src/port/dirmod.c

Force some system catalog table columns to be marked NOT NULL.

commit   : 82a532b34d7547b43b90e2e4d4953f4be1c655b8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 21 Feb 2015 22:37:05 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 21 Feb 2015 22:37:05 +0100    

Click here for diff

In a manual pass over the catalog declaration I found a number of  
columns which the boostrap automatism didn't mark NOT NULL even though  
they actually were. Add BKI_FORCE_NOT_NULL markings to them.  
  
It's usually not critical if a system table column is falsely determined  
to be nullable as the code should always catch relevant cases. But it's  
good to have a extra layer in place.  
  
Discussion: [email protected]  

M src/include/catalog/pg_description.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_trigger.h

Allow forcing nullness of columns during bootstrap.

commit   : eb68379c38202180bc8e33fb9987284e314b7fc8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 21 Feb 2015 22:25:49 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 21 Feb 2015 22:25:49 +0100    

Click here for diff

Bootstrap determines whether a column is null based on simple builtin  
rules. Those work surprisingly well, but nonetheless a few existing  
columns aren't set correctly. Additionally there is at least one patch  
sent to hackers where forcing the nullness of a column would be helpful.  
  
The boostrap format has gained FORCE [NOT] NULL for this, which will be  
emitted by genbki.pl when BKI_FORCE_(NOT_)?NULL is specified for a  
column in a catalog header.  
  
This patch doesn't change the marking of any existing columns.  
  
Discussion: [email protected]  

M doc/src/sgml/bki.sgml
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/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/include/bootstrap/bootstrap.h
M src/include/catalog/genbki.h

Don't need to explain [1] kluge anymore in xfunc.sgml.

commit   : 0627eff3602c0ce0e8358d48ddb3ffa73963e4d0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 16:29:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 16:29:45 -0500    

Click here for diff

M doc/src/sgml/xfunc.sgml

Use FLEXIBLE_ARRAY_MEMBER in a number of other places.

commit   : 2e211211a76782b6084194a5ced94c0795460047    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 16:12:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 16:12:14 -0500    

Click here for diff

I think we're about done with this...  

M contrib/hstore/hstore_gist.c
M contrib/spi/timetravel.c
M src/backend/access/heap/syncscan.c
M src/backend/commands/async.c
M src/backend/libpq/auth.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/txid.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/sort/logtape.c
M src/interfaces/ecpg/ecpglib/extern.h

Use FLEXIBLE_ARRAY_MEMBER for HeapTupleHeaderData.t_bits[].

commit   : e1a11d93111ff3fba7a91f3f2ac0b0aca16909a8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 15:13:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 15:13:06 -0500    

Click here for diff

This requires changing quite a few places that were depending on  
sizeof(HeapTupleHeaderData), but it seems for the best.  
  
Michael Paquier, some adjustments by me  

M contrib/file_fdw/file_fdw.c
M contrib/pageinspect/heapfuncs.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/common/heaptuple.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/tuptoaster.c
M src/backend/catalog/toasting.c
M src/backend/executor/nodeHash.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/plancat.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/adt/trigfuncs.c
M src/include/access/htup_details.h
M src/include/access/tuptoaster.h
M src/include/replication/reorderbuffer.h

Minor code beautification in conninfo_uri_parse_params().

commit   : 3d9b6f31eec150b5a6000e0814e81e36d9eb069a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 13:27:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 13:27:12 -0500    

Click here for diff

Reading this made me itch, so clean the logic a bit.  

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

Fix misparsing of empty value in conninfo_uri_parse_params().

commit   : b26e2081423cf1c70f83a11787351017c97cfd7c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 12:59:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 12:59:25 -0500    

Click here for diff

After finding an "=" character, the pointer was advanced twice when it  
should only advance once.  This is harmless as long as the value after "="  
has at least one character; but if it doesn't, we'd miss the terminator  
character and include too much in the value.  
  
In principle this could lead to reading off the end of memory.  It does not  
seem worth treating as a security issue though, because it would happen on  
client side, and besides client logic that's taking conninfo strings from  
untrusted sources has much worse security problems than this.  
  
Report and patch received off-list from Thomas Fanghaenel.  
Back-patch to 9.2 where the faulty code was introduced.  

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

Don't require users of src/port/gettimeofday.c to initialize it.

commit   : 64235fecc6d377690444ca3702257b5e39ed3413    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 21 Feb 2015 12:13:47 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 21 Feb 2015 12:13:47 -0500    

Click here for diff

Commit 8001fe67a3d66c95861ce1f7075ef03953670d13 introduced this  
requirement, but per discussion, we want to avoid requirements of  
this type to make things easier on the calling code.  An especially  
important consideration is that this may be used in frontend code,  
not just the backend.  
  
Asif Naeem, reviewed by Michael Paquier  

M src/backend/main/main.c
M src/include/port.h
M src/port/gettimeofday.c

Some more FLEXIBLE_ARRAY_MEMBER fixes.

commit   : f2874feb7c4e71200539c0287544eeebd8fcb3d4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 01:46:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Feb 2015 01:46:43 -0500    

Click here for diff

M src/backend/optimizer/plan/setrefs.c
M src/include/access/brin_page.h
M src/include/replication/slot.h
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-int.h
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/plpgsql.h

Fix statically allocated struct with FLEXIBLE_ARRAY_MEMBER member.

commit   : 33b2a2c97f3dd4cf8bbc2c020e34129886367b72    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 17:50:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 17:50:18 -0500    

Click here for diff

clang complains about this, not unreasonably, so define another struct  
that's explicitly for a WordEntryPos with exactly one element.  
  
While at it, get rid of pretty dubious use of a static variable for  
more than one purpose --- if it were being treated as const maybe  
I'd be okay with this, but it isn't.  

M src/backend/utils/adt/tsrank.c
M src/include/tsearch/ts_type.h

Use FLEXIBLE_ARRAY_MEMBER in some more places.

commit   : 33a3b03d636b529b27f869e332b6344d52635331    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 17:32:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 17:32:01 -0500    

Click here for diff

Fix a batch of structs that are only visible within individual .c files.  
  
Michael Paquier  

M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeAgg.c
M src/backend/postmaster/checkpointer.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/typcache.c

Use FLEXIBLE_ARRAY_MEMBER in struct RecordIOData.

commit   : c110eff1324f5c882c737ad988191ed4a54c4936    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 17:03:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 17:03:12 -0500    

Click here for diff

I (tgl) fixed this last night in rowtypes.c, but I missed that the  
code had been copied into a couple of other places.  
  
Michael Paquier  

M contrib/hstore/hstore_io.c
M src/backend/utils/adt/jsonfuncs.c

Use FLEXIBLE_ARRAY_MEMBER in struct varlena.

commit   : e38b1eb0986990d539e056a65c6b122b295ce932    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 16:51:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 16:51:53 -0500    

Click here for diff

This forces some minor coding adjustments in tuptoaster.c and inv_api.c,  
but the new coding there is cleaner anyway.  
  
Michael Paquier  

M src/backend/access/heap/tuptoaster.c
M src/backend/storage/large_object/inv_api.c
M src/include/c.h

Remove unnecessary and unreliable test

commit   : 8902f79264d95ed84e4c9fb4749b3956b4c74349    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Feb 2015 14:03:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Feb 2015 14:03:49 -0300    

Click here for diff

M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/prepared_xacts.sql

Update PGSTAT_FILE_FORMAT_ID

commit   : 3b14bb77716a01915da4833194e7c8c1c51da66d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Feb 2015 12:59:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Feb 2015 12:59:27 -0300    

Click here for diff

Previous commit should have bumped it but didn't.  Oops.  
  
Per note from Tom.  

M src/include/pgstat.h

Have TRUNCATE update pgstat tuple counters

commit   : d42358efb16cc81122c53ffb35ac381b9158e519    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Feb 2015 12:10:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Feb 2015 12:10:01 -0300    

Click here for diff

This works by keeping a per-subtransaction record of the ins/upd/del  
counters before the truncate, and then resetting them; this record is  
useful to return to the previous state in case the truncate is rolled  
back, either in a subtransaction or whole transaction.  The state is  
propagated upwards as subtransactions commit.  
  
When the per-table data is sent to the stats collector, a flag indicates  
to reset the live/dead counters to zero as well.  
  
Catalog version bumped due to the change in pgstat format.  
  
Author: Alexander Shulgin  
Discussion: [email protected]  
Discussion: [email protected]  
Reviewed-by: Álvaro Herrera, Jim Nasby  

M src/backend/commands/tablecmds.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h
M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/prepared_xacts.sql
M src/test/regress/sql/stats.sql

Some more FLEXIBLE_ARRAY_MEMBER hacking.

commit   : 5740be6d6e39dd85587aa71b3bd1fb0a423858b0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 02:28:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 02:28:03 -0500    

Click here for diff

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

Remove unused variable.

commit   : 9aa53bbd15ef65a4be6c09709fbe985898ae9ad7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 00:47:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 00:47:28 -0500    

Click here for diff

Per buildfarm.  

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

Use "#ifdef CATALOG_VARLEN" to protect nullable fields of pg_authid.

commit   : 692bd09ad12a27fda3566787b089fbd394d7b65b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 00:23:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 00:23:48 -0500    

Click here for diff

This gives a stronger guarantee than a mere comment against accessing these  
fields as simple struct members.  Since rolpassword is in fact varlena,  
it's not clear why these didn't get marked from the beginning, but let's  
do it now.  
  
Michael Paquier  

M src/include/catalog/pg_authid.h

Use FLEXIBLE_ARRAY_MEMBER in a bunch more places.

commit   : 09d8d110a604e52216102e73fb8475b7aa88f1d1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 00:11:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Feb 2015 00:11:42 -0500    

Click here for diff

Replace some bogus "x[1]" declarations with "x[FLEXIBLE_ARRAY_MEMBER]".  
Aside from being more self-documenting, this should help prevent bogus  
warnings from static code analyzers and perhaps compiler misoptimizations.  
  
This patch is just a down payment on eliminating the whole problem, but  
it gets rid of a lot of easy-to-fix cases.  
  
Note that the main problem with doing this is that one must no longer rely  
on computing sizeof(the containing struct), since the result would be  
compiler-dependent.  Instead use offsetof(struct, lastfield).  Autoconf  
also warns against spelling that offsetof(struct, lastfield[0]).  
  
Michael Paquier, review and additional fixes by me.  

M contrib/cube/cubedata.h
M contrib/intarray/_int.h
M contrib/ltree/ltree.h
M contrib/pageinspect/rawpage.c
M contrib/pg_trgm/trgm.h
M src/backend/catalog/namespace.c
M src/backend/commands/prepare.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/nodes/params.c
M src/backend/postmaster/syslogger.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/cache/catcache.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/heapam_xlog.h
M src/include/access/spgist_private.h
M src/include/access/xact.h
M src/include/c.h
M src/include/catalog/namespace.h
M src/include/commands/dbcommands.h
M src/include/commands/tablespace.h
M src/include/executor/hashjoin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/params.h
M src/include/nodes/tidbitmap.h
M src/include/postgres.h
M src/include/postmaster/syslogger.h
M src/include/replication/walsender_private.h
M src/include/storage/bufpage.h
M src/include/storage/fsm_internals.h
M src/include/storage/standby.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_type.h
M src/include/utils/catcache.h
M src/include/utils/datetime.h
M src/include/utils/geo_decls.h
M src/include/utils/jsonb.h
M src/include/utils/relmapper.h
M src/include/utils/varbit.h

Add pg_stat_get_snapshot_timestamp() to show statistics snapshot timestamp.

commit   : 2fb7a75f37d0beca80f45e15736ec8d50064228a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Feb 2015 21:36:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Feb 2015 21:36:50 -0500    

Click here for diff

Per discussion, this could be useful for purposes such as programmatically  
detecting a nonresponding stats collector.  We already have the timestamp  
anyway, it's just a matter of providing a SQL-accessible function to fetch  
it.  
  
Matt Kelly, reviewed by Jim Nasby  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Remove dead structs.

commit   : 634618ecd039cf99fb8212b0314ef8a3754ca9c2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Feb 2015 21:13:15 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Feb 2015 21:13:15 +0200    

Click here for diff

These are not used with the new WAL format anymore. GIN split records are  
simply always recorded as full-page images.  
  
Michael Paquier  

M src/include/access/gin_private.h

commit   : 9bb955c8286c20474b5462eea3e3cf76c694d88f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 22:33:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 22:33:39 -0500    

Click here for diff

While working on documentation for expanded arrays, I noticed a number of  
details in the TOAST-related documentation that were already inaccurate or  
obsolete.  This should be fixed independently of whether expanded arrays  
get in or not.  One issue is that the already existing indirect-pointer  
facility was not documented at all.  Also, the documentation says that you  
only need to use VARSIZE/SET_VARSIZE if you've made your variable-length  
type TOAST-aware, but actually we've forced that business on all varlena  
types even if they've opted out of TOAST by setting storage = plain.  
Wordsmith a few other things too, like an amusingly archaic claim that  
there are few 64-bit machines.  
  
I thought about back-patching this, but since all this doco is oriented  
to hackers and C-coded extension authors, fixing it in HEAD is probably  
good enough.  

M doc/src/sgml/ref/create_type.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/xtypes.sgml

Split array_push into separate array_append and array_prepend functions.

commit   : 56a79a869bedc4bf6c35853642694cc0b0594dd2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 20:53:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 20:53:14 -0500    

Click here for diff

There wasn't any good reason for a single C function to implement both  
these SQL functions: it saved very little code overall, and it required  
significant pushups to re-determine at runtime which case applied.  Redoing  
it as two functions ends up with just slightly more lines of code, but it's  
simpler to understand, and faster too because we need not repeat syscache  
lookups on every call.  
  
An important side benefit is that this eliminates the only case in which  
different aliases of the same C function had both anyarray and anyelement  
arguments at the same position, which would almost always be a mistake.  
The opr_sanity regression test will now notice such mistakes since there's  
no longer a valid case where it happens.  

M src/backend/utils/adt/array_userfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/array.h
M src/test/regress/expected/opr_sanity.out

Fix Perl coding error in msvc build system

commit   : d30292b8c45a1d909ff7d84bd6787c8827134fc3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 Feb 2015 20:24:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 Feb 2015 20:24:30 -0500    

Click here for diff

Code like  
  
    open(P, "cl /? 2>&1 |") || die "cl command not found";  
  
does not actually catch any errors, because the exit status of the  
command before the pipe is ignored.  The fix is to look at $?.  
  
This also gave the opportunity to clean up the logic of this code a bit.  

M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Fix opclass/opfamily identity strings

commit   : 9c7dd350199fa030ccbd5538e1b8e13a9603fda4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Feb 2015 14:44:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Feb 2015 14:44:27 -0300    

Click here for diff

The original representation uses "opcname for amname", which is good  
enough; but if we replace "for" with "using", we can apply the returned  
identity directly in a DROP command, as in  
  
DROP OPERATOR CLASS opcname USING amname  
  
This slightly simplifies code using object identities to programatically  
execute commands on these kinds of objects.  
  
Note backwards-incompatible change:  
The previous representation dates back to 9.3 when object identities  
were introduced by commit f8348ea3, but we don't want to change the  
behavior on released branches unnecessarily and so this is not  
backpatched.  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out

Fix object identities for pg_conversion objects

commit   : 0d906798f680b2dd86cbc8d31ba64685aeb12092    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Feb 2015 14:28:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Feb 2015 14:28:11 -0300    

Click here for diff

We were neglecting to schema-qualify them.  
  
Backpatch to 9.3, where object identities were introduced as a concept  
by commit f8348ea32ec8.  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out

Fix placement of "SET row_security" command issuance in pg_dump.

commit   : 297b2c1ef9878f84a9951beadf831ef390227238    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 12:23:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 12:23:40 -0500    

Click here for diff

Somebody apparently threw darts at the code to decide where to insert  
these.  They certainly didn't proceed by adding them where other similar  
SETs were handled.  This at least broke pg_restore, and perhaps other  
use-cases too.  

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

Fix failure to honor -Z compression level option in pg_dump -Fd.

commit   : 0e7e355f27302b62af3e1add93853ccd45678443    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 11:43:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Feb 2015 11:43:00 -0500    

Click here for diff

cfopen() and cfopen_write() failed to pass the compression level through  
to zlib, so that you always got the default compression level if you got  
any at all.  
  
In passing, also fix these and related functions so that the correct errno  
is reliably returned on failure; the original coding supposes that free()  
cannot change errno, which is untrue on at least some platforms.  
  
Per bug #12779 from Christoph Berg.  Back-patch to 9.1 where the faulty  
code was introduced.  
  
Michael Paquier  

M src/bin/pg_dump/compress_io.c

Fix EXPLAIN output for cases where parent table is excluded by constraints.

commit   : abe45a9b315d7b3739f442597f570f9454bd466d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Feb 2015 18:04:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Feb 2015 18:04:11 -0500    

Click here for diff

The previous coding in EXPLAIN always labeled a ModifyTable node with the  
name of the target table affected by its first child plan.  When originally  
written, this was necessarily the parent table of the inheritance tree,  
so everything was unconfusing.  But when we added NO INHERIT constraints,  
it became possible for the parent table to be deleted from the plan by  
constraint exclusion while still leaving child tables present.  This led to  
the ModifyTable plan node being labeled with the first surviving child,  
which was deemed confusing.  Fix it by retaining the parent table's RT  
index in a new field in ModifyTable.  
  
Etsuro Fujita, reviewed by Ashutosh Bapat and myself  

M src/backend/commands/explain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h

Fix a bug in pairing heap removal code.

commit   : 931bf3eb9b203ca02d729f5122a44cc250c27695    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Feb 2015 22:55:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Feb 2015 22:55:53 +0200    

Click here for diff

After removal, the next_sibling pointer of a node was sometimes incorrectly  
left to point to another node in the heap, which meant that a node was  
sometimes linked twice into the heap. Surprisingly that didn't cause any  
crashes in my testing, but it was clearly wrong and could easily segfault  
in other scenarios.  
  
Also always keep the prev_or_parent pointer as NULL on the root node. That  
was not a correctness issue AFAICS, but let's be tidy.  
  
Add a debugging function, to dump the contents of a pairing heap as a  
string. It's #ifdef'd out, as it's not used for anything in any normal  
code, but it was highly useful in debugging this. Let's keep it handy for  
further reference.  

M src/backend/lib/pairingheap.c
M src/include/lib/pairingheap.h

Fix knn-GiST queue comparison function to return heap tuples first.

commit   : d17b6df239e6eebf288969e931cdbe8076d1fe12    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Feb 2015 22:33:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Feb 2015 22:33:38 +0200    

Click here for diff

The part of the comparison function that was supposed to keep heap tuples  
ahead of index items was backwards. It would not lead to incorrect results,  
but it is more efficient to return heap tuples first, before scanning more  
index pages, when both have the same distance.  
  
Alexander Korotkov  

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

Remove code to match IPv4 pg_hba.conf entries to IPv4-in-IPv6 addresses.

commit   : 2e105def09f27d49c1761abab06b427cfaa5d304    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Feb 2015 12:49:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Feb 2015 12:49:18 -0500    

Click here for diff

In investigating yesterday's crash report from Hugo Osvaldo Barrera, I only  
looked back as far as commit f3aec2c7f51904e7 where the breakage occurred  
(which is why I thought the IPv4-in-IPv6 business was undocumented).  But  
actually the logic dates back to commit 3c9bb8886df7d56a and was simply  
broken by erroneous refactoring in the later commit.  A bit of archives  
excavation shows that we added the whole business in response to a report  
that some 2003-era Linux kernels would report IPv4 connections as having  
IPv4-in-IPv6 addresses.  The fact that we've had no complaints since 9.0  
seems to be sufficient confirmation that no modern kernels do that, so  
let's just rip it all out rather than trying to fix it.  
  
Do this in the back branches too, thus essentially deciding that our  
effective behavior since 9.0 is correct.  If there are any platforms on  
which the kernel reports IPv4-in-IPv6 addresses as such, yesterday's fix  
would have made for a subtle and potentially security-sensitive change in  
the effective meaning of IPv4 pg_hba.conf entries, which does not seem like  
a good thing to do in minor releases.  So let's let the post-9.0 behavior  
stand, and change the documentation to match it.  
  
In passing, I failed to resist the temptation to wordsmith the description  
of pg_hba.conf IPv4 and IPv6 address entries a bit.  A lot of this text  
hasn't been touched since we were IPv4-only.  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/hba.c
M src/backend/libpq/ip.c
M src/include/libpq/ip.h

Improve pg_check_dir code and comments.

commit   : 5d6c2405f4bae6c87533d981d6a47587db501220    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Feb 2015 10:19:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Feb 2015 10:19:30 -0500    

Click here for diff

Avoid losing errno if readdir() fails and closedir() works.  Consistently  
return 4 rather than 3 if both a lost+found directory and other files are  
found, rather than returning one value or the other depending on the  
order of the directory listing.  Update comments to match the actual  
behavior.  
  
These oversights date to commits 6f03927fce038096f53ca67eeab9adb24938f8a6  
and 17f15239325a88581bb4f9cf91d38005f1f52d69.  
  
Marco Nenciarini  

M src/port/pgcheckdir.c

Eliminate unnecessary NULL checks in picksplit method of intarray.

commit   : c923e82a231ebfe7c4329984c68819e26837bee6    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 16 Feb 2015 15:26:23 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 16 Feb 2015 15:26:23 -0600    

Click here for diff

Where these checks were being done there was no code path which  
could leave them NULL.  
  
Michael Paquier per Coverity  

M contrib/intarray/_int_gist.c

Fix misuse of memcpy() in check_ip().

commit   : cb66f495f5d0c204f051971f2c549d5c3ac850ea    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Feb 2015 16:17:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Feb 2015 16:17:48 -0500    

Click here for diff

The previous coding copied garbage into a local variable, pretty much  
ensuring that the intended test of an IPv6 connection address against a  
promoted IPv4 address from pg_hba.conf would never match.  The lack of  
field complaints likely indicates that nobody realized this was supposed  
to work, which is unsurprising considering that no user-facing docs suggest  
it should work.  
  
In principle this could have led to a SIGSEGV due to reading off the end of  
memory, but since the source address would have pointed to somewhere in the  
function's stack frame, that's quite unlikely.  What led to discovery of  
the bug is Hugo Osvaldo Barrera's report of a crash after an OS upgrade,  
which is probably because he is now running a system in which memcpy raises  
abort() upon detecting overlapping source and destination areas.  (You'd  
have to additionally suppose some things about the stack frame layout to  
arrive at this conclusion, but it seems plausible.)  
  
This has been broken since the code was added, in commit f3aec2c7f51904e7,  
so back-patch to all supported branches.  

M src/backend/libpq/hba.c

Fix comment in libpq OpenSSL code about why a substitue BIO is used.

commit   : c478959a009a926ec441f355219eae18537e648c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Feb 2015 23:05:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Feb 2015 23:05:20 +0200    

Click here for diff

The comment was copy-pasted from the backend code along with the  
implementation, but libpq has different reasons for using the BIO.  

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

Restore the SSL_set_session_id_context() call to OpenSSL renegotiation.

commit   : 1c2b7c0879d83ff79e4adf2c0a883df92b713da4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Feb 2015 22:34:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Feb 2015 22:34:32 +0200    

Click here for diff

This reverts the removal of the call in commit (272923a0). It turns out it  
wasn't superfluous after all: without it, renegotiation fails if a client  
certificate was used. The rest of the changes in that commit are still OK  
and not reverted.  
  
Per investigation of bug #12769 by Arne Scheffer, although this doesn't fix  
the reported bug yet.  

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

Use fast path in plpgsql's RETURN/RETURN NEXT in more cases.

commit   : 9e3ad1aac52454569393a947c06be0d301749362    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Feb 2015 15:28:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Feb 2015 15:28:40 -0500    

Click here for diff

exec_stmt_return() and exec_stmt_return_next() have fast-path code for  
handling a simple variable reference (i.e. "return var") without going  
through the full expression evaluation machinery.  For some reason,  
pl_gram.y was under the impression that this fast path only applied for  
record/row variables; but in reality code for handling regular scalar  
variables has been there all along.  Adjusting the logic to allow that  
code to be used actually results in a net savings of code in pl_gram.y  
(by eliminating some redundancy), and it buys a measurable though not  
very impressive amount of speedup.  
  
Noted while fooling with my expanded-array patch, wherein this makes a much  
bigger difference because it enables returning an expanded array variable  
without an extra flattening step.  But AFAICS this is a win regardless,  
so commit it separately.  

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

In the SSL test suite, use a root CA cert that won't expire (so quickly)

commit   : 2c75531a6cc49a56afbd5619c36b3daccbe243fa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Feb 2015 22:08:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Feb 2015 22:08:41 +0200    

Click here for diff

All the other certificates were created to be valid for 10000 days, because  
we don't want to have to recreate them. But I missed the root CA cert, and  
the pre-created certificates included in the repository expired in January.  
Fix, and re-create all the certificates.  

M src/test/ssl/Makefile
M src/test/ssl/ssl/both-cas-1.crt
M src/test/ssl/ssl/both-cas-2.crt
M src/test/ssl/ssl/client-revoked.crt
M src/test/ssl/ssl/client-revoked.key
M src/test/ssl/ssl/client.crl
M src/test/ssl/ssl/client.crt
M src/test/ssl/ssl/client.key
M src/test/ssl/ssl/client_ca.crt
M src/test/ssl/ssl/client_ca.key
M src/test/ssl/ssl/root+client.crl
M src/test/ssl/ssl/root+client_ca.crt
M src/test/ssl/ssl/root+server.crl
M src/test/ssl/ssl/root+server_ca.crt
M src/test/ssl/ssl/root.crl
M src/test/ssl/ssl/root_ca.crt
M src/test/ssl/ssl/root_ca.key
M src/test/ssl/ssl/server-cn-and-alt-names.crt
M src/test/ssl/ssl/server-cn-and-alt-names.key
M src/test/ssl/ssl/server-cn-only.crt
M src/test/ssl/ssl/server-cn-only.key
M src/test/ssl/ssl/server-multiple-alt-names.crt
M src/test/ssl/ssl/server-multiple-alt-names.key
M src/test/ssl/ssl/server-no-names.crt
M src/test/ssl/ssl/server-no-names.key
M src/test/ssl/ssl/server-revoked.crt
M src/test/ssl/ssl/server-revoked.key
M src/test/ssl/ssl/server-single-alt-name.crt
M src/test/ssl/ssl/server-single-alt-name.key
M src/test/ssl/ssl/server-ss.crt
M src/test/ssl/ssl/server-ss.key
M src/test/ssl/ssl/server.crl
M src/test/ssl/ssl/server_ca.crt
M src/test/ssl/ssl/server_ca.key

Rationalize the APIs of array element/slice access functions.

commit   : e983c4d1aa42d613542cf222e222b034918374b1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Feb 2015 12:23:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Feb 2015 12:23:58 -0500    

Click here for diff

The four functions array_ref, array_set, array_get_slice, array_set_slice  
have traditionally declared their array inputs and results as being of type  
"ArrayType *".  This is a lie, and has been since Berkeley days, because  
they actually also support "fixed-length array" types such as "name" and  
"point"; not to mention that the inputs could be toasted.  These values  
should be declared Datum instead to avoid confusion.  The current coding  
already risks possible misoptimization by compilers, and it'll get worse  
when "expanded" array representations become a valid alternative.  
  
However, there's a fair amount of code using array_ref and array_set with  
arrays that *are* known to be ArrayType structures, and there might be more  
such places in third-party code.  Rather than cluttering those call sites  
with PointerGetDatum/DatumGetArrayTypeP cruft, what I did was to rename the  
existing functions to array_get_element/array_set_element, fix their  
signatures, then reincarnate array_ref/array_set as backwards compatibility  
wrappers.  
  
array_get_slice/array_set_slice have no such constituency in the core code,  
and probably not in third-party code either, so I just changed their APIs.  

M src/backend/executor/execQual.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/arrayfuncs.c
M src/include/utils/array.h
M src/pl/plpgsql/src/pl_exec.c

Correct the path of pg_lzcompress.c in doc.

commit   : cef30974dec2c052170b80eff1fe4b9bb285e903    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 16 Feb 2015 14:50:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 16 Feb 2015 14:50:13 +0900    

Click here for diff

Commit 40bede5 moved pg_lzcompress.c to src/common, but forgot to  
update its path in doc. This commit fixes that oversight.  

M doc/src/sgml/storage.sgml

Fix null-pointer-deref crash while doing COPY IN with check constraints.

commit   : 08361cea2b333189fa3736f2dc6452cef654923d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Feb 2015 23:26:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Feb 2015 23:26:45 -0500    

Click here for diff

In commit bf7ca15875988a88e97302e012d7c4808bef3ea9 I introduced an  
assumption that an RTE referenced by a whole-row Var must have a valid eref  
field.  This is false for RTEs constructed by DoCopy, and there are other  
places taking similar shortcuts.  Perhaps we should make all those places  
go through addRangeTableEntryForRelation or its siblings instead of having  
ad-hoc logic, but the most reliable fix seems to be to make the new code in  
ExecEvalWholeRowVar cope if there's no eref.  We can reasonably assume that  
there's no need to insert column aliases if no aliases were provided.  
  
Add a regression test case covering this, and also verifying that a sane  
column name is in fact available in this situation.  
  
Although the known case only crashes in 9.4 and HEAD, it seems prudent to  
back-patch the code change to 9.2, since all the ingredients for a similar  
failure exist in the variant patch applied to 9.3 and 9.2.  
  
Per report from Jean-Pierre Pelletier.  

M src/backend/executor/execQual.c
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql

Minor housekeeping on JSON docs.

commit   : c5b31e29f0128b1c3c1caeeef81b0986cebdcd03    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 15 Feb 2015 17:08:37 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 15 Feb 2015 17:08:37 -0500    

Click here for diff

M doc/src/sgml/func.sgml

pg_regress: Write processed input/*.source into output dir

commit   : 64cdbbc48cade73d7b0831444a62e19fd4a342f8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 14 Feb 2015 21:33:41 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 14 Feb 2015 21:33:41 -0500    

Click here for diff

Before, it was writing the processed files into the input directory,  
which is incorrect in a vpath build.  

M src/test/regress/pg_regress.c

Avoid returning undefined bytes in chkpass_in().

commit   : 80986e85aafd64165efc7f45b330f2f213713032    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Feb 2015 12:20:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Feb 2015 12:20:56 -0500    

Click here for diff

We can't really fix the problem that the result is defined to depend on  
random(), so it is still going to fail the "unstable input conversion"  
test in parse_type.c.  However, we can at least satify valgrind.  (It  
looks like this code used to be valgrind-clean, actually, until somebody  
did a careless s/strncpy/strlcpy/g on it.)  
  
In passing, let's just make real sure that chkpass_out doesn't overrun  
its output buffer.  
  
No need for backpatch, I think, since this is just to satisfy debugging  
tools.  
  
Asif Naeem  

M contrib/chkpass/chkpass.c

Fix broken #ifdef for __sparcv8

commit   : 33e879c4e9f485405fc19b663392d8635714d020    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Feb 2015 23:51:23 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Feb 2015 23:51:23 +0200    

Click here for diff

Rob Rowan. Backpatch to all supported versions, like the patch that added  
the broken #ifdef.  

M src/include/storage/s_lock.h

Simplify waiting logic in reading from / writing to client.

commit   : 80788a431e9bff06314a054109fdea66ac538199    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Feb 2015 21:46:14 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Feb 2015 21:46:14 +0200    

Click here for diff

The client socket is always in non-blocking mode, and if we actually want  
blocking behaviour, we emulate it by sleeping and retrying. But we have  
retry loops at different layers for reads and writes, which was confusing.  
To simplify, remove all the sleeping and retrying code from the lower  
levels, from be_tls_read and secure_raw_read and secure_raw_write, and put  
all the logic in secure_read() and secure_write().  

M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/pqcomm.c
M src/include/libpq/libpq-be.h

Simplify the way OpenSSL renegotiation is initiated in server.

commit   : 272923a0a6956187471df4f032eee06559520390    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Feb 2015 21:46:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Feb 2015 21:46:08 +0200    

Click here for diff

At least in all modern versions of OpenSSL, it is enough to call  
SSL_renegotiate() once, and then forget about it. Subsequent SSL_write()  
and SSL_read() calls will finish the handshake.  
  
The SSL_set_session_id_context() call is unnecessary too. We only have  
one SSL context, and the SSL session was created with that to begin with.  

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

pg_upgrade: improve checksum mismatch error message

commit   : dc01efa5ccdd9804b0c97d4d9b651ba9360ebb11    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 Feb 2015 22:22:26 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 Feb 2015 22:22:26 -0500    

Click here for diff

Patch by Greg Sabino Mullane, slight adjustments by me  

M contrib/pg_upgrade/controldata.c

pg_upgrade: quote directory names in delete_old_cluster script

commit   : 056764b10248bff702d9d7b8b97690668eaf1c93    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 Feb 2015 22:06:04 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 Feb 2015 22:06:04 -0500    

Click here for diff

This allows the delete script to properly function when special  
characters appear in directory paths, e.g. spaces.  
  
Backpatch through 9.0  

M contrib/pg_upgrade/check.c

pg_upgrade: preserve freeze info for postgres/template1 dbs

commit   : 866f3017a88b9cb639f05c9ad413e5eafe0266e3    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 Feb 2015 21:02:07 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 Feb 2015 21:02:07 -0500    

Click here for diff

pg_database.datfrozenxid and pg_database.datminmxid were not preserved  
for the 'postgres' and 'template1' databases.  This could cause missing  
clog file errors on access to user tables and indexes after upgrades in  
these databases.  
  
Backpatch through 9.0  

M src/bin/pg_dump/pg_dumpall.c

Fix typo in logicaldecoding.sgml.

commit   : 8785e6e378f919827d851926ea0f400f08afd477    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 Feb 2015 01:16:32 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 Feb 2015 01:16:32 +0100    

Click here for diff

Author: Tatsuo Ishii  
  
Backpatch to 9.4, where logicaldecoding was introduced.  

M doc/src/sgml/logicaldecoding.sgml

Fix missing PQclear() in libpqrcv_endstreaming().

commit   : 4f38a281a3d4a7cbcf9de2f676d44336d57b7717    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Feb 2015 19:20:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Feb 2015 19:20:49 -0500    

Click here for diff

This omission leaked one PGresult per WAL streaming cycle, which possibly  
would never be enough to notice in the real world, but it's still a leak.  
  
Per Coverity.  Back-patch to 9.3 where the error was introduced.  

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

Fix minor memory leak in ident_inet().

commit   : 58146d35deed3bd3e05ce4b5ba529e4e4a369ddb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Feb 2015 19:09:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Feb 2015 19:09:54 -0500    

Click here for diff

We'd leak the ident_serv data structure if the second pg_getaddrinfo_all  
(the one for the local address) failed.  This is not of great consequence  
because a failure return here just leads directly to backend exit(), but  
if this function is going to try to clean up after itself at all, it should  
not have such holes in the logic.  Try to fix it in a future-proof way by  
having all the failure exits go through the same cleanup path, rather than  
"optimizing" some of them.  
  
Per Coverity.  Back-patch to 9.2, which is as far back as this patch  
applies cleanly.  

M src/backend/libpq/auth.c

Fix more memory leaks in failure path in buildACLCommands.

commit   : 9179444d070713f53a97bc8f5c898a8304424c4d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Feb 2015 18:35:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Feb 2015 18:35:23 -0500    

Click here for diff

We already had one go at this issue in commit d73b7f973db5ec7e, but we  
failed to notice that buildACLCommands also leaked several PQExpBuffers  
along with a simply malloc'd string.  This time let's try to make the  
fix a bit more future-proof by eliminating the separate exit path.  
  
It's still not exactly critical because pg_dump will curl up and die on  
failure; but since the amount of the potential leak is now several KB,  
it seems worth back-patching as far as 9.2 where the previous fix landed.  
  
Per Coverity, which evidently is smarter than clang's static analyzer.  

M src/bin/pg_dump/dumputils.c

Fix pg_dump's heuristic for deciding which casts to dump.

commit   : 9feefedf9e92066fa6609d1e1e17b4892d81716f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Feb 2015 22:38:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Feb 2015 22:38:15 -0500    

Click here for diff

Back in 2003 we had a discussion about how to decide which casts to dump.  
At the time pg_dump really only considered an object's containing schema  
to decide what to dump (ie, dump whatever's not in pg_catalog), and so  
we chose a complicated idea involving whether the underlying types were to  
be dumped (cf commit a6790ce85752b67ad994f55fdf1a450262ccc32e).  But users  
are allowed to create casts between built-in types, and we failed to dump  
such casts.  Let's get rid of that heuristic, which has accreted even more  
ugliness since then, in favor of just looking at the cast's OID to decide  
if it's a built-in cast or not.  
  
In passing, also fix some really ancient code that supposed that it had to  
manufacture a dependency for the cast on its cast function; that's only  
true when dumping from a pre-7.3 server.  This just resulted in some wasted  
cycles and duplicate dependency-list entries with newer servers, but we  
might as well improve it.  
  
Per gripes from a number of people, most recently Greg Sabino Mullane.  
Back-patch to all supported branches.  

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

Fix GEQO to not assume its join order heuristic always works.

commit   : 1a179f36f7c612d3560a72396c559cd876dfab6b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Feb 2015 20:37:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Feb 2015 20:37:19 -0500    

Click here for diff

Back in commit 400e2c934457bef4bc3cc9a3e49b6289bd761bc0 I rewrote GEQO's  
gimme_tree function to improve its heuristic for modifying the given tour  
into a legal join order.  In what can only be called a fit of hubris,  
I supposed that this new heuristic would *always* find a legal join order,  
and ripped out the old logic that allowed gimme_tree to sometimes fail.  
  
The folly of this is exposed by bug #12760, in which the "greedy" clumping  
behavior of merge_clump() can lead it into a dead end which could only be  
recovered from by un-clumping.  We have no code for that and wouldn't know  
exactly what to do with it if we did.  Rather than try to improve the  
heuristic rules still further, let's just recognize that it *is* a  
heuristic and probably must always have failure cases.  So, put back the  
code removed in the previous commit to allow for failure (but comment it  
a bit better this time).  
  
It's possible that this code was actually fully correct at the time and  
has only been broken by the introduction of LATERAL.  But having seen this  
example I no longer have much faith in that proposition, so back-patch to  
all supported branches.  

M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_pool.c

Fixed array handling in ecpg.

commit   : 1f393fc923ec77f25fd37e16fd8ccb480df82ebb    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 10 Feb 2015 12:00:13 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 10 Feb 2015 12:00:13 +0100    

Click here for diff

When ecpg was rewritten to the new protocol version not all variable types  
were corrected. This patch rewrites the code for these types to fix that. It  
also fixes the documentation to correctly tell the status of array handling.  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/test/expected/sql-array.c
M src/interfaces/ecpg/test/expected/sql-array.stderr
M src/interfaces/ecpg/test/expected/sql-array.stdout
M src/interfaces/ecpg/test/expected/sql-oldexec.c
M src/interfaces/ecpg/test/expected/sql-oldexec.stderr
M src/interfaces/ecpg/test/sql/array.pgc
M src/interfaces/ecpg/test/sql/oldexec.pgc

Speed up CRC calculation using slicing-by-8 algorithm.

commit   : 025c02420de990c15a90e9e3f86fcfbc5b59ee88    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 10 Feb 2015 10:54:40 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 10 Feb 2015 10:54:40 +0200    

Click here for diff

This speeds up WAL generation and replay. The new algorithm is  
significantly faster with large inputs, like full-page images or when  
inserting wide rows. It is slower with tiny inputs, i.e. less than 10 bytes  
or so, but the speedup with longer inputs more than make up for that. Even  
small WAL records at least have 24 byte header in the front.  
  
The output is identical to the current byte-at-a-time computation, so this  
does not affect compatibility. The new algorithm is only used for the  
CRC-32C variant, not the legacy version used in tsquery or the  
"traditional" CRC-32 used in hstore and ltree. Those are not as performance  
critical, and are usually only applied over small inputs, so it seems  
better to not carry around the extra lookup tables to speed up those rare  
cases.  
  
Abhijit Menon-Sen  

M config/c-compiler.m4
M configure
M configure.in
M src/common/pg_crc.c
M src/include/common/pg_crc.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Fix MSVC build.

commit   : cc761b170c5e7b4ef22ed918f4785ec1fabe62cd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Feb 2015 22:13:50 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Feb 2015 22:13:50 +0200    

Click here for diff

When I moved pg_crc.c from src/port to src/common, I forgot to modify MSVC  
build script accordingly.  

M src/tools/msvc/Mkvcbuild.pm

Minor cleanup/code review for "indirect toast" stuff.

commit   : bc4de01db3a210e988dc88b585d7c38e6e7054c7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Feb 2015 12:30:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Feb 2015 12:30:52 -0500    

Click here for diff

Fix some issues I noticed while fooling with an extension to allow an  
additional kind of toast pointer.  Much of this is just comment  
improvement, but there are a couple of actual bugs, which might or might  
not be reachable today depending on what can happen during logical  
decoding.  An example is that toast_flatten_tuple() failed to cover the  
possibility of an indirection pointer in its input.  Back-patch to 9.4  
just in case that is reachable now.  
  
In HEAD, also correct some really minor issues with recent compression  
reorganization, such as dangerously underparenthesized macros.  

M src/backend/access/heap/tuptoaster.c
M src/include/access/tuptoaster.h
M src/include/postgres.h

Move pg_crc.c to src/common, and remove pg_crc_tables.h

commit   : c619c2351f7ec429b6ddce519c939f7b8465d711    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Feb 2015 11:17:56 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Feb 2015 11:17:56 +0200    

Click here for diff

To get CRC functionality in a client program, you now need to link with  
libpgcommon instead of libpgport. The CRC code has nothing to do with  
portability, so libpgcommon is a better home. (libpgcommon didn't exist  
when pg_crc.c was originally moved to src/port.)  
  
Remove the possibility to get CRC functionality by just #including  
pg_crc_tables.h. I'm not aware of any extensions that actually did that and  
couldn't simply link with libpgcommon.  
  
This also moves the pg_crc.h header file from src/include/utils to  
src/include/common, which will require changes to any external programs  
that currently does #include "utils/pg_crc.h". That seems acceptable, as  
include/common is clearly the right home for it now, and the change needed  
to any such programs is trivial.  

M contrib/hstore/hstore_gist.c
M contrib/ltree/crc32.c
M src/backend/utils/adt/tsquery.c
M src/common/Makefile
R093 src/include/utils/pg_crc_tables.h src/common/pg_crc.c
M src/include/access/xlogrecord.h
M src/include/catalog/pg_control.h
R099 src/include/utils/pg_crc.h src/include/common/pg_crc.h
M src/include/tsearch/ts_type.h
M src/port/Makefile
D src/port/pg_crc.c

Move pg_lzcompress.c to src/common.

commit   : 40bede5477bb5bce98ce9548841cb414634c26f7    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 9 Feb 2015 15:15:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 9 Feb 2015 15:15:24 +0900    

Click here for diff

The meta data of PGLZ symbolized by PGLZ_Header is removed, to make  
the compression and decompression code independent on the backend-only  
varlena facility. PGLZ_Header is being used to store some meta data  
related to the data being compressed like the raw length of the uncompressed  
record or some varlena-related data, making it unpluggable once PGLZ is  
stored in src/common as it contains some backend-only code paths with  
the management of varlena structures. The APIs of PGLZ are reworked  
at the same time to do only compression and decompression of buffers  
without the meta-data layer, simplifying its use for a more general usage.  
  
On-disk format is preserved as well, so there is no incompatibility with  
previous major versions of PostgreSQL for TOAST entries.  
  
Exposing compression and decompression APIs of pglz makes possible its  
use by extensions and contrib modules. Especially this commit is required  
for upcoming WAL compression feature so that the WAL reader facility can  
decompress the WAL data by using pglz_decompress.  
  
Michael Paquier, reviewed by me.  

M src/backend/access/heap/tuptoaster.c
M src/backend/utils/adt/Makefile
M src/common/Makefile
R092 src/backend/utils/adt/pg_lzcompress.c src/common/pg_lzcompress.c
R077 src/include/utils/pg_lzcompress.h src/include/common/pg_lzcompress.h
M src/tools/msvc/Mkvcbuild.pm
M src/tools/pgindent/typedefs.list

Check DCH_MAX_ITEM_SIZ limits with <=, not <.

commit   : 237795a7b4ccf359423bdd99476782d4880eda83    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 6 Feb 2015 23:39:52 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 6 Feb 2015 23:39:52 -0500    

Click here for diff

We reserve space for the full amount, not one less.  The affected checks  
deal with localized month and day names.  Today's DCH_MAX_ITEM_SIZ value  
would suffice for a 60-byte day name, while the longest known is the  
49-byte mn_CN.utf-8 word for "Saturday."  Thus, the upshot of this  
change is merely to avoid misdirecting future readers of the code; users  
are not expected to see errors either way.  

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

Assert(PqCommReadingMsg) in pq_peekbyte().

commit   : a7a4adcf8d1e5a34a15ad86aee7d6aa0b8c15d43    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 6 Feb 2015 23:14:27 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 6 Feb 2015 23:14:27 -0500    

Click here for diff

Interrupting pq_recvbuf() can break protocol sync, so its callers all  
deserve this assertion.  The one pq_peekbyte() caller suffices already.  

M src/backend/libpq/pqcomm.c

Report WAL flush, not insert, position in replication IDENTIFY_SYSTEM

commit   : ff16b40f8cac67a740f4edaa9fc2d9c7ba44c73a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 6 Feb 2015 11:18:14 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 6 Feb 2015 11:18:14 +0200    

Click here for diff

When beginning streaming replication, the client usually issues the  
IDENTIFY_SYSTEM command, which used to return the current WAL insert  
position. That's not suitable for the intended purpose of that field,  
however. pg_receivexlog uses it to start replication from the reported  
point, but if it hasn't been flushed to disk yet, it will fail. Change  
IDENTIFY_SYSTEM to report the flush position instead.  
  
Backpatch to 9.1 and above. 9.0 doesn't report any WAL position.  

M doc/src/sgml/protocol.sgml
M src/backend/replication/walsender.c

This routine was calling ecpg_alloc to allocate to memory but did not actually check the returned pointer allocated, potentially NULL which could be the result of a malloc call.

commit   : 5ee5bc387319b9ac33083bacebd3ab7046666328    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 5 Feb 2015 15:12:34 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 5 Feb 2015 15:12:34 +0100    

Click here for diff

Issue noted by Coverity, fixed by Michael Paquier <[email protected]>  

M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/extern.h
M src/interfaces/ecpg/ecpglib/memory.c

Use a separate memory context for GIN scan keys.

commit   : d88976cfa1302e8dccdcbfe55e9e29faee8c0cdf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 17:40:25 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 17:40:25 +0200    

Click here for diff

It was getting tedious to track and release all the different things that  
form a scan key. We were leaking at least the queryCategories array, and  
possibly more, on a rescan. That was visible if a GIN index was used in a  
nested loop join. This also protects from leaks in extractQuery method.  
  
No backpatching, given the lack of complaints from the field. Maybe later,  
after this has received more field testing.  

M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginscan.c
M src/include/access/gin_private.h

Fix reference-after-free when waiting for another xact due to constraint.

commit   : 57fe246890ad51e166fb6a8da937e41c35d7a279    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 16:00:34 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 16:00:34 +0200    

Click here for diff

If an insertion or update had to wait for another transaction to finish,  
because there was another insertion with conflicting key in progress,  
we would pass a just-free'd item pointer to XactLockTableWait().  
  
All calls to XactLockTableWait() and MultiXactIdWait() had similar issues.  
Some passed a pointer to a buffer in the buffer cache, after already  
releasing the lock. The call in EvalPlanQualFetch had already released the  
pin too. All but the call in execUtils.c would merely lead to reporting a  
bogus ctid, however (or an assertion failure, if enabled).  
  
All the callers that passed HeapTuple->t_data->t_ctid were slightly bogus  
anyway: if the tuple was updated (again) in the same transaction, its ctid  
field would point to the next tuple in the chain, not the tuple itself.  
  
Backpatch to 9.4, where the 'ctid' argument to XactLockTableWait was added  
(in commit f88d4cfc)  

M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c

pgcrypto: Code cleanup for decrypt_internal.

commit   : 370b3a4618c48cb44a1137f47cf1156836cf8a90    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 4 Feb 2015 08:41:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 4 Feb 2015 08:41:35 -0500    

Click here for diff

Remove some unnecessary null-tests, and replace a goto-label construct  
with an "if" block.  
  
Michael Paquier, reviewed by me.  

M contrib/pgcrypto/pgp-pgsql.c

Fix memory leaks on OOM in ecpg.

commit   : c31b5d9ddf25d26dac5f5c215b8a5e8b3dfa37e6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 14:53:29 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 14:53:29 +0200    

Click here for diff

These are fairly obscure cases, but let's keep Coverity happy.  
  
Michael Paquier with some further fixes by me.  

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

Add missing float.h include to snprintf.c.

commit   : ff8ca3b04c15eace1de1a7a66e3a05426b07b773    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Feb 2015 13:27:31 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Feb 2015 13:27:31 +0100    

Click here for diff

On windows _isnan() (which isnan() is redirected to in port/win32.h)  
is declared in float.h, not math.h.  
  
Per buildfarm animal currawong.  
  
Backpatch to all supported branches.  

M src/port/snprintf.c

doc: Fix markup

commit   : c036edb7b35fda18b93a6eacac5b14fcee4693a4    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 4 Feb 2015 19:00:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 4 Feb 2015 19:00:09 +0900    

Click here for diff

Ian Barwick  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/create_tablespace.sgml

Add dummy PQsslAttributes function for non-SSL builds.

commit   : 302262d52111ce71dececfe18448792cee415a57    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 09:13:15 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 4 Feb 2015 09:13:15 +0200    

Click here for diff

All the other new SSL information functions had dummy versions in  
be-secure.c, but I missed PQsslAttributes(). Oops. Surprisingly, the linker  
did not complain about the missing function on most platforms represented in  
the buildfarm, even though it is exported, except for a few Windows systems.  

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

Remove ill-conceived Assertion in ProcessClientWriteInterrupt().

commit   : 3a54f4a4944b849846c5a1494810ea06bd6601b7    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:52:15 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:52:15 +0100    

Click here for diff

It's perfectly fine to have blocked interrupts when  
ProcessClientWriteInterrupt() is called. In fact it's commonly the  
case when emitting error reports. And we deal with that correctly.  
  
Even if that'd not be the case, it'd be a bad location for such a  
assertion. Because ProcessClientWriteInterrupt() is only called when  
the socket is blocked it's hard to hit.  
  
Per Heikki and buildfarm animals nightjar and dunlin.  

M src/backend/tcop/postgres.c

Remove remnants of ImmediateInterruptOK handling.

commit   : 2505ce0be0b686c5a0a5141e9d080e7fdc35988a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:25:47 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:25:47 +0100    

Click here for diff

Now that nothing sets ImmediateInterruptOK to true anymore, we can  
remove all the supporting code.  
  
Reviewed-By: Heikki Linnakangas  

M src/backend/storage/ipc/ipc.c
M src/backend/tcop/postgres.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/timeout.c
M src/include/miscadmin.h
M src/test/modules/test_shm_mq/worker.c

Remove the option to service interrupts during PGSemaphoreLock().

commit   : d06995710bc7e347d39866c1793ae282498d65e0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:25:00 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:25:00 +0100    

Click here for diff

The remaining caller (lwlocks) doesn't need that facility, and we plan  
to remove ImmedidateInterruptOK entirely. That means that interrupts  
can't be serviced race-free and portably anyway, so there's little  
reason for keeping the feature.  
  
Reviewed-By: Heikki Linnakangas  

M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/win32_sema.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/pg_sema.h

Move deadlock and other interrupt handling in proc.c out of signal handlers.

commit   : 6753333f55e1d9bcb9da4323556b456583624a07    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:24:38 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 23:24:38 +0100    

Click here for diff

Deadlock checking was performed inside signal handlers up to  
now. While it's a remarkable feat to have made this work reliably,  
it's quite complex to understand why that is the case. Partially it  
worked due to the assumption that semaphores are signal safe - which  
is not actually documented to be the case for sysv semaphores.  
  
The reason we had to rely on performing this work inside signal  
handlers is that semaphores aren't guaranteed to be interruptable by  
signals on all platforms. But now that latches provide a somewhat  
similar API, which actually has the guarantee of being interruptible,  
we can avoid doing so.  
  
Signalling between ProcSleep, ProcWakeup, ProcWaitForSignal and  
ProcSendSignal is now done using latches. This increases the  
likelihood of spurious wakeups. As spurious wakeup already were  
possible and aren't likely to be frequent enough to be an actual  
problem, this seems acceptable.  
  
This change would allow for further simplification of the deadlock  
checking, now that it doesn't have to run in a signal handler. But  
even if I were motivated to do so right now, it would still be better  
to do that separately. Such a cleanup shouldn't have to be reviewed a  
the same time as the more fundamental changes in this commit.  
  
There is one possible usability regression due to this commit. Namely  
it is more likely than before that log_lock_waits messages are output  
more than once.  
  
Reviewed-By: Heikki Linnakangas  

M src/backend/storage/lmgr/proc.c
M src/backend/utils/init/postinit.c
M src/include/storage/proc.h

Don't allow immediate interrupts during authentication anymore.

commit   : 6647248e3708843be93c7ca670cd219fe8e61026    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:54:48 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:54:48 +0100    

Click here for diff

We used to handle authentication_timeout by setting  
ImmediateInterruptOK to true during large parts of the authentication  
phase of a new connection.  While that happens to work acceptably in  
practice, it's not particularly nice and has ugly corner cases.  
  
Previous commits converted the FE/BE communication to use latches and  
implemented support for interrupt handling during both  
send/recv. Building on top of that work we can get rid of  
ImmediateInterruptOK during authentication, by immediately treating  
timeouts during authentication as a reason to die. As die interrupts  
are handled immediately during client communication that provides a  
sensibly quick reaction time to authentication timeout.  
  
Additionally add a few CHECK_FOR_INTERRUPTS() to some more complex  
authentication methods. More could be added, but this already should  
provides a reasonable coverage.  
  
While it this overall increases the maximum time till a timeout is  
reacted to, it greatly reduces complexity and increases  
reliability. That seems like a overall win. If the increase proves to  
be noticeable we can deal with those cases by moving to nonblocking  
network code and add interrupt checking there.  
  
Reviewed-By: Heikki Linnakangas  

M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/crypt.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c

Remove unused "m" field in LSEG.

commit   : cec916f35be5531efdaf721a46313feb36e0cd76    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Feb 2015 16:50:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Feb 2015 16:50:50 -0500    

Click here for diff

This field has been unreferenced since 1998, and does not appear in lseg  
values stored on disk (since sizeof(lseg) is only 32 bytes according to  
pg_type).  There was apparently some idea of maintaining it just in values  
appearing in memory, but the bookkeeping required to make that work would  
surely far outweigh the cost of recalculating the line's slope when needed.  
Remove it to (a) simplify matters and (b) suppress some uninitialized-field  
whining from Coverity.  

M src/backend/utils/adt/geo_ops.c
M src/include/utils/geo_decls.h
M src/test/regress/regress.c

Process 'die' interrupts while reading/writing from the client socket.

commit   : 4fe384bd858671d40d311ca68cc9b80f4c683a3e    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:45:45 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:45:45 +0100    

Click here for diff

Up to now it was impossible to terminate a backend that was trying to  
send/recv data to/from the client when the socket's buffer was already  
full/empty. While the send/recv calls itself might have gotten  
interrupted by signals on some platforms, we just immediately retried.  
  
That could lead to situations where a backend couldn't be terminated ,  
after a client died without the connection being closed, because it  
was blocked in send/recv.  
  
The problem was far more likely to be hit when sending data than when  
reading. That's because while reading a command from the client, and  
during authentication, we processed interrupts immediately . That  
primarily left COPY FROM STDIN as being problematic for recv.  
  
Change things so that that we process 'die' events immediately when  
the appropriate signal arrives. We can't sensibly react to query  
cancels at that point, because we might loose sync with the client as  
we could be in the middle of writing a message.  
  
We don't interrupt writes if the write buffer isn't full, as indicated  
by write() returning EWOULDBLOCK, as that would lead to fewer error  
messages reaching clients.  
  
Per discussion with Kyotaro HORIGUCHI and Heikki Linnakangas  
  
Discussion: [email protected]  

M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/tcop/postgres.c
M src/include/tcop/tcopprot.h

Introduce and use infrastructure for interrupt processing during client reads.

commit   : 4f85fde8eb860f263384fffdca660e16e77c7f76    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:25:20 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:25:20 +0100    

Click here for diff

Up to now large swathes of backend code ran inside signal handlers  
while reading commands from the client, to allow for speedy reaction to  
asynchronous events. Most prominently shared invalidation and NOTIFY  
handling. That means that complex code like the starting/stopping of  
transactions is run in signal handlers...  The required code was  
fragile and verbose, and is likely to contain bugs.  
  
That approach also severely limited what could be done while  
communicating with the client. As the read might be from within  
openssl it wasn't safely possible to trigger an error, e.g. to cancel  
a backend in idle-in-transaction state. We did that in some cases,  
namely fatal errors, nonetheless.  
  
Now that FE/BE communication in the backend employs non-blocking  
sockets and latches to block, we can quite simply interrupt reads from  
signal handlers by setting the latch. That allows us to signal an  
interrupted read, which is supposed to be retried after returning from  
within the ssl library.  
  
As signal handlers now only need to set the latch to guarantee timely  
interrupt processing, remove a fair amount of complicated & fragile  
code from async.c and sinval.c.  
  
We could now actually start to process some kinds of interrupts, like  
sinval ones, more often that before, but that seems better done  
separately.  
  
This work will hopefully allow to handle cases like being blocked by  
sending data, interrupting idle transactions and similar to be  
implemented without too much effort.  In addition to allowing getting  
rid of ImmediateInterruptOK, that is.  
  
Author: Andres Freund  
Reviewed-By: Heikki Linnakangas  

M src/backend/commands/async.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/ipc/sinval.c
M src/backend/tcop/postgres.c
M src/include/commands/async.h
M src/include/storage/sinval.h
M src/include/tcop/tcopprot.h

Use a nonblocking socket for FE/BE communication and block using latches.

commit   : 387da18874afa17156ee3af63766f17efb53c4b9    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:03:48 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 3 Feb 2015 22:03:48 +0100    

Click here for diff

This allows to introduce more elaborate handling of interrupts while  
reading from a socket.  Currently some interrupt handlers have to do  
significant work from inside signal handlers, and it's very hard to  
correctly write code to do so.  Generic signal handler limitations,  
combined with the fact that we can't safely jump out of a signal  
handler while reading from the client have prohibited implementation  
of features like timeouts for idle-in-transaction.  
  
Additionally we use the latch code to wait in a couple places where we  
previously only had waiting code on windows as other platforms just  
busy looped.  
  
This can increase the number of systemcalls happening during FE/BE  
communication. Benchmarks so far indicate that the impact isn't very  
high, and there's room for optimization in the latch code. The chance  
of cleaning up the usage of latches gives us, seem to outweigh the  
risk of small performance regressions.  
  
This commit theoretically can't used without the next patch in the  
series, as WaitLatchOrSocket is not defined to be fully signal  
safe. As we already do that in some cases though, it seems better to  
keep the commits separate, so they're easier to understand.  
  
Author: Andres Freund  
Reviewed-By: Heikki Linnakangas  

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

Fix breakage in GEODEBUG debug code.

commit   : 778d498c7d9099c784f14199a319ec2a84d91191    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Feb 2015 15:20:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Feb 2015 15:20:45 -0500    

Click here for diff

LINE doesn't have an "m" field (anymore anyway).  Also fix unportable  
assumption that %x can print the result of pointer subtraction.  
  
In passing, improve single_decode() in minor ways:  
* Remove unnecessary leading-whitespace skip (strtod does that already).  
* Make GEODEBUG message more intelligible.  
* Remove entirely-useless test to see if strtod returned a silly pointer.  
* Don't bother computing trailing-whitespace skip unless caller wants  
  an ending pointer.  
  
This has been broken since 261c7d4b653bc3e44c31fd456d94f292caa50d8f.  
Although it's only debug code, might as well fix the 9.4 branch too.  

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

commit   : 91fa7b4719ac583420d9143132ba4ccddefbc5b2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 19:57:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 19:57:52 +0200    

Click here for diff

This makes it possible to query for things like the SSL version and cipher  
used, without depending on OpenSSL functions or macros. That is a good  
thing if we ever get another SSL implementation.  
  
PQgetssl() still works, but it should be considered as deprecated as it  
only works with OpenSSL. In particular, PQgetSslInUse() should be used to  
check if a connection uses SSL, because as soon as we have another  
implementation, PQgetssl() will return NULL even if SSL is in use.  

M doc/src/sgml/libpq.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-fe.h

Refactor page compactifying code.

commit   : 809d9a260b5d068a6a366273cd724bf9b396b026    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 14:09:29 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 14:09:29 +0200    

Click here for diff

The logic to compact away removed tuples from page was duplicated with  
small differences in PageRepairFragmentation, PageIndexMultiDelete, and  
PageIndexDeleteNoCompact. Put it into a common function.  
  
Reviewed by Peter Geoghegan.  

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

Rephrase the documentation on pg_receivexlog --synchronous option.

commit   : 507627f5b5c009aa95c04254614778c6263a3dc2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 10:35:46 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 10:35:46 +0200    

Click here for diff

The old wording talked about a "sync command", meaining fsync(), but it  
was not very clear.  

M doc/src/sgml/ref/pg_receivexlog.sgml

Fix typo in comment.

commit   : efba7a542fd52ed7607f1d8b162d898da0baa22c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 09:48:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 09:48:45 +0200    

Click here for diff

Amit Langote  

M src/backend/parser/parse_utilcmd.c

Remove dead code.

commit   : 4eaafa045362298adfe61fdd83b47b22211c75d1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 09:43:44 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 3 Feb 2015 09:43:44 +0200    

Click here for diff

Commit 13629df changed metaphone() function to return an empty string on  
empty input, but it left the old error message in place. It's now dead code.  
  
Michael Paquier, per Coverity warning.  

M contrib/fuzzystrmatch/fuzzystrmatch.c

Add new function BackgroundWorkerInitializeConnectionByOid.

commit   : 5d2f957f3f9dcd88384780876f535b423151f9bf    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 2 Feb 2015 16:23:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 2 Feb 2015 16:23:59 -0500    

Click here for diff

Sometimes it's useful for a background worker to be able to initialize  
its database connection by OID rather than by name, so provide a way  
to do that.  

M doc/src/sgml/bgworker.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h
M src/include/postmaster/bgworker.h

Last-minute updates for release notes.

commit   : 2488eff889f83d7d6411be9a6172ff69df3f0085    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Feb 2015 11:23:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Feb 2015 11:23:59 -0500    

Click here for diff

Add entries for security issues.  
  
Security: CVE-2015-0241 through CVE-2015-0244  

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Be more careful to not lose sync in the FE/BE protocol.

commit   : 2b3a8b20c2da9f39ffecae25ab7c66974fbc0d3b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Feb 2015 17:08:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 2 Feb 2015 17:08:45 +0200    

Click here for diff

If any error occurred while we were in the middle of reading a protocol  
message from the client, we could lose sync, and incorrectly try to  
interpret a part of another message as a new protocol message. That will  
usually lead to an "invalid frontend message" error that terminates the  
connection. However, this is a security issue because an attacker might  
be able to deliberately cause an error, inject a Query message in what's  
supposed to be just user data, and have the server execute it.  
  
We were quite careful to not have CHECK_FOR_INTERRUPTS() calls or other  
operations that could ereport(ERROR) in the middle of processing a message,  
but a query cancel interrupt or statement timeout could nevertheless cause  
it to happen. Also, the V2 fastpath and COPY handling were not so careful.  
It's very difficult to recover in the V2 COPY protocol, so we will just  
terminate the connection on error. In practice, that's what happened  
previously anyway, as we lost protocol sync.  
  
To fix, add a new variable in pqcomm.c, PqCommReadingMsg, that is set  
whenever we're in the middle of reading a message. When it's set, we cannot  
safely ERROR out and continue running, because we might've read only part  
of a message. PqCommReadingMsg acts somewhat similarly to critical sections  
in that if an error occurs while it's set, the error handler will force the  
connection to be terminated, as if the error was FATAL. It's not  
implemented by promoting ERROR to FATAL in elog.c, like ERROR is promoted  
to PANIC in critical sections, because we want to be able to use  
PG_TRY/CATCH to recover and regain protocol sync. pq_getmessage() takes  
advantage of that to prevent an OOM error from terminating the connection.  
  
To prevent unnecessary connection terminations, add a holdoff mechanism  
similar to HOLD/RESUME_INTERRUPTS() that can be used hold off query cancel  
interrupts, but still allow die interrupts. The rules on which interrupts  
are processed when are now a bit more complicated, so refactor  
ProcessInterrupts() and the calls to it in signal handlers so that the  
signal handlers always call it if ImmediateInterruptOK is set, and  
ProcessInterrupts() can decide to not do anything if the other conditions  
are not met.  
  
Reported by Emil Lenngren. Patch reviewed by Noah Misch and Andres Freund.  
Backpatch to all supported versions.  
  
Security: CVE-2015-0244  

M src/backend/commands/copy.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/globals.c
M src/include/libpq/libpq.h
M src/include/miscadmin.h
M src/include/tcop/fastpath.h

Prevent Valgrind Memcheck errors around px_acquire_system_randomness().

commit   : 59b919822ab060f721e235964d19b55a19c815f0    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    

Click here for diff

This function uses uninitialized stack and heap buffers as supplementary  
entropy sources.  Mark them so Memcheck will not complain.  Back-patch  
to 9.4, where Valgrind Memcheck cooperation first appeared.  
  
Marko Tiikkaja  

M contrib/pgcrypto/random.c

Cherry-pick security-relevant fixes from upstream imath library.

commit   : 8b59672d8d23ea4203cf2701d126a96edca5bdd6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    

Click here for diff

This covers alterations to buffer sizing and zeroing made between imath  
1.3 and imath 1.20.  Valgrind Memcheck identified the buffer overruns  
and reliance on uninitialized data; their exploit potential is unknown.  
Builds specifying --with-openssl are unaffected, because they use the  
OpenSSL BIGNUM facility instead of imath.  Back-patch to 9.0 (all  
supported versions).  
  
Security: CVE-2015-0243  

M contrib/pgcrypto/imath.c

Fix buffer overrun after incomplete read in pullf_read_max().

commit   : 1dc75515868454c645ded22d38054ec693e23ec6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    

Click here for diff

Most callers pass a stack buffer.  The ensuing stack smash can crash the  
server, and we have not ruled out the viability of attacks that lead to  
privilege escalation.  Back-patch to 9.0 (all supported versions).  
  
Marko Tiikkaja  
  
Security: CVE-2015-0243  

M contrib/pgcrypto/expected/pgp-info.out
M contrib/pgcrypto/expected/pgp-pubkey-decrypt.out
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/sql/pgp-pubkey-decrypt.sql

port/snprintf(): fix overflow and do padding

commit   : 29725b3db67ad3f09da1a7fb6690737d2f8d6c0a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    

Click here for diff

Prevent port/snprintf() from overflowing its local fixed-size  
buffer and pad to the desired number of digits with zeros, even  
if the precision is beyond the ability of the native sprintf().  
port/snprintf() is only used on systems that lack a native  
snprintf().  
  
Reported by Bruce Momjian. Patch by Tom Lane.	Backpatch to all  
supported versions.  
  
Security: CVE-2015-0242  

M src/port/snprintf.c

to_char(): prevent writing beyond the allocated buffer

commit   : 9241c84cbcb82174a7d986242f233aa6472c1129    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:45 -0500    

Click here for diff

Previously very long localized month and weekday strings could  
overflow the allocated buffers, causing a server crash.  
  
Reported and patch reviewed by Noah Misch.  Backpatch to all  
supported versions.  
  
Security: CVE-2015-0241  

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

to_char(): prevent accesses beyond the allocated buffer

commit   : 0150ab567bcf5e5913e2b62a1678f84cc272441f    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:44 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 2 Feb 2015 10:00:44 -0500    

Click here for diff

Previously very long field masks for floats could access memory  
beyond the existing buffer allocated to hold the result.  
  
Reported by Andres Freund and Peter Geoghegan.	Backpatch to all  
supported versions.  
  
Security: CVE-2015-0241  

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

Doc: fix syntax description for psql's \setenv.

commit   : f9ee8ea10a432bd5692ef9ff25055717fbf290ce    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Feb 2015 00:18:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Feb 2015 00:18:54 -0500    

Click here for diff

The variable name isn't optional --- looks like a copy-and-paste-o from  
the \set command, where it is.  
  
Dilip Kumar  

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

Translation updates

commit   : f8948616c9403effb84ed09c244650d9750243a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Feb 2015 23:23:40 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Feb 2015 23:23:40 -0500    

Click here for diff

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

M src/backend/nls.mk
M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
A src/backend/po/id.po
M src/backend/po/pt_BR.po
M src/backend/po/ru.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/sv.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_config/po/es.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_resetxlog/po/es.po
M src/bin/psql/po/de.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/pt_BR.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/ru.po
M src/pl/plperl/po/es.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpython/po/de.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/ru.po
M src/pl/tcl/po/es.po

doc: Improve claim about location of pg_service.conf

commit   : 1332bbb30cd1e6beb7b43c26ca5728c715c1a9c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Feb 2015 22:36:44 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Feb 2015 22:36:44 -0500    

Click here for diff

The previous wording claimed that the file was always in /etc, but of  
course this varies with the installation layout.  Write instead that it  
can be found via `pg_config --sysconfdir`.  Even though this is still  
somewhat incorrect because it doesn't account of moved installations, it  
at least conveys that the location depends on the installation.  

M doc/src/sgml/libpq.sgml

Release notes for 9.4.1, 9.3.6, 9.2.10, 9.1.15, 9.0.19.

commit   : 21fe4e2b6e701234afb77fa92e192546d51a5962    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Feb 2015 16:50:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Feb 2015 16:50:31 -0500    

Click here for diff

M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml

Fix documentation of psql's ECHO all mode.

commit   : b7d254c0793e072dcf6d370195291cf85a7e9976    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Jan 2015 18:35:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Jan 2015 18:35:13 -0500    

Click here for diff

"ECHO all" is ignored for interactive input, and has been for a very long  
time, though possibly not for as long as the documentation has claimed the  
opposite.  Fix that, and also note that empty lines aren't echoed, which  
while dubious is another longstanding behavior (it's embedded in our  
regression test files for one thing).  Per bug #12721 from Hans Ginzel.  
  
In HEAD, also improve the code comments in this area, and suppress an  
unnecessary fflush(stdout) when we're not echoing.  That would likely  
be safe to back-patch, but I'll not risk it mere hours before a release  
wrap.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/mainloop.c

First-draft release notes for 9.4.1 et al.

commit   : 77e9125e847adf76e9466814781957c0f32d8554    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Jan 2015 17:30:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Jan 2015 17:30:30 -0500    

Click here for diff

As usual, the release notes for older branches will be made by cutting  
these down, but put them up for community review first.  
  
Note: a significant fraction of these items don't apply to 9.4.1, only to  
older branches, because the fixes already appeared in 9.4.0.  These can be  
distinguished by noting the branch commits in the associated SGML comments.  
This will be adjusted tomorrow while copying items into the older  
release-X.Y.sgml files.  In a few cases I've made two separate entries with  
different wordings for 9.4 than for the equivalent commits in the older  
branches.  

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

Update time zone data files to tzdata release 2015a.

commit   : 08bd0c58115897de8b5c53f616c2add48e8038c2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 22:45:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 22:45:44 -0500    

Click here for diff

DST law changes in Chile and Mexico (state of Quintana Roo).  
Historical changes for Iceland.  

M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/backward
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Antarctica.txt
M src/timezone/tznames/Default

Policy documentation improvements

commit   : 3144e1b3c6cf59f068f704061ba967ce707531d3    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 30 Jan 2015 16:09:41 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 30 Jan 2015 16:09:41 -0500    

Click here for diff

In ALTER POLICY, use 'check_expression' instead of 'expression' for the  
parameter, to match up with the recent CREATE POLICY change.  
  
In CREATE POLICY, frame the discussion as granting access to rows  
instead of limiting access to rows.  Further, clarify that the  
expression must return true for rows to be visible/allowed and that a  
false or NULL result will mean the row is not visible/allowed.  
  
Per discussion with Dean Rasheed and Robert.  

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

Fix jsonb Unicode escape processing, and in consequence disallow \u0000.

commit   : 451d2808151e56c2c70893b8c3ee72af393a9f1d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 14:44:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 14:44:46 -0500    

Click here for diff

We've been trying to support \u0000 in JSON values since commit  
78ed8e03c67d7333, and have introduced increasingly worse hacks to try to  
make it work, such as commit 0ad1a816320a2b53.  However, it fundamentally  
can't work in the way envisioned, because the stored representation looks  
the same as for \\u0000 which is not the same thing at all.  It's also  
entirely bogus to output \u0000 when de-escaped output is called for.  
  
The right way to do this would be to store an actual 0x00 byte, and then  
throw error only if asked to produce de-escaped textual output.  However,  
getting to that point seems likely to take considerable work and may well  
never be practical in the 9.4.x series.  
  
To preserve our options for better behavior while getting rid of the nasty  
side-effects of 0ad1a816320a2b53, revert that commit in toto and instead  
throw error if \u0000 is used in a context where it needs to be de-escaped.  
(These are the same contexts where non-ASCII Unicode escapes throw error  
if the database encoding isn't UTF8, so this behavior is by no means  
without precedent.)  
  
In passing, make both the \u0000 case and the non-ASCII Unicode case report  
ERRCODE_UNTRANSLATABLE_CHARACTER / "unsupported Unicode escape sequence"  
rather than claiming there's something wrong with the input syntax.  
  
Back-patch to 9.4, where we have to do something because 0ad1a816320a2b53  
broke things for many cases having nothing to do with \u0000.  9.3 also has  
bogus behavior, but only for that specific escape value, so given the lack  
of field complaints it seems better to leave 9.3 alone.  

M doc/src/sgml/json.sgml
M doc/src/sgml/release-9.4.sgml
M src/backend/utils/adt/json.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

doc: Remove superfluous table column

commit   : e40d43f88eb8617e7c1b3a03dec595efe6066f72    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jan 2015 13:30:35 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Jan 2015 13:30:35 -0500    

Click here for diff

M doc/src/sgml/catalogs.sgml

Fix Coverity warning about contrib/pgcrypto's mdc_finish().

commit   : a59ee881978a2027dced30053f8ad4cd8e143953    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 13:04:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 13:04:56 -0500    

Click here for diff

Coverity points out that mdc_finish returns a pointer to a local buffer  
(which of course is gone as soon as the function returns), leaving open  
a risk of misbehaviors possibly as bad as a stack overwrite.  
  
In reality, the only possible call site is in process_data_packets()  
which does not examine the returned pointer at all.  So there's no  
live bug, but nonetheless the code is confusing and risky.  Refactor  
to avoid the issue by letting process_data_packets() call mdc_finish()  
directly instead of going through the pullf_read() API.  
  
Although this is only cosmetic, it seems good to back-patch so that  
the logic in pgp-decrypt.c stays in sync across all branches.  
  
Marko Kreen  

M contrib/pgcrypto/pgp-decrypt.c

Provide a way to supress the "out of memory" error when allocating.

commit   : bd4e2fd97d3db84bd970d6051f775b7ff2af0e9d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Jan 2015 12:56:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Jan 2015 12:56:48 -0500    

Click here for diff

Using the new interface MemoryContextAllocExtended, callers can  
specify MCXT_ALLOC_NO_OOM if they are prepared to handle a NULL  
return value.  
  
Michael Paquier, reviewed and somewhat revised by me.  

M src/backend/utils/mmgr/mcxt.c
M src/include/utils/palloc.h

Fix assorted oversights in range selectivity estimation.

commit   : 3d660d33aab2f1eb98367a84eb2addf3e0969c05    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 12:30:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jan 2015 12:30:38 -0500    

Click here for diff

calc_rangesel() failed outright when comparing range variables to empty  
constant ranges with < or >=, as a result of missing cases in a switch.  
It also produced a bogus estimate for > comparison to an empty range.  
  
On top of that, the >= and > cases were mislabeled throughout.  For  
nonempty constant ranges, they managed to produce the right answers  
anyway as a result of counterbalancing typos.  
  
Also, default_range_selectivity() omitted cases for elem <@ range,  
range &< range, and range &> range, so that rather dubious defaults  
were applied for these operators.  
  
In passing, rearrange the code in rangesel() so that the elem <@ range  
case is handled in a less opaque fashion.  
  
Report and patch by Emre Hasegeli, some additional work by me  

M src/backend/utils/adt/rangetypes_selfuncs.c
M src/include/catalog/pg_operator.h
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

Fix query-duration memory leak with GIN rescans.

commit   : 68fa75f3188c050ec62804f2bfacd3ea85404743    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jan 2015 17:58:23 +0100    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jan 2015 17:58:23 +0100    

Click here for diff

The requiredEntries / additionalEntries arrays were not freed in  
freeScanKeys() like other per-key stuff.  
  
It's not obvious, but startScanKey() was only ever called after the keys  
have been initialized with ginNewScanKey(). That's why it doesn't need to  
worry about freeing existing arrays. The ginIsNewKey() test in gingetbitmap  
was never true, because ginrescan free's the existing keys, and it's not OK  
to call gingetbitmap twice in a row without calling ginrescan in between.  
To make that clear, remove the unnecessary ginIsNewKey(). And just to be  
extra sure that nothing funny happens if there is an existing key after all,  
call freeScanKeys() to free it if it exists. This makes the code more  
straightforward.  
  
(I'm seeing other similar leaks in testing a query that rescans an GIN index  
scan, but that's a different issue. This just fixes the obvious leak with  
those two arrays.)  
  
Backpatch to 9.4, where GIN fast scan was added.  

M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginscan.c
M src/include/access/gin_private.h

Allow pg_dump to use jobs and serializable transactions together.

commit   : cff1bd2a3c36fdf014367dd97f140495ef6ed47e    
  
author   : Kevin Grittner <[email protected]>    
date     : Fri, 30 Jan 2015 08:57:24 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Fri, 30 Jan 2015 08:57:24 -0600    

Click here for diff

Since 9.3, when the --jobs option was introduced, using it together  
with the --serializable-deferrable option generated multiple  
errors.  We can get correct behavior by allowing the connection  
which acquires the snapshot to use SERIALIZABLE, READ ONLY,  
DEFERRABLE and pass that to the workers running the other  
connections using REPEATABLE READ, READ ONLY.  This is a bit of a  
kluge since the SERIALIZABLE behavior is achieved by running some  
of the participating connections at a different isolation level,  
but it is a simple and safe change, suitable for back-patching.  
  
This will be followed by a proposal for a more invasive fix with  
some slight behavioral changes on just the master branch, based on  
suggestions from Andres Freund, but the kluge will be applied to  
master until something is agreed along those lines.  
  
Back-patched to 9.3, where the --jobs option was added.  
  
Based on report from Alexander Korotkov  

M src/bin/pg_dump/pg_dump.c

Fix BuildIndexValueDescription for expressions

commit   : 32bf6ee6ab5cdfa4247f984f864860d988a58dfe    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 29 Jan 2015 21:59:34 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 29 Jan 2015 21:59:34 -0500    

Click here for diff

In 804b6b6db4dcfc590a468e7be390738f9f7755fb we modified  
BuildIndexValueDescription to pay attention to which columns are visible  
to the user, but unfortunatley that commit neglected to consider indexes  
which are built on expressions.  
  
Handle error-reporting of violations of constraint indexes based on  
expressions by not returning any detail when the user does not have  
table-level SELECT rights.  
  
Backpatch to 9.0, as the prior commit was.  
  
Pointed out by Tom.  

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

doc: clarify libpq's 'verify-full' host name check

commit   : e77043055f5b80bfc173ef67795cb36fdcef7f40    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 29 Jan 2015 21:20:21 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 29 Jan 2015 21:20:21 -0500    

Click here for diff

Report by David Guyot  

M doc/src/sgml/libpq.sgml

Handle unexpected query results, especially NULLs, safely in connectby().

commit   : 37507962c3d2123b0f21c50d6172fd0b1e059fe7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Jan 2015 20:18:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Jan 2015 20:18:33 -0500    

Click here for diff

connectby() didn't adequately check that the constructed SQL query returns  
what it's expected to; in fact, since commit 08c33c426bfebb32 it wasn't  
checking that at all.  This could result in a null-pointer-dereference  
crash if the constructed query returns only one column instead of the  
expected two.  Less excitingly, it could also result in surprising data  
conversion failures if the constructed query returned values that were  
not I/O-conversion-compatible with the types specified by the query  
calling connectby().  
  
In all branches, insist that the query return at least two columns;  
this seems like a minimal sanity check that can't break any reasonable  
use-cases.  
  
In HEAD, insist that the constructed query return the types specified by  
the outer query, including checking for typmod incompatibility, which the  
code never did even before it got broken.  This is to hide the fact that  
the implementation does a conversion to text and back; someday we might  
want to improve that.  
  
In back branches, leave that alone, since adding a type check in a minor  
release is more likely to break things than make people happy.  Type  
inconsistencies will continue to work so long as the actual type and  
declared type are I/O representation compatible, and otherwise will fail  
the same way they used to.  
  
Also, in all branches, be on guard for NULL results from the constructed  
query, which formerly would cause null-pointer dereference crashes.  
We now print the row with the NULL but don't recurse down from it.  
  
In passing, get rid of the rather pointless idea that  
build_tuplestore_recursively() should return the same tuplestore that's  
passed to it.  
  
Michael Paquier, adjusted somewhat by me  

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

Properly terminate the array returned by GetLockConflicts().

commit   : 17792bfc5b62f42a9dfbd2ac408e7e71c239330a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 29 Jan 2015 17:49:03 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 29 Jan 2015 17:49:03 +0100    

Click here for diff

GetLockConflicts() has for a long time not properly terminated the  
returned array. During normal processing the returned array is zero  
initialized which, while not pretty, is sufficient to be recognized as  
a invalid virtual transaction id. But the HotStandby case is more than  
aesthetically broken: The allocated (and reused) array is neither  
zeroed upon allocation, nor reinitialized, nor terminated.  
  
Not having a terminating element means that the end of the array will  
not be recognized and that recovery conflict handling will thus read  
ahead into adjacent memory. Only terminating when hitting memory  
content that looks like a invalid virtual transaction id.  Luckily  
this seems so far not have caused significant problems, besides making  
recovery conflict more expensive.  
  
Discussion: [email protected]  
  
Backpatch into all supported branches.  

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

Align buffer descriptors to cache line boundaries.

commit   : ed127002d8c592610bc8e716759a1a70657483b6    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 29 Jan 2015 17:49:03 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 29 Jan 2015 17:49:03 +0100    

Click here for diff

Benchmarks has shown that aligning the buffer descriptor array to  
cache lines is important for scalability; especially on bigger,  
multi-socket, machines.  
  
Currently the array sometimes already happens to be aligned by  
happenstance, depending how large previous shared memory allocations  
were. That can lead to wildly varying performance results after minor  
configuration changes.  
  
In addition to aligning the start of descriptor array, also force the  
size of individual descriptors to be of a common cache line size (64  
bytes). That happens to already be the case on 64bit platforms, but  
this way we can change the struct BufferDesc more easily.  
  
As the alignment primarily matters in highly concurrent workloads  
which probably all are 64bit these days, and the space wastage of  
element alignment would be a bit more noticeable on 32bit systems, we  
don't force the stride to be cacheline sized on 32bit platforms for  
now. If somebody does actual performance testing, we can reevaluate  
that decision by changing the definition of BUFFERDESC_PADDED_SIZE.  
  
Discussion: [email protected]  
  
Per discussion with Bruce Momjan, Tom Lane, Robert Haas, and Peter  
Geoghegan.  

M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/include/c.h
M src/include/storage/buf_internals.h

Fix #ifdefed'ed out code to compile again.

commit   : 7142bfbbd34a1dbe34346534d7479915145352b3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 29 Jan 2015 17:49:03 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 29 Jan 2015 17:49:03 +0100    

Click here for diff

M src/backend/storage/buffer/bufmgr.c

Fix bug where GIN scan keys were not initialized with gin_fuzzy_search_limit.

commit   : 31ed42b9a3ea45a76cd78b29ee3b111b5ea0dbf3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 29 Jan 2015 19:35:55 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 29 Jan 2015 19:35:55 +0200    

Click here for diff

When gin_fuzzy_search_limit was used, we could jump out of startScan()  
without calling startScanKey(). That was harmless in 9.3 and below, because  
startScanKey()() didn't do anything interesting, but in 9.4 it initializes  
information needed for skipping entries (aka GIN fast scans), and you  
readily get a segfault if it's not done. Nevertheless, it was clearly wrong  
all along, so backpatch all the way to 9.1 where the early return was  
introduced.  
  
(AFAICS startScanKey() did nothing useful in 9.3 and below, because the  
fields it initialized were already initialized in ginFillScanKey(), but I  
don't dare to change that in a minor release. ginFillScanKey() is always  
called in gingetbitmap() even though there's a check there to see if the  
scan keys have already been initialized, because they never are; ginrescan()  
free's them.)  
  
In the passing, remove unnecessary if-check from the second inner loop in  
startScan(). We already check in the first loop that the condition is true  
for all entries.  
  
Reported by Olaf Gawenda, bug #12694, Backpatch to 9.1 and above, although  
AFAICS it causes a live bug only in 9.4.  

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

Move out-of-memory error checks from aset.c to mcxt.c

commit   : 3d6d1b585524aab62616d20518fe1fe3be5d1a39    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 29 Jan 2015 10:23:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 29 Jan 2015 10:23:38 -0500    

Click here for diff

This potentially allows us to add mcxt.c interfaces that do something  
other than throw an error when memory cannot be allocated.  We'll  
handle adding those interfaces in a separate commit.  
  
Michael Paquier, with minor changes by me  

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

Reword CREATE POLICY parameter descriptions

commit   : 1c993b3aceb7e0ccf32b59280b266b1f4f7b077e    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 23:21:54 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 23:21:54 -0500    

Click here for diff

The parameter description for the using_expression and check_expression  
in CREATE POLICY were unclear and arguably included a typo.  Clarify  
and improve the consistency of that language.  
  
Pointed out by Dean Rasheed.  

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

CREATE POLICY expression -> using_expression

commit   : bb541812b8f67ae0341fa76fe3bb60f58671b8c7    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 22:59:03 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 22:59:03 -0500    

Click here for diff

The syntax for CREATE POLICY simply used "expression" for the USING  
expression, while the WITH CHECK expression was "check_expression".  
Given that we have two expressions, it's sensible to explcitly name both  
to maintain clarity.  
  
This patch simply changes the generic "expression" to be  
"using_expression".  
  
Pointed out by Peter Geoghegan.  

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

Improve CREATE POLICY documentation

commit   : 42f66b27566798d9969791ec6d2acd399c41b60f    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 22:16:24 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 22:16:24 -0500    

Click here for diff

The CREATE POLICY documention didn't sufficiently clarify what happens  
when a given command type (eg: ALL or UPDATE) accepts both USING and  
WITH CHECK clauses, but only the USING clause is defined.  Add language  
to clarify that, in such a case, the USING clause will be used for both  
USING and WITH CHECK cases.  
  
Pointed out by Peter Geoghegan.  

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

Add usebypassrls to pg_user and pg_shadow

commit   : c7cf9a243336d5f48bb4a4297c9fba4210f3e981    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 21:47:15 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 21:47:15 -0500    

Click here for diff

The row level security patches didn't add the 'usebypassrls' columns to  
the pg_user and pg_shadow views on the belief that they were deprecated,  
but we havn't actually said they are and therefore we should include it.  
  
This patch corrects that, adds missing documentation for rolbypassrls  
into the system catalog page for pg_authid, along with the entries for  
pg_user and pg_shadow, and cleans up a few other uses of 'row-level'  
cases to be 'row level' in the docs.  
  
Pointed out by Amit Kapila.  
  
Catalog version bump due to system view changes.  

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

Clean up range-table building in copy.c

commit   : f8519a6a464c92730dfa21298022f74d105f54d4    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 17:42:28 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 28 Jan 2015 17:42:28 -0500    

Click here for diff

Commit 804b6b6db4dcfc590a468e7be390738f9f7755fb added the build of a  
range table in copy.c to initialize the EState es_range_table since it  
can be needed in error paths.  Unfortunately, that commit didn't  
appreciate that some code paths might end up not initializing the rte  
which is used to build the range table.  
  
Fix that and clean up a couple others things along the way- build it  
only once and don't explicitly set it on the !is_from path as it  
doesn't make any sense there (cstate is palloc0'd, so this isn't an  
issue from an initializing standpoint either).  
  
The prior commit went back to 9.0, but this only goes back to 9.1 as  
prior to that the range table build happens immediately after building  
the RTE and therefore doesn't suffer from this issue.  
  
Pointed out by Robert.  

M src/backend/commands/copy.c

Fix column-privilege leak in error-message paths

commit   : 804b6b6db4dcfc590a468e7be390738f9f7755fb    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 12 Jan 2015 17:04:11 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 12 Jan 2015 17:04:11 -0500    

Click here for diff

While building error messages to return to the user,  
BuildIndexValueDescription, ExecBuildSlotValueDescription and  
ri_ReportViolation would happily include the entire key or entire row in  
the result returned to the user, even if the user didn't have access to  
view all of the columns being included.  
  
Instead, include only those columns which the user is providing or which  
the user has select rights on.  If the user does not have any rights  
to view the table or any of the columns involved then no detail is  
provided and a NULL value is returned from BuildIndexValueDescription  
and ExecBuildSlotValueDescription.  Note that, for key cases, the user  
must have access to all of the columns for the key to be shown; a  
partial key will not be returned.  
  
Further, in master only, do not return any data for cases where row  
security is enabled on the relation and row security should be applied  
for the user.  This required a bit of refactoring and moving of things  
around related to RLS- note the addition of utils/misc/rls.c.  
  
Back-patch all the way, as column-level privileges are now in all  
supported versions.  
  
This has been assigned CVE-2014-8161, but since the issue and the patch  
have already been publicized on pgsql-hackers, there's no point in trying  
to hide this commit.  

M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/misc/Makefile
M src/backend/utils/misc/guc.c
A src/backend/utils/misc/rls.c
M src/backend/utils/sort/tuplesort.c
M src/include/rewrite/rowsecurity.h
A src/include/utils/rls.h
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/privileges.sql

Fix typo in comment.

commit   : acc2b1e843ae04e97025880f33a82f326ab12d59    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Jan 2015 10:26:30 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Jan 2015 10:26:30 +0200    

Click here for diff

M src/backend/storage/buffer/bufmgr.c

Remove dead NULL-pointer checks in GiST code.

commit   : 670bf71f65c2315fc2ea7265d540402093db8cef    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Jan 2015 09:47:39 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Jan 2015 09:47:39 +0200    

Click here for diff

gist_poly_compress() and gist_circle_compress() checked for a NULL-pointer  
key argument, but that was dead code; the gist code never passes a  
NULL-pointer to the "compress" method.  
  
This commit also removes a documentation note added in commit a0a3883,  
about doing NULL-pointer checks in the "compress" method. It was added  
based on the fact that some implementations were doing NULL-pointer  
checks, but those checks were unnecessary in the first place.  
  
The NULL-pointer check in gbt_var_same() function was also unnecessary.  
The arguments to the "same" method come from the "compress", "union", or  
"picksplit" methods, but none of them return a NULL pointer.  
  
None of this is to be confused with SQL NULL values. Those are dealt with  
by the gist machinery, and are never passed to the GiST opclass methods.  
  
Michael Paquier  

M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M doc/src/sgml/gist.sgml
M src/backend/access/gist/gistproc.c

Fix NUMERIC field access macros to treat NaNs consistently.

commit   : 1a2b2034d48d46ec3d128b167cb7df317b4cd49a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jan 2015 12:06:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jan 2015 12:06:31 -0500    

Click here for diff

Commit 145343534c153d1e6c3cff1fa1855787684d9a38 arranged to store numeric  
NaN values as short-header numerics, but the field access macros did not  
get the memo: they thought only "SHORT" numerics have short headers.  
  
Most of the time this makes no difference because we don't access the  
weight or dscale of a NaN; but numeric_send does that.  As pointed out  
by Andrew Gierth, this led to fetching uninitialized bytes.  
  
AFAICS this could not have any worse consequences than that; in particular,  
an unaligned stored numeric would have been detoasted by PG_GETARG_NUMERIC,  
so that there's no risk of a fetch off the end of memory.  Still, the code  
is wrong on its own terms, and it's not hard to foresee future changes that  
might expose us to real risks.  So back-patch to all affected branches.  

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

Add a note to PG_TRY's documentation about volatile safety.

commit   : 4b2a254793be50e31d43d4bfd813da8d141494b8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 15:53:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 15:53:37 -0500    

Click here for diff

We had better memorialize what the actual requirements are for this.  

M src/include/utils/elog.h

commit   : dabda6415287bb8991c569036c1f5b57be62a58f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 15:17:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 15:17:33 -0500    

Click here for diff

Some fields of the sinfo struct are modified within PG_TRY and then  
referenced within PG_CATCH, so as with recent patch to async.c, "volatile"  
is necessary for strict POSIX compliance; and that propagates to a couple  
of subroutines as well as materializeQueryResult() itself.  I think the  
risk of actual issues here is probably higher than in async.c, because  
storeQueryResult() is likely to get inlined into materializeQueryResult(),  
leaving the compiler free to conclude that its stores into sinfo fields are  
dead code.  

M contrib/dblink/dblink.c

Re-enable abbreviated keys on Windows.

commit   : 168a809d4b8adb7cfd6c0f14116493c3f7bc24b7    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 26 Jan 2015 14:28:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 26 Jan 2015 14:28:14 -0500    

Click here for diff

Commit 1be4eb1b2d436d1375899c74e4c74486890d8777 disabled this, but I  
think the real problem here was fixed by commit  
b181a91981203f6ec9403115a2917bd3f9473707 and commit  
d060e07fa919e0eb681e2fa2cfbe63d6c40eb2cf.  So let's try re-enabling  
it now and see what happens.  

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

Fix volatile-safety issue in pltcl_SPI_execute_plan().

commit   : 599d00aa68cf444c7ddc5c10fe55a07b6b79e1f0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 12:18:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 12:18:25 -0500    

Click here for diff

The "callargs" variable is modified within PG_TRY and then referenced  
within PG_CATCH, which is exactly the coding pattern we've now found  
to be unsafe.  Marking "callargs" volatile would be problematic because  
it is passed by reference to some Tcl functions, so fix the problem  
by not modifying it within PG_TRY.  We can just postpone the free()  
till we exit the PG_TRY construct, as is already done elsewhere in this  
same file.  
  
Also, fix failure to free(callargs) when exiting on too-many-arguments  
error.  This is only a minor memory leak, but a leak nonetheless.  
  
In passing, remove some unnecessary "volatile" markings in the same  
function.  Those doubtless are there because gcc 2.95.3 whinged about  
them, but we now know that its algorithm for complaining is many bricks  
shy of a load.  
  
This is certainly a live bug with compilers that optimize similarly  
to current gcc, so back-patch to all active branches.  

M src/pl/tcl/pltcl.c

Fix volatile-safety issue in asyncQueueReadAllNotifications().

commit   : c58accd70bf3f8b436a66c5e9f0d0a1c1d4d5cc6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 11:57:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Jan 2015 11:57:33 -0500    

Click here for diff

The "pos" variable is modified within PG_TRY and then referenced  
within PG_CATCH, so for strict POSIX conformance it must be marked  
volatile.  Superficially the code looked safe because pos's address  
was taken, which was sufficient to force it into memory ... but it's  
not sufficient to ensure that the compiler applies updates exactly  
where the program text says to.  The volatility marking has to extend  
into a couple of subroutines too, but I think that's probably a good  
thing because the risk of out-of-order updates is mostly in those  
subroutines not asyncQueueReadAllNotifications() itself.  In principle  
the compiler could have re-ordered operations such that an error could  
be thrown while "pos" had an incorrect value.  
  
It's unclear how real the risk is here, but for safety back-patch  
to all active branches.  

M src/backend/commands/async.c

Further cleanup of ReorderBufferCommit().

commit   : c70f9e8988c52ee4a81b978208dda96d399977b6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jan 2015 22:49:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jan 2015 22:49:56 -0500    

Click here for diff

On closer inspection, we can remove the "volatile" qualifier on  
"using_subtxn" so long as we initialize that before the PG_TRY block,  
which there's no particularly good reason not to do.  
Also, push the "change" variable inside the PG_TRY so as to remove  
all question of whether it needs "volatile", and remove useless  
early initializations of "snapshow_now" and "using_subtxn".  

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

Clean up assorted issues in ALTER SYSTEM coding.

commit   : bf007a27acd7b2fbaa4c8db293f156907cb01d27    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jan 2015 20:19:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jan 2015 20:19:04 -0500    

Click here for diff

Fix unsafe use of a non-volatile variable in PG_TRY/PG_CATCH in  
AlterSystemSetConfigFile().  While at it, clean up a bundle of other  
infelicities and outright bugs, including corner-case-incorrect linked list  
manipulation, a poorly designed and worse documented parse-and-validate  
function (which even included some randomly chosen hard-wired substitutes  
for the specified elevel in one code path ... wtf?), direct use of open()  
instead of fd.c's facilities, inadequate checking of write()'s return  
value, and generally poorly written commentary.  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c

Clean up some mess in row-security patches.

commit   : fd496129d160950ed681c1150ea8f627b292c511    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 16:16:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 16:16:22 -0500    

Click here for diff

Fix unsafe coding around PG_TRY in RelationBuildRowSecurity: can't change  
a variable inside PG_TRY and then use it in PG_CATCH without marking it  
"volatile".  In this case though it seems saner to avoid that by doing  
a single assignment before entering the TRY block.  
  
I started out just intending to fix that, but the more I looked at the  
row-security code the more distressed I got.  This patch also fixes  
incorrect construction of the RowSecurityPolicy cache entries (there was  
not sufficient care taken to copy pass-by-ref data into the cache memory  
context) and a whole bunch of sloppiness around the definition and use of  
pg_policy.polcmd.  You can't use nulls in that column because initdb will  
mark it NOT NULL --- and I see no particular reason why a null entry would  
be a good idea anyway, so changing initdb's behavior is not the right  
answer.  The internal value of '\0' wouldn't be suitable in a "char" column  
either, so after a bit of thought I settled on using '*' to represent ALL.  
Chasing those changes down also revealed that somebody wasn't paying  
attention to what the underlying values of ACL_UPDATE_CHR etc really were,  
and there was a great deal of lackadaiscalness in the catalogs.sgml  
documentation for pg_policy and pg_policies too.  
  
This doesn't pretend to be a complete code review for the row-security  
stuff, it just fixes the things that were in my face while dealing with  
the bugs in RelationBuildRowSecurity.  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/policy.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_policy.h
M src/include/rewrite/rowsecurity.h
M src/test/regress/expected/rules.out

Fix unsafe coding in ReorderBufferCommit().

commit   : f8a4dd2e141a12e349882edecc683504acb82ec8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 13:25:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 13:25:19 -0500    

Click here for diff

"iterstate" must be marked volatile since it's changed inside the PG_TRY  
block and then used in the PG_CATCH stanza.  Noted by Mark Wilding of  
Salesforce.  (We really need to see if we can't get the C compiler to warn  
about this.)  
  
Also, reset iterstate to NULL after the mainline ReorderBufferIterTXNFinish  
call, to ensure the PG_CATCH block doesn't try to do that a second time.  

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

Replace a bunch more uses of strncpy() with safer coding.

commit   : 586dd5d6a5d59e406bc8032bb52625ffb904311c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 13:05:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 13:05:42 -0500    

Click here for diff

strncpy() has a well-deserved reputation for being unsafe, so make an  
effort to get rid of nearly all occurrences in HEAD.  
  
A large fraction of the remaining uses were passing length less than or  
equal to the known strlen() of the source, in which case no null-padding  
can occur and the behavior is equivalent to memcpy(), though doubtless  
slower and certainly harder to reason about.  So just use memcpy() in  
these cases.  
  
In other cases, use either StrNCpy() or strlcpy() as appropriate (depending  
on whether padding to the full length of the destination buffer seems  
useful).  
  
I left a few strncpy() calls alone in the src/timezone/ code, to keep it  
in sync with upstream (the IANA tzcode distribution).  There are also a  
few such calls in ecpg that could possibly do with more analysis.  
  
AFAICT, none of these changes are more than cosmetic, except for the four  
occurrences in fe-secure-openssl.c, which are in fact buggy: an overlength  
source leads to a non-null-terminated destination buffer and ensuing  
misbehavior.  These don't seem like security issues, first because no stack  
clobber is possible and second because if your values of sslcert etc are  
coming from untrusted sources then you've got problems way worse than this.  
Still, it's undesirable to have unpredictable behavior for overlength  
inputs, so back-patch those four changes to all active branches.  

M contrib/fuzzystrmatch/dmetaphone.c
M contrib/isn/isn.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgbench/pgbench.c
M contrib/pgcrypto/crypt-des.c
M contrib/xml2/xpath.c
M src/backend/libpq/hba.c
M src/backend/postmaster/pgstat.c
M src/backend/regex/regerror.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/error/elog.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_db.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-secure-openssl.c

Remove no-longer-referenced src/port/gethostname.c.

commit   : 9222cd84b0f227287f65df395d52dc7973a62d29    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 12:13:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jan 2015 12:13:57 -0500    

Click here for diff

This file hasn't been part of any build since 2005, and even before that  
wasn't used unless you configured --with-krb4 (and had a machine without  
gethostname(2), obviously).  What's more, we haven't actually called  
gethostname anywhere since then, either (except in thread_test.c, whose  
testing of this function is probably pointless).  So we don't need it.  

D src/port/gethostname.c

Fix assignment operator thinko

commit   : f2789ab84ea0f731d97006c3ea91c656415c0fe5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 24 Jan 2015 11:15:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 24 Jan 2015 11:15:56 -0300    

Click here for diff

Pointed out by Michael Paquier  

M src/bin/scripts/vacuumdb.c

Fix typos, update README.

commit   : d1747571b63444615730ca17474e9e89974c48ad    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Jan 2015 15:06:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Jan 2015 15:06:29 -0500    

Click here for diff

Peter Geoghegan  

M src/backend/lib/README
M src/backend/utils/adt/varlena.c
M src/include/utils/sortsupport.h

vacuumdb: enable parallel mode

commit   : a17923204736d8842eade3517d6a8ee81290fca4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Jan 2015 15:02:45 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Jan 2015 15:02:45 -0300    

Click here for diff

This mode allows vacuumdb to open several server connections to vacuum  
or analyze several tables simultaneously.  
  
Author: Dilip Kumar.  Some reworking by Álvaro Herrera  
Reviewed by: Jeff Janes, Amit Kapila, Magnus Hagander, Andres Freund  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/pg_dump/parallel.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/vacuumdb.c

Don't use abbreviated keys for the final merge pass.

commit   : 5cefbf5a6c4466ac6b1cc2a4316b4eba9108c802    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Jan 2015 11:58:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Jan 2015 11:58:31 -0500    

Click here for diff

When we write tuples out to disk and read them back in, the abbreviated  
keys become non-abbreviated, because the readtup routines don't know  
anything about abbreviation.  But without this fix, the rest of the  
code still thinks the abbreviation-aware compartor should be used,  
so chaos ensues.  
  
Report by Andrew Gierth; patch by Peter Geoghegan.  

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

Add an explicit cast to Size to hyperloglog.c

commit   : 6a3c6ba0ba2bf86254d43b40569cdf3012cf12aa    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 23 Jan 2015 11:44:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 23 Jan 2015 11:44:51 -0500    

Click here for diff

MSVC generates a warning here; we hope this will make it happy.  
  
Report by Michael Paquier.  Patch by David Rowley.  

M src/backend/lib/hyperloglog.c

Prevent duplicate escape-string warnings when using pg_stat_statements.

commit   : eb213acfe2a51ab3dc6d9bbe02d5d8a903366779    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Jan 2015 18:10:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Jan 2015 18:10:47 -0500    

Click here for diff

contrib/pg_stat_statements will sometimes run the core lexer a second time  
on submitted statements.  Formerly, if you had standard_conforming_strings  
turned off, this led to sometimes getting two copies of any warnings  
enabled by escape_string_warning.  While this is probably no longer a big  
deal in the field, it's a pain for regression testing.  
  
To fix, change the lexer so it doesn't consult the escape_string_warning  
GUC variable directly, but looks at a copy in the core_yy_extra_type state  
struct.  Then, pg_stat_statements can change that copy to disable warnings  
while it's redoing the lexing.  
  
It seemed like a good idea to make this happen for all three of the GUCs  
consulted by the lexer, not just escape_string_warning.  There's not an  
immediate use-case for callers to adjust the other two AFAIK, but making  
it possible is easy enough and seems like good future-proofing.  
  
Arguably this is a bug fix, but there doesn't seem to be enough interest to  
justify a back-patch.  We'd not be able to back-patch exactly as-is anyway,  
for fear of breaking ABI compatibility of the struct.  (We could perhaps  
back-patch the addition of only escape_string_warning by adding it at the  
end of the struct, where there's currently alignment padding space.)  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/parser/scan.l
M src/include/parser/scanner.h

Fix whitespace

commit   : f5f2c2de163352849879fd40e9793a0195fd6594    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Jan 2015 16:57:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Jan 2015 16:57:16 -0500    

Click here for diff

M src/backend/commands/foreigncmds.c

Tweak BRIN minmax operator class

commit   : 972bf7d6f13005dfe89ae3f8a3b937a4a0580c85    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jan 2015 17:01:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jan 2015 17:01:09 -0300    

Click here for diff

In the union support proc, we were not checking the hasnulls flag of  
value A early enough, so it could be skipped if the "allnulls" flag in  
value B is set.  Also, a check on the allnulls flag of value "B" was  
redundant, so remove it.  
  
Also change inet_minmax_ops to not be the default opclass for type inet,  
as a future inclusion operator class would be more useful and it's  
pretty difficult to change default opclass for a datatype later on.  
(There is no catversion bump for this catalog change; this shouldn't be  
a problem.)  
  
Extracted from a larger patch to add an "inclusion" operator class.  
  
Author: Emre Hasegeli  

M src/backend/access/brin/brin_minmax.c
M src/include/catalog/pg_opclass.h
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

docs: update libpq's PQputCopyData and PQputCopyEnd

commit   : b04d69161354f7cfc3d8153b67145dbebc4a4698    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 22 Jan 2015 13:30:08 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 22 Jan 2015 13:30:08 -0500    

Click here for diff

Clarify the meaning of libpq return values for PQputCopyData and  
PQputCopyEnd, particularly in non-blocking mode.  
  
Report by Robert Haas  

M doc/src/sgml/libpq.sgml

Repair brain fade in commit b181a91981203f6ec9403115a2917bd3f9473707.

commit   : d060e07fa919e0eb681e2fa2cfbe63d6c40eb2cf    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jan 2015 12:47:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jan 2015 12:47:46 -0500    

Click here for diff

The split between which things need to happen in the C-locale case and  
which needed to happen in the locale-aware case was a few bricks short  
of a load.  Try to fix that.  

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

adjust ACL owners for REASSIGN and ALTER OWNER TO

commit   : 59367fdf97cc1875b053ebf87cd1e071dc7f3640    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 22 Jan 2015 12:36:34 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 22 Jan 2015 12:36:34 -0500    

Click here for diff

When REASSIGN and ALTER OWNER TO are used, both the object owner and ACL  
list should be changed from the old owner to the new owner. This patch  
fixes types, foreign data wrappers, and foreign servers to change their  
ACL list properly;  they already changed owners properly.  
  
BACKWARD INCOMPATIBILITY?  
  
Report by Alexey Bashtanov  

M src/backend/commands/foreigncmds.c
M src/backend/commands/typecmds.c
M src/test/regress/expected/foreign_data.out

More fixes for abbreviated keys infrastructure.

commit   : b181a91981203f6ec9403115a2917bd3f9473707    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jan 2015 11:58:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jan 2015 11:58:58 -0500    

Click here for diff

First, when LC_COLLATE = C, bttext_abbrev_convert should use memcpy()  
rather than strxfrm() to construct the abbreviated key, because the  
authoritative comparator uses memcpy().  If we do anything else here,  
we might get inconsistent answers, and the buildfarm says this risk  
is not theoretical.  It should be faster this way, too.  
  
Second, while I'm looking at bttext_abbrev_convert, convert a needless  
use of goto into the loop it's trying to implement into an actual  
loop.  
  
Both of the above problems date to the original commit of abbreviated  
keys, commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23.  
  
Third, fix a bogus assignment to tss->locale before tss is set up.  
That's a new goof in commit b529b65d1bf8537ca7fa024760a9782d7c8b66e5.  

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

Heavily refactor btsortsupport_worker.

commit   : b529b65d1bf8537ca7fa024760a9782d7c8b66e5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 22 Jan 2015 10:46:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 22 Jan 2015 10:46:42 -0500    

Click here for diff

Prior to commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23, this function  
only had one job, which was to decide whether we could avoid trampolining  
through the fmgr layer when performing sort comparisons.  As of that  
commit, it has a second job, which is to decide whether we can use  
abbreviated keys.  Unfortunately, those two tasks are somewhat intertwined  
in the existing coding, which is likely why neither Peter Geoghegan nor  
I noticed prior to commit that this calls pg_newlocale_from_collation() in  
cases where it didn't previously.  The buildfarm noticed, though.  
  
To fix, rewrite the logic so that the decision as to which comparator to  
use is more cleanly separated from the decision about abbreviation.  

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

reinit.h: Fix typo in identification comment

commit   : 813ffc0ef9f3c19dc01de19b1a718f2dda495f4f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jan 2015 12:26:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jan 2015 12:26:51 -0300    

Click here for diff

Author: Sawada Masahiko  

M src/include/storage/reinit.h

Disable abbreviated keys on Windows.

commit   : 1be4eb1b2d436d1375899c74e4c74486890d8777    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Jan 2015 20:32:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Jan 2015 20:32:21 -0500    

Click here for diff

Most of the Windows buildfarm members (bowerbird, hamerkop, currawong,  
jacana, brolga) are unhappy with yesterday's abbreviated keys patch,  
although there are some (narwhal, frogmouth) that seem OK with it.  
Since there's no obvious pattern to explain why some are working and  
others are failing, just disable this across-the-board on Windows for  
now.  This is a bit unfortunate since the optimization will be a big  
win in some cases, but we can't leave the buildfarm broken.  

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

tools/ccsym: update for modern versions of gcc

commit   : f259e71dbe98f653182f0c710143487a0188fbc5    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 20 Jan 2015 13:02:35 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 20 Jan 2015 13:02:35 -0500    

Click here for diff

This dumps the predefined preprocessor macros  

M src/tools/ccsym

Add strxfrm_l to list of functions where Windows adds an underscore.

commit   : f32a1fa462c88676105445f26885d7a0656b6806    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 20 Jan 2015 10:52:01 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 20 Jan 2015 10:52:01 -0500    

Click here for diff

Per buildfarm failure on bowerbird after last night's commit  
4ea51cdfe85ceef8afabceb03c446574daa0ac23.  
  
Peter Geoghegan  

M src/include/port/win32.h

In pg_regress, remove the temporary installation upon successful exit.

commit   : aa719391d5537d30068109e1f96991d0e2c7dfc5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Jan 2015 23:44:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Jan 2015 23:44:19 -0500    

Click here for diff

This results in a very substantial reduction in disk space usage during  
"make check-world", since that sequence involves creation of numerous  
temporary installations.  It should also help a bit in the buildfarm, even  
though the buildfarm script doesn't create as many temp installations,  
because the current script misses deleting some of them; and anyway it  
seems better to do this once in one place rather than expecting that  
script to get it right every time.  
  
In 9.4 and HEAD, also undo the unwise choice in commit b1aebbb6a86e96d7  
to report strerror(errno) after a rmtree() failure.  rmtree has already  
reported that, possibly for multiple failures with distinct errnos; and  
what's more, by the time it returns there is no good reason to assume  
that errno still reflects the last reportable error.  So reporting errno  
here is at best redundant and at worst badly misleading.  
  
Back-patch to all supported branches, so that future revisions of the  
buildfarm script can rely on this behavior.  

M src/test/regress/pg_regress.c

Adjust "pgstat wait timeout" message to be a translatable LOG message.

commit   : 75b48e1fff8a4dedd3ddd7b76f6360b5cc9bb741    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Jan 2015 23:01:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Jan 2015 23:01:33 -0500    

Click here for diff

Per discussion, change the log level of this message to be LOG not WARNING.  
The main point of this change is to avoid causing buildfarm run failures  
when the stats collector is exceptionally slow to respond, which it not  
infrequently is on some of the smaller/slower buildfarm members.  
  
This change does lose notice to an interactive user when his stats query  
is looking at out-of-date stats, but the majority opinion (not necessarily  
that of yours truly) is that WARNING messages would probably not get  
noticed anyway on heavily loaded production systems.  A LOG message at  
least ensures that the problem is recorded somewhere where bulk auditing  
for the issue is possible.  
  
Also, instead of an untranslated "pgstat wait timeout" message, provide  
a translatable and hopefully more understandable message "using stale  
statistics instead of current ones because stats collector is not  
responding".  The original text was written hastily under the assumption  
that it would never really happen in practice, which we now know to be  
unduly optimistic.  
  
Back-patch to all active branches, since we've seen the buildfarm issue  
in all branches.  

M src/backend/postmaster/pgstat.c

Fix various shortcomings of the new PrivateRefCount infrastructure.

commit   : 2d115e47c861878669ba0814b3d97a4e4c347e8b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 19 Jan 2015 18:28:11 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 19 Jan 2015 18:28:11 +0100    

Click here for diff

As noted by Tom Lane the improvements in 4b4b680c3d6 had the problem  
that in some situations we searched, entered and modified entries in  
the private refcount hash while holding a spinlock. I had tried to  
keep the logic entirely local to PinBuffer_Locked(), but that's not  
really possible given it's called with a spinlock held...  
  
Besides being disadvantageous from a performance point of view, this  
also has problems with error handling safety. If we failed inserting  
an entry into the hashtable due to an out of memory error, we'd error  
out with a held spinlock. Not good.  
  
Change the way private refcounts are manipulated: Before a buffer can  
be tracked an entry has to be reserved using  
ReservePrivateRefCountEntry(); then, if a entry is not found using  
GetPrivateRefCountEntry(), it can be entered with  
NewPrivateRefCountEntry().  
  
Also take advantage of the fact that PinBuffer_Locked() currently is  
never called for buffers that already have been pinned by the current  
backend and don't search the private refcount entries for preexisting  
local pins. That results in a small, but measurable, performance  
improvement.  
  
Additionally make ReleaseBuffer() always call UnpinBuffer() for shared  
buffers. That avoids duplicating work in an eventual UnpinBuffer()  
call that already has been done in ReleaseBuffer() and also saves some  
code.  
  
Per discussion with Tom Lane.  
  
Discussion: [email protected]  

M src/backend/storage/buffer/bufmgr.c

Use abbreviated keys for faster sorting of text datums.

commit   : 4ea51cdfe85ceef8afabceb03c446574daa0ac23    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Jan 2015 15:20:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Jan 2015 15:20:31 -0500    

Click here for diff

This commit extends the SortSupport infrastructure to allow operator  
classes the option to provide abbreviated representations of Datums;  
in the case of text, we abbreviate by taking the first few characters  
of the strxfrm() blob.  If the abbreviated comparison is insufficent  
to resolve the comparison, we fall back on the normal comparator.  
This can be much faster than the old way of doing sorting if the  
first few bytes of the string are usually sufficient to resolve the  
comparison.  
  
There is the potential for a performance regression if all of the  
strings to be sorted are identical for the first 8+ characters and  
differ only in later positions; therefore, the SortSupport machinery  
now provides an infrastructure to abort the use of abbreviation if  
it appears that abbreviation is producing comparatively few distinct  
keys.  HyperLogLog, a streaming cardinality estimator, is included in  
this commit and used to make that determination for text.  
  
Peter Geoghegan, reviewed by me.  

M src/backend/access/nbtree/nbtsort.c
M src/backend/commands/analyze.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/lib/Makefile
A src/backend/lib/hyperloglog.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/sort/tuplesort.c
A src/include/lib/hyperloglog.h
M src/include/pg_config_manual.h
M src/include/utils/sortsupport.h

Typo fix.

commit   : 1605291b6c14be92915948d17f5509191632c97f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Jan 2015 11:36:22 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Jan 2015 11:36:22 -0500    

Click here for diff

Etsuro Fujita  

M src/backend/executor/execMain.c

doc: Fix typos in make_timestamp{,tz} examples

commit   : 412f604adbf025618f1338ea6fed0330bc6a610d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Jan 2015 12:43:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Jan 2015 12:43:58 -0300    

Click here for diff

Pointed out by Alan Mogi (bug #12571)  

M doc/src/sgml/func.sgml

BRIN typo fix.

commit   : 9d54b93239040dab49111b6d7e9d6bfe9c71f419    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Jan 2015 08:34:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Jan 2015 08:34:29 -0500    

Click here for diff

Amit Langote  

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

Install shared libraries also in bin on cygwin, mingw

commit   : cb4a3b0410d3ba19e4524fceee99fb9b10a5e08a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 18 Jan 2015 22:36:40 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 18 Jan 2015 22:36:40 -0500    

Click here for diff

This was previously only done for libpq, not it's done for all shared  
libraries.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/Makefile.shlib
M src/interfaces/libpq/Makefile

Fix ancient thinko in default table rowcount estimation.

commit   : 75df6dc083f7a989697b5002a421fb204f2eeddb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Jan 2015 17:04:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Jan 2015 17:04:11 -0500    

Click here for diff

The code used sizeof(ItemPointerData) where sizeof(ItemIdData) is correct,  
since we're trying to account for a tuple's line pointer.  Spotted by  
Tomonari Katsumata (bug #12584).  
  
Although this mistake is of very long standing, no back-patch, since it's  
a relatively harmless error and changing it would risk changing default  
planner behavior in stable branches.  (I don't see any change in regression  
test outputs here, but the buildfarm may think differently.)  

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

Activate low-volume optional logging during regression test runs.

commit   : 4c34dcf97f70fa5c3d5fbf70caff12032a27a7dd    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 18 Jan 2015 14:08:09 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 18 Jan 2015 14:08:09 -0500    

Click here for diff

Elaborated from an idea by Andres Freund.  

M src/test/regress/pg_regress.c

Fix use of already freed memory when dumping a database's security label.

commit   : 525b84c576e119de7f2b0d00e3a99d559771aa7b    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 18 Jan 2015 15:57:55 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 18 Jan 2015 15:57:55 +0100    

Click here for diff

pg_dump.c:dumDatabase() called ArchiveEntry() with the results of a a  
query that was PQclear()ed a couple lines earlier.  
  
Backpatch to 9.2 where security labels for shared objects where  
introduced.  

M src/bin/pg_dump/pg_dump.c

Replace walsender's latch with the general shared latch.

commit   : ff44fba46c09c37dd9e60da1cb0b3a9339eb085f    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 17 Jan 2015 13:00:42 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 17 Jan 2015 13:00:42 +0100    

Click here for diff

Relying on the normal shared latch simplifies interrupt/signal  
handling because we can rely on all signal handlers setting the proc  
latch. That in turn allows us to avoid the use of  
ImmediateInterruptOK, which arguably isn't correct because  
WaitLatchOrSocket isn't declared to be immediately interruptible.  
  
Also change sections that wait on the walsender's latch to notice  
interrupts quicker/more reliably and make them more consistent with  
each other.  
  
This is part of a larger "get rid of ImmediateInterruptOK" series.  
  
Discussion: [email protected]  

M src/backend/replication/basebackup.c
M src/backend/replication/walsender.c
M src/include/replication/walsender_private.h

Show sort ordering options in EXPLAIN output.

commit   : 20af53d7191f84d0f5b86da4362e481b7e85d52a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Jan 2015 18:18:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Jan 2015 18:18:52 -0500    

Click here for diff

Up to now, EXPLAIN has contented itself with printing the sort expressions  
in a Sort or Merge Append plan node.  This patch improves that by  
annotating the sort keys with COLLATE, DESC, USING, and/or NULLS FIRST/LAST  
whenever nondefault sort ordering options are used.  The output is now a  
reasonably close approximation of an ORDER BY clause equivalent to the  
plan's ordering.  
  
Marius Timmer, Lukas Kreft, and Arne Scheffer; reviewed by Mike Blackwell.  
Some additional hacking by me.  

M src/backend/commands/explain.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/equivclass.out
M src/test/regress/sql/collate.sql

Advance backend's advertised xmin more aggressively.

commit   : 94028691609f8e148bd4ce72c46163f018832a5b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 17 Jan 2015 01:14:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 17 Jan 2015 01:14:32 +0200    

Click here for diff

Currently, a backend will reset it's PGXACT->xmin value when it doesn't  
have any registered snapshots left. That covered the common case that a  
transaction in read committed mode runs several queries, one after each  
other, as there would be no snapshots active between those queries.  
However, if you hold cursors across each of the query, we didn't get a  
chance to reset xmin.  
  
To make that better, keep all the registered snapshots in a pairing heap,  
ordered by xmin so that it's always quick to find the snapshot with the  
smallest xmin. That allows us to advance PGXACT->xmin whenever the oldest  
snapshot is deregistered, even if there are others still active.  
  
Per discussion originally started by Jeff Davis back in 2009 and more  
recently by Robert Haas.  

M src/backend/utils/time/snapmgr.c
M src/include/lib/pairingheap.h
M src/include/utils/snapshot.h

Improve new caching logic in tbm_add_tuples().

commit   : 779fdcdeeeb9cdbfd271f8dc5bde76ed0c7b0813    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Jan 2015 13:28:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Jan 2015 13:28:30 -0500    

Click here for diff

For no significant extra complexity, we can cache knowledge that the  
target page is lossy, and save a hash_search per iteration in that  
case as well.  This probably makes little difference, since the extra  
rechecks that must occur when pages are lossy are way more expensive  
than anything we can save here ... but we might as well do it if we're  
going to cache anything.  

M src/backend/nodes/tidbitmap.c

Make tbm_add_tuples more efficient by caching the last acccessed page.

commit   : f5ae3ba4828ece02bae2d16b4cbce847fbcea850    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Jan 2015 17:47:59 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Jan 2015 17:47:59 +0100    

Click here for diff

When adding a large number of tuples to a TID bitmap using  
tbm_add_tuples() sometimes a lot of time was spent looking up a page's  
entry in the bitmap's internal hashtable.  
  
Improve efficiency by caching the last accessed page, while iterating  
over the passed in tuples, hoping consecutive tuples will often be on  
the same page.  In many cases that's a good bet, and in the rest the  
added overhead isn't big.  
  
Discussion: [email protected]  
  
Author: Teodor Sigaev  
Reviewed-By: David Rowley  

M src/backend/nodes/tidbitmap.c

Another attempt at fixing Windows Norwegian locale.

commit   : aa1d2fc5e91e396bec5bf8a8d10b6cc4af0b0fff    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 16 Jan 2015 12:12:49 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 16 Jan 2015 12:12:49 +0200    

Click here for diff

Previous fix mapped "Norwegian (Bokmål)" locale, which contains a non-ASCII  
character, to the pure ASCII alias "norwegian-bokmal". However, it turns  
out that more recent versions of the CRT library, in particular MSVCR110  
(Visual Studio 2012), changed the behaviour of setlocale() so that if  
you pass "norwegian-bokmal" to setlocale, it returns "Norwegian_Norway".  
  
That meant trouble, when setlocale(..., NULL) first returned  
"Norwegian (Bokmål)_Norway", which we mapped to "norwegian-bokmal_Norway",  
but another call to setlocale(..., "norwegian-bokmal_Norway") returned  
"Norwegian_Norway". That caused PostgreSQL to think that they are different  
locales, and therefore not compatible. That caused initdb to fail at  
CREATE DATABASE.  
  
Older CRT versions seem to accept "Norwegian_Norway" too, so change the  
mapping to return "Norwegian_Norway" instead of "norwegian-bokmal".  
  
Backpatch to 9.2 like the previous attempt. We haven't made a release that  
includes the previous fix yet, so we don't need to worry about changing the  
locale of existing clusters from "norwegian-bokmal" to "Norwegian_Norway".  
(Doing any mapping like this at all requires changing the locale of  
existing databases; the release notes need to include instructions for  
that).  

M src/port/win32setlocale.c

Update "pg_regress --no-locale" for Darwin and Windows.

commit   : 28df6a0df0a78360629163c3df5b073ea6deeca6    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 16 Jan 2015 01:27:31 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 16 Jan 2015 01:27:31 -0500    

Click here for diff

Commit 894459e59ffa5c7fee297b246c17e1f72564db1d revealed this option to  
be broken for NLS builds on Darwin, but "make -C contrib/unaccent check"  
and the buildfarm client rely on it.  Fix that configuration by  
redefining the option to imply LANG=C on Darwin.  In passing, use LANG=C  
instead of LANG=en on Windows; since only postmaster startup uses that  
value, testers are unlikely to notice the change.  Back-patch to 9.0,  
like the predecessor commit.  

M src/test/regress/pg_regress.c

Fix use-of-already-freed-memory problem in EvalPlanQual processing.

commit   : c480cb9d246cec5e1dd7d72956e792df16e5445d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jan 2015 18:52:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jan 2015 18:52:22 -0500    

Click here for diff

Up to now, the "child" executor state trees generated for EvalPlanQual  
rechecks have simply shared the ResultRelInfo arrays used for the original  
execution tree.  However, this leads to dangling-pointer problems, because  
ExecInitModifyTable() is all too willing to scribble on some fields of the  
ResultRelInfo(s) even when it's being run in one of those child trees.  
This trashes those fields from the perspective of the parent tree, because  
even if the generated subtree is logically identical to what was in use in  
the parent, it's in a memory context that will go away when we're done  
with the child state tree.  
  
We do however want to share information in the direction from the parent  
down to the children; in particular, fields such as es_instrument *must*  
be shared or we'll lose the stats arising from execution of the children.  
So the simplest fix is to make a copy of the parent's ResultRelInfo array,  
but not copy any fields back at end of child execution.  
  
Per report from Manuel Kniep.  The added isolation test is based on his  
example.  In an unpatched memory-clobber-enabled build it will reliably  
fail with "ctid is NULL" errors in all branches back to 9.1, as a  
consequence of junkfilter->jf_junkAttNo being overwritten with $7f7f.  
This test cannot be run as-is before that for lack of WITH syntax; but  
I have no doubt that some variant of this problem can arise in older  
branches, so apply the code change all the way back.  

M src/backend/executor/execMain.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Fix thinko in re-setting wal_log_hints flag from a parameter-change record.

commit   : 49b04188f83fb8cacf925978989bc20399e76786    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Jan 2015 20:48:48 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 15 Jan 2015 20:48:48 +0200    

Click here for diff

The flag is supposed to be copied from the record. Same issue with  
track_commit_timestamps, but that's master-only.  
  
Report and fix by Petr Jalinek. Backpatch to 9.4, where wal_log_hints was  
added.  

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

Rearrange explain.c's API so callers need not embed sizeof(ExplainState).

commit   : 8e166e164c7c4531d7eb150d836aa2357989237a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jan 2015 13:39:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jan 2015 13:39:33 -0500    

Click here for diff

The folly of the previous arrangement was just demonstrated: there's no  
convenient way to add fields to ExplainState without breaking ABI, even  
if callers have no need to touch those fields.  Since we might well need  
to do that again someday in back branches, let's change things so that  
only explain.c has to have sizeof(ExplainState) compiled into it.  This  
costs one extra palloc() per EXPLAIN operation, which is surely pretty  
negligible.  

M contrib/auto_explain/auto_explain.c
M src/backend/commands/explain.c
M src/include/commands/explain.h

Improve performance of EXPLAIN with large range tables.

commit   : a5cd70dcbc268381e13cb0b2973b5732856d186f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jan 2015 13:18:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jan 2015 13:18:12 -0500    

Click here for diff

As of 9.3, ruleutils.c goes to some lengths to ensure that table and column  
aliases used in its output are unique.  Of course this takes more time than  
was required before, which in itself isn't fatal.  However, EXPLAIN was set  
up so that recalculation of the unique aliases was repeated for each  
subexpression printed in a plan.  That results in O(N^2) time and memory  
consumption for large plan trees, which did not happen in older branches.  
  
Fortunately, the expensive work is the same across a whole plan tree,  
so there is no need to repeat it; we can do most of the initialization  
just once per query and re-use it for each subexpression.  This buys  
back most (not all) of the performance loss since 9.2.  
  
We need an extra ExplainState field to hold the precalculated deparse  
context.  That's no problem in HEAD, but in the back branches, expanding  
sizeof(ExplainState) seems risky because third-party extensions might  
have local variables of that struct type.  So, in 9.4 and 9.3, introduce  
an auxiliary struct to keep sizeof(ExplainState) the same.  We should  
refactor the APIs to avoid such local variables in future, but that's  
material for a separate HEAD-only commit.  
  
Per gripe from Alexey Bashtanov.  Back-patch to 9.3 where the issue  
was introduced.  

M src/backend/commands/explain.c
M src/backend/utils/adt/ruleutils.c
M src/include/commands/explain.h
M src/include/utils/ruleutils.h

pg_standby: Avoid writing one byte beyond the end of the buffer.

commit   : 0b49642b99ca2818bb8bfcaddf522b2e36a5b350    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 15 Jan 2015 09:26:03 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 15 Jan 2015 09:26:03 -0500    

Click here for diff

Previously, read() might have returned a length equal to the buffer  
length, and then the subsequent store to buf[len] would write a  
zero-byte one byte past the end.  This doesn't seem likely to be  
a security issue, but there's some chance it could result in  
pg_standby misbehaving.  
  
Spotted by Coverity; patch by Michael Paquier, reviewed by me.  

M contrib/pg_standby/pg_standby.c

Blindly try to fix a warning in s_lock.h when compiling with gcc on HPPA.

commit   : 6cfd5086e140b365086d61f25c519d046dfcf7f0    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Jan 2015 13:10:24 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Jan 2015 13:10:24 +0100    

Click here for diff

The possibly, depending on compiler settings, generated warning was  
"warning: `S_UNLOCK' redefined".  
  
The hppa spinlock implementation doesn't follow the rules of s_lock.h  
and provides a gcc specific implementation outside of the the part of  
the file that's supposed to do that.  It does so to avoid duplication  
between the HP compiler and gcc. That unfortunately means that  
S_UNLOCK is already defined when the HPPA specific section is reached.  
  
Undefine the generic fallback S_UNLOCK definition inside the HPPA  
section. That's far from pretty, but has the big advantage of being  
simple. If somebody is interested to fix this in a prettier way...  
  
This presumably got broken in the course of 0709b7ee72.  
  
Discussion: [email protected]  
  
Per complaint from Tom Lane.  

M src/include/storage/s_lock.h

docs: Add missing <literal> markup.

commit   : 73a8f5176ad980d1d2c265649757af3391079318    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 14 Jan 2015 16:40:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 14 Jan 2015 16:40:58 -0500    

Click here for diff

Michael Paquier  

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

vacuumlo: Avoid unlikely memory leak.

commit   : 4a0a5f21fa05070295557ad6ac9b9bbe247938ad    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 14 Jan 2015 15:14:20 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 14 Jan 2015 15:14:20 -0500    

Click here for diff

Spotted by Coverity.  This isn't likely to matter in practice, but  
there's no harm in fixing it.  
  
Michael Paquier  

M contrib/vacuumlo/vacuumlo.c

Add a default local latch for use in signal handlers.

commit   : 59f71a0d0b56b2df48db4bf1738aece5551f7a47    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 14 Jan 2015 18:45:22 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 14 Jan 2015 18:45:22 +0100    

Click here for diff

To do so, move InitializeLatchSupport() into the new common process  
initialization functions, and add a new global variable MyLatch.  
  
MyLatch is usable as soon InitPostmasterChild() has been called  
(i.e. very early during startup). Initially it points to a process  
local latch that exists in all processes. InitProcess/InitAuxiliaryProcess  
then replaces that local latch with PGPROC->procLatch. During shutdown  
the reverse happens.  
  
This is primarily advantageous for two reasons: For one it simplifies  
dealing with the shared process latch, especially in signal handlers,  
because instead of having to check for MyProc, MyLatch can be used  
unconditionally. For another, a later patch that makes FEs/BE  
communication use latches, now can rely on the existence of a latch,  
even before having gone through InitProcess.  
  
Discussion: [email protected]  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/syncrep.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/misc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/timeout.c
M src/include/miscadmin.h
M src/include/storage/latch.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/worker.c
M src/test/modules/worker_spi/worker_spi.c

Allow CFLAGS from configure's environment to override automatic CFLAGS.

commit   : 85a2a8903f7e9151793308d0638621003aded5ae    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Jan 2015 11:08:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Jan 2015 11:08:13 -0500    

Click here for diff

Previously, configure would add any switches that it chose of its own  
accord to the end of the user-specified CFLAGS string.  Since most  
compilers process these left-to-right, this meant that configure's choices  
would override the user-specified flags in case of conflicts.  We'd rather  
that worked the other way around, so adjust the logic to put the user's  
string at the end not the beginning.  
  
There does not seem to be a need for a similar behavior change for CPPFLAGS  
or LDFLAGS: in those, the earlier switches tend to win (think -I or -L  
behavior) so putting the user's string at the front is fine.  
  
Backpatch to 9.4 but not earlier.  I'm not planning to run buildfarm member  
guar on older branches, and it seems a bit risky to change this behavior  
in long-stable branches.  

M configure
M configure.in

Remove duplicate specification of -Ae for HP-UX C compiler.

commit   : fd3d894e4ea0021efa2628e4dfc5fe0ed3071859    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Jan 2015 22:52:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Jan 2015 22:52:11 -0500    

Click here for diff

Autoconf has known about automatically selecting -Ae when needed for  
quite some time now, so remove the redundant addition in template/hpux.  
Noted while setting up buildfarm member pademelon.  

M src/template/hpux

Remove some dead IsUnderPostmaster code from bootstrap.c.

commit   : 0139dea8f1cea49f13c22a3f645dbdd02b90d25c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 16:44:09 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 16:44:09 +0100    

Click here for diff

Since commit 626eb021988a2 has introduced the auxiliary process  
infrastructure, bootstrap_signals() was never used when forked from  
postmaster.  
  
Remove the IsUnderPostmaster specific code, and add a appropriate  
assertion.  

M src/backend/bootstrap/bootstrap.c

Commonalize process startup code.

commit   : 31c453165b5a656044ce1dbce89f5828c1c7e23c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 13:12:37 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 13:12:37 +0100    

Click here for diff

Move common code, that was duplicated in every postmaster child/every  
standalone process, into two functions in miscinit.c.  Not only does  
that already result in a fair amount of net code reduction but it also  
makes it much easier to remove more duplication in the future. The  
prime motivation wasn't code deduplication though, but easier addition  
of new common code.  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Make logging_collector=on work with non-windows EXEC_BACKEND again.

commit   : 2be82dcf17a18511df5153bcafe67a9c1387be1e    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 21:02:47 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 21:02:47 +0100    

Click here for diff

Commit b94ce6e80 reordered postmaster's startup sequence so that the  
tempfile directory is only cleaned up after all the necessary state  
for pg_ctl is collected.  Unfortunately the chosen location is after  
the syslogger has been started; which normally is fine, except for  
!WIN32 EXEC_BACKEND builds, which pass information to children via  
files in the temp directory.  
  
Move the call to RemovePgTempFiles() to just before the syslogger has  
started. That's the first child we fork.  
  
Luckily EXEC_BACKEND is pretty much only used by endusers on windows,  
which has a separate method to pass information to children. That  
means the real world impact of this bug is very small.  
  
Discussion: [email protected]  
  
Backpatch to 9.1, just as the previous commit was.  

M src/backend/postmaster/postmaster.c

Spell the X072 feature correctly, was missing "with".

commit   : e922a13058e3c4a20e11cea8e4801ec36f811455    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Jan 2015 16:08:55 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Jan 2015 16:08:55 +0200    

Click here for diff

Also use lower-case for a few more features, to be consistent with the  
others and with the SQL spec.  

M src/backend/catalog/sql_features.txt

Silence Coverity warnings about unused return values from pushJsonbValue()

commit   : e37d474f91c3a8a88be28a65389c948a55f18075    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Jan 2015 14:29:36 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Jan 2015 14:29:36 +0200    

Click here for diff

Similar warnings from backend were silenced earlier by commit c8315930,  
but there were a few more contrib/hstore.  
  
Michael Paquier  

M contrib/hstore/hstore_io.c

Add barriers to the latch code.

commit   : 14e8803f101a54d99600683543b0f893a2e3f529    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 12:58:43 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 12:58:43 +0100    

Click here for diff

Since their introduction latches have required barriers in SetLatch  
and ResetLatch - but when they were introduced there wasn't any  
barrier abstraction. Instead latches were documented to rely on the  
callsites to provide barrier semantics.  
  
Now that the barrier support looks halfway complete, add the necessary  
barriers to both latch implementations.  
  
Also remove a now superflous lock acquisition from syncrep.c and a  
superflous (and insufficient) barrier from freelist.c. There might be  
other cases that can now be simplified, but those are the only ones  
I've seen on a quick scan.  
  
We might want to backpatch this at some later point, but right now the  
barrier infrastructure in the backbranches isn't totally on par with  
master.  
  
Discussion: [email protected]  

M src/backend/port/unix_latch.c
M src/backend/port/win32_latch.c
M src/backend/replication/syncrep.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/latch.h

Allow latches to wait for socket writability without waiting for readability.

commit   : 4bad60e3fd9a5fc6070fd4d1bd820a280e174654    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 12:58:43 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Jan 2015 12:58:43 +0100    

Click here for diff

So far WaitLatchOrSocket() required to pass in WL_SOCKET_READABLE as  
that solely was used to indicate error conditions, like EOF. Waiting  
for WL_SOCKET_WRITEABLE would have meant to busy wait upon socket  
errors.  
  
Adjust the API to signal errors by returning the socket as readable,  
writable or both, depending on WL_SOCKET_READABLE/WL_SOCKET_WRITEABLE  
being specified.  It would arguably be nicer to return WL_SOCKET_ERROR  
but that's not possible on platforms and would probably also result in  
more complex callsites.  
  
This previously had explicitly been forbidden in e42a21b9e6c9, as  
there was no strong use case at that point. We now are looking into  
making FE/BE communication use latches, so changing this makes sense.  
  
There also are some portability concerns because there cases of older  
platforms where select(2) is known to, in violation of POSIX, not  
return a socket as writable after the peer has closed it.  So far the  
platforms where that's the case provide a working poll(2). If we find  
one where that's not the case, we'll need to add a workaround for that  
platform.  
  
Discussion: [email protected]  
Reviewed-By: Heikki Linnakangas, Noah Misch  

M src/backend/port/unix_latch.c
M src/backend/port/win32_latch.c

Fix typos in comment.

commit   : 3dfce37627b76e4da9e1d6090beedb608cefafcb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Jan 2015 10:29:16 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Jan 2015 10:29:16 +0200    

Click here for diff

Plus some tiny wordsmithing of not-quite-typos.  

M src/include/port/atomics/fallback.h

Fix some functions that were declared static then defined not-static.

commit   : 7391e2513f486a5df3eebf132c6dd6c16cf4e1f1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jan 2015 16:08:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jan 2015 16:08:43 -0500    

Click here for diff

Per testing with a compiler that whines about this.  

M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_plpymodule.c

Avoid unexpected slowdown in vacuum regression test.

commit   : 5b3ce2c911a2ec9de13b0dea7e135ad945a14583    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jan 2015 15:13:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jan 2015 15:13:28 -0500    

Click here for diff

I noticed the "vacuum" regression test taking really significantly longer  
than it used to on a slow machine.  Investigation pointed the finger at  
commit e415b469b33ba328765e39fd62edcd28f30d9c3c, which added creation of  
an index using an extremely expensive index function.  That function was  
evidently meant to be applied only twice ... but the test re-used an  
existing test table, which up till a couple lines before that had had over  
two thousand rows.  Depending on timing of the concurrent regression tests,  
the intervening VACUUMs might have been unable to remove those  
recently-dead rows, and then the index build would need to create index  
entries for them too, leading to the wrap_do_analyze() function being  
executed 2000+ times not twice.  Avoid this by using a different table  
that is guaranteed to have only the intended two rows in it.  
  
Back-patch to 9.0, like the commit that created the problem.  

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

Tweak heapam's rmgr desc output slightly

commit   : d126e1e95fab44cc73002de3eaa08e2d88f11c50    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Jan 2015 16:09:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Jan 2015 16:09:16 -0300    

Click here for diff

Some spaces were missing, and putting the affected tuple offset first in  
the lock cases instead of the locking data makes more sense.  
  
No backpatch since this is cosmetic and surrounding code has changed.  

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

Fix get_object_address argument type for extension statement

commit   : 5c5ffee80f3547625021c29f45b37321d8c710bf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Jan 2015 15:32:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Jan 2015 15:32:48 -0300    

Click here for diff

Commit 3f88672a4 neglected to update the AlterExtensionContentsStmt  
production in the grammar to use TypeName to represent types when  
passing objects to get_object_address.  
  
Reported as a pg_upgrade failure by Jeff Janes.  

M src/backend/parser/gram.y

Use correct text domain for errcontext() appearing within ereport().

commit   : 1f9bf05e539646103c518bcbb49c04919b238f7a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jan 2015 12:40:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jan 2015 12:40:09 -0500    

Click here for diff

The mechanism added in commit dbdf9679d7d61b03a3bf73af9b095831b7010eb5  
for associating the correct translation domain with errcontext strings  
potentially fails in cases where errcontext() is used within an ereport()  
macro.  Such usage was not originally envisioned for errcontext(), but we  
do have a few places that do it.  In this situation, the intended comma  
expression becomes just a couple of arguments to errfinish(), which the  
compiler might choose to evaluate right-to-left.  
  
Fortunately, in such cases the textdomain for the errcontext string must  
be the same as for the surrounding ereport.  So we can fix this by letting  
errstart initialize context_domain along with domain; then it will have  
the correct value no matter which order the calls occur in.  (Note that  
error stack callback functions are not invoked until errfinish, so normal  
usage of errcontext won't affect what happens for errcontext calls within  
the ereport macro.)  
  
In passing, make sure that errcontext calls within the main backend set  
context_domain to something non-NULL.  This isn't a live bug because  
NULL would select the current textdomain() setting which should be the  
right thing anyway --- but it seems better to handle this completely  
consistently with the regular domain field.  
  
Per report from Dmitry Voronin.  Backpatch to 9.3; before that, there  
wasn't any attempt to ensure that errcontext strings were translated  
in an appropriate domain.  

M src/backend/utils/error/elog.c

Skip dead backends in MinimumActiveBackends

commit   : 1bf4a84d0f9f7a442790d7948e96cd42eeb90a91    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 12 Jan 2015 10:13:18 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 12 Jan 2015 10:13:18 -0500    

Click here for diff

Back in ed0b409, PGPROC was split and moved to static variables in  
procarray.c, with procs in ProcArrayStruct replaced by an array of  
integers representing process numbers (pgprocnos), with -1 indicating a  
dead process which has yet to be removed.  Access to procArray is  
generally done under ProcArrayLock and therefore most code does not have  
to concern itself with -1 entries.  
  
However, MinimumActiveBackends intentionally does not take  
ProcArrayLock, which means it has to be extra careful when accessing  
procArray.  Prior to ed0b409, this was handled by checking for a NULL  
in the pointer array, but that check was no longer valid after the  
split.  Coverity pointed out that the check could never happen and so  
it was removed in 5592eba.  That didn't make anything worse, but it  
didn't fix the issue either.  
  
The correct fix is to check for pgprocno == -1 and skip over that entry  
if it is encountered.  
  
Back-patch to 9.2, since there can be attempts to access the arrays  
prior to their start otherwise.  Note that the changes prior to 9.4 will  
look a bit different due to the change in 5592eba.  
  
Note that MinimumActiveBackends only returns a bool for heuristic  
purposes and any pre-array accesses are strictly read-only and so there  
is no security implication and the lack of fields complaints indicates  
it's very unlikely to run into issues due to this.  
  
Pointed out by Noah.  

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

Fix portability breakage in pg_dump.

commit   : 44096f1c6644a97c92da6c96dc1d8d4e200d4a38    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Jan 2015 13:28:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Jan 2015 13:28:26 -0500    

Click here for diff

Commit 0eea8047bf0e15b402b951e383e39236bdfe57d5 introduced some overly  
optimistic assumptions about what could be in a local struct variable's  
initializer.  (This might in fact be valid code according to C99, but I've  
got at least one pre-C99 compiler that falls over on those nonconstant  
address expressions.)  There is no reason whatsoever for main()'s workspace  
to not be static, so revert long_options[] to a static and make the  
DumpOptions struct static as well.  

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

Remove configure test for nonstandard variants of getpwuid_r().

commit   : 8883bae33b55a52105b1b58d0e42c5a6bda09627    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Jan 2015 12:52:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Jan 2015 12:52:37 -0500    

Click here for diff

We had code that supposed that some platforms might offer a nonstandard  
version of getpwuid_r() with only four arguments.  However, the 5-argument  
definition has been standardized at least since the Single Unix Spec v2,  
which is our normal reference for what's portable across all Unix-oid  
platforms.  (What's more, this wasn't the only pre-standardization version  
of getpwuid_r(); my old HPUX 10.20 box has still another signature.)  
So let's just get rid of the now-useless configure step.  

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

Fix libpq's behavior when /etc/passwd isn't readable.

commit   : 080eabe2e8a184ff40b7380aaaa9418714acace9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Jan 2015 12:35:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Jan 2015 12:35:44 -0500    

Click here for diff

Some users run their applications in chroot environments that lack an  
/etc/passwd file.  This means that the current UID's user name and home  
directory are not obtainable.  libpq used to be all right with that,  
so long as the database role name to use was specified explicitly.  
But commit a4c8f14364c27508233f8a31ac4b10a4c90235a9 broke such cases by  
causing any failure of pg_fe_getauthname() to be treated as a hard error.  
In any case it did little to advance its nominal goal of causing errors  
in pg_fe_getauthname() to be reported better.  So revert that and instead  
put some real error-reporting code in place.  This requires changes to the  
APIs of pg_fe_getauthname() and pqGetpwuid(), since the latter had  
departed from the POSIX-specified API of getpwuid_r() in a way that made  
it impossible to distinguish actual lookup errors from "no such user".  
  
To allow such failures to be reported, while not failing if the caller  
supplies a role name, add a second call of pg_fe_getauthname() in  
connectOptions2().  This is a tad ugly, and could perhaps be avoided with  
some refactoring of PQsetdbLogin(), but I'll leave that idea for later.  
(Note that the complained-of misbehavior only occurs in PQsetdbLogin,  
not when using the PQconnect functions, because in the latter we will  
never bother to call pg_fe_getauthname() if the user gives a role name.)  
  
In passing also clean up the Windows-side usage of GetUserName(): the  
recommended buffer size is 257 bytes, the passed buffer length should  
be the buffer size not buffer size less 1, and any error is reported  
by GetLastError() not errno.  
  
Per report from Christoph Berg.  Back-patch to 9.4 where the chroot  
failure case was introduced.  The generally poor reporting of errors  
here is of very long standing, of course, but given the lack of field  
complaints about it we won't risk changing these APIs further back  
(even though they're theoretically internal to libpq).  

M src/common/username.c
M src/include/port.h
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/port/path.c
M src/port/thread.c

Provide a generic fallback for pg_compiler_barrier using an extern function.

commit   : de6429a8fdd3538e977b482d90389785d733e373    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 11 Jan 2015 01:15:29 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 11 Jan 2015 01:15:29 +0100    

Click here for diff

If the compiler/arch combination does not provide compiler barriers,  
provide a fallback. That fallback simply consists out of a function  
call into a externally defined function.  That should guarantee  
compiler barrierer semantics except for compilers that do inter  
translation unit/global optimization - those better provide an actual  
compiler barrier.  
  
Hopefully this fixes Tom's report of linker failures due to  
pg_compiler_barrier_impl not being provided.  
  
I'm not backpatching this commit as it builds on the new atomics  
infrastructure. If we decide an equivalent fix needs to be  
backpatched, I'll do so in a separate commit.  
  
Discussion: [email protected]  
  
Per report from Tom Lane.  

M src/backend/port/atomics.c
M src/include/port/atomics/fallback.h

Fix alignment of pg_atomic_uint64 variables on some 32bit platforms.

commit   : db4ec2ffce3549225619cae51d828224a11a165f    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 11 Jan 2015 01:06:37 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 11 Jan 2015 01:06:37 +0100    

Click here for diff

I failed to recognize that pg_atomic_uint64 wasn't guaranteed to be 8  
byte aligned on some 32bit platforms - which it has to be on some  
platforms to guarantee the desired atomicity and which we assert.  
  
As this is all compiler specific code anyway we can just rely on  
compiler specific tricks to enforce alignment.  
  
I've been unable to find concrete documentation about the version that  
introduce the sunpro alignment support, so that might need additional  
guards.  
  
I've verified that this works with gcc x86 32bit, but I don't have  
access to any other 32bit environment.  
  
Discussion: op.xpsjdkil0sbe7t@vld-kuci  
  
Per report from Vladimir Koković.  

M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h

docs: improve CREATE TRIGGER defer options list

commit   : 62f5e447fd09074d82052a7232822d1e80d25a08    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 9 Jan 2015 19:19:29 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 9 Jan 2015 19:19:29 -0500    

Click here for diff

Report by Jeff Davis  

M doc/src/sgml/ref/create_trigger.sgml

pg_upgrade: fix one-byte per empty db memory leak

commit   : ac7009abd228362042edd10e6b12556ddef35171    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 9 Jan 2015 12:12:30 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 9 Jan 2015 12:12:30 -0500    

Click here for diff

Report by Tatsuo Ishii, Coverity  

M contrib/pg_upgrade/relfilenode.c

Fix typo in execMain.c

commit   : c4fda14845c3215a15aa9aa0b844119d2c28c475    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 9 Jan 2015 11:01:31 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 9 Jan 2015 11:01:31 -0500    

Click here for diff

Wee -> We.  
  
Pointed out by Etsuro Fujita.  

M src/backend/executor/execMain.c

xlogreader.c: Fix report_invalid_record translatability flag

commit   : 045c68ad219047f42b3cf9ce0d0cda017979d16a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Jan 2015 12:34:25 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Jan 2015 12:34:25 -0300    

Click here for diff

For some reason I overlooked in GETTEXT_TRIGGERS that the right argument  
be read by gettext in 7fcbf6a405ffc12a4546a25b98592ee6733783fc.  This  
will drop the translation percentages for the backend all the way back  
to 9.3 ...  
  
Problem reported by Heikki.  

M src/backend/nls.mk

Move rowsecurity event trigger test

commit   : c219cbfed339122303266a01150c4fb8dde73fd1    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 2 Jan 2015 15:09:39 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 2 Jan 2015 15:09:39 -0500    

Click here for diff

The event trigger test for rowsecurity can cause problems for other  
tests which are run in parallel with it.  Instead of running that test  
in the rowsecurity set, move it to the event_trigger set, which runs  
isolated from other tests.  
  
Also reverts 7161b08, which moved rowsecurity into its own test group.  
That's no longer necessary, now that the event trigger test is gone from  
the rowsecurity set of tests.  
  
Pointed out by Tom.  

M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/event_trigger.sql
M src/test/regress/sql/rowsecurity.sql

Remove comment that was intended to have been removed before commit.

commit   : f454144a34c2288418292ae7b01495724cfda359    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Jan 2015 13:10:33 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Jan 2015 13:10:33 +0100    

Click here for diff

Noticed by Amit Kapila  

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

Move comment about sun cc's __machine_rw_barrier being a full barrier.

commit   : 93be0950070b5bcb22600cb1cbb62f93c058a5dd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Jan 2015 13:08:05 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Jan 2015 13:08:05 +0100    

Click here for diff

I'd accidentally written the comment besides the read barrier, instead  
of the full barrier, implementation.  
  
Noticed by Oskari Saarenmaa  

M src/include/port/atomics/generic-sunpro.h

Fix logging of pages skipped due to pins during vacuum.

commit   : 17eaae9897781c6dcc622b9327899329e4d2a4df    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 8 Jan 2015 12:57:09 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 8 Jan 2015 12:57:09 +0100    

Click here for diff

The new logging introduced in 35192f06 made the incorrect assumption  
that scan_all vacuums would always wait for buffer pins; but they only  
do so if the page actually needs to be frozen.  
  
Fix that inaccuracy by removing the difference in log output based on  
scan_all and just always remove the same message.  I chose to keep the  
split log message from the original commit for now, it seems likely  
that it'll be of use in the future.  
  
Also merge the line about buffer pins in autovacuum's log output into  
the existing "pages: ..." line. It seems odd to have a separate line  
about pins, without the "topic: " prefix others have.  
  
Also rename the new 'pinned_pages' variable to 'pinskipped_pages'  
because it actually tracks the number of pages that could *not* be  
pinned.  
  
Discussion: [email protected]  

M src/backend/commands/vacuumlazy.c

On Darwin, refuse postmaster startup when multithreaded.

commit   : 2048e5b88198213ae15c4b59ddbe124f1a5dc2b7    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:46:59 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:46:59 -0500    

Click here for diff

The previous commit introduced its report at LOG level to avoid  
surprises at minor release upgrade time.  Compel users deploying the  
next major release to also deploy the reported workaround.  

M src/backend/postmaster/postmaster.c

On Darwin, detect and report a multithreaded postmaster.

commit   : 894459e59ffa5c7fee297b246c17e1f72564db1d    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:35:44 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:35:44 -0500    

Click here for diff

Darwin --enable-nls builds use a substitute setlocale() that may start a  
thread.  Buildfarm member orangutan experienced BackendList corruption  
on account of different postmaster threads executing signal handlers  
simultaneously.  Furthermore, a multithreaded postmaster risks undefined  
behavior from sigprocmask() and fork().  Emit LOG messages about the  
problem and its workaround.  Back-patch to 9.0 (all supported versions).  

M configure
M configure.in
M src/backend/postmaster/postmaster.c
M src/common/exec.c
M src/include/pg_config.h.in

Always set the six locale category environment variables in main().

commit   : 6fdba8ceb071a3512d5685f1cd4f971ab4d562d1    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:34:57 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:34:57 -0500    

Click here for diff

Typical server invocations already achieved that.  Invalid locale  
settings in the initial postmaster environment interfered, as could  
malloc() failure.  Setting "LC_MESSAGES=pt_BR.utf8 LC_ALL=invalid" in  
the postmaster environment will now choose C-locale messages, not  
Brazilian Portuguese messages.  Most localized programs, including all  
PostgreSQL frontend executables, do likewise.  Users are unlikely to  
observe changes involving locale categories other than LC_MESSAGES.  
CheckMyDatabase() ensures that we successfully set LC_COLLATE and  
LC_CTYPE; main() sets the remaining three categories to locale "C",  
which almost cannot fail.  Back-patch to 9.0 (all supported versions).  

M src/backend/main/main.c

Reject ANALYZE commands during VACUUM FULL or another ANALYZE.

commit   : e415b469b33ba328765e39fd62edcd28f30d9c3c    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:33:58 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 7 Jan 2015 22:33:58 -0500    

Click here for diff

vacuum()'s static variable handling makes it non-reentrant; an ensuing  
null pointer deference crashed the backend.  Back-patch to 9.0 (all  
supported versions).  

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

docs: Reword CREATE POLICY documentation.

commit   : 39f2594ba54657f3fa8d0fe230447e673bcba2a4    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 7 Jan 2015 14:49:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 7 Jan 2015 14:49:59 -0500    

Click here for diff

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

Don't open a WAL segment for writing at end of recovery.

commit   : 1e78d81e883d7987de8da559d985958335820cc8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Jan 2015 16:11:33 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Jan 2015 16:11:33 +0200    

Click here for diff

Since commit ba94518a, we used XLogFileOpen to open the next segment for  
writing, but if the end-of-recovery happens exactly at a segment boundary,  
the new segment might not exist yet. (Before ba94518a, XLogFileOpen was  
correct, because we would open the previous segment if the switch happened  
at the boundary.)  
  
Instead of trying to create it if necessary, it's simpler to not bother  
opening the segment at all. XLogWrite() will open or create it soon anyway,  
after writing the checkpoint or end-of-recovery record.  
  
Reported by Andres Freund.  

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

Fix namespace handling in xpath function

commit   : 79af9a1d2668c9edc8171f03c39e7fed571eeb98    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 6 Jan 2015 23:06:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 6 Jan 2015 23:06:13 -0500    

Click here for diff

Previously, the xml value resulting from an xpath query would not have  
namespace declarations if the namespace declarations were attached to  
an ancestor element in the input xml value.  That means the output value  
was not correct XML.  Fix that by running the result value through  
xmlCopyNode(), which produces the correct namespace declarations.  
  
Author: Ali Akbar <[email protected]>  

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

Correctly handle relcache invalidation corner case during logical decoding.

commit   : 3fabed070530271771c2345dd7f60b0b28f0aae3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Jan 2015 00:10:19 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Jan 2015 00:10:19 +0100    

Click here for diff

When using a historic snapshot for logical decoding it can validly  
happen that a relation that's in the relcache isn't visible to that  
historic snapshot.  E.g. if a newly created relation is referenced in  
the query that uses the SQL interface for logical decoding and a  
sinval reset occurs.  
  
The earlier commit that fixed the error handling for that corner case  
already improves the situation as a ERROR is better than hitting an  
assertion... But it's obviously not good enough.  So additionally  
allow that case without an error if a historic snapshot is set up -  
that won't allow an invalid entry to stay in the cache because it's a)  
already marked invalid and will thus be rebuilt during the next access  
b) the syscaches will be reset at the end of decoding.  
  
There might be prettier solutions to handle this case, but all that we  
could think of so far end up being much more complex than this quite  
simple fix.  
  
This fixes the assertion failures reported by the buildfarm (markhor,  
tick, leech) after the introduction of new regression tests in  
89fd41b390a4. The failure there weren't actually directly caused by  
CLOBBER_CACHE_ALWAYS but the extraordinary long runtimes due to it  
lead to sinval resets triggering the behaviour.  
  
Discussion: [email protected]  
  
Backpatch to 9.4 where logical decoding was introduced.  

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

Improve relcache invalidation handling of currently invisible relations.

commit   : 31912d01d8d860ffaafb386437d149e1749962ab    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Jan 2015 00:10:18 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Jan 2015 00:10:18 +0100    

Click here for diff

The corner case where a relcache invalidation tried to rebuild the  
entry for a referenced relation but couldn't find it in the catalog  
wasn't correct.  
  
The code tried to RelationCacheDelete/RelationDestroyRelation the  
entry. That didn't work when assertions are enabled because the latter  
contains an assertion ensuring the refcount is zero. It's also more  
generally a bad idea, because by virtue of being referenced somebody  
might actually look at the entry, which is possible if the error is  
trapped and handled via a subtransaction abort.  
  
Instead just error out, without deleting the entry. As the entry is  
marked invalid, the worst that can happen is that the invalid (and at  
some point unused) entry lingers in the relcache.  
  
Discussion: [email protected]  
  
There should be no way to hit this case < 9.4 where logical decoding  
introduced a bug that can hit this. But since the code for handling  
the corner case is there it should do something halfway sane, so  
backpatch all the the way back.  The logical decoding bug will be  
handled in a separate commit.  

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

Document that Perl's Tie might add a trailing newline

commit   : cb075178ec7f04545f43f455ae93e6c9ef6ef160    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 15:51:39 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 15:51:39 -0500    

Click here for diff

Report by Stefan Kaltenbrunner  

M src/tools/copyright.pl

Fix thinko in plpython error message

commit   : 91539c56986da740fd733765b06920cc73aaf33e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Jan 2015 15:16:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Jan 2015 15:16:29 -0300    

Click here for diff

M src/pl/plpython/plpy_exec.c

commit   : 29c18d919e3e45fcb0c40747636c3bc2c79253ae    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 12:53:15 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 12:53:15 -0500    

Click here for diff

M src/tools/copyright.pl

Simplify post-copyright update instructions.

commit   : 338c10b7f9157ac2fb6a785505f800f4fd919577    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 11:45:17 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 11:45:17 -0500    

Click here for diff

M src/tools/copyright.pl

commit   : 4baaf863eca5412e07a8441b3b7e7482b7a8b21a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 11:43:47 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 6 Jan 2015 11:43:47 -0500    

Click here for diff

Backpatch certain files through 9.0  

M COPYRIGHT
M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/auto_explain/auto_explain.c
M contrib/dblink/dblink.c
M contrib/dblink/dblink.h
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/controldata.c
M contrib/pg_upgrade/dump.c
M contrib/pg_upgrade/exec.c
M contrib/pg_upgrade/file.c
M contrib/pg_upgrade/function.c
M contrib/pg_upgrade/info.c
M contrib/pg_upgrade/option.c
M contrib/pg_upgrade/page.c
M contrib/pg_upgrade/parallel.c
M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_upgrade/pg_upgrade.h
M contrib/pg_upgrade/relfilenode.c
M contrib/pg_upgrade/server.c
M contrib/pg_upgrade/tablespace.c
M contrib/pg_upgrade/test.sh
M contrib/pg_upgrade/util.c
M contrib/pg_upgrade/version.c
M contrib/pg_upgrade_support/pg_upgrade_support.c
M contrib/pg_xlogdump/compat.c
M contrib/pg_xlogdump/pg_xlogdump.c
M contrib/pgbench/pgbench.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/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/tsearch2/tsearch2.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_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_xlog.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/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/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashscan.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/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/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/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/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execQual.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/lib/binaryheap.c
M src/backend/lib/ilist.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/lib/stringinfo.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ip.c
M src/backend/libpq/md5.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/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/prepsecurity.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/keywords.c
M src/backend/parser/kwlookup.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/port/atomics.c
M src/backend/port/dynloader/aix.h
M src/backend/port/dynloader/cygwin.h
M src/backend/port/dynloader/freebsd.c
M src/backend/port/dynloader/freebsd.h
M src/backend/port/dynloader/hpux.c
M src/backend/port/dynloader/hpux.h
M src/backend/port/dynloader/linux.c
M src/backend/port/dynloader/linux.h
M src/backend/port/dynloader/netbsd.c
M src/backend/port/dynloader/netbsd.h
M src/backend/port/dynloader/openbsd.c
M src/backend/port/dynloader/openbsd.h
M src/backend/port/dynloader/sco.h
M src/backend/port/dynloader/solaris.h
M src/backend/port/dynloader/unixware.h
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/unix_latch.c
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/mingwcompat.c
M src/backend/port/win32/security.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_latch.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/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/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/smgr/smgrtype.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/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/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_lzcompress.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/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_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/ucs2utf.pl
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.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/mcxt.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_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/keywords.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetxlog/Makefile
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/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/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/mbprint.c
M src/bin/psql/print.c
M src/bin/psql/print.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscan.h
M src/bin/psql/psqlscan.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createlang.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/droplang.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/exec.c
M src/common/fe_memutils.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/rmtree.c
M src/common/username.c
M src/common/wait_error.c
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/printtup.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupmacs.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_fn.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_collation_fn.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_conversion_fn.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_inherits_fn.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_proc_fn.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_type_fn.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/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/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/fe_memutils.h
M src/include/common/relpath.h
M src/include/common/username.h
M src/include/datatype/timestamp.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/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/lib/binaryheap.h
M src/include/lib/ilist.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/crypt.h
M src/include/libpq/ip.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/md5.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/relation.h
M src/include/nodes/replnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/keywords.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/basebackup.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/storage/backendid.h
M src/include/storage/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/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/lwlock.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/pos.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopdebug.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/array.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/dynahash.h
M src/include/utils/dynamic_loader.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/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/lockwaitpolicy.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/nabstime.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_crc_tables.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/rangetypes.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/ruleutils.h
M src/include/utils/selfuncs.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tqual.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/pg_type.h
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq.rc.in
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/fls.c
M src/port/fseeko.c
M src/port/getaddrinfo.c
M src/port/gethostname.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_crc.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pqsignal.c
M src/port/quotes.c
M src/port/random.c
M src/port/sprompt.c
M src/port/srandom.c
M src/port/strlcpy.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32setlocale.c
M src/port/win32ver.rc
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specs/nowait-2.spec
M src/test/isolation/specs/nowait-3.spec
M src/test/isolation/specs/skip-locked-4.spec
M src/test/isolation/specscanner.l
M src/test/modules/commit_ts/commit_ts.conf
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/test_parser/test_parser.c
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/thread/Makefile
M src/test/thread/thread_test.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/findoidjoins/Makefile
M src/tools/findoidjoins/findoidjoins.c
M src/tools/ifaddrs/Makefile
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Fix broken pg_dump code for dumping comments on event triggers.

commit   : adfc157dd91471e995f3aa72e0fb5b50ecd93575    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jan 2015 19:27:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jan 2015 19:27:04 -0500    

Click here for diff

This never worked, I think.  Per report from Marc Munro.  
  
In passing, fix funny spacing in the COMMENT ON command as a result of  
excess space in the "label" string.  

M src/bin/pg_dump/pg_dump.c

Fix oversight in recent pg_basebackup fix causing pg_receivexlog failures.

commit   : 3c9e4cdbf2ec876dbb71aa80a4cc18662fbd41c2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Jan 2015 12:22:50 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Jan 2015 12:22:50 +0100    

Click here for diff

A oversight in 2c0a485896 causes 'could not create archive status file  
"...": No such file or directory' errors in pg_receivexlog if the  
target directory doesn't happen to contain a archive_status  
directory. That's due to a stupidly left over 'true' constant instead  
of mark_done being passed down to ProcessXLogDataMsg().  
  
The bug is only present in the master branch, and luckily wasn't  
released.  
  
Spotted by Fujii Masao.  

M src/bin/pg_basebackup/receivelog.c

Fix typo in comment.

commit   : 9f1d7313aa8deb0529edbef4ac157561c37d4e2f    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 5 Jan 2015 16:35:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 5 Jan 2015 16:35:26 +0900    

Click here for diff

Report by Amit Kapila  

M src/backend/utils/error/elog.c

Fix thinko in lock mode enum

commit   : d5e3d1e969d2f65009f718d3100d6565f47f9112    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Jan 2015 15:48:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Jan 2015 15:48:29 -0300    

Click here for diff

Commit 0e5680f4737a9c6aa94aa9e77543e5de60411322 contained a thinko  
mixing LOCKMODE with LockTupleMode.  This caused misbehavior in the case  
where a tuple is marked with a multixact with at most a FOR SHARE lock,  
and another transaction tries to acquire a FOR NO KEY EXCLUSIVE lock;  
this case should block but doesn't.  
  
Include a new isolation tester spec file to explicitely try all the  
tuple lock combinations; without the fix it shows the problem:  
  
    starting permutation: s1_begin s1_lcksvpt s1_tuplock2 s2_tuplock3 s1_commit  
    step s1_begin: BEGIN;  
    step s1_lcksvpt: SELECT * FROM multixact_conflict FOR KEY SHARE; SAVEPOINT foo;  
    a  
  
    1  
    step s1_tuplock2: SELECT * FROM multixact_conflict FOR SHARE;  
    a  
  
    1  
    step s2_tuplock3: SELECT * FROM multixact_conflict FOR NO KEY UPDATE;  
    a  
  
    1  
    step s1_commit: COMMIT;  
  
With the fixed code, step s2_tuplock3 blocks until session 1 commits,  
which is the correct behavior.  
  
All other cases behave correctly.  
  
Backpatch to 9.3, like the commit that introduced the problem.  

M src/backend/access/heap/heapam.c
A src/test/isolation/expected/tuplelock-conflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/tuplelock-conflict.spec

Add error handling for failing fstat() calls in copy.c.

commit   : 2ea95959afa225118374ab1691a5ccf84ae05ce8    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 16:47:23 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 16:47:23 +0100    

Click here for diff

These calls are pretty much guaranteed not to fail unless something  
has gone horribly wrong, and even in that case we'd just error out a  
short time later.  But since several code checkers complain about the  
missing check it seems worthwile to fix it nonetheless.  
  
Pointed out by Coverity.  

M src/backend/commands/copy.c

Correctly handle test durations of more than 2147s in pg_test_timing.

commit   : 8cadeb792cd08478a73cb0941bb67f03e8465090    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:44:49 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:44:49 +0100    

Click here for diff

Previously the computation of the total test duration, measured in  
microseconds, accidentally overflowed due to accidentally using signed  
32bit arithmetic.  As the only consequence is that pg_test_timing  
invocations with such, overly large, durations never finished the  
practical consequences of this bug are minor.  
  
Pointed out by Coverity.  
  
Backpatch to 9.2 where pg_test_timing was added.  

M contrib/pg_test_timing/pg_test_timing.c

Fix off-by-one in pg_xlogdump's fuzzy_open_file().

commit   : d1c575230d49929f82c6d91e9b3070a9f4018718    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:35:46 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:35:46 +0100    

Click here for diff

In the unlikely case of stdin (fd 0) being closed, the off-by-one  
would lead to pg_xlogdump failing to open files.  
  
Spotted by Coverity.  
  
Backpatch to 9.3 where pg_xlogdump was introduced.  

M contrib/pg_xlogdump/pg_xlogdump.c

Remove superflous variable from xlogreader's XLogFindNextRecord().

commit   : 14570c28289f82030172c699ec877dd26d04940a    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:35:46 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:35:46 +0100    

Click here for diff

Pointed out by Coverity.  
  
Since this is mere, and debatable, cosmetics I'm not backpatching  
this.  

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

Add missing va_end() call to a early exit in dmetaphone.c's StringAt().

commit   : 58bc4747be26f6849ca38e67e24abdd6aecba3b1    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:35:46 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 15:35:46 +0100    

Click here for diff

Pointed out by Coverity.  
  
Backpatch to all supported branches, the code has been that way for a  
long while.  

M contrib/fuzzystrmatch/dmetaphone.c

Fix inconsequential fd leak in the new mark_file_as_archived() function.

commit   : 0398ece4c5baacc98f0fd46a731518b3ccb25bb3    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 14:36:21 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 4 Jan 2015 14:36:21 +0100    

Click here for diff

As every error in mark_file_as_archived() will lead to a failure of  
pg_basebackup the FD leak couldn't ever lead to a real problem.  It  
seems better to fix the leak anyway though, rather than silence  
Coverity, as the usage of the function might get extended or copied at  
some point in the future.  
  
Pointed out by Coverity.  
  
Backpatch to 9.2, like the relevant part of the previous patch.  

M src/bin/pg_basebackup/receivelog.c

Prevent WAL files created by pg_basebackup -x/X from being archived again.

commit   : 2c0a4858965f1375dadb45df9f3a054bfcb283f5    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Jan 2015 20:51:52 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Jan 2015 20:51:52 +0100    

Click here for diff

WAL (and timeline history) files created by pg_basebackup did not  
maintain the new base backup's archive status. That's currently not a  
problem if the new node is used as a standby - but if that node is  
promoted all still existing files can get archived again.  With a high  
wal_keep_segment settings that can happen a significant time later -  
which is quite confusing.  
  
Change both the backend (for the -x/-X fetch case) and pg_basebackup  
(for -X stream) itself to always mark WAL/timeline files included in  
the base backup as .done. That's in line with walreceiver.c doing so.  
  
The verbosity of the pg_basebackup changes show pretty clearly that it  
needs some refactoring, but that'd result in not be backpatchable  
changes.  
  
Backpatch to 9.1 where pg_basebackup was introduced.  
  
Discussion: [email protected]  

M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h

Add pg_string_endswith as the start of a string helper library in src/common.

commit   : ccb161b66addc9d0ede31359c05f7e9df61ab8d4    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Jan 2015 20:51:52 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Jan 2015 20:51:52 +0100    

Click here for diff

Backpatch to 9.3 where src/common was introduce, because a bugfix that  
needs to be backpatched, requires the function. Earlier branches will  
have to duplicate the code.  

M src/backend/replication/slot.c
M src/common/Makefile
A src/common/string.c
A src/include/common/string.h
M src/tools/msvc/Mkvcbuild.pm

Treat negative values of recovery_min_apply_delay as having no effect.

commit   : d6657d2a107bee20d63ec2f776d873242f9355e9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Jan 2015 13:14:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Jan 2015 13:14:03 -0500    

Click here for diff

At one point in the development of this feature, it was claimed that  
allowing negative values would be useful to compensate for timezone  
differences between master and slave servers.  That was based on a mistaken  
assumption that commit timestamps are recorded in local time; but of course  
they're in UTC.  Nor is a negative apply delay likely to be a sane way of  
coping with server clock skew.  However, the committed patch still treated  
negative delays as doing something, and the timezone misapprehension  
survived in the user documentation as well.  
  
If recovery_min_apply_delay were a proper GUC we'd just set the minimum  
allowed value to be zero; but for the moment it seems better to treat  
negative settings as if they were zero.  
  
In passing do some extra wordsmithing on the parameter's documentation,  
including correcting a second misstatement that the parameter affects  
processing of Restore Point records.  
  
Issue noted by Michael Paquier, who also provided the code patch; doc  
changes by me.  Back-patch to 9.4 where the feature was introduced.  

M doc/src/sgml/recovery-config.sgml
M src/backend/access/transam/xlog.c

Make path to pg_service.conf absolute in documentation

commit   : f9769c719f7811146e8aafbd0ff6c666b128ecce    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 3 Jan 2015 13:18:54 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 3 Jan 2015 13:18:54 +0100    

Click here for diff

The system file is always in the absolute path /etc/, not relative.  
  
David Fetter  

M doc/src/sgml/libpq.sgml

Don't run rowsecurity in parallel with other regression tests.

commit   : 7161b082bd9fc51e67a1031ea9d0313e8a48286b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 17:04:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 17:04:27 -0500    

Click here for diff

The short-lived event trigger in the rowsecurity test causes irreproducible  
failures when the concurrent tests do something that the event trigger  
can't cope with.  Per buildfarm.  

M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule

Docs: improve descriptions of ISO week-numbering date features.

commit   : 2f03ae69875ff27a9667a7ec4655434900b64e55    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 16:42:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 16:42:42 -0500    

Click here for diff

Use the phraseology "ISO 8601 week-numbering year" in place of just  
"ISO year", and make related adjustments to other terminology.  
  
The point of this change is that it seems some people see "ISO year"  
and think "standard year", whereupon they're surprised when constructs  
like to_char(..., "IYYY-MM-DD") produce nonsensical results.  Perhaps  
hanging a few more adjectives on it will discourage them from jumping  
to false conclusions.  I put in an explicit warning against that  
specific usage, too, though the main point is to discourage people  
who haven't read this far down the page.  
  
In passing fix some nearby markup and terminology inconsistencies.  

M doc/src/sgml/func.sgml

Print more information about getObjectIdentityParts() failures.

commit   : a486841eb11517e4a344fdebaf370f425a171c85    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 14:44:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 14:44:43 -0500    

Click here for diff

This might help us debug what's happening on some buildfarm members.  
  
In passing, reduce the message from ereport to elog --- it doesn't seem  
like this should be a user-facing case, so not worth translating.  

M src/backend/catalog/objectaddress.c

Improve consistency of parsing of psql's magic variables.

commit   : 28551797a46c0ada035c34cf9cf2bc90448e3c26    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 12:16:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Dec 2014 12:16:53 -0500    

Click here for diff

For simple boolean variables such as ON_ERROR_STOP, psql has for a long  
time recognized variant spellings of "on" and "off" (such as "1"/"0"),  
and it also made a point of warning you if you'd misspelled the setting.  
But these conveniences did not exist for other keyword-valued variables.  
In particular, though ECHO_HIDDEN and ON_ERROR_ROLLBACK include "on" and  
"off" as possible values, none of the alternative spellings for those were  
recognized; and to make matters worse the code would just silently assume  
"on" was meant for any unrecognized spelling.  Several people have reported  
getting bitten by this, so let's fix it.  In detail, this patch:  
  
* Allows all spellings recognized by ParseVariableBool() for ECHO_HIDDEN  
and ON_ERROR_ROLLBACK.  
  
* Reports a warning for unrecognized values for COMP_KEYWORD_CASE, ECHO,  
ECHO_HIDDEN, HISTCONTROL, ON_ERROR_ROLLBACK, and VERBOSITY.  
  
* Recognizes all values for all these variables case-insensitively;  
previously there was a mishmash of case-sensitive and case-insensitive  
behaviors.  
  
Back-patch to all supported branches.  There is a small risk of breaking  
existing scripts that were accidentally failing to malfunction; but the  
consensus is that the chance of detecting real problems and preventing  
future mistakes outweighs this.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h

Add missing pstrdup calls

commit   : ba66c9d0681f0c5ec834255fb4e7f6ef6b626747    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 31 Dec 2014 13:19:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 31 Dec 2014 13:19:40 -0300    

Click here for diff

The one for the OCLASS_COLLATION case was noticed by  
CLOBBER_CACHE_ALWAYS buildfarm members; the others I spotted by manual  
code inspection.  
  
Also remove a redundant check.  

M src/backend/catalog/objectaddress.c

Don't tab-complete COMMENT ON ... IS with IS.

commit   : c168c885776cd5d815611c10633ca04f699744e3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Dec 2014 11:06:43 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Dec 2014 11:06:43 -0500    

Click here for diff

Ian Barwick  

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

pg_event_trigger_dropped_objects: Add name/args output columns

commit   : 72dd233d3ef12da0f041bb3024deaa6d2950369c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 17:41:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 17:41:46 -0300    

Click here for diff

These columns can be passed to pg_get_object_address() and used to  
reconstruct the dropped objects identities in a remote server containing  
similar objects, so that the drop can be replicated.  
  
Reviewed by Stephen Frost, Heikki Linnakangas, Abhijit Menon-Sen, Andres  
Freund.  

M doc/src/sgml/func.sgml
M src/backend/commands/event_trigger.c
M src/include/catalog/pg_proc.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Add pg_identify_object_as_address

commit   : a676201490c8113b4692562126c77a29dfd8dac1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 15:41:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 15:41:50 -0300    

Click here for diff

This function returns object type and objname/objargs arrays, which can  
be passed to pg_get_object_address.  This is especially useful because  
the textual representation can be copied to a remote server in order to  
obtain the corresponding OID-based address.  In essence, this function  
is the inverse of recently added pg_get_object_address().  
  
Catalog version bumped due to the addition of the new function.  
  
Also add docs to pg_get_object_address.  

M doc/src/sgml/func.sgml
M src/backend/catalog/objectaddress.c
M src/backend/utils/adt/regproc.c
M src/include/catalog/catversion.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Fix object_address expected output

commit   : 5b447ad3a98aa6f059ba467eb10a832eb1544985    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 15:04:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 15:04:21 -0300    

Click here for diff

Per pink buildfarm  

M src/test/regress/expected/object_address.out

Use TypeName to represent type names in certain commands

commit   : 3f88672a4e4d8e648d24ccc65937da61c7660854    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 13:57:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Dec 2014 13:57:23 -0300    

Click here for diff

In COMMENT, DROP, SECURITY LABEL, and the new pg_get_object_address  
function, we were representing types as a list of names, same as other  
objects; but types are special objects that require their own  
representation to be totally accurate.  In the original COMMENT code we  
had a note about fixing it which was lost in the course of c10575ff005.  
Change all those places to use TypeName instead, as suggested by that  
comment.  
  
Right now the original coding doesn't cause any bugs, so no backpatch.  
It is more problematic for proposed future code that operate with object  
addresses from the SQL interface; type details such as array-ness are  
lost when working with the degraded representation.  
  
Thanks to Petr Jelínek and Dimitri Fontaine for offlist help on finding  
a solution to a shift/reduce grammar conflict.  

M src/backend/catalog/objectaddress.c
M src/backend/commands/dropcmds.c
M src/backend/parser/gram.y
M src/test/regress/sql/object_address.sql

Revert the GinMaxItemSize calculation so that we fit 3 tuples per page.

commit   : 930fd68455576dada48521a6cef642caddea3c63    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Dec 2014 14:29:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Dec 2014 14:29:20 +0200    

Click here for diff

Commit 36a35c55 changed the divisor from 3 to 6, for no apparent reason.  
Reducing GinMaxItemSize like that created a dump/reload hazard: loading a  
9.3 database to 9.4 might fail with "index row size XXX exceeds maximum 1352  
for index ..." error. Revert the change.  
  
While we're at it, make the calculation slightly more accurate. It used to  
divide the available space on page by three, then subtract  
sizeof(ItemIdData), and finally round down. That's not totally accurate; the  
item pointers for the three items are packed tight right after the page  
header, but there is alignment padding after the item pointers. Change the  
calculation to reflect that, like BTMaxItemSize does. I tested this with  
different block sizes on systems with 4- and 8-byte alignment, and the value  
after the final MAXALIGN_DOWN was the same with both methods on all  
configurations. So this does not make any difference currently, but let's be  
tidy.  
  
Also add a comment explaining what the macro does.  
  
This fixes bug #12292 reported by Robert Thaler. Backpatch to 9.4, where the  
bug was introduced.  

M src/include/access/gin_private.h

Fix resource leak pointed out by Coverity.

commit   : 3b5a89c4820fb11c337838c1ad71e8e93f2937d1    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 30 Dec 2014 20:19:50 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 30 Dec 2014 20:19:50 +0900    

Click here for diff

M contrib/pgbench/pgbench.c

Assorted minor fixes for psql metacommand docs.

commit   : ae17897ce84e545fd5a042530055df728b2ca98f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Dec 2014 14:20:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Dec 2014 14:20:54 -0500    

Click here for diff

Document the long forms of \H \i \ir \o \p \r \w ... apparently, we have  
a long and dishonorable history of leaving out the unabbreviated names of  
psql backslash commands.  
  
Avoid saying "Unix shell"; we can just say "shell" with equal clarity,  
and not leave Windows users wondering whether the feature works for them.  
  
Improve consistency of documentation of \g \o \w metacommands.  There's  
no reason to use slightly different wording or markup for each one.  

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

Remove duplicate assignment in new pg_get_object_address() function.

commit   : 9a11df14498434bbb5e16dfa7aecbf71bf24d196    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Dec 2014 12:03:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Dec 2014 12:03:32 -0500    

Click here for diff

Noted by Coverity.  

M src/backend/catalog/objectaddress.c

Restrict name list len for domain constraints

commit   : 6630420fc9139c3a1ee051bc2f2ae8fa32e71c62    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Dec 2014 14:31:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Dec 2014 14:31:37 -0300    

Click here for diff

This avoids an ugly-looking "cache lookup failure" message.  
  
Ugliness pointed out by Andres Freund.  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out

Remove event trigger from object_address test

commit   : 289121a452e3c255e4fd63dbb0252261605c2eaf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Dec 2014 14:18:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Dec 2014 14:18:09 -0300    

Click here for diff

It is causing trouble when run in parallel mode, because dropping the  
function other sessions are running concurrently causes them to fail due  
to inability to find the function.  
  
Per buildfarm, as noted by Tom Lane.  

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

Grab heavyweight tuple lock only before sleeping

commit   : 0e5680f4737a9c6aa94aa9e77543e5de60411322    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Dec 2014 13:52:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Dec 2014 13:52:27 -0300    

Click here for diff

We were trying to acquire the lock even when we were subsequently  
not sleeping in some other transaction, which opens us up unnecessarily  
to deadlocks.  In particular, this is troublesome if an update tries to  
lock an updated version of a tuple and finds itself doing EvalPlanQual  
update chain walking; more than two sessions doing this concurrently  
will find themselves sleeping on each other because the HW tuple lock  
acquisition in heap_lock_tuple called from EvalPlanQualFetch races with  
the same tuple lock being acquired in heap_update -- one of these  
sessions sleeps on the other one to finish while holding the tuple lock,  
and the other one sleeps on the tuple lock.  
  
Per trouble report from Andrew Sackville-West in  
http://www.postgresql.org/message-id/20140731233051.GN17765@andrew-ThinkPad-X230  
  
His scenario can be simplified down to a relatively simple  
isolationtester spec file which I don't include in this commit; the  
reason is that the current isolationtester is not able to deal with more  
than one blocked session concurrently and it blocks instead of raising  
the expected deadlock.  In the future, if we improve isolationtester, it  
would be good to include the spec file in the isolation schedule.  I  
posted it in  
http://www.postgresql.org/message-id/[email protected]  
  
Hat tip to Mark Kirkwood, who helped diagnose the trouble.  

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

Have config_sspi_auth() permit IPv6 localhost connections.

commit   : 8d9cb0bc483431780aef483c7c110ab39e465958    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 25 Dec 2014 13:52:03 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 25 Dec 2014 13:52:03 -0500    

Click here for diff

Windows versions later than Windows Server 2003 map "localhost" to ::1.  
Account for that in the generated pg_hba.conf, fixing another oversight  
in commit f6dc6dd5ba54d52c0733aaafc50da2fbaeabb8b0.  Back-patch to 9.0,  
like that commit.  
  
David Rowley and Noah Misch  

M src/test/regress/pg_regress.c
M src/tools/msvc/Mkvcbuild.pm

Blindly fix a dtrace probe in lwlock.c for a removed local variable.

commit   : 740a4ec7f4adccd56eced452580ccec7157fc8d8    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 19:48:46 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 19:48:46 +0100    

Click here for diff

Per buildfarm member locust.  

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

Temporarily revert "Move pg_lzcompress.c to src/common."

commit   : 966115c305c297cf4a1ec5ebbd0a55be46ff33ad    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Dec 2014 13:22:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Dec 2014 13:22:55 -0500    

Click here for diff

This reverts commit 60838df922345b26a616e49ac9fab808a35d1f85.  
That change needs a bit more thought to be workable.  In view of  
the potentially machine-dependent stuff that went in today,  
we need all of the buildfarm to be testing those other changes.  

M src/backend/access/heap/tuptoaster.c
M src/backend/utils/adt/Makefile
R097 src/common/pg_lzcompress.c src/backend/utils/adt/pg_lzcompress.c
M src/common/Makefile
R096 src/include/common/pg_lzcompress.h src/include/utils/pg_lzcompress.h
M src/tools/msvc/Mkvcbuild.pm

Lockless StrategyGetBuffer clock sweep hot path.

commit   : d72731a70450b5e7084991b9caa15cb58a2820df    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 18:24:20 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 18:24:20 +0100    

Click here for diff

StrategyGetBuffer() has proven to be a bottleneck in a number of  
buffer acquisition heavy workloads. To some degree this has already  
been alleviated by 5d7962c6, but it still can be quite a heavy  
bottleneck.  The problem is that in unfortunate usage patterns a  
single StrategyGetBuffer() call will have to look at a large number of  
buffers - in turn making it likely that the process will be put to  
sleep while still holding the spinlock.  
  
Replace most of the usage of the buffer_strategy_lock spinlock for the  
clock sweep by a atomic nextVictimBuffer variable. That variable,  
modulo NBuffers, is the current hand of the clock sweep. The buffer  
clock-sweep then only needs to acquire the spinlock after a  
wraparound. And even then only in the process that did the wrapping  
around. That alleviates nearly all the contention on the relevant  
spinlock, although significant contention on the cacheline can still  
exist.  
  
Reviewed-By: Robert Haas and Amit Kapila  
  
Discussion: [email protected],  
    [email protected]  

M src/backend/postmaster/bgwriter.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h

Improve LWLock scalability.

commit   : ab5194e6f617a9a9e7aadb3dd1cee948a42d0755    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 17:24:30 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 17:24:30 +0100    

Click here for diff

The old LWLock implementation had the problem that concurrent lock  
acquisitions required exclusively acquiring a spinlock. Often that  
could lead to acquirers waiting behind the spinlock, even if the  
actual LWLock was free.  
  
The new implementation doesn't acquire the spinlock when acquiring the  
lock itself. Instead the new atomic operations are used to atomically  
manipulate the state. Only the waitqueue, used solely in the slow  
path, is still protected by the spinlock. Check lwlock.c's header for  
an explanation about the used algorithm.  
  
For some common workloads on larger machines this can yield  
significant performance improvements. Particularly in read mostly  
workloads.  
  
Reviewed-By: Amit Kapila and Robert Haas  
Author: Andres Freund  
  
Discussion: [email protected]  

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

commit   : 7882c3b0b95640e361f1533fe0f2d02e4e5d8610    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 17:24:30 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 17:24:30 +0100    

Click here for diff

Besides being shorter and much easier to read it changes the logic in  
LWLockRelease() to release all shared lockers when waking up any. This  
can yield some significant performance improvements - and the fairness  
isn't really much worse than before, as we always allowed new shared  
lockers to jump the queue.  

M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lwlock.h
M src/include/storage/proc.h

Add capability to suppress CONTEXT: messages to elog machinery.

commit   : 570bd2b3fd20d3f8896f5e6a8133d6aed385ac86    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 17:24:30 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Dec 2014 17:24:30 +0100    

Click here for diff

Hiding context messages usually is not a good idea - except for rather  
verbose debugging/development utensils like LOG_DEBUG. There the  
amount of repeated context messages just bloat the log without adding  
information.  

M src/backend/utils/error/elog.c
M src/include/utils/elog.h

Remove duplicate include of slot.h.

commit   : 4a5593197b0ddec913fcd7758d61e782ab5c4d59    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Dec 2014 22:47:53 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Dec 2014 22:47:53 +0900    

Click here for diff

Back-patch to 9.4, where this problem was added.  

M src/backend/replication/walsender.c

Move pg_lzcompress.c to src/common.

commit   : 60838df922345b26a616e49ac9fab808a35d1f85    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Dec 2014 20:46:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Dec 2014 20:46:14 +0900    

Click here for diff

Exposing compression and decompression APIs of pglz makes possible its  
use by extensions and contrib modules. pglz_decompress contained a call  
to elog to emit an error message in case of corrupted data. This function  
is changed to return a status code to let its callers return an error instead.  
  
This commit is required for upcoming WAL compression feature so that  
the WAL reader facility can decompress the WAL data by using pglz_decompress.  
  
Michael Paquier  

M src/backend/access/heap/tuptoaster.c
M src/backend/utils/adt/Makefile
M src/common/Makefile
R097 src/backend/utils/adt/pg_lzcompress.c src/common/pg_lzcompress.c
R096 src/include/utils/pg_lzcompress.h src/include/common/pg_lzcompress.h
M src/tools/msvc/Mkvcbuild.pm

Add CST (China Standard Time) to our lists of timezone abbreviations.

commit   : 5b89473d870dc2a9fec0926c5afccf53042dbb0a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Dec 2014 16:35:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Dec 2014 16:35:23 -0500    

Click here for diff

For some reason this seems to have been missed when the lists in  
src/timezone/tznames/ were first constructed.  We can't put it in Default  
because of the conflict with US CST, but we should certainly list it among  
the alternative entries in Asia.txt.  (I checked for other oversights, but  
all the other abbreviations that are in current use according to the IANA  
files seem to be accounted for.)  Noted while responding to bug #12326.  

M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Australia.txt
M src/timezone/tznames/Default

Fix installcheck case for tap tests

commit   : 3f37b6c3166b2dc1956de8b0fb046ea6e7320d52    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Dec 2014 10:31:36 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Dec 2014 10:31:36 -0500    

Click here for diff

M src/Makefile.global.in

pgbench: remove odd trailing period in init progress output

commit   : 83bcc70459c596ceb9a90e96f011d24b88d93a85    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 24 Dec 2014 09:20:29 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 24 Dec 2014 09:20:29 -0500    

Click here for diff

M contrib/pgbench/pgbench.c

Remove unused fields from ReindexStmt.

commit   : 3b6ca123b5665044557154385a6be5d1df76c5e5    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 24 Dec 2014 21:40:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 24 Dec 2014 21:40:47 +0900    

Click here for diff

fe263d1 changed the REINDEX logic so that those fields are not used at all,  
but forgot to remove them.  
  
Sawada Masahiko  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/include/nodes/parsenodes.h

Suppress MSVC warning in typeStringToTypeName function.

commit   : cd5ebe1edd6d9c19caba406a90f626afec5d3f0a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Dec 2014 12:30:08 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Dec 2014 12:30:08 +0100    

Click here for diff

MSVC doesn't realize ereport(ERROR) doesn't return.  
  
David Rowley  

M src/backend/parser/parse_type.c

Remove failing collation case from object_address regression test.

commit   : 3e2275355954cabf89ba044fe8557ef347bf3fb1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Dec 2014 16:55:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Dec 2014 16:55:51 -0500    

Click here for diff

Per buildfarm, this test case does not yield consistent results.  
I don't think it's useful enough to figure out a workaround, either.  

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

Revert "Use a bitmask to represent role attributes"

commit   : a609d96778c1714b9af916477b2c30891fbe578a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 15:35:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 15:35:49 -0300    

Click here for diff

This reverts commit 1826987a46d079458007b7b6bbcbbd852353adbb.  
  
The overall design was deemed unacceptable, in discussion following the  
previous commit message; we might find some parts of it still  
salvageable, but I don't want to be on the hook for fixing it, so let's  
wait until we have a new patch.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/catalog/system_views.sql
M src/backend/commands/dbcommands.c
M src/backend/commands/user.c
M src/backend/commands/variable.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/superuser.c
M src/bin/pg_dump/pg_dumpall.c
D src/include/catalog/acldefs.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_proc.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
M src/include/utils/builtins.h
M src/test/regress/expected/rules.out

Add SQL-callable pg_get_object_address

commit   : d7ee82e50f624221db76023c17137661fe69ec61    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 15:31:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 15:31:29 -0300    

Click here for diff

This allows access to get_object_address from SQL, which is useful to  
obtain OID addressing information from data equivalent to that emitted  
by the parser.  This is necessary infrastructure of a project to let  
replication systems propagate object dropping events to remote servers,  
where the schema might be different than the server originating the  
DROP.  
  
This patch also adds support for OBJECT_DEFAULT to get_object_address;  
that is, it is now possible to refer to a column's default value.  
  
Catalog version bumped due to the new function.  
  
Reviewed by Stephen Frost, Heikki Linnakangas, Robert Haas, Andres  
Freund, Abhijit Menon-Sen, Adam Brightwell.  

M src/backend/catalog/objectaddress.c
M src/backend/commands/event_trigger.c
M src/backend/parser/parse_type.c
M src/include/catalog/catversion.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_proc.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_type.h
M src/include/utils/builtins.h
A src/test/regress/expected/object_address.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/object_address.sql

Use a bitmask to represent role attributes

commit   : 1826987a46d079458007b7b6bbcbbd852353adbb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 10:22:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 10:22:09 -0300    

Click here for diff

The previous representation using a boolean column for each attribute  
would not scale as well as we want to add further attributes.  
  
Extra auxilliary functions are added to go along with this change, to  
make up for the lost convenience of access of the old representation.  
  
Catalog version bumped due to change in catalogs and the new functions.  
  
Author: Adam Brightwell, minor tweaks by Álvaro  
Reviewed by: Stephen Frost, Andres Freund, Álvaro Herrera  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/catalog/system_views.sql
M src/backend/commands/dbcommands.c
M src/backend/commands/user.c
M src/backend/commands/variable.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/superuser.c
M src/bin/pg_dump/pg_dumpall.c
A src/include/catalog/acldefs.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_proc.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
M src/include/utils/builtins.h
M src/test/regress/expected/rules.out

get_object_address: separate domain constraints from table constraints

commit   : 7eca575d1c28f6eee2bf4564f3d458d10c4a8f47    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 09:06:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Dec 2014 09:06:44 -0300    

Click here for diff

Apart from enabling comments on domain constraints, this enables a  
future project to replicate object dropping to remote servers: with the  
current mechanism there's no way to distinguish between the two types of  
constraints, so there's no way to know what to drop.  
  
Also added support for the domain constraint comments in psql's \dd and  
pg_dump.  
  
Catalog version bumped due to the change in ObjectType enum.  

M doc/src/sgml/ref/comment.sgml
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/include/nodes/parsenodes.h
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source

Change local_preload_libraries to PGC_USERSET

commit   : 584e35d17c00b69d598522d3cf321fbd9b7dbd03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Dec 2014 23:05:46 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Dec 2014 23:05:46 -0500    

Click here for diff

This allows it to be used with ALTER ROLE SET.  
  
Although the old setting of PGC_BACKEND prevented changes after session  
start, after discussion it was more useful to allow ALTER ROLE SET  
instead and just document that changes during a session have no effect.  
This is similar to how session_preload_libraries works already.  
  
An alternative would be to change things to allow PGC_BACKEND and  
PGC_SU_BACKEND settings to be changed by ALTER ROLE SET.  But that might  
need further research (e.g., log_connections would probably not work).  
  
based on patch by Kyotaro Horiguchi  

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

Further tidy up on json aggregate documentation

commit   : 2a3f2743f200dbcdd412a00ff69f30d3e34b662b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 22 Dec 2014 18:30:46 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 22 Dec 2014 18:30:46 -0500    

Click here for diff

M doc/src/sgml/func.sgml

Fix documentation of argument type of json_agg and jsonb_agg

commit   : b2d145bff02e5f278649aca0e6fb6142ea2f298d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 22 Dec 2014 14:12:06 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 22 Dec 2014 14:12:06 -0500    

Click here for diff

json_agg was originally designed to aggregate records. However, it soon  
became clear that it is useful for aggregating all kinds of values and  
that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.  
The documentation suggested otherwise, so this fixes it.  

M doc/src/sgml/func.sgml

Move rbtree.c from src/backend/utils/misc to src/backend/lib.

commit   : 955557ddccb4065831af80b0966cbd02937dfb72    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Dec 2014 17:52:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Dec 2014 17:52:08 +0200    

Click here for diff

We have other general-purpose data structures in src/backend/lib, so it  
seems like a better home for the red-black tree as well.  

M src/backend/lib/Makefile
M src/backend/lib/README
R099 src/backend/utils/misc/rbtree.c src/backend/lib/rbtree.c
M src/backend/utils/misc/Makefile
M src/include/access/gin_private.h
R098 src/include/utils/rbtree.h src/include/lib/rbtree.h

Turn much of the btree_gin macros into real functions.

commit   : 7f0dccaed64a8ed6f5db8ad43e7612202fbeeeaf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Dec 2014 17:11:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Dec 2014 17:11:53 +0200    

Click here for diff

This makes the functions much nicer to read and edit, and also makes  
debugging easier.  

M contrib/btree_gin/btree_gin.c

Use a pairing heap for the priority queue in kNN-GiST searches.

commit   : e7032610f76e6c8345496ae7bbdf49d3c40df30f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Dec 2014 12:05:57 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Dec 2014 12:05:57 +0200    

Click here for diff

This performs slightly better, uses less memory, and needs slightly less  
code in GiST, than the Red-Black tree previously used.  
  
Reviewed by Peter Geoghegan  

M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/lib/Makefile
A src/backend/lib/README
A src/backend/lib/pairingheap.c
M src/include/access/gist_private.h
A src/include/lib/pairingheap.h

Docs: clarify treatment of variadic functions with zero variadic arguments.

commit   : 699300a146c04e207a8fdec407538cdf5368fde5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Dec 2014 15:30:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Dec 2014 15:30:39 -0500    

Click here for diff

Explain that you have to use "VARIADIC ARRAY[]" to pass an empty array  
to a variadic parameter position.  This was already implicit in the text  
but it seems better to spell it out.  
  
Per a suggestion from David Johnston, though I didn't use his proposed  
wording.  Back-patch to all supported branches.  

M doc/src/sgml/xfunc.sgml

Fix file descriptor leak at end of recovery.

commit   : 2ef6c66a2b1ed288a5e4448989d4b85082d22736    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 21 Dec 2014 21:49:03 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 21 Dec 2014 21:49:03 +0200    

Click here for diff

XLogFileInit() returns a file descriptor, which needs to be closed. The leak  
was short-lived, since the startup process exits shortly afterwards, but it  
was clearly a bug, nevertheless.  
  
Per Coverity report.  

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

doc: Adjust wording of ALTER TABLESPACE restriction

commit   : cfb64fde7bb93fb44ebcb1f1924faec5b5705af7    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 19 Dec 2014 20:56:03 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 19 Dec 2014 20:56:03 -0500    

Click here for diff

Report by Noah Misch  

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

pg_event_trigger_dropped_objects: add behavior flags

commit   : 0ee98d1cbf1cd3b888633b2ee90e0001889c12b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Dec 2014 15:00:45 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Dec 2014 15:00:45 -0300    

Click here for diff

Add "normal" and "original" flags as output columns to the  
pg_event_trigger_dropped_objects() function.  With this it's possible to  
distinguish which objects, among those listed, need to be explicitely  
referenced when trying to replicate a deletion.  
  
This is necessary so that the list of objects can be pruned to the  
minimum necessary to replicate the DROP command in a remote server that  
might have slightly different schema (for instance, TOAST tables and  
constraints with different names and such.)  
  
Catalog version bumped due to change of function definition.  
  
Reviewed by: Abhijit Menon-Sen, Stephen Frost, Heikki Linnakangas,  
Robert Haas.  

M doc/src/sgml/func.sgml
M src/backend/catalog/dependency.c
M src/backend/commands/event_trigger.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/commands/event_trigger.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Fix timestamp in end-of-recovery WAL records.

commit   : 5c805d0a813e6c611485bfc9bde9d2a10d1800e5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 19 Dec 2014 17:00:21 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 19 Dec 2014 17:00:21 +0200    

Click here for diff

We used time(null) to set a TimestampTz field, which gave bogus results.  
Noticed while looking at pg_xlogdump output.  
  
Backpatch to 9.3 and above, where the fast promotion was introduced.  

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

Prevent potentially hazardous compiler/cpu reordering during lwlock release.

commit   : 37de8de9e33606a043e98fee64b5595aedaa8254    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Dec 2014 14:29:52 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Dec 2014 14:29:52 +0100    

Click here for diff

In LWLockRelease() (and in 9.4+ LWLockUpdateVar()) we release enqueued  
waiters using PGSemaphoreUnlock(). As there are other sources of such  
unlocks backends only wake up if MyProc->lwWaiting is set to false;  
which is only done in the aforementioned functions.  
  
Before this commit there were dangers because the store to lwWaitLink  
could become visible before the store to lwWaitLink. This could both  
happen due to compiler reordering (on most compilers) and on some  
platforms due to the CPU reordering stores.  
  
The possible consequence of this is that a backend stops waiting  
before lwWaitLink is set to NULL. If that backend then tries to  
acquire another lock and has to wait there the list could become  
corrupted once the lwWaitLink store is finally performed.  
  
Add a write memory barrier to prevent that issue.  
  
Unfortunately the barrier support has been only added in 9.2. Given  
that the issue has not knowingly been observed in praxis it seems  
sufficient to prohibit compiler reordering using volatile for 9.0 and  
9.1. Actual problems due to compiler reordering are more likely  
anyway.  
  
Discussion: [email protected]  

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

Define Assert() et al to ((void)0) to avoid pedantic warnings.

commit   : 9959abb0122ca2b0e4817e20954e3083c90becdc    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Dec 2014 20:28:09 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Dec 2014 20:28:09 +0100    

Click here for diff

gcc's -Wempty-body warns about the current usage when compiling  
postgres without --enable-cassert.  

M src/include/c.h

Improve documentation about CASE and constant subexpressions.

commit   : 5b516835897f2a487eedacdb605ac40d52f6b484    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Dec 2014 16:38:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Dec 2014 16:38:52 -0500    

Click here for diff

The possibility that constant subexpressions of a CASE might be evaluated  
at planning time was touched on in 9.17.1 (CASE expressions), but it really  
ought to be explained in 4.2.14 (Expression Evaluation Rules) which is the  
primary discussion of such topics.  Add text and an example there, and  
revise the <note> under CASE to link there.  
  
Back-patch to all supported branches, since it's acted like this for a  
long time (though 9.2+ is probably worse because of its more aggressive  
use of constant-folding via replanning of nominally-prepared statements).  
Pre-9.4, also back-patch text added in commit 0ce627d4 about CASE versus  
aggregate functions.  
  
Tom Lane and David Johnston, per discussion of bug #12273.  

M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml

Use %u to print out BlockNumber variables

commit   : cd6e66572b7b5f6bae2b8c8bd62e4862b0a2cf9d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 18 Dec 2014 17:59:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 18 Dec 2014 17:59:00 -0300    

Click here for diff

Per Tom Lane  

M src/backend/commands/vacuumlazy.c

Have VACUUM log number of skipped pages due to pins

commit   : 35192f0626ccc1729eb6220a5fa04699fd62e04e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 18 Dec 2014 17:18:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 18 Dec 2014 17:18:33 -0300    

Click here for diff

Author: Jim Nasby, some kibitzing by Heikki Linnankangas.  
Discussion leading to current behavior and precise wording fueled by  
thoughts from Robert Haas and Andres Freund.  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuumlazy.c

Improve hash_create's API for selecting simple-binary-key hash functions.

commit   : 4a14f13a0abfbf7e7d44a3d2689444d1806aa9dc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Dec 2014 13:36:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Dec 2014 13:36:29 -0500    

Click here for diff

Previously, if you wanted anything besides C-string hash keys, you had to  
specify a custom hashing function to hash_create().  Nearly all such  
callers were specifying tag_hash or oid_hash; which is tedious, and rather  
error-prone, since a caller could easily miss the opportunity to optimize  
by using hash_uint32 when appropriate.  Replace this with a design whereby  
callers using simple binary-data keys just specify HASH_BLOBS and don't  
need to mess with specific support functions.  hash_create() itself will  
take care of optimizing when the key size is four bytes.  
  
This nets out saving a few hundred bytes of code space, and offers  
a measurable performance improvement in tidbitmap.c (which was not  
exploiting the opportunity to use hash_uint32 for its 4-byte keys).  
There might be some wins elsewhere too, I didn't analyze closely.  
  
In future we could look into offering a similar optimized hashing function  
for 8-byte keys.  Under this design that could be done in a centralized  
and machine-independent fashion, whereas getting it right for keys of  
platform-dependent sizes would've been notationally painful before.  
  
For the moment, the old way still works fine, so as not to break source  
code compatibility for loadable modules.  Eventually we might want to  
remove tag_hash and friends from the exported API altogether, since there's  
no real need for them to be explicitly referenced from outside dynahash.c.  
  
Teodor Sigaev and Tom Lane  

M contrib/pg_trgm/trgm_regexp.c
M contrib/postgres_fdw/connection.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/sequence.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/util/predtest.c
M src/backend/parser/parse_oper.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/attoptcache.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/spccache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/time/combocid.c
M src/include/utils/hsearch.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_procedure.c
M src/pl/tcl/pltcl.c

Change how first WAL segment on new timeline after promotion is created.

commit   : ba94518aad23beb800b657bd0cc8c4e7ea43ca33    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 18 Dec 2014 19:38:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 18 Dec 2014 19:38:53 +0200    

Click here for diff

Two changes:  
  
1. When copying a WAL segment from old timeline to create the first segment  
on the new timeline, only copy up to the point where the timeline switch  
happens, and zero-fill the rest. This avoids corner cases where we might  
think that the copied WAL from the previous timeline belong to the new  
timeline.  
  
2. If the timeline switch happens at a segment boundary, don't copy the  
whole old segment to the new timeline. It's pointless, because it's 100%  
identical to the old segment.  

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

Add memory barriers for PgBackendStatus.st_changecount protocol.

commit   : 38628db8d8caff21eb6cf8d775c0b2d04cf07b9b    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 23:07:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 23:07:51 +0900    

Click here for diff

st_changecount protocol needs the memory barriers to ensure that  
the apparent order of execution is as it desires. Otherwise,  
for example, the CPU might rearrange the code so that st_changecount  
is incremented twice before the modification on a machine with  
weak memory ordering. This surprising result can lead to bugs.  
  
This commit introduces the macros to load and store st_changecount  
with the memory barriers. These are called before and after  
PgBackendStatus entries are modified or copied into private memory,  
in order to prevent CPU from reordering PgBackendStatus access.  
  
Per discussion on pgsql-hackers, we decided not to back-patch this  
to 9.4 or before until we get an actual bug report about this.  
  
Patch by me. Review by Robert Haas.  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Ensure variables live across calls in generate_series(numeric, numeric).

commit   : 19e065c0492c34fbccbd2c3707ba68cff14195a3    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 21:13:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 21:13:52 +0900    

Click here for diff

In generate_series_step_numeric(), the variables "start_num"  
and "stop_num" may be potentially freed until the next call.  
So they should be put in the location which can survive across calls.  
But previously they were not, and which could cause incorrect  
behavior of generate_series(numeric, numeric). This commit fixes  
this problem by copying them on multi_call_memory_ctx.  
  
Andrew Gierth  

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

Update .gitignore for config.cache.

commit   : ccf292cd2ec16c69ddfee3bf72afe113a7595e00    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 19:56:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 19:56:42 +0900    

Click here for diff

Also add a comment about why regreesion.* aren't listed in .gitignore.  
  
Jim Nasby  

M .gitignore
M src/test/regress/.gitignore

Adjust valgrind suppression to the changes in 2c03216d8311.

commit   : 72950dc1d02c6b44c6475485fd5ef8ac277bbdd0    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 18 Dec 2014 10:31:59 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 18 Dec 2014 10:31:59 +0100    

Click here for diff

CRC computation is now done in XLogRecordAssemble.  

M src/tools/valgrind.supp

Recognize Makefile line continuations in fetchRegressOpts().

commit   : 43b56171b1fbcba8a6309de755545e3c63ac25dd    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 18 Dec 2014 03:55:17 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 18 Dec 2014 03:55:17 -0500    

Click here for diff

Back-patch to 9.0 (all supported versions).  This is mere  
future-proofing in the context of the master branch, but commit  
f6dc6dd5ba54d52c0733aaafc50da2fbaeabb8b0 requires it of older branches.  

M src/tools/msvc/vcregress.pl

Remove odd blank line in comment.

commit   : 26674c923d0ecbac2cda039433163d17584fae65    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 17:33:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 18 Dec 2014 17:33:38 +0900    

Click here for diff

Etsuro Fujita  

M src/backend/commands/explain.c

Fix (re-)starting from a basebackup taken off a standby after a failure.

commit   : c303e9e7e5d4ddf04526ed8e821ef4b1c3bc2d12    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 18 Dec 2014 08:35:27 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 18 Dec 2014 08:35:27 +0100    

Click here for diff

When starting up from a basebackup taken off a standby extra logic has  
to be applied to compute the point where the data directory is  
consistent. Normal base backups use a WAL record for that purpose, but  
that isn't possible on a standby.  
  
That logic had a error check ensuring that the cluster's control file  
indicates being in recovery. Unfortunately that check was too strict,  
disregarding the fact that the control file could also indicate that  
the cluster was shut down while in recovery.  
  
That's possible when the a cluster starting from a basebackup is shut  
down before the backup label has been removed. When everything goes  
well that's a short window, but when either restore_command or  
primary_conninfo isn't configured correctly the window can get much  
wider. That's because inbetween reading and unlinking the label we  
restore the last checkpoint from WAL which can need additional WAL.  
  
To fix simply also allow starting when the control file indicates  
"shutdown in recovery". There's nicer fixes imaginable, but they'd be  
more invasive.  
  
Backpatch to 9.2 where support for taking basebackups from standbys  
was added.  

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

Fix previous commit for TAP test suites in VPATH builds.

commit   : 40c598fa15bef1ea10850aad80914ab797808106    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 18 Dec 2014 01:24:57 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 18 Dec 2014 01:24:57 -0500    

Click here for diff

Per buildfarm member crake.  Back-patch to 9.4, where the TAP suites  
were introduced.  

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

Lock down regression testing temporary clusters on Windows.

commit   : f6dc6dd5ba54d52c0733aaafc50da2fbaeabb8b0    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 17 Dec 2014 22:48:40 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 17 Dec 2014 22:48:40 -0500    

Click here for diff

Use SSPI authentication to allow connections exclusively from the OS  
user that launched the test suite.  This closes on Windows the  
vulnerability that commit be76a6d39e2832d4b88c0e1cc381aa44a7f86881  
closed on other platforms.  Users of "make installcheck" or custom test  
harnesses can run "pg_regress --config-auth=DATADIR" to activate the  
same authentication configuration that "make check" would use.  
Back-patch to 9.0 (all supported versions).  
  
Security: CVE-2014-0067  

M contrib/pg_upgrade/test.sh
M doc/src/sgml/regress.sgml
M src/Makefile.global.in
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/test/perl/TestLib.pm
M src/test/regress/pg_regress.c
M src/tools/msvc/vcregress.pl

Allow CHECK constraints to be placed on foreign tables.

commit   : fc2ac1fb41c2defb8caf825781af75db158fb7a9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Dec 2014 17:00:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Dec 2014 17:00:53 -0500    

Click here for diff

As with NOT NULL constraints, we consider that such constraints are merely  
reports of constraints that are being enforced by the remote server (or  
other underlying storage mechanism).  Their only real use is to allow  
planner optimizations, for example in constraint-exclusion checks.  Thus,  
the code changes here amount to little more than removal of the error that  
was formerly thrown for applying CHECK to a foreign table.  
  
(In passing, do a bit of cleanup of the ALTER FOREIGN TABLE reference page,  
which had accumulated some weird decisions about ordering etc.)  
  
Shigeru Hanada and Etsuro Fujita, reviewed by Kyotaro Horiguchi and  
Ashutosh Bapat.  

M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Clarify the regexp used to detect source files in MSVC builds.

commit   : ce01548d4fdbc06dce59f90a3e4598162b1e8ea1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 17 Dec 2014 21:55:26 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 17 Dec 2014 21:55:26 +0200    

Click here for diff

The old pattern would match files with strange extensions like *.ry or  
*.lpp. Refactor it to only include files with known extensions, and to make  
it more readable.  
  
Per Andrew Dunstan's suggestion.  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/VCBuildProject.pm

Fix another poorly worded error message.

commit   : c340494235111fb87e46b11ca6a87a7a43795f0f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Dec 2014 13:22:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Dec 2014 13:22:07 -0500    

Click here for diff

Spotted by Álvaro Herrera.  

M src/bin/initdb/initdb.c

Fix poorly worded error message.

commit   : c977b8cffc76be00fbaab76e3271e05104260ec7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Dec 2014 13:14:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Dec 2014 13:14:53 -0500    

Click here for diff

Adam Brightwell, per report from Martín Marqués.  

M src/backend/libpq/auth.c

Update .gitignore for pg_upgrade

commit   : cef0ae498ccbd4b166ee4fe6cb33612646fdc4b5    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 17 Dec 2014 11:55:22 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 17 Dec 2014 11:55:22 +0100    

Click here for diff

Add Windows versions of generated scripts, and make sure we only  
ignore the scripts int he root directory.  
  
Michael Paquier  

M contrib/pg_upgrade/.gitignore

Add missing documentation for some vcregress modes

commit   : 6964ad95d78a21e6d7aec9727ea9a0af68482c35    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 17 Dec 2014 11:14:34 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 17 Dec 2014 11:14:34 +0100    

Click here for diff

Michael Paquier  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/vcregress.pl

Remove redundant sentence

commit   : cb7b5c5c6f8df5fee936c6a26553427166cbdbfe    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 17 Dec 2014 09:59:21 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 17 Dec 2014 09:59:21 +0100    

Click here for diff

Spotted by David Johnston  

M doc/src/sgml/protocol.sgml

Fix off-by-one loop count in MapArrayTypeName, and get rid of static array.

commit   : 66709133c7e5506be19bf56a82f45dd150f74732    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Dec 2014 15:35:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Dec 2014 15:35:33 -0500    

Click here for diff

MapArrayTypeName would copy up to NAMEDATALEN-1 bytes of the base type  
name, which of course is wrong: after prepending '_' there is only room for  
NAMEDATALEN-2 bytes.  Aside from being the wrong result, this case would  
lead to overrunning the statically allocated work buffer.  This would be a  
security bug if the function were ever used outside bootstrap mode, but it  
isn't, at least not in any currently supported branches.  
  
Aside from fixing the off-by-one loop logic, this patch gets rid of the  
static work buffer by having MapArrayTypeName pstrdup its result; the sole  
caller was already doing that, so this just requires moving the pstrdup  
call.  This saves a few bytes but mainly it makes the API a lot cleaner.  
  
Back-patch on the off chance that there is some third-party code using  
MapArrayTypeName with less-secure input.  Pushing pstrdup into the function  
should not cause any serious problems for such hypothetical code; at worst  
there might be a short term memory leak.  
  
Per Coverity scanning.  

M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/include/bootstrap/bootstrap.h

Suppress bogus statistics when pgbench failed to complete any transactions.

commit   : de8e46f5f5785f4016aabf2aa231faa89a0746fb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Dec 2014 14:53:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Dec 2014 14:53:55 -0500    

Click here for diff

Code added in 9.4 would attempt to divide by zero in such cases.  
Noted while testing fix for missing-pclose problem.  

M contrib/pgbench/pgbench.c

Fix file descriptor leak after failure of a \setshell command in pgbench.

commit   : d38e8d30cecea96a088330133e232c465a222d0a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Dec 2014 13:31:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Dec 2014 13:31:42 -0500    

Click here for diff

If the called command fails to return data, runShellCommand forgot to  
pclose() the pipe before returning.  This is fairly harmless in the current  
code, because pgbench would then abandon further processing of that client  
thread; so no more than nclients descriptors could be leaked this way.  But  
it's not hard to imagine future improvements whereby that wouldn't be true.  
In any case, it's sloppy coding, so patch all branches.  Found by Coverity.  

M contrib/pgbench/pgbench.c

Fix some jsonb issues found by Coverity in recent commits.

commit   : c8315930e6a34b616d9840985c85eb0d856dd2df    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 16 Dec 2014 10:32:06 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 16 Dec 2014 10:32:06 -0500    

Click here for diff

Mostly these issues concern the non-use of function results. These  
have been changed to use (void) pushJsonbValue(...) instead of assigning  
the result to a variable that gets overwritten before it is used.  
  
There is a larger issue that we should possibly examine the API for  
pushJsonbValue(), so that instead of returning a value it modifies a  
state argument. The current idiom is rather clumsy. However, changing  
that requires quite a bit more work, so this change should do for the  
moment.  

M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c

Misc comment typo fixes.

commit   : 4d65e16a6ff609701a8780d3cddbae02c6e20926    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Dec 2014 16:34:56 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Dec 2014 16:34:56 +0200    

Click here for diff

Backpatch the applicable parts, just to make backpatching future patches  
easier.  

M src/backend/lib/binaryheap.c
M src/backend/replication/walsender.c
M src/include/access/brin_tuple.h

Fix incorrect comment about XLogRecordBlockHeader.data_length field.

commit   : da9f6a78ef84898ccdf7855089aa08e7524dfbdc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Dec 2014 15:39:57 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Dec 2014 15:39:57 +0200    

Click here for diff

It does not include the possible full-page image. While at it, reformat the  
comment slightly to make it more readable.  
  
Reported by Rahila Syed  

M src/include/access/xlogrecord.h

Fix commit_ts test suite for systems with coarse timestamp granularity.

commit   : 0916eba131530b296f86137759a32f66ffedff7b    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 15 Dec 2014 20:56:09 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 15 Dec 2014 20:56:09 -0500    

Click here for diff

Noticed on a couple of Windows configurations.  
  
Petr Jelinek, reviewed by Michael Paquier.  

M src/test/modules/commit_ts/expected/commit_timestamp.out
M src/test/modules/commit_ts/expected/commit_timestamp_1.out
M src/test/modules/commit_ts/sql/commit_timestamp.sql

Translation updates

commit   : 733a264ddc1ad29d9cb91cbd712c1ef5f92886c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Dec 2014 16:18:13 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Dec 2014 16:18:13 -0500    

Click here for diff

M src/bin/pg_basebackup/nls.mk
A src/bin/pg_basebackup/po/es.po

add missing newline

commit   : 4576b9cc46b7a0966b94927b4dcc7d24823cab6a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 15 Dec 2014 16:49:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 15 Dec 2014 16:49:41 -0300    

Click here for diff

M src/bin/pg_basebackup/pg_basebackup.c

Fix point <-> polygon code for zero-distance case.

commit   : 9418820efb32e739706cc3860347089315562ee4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Dec 2014 14:04:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Dec 2014 14:04:27 -0500    

Click here for diff

"PG_RETURN_FLOAT8(x)" is not "return x", except perhaps by accident  
on some platforms.  

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

Add point <-> polygon distance operator.

commit   : 4520ba67691fc13bb8be2cc47dd0bf8c7ab94205    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 15 Dec 2014 17:02:49 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 15 Dec 2014 17:02:49 +0200    

Click here for diff

Alexander Korotkov, reviewed by Emre Hasegeli.  

M src/backend/utils/adt/geo_ops.c
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/utils/geo_decls.h
M src/test/regress/expected/polygon.out
M src/test/regress/sql/polygon.sql

Translation updates

commit   : ee3bec5e22f7aed4d9086bec45a8d1821a9e236c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Dec 2014 00:23:25 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Dec 2014 00:23:25 -0500    

Click here for diff

M src/backend/nls.mk
M src/backend/po/de.po
M src/backend/po/it.po
M src/backend/po/ru.po
M src/backend/po/zh_CN.po
D src/backend/po/zh_TW.po
M src/bin/initdb/nls.mk
M src/bin/initdb/po/de.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/it.po
A src/bin/initdb/po/sv.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_basebackup/nls.mk
D src/bin/pg_basebackup/po/cs.po
D src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/it.po
D src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_config/po/sv.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/sv.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/nls.mk
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_ctl/po/zh_CN.po
D src/bin/pg_ctl/po/zh_TW.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/zh_CN.po
M src/bin/pg_resetxlog/nls.mk
M src/bin/pg_resetxlog/po/fr.po
A src/bin/pg_resetxlog/po/sv.po
M src/bin/pg_resetxlog/po/zh_CN.po
M src/bin/psql/po/it.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/de.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/it.po
A src/bin/scripts/po/sv.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/ecpg/preproc/po/zh_CN.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/nls.mk
A src/pl/plperl/po/sv.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/nls.mk
D src/pl/plpython/po/ro.po
M src/pl/plpython/po/zh_CN.po

commit   : 6457ff93feca5b798def2c41786904fe13cc41d1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Dec 2014 20:02:04 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Dec 2014 20:02:04 -0500    

Click here for diff

M doc/src/sgml/ref/initdb.sgml

Improve documentation around parameter-setting and ALTER SYSTEM.

commit   : af06aa822dbc023f3a103278ec381e1c88d67db1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Dec 2014 18:09:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Dec 2014 18:09:51 -0500    

Click here for diff

The ALTER SYSTEM ref page hadn't been held to a very high standard, nor  
was the feature well integrated into section 18.1 (parameter setting).  
Also, though commit 4c4654afe had improved the structure of 18.1, it also  
introduced a lot of poor wording, imprecision, and outright falsehoods.  
Try to clean that up.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/alter_system.sgml

Update 9.4 release notes.

commit   : 0923b01e3e64d4985ffbdf8ec912e25ad02e0c0c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Dec 2014 14:58:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Dec 2014 14:58:03 -0500    

Click here for diff

Set release date, do a final pass of wordsmithing, improve some other  
new-in-9.4 documentation.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/release-9.4.sgml

doc: Fix markup

commit   : c50423c0feac69a4d810f17145536d6844fad01e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Dec 2014 14:16:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Dec 2014 14:16:16 -0500    

Click here for diff

M doc/src/sgml/ref/create_materialized_view.sgml

Add CINE option for CREATE TABLE AS and CREATE MATERIALIZED VIEW

commit   : e39b6f953e8c699eacd676314574ed5869ebacef    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 13 Dec 2014 13:56:09 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 13 Dec 2014 13:56:09 -0500    

Click here for diff

Fabrízio de Royes Mello reviewed by Rushabh Lathia.  

M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_table_as.sgml
M src/backend/commands/createas.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_table.out
M src/test/regress/expected/matview.out
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/matview.sql

Improve recovery target settings documentation.

commit   : e311cd6ded096122a5f2b5cbe91bc3a9f0dda3cb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Dec 2014 13:46:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Dec 2014 13:46:44 -0500    

Click here for diff

Commit 815d71dee hadn't bothered to update the documentation to match the  
behavioral change, and a lot of other text in this section was badly in  
need of copy-editing.  

M doc/src/sgml/recovery-config.sgml

Repair corner-case bug in array version of percentile_cont().

commit   : b0f479113abaf28f1c9ed25d856ffe6fd4bb7dc9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Dec 2014 11:49:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Dec 2014 11:49:16 -0500    

Click here for diff

The code for advancing through the input rows overlooked the case that we  
might already be past the first row of the row pair now being considered,  
in case the previous percentile also fell between the same two input rows.  
  
Report and patch by Andrew Gierth; logic rewritten a bit for clarity by me.  

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

Remove duplicate #define

commit   : 50f2c0687fabde9c665df66f77b464c539d927a9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 13 Dec 2014 18:21:25 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 13 Dec 2014 18:21:25 +0200    

Click here for diff

Mark Dilger  

M src/include/access/xlogrecord.h

Avoid instability in output of new REINDEX SCHEMA test.

commit   : 1c5c70df45714f38c033bb1a272d8db4f2dc8a2f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Dec 2014 15:49:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Dec 2014 15:49:03 -0500    

Click here for diff

The planner seems to like to do this join query as a hash join, making  
the output ordering machine-dependent; worse, it's a hash on OIDs, so  
that it's a bit astonishing that the result doesn't change from run to  
run even on one machine.  Add an ORDER BY to get consistent results.  
Per buildfarm.  
  
I also suppressed output from the final DROP SCHEMA CASCADE, to avoid  
occasional failures similar to those fixed in commit 81d815dc3ed74a7d.  
That hasn't been observed in the buildfarm yet, but it seems likely  
to happen in future if we leave it as-is.  

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

Add several generator functions for jsonb that exist for json.

commit   : 7e354ab9fe9e7c3b0a7a40f226c76bd5cf6438d0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 Dec 2014 15:31:14 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 Dec 2014 15:31:14 -0500    

Click here for diff

The functions are:  
    to_jsonb()  
    jsonb_object()  
    jsonb_build_object()  
    jsonb_build_array()  
    jsonb_agg()  
    jsonb_object_agg()  
  
Also along the way some better logic is implemented in  
json_categorize_type() to match that in the newly implemented  
jsonb_categorize_type().  
  
Andrew Dunstan, reviewed by Pavel Stehule and Alvaro Herrera.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_proc.h
M src/include/utils/jsonb.h
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/jsonb.sql

Revert misguided change to postgres_fdw FOR UPDATE/SHARE code.

commit   : 8ec8760fc87ecde0516e511f1c55aec627b01ea7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Dec 2014 12:41:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Dec 2014 12:41:49 -0500    

Click here for diff

In commit 462bd95705a0c23ba0b0ba60a78d32566a0384c1, I changed postgres_fdw  
to rely on get_plan_rowmark() instead of get_parse_rowmark().  I still  
think that's a good idea in the long run, but as Etsuro Fujita pointed out,  
it doesn't work today because planner.c forces PlanRowMarks to have  
markType = ROW_MARK_COPY for all foreign tables.  There's no urgent reason  
to change this in the back branches, so let's just revert that part of  
yesterday's commit rather than trying to design a better solution under  
time pressure.  
  
Also, add a regression test case showing what postgres_fdw does with FOR  
UPDATE/SHARE.  I'd blithely assumed there was one already, else I'd have  
realized yesterday that this code didn't work.  

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

Add json_strip_nulls and jsonb_strip_nulls functions.

commit   : 237a8824430c607fce1eafde0c625744d50a455c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 Dec 2014 09:00:43 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 Dec 2014 09:00:43 -0500    

Click here for diff

The functions remove object fields, including in nested objects, that  
have null as a value. In certain cases this can lead to considerably  
smaller datums, with no loss of semantic information.  
  
Andrew Dunstan, reviewed by Pavel Stehule.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/json.h
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Put the logic to decide which synchronous standby is active into a function.

commit   : b1332e98c441b40300670f55a4303bf69cd8b226    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Dec 2014 13:39:36 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Dec 2014 13:39:36 +0200    

Click here for diff

This avoids duplicating the code.  
  
Michael Paquier, reviewed by Simon Riggs and me  

M src/backend/replication/syncrep.c
M src/backend/replication/walsender.c
M src/include/replication/syncrep.h

doc: Move website-stylesheet setting to a more appropriate location

commit   : 7afc2336cd9ce294894fcb750ab8c8cf51bf6bce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Dec 2014 21:48:01 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Dec 2014 21:48:01 -0500    

Click here for diff

M doc/src/sgml/stylesheet.dsl

SSL tests: Remove trailing blank lines

commit   : 2f8607860b4ef3668350a47e9488aee3d640da75    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Dec 2014 21:33:58 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Dec 2014 21:33:58 -0500    

Click here for diff

M src/test/ssl/server-cn-only.config
M src/test/ssl/server-revoked.config

SSL tests: Silence pg_ctl output

commit   : ce37eff06df66dcd2091c76c0d29178b55e1e407    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Dec 2014 21:32:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Dec 2014 21:32:30 -0500    

Click here for diff

Otherwise the pg_ctl start and stop messages get mixed up with the TAP  
output, which isn't technically valid.  

M src/test/ssl/ServerSetup.pm

Fix planning of SELECT FOR UPDATE on child table with partial index.

commit   : 462bd95705a0c23ba0b0ba60a78d32566a0384c1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 21:02:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 21:02:25 -0500    

Click here for diff

Ordinarily we can omit checking of a WHERE condition that matches a partial  
index's condition, when we are using an indexscan on that partial index.  
However, in SELECT FOR UPDATE we must include the "redundant" filter  
condition in the plan so that it gets checked properly in an EvalPlanQual  
recheck.  The planner got this mostly right, but improperly omitted the  
filter condition if the index in question was on an inheritance child  
table.  In READ COMMITTED mode, this could result in incorrectly returning  
just-updated rows that no longer satisfy the filter condition.  
  
The cause of the error is using get_parse_rowmark() when get_plan_rowmark()  
is what should be used during planning.  In 9.3 and up, also fix the same  
mistake in contrib/postgres_fdw.  It's currently harmless there (for lack  
of inheritance support) but wrong is wrong, and the incorrect code might  
get copied to someplace where it's more significant.  
  
Report and fix by Kyotaro Horiguchi.  Back-patch to all supported branches.  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/plan/createplan.c

Fix corner case where SELECT FOR UPDATE could return a row twice.

commit   : 2db576ba8c449fcaf61ae7aa14ed62e63ebf5924    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 19:37:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 19:37:00 -0500    

Click here for diff

In READ COMMITTED mode, if a SELECT FOR UPDATE discovers it has to redo  
WHERE-clause checking on rows that have been updated since the SELECT's  
snapshot, it invokes EvalPlanQual processing to do that.  If this first  
occurs within a non-first child table of an inheritance tree, the previous  
coding could accidentally re-return a matching row from an earlier,  
already-scanned child table.  (And, to add insult to injury, I think this  
could make it miss returning a row that should have been returned, if the  
updated row that this happens on should still have passed the WHERE qual.)  
Per report from Kyotaro Horiguchi; the added isolation test is based on his  
test case.  
  
This has been broken for quite awhile, so back-patch to all supported  
branches.  

M src/backend/executor/nodeLockRows.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Further changes to REINDEX SCHEMA

commit   : 2646d2d4a9d8b978fda0d0d1affae4788a30f604    
  
author   : Simon Riggs <[email protected]>    
date     : Thu, 11 Dec 2014 22:54:05 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Thu, 11 Dec 2014 22:54:05 +0000    

Click here for diff

Ensure we reindex indexes built on Mat Views.  
Based on patch from Micheal Paquier  
  
Add thorough tests to check that indexes on  
tables, toast tables and mat views are reindexed.  
  
Simon Riggs  

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

Make rowsecurity test clean up after itself, too.

commit   : 0845264642d855d92c63c5d05a4ef83245ca16c5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 17:45:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 17:45:35 -0500    

Click here for diff

Leaving global objects like roles hanging around is bad practice.  

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

Fix completely broken REINDEX SCHEMA testcase.

commit   : 58af84f4bba5c87b352cf40e276e287fd289bd77    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 17:37:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 17:37:17 -0500    

Click here for diff

Aside from not testing the case it claimed to test (namely a permissions  
failure), it left a login-capable role lying around, which quite aside  
from possibly being a security hole would cause subsequent regression runs  
to fail since the role would already exist.  

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

Fix assorted confusion between Oid and int32.

commit   : 06d5803ffa1ea5a42295c9266f30557e44a99de7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 15:41:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Dec 2014 15:41:15 -0500    

Click here for diff

In passing, also make some debugging elog's in pgstat.c a bit more  
consistently worded.  
  
Back-patch as far as applicable (9.3 or 9.4; none of these mistakes are  
really old).  
  
Mark Dilger identified and patched the type violations; the message  
rewordings are mine.  

M src/backend/access/heap/tuptoaster.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/reorderbuffer.c
M src/bin/pg_dump/parallel.c

Use correct macro for reltablespace.

commit   : 10eb7dfa9b7499d603d09a141b9ae4e36b14393f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Dec 2014 10:19:50 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Dec 2014 10:19:50 +0200    

Click here for diff

It's an OID. WRITE_UINT_FIELD is identical to WRITE_OID_FIELD, but let's  
be tidy.  
  
Mark Dilger  

M src/backend/nodes/outfuncs.c

Fix typo

commit   : 7442a8899751c804c7def0407fd1756360917754    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Dec 2014 20:55:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Dec 2014 20:55:30 -0500    

Click here for diff

Author: Fabrízio de Royes Mello <[email protected]>  

M src/bin/scripts/t/100_vacuumdb.pl

Fix minor thinko in convertToJsonb().

commit   : 24688f4e5a7d5fadde0e43a5b123432d81577d82    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Dec 2014 19:06:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Dec 2014 19:06:27 -0500    

Click here for diff

The amount of space to reserve for the value's varlena header is  
VARHDRSZ, not sizeof(VARHDRSZ).  The latter coding accidentally  
failed to fail because of the way the VARHDRSZ macro is currently  
defined; but if we ever change it to return size_t (as one might  
reasonably expect it to do), convertToJsonb() would have failed.  
  
Spotted by Mark Dilger.  

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

Add a regression test suite for SSL support.

commit   : e39250c644ea7cd3904e4e24570db21a209cf97f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Dec 2014 17:21:18 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Dec 2014 17:21:18 +0200    

Click here for diff

It's not run by the global "check" or "installcheck" targets, because the  
temporary installation it creates accepts TCP connections from any user  
the same host, which is insecure.  

M src/test/Makefile
A src/test/ssl/Makefile
A src/test/ssl/README
A src/test/ssl/ServerSetup.pm
A src/test/ssl/cas.config
A src/test/ssl/client.config
A src/test/ssl/client_ca.config
A src/test/ssl/root_ca.config
A src/test/ssl/server-cn-and-alt-names.config
A src/test/ssl/server-cn-only.config
A src/test/ssl/server-multiple-alt-names.config
A src/test/ssl/server-no-names.config
A src/test/ssl/server-revoked.config
A src/test/ssl/server-single-alt-name.config
A src/test/ssl/server_ca.config
A src/test/ssl/ssl/.gitignore
A src/test/ssl/ssl/both-cas-1.crt
A src/test/ssl/ssl/both-cas-2.crt
A src/test/ssl/ssl/client-revoked.crt
A src/test/ssl/ssl/client-revoked.key
A src/test/ssl/ssl/client.crl
A src/test/ssl/ssl/client.crt
A src/test/ssl/ssl/client.key
A src/test/ssl/ssl/client_ca.crt
A src/test/ssl/ssl/client_ca.key
A src/test/ssl/ssl/root+client.crl
A src/test/ssl/ssl/root+client_ca.crt
A src/test/ssl/ssl/root+server.crl
A src/test/ssl/ssl/root+server_ca.crt
A src/test/ssl/ssl/root.crl
A src/test/ssl/ssl/root_ca.crt
A src/test/ssl/ssl/root_ca.key
A src/test/ssl/ssl/server-cn-and-alt-names.crt
A src/test/ssl/ssl/server-cn-and-alt-names.key
A src/test/ssl/ssl/server-cn-only.crt
A src/test/ssl/ssl/server-cn-only.key
A src/test/ssl/ssl/server-multiple-alt-names.crt
A src/test/ssl/ssl/server-multiple-alt-names.key
A src/test/ssl/ssl/server-no-names.crt
A src/test/ssl/ssl/server-no-names.key
A src/test/ssl/ssl/server-revoked.crt
A src/test/ssl/ssl/server-revoked.key
A src/test/ssl/ssl/server-single-alt-name.crt
A src/test/ssl/ssl/server-single-alt-name.key
A src/test/ssl/ssl/server-ss.crt
A src/test/ssl/ssl/server-ss.key
A src/test/ssl/ssl/server.crl
A src/test/ssl/ssl/server_ca.crt
A src/test/ssl/ssl/server_ca.key
A src/test/ssl/t/001_ssltests.pl

pg_xlogdump/.gitignore: add committsdesc.c

commit   : dcbfc00aba1ee4329fea20ad58e13a84848df993    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 Dec 2014 09:54:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 Dec 2014 09:54:14 -0300    

Click here for diff

Author: Michael Paquier  

M contrib/pg_xlogdump/.gitignore

Silence REINDEX

commit   : ae4e6887a4eaa62ff3e47a16a8b2b6a91fa6a514    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 9 Dec 2014 18:05:36 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 9 Dec 2014 18:05:36 +0900    

Click here for diff

Previously REINDEX DATABASE and REINDEX SCHEMA  
produced a stream of NOTICE messages. Removing that  
since it is inconsistent for such a command to  
produce output without a VERBOSE option.  

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

Execute 18 tests for src/bin/scripts/t/090..

commit   : 1135aabab5dad2f4e79aade3c907bd7a51ac263a    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 9 Dec 2014 01:51:02 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 9 Dec 2014 01:51:02 +0900    

Click here for diff

Some requests count as two tests.  

M src/bin/scripts/t/090_reindexdb.pl

REINDEX SCHEMA

commit   : fe263d115a7dd16095b8b8f1e943aff2bb4574d2    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 9 Dec 2014 00:28:00 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 9 Dec 2014 00:28:00 +0900    

Click here for diff

Add new SCHEMA option to REINDEX and reindexdb.  
  
Sawada Masahiko  
  
Reviewed by Michael Paquier and Fabrízio de Royes Mello  

M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M src/backend/commands/indexcmds.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Windows: use GetSystemTimePreciseAsFileTime if available

commit   : 8001fe67a3d66c95861ce1f7075ef03953670d13    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 23:36:06 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 23:36:06 +0900    

Click here for diff

PostgreSQL on Windows 8 or Windows Server 2012 will now  
get high-resolution timestamps by dynamically loading the  
GetSystemTimePreciseAsFileTime function. It'll fall back to  
to GetSystemTimeAsFileTime if the higher precision variant  
isn't found, so the same binaries without problems on older  
Windows releases.  
  
No attempt is made to detect the Windows version.  Only the  
presence or absence of the desired function is considered.  
  
Craig Ringer  

M src/backend/main/main.c
M src/include/port.h
M src/port/gettimeofday.c

Use GetSystemTimeAsFileTime directly in win32

commit   : 519b0757a37254452e013ea0ac95f4e56391608c    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 23:32:03 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 23:32:03 +0900    

Click here for diff

PostgreSQL was calling GetSystemTime followed by SystemTimeToFileTime in the  
win32 port gettimeofday function. This is not necessary and limits the reported  
precision to the 1ms granularity that the SYSTEMTIME struct can represent. By  
using GetSystemTimeAsFileTime we avoid unnecessary conversions and capture  
timestamps at 100ns granularity, which is then rounded to 1µs granularity for  
storage in a PostgreSQL timestamp.  
  
On most Windows systems this change will actually have no significant effect on  
timestamp resolution as the system timer tick is typically between 1ms and 15ms  
depending on what timer resolution currently running applications have  
requested. You can check this with clockres.exe from sysinternals. Despite the  
platform limiation this change still permits capture of finer timestamps where  
the system is capable of producing them and it gets rid of an unnecessary  
syscall.  
  
The higher resolution GetSystemTimePreciseAsFileTime call available on Windows  
8 and Windows Server 2012 has the same interface as GetSystemTimeAsFileTime, so  
switching to GetSystemTimeAsFileTime makes it easier to use the Precise variant  
later.  
  
Craig Ringer, reviewed by David Rowley  

M src/port/gettimeofday.c

doc: Fix DocBook table column count declaration

commit   : 611d46ea67c0863ab1d97c73c8cead1ed5ca82f0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Dec 2014 02:18:29 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Dec 2014 02:18:29 -0500    

Click here for diff

This was broken in 618c9430a82860c84a3be2711eec2c3b43573b2a.  

M doc/src/sgml/event-trigger.sgml

Correct recovery_target_action docs

commit   : da71632fcfc4e642e9bafb2c0074cad109e59486    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 09:28:24 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 09:28:24 +0900    

Click here for diff

From Michael Paquier  

M doc/src/sgml/recovery-config.sgml

Remove duplicate code in heap_prune_chain()

commit   : c2707547193a1e1f1016552cc92f33e8f0d296d4    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 08:44:37 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 08:44:37 +0900    

Click here for diff

No need to set tuple tableOid twice  
  
Jim Nasby  

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

Event Trigger for table_rewrite

commit   : 618c9430a82860c84a3be2711eec2c3b43573b2a    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 00:55:28 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 8 Dec 2014 00:55:28 +0900    

Click here for diff

Generate a table_rewrite event when ALTER TABLE  
attempts to rewrite a table. Provide helper  
functions to identify table and reason.  
  
Intended use case is to help assess or to react  
to schema changes that might hold exclusive locks  
for long periods.  
  
Dimitri Fontaine, triggering an edit by Simon Riggs  
  
Reviewed in detail by Michael Paquier  

M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func.sgml
M src/backend/commands/event_trigger.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/evtcache.c
M src/include/catalog/pg_proc.h
M src/include/commands/event_trigger.h
M src/include/utils/builtins.h
M src/include/utils/evtcache.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/event_trigger.sql

Tweaks for recovery_target_action

commit   : b8e33a85d4e86a8391118c3d5cdb249b560dec4f    
  
author   : Simon Riggs <[email protected]>    
date     : Sun, 7 Dec 2014 21:55:29 +0900    
  
committer: Simon Riggs <[email protected]>    
date     : Sun, 7 Dec 2014 21:55:29 +0900    

Click here for diff

Rename parameter action_at_recovery_target to  
recovery_target_action suggested by Christoph Berg.  
  
Place into recovery.conf suggested by Fujii Masao,  
replacing (deprecating) earlier parameters, per  
Michael Paquier.  

M src/backend/access/transam/recovery.conf.sample
M src/backend/access/transam/xlog.c

Give a proper error message if initdb password file is empty.

commit   : 198cbe0a0c4b539c9f9f3f2e9169d774d1d39a8e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 14:27:56 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 14:27:56 +0200    

Click here for diff

Used to say just "could not read password from file "...": Success", which  
isn't very informative.  
  
Mats Erik Andersson. Backpatch to all supported versions.  

M src/bin/initdb/initdb.c

Don't include file type bits in tar archive's mode field.

commit   : c0f279c469c87a010fda19647c5453baa5ba97ee    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 13:08:22 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 13:08:22 +0200    

Click here for diff

The "file mode" bits in the tar file header is not supposed to include the  
file type bits, e.g. S_IFREG or S_IFDIR. The file type is stored in a  
separate field. This isn't a problem in practice, all tar programs ignore  
the extra bits, but let's be tidy.  
  
This came up in a discussion around bug #11949, reported by Hendrik Grewe,  
although this doesn't fix the issue with tar --append. That turned out to be  
a bug in GNU tar. Schilly's tartest program revealed this defect in the tar  
created by pg_basebackup.  
  
This problem goes as far as we we've had pg_basebackup, but since this  
hasn't caused any problems in practice, let's be conservative and fix in  
master only.  

M src/port/tar.c

Remove erroneous EXTRA_CLEAN line from Makefile.

commit   : b27b6e75af556b7a07a156eef670e1086c063685    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 12:13:19 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 12:13:19 +0200    

Click here for diff

After commit da34731, these files are not generated files anymore.  
  
Adam Brightwell  

M src/test/modules/dummy_seclabel/Makefile

Print new track_commit_timestamp in rm_desc of a parameter-change record.

commit   : 326b6f009f9f76afbbcd39d751e07822fe453730    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 12:11:07 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 12:11:07 +0200    

Click here for diff

Michael Paquier  

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

Print wal_log_hints in the rm_desc routing of a parameter-change record.

commit   : c846e67c46d5e72e6a0855282720bc44c6f95cb9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 11:58:24 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 11:58:24 +0200    

Click here for diff

It was an oversight in the original commit.  
  
Also note in the sample config file that changing wal_log_hints requires a  
restart.  
  
Michael Paquier. Backpatch to 9.4, where wal_log_hints was added.  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/utils/misc/postgresql.conf.sample

Fix pg_xlogdump's calculation of full-page image data.

commit   : ebc2b681b8ffa597137aa7a19619e6a21176e928    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 11:39:40 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Dec 2014 11:39:40 +0200    

Click here for diff

The old formula was completely bogus with the new WAL record format.  

M contrib/pg_xlogdump/pg_xlogdump.c

Don't dump core if pq_comm_reset() is called before pq_init().

commit   : 9a946298338e4783fcc98e0896712fdf2b2bfd56    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Dec 2014 19:47:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Dec 2014 19:47:06 -0500    

Click here for diff

This can happen if an error occurs in a standalone backend.  This bug  
was introduced by commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d.  
  
Reported by Álvaro Herrera.  

M src/backend/libpq/pqcomm.c

Document that pg_stat_*_tables.n_tup_upd includes n_tup_hot_upd.

commit   : 5ede3a31171d83b94a773d997fe05b563f8ebb3d    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 4 Dec 2014 23:55:19 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 4 Dec 2014 23:55:19 +0100    

Click here for diff

Author: Peter Geoghegan  

M doc/src/sgml/monitoring.sgml

Fix PGXS vpath build when PostgreSQL is built with vpath

commit   : b58233c71b93a32fcab7219585cafc25a27eb769    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Dec 2014 17:02:02 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Dec 2014 17:02:02 -0500    

Click here for diff

PGXS computes srcdir from VPATH, PostgreSQL proper computes VPATH from  
srcdir, and doing both results in an error from make.  Conditionalize so  
only one of these takes effect.  

M src/Makefile.global.in

Revert haphazard pgxs makefile changes

commit   : e4b5a070b4d25da2c2f80af306fa1d19044370ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Nov 2014 22:26:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Nov 2014 22:26:32 -0500    

Click here for diff

These changes were originally submitted as "adds support for VPATH with  
USE_PGXS", but they are not necessary for VPATH support, so they just  
add more lines of code for no reason.  

M src/makefiles/pgxs.mk

Remove USE_VPATH make variable from PGXS

commit   : eb1c3f478645cbbd39877c2a8432f2f8c722eed2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Nov 2014 21:51:30 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Nov 2014 21:51:30 -0500    

Click here for diff

The user can just set VPATH directly.  There is no need to invent  
another variable.  

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

Fix SHLIB_PREREQS use in contrib, allowing PGXS builds

commit   : 1e95bbc870ccb4dc4ac8d43b0a4ed3661415f148    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Dec 2014 07:58:12 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Dec 2014 07:58:12 -0500    

Click here for diff

dblink and postgres_fdw use SHLIB_PREREQS = submake-libpq to build libpq  
first.  This doesn't work in a PGXS build, because there is no libpq to  
build.  So just omit setting SHLIB_PREREQS in this case.  
  
Note that PGXS users can still use SHLIB_PREREQS (although it is not  
documented).  The problem here is only that contrib modules can be built  
in-tree or using PGXS, and the prerequisite is only applicable in the  
former case.  
  
Commit 6697aa2bc25c83b88d6165340348a31328c35de6 previously attempted to  
address this by creating a somewhat fake submake-libpq target in  
Makefile.global.  That was not the right fix, and it was also done in a  
nonportable way, so revert that.  

M contrib/dblink/Makefile
M contrib/postgres_fdw/Makefile
M src/Makefile.global.in

Move PG_AUTOCONF_FILENAME definition

commit   : e86507d7708591804c38de67f8ba5fdb67863810    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Dec 2014 19:54:01 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Dec 2014 19:54:01 -0500    

Click here for diff

Since this is not something that a user should change,  
pg_config_manual.h was an inappropriate place for it.  
  
In initdb.c, remove the use of the macro, because utils/guc.h can't be  
included by non-backend code.  But we hardcode all the other  
configuration file names there, so this isn't a disaster.  

M src/bin/initdb/initdb.c
M src/include/pg_config_manual.h
M src/include/utils/guc.h

doc: Fix markup

commit   : 182362b669f484c1f92e058c710b025d25ddc5dd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Dec 2014 16:23:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Dec 2014 16:23:38 -0300    

Click here for diff

In the spirit of d34b48a021b181e30c53280d336820740f67570b  
  
Per buildfarm member guaibasaurus, via Stefan Kaltenbrunner.  

M doc/src/sgml/config.sgml

Keep track of transaction commit timestamps

commit   : 73c986adde5d73a5e2555da9b5c8facedb146dcd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Dec 2014 11:53:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Dec 2014 11:53:02 -0300    

Click here for diff

Transactions can now set their commit timestamp directly as they commit,  
or an external transaction commit timestamp can be fed from an outside  
system using the new function TransactionTreeSetCommitTsData().  This  
data is crash-safe, and truncated at Xid freeze point, same as pg_clog.  
  
This module is disabled by default because it causes a performance hit,  
but can be enabled in postgresql.conf requiring only a server restart.  
  
A new test in src/test/modules is included.  
  
Catalog version bumped due to the new subdirectory within PGDATA and a  
couple of new SQL functions.  
  
Authors: Álvaro Herrera and Petr Jelínek  
  
Reviewed to varying degrees by Michael Paquier, Andres Freund, Robert  
Haas, Amit Kapila, Fujii Masao, Jaime Casanova, Simon Riggs, Steven  
Singer, Peter Eisentraut  

M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_xlogdump/rmgrdesc.c
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/pg_resetxlog.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/rmgrdesc/Makefile
A src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/Makefile
M src/backend/access/transam/README
A src/backend/access/transam/commit_ts.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/slru.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/commands/vacuum.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/decode.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c
A src/include/access/commit_ts.h
M src/include/access/rmgrlist.h
M src/include/access/transam.h
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.h
M src/include/storage/lwlock.h
M src/include/utils/builtins.h
M src/test/modules/Makefile
A src/test/modules/commit_ts/.gitignore
A src/test/modules/commit_ts/Makefile
A src/test/modules/commit_ts/commit_ts.conf
A src/test/modules/commit_ts/expected/commit_timestamp.out
A src/test/modules/commit_ts/expected/commit_timestamp_1.out
A src/test/modules/commit_ts/sql/commit_timestamp.sql

Fix typos

commit   : 6597ec9be6a9ed50390f73235d6654ec32a0b944    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Dec 2014 11:52:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Dec 2014 11:52:15 -0300    

Click here for diff

M src/backend/access/transam/clog.c
M src/backend/access/transam/xloginsert.c
M src/include/access/rmgrlist.h

Fix whitespace

commit   : bc2f43eaa4cef83798692e57e9d0364f0bcce021    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Dec 2014 23:45:03 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Dec 2014 23:45:03 -0500    

Click here for diff

M src/test/modules/dummy_seclabel/dummy_seclabel–1.0.sql

Install kludges to fix check-world for src/test/modules

commit   : da34731bd3c805ab77d6e5914d02b1f011e9479d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Dec 2014 23:43:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Dec 2014 23:43:53 -0300    

Click here for diff

check-world failed in a completely clean tree, because src/test/modules  
fail to build unless errcodes.h is generated first.  To fix this,  
install a dependency in src/test/modules' Makefile so that the necessary  
file is generated.  Even with this, running "make check" within  
individual module subdirs will still fail because the dependency is not  
considered there, but this case is less interesting and would be messier  
to fix.  
  
check-world still failed with the above fix in place, this time because  
dummy_seclabel used LOAD to load the dynamic library, which doesn't work  
because the @libdir@ (expanded by the makefile) is expanded to the final  
install path, not the temporary installation directory used by make  
check.  To fix, tweak things so that CREATE EXTENSION can be used  
instead, which solves the problem because the library path is expanded  
by the backend, which is aware of the true libdir.  

M src/test/modules/Makefile
M src/test/modules/dummy_seclabel/Makefile
A src/test/modules/dummy_seclabel/dummy_seclabel–1.0.sql
M src/test/modules/dummy_seclabel/dummy_seclabel.c
A src/test/modules/dummy_seclabel/dummy_seclabel.control
D src/test/modules/dummy_seclabel/expected/.gitignore
R099 src/test/modules/dummy_seclabel/output/dummy_seclabel.source src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
D src/test/modules/dummy_seclabel/sql/.gitignore
R098 src/test/modules/dummy_seclabel/input/dummy_seclabel.source src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql

Improve error messages for malformed array input strings.

commit   : 475aedd1ef0c0f9fc9d675dd2286380d14804975    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Dec 2014 18:23:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Dec 2014 18:23:16 -0500    

Click here for diff

Make the error messages issued by array_in() uniformly follow the style  
	ERROR: malformed array literal: "actual input string"  
	DETAIL: specific complaint here  
and rewrite many of the specific complaints to be clearer.  
  
The immediate motivation for doing this is a complaint from Josh Berkus  
that json_to_record() produced an unintelligible error message when  
dealing with an array item, because it tries to feed the JSON-format  
array value to array_in().  Really it ought to be smart enough to  
perform JSON-to-Postgres array conversion, but that's a future feature  
not a bug fix.  In the meantime, this change is something we agreed  
we could back-patch into 9.4, and it should help de-confuse things a bit.  

M src/backend/utils/adt/arrayfuncs.c
M src/pl/plperl/expected/plperl_array.out
M src/test/regress/expected/arrays.out

Don't skip SQL backends in logical decoding for visibility computation.

commit   : 0fd38e13706e6bd4b2a4ce4e0570d0aa4ad65345    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 2 Dec 2014 23:42:26 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 2 Dec 2014 23:42:26 +0100    

Click here for diff

The logical decoding patchset introduced PROC_IN_LOGICAL_DECODING flag  
PGXACT flag, that allows such backends to be skipped when computing  
the xmin horizon/snapshots. That's fine and sensible for walsenders  
streaming out logical changes, but not at all fine for SQL backends  
doing logical decoding. If the latter set that flag any change they  
have performed outside of logical decoding will not be regarded as  
visible - which e.g. can lead to that change being vacuumed away.  
  
Note that not setting the flag for SQL backends isn't particularly  
bothersome - the SQL backend doesn't do streaming, so it only runs for  
a limited amount of time.  
  
Per buildfarm member 'tick' and Alvaro.  
  
Backpatch to 9.4, where logical decoding was introduced.  

M contrib/test_decoding/expected/decoding_into_rel.out
M contrib/test_decoding/sql/decoding_into_rel.sql
M src/backend/replication/logical/logical.c
M src/include/storage/proc.h

Fix JSON aggregates to work properly when final function is re-executed.

commit   : 75ef435218fe4f6ce29d33e10f6f7a328c93f7e7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Dec 2014 15:02:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Dec 2014 15:02:37 -0500    

Click here for diff

Davide S. reported that json_agg() sometimes produced multiple trailing  
right brackets.  This turns out to be because json_agg_finalfn() attaches  
the final right bracket, and was doing so by modifying the aggregate state  
in-place.  That's verboten, though unfortunately it seems there's no way  
for nodeAgg.c to check for such mistakes.  
  
Fix that back to 9.3 where the broken code was introduced.  In 9.4 and  
HEAD, likewise fix json_object_agg(), which had copied the erroneous logic.  
Make some cosmetic cleanups as well.  

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

Minor cleanup of function declarations for BRIN.

commit   : 1511521a36f99a242f51c3bd0811cfcd53c5e63a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Dec 2014 14:07:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Dec 2014 14:07:54 -0500    

Click here for diff

Get rid of PG_FUNCTION_INFO_V1() macros, which are quite inappropriate  
for built-in functions (possibly leftovers from testing as a loadable  
module?).  Also, fix gratuitous inconsistency between SQL-level and  
C-level names of the minmax support functions.  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_minmax.c
M src/include/access/brin_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

pageinspect/BRIN: minor tweaks

commit   : b52cb4690e0752efea440173c4923d76d2126679    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Dec 2014 12:20:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Dec 2014 12:20:50 -0300    

Click here for diff

Michael Paquier  
  
Double-dash additions suggested by Peter Geoghegan  

M contrib/pageinspect/pageinspect–1.2–1.3.sql
M contrib/pageinspect/pageinspect–1.3.sql
M doc/src/sgml/pageinspect.sgml

dummy_seclabel: add sql/, expected/, and .gitignores

commit   : 332562437724845635f0e11685d11fdfe8719eb2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Dec 2014 11:14:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Dec 2014 11:14:56 -0300    

Click here for diff

Michael Paquier  

A src/test/modules/dummy_seclabel/.gitignore
M src/test/modules/dummy_seclabel/Makefile
A src/test/modules/dummy_seclabel/expected/.gitignore
A src/test/modules/dummy_seclabel/sql/.gitignore

Guard against bad "dscale" values in numeric_recv().

commit   : 0927bf8060eca4e220cde48b1425e7bcf7451b94    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Dec 2014 15:25:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Dec 2014 15:25:02 -0500    

Click here for diff

We were not checking to see if the supplied dscale was valid for the given  
digit array when receiving binary-format numeric values.  While dscale can  
validly be more than the number of nonzero fractional digits, it shouldn't  
be less; that case causes fractional digits to be hidden on display even  
though they're there and participate in arithmetic.  
  
Bug #12053 from Tommaso Sala indicates that there's at least one broken  
client library out there that sometimes supplies an incorrect dscale value,  
leading to strange behavior.  This suggests that simply throwing an error  
might not be the best response; it would lead to failures in applications  
that might seem to be working fine today.  What seems the least risky fix  
is to truncate away any digits that would be hidden by dscale.  This  
preserves the existing behavior in terms of what will be printed for the  
transmitted value, while preventing subsequent arithmetic from producing  
results inconsistent with that.  
  
In passing, throw a specific error for the case of dscale being outside  
the range that will fit into a numeric's header.  Before you got "value  
overflows numeric format", which is a bit misleading.  
  
Back-patch to all supported branches.  

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

Move security_label test

commit   : df761e3cf79db09d602610ee61e51cb378288382    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 1 Dec 2014 16:12:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 1 Dec 2014 16:12:43 -0300    

Click here for diff

Rather than have the core security_label regression test depend on the  
dummy_seclabel module, have that part of the test be executed by  
dummy_seclabel itself directly.  This simplifies the testing rig a bit;  
in particular it should silence the problems from the MSVC buildfarm  
phylum, which haven't yet gotten taught how to install src/test/modules.  

M src/test/modules/dummy_seclabel/Makefile
A src/test/modules/dummy_seclabel/input/dummy_seclabel.source
A src/test/modules/dummy_seclabel/output/dummy_seclabel.source
M src/test/regress/GNUmakefile
A src/test/regress/expected/security_label.out
D src/test/regress/input/security_label.source
D src/test/regress/output/security_label.source
A src/test/regress/sql/security_label.sql

Fix hstore_to_json_loose's detection of valid JSON number values.

commit   : e09996ff8dee3f70b0a027cffebccef4388ed5b7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 1 Dec 2014 11:28:45 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 1 Dec 2014 11:28:45 -0500    

Click here for diff

We expose a function IsValidJsonNumber that internally calls the lexer  
for json numbers. That allows us to use the same test everywhere,  
instead of inventing a broken test for hstore conversions. The new  
function is also used in datum_to_json, replacing the code that is now  
moved to the new function.  
  
Backpatch to 9.3 where hstore_to_json_loose was introduced.  

M contrib/hstore/hstore_io.c
M src/backend/utils/adt/json.c
M src/include/utils/jsonapi.h

Put SSL_pending() call behind the new internal SSL API.

commit   : 4e86f1b16da85ba0a99c592dc7b977b3be80a483    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Dec 2014 17:43:14 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 1 Dec 2014 17:43:14 +0200    

Click here for diff

It seems likely that any SSL implementation will need a similar call, not  
just OpenSSL.  

M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h

Fix missing space in documentation

commit   : 6d6cade05bcb68ca8677aa5502ca73274d6e4539    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 1 Dec 2014 12:12:07 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 1 Dec 2014 12:12:07 +0100    

Click here for diff

Ian Barwick  

M doc/src/sgml/wal.sgml

Add a #define for the inet overlaps operator.

commit   : 866737c923730f0cf8dde787868ab3ae697a278a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Nov 2014 19:43:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Nov 2014 19:43:43 -0500    

Click here for diff

Extracted from pending inet selectivity patch.  The rest of it isn't  
quite ready to commit, but we might as well push this part so the patch  
doesn't have to track the moving target of pg_operator.h.  

M src/include/catalog/pg_operator.h

Fix minor bugs in commit 30bf4689a96cd283af33edcdd6b7210df3f20cd8 et al.

commit   : 1adbb347ec6ca059168a1866357ca7a23d117272    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Nov 2014 12:20:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Nov 2014 12:20:44 -0500    

Click here for diff

Coverity complained that the "else" added to fillPGconn() was unreachable,  
which it was.  Remove the dead code.  In passing, rearrange the tests so as  
not to bother trying to fetch values for options that can't be assigned.  
  
Pre-9.3 did not have that issue, but it did have a "return" that should be  
"goto oom_error" to ensure that a suitable error message gets filled in.  

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

Move test modules from contrib to src/test/modules

commit   : 22dfd116a127a2fc916a4fdac282ee69d4905a25    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 29 Nov 2014 23:55:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 29 Nov 2014 23:55:00 -0300    

Click here for diff

This is advance preparation for introducing even more test modules; the  
easy solution is to add them to contrib, but that's bloated enough that  
it seems a good time to think of something different.  
  
Moved modules are dummy_seclabel, test_shm_mq, test_parser and  
worker_spi.  
  
(test_decoding was also a candidate, but there was too much opposition  
to moving that one.  We can always reconsider later.)  

M contrib/Makefile
M doc/src/sgml/contrib.sgml
D doc/src/sgml/dummy-seclabel.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.4.sgml
D doc/src/sgml/test-parser.sgml
D doc/src/sgml/test-shm-mq.sgml
M src/test/Makefile
A src/test/modules/Makefile
R073 contrib/dummy_seclabel/Makefile src/test/modules/dummy_seclabel/Makefile
A src/test/modules/dummy_seclabel/README
R100 contrib/dummy_seclabel/dummy_seclabel.c src/test/modules/dummy_seclabel/dummy_seclabel.c
R100 contrib/test_parser/.gitignore src/test/modules/test_parser/.gitignore
R080 contrib/test_parser/Makefile src/test/modules/test_parser/Makefile
A src/test/modules/test_parser/README
R100 contrib/test_parser/expected/test_parser.out src/test/modules/test_parser/expected/test_parser.out
R100 contrib/test_parser/sql/test_parser.sql src/test/modules/test_parser/sql/test_parser.sql
R093 contrib/test_parser/test_parser–1.0.sql src/test/modules/test_parser/test_parser–1.0.sql
R088 contrib/test_parser/test_parser–unpackaged–1.0.sql src/test/modules/test_parser/test_parser–unpackaged–1.0.sql
R098 contrib/test_parser/test_parser.c src/test/modules/test_parser/test_parser.c
R100 contrib/test_parser/test_parser.control src/test/modules/test_parser/test_parser.control
R100 contrib/test_shm_mq/.gitignore src/test/modules/test_shm_mq/.gitignore
R079 contrib/test_shm_mq/Makefile src/test/modules/test_shm_mq/Makefile
A src/test/modules/test_shm_mq/README
R100 contrib/test_shm_mq/expected/test_shm_mq.out src/test/modules/test_shm_mq/expected/test_shm_mq.out
R098 contrib/test_shm_mq/setup.c src/test/modules/test_shm_mq/setup.c
R100 contrib/test_shm_mq/sql/test_shm_mq.sql src/test/modules/test_shm_mq/sql/test_shm_mq.sql
R098 contrib/test_shm_mq/test.c src/test/modules/test_shm_mq/test.c
R092 contrib/test_shm_mq/test_shm_mq–1.0.sql src/test/modules/test_shm_mq/test_shm_mq–1.0.sql
R100 contrib/test_shm_mq/test_shm_mq.control src/test/modules/test_shm_mq/test_shm_mq.control
R096 contrib/test_shm_mq/test_shm_mq.h src/test/modules/test_shm_mq/test_shm_mq.h
R098 contrib/test_shm_mq/worker.c src/test/modules/test_shm_mq/worker.c
R075 contrib/worker_spi/Makefile src/test/modules/worker_spi/Makefile
R082 contrib/worker_spi/worker_spi–1.0.sql src/test/modules/worker_spi/worker_spi–1.0.sql
R099 contrib/worker_spi/worker_spi.c src/test/modules/worker_spi/worker_spi.c
R100 contrib/worker_spi/worker_spi.control src/test/modules/worker_spi/worker_spi.control
M src/test/regress/GNUmakefile

Remove PQhostaddr() from 9.4 release notes.

commit   : 5b12987b2e80fcf3af1f6fd23954da5c453e9e64    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 29 Nov 2014 15:53:05 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 29 Nov 2014 15:53:05 -0500    

Click here for diff

Back-patch to 9.4, like the feature's removal.  

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

Reimplement 9f80f4835a55a1cbffcda5d23a617917f3286c14 with PQconninfo().

commit   : 64f86fb11e20b55fb742af72d55806f8bdd9cd2d    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 29 Nov 2014 12:31:43 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 29 Nov 2014 12:31:43 -0500    

Click here for diff

Apart from ignoring "hostaddr" set to the empty string, this behaves  
identically to its predecessor.  Back-patch to 9.4, where the original  
commit first appeared.  
  
Reviewed by Fujii Masao.  

M src/bin/psql/command.c

Revert "Add libpq function PQhostaddr()."

commit   : 2cda889984a6f5ad405318f9e91202d258383b66    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 29 Nov 2014 12:31:21 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 29 Nov 2014 12:31:21 -0500    

Click here for diff

This reverts commit 9f80f4835a55a1cbffcda5d23a617917f3286c14.  The  
function returned the raw value of a connection parameter, a task served  
by PQconninfo().  The next commit will reimplement the psql \conninfo  
change that way.  Back-patch to 9.4, where that commit first appeared.  

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

Fix BRIN operator family definitions

commit   : 816e10d80033dd74b3b76fdfd84dffb767316c54    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Nov 2014 18:09:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Nov 2014 18:09:19 -0300    

Click here for diff

The original definitions were leaving no room for cross-type operators,  
so queries that compared a column of one type against something of a  
different type were not taking advantage of the index.  Fix by making  
the opfamilies more like the ones for Btree, and include a few  
cross-type operator classes.  
  
Catalog version bumped.  
  
Per complaints from Hubert Lubaczewski, Mark Wong, Heikki Linnakangas.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_opfamily.h

Update transaction README for persistent multixacts

commit   : ae04bf50277ae25ca741cf3322d231c7dfb4c997    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Nov 2014 18:06:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Nov 2014 18:06:18 -0300    

Click here for diff

Multixacts are now maintained during recovery, but the README didn't get  
the memo.  Backpatch to 9.3, where the divergence was introduced.  

M src/backend/access/transam/README

Add bms_get_singleton_member(), and use it where appropriate.

commit   : d25367ec4f869aac80e97964fa5d7143536818b1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 14:16:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 14:16:24 -0500    

Click here for diff

This patch adds a function that replaces a bms_membership() test followed  
by a bms_singleton_member() call, performing both the test and the  
extraction of a singleton set's member in one scan of the bitmapset.  
The performance advantage over the old way is probably minimal in current  
usage, but it seems worthwhile on notational grounds anyway.  
  
David Rowley  

M src/backend/nodes/bitmapset.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/util/placeholder.c
M src/include/nodes/bitmapset.h

Add bms_next_member(), and use it where appropriate.

commit   : f4e031c662a6b600b786c4849968a099c58fcce7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 13:37:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 13:37:25 -0500    

Click here for diff

This patch adds a way of iterating through the members of a bitmapset  
nondestructively, unlike the old way with bms_first_member().  While  
bms_next_member() is very slightly slower than bms_first_member()  
(at least for typical-size bitmapsets), eliminating the need to palloc  
and pfree a temporary copy of the target bitmapset is a significant win.  
So this method should be preferred in all cases where a temporary copy  
would be necessary.  
  
Tom Lane, with suggestions from Dean Rasheed and David Rowley  

M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/dml.c
M src/backend/executor/execMain.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/var.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/include/nodes/bitmapset.h
M src/pl/plpgsql/src/pl_exec.c

Improve performance of OverrideSearchPathMatchesCurrent().

commit   : 96d66bcfc60d9bcb7db767f23d33abf4d8bc7021    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 12:37:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 12:37:27 -0500    

Click here for diff

This function was initially coded on the assumption that it would not be  
performance-critical, but that turns out to be wrong in workloads that  
are heavily dependent on the speed of plpgsql functions.  Speed it up by  
hard-coding the comparison rules, thereby avoiding palloc/pfree traffic  
from creating and immediately freeing an OverrideSearchPath object.  
Per report from Scott Marlowe.  

M src/backend/catalog/namespace.c

Improve typcache: cache negative lookup results, add invalidation logic.

commit   : e384ed6cdec691e0f7c9a077d0fb2a357763c335    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 12:19:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Nov 2014 12:19:14 -0500    

Click here for diff

Previously, if the typcache had for example tried and failed to find a hash  
opclass for a given data type, it would nonetheless repeat the unsuccessful  
catalog lookup each time it was asked again.  This can lead to a  
significant amount of useless bufmgr traffic, as in a recent report from  
Scott Marlowe.  Like the catalog caches, typcache should be able to cache  
negative results.  This patch arranges that by making use of separate flag  
bits to remember whether a particular item has been looked up, rather than  
treating a zero OID as an indicator that no lookup has been done.  
  
Also, install a credible invalidation mechanism, namely watching for inval  
events in pg_opclass.  The sole advantage of the lack of negative caching  
was that the code would cope if operators or opclasses got added for a type  
mid-session; to preserve that behavior we have to be able to invalidate  
stale lookup results.  Updates in pg_opclass should be pretty rare in  
production systems, so it seems sufficient to just invalidate all the  
dependent data whenever one happens.  
  
Adding proper invalidation also means that this code will now react sanely  
if an opclass is dropped mid-session.  Arguably, that's a back-patchable  
bug fix, but in view of the lack of complaints from the field I'll refrain  
from back-patching.  (Probably, in most cases where an opclass is dropped,  
the data type itself is dropped soon after, so that this misfeasance has  
no bad consequences.)  

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

Add tab-completion for ALTER TABLE ALTER CONSTRAINT in psql.

commit   : 202cbdf7821b4e83694794bfa9f05a376ccad8cd    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 28 Nov 2014 21:29:45 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 28 Nov 2014 21:29:45 +0900    

Click here for diff

Back-patch to 9.4 where ALTER TABLE ALTER CONSTRAINT was added.  
  
Michael Paquier, bug reported by Andrey Lizenko.  

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

Fix assertion failure at end of PITR.

commit   : afeacd274830d1e3d15ffc4e4d4b08a887f76abb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 28 Nov 2014 09:23:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 28 Nov 2014 09:23:41 +0200    

Click here for diff

InitXLogInsert() cannot be called in a critical section, because it  
allocates memory. But CreateCheckPoint() did that, when called for the  
end-of-recovery checkpoint by the startup process.  
  
In the passing, fix the scratch space allocation in InitXLogInsert to go to  
the right memory context. Also update the comment at InitXLOGAccess, which  
hasn't been totally accurate since hot standby was introduced (in a hot  
standby backend, InitXLOGAccess isn't called at backend startup).  
  
Reported by Michael Paquier  

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

Make \watch respect the user's \pset null setting.

commit   : a5eb85eb6266c99f79144201f1162e5106969575    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 28 Nov 2014 02:42:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 28 Nov 2014 02:42:43 +0900    

Click here for diff

Previously \watch always ignored the user's \pset null setting.  
\pset null setting should be ignored for \d and similar queries.  
For those, the code can reasonably have an opinion about what  
the presentation should be like, since it knows what SQL query  
it's issuing. This argument surely doesn't apply to \watch,  
so this commit makes \watch use the user's \pset null setting.  
  
Back-patch to 9.3 where \watch was added.  

M src/bin/psql/command.c

Mark response messages for translation in pg_isready.

commit   : e656f5d2475f1c3c4099700a6f636cbfbe946ed2    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 28 Nov 2014 02:12:45 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 28 Nov 2014 02:12:45 +0900    

Click here for diff

Back-patch to 9.3 where pg_isready was added.  
  
Mats Erik Andersson  

M src/bin/scripts/pg_isready.c

Free libxml2/libxslt resources in a safer order.

commit   : c168ba311228c523923f7ef7699cba96deedcc6d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Nov 2014 11:12:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Nov 2014 11:12:44 -0500    

Click here for diff

Mark Simonetti reported that libxslt sometimes crashes for him, and that  
swapping xslt_process's object-freeing calls around to do them in reverse  
order of creation seemed to fix it.  I've not reproduced the crash, but  
valgrind clearly shows a reference to already-freed memory, which is  
consistent with the idea that shutdown of the xsltTransformContext is  
trying to reference the already-freed stylesheet or input document.  
With this patch, valgrind is no longer unhappy.  
  
I have an inquiry in to see if this is a libxslt bug or if we're just  
abusing the library; but even if it's a library bug, we'd want to adjust  
our code so it doesn't fail with unpatched libraries.  
  
Back-patch to all supported branches, because we've been doing this in  
the wrong(?) order for a long time.  

M contrib/xml2/xslt_proc.c

Rename pg_rowsecurity -> pg_policy and other fixes

commit   : 143b39c1855f8a22f474f20354ee5ee5d2f4d266    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 27 Nov 2014 01:06:36 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 27 Nov 2014 01:06:36 -0500    

Click here for diff

As pointed out by Robert, we should really have named pg_rowsecurity  
pg_policy, as the objects stored in that catalog are policies.  This  
patch fixes that and updates the column names to start with 'pol' to  
match the new catalog name.  
  
The security consideration for COPY with row level security, also  
pointed out by Robert, has also been addressed by remembering and  
re-checking the OID of the relation initially referenced during COPY  
processing, to make sure it hasn't changed under us by the time we  
finish planning out the query which has been built.  
  
Robert and Alvaro also commented on missing OCLASS and OBJECT entries  
for POLICY (formerly ROWSECURITY or POLICY, depending) in various  
places.  This patch fixes that too, which also happens to add the  
ability to COMMENT on policies.  
  
In passing, attempt to improve the consistency of messages, comments,  
and documentation as well.  This removes various incarnations of  
'row-security', 'row-level security', 'Row-security', etc, in favor  
of 'policy', 'row level security' or 'row_security' as appropriate.  
  
Happy Thanksgiving!  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/rules.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/system_views.sql
M src/backend/commands/copy.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/policy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/gram.y
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_class.h
A src/include/catalog/pg_policy.h
D src/include/catalog/pg_rowsecurity.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/rewrite/rowsecurity.h
M src/include/utils/plancache.h
M src/include/utils/rel.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/rowsecurity.sql

Remove dead function prototype

commit   : 1812ee5767a25a36e7002be8a3a032357d3fe4e2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Nov 2014 11:04:33 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 26 Nov 2014 11:04:33 +0200    

Click here for diff

It was added in commit efc16ea5, but never defined.  

M src/include/storage/lock.h

doc: Fix markup

commit   : e6f0a48a6094b4e10a81fc2de82cf896701ff396    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 25 Nov 2014 22:21:23 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 25 Nov 2014 22:21:23 -0500    

Click here for diff

M doc/src/sgml/recovery-config.sgml

Attempt to suppress uninitialized variable warning.

commit   : a6c84c770efdc85aecbef319b453c997a465bd84    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 25 Nov 2014 20:07:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 25 Nov 2014 20:07:07 -0500    

Click here for diff

Report by Heikki Linnakangas.  

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

Remove extraneous SGML tag

commit   : b7a715800a45be00c513ce9c4371fd47b5324d34    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 25 Nov 2014 20:51:13 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 25 Nov 2014 20:51:13 +0000    

Click here for diff

M doc/src/sgml/recovery-config.sgml

Fix uninitialized-variable warning.

commit   : d934a052348c1fa017ff677d08e74c643e3f416c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Nov 2014 15:16:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Nov 2014 15:16:49 -0500    

Click here for diff

In passing, add an Assert defending the presumption that bytes_left  
is positive to start with.  (I'm not exactly convinced that using an  
unsigned type was such a bright thing here, but let's at least do  
this much.)  

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

action_at_recovery_target recovery config option

commit   : aedccb1f6fef988af1d1a25b78151f3773954b4c    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 25 Nov 2014 20:13:30 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 25 Nov 2014 20:13:30 +0000    

Click here for diff

action_at_recovery_target = pause | promote | shutdown  
  
Petr Jelinek  
  
Reviewed by Muhammad Asif Naeem, Fujji Masao and  
Simon Riggs  

M doc/src/sgml/recovery-config.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/include/access/xlog_internal.h

De-reserve most statement-introducing keywords in plpgsql.

commit   : bb1b8f694ad2efc35ebae2acfa2c18a2197b82a1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Nov 2014 15:02:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Nov 2014 15:02:09 -0500    

Click here for diff

Add a bit of context sensitivity to plpgsql_yylex() so that it can  
recognize when the word it is looking at is the first word of a new  
statement, and if so whether it is the target of an assignment statement.  
When we are at start of statement and it's not an assignment, we can  
prefer recognizing unreserved keywords over recognizing variable names,  
thereby allowing most statements' initial keywords to be demoted from  
reserved to unreserved status.  This is rather useful already (there are  
15 such words that get demoted here), and what's more to the point is  
that future patches proposing to add new plpgsql statements can avoid  
objections about having to add new reserved words.  
  
The keywords BEGIN, DECLARE, FOR, FOREACH, LOOP, WHILE need to remain  
reserved because they can be preceded by block labels, and the logic  
added here doesn't understand about block labels.  In principle we  
could probably fix that, but it would take more than one token of  
lookback and the benefit doesn't seem worth extra complexity.  
  
Also note I didn't de-reserve EXECUTE, because it is used in more places  
than just statement start.  It's possible it could be de-reserved with  
more work, but that would be an independent fix.  
  
In passing, also de-reserve COLLATE and DEFAULT, which shouldn't have  
been reserved in the first place since they only need to be recognized  
within DECLARE sections.  

M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Support arrays as input to array_agg() and ARRAY(SELECT ...).

commit   : bac27394a1c69c20ec904729c593e59485c75c69    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Nov 2014 12:21:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Nov 2014 12:21:22 -0500    

Click here for diff

These cases formerly failed with errors about "could not find array type  
for data type".  Now they yield arrays of the same element type and one  
higher dimension.  
  
The implementation involves creating functions with API similar to the  
existing accumArrayResult() family.  I (tgl) also extended the base family  
by adding an initArrayResult() function, which allows callers to avoid  
special-casing the zero-inputs case if they just want an empty array as  
result.  (Not all do, so the previous calling convention remains valid.)  
This allowed simplifying some existing code in xml.c and plperl.c.  
  
Ali Akbar, reviewed by Pavel Stehule, significantly modified by me  

M doc/src/sgml/func.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xaggr.sgml
M src/backend/executor/nodeSubplan.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_proc.h
M src/include/utils/array.h
M src/include/utils/lsyscache.h
M src/pl/plperl/plperl.c
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Add int64 -> int8 mapping to genbki

commit   : 25976710dfd8611d3fc79c0c1e20179ff7a940ec    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 25 Nov 2014 11:48:16 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 25 Nov 2014 11:48:16 -0500    

Click here for diff

Per discussion with Tom and Andrew, 64bit integers are no longer a  
problem for the catalogs, so go ahead and add the mapping from the C  
int64 type to the int8 SQL identification to allow using them.  
  
Patch by Adam Brightwell  

M src/backend/catalog/Catalog.pm

Allow using connection URI in primary_conninfo.

commit   : b3fc6727ce54a16ae9227bcccfebfa028ac5b16f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 18:24:07 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 18:24:07 +0200    

Click here for diff

The old method of appending options to the connection string didn't work if  
the primary_conninfo was a postgres:// style URI, instead of a traditional  
connection string. Use PQconnectdbParams instead.  
  
Alex Shulgin  

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

Allow "dbname" from connection string to be overridden in PQconnectDBParams

commit   : add1b052e2b2d5206474d58db25e48820242d15b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 17:12:07 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 17:12:07 +0200    

Click here for diff

If the "dbname" attribute in PQconnectDBParams contained a connection string  
or URI (and expand_dbname = TRUE), the database name from the connection  
string could not be overridden by a subsequent "dbname" keyword in the  
array. That was not intentional; all other options can be overridden.  
Furthermore, any subsequent "dbname" caused the connection string from the  
first dbname value to be processed again, overriding any values for the same  
options that were given between the connection string and the second dbname  
option.  
  
In the passing, clarify in the docs that only the first dbname option in the  
array is parsed as a connection string.  
  
Alex Shulgin. Backpatch to all supported versions.  

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

Suppress DROP CASCADE notices in regression tests

commit   : 81d815dc3ed74a7d20f7b4c7d87c42816c7ee7af    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 25 Nov 2014 09:49:48 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 25 Nov 2014 09:49:48 -0500    

Click here for diff

In the regression tests, when doing cascaded drops, we need to suppress  
the notices from DROP CASCADE or there can be transient regression  
failures as the order of drops can depend on the physical row order in  
pg_depend.  
  
Report and fix suggestion from Tom.  

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

Check return value of strdup() in libpq connection option parsing.

commit   : 30bf4689a96cd283af33edcdd6b7210df3f20cd8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 12:55:00 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 12:55:00 +0200    

Click here for diff

An out-of-memory in most of these would lead to strange behavior, like  
connecting to a different database than intended, but some would lead to  
an outright segfault.  
  
Alex Shulgin and me. Backpatch to all supported versions.  

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

Make Port->ssl_in_use available, even when built with !USE_SSL

commit   : e453cc2741416dc784842b2bba68749556cf0f6f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 09:39:31 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Nov 2014 09:39:31 +0200    

Click here for diff

Code that check the flag no longer need #ifdef's, which is more convenient.  
In particular, makes it easier to write extensions that depend on it.  
  
In the passing, modify sslinfo's ssl_is_used function to check ssl_in_use  
instead of the OpenSSL specific 'ssl' pointer. It doesn't make any  
difference currently, as sslinfo is only compiled when built with OpenSSL,  
but seems cleaner anyway.  

M contrib/sslinfo/sslinfo.c
M src/backend/libpq/hba.c
M src/include/libpq/libpq-be.h

Add infrastructure to save and restore GUC values.

commit   : f5d9698a8400972bd604069a3f15ca33e535ea6e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Nov 2014 16:13:11 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Nov 2014 16:13:11 -0500    

Click here for diff

This is further infrastructure for parallelism.  
  
Amit Khandekar, Noah Misch, Robert Haas  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/extension.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Add a few paragraphs to B-tree README explaining L&Y algorithm.

commit   : 49b86fb1c97878ea2e3a8118df072c95f60077ac    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 24 Nov 2014 13:41:47 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 24 Nov 2014 13:41:47 +0200    

Click here for diff

This gives an overview of what Lehman & Yao's paper is all about, so that  
you can understand the rest of the README without having to read the paper.  
  
Per discussion with Peter Geoghegan and others.  

M src/backend/access/nbtree/README

Distinguish XLOG_FPI records generated for hint-bit updates.

commit   : 0bd624d63b056205fda17a2d694d91db16468e3f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 24 Nov 2014 10:43:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 24 Nov 2014 10:43:32 +0200    

Click here for diff

Add a new XLOG_FPI_FOR_HINT record type, and use that for full-page images  
generated for hint bit updates, when checksums are enabled. The new record  
type is replayed exactly the same as XLOG_FPI, but allows them to be tallied  
separately e.g. in pg_xlogdump.  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/decode.c
M src/include/catalog/pg_control.h

Get rid of redundant production in plpgsql grammar.

commit   : e2dc3f57726199408902ba87eaaf7b95d1223744    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Nov 2014 15:31:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Nov 2014 15:31:32 -0500    

Click here for diff

There may once have been a reason for the intermediate proc_stmts  
production in the plpgsql grammar, but it isn't doing anything useful  
anymore, so let's collapse it into proc_sect.  Saves some code and  
probably a small number of nanoseconds per statement list.  
  
In passing, correctly alphabetize keyword lists to match pl_scanner.c;  
note that for "rowtype" vs "row_count", pl_scanner.c must sort on the  
basis of the lower-case spelling.  
  
Noted while fooling with a patch to de-reserve more plpgsql keywords.  

M src/pl/plpgsql/src/pl_gram.y

Fix memory leaks introduced by commit eca2b9b

commit   : 02d5ab6a86aa941109cecd9e6ebe73a67e8bf545    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 23 Nov 2014 13:47:08 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 23 Nov 2014 13:47:08 -0500    

Click here for diff

M src/bin/psql/command.c

Detect PG_PRINTF_ATTRIBUTE automatically.

commit   : b779168ffe330d137b8b4329a7710c8bf1f7e661    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 23 Nov 2014 09:34:03 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 23 Nov 2014 09:34:03 -0500    

Click here for diff

This eliminates gobs of "unrecognized format function type" warnings  
under MinGW compilers predating GCC 4.4.  

M config/c-compiler.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config_manual.h

Allow simplification of EXISTS() subqueries containing LIMIT.

commit   : b62f94c60386796fd88256c5b7b1e8301c345166    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Nov 2014 19:12:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Nov 2014 19:12:38 -0500    

Click here for diff

The locution "EXISTS(SELECT ... LIMIT 1)" seems to be rather common among  
people who don't realize that the database already performs optimizations  
equivalent to putting LIMIT 1 in the sub-select.  Unfortunately, this was  
actually making things worse, because it prevented us from optimizing such  
EXISTS clauses into semi or anti joins.  Teach simplify_EXISTS_query() to  
suppress constant-positive LIMIT clauses.  That fixes the semi/anti-join  
case, and may help marginally even for cases that have to be left as  
sub-SELECTs.  
  
Marti Raudsepp, reviewed by David Rowley  

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

Fix mishandling of system columns in FDW queries.

commit   : 9c58101117d25f174c8d8013befdc33c632922d0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Nov 2014 16:01:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Nov 2014 16:01:05 -0500    

Click here for diff

postgres_fdw would send query conditions involving system columns to the  
remote server, even though it makes no effort to ensure that system  
columns other than CTID match what the remote side thinks.  tableoid,  
in particular, probably won't match and might have some use in queries.  
Hence, prevent sending conditions that include non-CTID system columns.  
  
Also, create_foreignscan_plan neglected to check local restriction  
conditions while determining whether to set fsSystemCol for a foreign  
scan plan node.  This again would bollix the results for queries that  
test a foreign table's tableoid.  
  
Back-patch the first fix to 9.3 where postgres_fdw was introduced.  
Back-patch the second to 9.2.  The code is probably broken in 9.1 as  
well, but the patch doesn't apply cleanly there; given the weak state  
of support for FDWs in 9.1, it doesn't seem worth fixing.  
  
Etsuro Fujita, reviewed by Ashutosh Bapat, and somewhat modified by me  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/createplan.c

Rework echo_hidden for \sf and \ef from commit e4d2817.

commit   : eca2b9ba3e1e65c2ac880578bfb3cbeed1cb1d26    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 22 Nov 2014 09:39:01 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 22 Nov 2014 09:39:01 -0500    

Click here for diff

PSQLexec's error reporting turns out to be too verbose for this case, so  
revert to using PQexec instead with minimal error reporting. Prior to  
calling PQexec, we call a function that mimics just the echo_hidden  
piece of PSQLexec.  

M src/bin/psql/command.c

Rearrange CustomScan API.

commit   : 447770404cce5ce86174fa4809784c4e5d0a0a76    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Nov 2014 18:21:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Nov 2014 18:21:46 -0500    

Click here for diff

Make it work more like FDW plans do: instead of assuming that there are  
expressions in a CustomScan plan node that the core code doesn't know  
about, insist that all subexpressions that need planner attention be in  
a "custom_exprs" list in the Plan representation.  (Of course, the  
custom plugin can break the list apart again at executor initialization.)  
This lets us revert the parts of the patch that exposed setrefs.c and  
subselect.c processing to the outside world.  
  
Also revert the GetSpecialCustomVar stuff in ruleutils.c; that concept  
may work in future, but it's far from fully baked right now.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/nodeCustom.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/planmain.h

Simplify API for initially hooking custom-path providers into the planner.

commit   : c2ea2285e978d9289084846a3343cef7d261d880    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Nov 2014 14:05:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Nov 2014 14:05:46 -0500    

Click here for diff

Instead of register_custom_path_provider and a CreateCustomScanPath  
callback, let's just provide a standard function hook in set_rel_pathlist.  
This is more flexible than what was previously committed, is more like the  
usual conventions for planner hooks, and requires less support code in the  
core.  We had discussed this design (including centralizing the  
set_cheapest() calls) back in March or so, so I'm not sure why it wasn't  
done like this already.  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h

Fix an error in psql that overcounted output lines.

commit   : 4077fb4d1d34ad04dfb95ba676c2b43ea1f1da53    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 21 Nov 2014 12:37:09 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 21 Nov 2014 12:37:09 -0500    

Click here for diff

This error counted the first line of a cell as "extra". The effect was  
to cause far too frequent invocation of the pager. In most cases this  
can be worked around (for example, by using the "less" pager with the -F  
flag), so don't backpatch.  

M src/bin/psql/print.c

Make psql's \sf and \ef honor ECHO_HIDDEN.

commit   : e4d28175a13d47a747b33e87c0f808b2ef57c0cd    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 21 Nov 2014 12:14:05 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 21 Nov 2014 12:14:05 -0500    

Click here for diff

These commands were calling the database direct rather than  calling  
PSQLexec like other slash commands that needed database data.  
  
The code is also changed not to pass the connection as a parameter to  
the helper functions. It's available in a global variable, and that's  
what PSQLexec uses.  

M src/bin/psql/command.c

No need to call XLogEnsureRecordSpace when the relation is unlogged.

commit   : 622983ea6964fc55f1ad3063d3d7b8f5de8e8816    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 15:13:15 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 15:13:15 +0200    

Click here for diff

Amit Kapila  

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

Add a comment to regress.c explaining what it contains.

commit   : b10a97b819a2594c97188bac02d87b550908a692    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 15:07:29 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 15:07:29 +0200    

Click here for diff

Ian Barwick  

M src/test/regress/regress.c

Fix bogus comments in XLogRecordAssemble

commit   : 8f5dcb56cb1877f7ed6b0f3f72cc26c4e060aa61    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 12:13:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 12:13:10 +0200    

Click here for diff

Pointed out by Michael Paquier  

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

Add pageinspect functions for inspecting GIN indexes.

commit   : 3a82bc6f8ab38be3ed095f1c86866900b145f0f6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 11:46:50 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Nov 2014 11:46:50 +0200    

Click here for diff

Patch by me, Peter Geoghegan and Michael Paquier, reviewed by Amit Kapila.  

M contrib/pageinspect/Makefile
A contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/pageinspect–1.2–1.3.sql
M contrib/pageinspect/pageinspect–1.3.sql
M doc/src/sgml/pageinspect.sgml

Remove dead code supporting mark/restore in SeqScan, TidScan, ValuesScan.

commit   : adbfab119b308a7e0e6b1305de9be222cfd5c85b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 20:20:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 20:20:54 -0500    

Click here for diff

There seems no prospect that any of this will ever be useful, and indeed  
it's questionable whether some of it would work if it ever got called;  
it's certainly not been exercised in a very long time, if ever. So let's  
get rid of it, and make the comments about mark/restore in execAmi.c less  
wishy-washy.  
  
The mark/restore support for Result nodes is also currently dead code,  
but that's due to planner limitations not because it's impossible that  
it could be useful.  So I left it in.  

M src/backend/access/heap/heapam.c
M src/backend/executor/execAmi.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeValuesscan.c
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeValuesscan.h
M src/include/nodes/execnodes.h

Initial code review for CustomScan patch.

commit   : a34fa8ee7cc757671632dc4dcae4f21e8f2e2357    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 18:36:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 18:36:07 -0500    

Click here for diff

Get rid of the pernicious entanglement between planner and executor headers  
introduced by commit 0b03e5951bf0a1a8868db13f02049cf686a82165.  
  
Also, rearrange the CustomFoo struct/typedef definitions so that all the  
typedef names are seen as used by the compiler.  Without this pgindent  
will mess things up a bit, which is not so important perhaps, but it also  
removes a bizarre discrepancy between the declaration arrangement used for  
CustomExecMethods and that used for CustomScanMethods and  
CustomPathMethods.  
  
Clean up the commentary around ExecSupportsMarkRestore to reflect the  
rather large change in its API.  
  
Const-ify register_custom_path_provider's argument.  This necessitates  
casting away const in the function, but that seems better than forcing  
callers of the function to do so (or else not const-ify their method  
pointer structs, which was sort of the whole point).  
  
De-export fix_expr_common.  I don't like the exporting of fix_scan_expr  
or replace_nestloop_params either, but this one surely has got little  
excuse.  

M src/backend/executor/execAmi.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/pathnode.c
M src/include/executor/executor.h
M src/include/executor/nodeCustom.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h

Fix another oversight in CustomScan patch.

commit   : 081a6048cff07a83591ebcb08b676a771ae58d2b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 15:56:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 15:56:39 -0500    

Click here for diff

execCurrent.c's search_plan_tree() must recognize a CustomScan on the  
target relation.  This would only be helpful for custom providers that  
support CurrentOfExpr quals, which is probably a bit far-fetched, but  
it's not impossible I think.  But even without assuming that, we need  
to recognize a scanned-relation match so that we will properly throw  
error if the desired relation is being scanned with both a CustomScan  
and a regular scan (ie, self-join).  
  
Also recognize ForeignScanState for similar reasons.  Supporting WHERE  
CURRENT OF on a foreign table is probably even more far-fetched than  
it is for custom scans, but I think in principle you could do it with  
postgres_fdw (or another FDW that supports the ctid column).  This  
would be a back-patchable bug fix if existing FDWs handled CurrentOfExpr,  
but I doubt any do so I won't bother back-patching.  

M src/backend/executor/execCurrent.c

Fix another oversight in CustomScan patch.

commit   : 03e574af5f5d4682ce3ae6dc401ba126c70ce2ea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 14:49:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 14:49:02 -0500    

Click here for diff

disuse_physical_tlist() must work for all plan types handled by  
create_scan_plan().  

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

Remove no-longer-needed phony typedefs in genbki.h.

commit   : c5111ea9ca049a650b63cdcb2551c330c2f998b1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 13:16:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 13:16:14 -0500    

Click here for diff

Now that we have a policy of hiding varlena catalog fields behind  
"#ifdef CATALOG_VARLEN", there is no need for their type names to be  
acceptable to the C compiler.  And experimentation shows that it does  
not matter to pgindent either.  (If it did, we'd have problems anyway,  
since these typedefs are unreferenced so far as the C compiler is  
concerned, and find_typedef fails to identify such typedefs.)  
  
Hence, remove the phony typedefs that genbki.h provided to make  
some varlena field definitions compilable.  
  
In passing, rearrange #define's into what seemed a more logical order.  

M src/include/catalog/genbki.h

Add missing case for CustomScan.

commit   : f9e0255c6fbedda50aae6aa7479f0c5a8f90b831    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 12:32:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Nov 2014 12:32:19 -0500    

Click here for diff

Per KaiGai Kohei.  
  
In passing improve formatting of some code added in commit 30d7ae3c,  
because otherwise pgindent will make a mess of it.  

M src/backend/commands/explain.c

Silence compiler warning about variable being used uninitialized.

commit   : f464042161fb980578c33fedc2742c5a4d941fa2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 20 Nov 2014 19:16:12 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 20 Nov 2014 19:16:12 +0200    

Click here for diff

It's a false positive - the variable is only used when 'onleft' is true,  
and it is initialized in that case. But the compiler doesn't necessarily  
see that.  

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

Revamp the WAL record format.

commit   : 2c03216d831160bedd72d45f712601b6f7d03f1c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 20 Nov 2014 17:56:26 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 20 Nov 2014 17:56:26 +0200    

Click here for diff

Each WAL record now carries information about the modified relation and  
block(s) in a standardized format. That makes it easier to write tools that  
need that information, like pg_rewind, prefetching the blocks to speed up  
recovery, etc.  
  
There's a whole new API for building WAL records, replacing the XLogRecData  
chains used previously. The new API consists of XLogRegister* functions,  
which are called for each buffer and chunk of data that is added to the  
record. The new API also gives more control over when a full-page image is  
written, by passing flags to the XLogRegisterBuffer function.  
  
This also simplifies the XLogReadBufferForRedo() calls. The function can dig  
the relation and block number from the WAL record, so they no longer need to  
be passed as arguments.  
  
For the convenience of redo routines, XLogReader now disects each WAL record  
after reading it, copying the main data part and the per-block data into  
MAXALIGNed buffers. The data chunks are not aligned within the WAL record,  
but the redo routines can assume that the pointers returned by XLogRecGet*  
functions are. Redo routines are now passed the XLogReaderState, which  
contains the record in the already-disected format, instead of the plain  
XLogRecord.  
  
The new record format also makes the fixed size XLogRecord header smaller,  
by removing the xl_len field. The length of the "main data" portion is now  
stored at the end of the WAL record, and there's a separate header after  
XLogRecord for it. The alignment padding at the end of XLogRecord is also  
removed. This compansates for the fact that the new format would otherwise  
be more bulky than the old format.  
  
Reviewed by Andres Freund, Amit Kapila, Michael Paquier, Alvaro Herrera,  
Fujii Masao.  

M contrib/pg_xlogdump/pg_xlogdump.c
M contrib/pg_xlogdump/rmgrdesc.h
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/dbasedesc.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/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.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/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/README
M src/backend/access/transam/clog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/storage.c
M src/backend/commands/dbcommands.c
M src/backend/commands/sequence.c
M src/backend/commands/tablespace.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/cache/relmapper.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/brin_xlog.h
M src/include/access/clog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/heapam_xlog.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/spgist.h
M src/include/access/spgist_private.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/catalog/storage_xlog.h
M src/include/commands/dbcommands.h
M src/include/commands/sequence.h
M src/include/commands/tablespace.h
M src/include/replication/decode.h
M src/include/storage/standby.h
M src/include/utils/relmapper.h

Fix suggested layout for PGXS makefile

commit   : 8dc626defec23016dd5988208d8704b858b9d21d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Nov 2014 22:21:54 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Nov 2014 22:21:54 -0500    

Click here for diff

Custom rules must come after pgxs inclusion, not before, because any  
rule added before pgxs will break the default 'all' target.  
  
Author: Cédric Villemain <[email protected]>  

M src/makefiles/pgxs.mk

Improve documentation's description of JOIN clauses.

commit   : 8372304e3594a1d67737df779f098d9ae9937603    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Nov 2014 16:00:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Nov 2014 16:00:24 -0500    

Click here for diff

In bug #12000, Andreas Kunert complained that the documentation was  
misleading in saying "FROM T1 CROSS JOIN T2 is equivalent to FROM T1, T2".  
That's correct as far as it goes, but the equivalence doesn't hold when  
you consider three or more tables, since JOIN binds more tightly than  
comma.  I added a <note> to explain this, and ended up rearranging some  
of the existing text so that the note would make sense in context.  
  
In passing, rewrite the description of JOIN USING, which was unnecessarily  
vague, and hadn't been helped any by somebody's reliance on markup as a  
substitute for clear writing.  (Mostly this involved reintroducing a  
concrete example that was unaccountably removed by commit 032f3b7e166cfa28.)  
  
Back-patch to all supported branches.  

M doc/src/sgml/queries.sgml

Add test cases for indexam operations not currently covered.

commit   : 88fc71926392115cdc3672807f3903ce43d0ebcf    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 19 Nov 2014 19:24:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 19 Nov 2014 19:24:58 +0200    

Click here for diff

That includes VACUUM on GIN, GiST and SP-GiST indexes, and B-tree indexes  
large enough to cause page deletions in B-tree. Plus some other special  
cases.  
  
After this patch, the regression tests generate all different WAL record  
types. Not all branches within the redo functions are covered, but it's a  
step forward.  

M src/test/regress/expected/btree_index.out
A src/test/regress/expected/gin.out
A src/test/regress/expected/gist.out
A src/test/regress/expected/spgist.out
M src/test/regress/output/misc.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/btree_index.sql
A src/test/regress/sql/gin.sql
A src/test/regress/sql/gist.sql
A src/test/regress/sql/spgist.sql

Avoid file descriptor leak in pg_test_fsync.

commit   : a0165553619107f990cb7872f4a9573598319581    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 19 Nov 2014 11:57:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 19 Nov 2014 11:57:54 -0500    

Click here for diff

This can cause problems on Windows, where files that are still open  
can't be unlinked.  
  
Jeff Janes  

M contrib/pg_test_fsync/pg_test_fsync.c

Fix bug in the test of file descriptor of current WAL file in pg_receivexlog.

commit   : d5f4df7264ec73abda41eb78b81cf430b33f7606    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 19 Nov 2014 19:10:04 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 19 Nov 2014 19:10:04 +0900    

Click here for diff

In pg_receivexlog, in order to check whether the current WAL file is  
being opened or not, its file descriptor has to be checked against -1  
as an invalid value. But, oops, 7900e94 added the incorrect test  
checking the descriptor against 1. This commit fixes that bug.  
  
Back-patch to 9.4 where the bug was added.  
  
Spotted by Magnus Hagander  

M src/bin/pg_basebackup/receivelog.c

Fix pg_receivexlog --slot so that it doesn't prevent the server shutdown.

commit   : f66c20b317578838a39a1de8014c4363bdc98b9a    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 19 Nov 2014 14:11:12 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 19 Nov 2014 14:11:12 +0900    

Click here for diff

When pg_receivexlog --slot is connecting to the server, at the shutdown  
of the server, walsender keeps waiting for the last WAL record to be  
replicated and flushed in pg_receivexlog. But previously pg_receivexlog  
issued sync command only when WAL file was switched. So there was  
the case where the last WAL was never flushed and walsender had to  
keep waiting infinitely. This caused the server shutdown to get stuck.  
  
pg_recvlogical handles this problem by calling fsync() when it receives  
the request of immediate reply from the server. That is, at shutdown,  
walsender sends the request, pg_recvlogical receives it, flushes the last  
WAL record, and sends the flush location back to the server. Since  
walsender can see that the last WAL record is successfully flushed, it can  
exit cleanly.  
  
This commit introduces the same logic as pg_recvlogical has,  
to pg_receivexlog.  
  
Back-patch to 9.4 where pg_receivexlog was changed so that it can use  
the replication slot.  
  
Original patch by Michael Paquier, rewritten by me.  
Bug report by Furuya Osamu.  

M src/bin/pg_basebackup/receivelog.c

Don't require bleeding-edge timezone data in timestamptz regression test.

commit   : 8d7af8fbe7349cbebb576459c9b5f54dfcc6216a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Nov 2014 21:36:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Nov 2014 21:36:39 -0500    

Click here for diff

The regression test cases added in commits b2cbced9e et al depended in part  
on the Russian timezone offset changes of Oct 2014.  While this is of no  
particular concern for a default Postgres build, it was possible for a  
build using --with-system-tzdata to fail the tests if the system tzdata  
database wasn't au courant.  Bjorn Munch and Christoph Berg both complained  
about this while packaging 9.4rc1, so we probably shouldn't insist on the  
system tzdata being up-to-date.  Instead, make an equivalent test using a  
zone change that occurred in Venezuela in 2007.  With this patch, the  
regression tests should pass using any tzdata set from 2012 or later.  
(I can't muster much sympathy for somebody using --with-system-tzdata  
on a machine whose system tzdata is more than three years out-of-date.)  

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

Update comments in find_typedef.

commit   : 7aa8d9e56c18b1df9d924f144c06d921131a137e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Nov 2014 15:51:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Nov 2014 15:51:45 -0500    

Click here for diff

These comments don't seem to have been touched in a long time.  Make them  
describe the current implementation rather than what was here last century,  
and be a bit more explicit about the unreferenced-typedefs issue.  

M src/tools/find_typedef

Fix some bogus direct uses of realloc().

commit   : 8b13e5c6c0e8a6b797370fb91d207031df5e784a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Nov 2014 13:28:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Nov 2014 13:28:06 -0500    

Click here for diff

pg_dump/parallel.c was using realloc() directly with no error check.  
While the odds of an actual failure here seem pretty low, Coverity  
complains about it, so fix by using pg_realloc() instead.  
  
While looking for other instances, I noticed a couple of places in  
psql that hadn't gotten the memo about the availability of pg_realloc.  
These aren't bugs, since they did have error checks, but verbosely  
inconsistent code is not a good thing.  
  
Back-patch as far as 9.3.  9.2 did not have pg_dump/parallel.c, nor  
did it have pg_realloc available in all frontend code.  

M src/bin/pg_dump/parallel.c
M src/bin/psql/command.c
M src/bin/psql/tab-complete.c

Reduce btree scan overhead for < and > strategies

commit   : 606c0123d627b37d5ac3f7c2c97cd715dde7842f    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 18 Nov 2014 10:24:55 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 18 Nov 2014 10:24:55 +0000    

Click here for diff

For <, <=, > and >= strategies, mark the first scan key  
as already matched if scanning in an appropriate direction.  
If index tuple contains no nulls we can skip the first  
re-check for each tuple.  
  
Author: Rajeev Rastogi  
Reviewer: Haribabu Kommi  
Rework of the code and comments by Simon Riggs  

M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Remove obsolete debugging option, RTDEBUG.

commit   : dedae6c211415290cdf5faca4ef874f803af204c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Nov 2014 09:55:05 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Nov 2014 09:55:05 +0200    

Click here for diff

The r-tree AM that used it was removed back in 2005.  
  
Peter Geoghegan  

M src/include/pg_config_manual.h

Add pg_dump --snapshot option

commit   : be1cc8f46f57a04e69d9e4dd268d34da885fe6eb    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 17 Nov 2014 22:15:07 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 17 Nov 2014 22:15:07 +0000    

Click here for diff

Allows pg_dump to use a snapshot previously defined by a concurrent  
session that has either used pg_export_snapshot() or obtained a  
snapshot when creating a logical slot. When this option is used with  
parallel pg_dump, the snapshot defined by this option is used and no  
new snapshot is taken.  
  
Simon Riggs and Michael Paquier  

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

Update 9.4 release notes for commits through today.

commit   : 832054044f68080eaebccd771e21fdd56824db20    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Nov 2014 14:47:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Nov 2014 14:47:10 -0500    

Click here for diff

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

Add --synchronous option to pg_receivexlog, for more reliable WAL writing.

commit   : c4f99d20294950576d552dcaf9ce5b9bdc4233a3    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 18 Nov 2014 02:32:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 18 Nov 2014 02:32:48 +0900    

Click here for diff

Previously pg_receivexlog flushed WAL data only when WAL file was switched.  
Then 3dad73e added -F option to pg_receivexlog so that users could control  
how frequently sync commands were issued to WAL files. It also allowed users  
to make pg_receivexlog flush WAL data immediately after writing by  
specifying 0 in -F option. However feedback messages were not sent back  
immediately even after a flush location was updated. So even if WAL data  
was flushed in real time, the server could not see that for a while.  
  
This commit removes -F option from and adds --synchronous to pg_receivexlog.  
If --synchronous is specified, like the standby's wal receiver, pg_receivexlog  
flushes WAL data as soon as there is WAL data which has not been flushed yet.  
Then it sends back the feedback message identifying the latest flush location  
to the server. This option is useful to make pg_receivexlog behave as sync  
standby by using replication slot, for example.  
  
Original patch by Furuya Osamu, heavily rewritten by me.  
Reviewed by Heikki Linnakangas, Alvaro Herrera and Sawada Masahiko.  

M doc/src/sgml/ref/pg_receivexlog.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h

Update time zone data files to tzdata release 2014j.

commit   : bc241488b0f9bde3e14094bfaf0d7987fafb6600    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Nov 2014 12:08:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Nov 2014 12:08:02 -0500    

Click here for diff

DST law changes in the Turks & Caicos Islands (America/Grand_Turk) and  
in Fiji.  New zone Pacific/Bougainville for portions of Papua New Guinea.  
Historical changes for Korea and Vietnam.  

M src/timezone/data/africa
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backzone
M src/timezone/data/europe
M src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab
M src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Pacific.txt

commit   : c73669c0e0168923e3f9e787beec980f55af2bd8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Nov 2014 18:42:04 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Nov 2014 18:42:04 +0200    

Click here for diff

There was some confusion on how to record the case that the operation  
unlinks the last non-leaf page in the branch being deleted.  
_bt_unlink_halfdead_page set the "topdead" field in the WAL record to  
the leaf page, but the redo routine assumed that it would be an invalid  
block number in that case. This commit fixes _bt_unlink_halfdead_page to  
do what the redo routine expected.  
  
This code is new in 9.4, so backpatch there.  

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

Fix relpersistence setting in reindex_index

commit   : 0f9692b40d1292f1b2640f026561908fd37b7407    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Nov 2014 11:23:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Nov 2014 11:23:35 -0300    

Click here for diff

Buildfarm members with CLOBBER_CACHE_ALWAYS advised us that commit  
85b506bbfc2937 was mistaken in setting the relpersistence value of the  
index directly in the relcache entry, within reindex_index.  The reason  
for the failure is that an invalidation message that comes after mucking  
with the relcache entry directly, but before writing it to the catalogs,  
would cause the entry to become rebuilt in place from catalogs with the  
old contents, losing the update.  
  
Fix by passing the correct persistence value to  
RelationSetNewRelfilenode instead; this routine also writes the updated  
tuple to pg_class, avoiding the problem.  Suggested by Tom Lane.  

M src/backend/catalog/index.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/utils/relcache.h

Translation updates

commit   : 7466a1b75f01c10c2eb33ed50663fe27f66194e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 16 Nov 2014 21:31:08 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 16 Nov 2014 21:31:08 -0500    

Click here for diff

M src/backend/po/de.po
M src/backend/po/pl.po
M src/backend/po/ru.po
M src/bin/initdb/po/pl.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/pl.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_controldata/nls.mk
M src/bin/pg_controldata/po/pl.po
A src/bin/pg_controldata/po/sv.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/psql/po/de.po
M src/bin/psql/po/pl.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/pl.po
M src/interfaces/ecpg/preproc/po/pl.po
M src/pl/plpgsql/src/po/pl.po
M src/pl/plpython/po/pl.po

Mention the TZ environment variable for initdb

commit   : d883b916a947a3c6b1b88d386d5add62862bf8cf    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 16 Nov 2014 15:48:30 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 16 Nov 2014 15:48:30 +0100    

Click here for diff

Daniel Gustafsson  

M doc/src/sgml/ref/initdb.sgml

Restructure doc sections about statistics views

commit   : 386c9b73839bd4cae489451122801c31496d20e8    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 16 Nov 2014 13:47:44 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 16 Nov 2014 13:47:44 +0100    

Click here for diff

Break out the "dynamic statistics" views in the table from the  
"collected statistics" ones. Could do with some more refactoring,  
but this is a start.  

M doc/src/sgml/monitoring.sgml

Emit msg re skipping ANALYZE for absent inh tree

commit   : 0f66d2120154e51960a21062b214d468782d8554    
  
author   : Simon Riggs <[email protected]>    
date     : Sat, 15 Nov 2014 22:49:54 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Sat, 15 Nov 2014 22:49:54 +0000    

Click here for diff

When checking a table that has an inheritance tree marked,  
if no child tables remain, we skip ANALYZE. This patch emits  
a message to show that the action has been skipped.  
  
Author: Etsuro Fujita  
Reviewer: Furuya Osamu  

M src/backend/commands/analyze.c

Get rid of SET LOGGED indexes persistence kludge

commit   : 85b506bbfc2937c9abdfcce4e01a8feca8e64ee8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 15 Nov 2014 01:19:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 15 Nov 2014 01:19:49 -0300    

Click here for diff

This removes ATChangeIndexesPersistence() introduced by f41872d0c1239d36  
which was too ugly to live for long.  Instead, the correct persistence  
marking is passed all the way down to reindex_index, so that the  
transient relation built to contain the index relfilenode can  
get marked correctly right from the start.  
  
Author: Fabrízio de Royes Mello  
Review and editorialization by Michael Paquier  
                                     and Álvaro Herrera  

M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/index.h
M src/include/commands/cluster.h

Remove unused InhPaths

commit   : e4d1e264918f4019c86c807e7c349658f7a10397    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 15 Nov 2014 01:19:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 15 Nov 2014 01:19:39 -0300    

Click here for diff

Allegedly, the last remaining usages of that struct were removed by  
0e99be1c.  
  
Author: Peter Geoghegan  

M src/include/parser/parse_func.h

postgres_fdw.h: don't pull in rel.h when relcache.h is enough

commit   : f9ef578d050c509d0f4bc02b3c0a3a0497056a2a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 21:48:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 21:48:53 -0300    

Click here for diff

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

Fix initdb --sync-only to also sync tablespaces.

commit   : 522c85a6a27b614589543eddb68a4c8f7fcac901    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 18:22:12 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 18:22:12 +0100    

Click here for diff

630cd14426dc added initdb --sync-only, for use by pg_upgrade, by just  
exposing the existing fsync code. That's wrong, because initdb so far  
had absolutely no reason to deal with tablespaces.  
  
Fix --sync-only by additionally explicitly syncing each of the  
tablespaces.  
  
Backpatch to 9.3 where --sync-only was introduced.  
  
Abhijit Menon-Sen and Andres Freund  

M src/bin/initdb/initdb.c

Sync unlogged relations to disk after they have been reset.

commit   : 98ec7fd903bbd4ab1694de5aaa4f7bb62935c58d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 18:21:30 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 18:21:30 +0100    

Click here for diff

Unlogged relations are only reset when performing a unclean  
restart. That means they have to be synced to disk during clean  
shutdowns. During normal processing that's achieved by registering a  
buffer's file to be fsynced at the next checkpoint when flushed. But  
ResetUnloggedRelations() doesn't go through the buffer manager, so  
nothing will force reset relations to disk before the next shutdown  
checkpoint.  
  
So just make ResetUnloggedRelations() fsync the newly created main  
forks to disk.  
  
Discussion: [email protected]  
  
Backpatch to 9.1 where unlogged tables were introduced.  
  
Abhijit Menon-Sen and Andres Freund  

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

Ensure unlogged tables are reset even if crash recovery errors out.

commit   : d3586fc8aa5d9365a5c50cb5e555971eb633a4ec    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 18:20:59 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 18:20:59 +0100    

Click here for diff

Unlogged relations are reset at the end of crash recovery as they're  
only synced to disk during a proper shutdown. Unfortunately that and  
later steps can fail, e.g. due to running out of space. This reset  
was, up to now performed after marking the database as having finished  
crash recovery successfully. As out of space errors trigger a crash  
restart that could lead to the situation that not all unlogged  
relations are reset.  
  
Once that happend usage of unlogged relations could yield errors like  
"could not open file "...": No such file or directory". Luckily  
clusters that show the problem can be fixed by performing a immediate  
shutdown, and starting the database again.  
  
To fix, just call ResetUnloggedRelations(UNLOGGED_RELATION_INIT)  
earlier, before marking the database as having successfully recovered.  
  
Discussion: [email protected]  
  
Backpatch to 9.1 where unlogged tables were introduced.  
  
Abhijit Menon-Sen and Andres Freund  

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

Document evaluation-order considerations for aggregate functions.

commit   : 0ce627d465f534a3234750a5b398664dfece4102    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Nov 2014 17:19:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Nov 2014 17:19:29 -0500    

Click here for diff

The SELECT reference page didn't really address the question of when  
aggregate function evaluation occurs, nor did the "expression evaluation  
rules" documentation mention that CASE can't be used to control whether  
an aggregate gets evaluated or not.  Improve that.  
  
Per discussion of bug #11661.  Original text by Marti Raudsepp and Michael  
Paquier, rewritten significantly by me.  

M doc/src/sgml/ref/select.sgml
M doc/src/sgml/syntax.sgml

Clean up includes from RLS patch

commit   : 80eacaa3cdcd10383c333f6f4625af8cee1f7bee    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 14 Nov 2014 16:53:51 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 14 Nov 2014 16:53:51 -0500    

Click here for diff

The initial patch for RLS mistakenly included headers associated with  
the executor and planner bits in rewrite/rowsecurity.h.  Per policy and  
general good sense, executor headers should not be included in planner  
headers or vice versa.  
  
The include of execnodes.h was a mistaken holdover from previous  
versions, while the include of relation.h was used for Relation's  
definition, which should have been coming from utils/relcache.h.  This  
patch cleans these issues up, adds comments to the RowSecurityPolicy  
struct and the RowSecurityConfigType enum, and changes Relation->rsdesc  
to Relation->rd_rsdesc to follow Relation field naming convention.  
  
Additionally, utils/rel.h was including rewrite/rowsecurity.h, which  
wasn't a great idea since that was pulling in things not really needed  
in utils/rel.h (which gets included in quite a few places).  Instead,  
use 'struct RowSecurityDesc' for the rd_rsdesc field and add comments  
explaining why.  
  
Lastly, add an include into access/nbtree/nbtsort.c for  
utils/sortsupport.h, which was evidently missed due to the above mess.  
  
Pointed out by Tom in [email protected]; note that the  
concerns regarding a similar situation in the custom-path commit still  
need to be addressed.  

M src/backend/access/nbtree/nbtsort.c
M src/backend/commands/policy.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/cache/relcache.c
M src/include/rewrite/rowsecurity.h
M src/include/utils/rel.h

Document BRIN's pages_per_range in CREATE INDEX

commit   : 79172a58ea3e858750c93c61d55411a209c5ac69    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 17:36:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 17:36:10 -0300    

Click here for diff

Author: Michael Paquier  

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

Revert change to ALTER TABLESPACE summary.

commit   : 155c0f24b7d370eb57fb8dde0447e11e41c405c2    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 14 Nov 2014 15:16:01 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 14 Nov 2014 15:16:01 -0500    

Click here for diff

When ALTER TABLESPACE MOVE ALL was changed to be ALTER TABLE ALL IN  
TABLESPACE, the ALTER TABLESPACE summary should have been adjusted back  
to its original definition.  
  
Patch by Thom Brown (thanks!).  

M doc/src/sgml/ref/alter_tablespace.sgml

Reduce disk footprint of brin regression test

commit   : 86cf9a565069755189e08290343d2d62afdd1f52    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 16:27:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 16:27:26 -0300    

Click here for diff

Per complaint from Tom.  
  
While at it, throw in some extra tests for nulls as well, and make sure  
that the set of data we insert on the second round is not identical to  
the first one.  Both measures are intended to improve coverage of the  
test.  
  
Also uncomment the ON COMMIT DROP clause on the CREATE TEMP TABLE  
commands.  This doesn't have any effect for someone examining the  
regression database after the tests are done, but it reduces clutter for  
those that execute the script directly.  

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

Allow interrupting GetMultiXactIdMembers

commit   : 51f9ea25dc4296948eb851a851bb60e0860c70a1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 15:14:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Nov 2014 15:14:01 -0300    

Click here for diff

This function has a loop which can lead to uninterruptible process  
"stalls" (actually infinite loops) when some bugs are triggered.  Avoid  
that unpleasant situation by adding a check for interrupts in a place  
that shouldn't degrade performance in the normal case.  
  
Backpatch to 9.3.  Older branches have an identical loop here, but the  
aforementioned bugs are only a problem starting in 9.3 so there doesn't  
seem to be any point in backpatching any further.  

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

Move BufferGetBlockNumber() out of heap_page_is_all_visible()'s inner loop.

commit   : 0c5af0a537a2d6320eb8ef7f401401aa1f47b79e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 17:04:44 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 17:04:44 +0100    

Click here for diff

In some workloads BufferGetBlockNumber() shows up in profiles due to  
the sheer number of calls to it (and because it causes cache  
misses). The compiler can't move it out of the loop because it's a  
full extern function call...  

M src/backend/commands/vacuumlazy.c

Add valgrind suppression for pg_atomic_init_u64.

commit   : 6c878edc1df9d4d9ad7ed4a7e1c34c0bf0f622b9    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 16:58:00 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 16:58:00 +0100    

Click here for diff

pg_atomic_init_u64 (indirectly) uses compare/exchange to guarantee  
atomic writes on platforms where compare/exchange is available, but  
64bit writes aren't atomic (yes, those exist). That leads to a  
harmless read of the initial value of variable.  

M src/tools/valgrind.supp

Improve logical decoding log messages

commit   : a15d387c22b794b0d2d037ce9f7b379ea8f153c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Nov 2014 20:43:55 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Nov 2014 20:43:55 -0500    

Click here for diff

suggestions from Robert Haas  

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

Adapt valgrind.supp to the XLogInsert() split.

commit   : 473f162ce1faabeb2d572b9805311081919e5deb    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 00:59:40 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Nov 2014 00:59:40 +0100    

Click here for diff

The CRC computation now happens in XLogInsertRecord(), not  
XLogInsert() itself anymore.  

M src/tools/valgrind.supp

Fix pg_dumpall to restore its ability to dump from ancient servers.

commit   : be09ceb21882507bff95d74bad0ebe25efc227bd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Nov 2014 18:19:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Nov 2014 18:19:26 -0500    

Click here for diff

Fix breakage induced by commits d8d3d2a4f37f6df5d0118b7f5211978cca22091a  
and 463f2625a5fb183b6a8925ccde98bb3889f921d9: pg_dumpall has crashed when  
attempting to dump from pre-8.1 servers since then, due to faulty  
construction of the query used for dumping roles from older servers.  
The query was erroneous as of the earlier commit, but it wasn't exposed  
unless you tried to use --binary-upgrade, which you presumably wouldn't  
with a pre-8.1 server.  However commit 463f2625a made it fail always.  
  
In HEAD, also fix additional breakage induced in the same query by  
commit 491c029dbc4206779cf659aa0ff986af7831d2ff, which evidently wasn't  
tested against pre-8.1 servers either.  
  
The bug is only latent in 9.1 because 463f2625a hadn't landed yet, but  
it seems best to back-patch all branches containing the faulty query.  
  
Gilles Darold  

M src/bin/pg_dump/pg_dumpall.c

Fix and improve cache invalidation logic for logical decoding.

commit   : 89fd41b390a46202937f647043043d5b0a4eadae    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Nov 2014 19:06:43 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Nov 2014 19:06:43 +0100    

Click here for diff

There are basically three situations in which logical decoding needs  
to perform cache invalidation. During/After replaying a transaction  
with catalog changes, when skipping a uninteresting transaction that  
performed catalog changes and when erroring out while replaying a  
transaction. Unfortunately these three cases were all done slightly  
differently - partially because 8de3e410fa, which greatly simplifies  
matters, got committed in the midst of the development of logical  
decoding.  
  
The actually problematic case was when logical decoding skipped  
transaction commits (and thus processed invalidations). When used via  
the SQL interface cache invalidation could access the catalog - bad,  
because we didn't set up enough state to allow that correctly. It'd  
not be hard to setup sufficient state, but the simpler solution is to  
always perform cache invalidation outside a valid transaction.  
  
Also make the different cache invalidation cases look as similar as  
possible, to ease code review.  
  
This fixes the assertion failure reported by Antonin Houska in  
[email protected]. The presented testcase has been expanded  
into a regression test.  
  
Backpatch to 9.4, where logical decoding was introduced.  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/decoding_into_rel.out
A contrib/test_decoding/sql/decoding_into_rel.sql
M src/backend/replication/logical/reorderbuffer.c

Fix xmin/xmax horizon computation during logical decoding initialization.

commit   : 5a2c184058c51a41b855b9e824102d1395402ffa    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Nov 2014 19:06:43 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Nov 2014 19:06:43 +0100    

Click here for diff

When building the initial historic catalog snapshot there were  
scenarios where snapbuild.c would use incorrect xmin/xmax values when  
starting from a xl_running_xacts record. The values used were always a  
bit suspect, but happened to be correct in the easy to test  
cases. Notably the values used when the the initial snapshot was  
computed while no other transactions were running were correct.  
  
This is likely to be the cause of the occasional buildfarm failures on  
animals markhor and tick; but it's quite possible to reproduce  
problems without CLOBBER_CACHE_ALWAYS.  
  
Backpatch to 9.4, where logical decoding was introduced.  

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

Fix race condition between hot standby and restoring a full-page image.

commit   : 81c45081960f39351c38cd53554bb3788af54023    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Nov 2014 19:47:44 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Nov 2014 19:47:44 +0200    

Click here for diff

There was a window in RestoreBackupBlock where a page would be zeroed out,  
but not yet locked. If a backend pinned and locked the page in that window,  
it saw the zeroed page instead of the old page or new page contents, which  
could lead to missing rows in a result set, or errors.  
  
To fix, replace RBM_ZERO with RBM_ZERO_AND_LOCK, which atomically pins,  
zeroes, and locks the page, if it's not in the buffer cache already.  
  
In stable branches, the old RBM_ZERO constant is renamed to RBM_DO_NOT_USE,  
to avoid breaking any 3rd party extensions that might use RBM_ZERO. More  
importantly, this avoids renumbering the other enum values, which would  
cause even bigger confusion in extensions that use ReadBufferExtended, but  
haven't been recompiled.  
  
Backpatch to all supported versions; this has been racy since hot standby  
was introduced.  

M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/xlogutils.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Tweak row-level locking documentation

commit   : 35fed51626328a3ff54adae4749bef956e1e1099    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Nov 2014 14:45:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Nov 2014 14:45:55 -0300    

Click here for diff

Move the meat of locking levels to mvcc.sgml, leaving only a link to it  
in the SELECT reference page.  
  
Michael Paquier, with some tweaks by Álvaro  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/select.sgml

Move the guts of our Levenshtein implementation into core.

commit   : c0828b78e930a4e085ec52f19fdc850104cb0659    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 13 Nov 2014 12:25:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 13 Nov 2014 12:25:10 -0500    

Click here for diff

The hope is that we can use this to produce better diagnostics in  
some cases.  
  
Peter Geoghegan, reviewed by Michael Paquier, with some further  
changes by me.  

M contrib/fuzzystrmatch/Makefile
M contrib/fuzzystrmatch/fuzzystrmatch.c
M src/backend/utils/adt/Makefile
R085 contrib/fuzzystrmatch/levenshtein.c src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/varlena.c
M src/include/utils/builtins.h

doc: Add index entry for "hypothetical-set aggregate"

commit   : 1d69ae419d04fa7919fa282224a566499f3a0fd0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Nov 2014 11:57:16 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Nov 2014 11:57:16 -0500    

Click here for diff

M doc/src/sgml/func.sgml

Fix XLogReadBufferForRedoExtended to get cleanup lock when asked to do so.

commit   : 34402ae351e71f852a6c2fee7861a66d0dbeb24c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Nov 2014 17:54:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Nov 2014 17:54:20 +0200    

Click here for diff

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

Rename pending_list_cleanup_size to gin_pending_list_limit.

commit   : c291503b1c8250c7ba6ca900b7ba2f85a64b1eb6    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 13 Nov 2014 12:14:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 13 Nov 2014 12:14:48 +0900    

Click here for diff

Since this parameter is only for GIN index, it's better to  
add "gin" to the parameter name for easier understanding.  

M doc/src/sgml/config.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginutil.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.c
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Explicitly support the case that a plancache's raw_parse_tree is NULL.

commit   : 677708032c4a4d37cdb2a4bd45726fc260308db7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Nov 2014 15:58:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Nov 2014 15:58:37 -0500    

Click here for diff

This only happens if a client issues a Parse message with an empty query  
string, which is a bit odd; but since it is explicitly called out as legal  
by our FE/BE protocol spec, we'd probably better continue to allow it.  
  
Fix by adding tests everywhere that the raw_parse_tree field is passed to  
functions that don't or shouldn't accept NULL.  Also make it clear in the  
relevant comments that NULL is an expected case.  
  
This reverts commits a73c9dbab0165b3395dfe8a44a7dfd16166963c4 and  
2e9650cbcff8c8fb0d9ef807c73a44f241822eee, which fixed specific crash  
symptoms by hacking things at what now seems to be the wrong end, ie the  
callee functions.  Making the callees allow NULL is superficially more  
robust, but it's not always true that there is a defensible thing for the  
callee to do in such cases.  The caller has more context and is better  
able to decide what the empty-query case ought to do.  
  
Per followup discussion of bug #11335.  Back-patch to 9.2.  The code  
before that is sufficiently different that it would require development  
of a separate patch, which doesn't seem worthwhile for what is believed  
to be an essentially cosmetic change.  

M src/backend/executor/spi.c
M src/backend/parser/analyze.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/plancache.c
M src/include/utils/plancache.h

Fix several weaknesses in slot and logical replication on-disk serialization.

commit   : ec5896aed3c01da24c1f335f138817e9890d68b6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Nov 2014 18:52:49 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Nov 2014 18:52:49 +0100    

Click here for diff

Heikki noticed in [email protected] that slot.c and  
snapbuild.c were missing the FIN_CRC32 call when computing/checking  
checksums of on disk files. That doesn't lower the the error detection  
capabilities of the checksum, but is inconsistent with other usages.  
  
In a followup mail Heikki also noticed that, contrary to a comment,  
the 'version' and 'length' struct fields of replication slot's on disk  
data where not covered by the checksum. That's not likely to lead to  
actually missed corruption as those fields are cross checked with the  
expected version and the actual file length. But it's wrong  
nonetheless.  
  
As fixing these issues makes existing on disk files unreadable, bump  
the expected versions of on disk files for both slots and logical  
decoding historic catalog snapshots.  This means that loading old  
files will fail with  
ERROR: "replication slot file ... has unsupported version 1"  
and  
ERROR: "snapbuild state file ... has unsupported version 1 instead of  
2" respectively. Given the low likelihood of anybody already using  
these new features in a production setup that seems acceptable.  
  
Fixing these issues made me notice that there's no regression test  
covering the loading of historic snapshot from disk - so add one.  
  
Backpatch to 9.4 where these features were introduced.  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/ondisk_startup.out
A contrib/test_decoding/specs/ondisk_startup.spec
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c

Add interrupt checks to contrib/pg_prewarm.

commit   : bd4ae0f396b36955c92f26c0058e7dc0452db817    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Nov 2014 18:52:49 +0100    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Nov 2014 18:52:49 +0100    

Click here for diff

Currently the extension's pg_prewarm() function didn't check  
interrupts once it started "warming" data. Since individual calls can  
take a long while it's important for them to be interruptible.  
  
Backpatch to 9.4 where pg_prewarm was introduced.  

M contrib/pg_prewarm/pg_prewarm.c

Use just one database connection in the "tablespace" test.

commit   : 28245b8424e29808f4f714482077a762cab0c5c5    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 12 Nov 2014 07:33:17 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 12 Nov 2014 07:33:17 -0500    

Click here for diff

On Windows, DROP TABLESPACE has a race condition when run concurrently  
with other processes having opened files in the tablespace.  This led to  
a rare failure on buildfarm member frogmouth.  Back-patch to 9.4, where  
the reconnection was introduced.  

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

Message improvements

commit   : 8339f33d68e08d24eb316971a0ac73af162d52b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 11 Nov 2014 20:00:58 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 11 Nov 2014 20:00:58 -0500    

Click here for diff

M src/backend/libpq/auth.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/utils/misc/guc.c

Remove incorrect comment.

commit   : f1abd78be7c7dc6fce7edaf9262998f3ca3d14be    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Nov 2014 18:36:20 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Nov 2014 18:36:20 -0500    

Click here for diff

This was introduced by commit 5ea86e6e65dd2da3e9a3464484985d48328e7fe3.  
  
Peter Geoghegan  

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

Loop when necessary in contrib/pgcrypto's pktreader_pull().

commit   : f2ad2bdd0abfb1ce8f274fbb01a82e209f4cc122    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Nov 2014 17:22:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Nov 2014 17:22:15 -0500    

Click here for diff

This fixes a scenario in which pgp_sym_decrypt() failed with "Wrong key  
or corrupt data" on messages whose length is 6 less than a power of 2.  
  
Per bug #11905 from Connor Penhale.  Fix by Marko Tiikkaja, regression  
test case from Jeff Janes.  

M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/sql/pgp-decrypt.sql

Fix dependency searching for case where column is visited before table.

commit   : 2edfc021c64ac2b15c9e9f9ada037ad12150bfa9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Nov 2014 17:00:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Nov 2014 17:00:11 -0500    

Click here for diff

When the recursive search in dependency.c visits a column and then later  
visits the whole table containing the column, it needs to propagate the  
drop-context flags for the table to the existing target-object entry for  
the column.  Otherwise we might refuse the DROP (if not CASCADE) on the  
incorrect grounds that there was no automatic drop pathway to the column.  
Remarkably, this has not been reported before, though it's possible at  
least when an extension creates both a datatype and a table using that  
datatype.  
  
Rather than just marking the column as allowed to be dropped, it might  
seem good to skip the DROP COLUMN step altogether, since the later DROP  
of the table will surely get the job done.  The problem with that is that  
the datatype would then be dropped before the table (since the whole  
situation occurred because we visited the datatype, and then recursed to  
the dependent column, before visiting the table).  That seems pretty risky,  
and the case is rare enough that it doesn't seem worth expending a lot of  
effort or risk to make the drops happen in a safe order.  So we just play  
dumb and delete the column separately according to the existing drop  
ordering rules.  
  
Per report from Petr Jelinek, though this is different from his proposed  
patch.  
  
Back-patch to 9.1, where extensions were introduced.  There's currently  
no evidence that such cases can arise before 9.1, and in any case we would  
also need to back-patch cb5c2ba2d82688d29b5902d86b993a54355cad4d to 9.0  
if we wanted to back-patch this.  

M src/backend/catalog/dependency.c

Add generate_series(numeric, numeric).

commit   : 1871c892021055532344266d7429b63f76a892c2    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 11 Nov 2014 21:44:46 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 11 Nov 2014 21:44:46 +0900    

Click here for diff

Платон Малюгин  
Reviewed by Michael Paquier, Ali Akbar and Marti Raudsepp  

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.h
M src/include/utils/builtins.h
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Add GUC and storage parameter to set the maximum size of GIN pending list.

commit   : a1b395b6a26ae80cde17fdfd2def8d351872f399    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 11 Nov 2014 21:08:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 11 Nov 2014 21:08:21 +0900    

Click here for diff

Previously the maximum size of GIN pending list was controlled only by  
work_mem. But the reasonable value of work_mem and the reasonable size  
of the list are basically not the same, so it was not appropriate to  
control both of them by only one GUC, i.e., work_mem. This commit  
separates new GUC, pending_list_cleanup_size, from work_mem to allow  
users to control only the size of the list.  
  
Also this commit adds pending_list_cleanup_size as new storage parameter  
to allow users to specify the size of the list per index. This is useful,  
for example, when users want to increase the size of the list only for  
the GIN index which can be updated heavily, and decrease it otherwise.  
  
Reviewed by Etsuro Fujita.  

M doc/src/sgml/config.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginutil.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.c
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/utils/guc.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Really fix compilation failure on MIPS.

commit   : ae667f778d9b7b8ed5a9a8b93abd868690a8ae14    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 11 Nov 2014 10:25:22 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 11 Nov 2014 10:25:22 +0200    

Click here for diff

I missed an additional colon in previous patch. Oops. to make that mistake  
less likely in the future, add comments as placeholders for unused inputs  
and outputs in inline assembly.  

M src/include/storage/s_lock.h

Fix compilation failure on MIPS.

commit   : baf7b3a503342f263558b7dbf6d3c694622ab3c5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 11 Nov 2014 01:04:57 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 11 Nov 2014 01:04:57 +0200    

Click here for diff

Rémi Zara  

M src/include/storage/s_lock.h

BRIN: fix bug in xlog backup block counting

commit   : a590f266e44c492d2a252ab9dee0cd88dbe06dc5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 10 Nov 2014 18:13:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 10 Nov 2014 18:13:49 -0300    

Click here for diff

The code that generates the BRIN_XLOG_UPDATE removes the buffer  
reference when the page that's target for the updated tuple is freshly  
initialized.  This is a pretty usual optimization, but was breaking the  
case where the revmap buffer, which is referenced in the same WAL  
record, is getting a backup block: the replay code was using backup  
block index 1, which is not valid when the update target buffer gets  
pruned; the revmap buffer gets assigned 0 instead.  Make sure to use the  
correct backup block index for revmap when replaying.  
  
Bug reported by Fujii Masao.  

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

Fix potential NULL-pointer dereference.

commit   : c8df9477f8ce48b202de989984f90dd78e1bba31    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 10 Nov 2014 15:19:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 10 Nov 2014 15:19:56 -0500    

Click here for diff

Commit 2781b4bea7db357be59f9a5fd73ca1eb12ff5a79 arranged to defer  
the setup of after-trigger-related data structures, but  
AfterTriggerPendingOnRel didn't get the memo.  

M src/backend/commands/trigger.c

Ensure that RowExprs and whole-row Vars produce the expected column names.

commit   : bf7ca15875988a88e97302e012d7c4808bef3ea9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Nov 2014 15:21:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Nov 2014 15:21:09 -0500    

Click here for diff

At one time it wasn't terribly important what column names were associated  
with the fields of a composite Datum, but since the introduction of  
operations like row_to_json(), it's important that looking up the rowtype  
ID embedded in the Datum returns the column names that users would expect.  
That did not work terribly well before this patch: you could get the column  
names of the underlying table, or column aliases from any level of the  
query, depending on minor details of the plan tree.  You could even get  
totally empty field names, which is disastrous for cases like row_to_json().  
  
To fix this for whole-row Vars, look to the RTE referenced by the Var, and  
make sure its column aliases are applied to the rowtype associated with  
the result Datums.  This is a tad scary because we might have to return  
a transient RECORD type even though the Var is declared as having some  
named rowtype.  In principle it should be all right because the record  
type will still be physically compatible with the named rowtype; but  
I had to weaken one Assert in ExecEvalConvertRowtype, and there might be  
third-party code containing similar assumptions.  
  
Similarly, RowExprs have to be willing to override the column names coming  
from a named composite result type and produce a RECORD when the column  
aliases visible at the site of the RowExpr differ from the underlying  
table's column names.  
  
In passing, revert the decision made in commit 398f70ec070fe601 to add  
an alias-list argument to ExecTypeFromExprList: better to provide that  
functionality in a separate function.  This also reverts most of the code  
changes in d68581483564ec0f, which we don't need because we're no longer  
depending on the tupdesc found in the child plan node's result slot to be  
blessed.  
  
Back-patch to 9.4, but not earlier, since this solution changes the results  
in some cases that users might not have realized were buggy.  We'll apply a  
more restricted form of this patch in older branches.  

M src/backend/executor/execQual.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeValuesscan.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Further code and wording tweaks in BRIN

commit   : 1e0b4365c22c9f8a1bc7a5f8339f770c767b402f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 10 Nov 2014 15:56:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 10 Nov 2014 15:56:08 -0300    

Click here for diff

Besides a couple of typo fixes, per David Rowley, Thom Brown, and Amit  
Langote, and mentions of BRIN in the general CREATE INDEX page again per  
David, this includes silencing MSVC compiler warnings (thanks Microsoft)  
and an additional variable initialization per Coverity scanner.  

M doc/src/sgml/brin.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/brin/README
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_tuple.c

Fix compiler warning for non-assert builds.

commit   : 96a73fcdace57f0f631c1f56d1cb8a7a0773e93f    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 10 Nov 2014 09:42:46 -0600    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 10 Nov 2014 09:42:46 -0600    

Click here for diff

Reported by Peter Geoghegan  
David Rowley  

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

Tab complete second argument to \c with role names.

commit   : 095d40123cedcdfa81c55f0de113067d95370d57    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 10 Nov 2014 08:15:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 10 Nov 2014 08:15:17 -0500    

Click here for diff

Ian Barwick  

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

C comment: mention 1500-02-29 as an invalid date

commit   : 67067f9ae35fcaf7c1a6f3258043cbd0a0380473    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 9 Nov 2014 20:50:15 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 9 Nov 2014 20:50:15 -0500    

Click here for diff

It is invalid because the Gregorian calendar is used for all years.  

M src/include/utils/datetime.h

Fix some coding issues in BRIN

commit   : b89ee54e20e722bb91f388667586a2e0986f197b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 8 Nov 2014 00:31:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 8 Nov 2014 00:31:03 -0300    

Click here for diff

Reported by David Rowley: variadic macros are a problem.  Get rid of  
them using a trick suggested by Tom Lane: add extra parentheses where  
needed.  In the future we might decide we don't need the calls at all  
and remove them, but it seems appropriate to keep them while this code  
is still new.  
  
Also from David Rowley: brininsert() was trying to use a variable before  
initializing it.  Fix by moving the brin_form_tuple call (which  
initializes the variable) to within the locked section.  
  
Reported by Peter Eisentraut: can't use "new" as a struct member name,  
because C++ compilers will choke on it, as reported by cpluspluscheck.  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/include/access/brin_internal.h
M src/include/access/brin_xlog.h

pg_basebackup: Adjust tests for long file name issues

commit   : 926f5cea472676b8378f02cd80c2c5f86226d981    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Nov 2014 20:47:38 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Nov 2014 20:47:38 -0500    

Click here for diff

Work around accidental test failures because the working directory path  
is too long by creating a temporary directory in the (hopefully shorter)  
system location, symlinking that to the working directory, and creating  
the tablespaces using the shorter path.  

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

doc: Update pg_receivexlog note

commit   : 552faefd68f1cec6bbaf0a038d8d410b59edb17f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Nov 2014 20:15:22 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Nov 2014 20:15:22 -0500    

Click here for diff

The old note about how to use pg_receivexlog as an alternative to  
archive_command was obsoleted by replication slots.  

M doc/src/sgml/ref/pg_receivexlog.sgml

Introduce custom path and scan providers.

commit   : 0b03e5951bf0a1a8868db13f02049cf686a82165    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Nov 2014 17:26:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Nov 2014 17:26:02 -0500    

Click here for diff

This allows extension modules to define their own methods for  
scanning a relation, and get the core code to use them.  It's  
unclear as yet how much use this capability will find, but we  
won't find out if we never commit it.  
  
KaiGai Kohei, reviewed at various times and in various levels  
of detail by Shigeru Hanada, Tom Lane, Andres Freund, Álvaro  
Herrera, and myself.  

M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execProcnode.c
A src/backend/executor/nodeCustom.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/executor.h
A src/include/executor/nodeCustom.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h

Fix building with WAL_DEBUG.

commit   : 7250d8535b11d6443a9b27299e586c3df0654302    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Nov 2014 23:04:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Nov 2014 23:04:53 +0200    

Click here for diff

Now that the backup blocks are appended to the WAL record in xloginsert.c,  
XLogInsert doesn't see them anymore and cannot remove them from the version  
reconstructed for xlog_outdesc. This makes running with wal_debug=on more  
expensive, as we now make (unnecessary) temporary copies of the backup  
blocks, but it doesn't seem worth convoluting the code to keep that  
optimization.  
  
Reported by Alvaro Herrera.  

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

Use the sortsupport infrastructure in more cases.

commit   : 5ea86e6e65dd2da3e9a3464484985d48328e7fe3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Nov 2014 15:50:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Nov 2014 15:50:09 -0500    

Click here for diff

This removes some fmgr overhead from cases such as btree index builds.  
  
Peter Geoghegan, reviewed by Andreas Karlsson and me.  

M src/backend/access/nbtree/nbtsort.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

Update pg_xlogdump's .gitignore for brindesc.c.

commit   : 99e8f08fab6fb8a10cb5ef060b9e4973b671d27d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 7 Nov 2014 15:41:52 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 7 Nov 2014 15:41:52 -0500    

Click here for diff

M contrib/pg_xlogdump/.gitignore

Fix serial schedule

commit   : 0e892e04efdc92abf53260e0bb0092cc48060e22    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Nov 2014 17:05:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Nov 2014 17:05:26 -0300    

Click here for diff

Test misc depends on brin, but it was earlier in the serial schedule  
file.  I didn't notice this because I only run the parallel schedule,  
but the buildfarm exposed my folly ...  

M src/test/regress/serial_schedule

BRIN: Block Range Indexes

commit   : 7516f5259411c02ae89e49084452dc342aadb2ae    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Nov 2014 16:38:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Nov 2014 16:38:14 -0300    

Click here for diff

BRIN is a new index access method intended to accelerate scans of very  
large tables, without the maintenance overhead of btrees or other  
traditional indexes.  They work by maintaining "summary" data about  
block ranges.  Bitmap index scans work by reading each summary tuple and  
comparing them with the query quals; all pages in the range are returned  
in a lossy TID bitmap if the quals are consistent with the values in the  
summary tuple, otherwise not.  Normal index scans are not supported  
because these indexes do not store TIDs.  
  
As new tuples are added into the index, the summary information is  
updated (if the block range in which the tuple is added is already  
summarized) or not; in the latter case, a subsequent pass of VACUUM or  
the brin_summarize_new_values() function will create the summary  
information.  
  
For data types with natural 1-D sort orders, the summary info consists  
of the maximum and the minimum values of each indexed column within each  
page range.  This type of operator class we call "Minmax", and we  
supply a bunch of them for most data types with B-tree opclasses.  
Since the BRIN code is generalized, other approaches are possible for  
things such as arrays, geometric types, ranges, etc; even for things  
such as enum types we could do something different than minmax with  
better results.  In this commit I only include minmax.  
  
Catalog version bumped due to new builtin catalog entries.  
  
There's more that could be done here, but this is a good step forwards.  
  
Loosely based on ideas from Simon Riggs; code mostly by Álvaro Herrera,  
with contribution by Heikki Linnakangas.  
  
Patch reviewed by: Amit Kapila, Heikki Linnakangas, Robert Haas.  
Testing help from Jeff Janes, Erik Rijkers, Emanuel Calvo.  
  
PS:  
  The research leading to these results has received funding from the  
  European Union's Seventh Framework Programme (FP7/2007-2013) under  
  grant agreement n° 318633.  

M contrib/pageinspect/Makefile
A contrib/pageinspect/brinfuncs.c
A contrib/pageinspect/pageinspect–1.2–1.3.sql
R071 contrib/pageinspect/pageinspect–1.2.sql contrib/pageinspect/pageinspect–1.3.sql
M contrib/pageinspect/pageinspect.control
M contrib/pg_xlogdump/rmgrdesc.c
A doc/src/sgml/brin.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/postgres.sgml
M src/backend/access/Makefile
A src/backend/access/brin/Makefile
A src/backend/access/brin/README
A src/backend/access/brin/brin.c
A src/backend/access/brin/brin_minmax.c
A src/backend/access/brin/brin_pageops.c
A src/backend/access/brin/brin_revmap.c
A src/backend/access/brin/brin_tuple.c
A src/backend/access/brin/brin_xlog.c
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/Makefile
A src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/transam/rmgr.c
M src/backend/catalog/index.c
M src/backend/replication/logical/decode.c
M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/selfuncs.c
A src/include/access/brin.h
A src/include/access/brin_internal.h
A src/include/access/brin_page.h
A src/include/access/brin_pageops.h
A src/include/access/brin_revmap.h
A src/include/access/brin_tuple.h
A src/include/access/brin_xlog.h
M src/include/access/heapam.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rmgrlist.h
M src/include/catalog/catversion.h
M src/include/catalog/index.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_proc.h
M src/include/storage/bufpage.h
M src/include/utils/selfuncs.h
A src/test/regress/expected/brin.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/output/misc.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/brin.sql
M src/test/regress/sql/opr_sanity.sql

Fix generation of SP-GiST vacuum WAL records.

commit   : 1961b1c131e4211f3dc86ff2be971e430ab2a23d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Nov 2014 21:14:35 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Nov 2014 21:14:35 +0200    

Click here for diff

I broke these in 8776faa81cb651322b8993422bdd4633f1f6a487. Backpatch to  
9.4, where that was done.  

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

Remove obsolete cases from GiST update redo code.

commit   : 2effb72e682a7dbdc9a8a60a80c22ec1fa9d8079    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Nov 2014 15:03:46 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Nov 2014 15:03:46 +0200    

Click here for diff

The code that generated a record to clear the F_TUPLES_DELETED flag hasn't  
existed since we got rid of old-style VACUUM FULL. I kept the code that sets  
the flag, although it's not used for anything anymore, because it might  
still be interesting information for debugging purposes that some tuples  
have been deleted from a page.  
  
Likewise, the code to turn the root page from non-leaf to leaf page was  
removed when we got rid of old-style VACUUM FULL. Remove the code to replay  
that action, too.  

M src/backend/access/gist/gistxlog.c
M src/include/access/gist.h

Cope with more than 64K phrases in a thesaurus dictionary.

commit   : d6e37b35cda9a88dfd938dd61e9986dd93cc6dd3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Nov 2014 20:52:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Nov 2014 20:52:40 -0500    

Click here for diff

dict_thesaurus stored phrase IDs in uint16 fields, so it would get confused  
and even crash if there were more than 64K entries in the configuration  
file.  It turns out to be basically free to widen the phrase IDs to uint32,  
so let's just do so.  
  
This was complained of some time ago by David Boutin (in bug #7793);  
he later submitted an informal patch but it was never acted on.  
We now have another complaint (bug #11901 from Luc Ouellette) so it's  
time to make something happen.  
  
This is basically Boutin's patch, but for future-proofing I also added a  
defense against too many words per phrase.  Note that we don't need any  
explicit defense against overflow of the uint32 counters, since before that  
happens we'd hit array allocation sizes that repalloc rejects.  
  
Back-patch to all supported branches because of the crash risk.  

M src/backend/tsearch/dict_thesaurus.c

Fix normalization of numeric values in JSONB GIN indexes.

commit   : 4875931938b27924fe8d6f91bbdb09e2e5a29d0a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Nov 2014 11:41:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Nov 2014 11:41:06 -0500    

Click here for diff

The default JSONB GIN opclass (jsonb_ops) converts numeric data values  
to strings for storage in the index.  It must ensure that numeric values  
that would compare equal (such as 12 and 12.00) produce identical strings,  
else index searches would have behavior different from regular JSONB  
comparisons.  Unfortunately the function charged with doing this was  
completely wrong: it could reduce distinct numeric values to the same  
string, or reduce equivalent numeric values to different strings.  The  
former type of error would only lead to search inefficiency, but the  
latter type of error would cause index entries that should be found by  
a search to not be found.  
  
Repairing this bug therefore means that it will be necessary for 9.4 beta  
testers to reindex GIN jsonb_ops indexes, if they care about getting  
correct results from index searches involving numeric data values within  
the comparison JSONB object.  
  
Per report from Thomas Fanghaenel.  

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

Prevent the unnecessary creation of .ready file for the timeline history file.

commit   : 5332b8cec54192c5d7b0ad67dc5668ccb917eeef    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 6 Nov 2014 21:24:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 6 Nov 2014 21:24:40 +0900    

Click here for diff

Previously .ready file was created for the timeline history file at the end  
of an archive recovery even when WAL archiving was not enabled.  
This creation is unnecessary and causes .ready file to remain infinitely.  
  
This commit changes an archive recovery so that it creates .ready file for  
the timeline history file only when WAL archiving is enabled.  
  
Backpatch to all supported versions.  

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

Move the backup-block logic from XLogInsert to a new file, xloginsert.c.

commit   : 2076db2aea766c4c828dccc34ae35f614129000d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Nov 2014 13:52:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Nov 2014 13:52:08 +0200    

Click here for diff

xlog.c is huge, this makes it a little bit smaller, which is nice. Functions  
related to putting together the WAL record are in xloginsert.c, and the  
lower level stuff for managing WAL buffers and such are in xlog.c.  
  
Also move the definition of XLogRecord to a separate header file. This  
causes churn in the #includes of all the files that write WAL records, and  
redo routines, but it avoids pulling in xlog.h into most places.  
  
Reviewed by Michael Paquier, Alvaro Herrera, Andres Freund and Amit Kapila.  

M contrib/pg_xlogdump/pg_xlogdump.c
M doc/src/sgml/wal.sgml
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/Makefile
M src/backend/access/transam/clog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
A src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/heap.c
M src/backend/catalog/namespace.c
M src/backend/catalog/storage.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/matview.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/txid.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/init/postinit.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/tqual.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/clog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/heapam_xlog.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
A src/include/access/xloginsert.h
A src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/catalog/storage_xlog.h
M src/include/commands/dbcommands.h
M src/include/commands/sequence.h
M src/include/commands/tablespace.h
M src/include/replication/decode.h
M src/include/storage/standby.h
M src/include/utils/relmapper.h

Fix typo in comment.

commit   : d2b8a2c7ec1098e7b98160ccdc0e3a513964fb08    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 6 Nov 2014 20:04:11 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 6 Nov 2014 20:04:11 +0900    

Click here for diff

Etsuro Fujita  

M src/backend/commands/matview.c

Implement IF NOT EXIST for CREATE INDEX.

commit   : 08309aaf74ee879699165ec8a2d53e56f2d2e947    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 6 Nov 2014 18:48:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 6 Nov 2014 18:48:33 +0900    

Click here for diff

Fabrízio de Royes Mello, reviewed by Marti Raudsepp, Adam Brightwell and me.  

M doc/src/sgml/ref/create_index.sgml
M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/catalog/index.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

C comment: mention why the Gregorian calendar is used pre-1582

commit   : 171c377a0abe12d1418540dc154feccd9355995e    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 6 Nov 2014 02:33:05 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 6 Nov 2014 02:33:05 -0500    

Click here for diff

M src/include/utils/datetime.h

Remove the last vestige of server-side autocommit.

commit   : 525a489915cad1c5b2fc39e43e8005025afe63b2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Nov 2014 19:35:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Nov 2014 19:35:23 -0500    

Click here for diff

Long ago we briefly had an "autocommit" GUC that turned server-side  
autocommit on and off.  That behavior was removed in 7.4 after concluding  
that it broke far too much client-side logic, and making clients cope with  
both behaviors was impractical.  But the GUC variable was left behind, so  
as not to break any client code that might be trying to read its value.  
Enough time has now passed that we should remove the GUC completely.  
Whatever vestigial backwards-compatibility benefit it had is outweighed by  
the risk of confusion for newbies who assume it ought to do something,  
as per a recent complaint from Wolfgang Wilhelm.  
  
In passing, adjust what seemed to me a rather confusing documentation  
reference to libpq's autocommit behavior.  libpq as such knows nothing  
about autocommit, so psql is probably what was meant.  

M doc/src/sgml/ecpg.sgml
M src/backend/utils/misc/check_guc
M src/backend/utils/misc/guc.c

Fix thinko in commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d.

commit   : c30be9787bd9808631b72843b0a93f06ce775dd0    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Nov 2014 17:12:23 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Nov 2014 17:12:23 -0500    

Click here for diff

Obviously, every translation unit should not be declaring this  
separately.  It needs to be PGDLLIMPORT as well, to avoid breaking  
third-party code that uses any of the functions that the commit  
mentioned above changed to macros.  

M src/backend/libpq/pqcomm.c
M src/include/libpq/libpq.h

Make CREATE TYPE print warnings if a datatype's I/O functions are volatile.

commit   : 465d7e1882bc1f316c7cb2a68e751c34b403e8d7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Nov 2014 11:44:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Nov 2014 11:44:06 -0500    

Click here for diff

This is a followup to commit 43ac12c6e6e397fd9142ed908447eba32d3785b2,  
which added regression tests checking that I/O functions of built-in  
types are not marked volatile.  Complaining in CREATE TYPE should push  
developers of add-on types to fix any misdeclared functions in their  
types.  It's just a warning not an error, to avoid creating upgrade  
problems for what might be just cosmetic mis-markings.  
  
Aside from adding the warning code, fix a number of types that were  
sloppily created in the regression tests.  

M src/backend/commands/typecmds.c
M src/test/regress/expected/create_cast.out
M src/test/regress/expected/create_type.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/sql/create_cast.sql
M src/test/regress/sql/create_type.sql

Fix volatility markings of some contrib I/O functions.

commit   : 66c029c842629958b3ae0d389f24ea3407225723    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Nov 2014 11:34:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Nov 2014 11:34:11 -0500    

Click here for diff

In general, datatype I/O functions are supposed to be immutable or at  
worst stable.  Some contrib I/O functions were, through oversight, not  
marked with any volatility property at all, which made them VOLATILE.  
Since (most of) these functions actually behave immutably, the erroneous  
marking isn't terribly harmful; but it can be user-visible in certain  
circumstances, as per a recent bug report from Joe Van Dyk in which a  
cast to text was disallowed in an expression index definition.  
  
To fix, just adjust the declarations in the extension SQL scripts.  If we  
were being very fussy about this, we'd bump the extension version numbers,  
but that seems like more trouble (for both developers and users) than the  
problem is worth.  
  
A fly in the ointment is that chkpass_in actually is volatile, because  
of its use of random() to generate a fresh salt when presented with a  
not-yet-encrypted password.  This is bad because of the general assumption  
that I/O functions aren't volatile: the consequence is that records or  
arrays containing chkpass elements may have input behavior a bit different  
from a bare chkpass column.  But there seems no way to fix this without  
breaking existing usage patterns for chkpass, and the consequences of the  
inconsistency don't seem bad enough to justify that.  So for the moment,  
just document it in a comment.  
  
Since we're not bumping version numbers, there seems no harm in  
back-patching these fixes; at least future installations will get the  
functions marked correctly.  

M contrib/chkpass/chkpass–1.0.sql
M contrib/ltree/ltree–1.0.sql
M contrib/pg_trgm/pg_trgm–1.1.sql

doc: Move misplaced paragraph

commit   : e809fa2c80e051ed49a3ed2206dc055a10d588a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Nov 2014 16:10:58 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Nov 2014 16:10:58 -0500    

Click here for diff

M doc/src/sgml/protocol.sgml

Drop no-longer-needed buffers during ALTER DATABASE SET TABLESPACE.

commit   : 33f80f8480434f02beb940b8f0627d534f3fd3af    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Nov 2014 13:24:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Nov 2014 13:24:06 -0500    

Click here for diff

The previous coding assumed that we could just let buffers for the  
database's old tablespace age out of the buffer arena naturally.  
The folly of that is exposed by bug #11867 from Marc Munro: the user could  
later move the database back to its original tablespace, after which any  
still-surviving buffers would match lookups again and appear to contain  
valid data.  But they'd be missing any changes applied while the database  
was in the new tablespace.  
  
This has been broken since ALTER SET TABLESPACE was introduced, so  
back-patch to all supported branches.  

M src/backend/commands/dbcommands.c

Switch to CRC-32C in WAL and other places.

commit   : 5028f22f6eb0579890689655285a4778b4ffc460    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Nov 2014 11:35:15 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Nov 2014 11:35:15 +0200    

Click here for diff

The old algorithm was found to not be the usual CRC-32 algorithm, used by  
Ethernet et al. We were using a non-reflected lookup table with code meant  
for a reflected lookup table. That's a strange combination that AFAICS does  
not correspond to any bit-wise CRC calculation, which makes it difficult to  
reason about its properties. Although it has worked well in practice, seems  
safer to use a well-known algorithm.  
  
Since we're changing the algorithm anyway, we might as well choose a  
different polynomial. The Castagnoli polynomial has better error-correcting  
properties than the traditional CRC-32 polynomial, even if we had  
implemented it correctly. Another reason for picking that is that some new  
CPUs have hardware support for calculating CRC-32C, but not CRC-32, let  
alone our strange variant of it. This patch doesn't add any support for such  
hardware, but a future patch could now do that.  
  
The old algorithm is kept around for tsquery and pg_trgm, which use the  
values in indexes that need to remain compatible so that pg_upgrade works.  
While we're at it, share the old lookup table for CRC-32 calculation  
between hstore, ltree and core. They all use the same table, so might as  
well.  

M contrib/hstore/Makefile
D contrib/hstore/crc32.c
D contrib/hstore/crc32.h
M contrib/hstore/hstore_gist.c
M contrib/ltree/crc32.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/cache/relmapper.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_crc_tables.h

Remove support for 64-bit CRC.

commit   : 404bc51cde9dce1c674abe4695635612f08fe27e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Nov 2014 11:33:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 4 Nov 2014 11:33:08 +0200    

Click here for diff

It hasn't been used for anything for a long time.  

M src/include/utils/pg_crc.h
M src/include/utils/pg_crc_tables.h

pqmq.h needs to include something that defines StringInfo.

commit   : 585e0b9b277ad3b17a582b20daa8d09bd0ace8bd    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Nov 2014 12:23:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Nov 2014 12:23:08 -0500    

Click here for diff

Reported by Peter Eisentraut.  

M src/include/libpq/pqmq.h

Docs: fix incorrect spelling of contrib/pgcrypto option.

commit   : f443de873e500de999a2d165731a0356b79a6ed7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Nov 2014 11:11:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Nov 2014 11:11:34 -0500    

Click here for diff

pgp_sym_encrypt's option is spelled "sess-key", not "enable-session-key".  
Spotted by Jeff Janes.  
  
In passing, improve a comment in pgp-pgsql.c to make it clearer that  
the debugging options are intentionally undocumented.  

M contrib/pgcrypto/pgp-pgsql.c
M doc/src/sgml/pgcrypto.sgml

Remove dead-since-introduction pgcrypto code.

commit   : 1ed8e771ade6f2a58728f4537e9c19b702d8cf25    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:39 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:39 -0500    

Click here for diff

Marko Tiikkaja  

M contrib/pgcrypto/pgp-decrypt.c

Clarify .def file comments.

commit   : c40212baf6c093b4958c6e04ddde94869788a572    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:33 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:33 -0500    

Click here for diff

M src/Makefile.shlib

Re-remove dependency on the DLL of pythonxx.def file.

commit   : 00c07e497f31e44ddf971e2d5f14240971ed5175    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:30 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:30 -0500    

Click here for diff

The reasons behind commit 0d147e43adcf5d2bff9caa073608f381a27439bf still  
stand, so this reverts the non-cosmetic portion of commit  
a7983e989d9cafc9cef49becfee054e34b1ed9b4.  Back-patch to 9.4, where the  
latter commit first appeared.  

M src/pl/plpython/Makefile

Make ECPG test programs depend on "ecpg$(X)", not "ecpg".

commit   : 67a412049489f554c3a552bd523cefd30d038221    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:25 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:25 -0500    

Click here for diff

Cygwin builds require this of dependencies pertaining to pattern rules.  
On Cygwin, stat("foo") in the absence of a file with that exact name can  
locate foo.exe.  While GNU make uses stat() for dependencies of ordinary  
rules, it uses readdir() to assess dependencies of pattern rules.  
Therefore, a pattern rule dependency should match any underlying file  
name exactly.  Back-patch to 9.4, where the dependency was introduced.  

M src/interfaces/ecpg/test/Makefile.regress

commit   : 846319521753af63c8f9b0893a116adc0a70e936    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:20 -0500    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Nov 2014 21:43:20 -0500    

Click here for diff

Back-patch to 9.2, like commit db29620d4d16e08241f965ccd70d0f65883ff0de.  

M src/port/win32setlocale.c

Fix generation of INSTALL file by removing link

commit   : 9522efdae11c7bb3e12cd4bf070399d5417ac405    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 2 Nov 2014 20:17:32 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 2 Nov 2014 20:17:32 -0500    

Click here for diff

M doc/src/sgml/installation.sgml

Add configure --enable-tap-tests option

commit   : a409b464f91e0bdf61f2b3fb81218a0e4312987b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 2 Nov 2014 09:14:36 -0500    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 2 Nov 2014 09:14:36 -0500    

Click here for diff

Don't skip the TAP tests anymore when IPC::Run is not found.  This will  
fail normally now.  

M configure
M configure.in
M doc/src/sgml/installation.sgml
M doc/src/sgml/regress.sgml
M src/Makefile.global.in
M src/test/perl/TestLib.pm

PL/Python: Fix example

commit   : 3e81a33d799ed8c12847eb8ef1685563eeb10e7d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 1 Nov 2014 11:31:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 1 Nov 2014 11:31:35 -0400    

Click here for diff

Revert "6f6b46c9c0ca3d96acbebc5499c32ee6369e1eec", which was broken.  
  
Reported-by: Jonathan Rogers <[email protected]>  

M doc/src/sgml/plpython.sgml

Support frontend-backend protocol communication using a shm_mq.

commit   : 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 31 Oct 2014 12:02:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 31 Oct 2014 12:02:40 -0400    

Click here for diff

A background worker can use pq_redirect_to_shm_mq() to direct protocol  
that would normally be sent to the frontend to a shm_mq so that another  
process may read them.  
  
The receiving process may use pq_parse_errornotice() to parse an  
ErrorResponse or NoticeResponse from the background worker and, if  
it wishes, ThrowErrorData() to propagate the error (with or without  
further modification).  
  
Patch by me.  Review by Andres Freund.  

M src/backend/libpq/Makefile
M src/backend/libpq/pqcomm.c
A src/backend/libpq/pqmq.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/error/elog.c
M src/include/libpq/libpq.h
A src/include/libpq/pqmq.h
M src/include/utils/builtins.h
M src/include/utils/elog.h

doc: Fix typos

commit   : 252e652edea80b948fbc9c3723183065e94d8480    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 31 Oct 2014 08:11:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 31 Oct 2014 08:11:06 -0400    

Click here for diff

per Andres Freund  

M doc/src/sgml/logicaldecoding.sgml

doc: Wording and formatting improvements in new logical decoding docs

commit   : 50709a1d427831d48a5aa14655e9f57e3721a06b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Oct 2014 22:52:21 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Oct 2014 22:52:21 -0400    

Click here for diff

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml

doc: Improve CREATE VIEW / WITH documentation

commit   : 5bd91e3a835b5d5499fee5f49fc7c0c776fe63dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Oct 2014 22:50:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Oct 2014 22:50:02 -0400    

Click here for diff

Similar to 590eb0c14eebe834f716721a9659b77899cf3084, remove the options  
list from the synopsis and elaborate in the main description.  

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

Extend dsm API with a new function dsm_unpin_mapping.

commit   : f7102b04638a882b38cbba7670471a073a939865    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Oct 2014 14:55:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Oct 2014 14:55:23 -0400    

Click here for diff

This reassociates a dynamic shared memory handle previous passed to  
dsm_pin_mapping with the current resource owner, so that it will be  
cleaned up at the end of the current query.  
  
Patch by me.  Review of the function name by Andres Freund, Amit  
Kapila, Jim Nasby, Petr Jelinek, and Álvaro Herrera.  

M src/backend/storage/ipc/dsm.c
M src/include/storage/dsm.h

Test IsInTransactionChain, not IsTransactionBlock, in vac_update_relstats.

commit   : fd0f651a867ce4a25160e37bcb9085f3b3209bf8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Oct 2014 13:03:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Oct 2014 13:03:22 -0400    

Click here for diff

As noted by Noah Misch, my initial cut at fixing bug #11638 didn't cover  
all cases where ANALYZE might be invoked in an unsafe context.  We need to  
test the result of IsInTransactionChain not IsTransactionBlock; which is  
notationally a pain because IsInTransactionChain requires an isTopLevel  
flag, which would have to be passed down through several levels of callers.  
I chose to pass in_outer_xact (ie, the result of IsInTransactionChain)  
rather than isTopLevel per se, as that seemed marginally more apropos  
for the intermediate functions to know about.  

M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/include/commands/vacuum.h

"Pin", rather than "keep", dynamic shared memory mappings and segments.

commit   : 6057c212f3e783c45e050a78d070edf3e5f069f0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Oct 2014 11:35:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Oct 2014 11:35:55 -0400    

Click here for diff

Nobody seemed concerned about this naming when it originally went in,  
but there's a pending patch that implements the opposite of  
dsm_keep_mapping, and the term "unkeep" was judged unpalatable.  
"unpin" has existing precedent in the PostgreSQL code base, and the  
English language, so use this terminology instead.  
  
Per discussion, back-patch to 9.4.  

M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h

Remove use of TAP subtests

commit   : 7912f9b7dc9e2d3f6cd81892ef6aa797578e9f06    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Oct 2014 19:41:19 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Oct 2014 19:41:19 -0400    

Click here for diff

They turned out to be too much of a portability headache, because they  
need a fairly new version of Test::More to work properly.  

M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivexlog.pl
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/030_createlang.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/060_droplang.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/test/perl/TestLib.pm

Avoid corrupting tables when ANALYZE inside a transaction is rolled back.

commit   : e0722d9cb57d06c2e459cf338cf7387ec3edb1f5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Oct 2014 18:12:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Oct 2014 18:12:02 -0400    

Click here for diff

VACUUM and ANALYZE update the target table's pg_class row in-place, that is  
nontransactionally.  This is OK, more or less, for the statistical columns,  
which are mostly nontransactional anyhow.  It's not so OK for the DDL hint  
flags (relhasindex etc), which might get changed in response to  
transactional changes that could still be rolled back.  This isn't a  
problem for VACUUM, since it can't be run inside a transaction block nor  
in parallel with DDL on the table.  However, we allow ANALYZE inside a  
transaction block, so if the transaction had earlier removed the last  
index, rule, or trigger from the table, and then we roll back the  
transaction after ANALYZE, the table would be left in a corrupted state  
with the hint flags not set though they should be.  
  
To fix, suppress the hint-flag updates if we are InTransactionBlock().  
This is safe enough because it's always OK to postpone hint maintenance  
some more; the worst-case consequence is a few extra searches of pg_index  
et al.  There was discussion of instead using a transactional update,  
but that would change the behavior in ways that are not all desirable:  
in most scenarios we're better off keeping ANALYZE's statistical values  
even if the ANALYZE itself rolls back.  In any case we probably don't want  
to change this behavior in back branches.  
  
Per bug #11638 from Casey Shobe.  This has been broken for a good long  
time, so back-patch to all supported branches.  
  
Tom Lane and Michael Paquier, initial diagnosis by Andres Freund  

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

Avoid setup work for invalidation messages at start-of-(sub)xact.

commit   : 6cb4afff33ba0b6f88cca2967904ad501d648e2f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Oct 2014 12:35:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Oct 2014 12:35:19 -0400    

Click here for diff

Instead of initializing a new TransInvalidationInfo for every  
transaction or subtransaction, we can just do it for those  
transactions or subtransactions that actually need to queue  
invalidation messages.  That also avoids needing to free those  
entries at the end of a transaction or subtransaction that does  
not generate any invalidation messages, which is by far the  
common case.  
  
Patch by me.  Review by Simon Riggs and Andres Freund.  

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

Reset error message at PQreset()

commit   : 8f8314b56003877185fb817c847c7c9609621d0c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Oct 2014 14:32:01 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 29 Oct 2014 14:32:01 +0200    

Click here for diff

If you call PQreset() repeatedly, and the connection cannot be  
re-established, the error messages from the failed connection attempts  
kept accumulating in the error string.  
  
Fixes bug #11455 reported by Caleb Epstein. Backpatch to all supported  
versions.  

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

Remove obsolete commentary.

commit   : a00d468e658a245823083b9ac2e423a659a03802    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Oct 2014 18:36:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Oct 2014 18:36:02 -0400    

Click here for diff

Since we got rid of non-MVCC catalog scans, the fourth reason given for  
using a non-transactional update in index_update_stats() is obsolete.  
The other three are still good, so we're not going to change the code,  
but fix the comment.  

M src/backend/catalog/index.c

Remove unnecessary assignment.

commit   : 18f158ef697974cb976b52dae8a048d83b7f1ca4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Oct 2014 20:26:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Oct 2014 20:26:20 +0200    

Click here for diff

Reported by MauMau.  

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

MinGW: Include .dll extension in .def file LIBRARY commands.

commit   : c0e190365b93bbf717540d8e7653c65a9f6c5650    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 27 Oct 2014 19:59:39 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 27 Oct 2014 19:59:39 -0400    

Click here for diff

Newer toolchains append the extension implicitly if missing, but  
buildfarm member narwhal (gcc 3.4.2, ld 2.15.91 20040904) does not.  
This affects most core libraries having an exports.txt file, namely  
libpq and the ECPG support libraries.  On Windows Server 2003, Windows  
API functions that load and unload DLLs internally will mistakenly  
unload a libpq whose DLL header reports "LIBPQ" instead of "LIBPQ.dll".  
When, subsequently, control would return to libpq, the backend crashes.  
Back-patch to 9.4, like commit 846e91e0223cf9f2821c3ad4dfffffbb929cb027.  
Before that commit, we used a different linking technique that yielded  
"libpq.dll" in the DLL header.  
  
Commit 53566fc0940cf557416b13252df57350a4511ce4 worked around this by  
eliminating a call to a function that loads and unloads DLLs internally.  
That commit is no longer necessary for correctness, but its improving  
consistency with the MSVC build remains valid.  

M src/Makefile.shlib

Add missing equals signs to pg_recvlogical documentation.

commit   : 7f609a10adb5419c68fc683594fcd14f1e7322fb    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Oct 2014 08:53:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Oct 2014 08:53:16 -0400    

Click here for diff

Michael Paquier  

M doc/src/sgml/ref/pg_recvlogical.sgml

Fix two bugs in tsquery @> operator.

commit   : 22926e00f7041b2b542f80caf63b41faa99a3163    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Oct 2014 10:50:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Oct 2014 10:50:41 +0200    

Click here for diff

1. The comparison for matching terms used only the CRC to decide if there's  
a match. Two different terms with the same CRC gave a match.  
  
2. It assumed that if the second operand has more terms than the first, it's  
never a match. That assumption is bogus, because there can be duplicate  
terms in either operand.  
  
Rewrite the implementation in a way that doesn't have those bugs.  
  
Backpatch to all supported versions.  

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

Add variable names to two LWLock C prototypes

commit   : a4da35a0d2c61231d8e91ed2ae424faea6f3501c    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 27 Oct 2014 04:45:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 27 Oct 2014 04:45:57 -0400    

Click here for diff

Previously only the variable types appeared.  

M src/include/storage/lwlock.h

Avoid unportable strftime() behavior in pg_dump/pg_dumpall.

commit   : f455fcfdb8ca3b67373223a4e15648c35e2592a9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Oct 2014 20:59:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Oct 2014 20:59:21 -0400    

Click here for diff

Commit ad5d46a4494b0b480a3af246bb4227d9bdadca37 thought that we could  
get around the known portability issues of strftime's %Z specifier by  
using %z instead.  However, that idea seems to have been innocent of  
any actual research, as it certainly missed the facts that  
(1) %z is not portable to pre-C99 systems, and  
(2) %z doesn't actually act differently from %Z on Windows anyway.  
  
Per failures on buildfarm member hamerkop.  
  
While at it, centralize the code defining what strftime format we  
want to use in pg_dump; three copies of that string seems a bit much.  

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

Fix undersized result buffer in pset_quoted_string().

commit   : 9711fa06081da230e62fa52147c49ccf7b9ccbe2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Oct 2014 19:17:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Oct 2014 19:17:55 -0400    

Click here for diff

The malloc request was 1 byte too small for the worst-case output.  
This seems relatively unlikely to cause any problems in practice,  
as the worst case only occurs if the input string contains no  
characters other than single-quote or newline, and even then  
malloc alignment padding would probably save the day.  But it's  
definitely a bug.  
  
David Rowley  

M src/bin/psql/command.c

Improve planning of btree index scans using ScalarArrayOpExpr quals.

commit   : a4523c5aa5349510ddb74abddc416add2536ec3d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Oct 2014 16:12:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Oct 2014 16:12:22 -0400    

Click here for diff

Since we taught btree to handle ScalarArrayOpExpr quals natively (commit  
9e8da0f75731aaa7605cf4656c21ea09e84d2eb1), the planner has always included  
ScalarArrayOpExpr quals in index conditions if possible.  However, if the  
qual is for a non-first index column, this could result in an inferior plan  
because we can no longer take advantage of index ordering (cf. commit  
807a40c551dd30c8dd5a0b3bd82f5bbb1e7fd285).  It can be better to omit the  
ScalarArrayOpExpr qual from the index condition and let it be done as a  
filter, so that the output doesn't need to get sorted.  Indeed, this is  
true for the query introduced as a test case by the latter commit.  
  
To fix, restructure get_index_paths and build_index_paths so that we  
consider paths both with and without ScalarArrayOpExpr quals in non-first  
index columns.  Redesign the API of build_index_paths so that it reports  
what it found, saving useless second or third calls.  
  
Report and patch by Andrew Gierth (though rather heavily modified by me).  
Back-patch to 9.2 where this code was introduced, since the issue can  
result in significant performance regressions compared to plans produced  
by 9.1 and earlier.  

M src/backend/optimizer/path/indxpath.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix TAP tests with Perl 5.12

commit   : 17009fb9ebe6873d98ed0fe216eeec08e0603823    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Oct 2014 10:26:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Oct 2014 10:26:36 -0400    

Click here for diff

Perl 5.12 ships with a somewhat broken version of Test::Simple, so skip  
the tests if that is found.  
  
The relevant fix is  
  
    0.98  Wed, 23 Feb 2011 14:38:02 +1100  
        Bug Fixes  
        * subtest() should not fail if $? is non-zero. (Aaron Crane)  

M src/test/perl/TestLib.pm

Fix TAP tests with Perl 5.8

commit   : 5c3d830e4401a1825207eb18640395112e6ccd6d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Oct 2014 09:47:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Oct 2014 09:47:01 -0400    

Click here for diff

The prove program included in Perl 5.8 does not support the --ext  
option, so don't use that and use wildcards on the command line instead.  
  
Note that the tests will still all be skipped, because, for instance,  
the version of Test::More is too old, but at least the regular  
mechanisms for handling that will apply, instead of failing to call  
prove altogether.  

M src/Makefile.global.in

Add native compiler and memory barriers for solaris studio.

commit   : 4a54b99e9c3989017fa5717f343cceab09aa5542    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 25 Oct 2014 10:27:41 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 25 Oct 2014 10:27:41 +0200    

Click here for diff

Discussion: [email protected]  
Author: Oskari Saarenmaa  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port/atomics/generic-sunpro.h

Work around Windows locale name with non-ASCII character.

commit   : db29620d4d16e08241f965ccd70d0f65883ff0de    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 21:10:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 21:10:13 +0300    

Click here for diff

Windows has one a locale whose name contains a non-ASCII character:  
"Norwegian (Bokmål)" (that's an 'a' with a ring on top). That causes  
trouble; when passing it setlocale(), it's not clear what encoding the  
argument should be in. Another problem is that the locale name is stored in  
pg_database catalog table, and the encoding used there depends on what  
server encoding happens to be in use when the database is created. For  
example, if you issue the CREATE DATABASE when connected to a UTF-8  
database, the locale name is stored in pg_database in UTF-8. As long as all  
locale names are pure ASCII, that's not a problem.  
  
To work around that, map the troublesome locale name to a pure-ASCII alias  
of the same locale, "norwegian-bokmal".  
  
Now, this doesn't change the existing values that are already in  
pg_database and in postgresql.conf. Old clusters will need to be fixed  
manually. Instructions for that need to be put in the release notes.  
  
This fixes bug #11431 reported by Alon Siman-Tov. Backpatch to 9.2;  
backpatching further would require more work than seems worth it.  

M src/port/win32setlocale.c

Forgot #include "pg_getopt.h", now that pg_controldata uses getopt.

commit   : c0c1f6fc97088100a710e7e9c2e74b775985083d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 20:39:56 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 20:39:56 +0300    

Click here for diff

Needed at least on Windows.  

M src/bin/pg_controldata/pg_controldata.c

Complain if too many options are passed to pg_controldata or pg_resetxlog.

commit   : 2d53003432f8560b9c3adf569118747c8ac8447d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 18:59:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 18:59:08 +0300    

Click here for diff

M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c

Oops, the commit accept pg_controldata -D datadir missed code changes.

commit   : 22b743b2ca18a692ba8d91bc18e7c42a8b7941ad    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 18:55:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 24 Oct 2014 18:55:33 +0300    

Click here for diff

I updated the docs and usage blurp, but forgot to commit the code changes  
required.  
  
Spotted by Michael Paquier.  

M src/bin/pg_controldata/pg_controldata.c

Fix off-by-one error in 2781b4bea7db357be59f9a5fd73ca1eb12ff5a79.

commit   : 85bb81de530aed08888f4fc3dec85c5cfbd3befd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Oct 2014 08:17:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Oct 2014 08:17:00 -0400    

Click here for diff

Spotted by Tom Lane.  

M src/backend/commands/trigger.c

psql: complain if pg_dump custom-format is detected

commit   : 3c2aa0c6f27fc921c881b3bf0b6df03fdf557304    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 24 Oct 2014 07:14:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 24 Oct 2014 07:14:09 -0300    

Click here for diff

Apparently, this is a very common mistake for users to make; it is  
better to have it fail reasonably rather than throw potentially a large  
number of errors.  Since we have a magic string at the start of the  
file, we can detect the case easily and there's no other possible useful  
behavior anyway.  
  
Author: Craig Ringer  

M src/bin/psql/mainloop.c

Update README.tuplock

commit   : b01a4f68386f8bbc62c308138f23e436cb274629    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 23 Oct 2014 20:51:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 23 Oct 2014 20:51:58 -0300    

Click here for diff

This file was documenting an older version of patch 0ac5ad5134; update  
it to match what was really committed  
  
Author: Florian Pflug  

M src/backend/access/heap/README.tuplock

In type_sanity, check I/O functions of built-in types are not volatile.

commit   : 43ac12c6e6e397fd9142ed908447eba32d3785b2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Oct 2014 15:59:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Oct 2014 15:59:40 -0400    

Click here for diff

We have a project policy that I/O functions must not be volatile, as per  
commit aab353a60b95aadc00f81da0c6d99bde696c4b75, but we weren't doing  
anything to enforce that.  In most usage the marking of the function  
doesn't matter as long as its behavior is sane --- but I/O casts can  
expose the marking as user-visible behavior, as per today's complaint  
from Joe Van Dyk about contrib/ltree.  
  
This test as such will only protect us against future errors in built-in  
data types.  To catch the same error in contrib or third-party types,  
perhaps we should make CREATE TYPE complain?  But that's a separate  
issue from enforcing the policy for built-in types.  

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

Improve ispell dictionary's defenses against bad affix files.

commit   : b34d6f03dbb34027ee0ee6f1c1887ae30ec7b07d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Oct 2014 13:11:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Oct 2014 13:11:28 -0400    

Click here for diff

Don't crash if an ispell dictionary definition contains flags but not  
any compound affixes.  (This isn't a security issue since only superusers  
can install affix files, but still it's a bad thing.)  
  
Also, be more careful about detecting whether an affix-file FLAG command  
is old-format (ispell) or new-format (myspell/hunspell).  And change the  
error message about mixed old-format and new-format commands into something  
intelligible.  
  
Per bug #11770 from Emre Hasegeli.  Back-patch to all supported branches.  

M src/backend/tsearch/spell.c

Perform less setup work for AFTER triggers at transaction start.

commit   : 2781b4bea7db357be59f9a5fd73ca1eb12ff5a79    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Oct 2014 12:33:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Oct 2014 12:33:02 -0400    

Click here for diff

Testing reveals that the memory allocation we do at transaction start  
has small but measurable overhead on simple transactions.  To cut  
down on that overhead, defer some of that work to the point when  
AFTER triggers are first used, thus avoiding it altogether if they  
never are.  
  
Patch by me.  Review by Andres Freund.  

M src/backend/commands/trigger.c

Remove the unused argument of PSQLexec().

commit   : efbbbbc8b51bacd32e96c3f747dd6aa4c0e444cb    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 23 Oct 2014 22:33:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 23 Oct 2014 22:33:56 +0900    

Click here for diff

This commit simply removes the second argument of PSQLexec that was  
set to the same value everywhere. Comments and code blocks related  
to this parameter are removed.  
  
Noticed by Heikki Linnakangas, reviewed by Michael Paquier  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/describe.c
M src/bin/psql/large_obj.c

Add a function to get the authenticated user ID.

commit   : 5ac372fc1a7cc673cc7d4cf26ba651d52495b27a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Oct 2014 08:18:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Oct 2014 08:18:45 -0400    

Click here for diff

Previously, this was not exposed outside of miscinit.c.  It is needed  
for the pending pg_background patch, and will also be needed for  
parallelism.  Without it, there's no way for a background worker to  
re-create the exact authentication environment that was present in the  
process that started it, which could lead to security exposures.  

M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Prevent the already-archived WAL file from being archived again.

commit   : c7371c4a607872c4d799e0dac0c9367574067cdc    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 23 Oct 2014 16:21:27 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 23 Oct 2014 16:21:27 +0900    

Click here for diff

Previously the archive recovery always created .ready file for  
the last WAL file of the old timeline at the end of recovery even when  
it's restored from the archive and has .done file. That is, there was  
the case where the WAL file had both .ready and .done files.  
This caused the already-archived WAL file to be archived again.  
  
This commit prevents the archive recovery from creating .ready file  
for the last WAL file if it has .done file, in order to prevent it from  
being archived again.  
  
This bug was added when cascading replication feature was introduced,  
i.e., the commit 5286105800c7d5902f98f32e11b209c471c0c69c.  
So, back-patch to 9.2, where cascading replication was added.  
  
Reviewed by Michael Paquier  

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

Minimize calls of pg_class_aclcheck to minimum necessary

commit   : e64d3c5635cef9ee2e9d67904f1d3e88f4d8b2e7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Oct 2014 21:41:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Oct 2014 21:41:43 -0400    

Click here for diff

In a couple of code paths, pg_class_aclcheck is called in succession  
with multiple different modes set.  This patch combines those modes to  
have a single call of this function and reduce a bit process overhead  
for permission checking.  
  
Author: Michael Paquier <[email protected]>  
Reviewed-by: Fabrízio de Royes Mello <[email protected]>  

M src/backend/commands/sequence.c

Add tests for sequence privileges

commit   : a5f7d581943e70235264098c35313d16e932ee0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Oct 2014 21:39:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Oct 2014 21:39:07 -0400    

Click here for diff

M src/test/regress/expected/sequence.out
M src/test/regress/expected/sequence_1.out
M src/test/regress/sql/sequence.sql

Ensure libpq reports a suitable error message on unexpected socket EOF.

commit   : 69fed5b26fa34fc825c7ed0a8d97221ff448e9c5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Oct 2014 18:41:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Oct 2014 18:41:44 -0400    

Click here for diff

The EOF-detection logic in pqReadData was a bit confused about who should  
set up the error message in case the kernel gives us read-ready-but-no-data  
rather than ECONNRESET or some other explicit error condition.  Since the  
whole point of this situation is that the lower-level functions don't know  
there's anything wrong, pqReadData itself must set up the message.  But  
keep the assumption that if an errno was reported, a message was set up at  
lower levels.  
  
Per bug #11712 from Marko Tiikkaja.  It's been like this for a very long  
time, so back-patch to all supported branches.  

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

Small code cleanup.

commit   : 2ae7811db87bf54e8a70aae3cfd9f7cc7eff0bc4    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 22 Oct 2014 10:35:36 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 22 Oct 2014 10:35:36 +0200    

Click here for diff

Declare static variable as static and external as extern.  

M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg_keywords.c
M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/preproc/keywords.c

Update comment.

commit   : 98b37437796bb5fedecf0d0c73cef4aa2ce9d192    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Oct 2014 15:39:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Oct 2014 15:39:28 +0300    

Click here for diff

The _bt_tuplecompare() function mentioned in comment hasn't existed for a  
long time.  
  
Peter Geoghegan  

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

MinGW: Use -static-libgcc when linking a DLL.

commit   : 284590e416b72f541c5fe54f36a95e38d80835c3    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 21 Oct 2014 22:55:47 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 21 Oct 2014 22:55:47 -0400    

Click here for diff

When commit 846e91e0223cf9f2821c3ad4dfffffbb929cb027 switched the linker  
driver from dlltool/dllwrap to gcc, it became possible for linking to  
choose shared libgcc.  Backends having loaded a module dynamically  
linked to libgcc can exit abnormally, which the postmaster treats like a  
crash.  Resume use of static libgcc exclusively, like 9.3 and earlier.  
Back-patch to 9.4.  

M src/Makefile.shlib
M src/makefiles/Makefile.win32

commit   : 53566fc0940cf557416b13252df57350a4511ce4    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 21 Oct 2014 22:55:43 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 21 Oct 2014 22:55:43 -0400    

Click here for diff

This improves consistency with the MSVC build.  On buildfarm member  
narwhal, since commit 846e91e0223cf9f2821c3ad4dfffffbb929cb027,  
shfolder.dll:SHGetFolderPath() crashes when dblink calls it by way of  
pqGetHomeDirectory().  Back-patch to 9.4, where that commit first  
appeared.  How it caused this regression remains a mystery.  This is a  
partial revert of commit 889f03812916b146ae504c0fad5afdc7bf2e8a2a, which  
adopted shfolder.dll for Windows NT 4.0 compatibility.  PostgreSQL 8.2  
dropped support for that operating system.  

M src/Makefile.global.in
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/win32.mak
M src/port/path.c

Update expected/sequence_1.out.

commit   : 31dd7fcd03609dbc3c3be85e645ccc7c715db719    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Oct 2014 18:25:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Oct 2014 18:25:58 -0400    

Click here for diff

The last three updates to the sequence regression test have all forgotten  
to touch the alternate expected-output file.  Sigh.  
  
Michael Paquier  

M src/test/regress/expected/sequence_1.out

Allow input format xxxx-xxxx-xxxx for macaddr type

commit   : 6f04368cfc05c46140f124415d752c3628c73f28    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 16:16:39 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 16:16:39 -0400    

Click here for diff

Author: Herwin Weststrate <[email protected]>  
Reviewed-by: Ali Akbar <[email protected]>  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/mac.c
M src/test/regress/expected/macaddr.out
M src/test/regress/sql/macaddr.sql

doc: Check DocBook XML validity during the build

commit   : 5d93ce2d0c619ba1b408eb749715e7223e23f6ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 14:46:38 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 14:46:38 -0400    

Click here for diff

Building the documentation with XSLT does not check the DTD, like a  
DSSSL build would.  One can often get away with having invalid XML, but  
the stylesheets might then create incorrect output, as they are not  
designed to handle that.  Therefore, check the validity of the XML  
against the DTD, using xmllint, during the build.  
  
Add xmllint detection to configure, and add some documentation.  
  
xmllint comes with libxml2, which is already in use, but it might be in  
a separate package, such as libxml2-utils on Debian.  
  
Reviewed-by: Fabien COELHO <[email protected]>  

M configure
M configure.in
M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml
M src/Makefile.global.in

doc: Update Red Hat documentation tools information

commit   : f43afbca701113fb6538e38e1f95666fb1910e2f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 10:43:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 10:43:09 -0400    

Click here for diff

The old text was written in ancient times when RPM packages could be  
shared more or less freely across a plethora of RPM-based Linux  
distributions.  This isn't really the case anymore, so just make this  
information more concrete for the Red Hat family.  

M doc/src/sgml/docguide.sgml

doc: Update FreeBSD documentation tools information

commit   : f048e50037b1aa5cda857ce5f6cc17a1ea410987    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 10:32:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Oct 2014 10:32:28 -0400    

Click here for diff

based on patch from Dag-Erling Smørgrav <[email protected]>  

M doc/src/sgml/docguide.sgml

Don't duplicate log_checkpoint messages for both of restart and checkpoints.

commit   : 5e5b65f359b7a12c05708585a8e6cd4d80ca2652    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 21 Oct 2014 01:01:56 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 21 Oct 2014 01:01:56 +0200    

Click here for diff

The duplication originated in cdd46c765, where restartpoints were  
introduced.  
  
In LogCheckpointStart's case the duplication actually lead to the  
compiler's format string checking not to be effective because the  
format string wasn't constant.  
  
Arguably these messages shouldn't be elog(), but ereport() style  
messages. That'd even allow to translate the messages... But as  
there's more mistakes of that kind in surrounding code, it seems  
better to change that separately.  

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

Renumber CHECKPOINT_* flags.

commit   : 11abd6c90f1094eaeee32e1c57d250c9db5102cb    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 21 Oct 2014 00:20:08 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 21 Oct 2014 00:20:08 +0200    

Click here for diff

Commit 7dbb6069382 added a new CHECKPOINT_FLUSH_ALL flag. As that  
commit needed to be backpatched I didn't change the numeric values of  
the existing flags as that could lead to nastly problems if any  
external code issued checkpoints. That's not a concern on master, so  
renumber them there.  
  
Also add a comment about CHECKPOINT_FLUSH_ALL above  
CreateCheckPoint().  

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

Flush unlogged table's buffers when copying or moving databases.

commit   : 7dbb60693820c20b562c12f58040c9871d6ab787    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Oct 2014 23:43:46 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Oct 2014 23:43:46 +0200    

Click here for diff

CREATE DATABASE and ALTER DATABASE .. SET TABLESPACE copy the source  
database directory on the filesystem level. To ensure the on disk  
state is consistent they block out users of the affected database and  
force a checkpoint to flush out all data to disk. Unfortunately, up to  
now, that checkpoint didn't flush out dirty buffers from unlogged  
relations.  
  
That bug means there could be leftover dirty buffers in either the  
template database, or the database in its old location. Leading to  
problems when accessing relations in an inconsistent state; and to  
possible problems during shutdown in the SET TABLESPACE case because  
buffers belonging files that don't exist anymore are flushed.  
  
This was reported in bug #10675 by Maxim Boguk.  
  
Fix by Pavan Deolasee, modified somewhat by me. Reviewed by MauMau and  
Fujii Masao.  
  
Backpatch to 9.1 where unlogged tables were introduced.  

M src/backend/access/transam/xlog.c
M src/backend/commands/dbcommands.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/xlog.h

pg_test_fsync: Update output format

commit   : 83dc5908c207bc0ff4256eb862f6a211ad5596ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Oct 2014 15:34:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Oct 2014 15:34:59 -0400    

Click here for diff

Apparently, computers are now a bit faster than when this was first  
added, so we need to make room for a digit or two in the ops/sec format.  
  
While we're at it, adjust some of the other output for a more consistent  
line length.  

M contrib/pg_test_fsync/pg_test_fsync.c

Correct volatility markings of a few json functions.

commit   : af2b8fd057213f4b1918b9581c63e0b00427573c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 20 Oct 2014 14:55:35 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 20 Oct 2014 14:55:35 -0400    

Click here for diff

json_agg and json_object_agg and their associated transition functions  
should have been marked as stable rather than immutable, as they call IO  
functions indirectly. Changing this probably isn't going to make much  
difference, as you can't use an aggregate function in an index  
expression, but we should be correct nevertheless.  
  
json_object, on the other hand, should be marked immutable rather than  
stable, as it does not call IO functions.  
  
As discussed on -hackers, this change is being made without bumping the  
catalog version, as we don't want to do that at this stage of the  cycle,  
and  the changes are very unlikely to affect anyone.  

M src/include/catalog/pg_proc.h

Fix mishandling of FieldSelect-on-whole-row-Var in nested lateral queries.

commit   : f330a6d14066277e78586cb4ceb8692ca3533046    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Oct 2014 12:23:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Oct 2014 12:23:42 -0400    

Click here for diff

If an inline-able SQL function taking a composite argument is used in a  
LATERAL subselect, and the composite argument is a lateral reference,  
the planner could fail with "variable not found in subplan target list",  
as seen in bug #11703 from Karl Bartel.  (The outer function call used in  
the bug report and in the committed regression test is not really necessary  
to provoke the bug --- you can get it if you manually expand the outer  
function into "LATERAL (SELECT inner_function(outer_relation))", too.)  
  
The cause of this is that we generate the reltargetlist for the referenced  
relation before doing eval_const_expressions() on the lateral sub-select's  
expressions (cf find_lateral_references()), so what's scheduled to be  
emitted by the referenced relation is a whole-row Var, not the simplified  
single-column Var produced by optimizing the function's FieldSelect on the  
whole-row Var.  Then setrefs.c fails to match up that lateral reference to  
what's available from the outer scan.  
  
Preserving the FieldSelect optimization in such cases would require either  
major planner restructuring (to recursively do expression simplification  
on sub-selects much earlier) or some amazingly ugly kluge to change the  
reltargetlist of a possibly-already-planned relation.  It seems better  
just to skip the optimization when the Var is from an upper query level;  
the case is not so common that it's likely anyone will notice a few  
wasted cycles.  
  
AFAICT this problem only occurs for uplevel LATERAL references, so  
back-patch to 9.3 where LATERAL was added.  

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

Fix file-identification comment in contrib/pgcrypto/pgcrypto--1.2.sql.

commit   : 488a7c9ccff54f947d5a51f00efe873f4bae909a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Oct 2014 10:53:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Oct 2014 10:53:57 -0400    

Click here for diff

Cosmetic oversight in commit 32984d8fc3dbb90a3fafb69fece0134f1ea790f9.  
  
Marko Tiikkaja  

M contrib/pgcrypto/pgcrypto–1.2.sql

Fix typos.

commit   : bc279c92f0c213b7bc9a1aef9773aa9a3a9cd0e3    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Oct 2014 10:33:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Oct 2014 10:33:16 -0400    

Click here for diff

David Rowley  

M src/backend/replication/walsender.c
M src/bin/pg_basebackup/receivelog.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c

Fix typos.

commit   : 0f565c074311d202f4524d1fd104b28c5a6adaf2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Oct 2014 10:23:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Oct 2014 10:23:40 -0400    

Click here for diff

Etsuro Fujita  

M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/time/snapmgr.c

initdb: Fix compiler error in USE_PREFETCH case

commit   : 49d182e61ebca00762531718b3bafa9107ccee17    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 19 Oct 2014 00:45:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 19 Oct 2014 00:45:40 -0400    

Click here for diff

M src/bin/initdb/initdb.c

psql: Improve \pset without arguments

commit   : 6895866510c5f4185f50ae7d6810d9ffd7701a9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Oct 2014 21:58:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Oct 2014 21:58:17 -0400    

Click here for diff

Revert the output of the individual backslash commands that change print  
settings back to the 9.3 way (not showing the command name in  
parentheses).  Implement \pset without arguments separately, showing all  
settings with values in a table form.  

M src/bin/psql/command.c
M src/test/regress/expected/psql.out

Allow setting effective_io_concurrency even on unsupported systems

commit   : 7feaccc21791d9d745bac013e5e0396bdde2d81c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Oct 2014 21:35:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Oct 2014 21:35:46 -0400    

Click here for diff

This matches the behavior of other parameters that are unsupported on  
some systems (e.g., ssl).  
  
Also document the default value.  

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

Shorten warning about hash creation

commit   : b87671f1b63a0c9cf264afc209e3acebdb52477f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 Oct 2014 10:36:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 Oct 2014 10:36:09 -0400    

Click here for diff

Also document that PITR is also affected.  

M doc/src/sgml/ref/create_index.sgml
M src/backend/commands/indexcmds.c
M src/test/regress/expected/create_index.out
M src/test/regress/expected/enum.out
M src/test/regress/expected/macaddr.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/uuid.out

interval: tighten precision specification

commit   : 417f92484da8c9a124e7eece8dbfb71f688a0104    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 Oct 2014 10:31:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 Oct 2014 10:31:00 -0400    

Click here for diff

interval precision can only be specified after the "interval" keyword if  
no units are specified.  
  
Previously we incorrectly checked the units to see if the precision was  
legal, causing confusion.  
  
Report by Alvaro Herrera  

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

doc: restrictions on alter database moving default tablespace

commit   : 97d554871c3d186db831b35c0eabe6d496e4f54b    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 Oct 2014 10:23:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 Oct 2014 10:23:42 -0400    

Click here for diff

Mention tablespace must be empty and no one connected to the database.  
  
Report by Josh Berkus  

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

doc: Clean up pg_recvlogical reference page

commit   : 52c1ae22d6a4daf1c1c01fc9244f8ebae5402b1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 18 Oct 2014 09:10:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 18 Oct 2014 09:10:12 -0400    

Click here for diff

This needed a general cleanup of wording, typos, outdated terminology,  
formatting, and hard-to-understand and borderline incorrect information.  
  
Also tweak the pg_receivexlog page a bit to make the two more  
consistent.  

M doc/src/sgml/ref/pg_receivexlog.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml

Declare mkdtemp() only if we're providing it.

commit   : 60f8133dc95d8d55ac52186eb9988559816cac49    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 22:55:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 22:55:20 -0400    

Click here for diff

Follow our usual style of providing an "extern" for a standard library  
function only when we're also providing the implementation.  This avoids  
issues when the system headers declare the function slightly differently  
than we do, as noted by Caleb Welton.  
  
We might have to go to the extent of probing to see if the system headers  
declare the function, but let's not do that until it's demonstrated to be  
necessary.  
  
Oversight in commit 9e6b1bf258170e62dac555fc82ff0536dfe01d29.  Back-patch  
to all supported branches, as that was.  

M src/include/port.h

Avoid core dump in _outPathInfo() for Path without a parent RelOptInfo.

commit   : 5ba062ee44c35b4dc49ccf869fe48f3c6f5f926f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 22:32:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 22:32:55 -0400    

Click here for diff

Nearly all Paths have parents, but a ResultPath representing an empty FROM  
clause does not.  Avoid a core dump in such cases.  I believe this is only  
a hazard for debugging usage, not for production, else we'd have heard  
about it before.  Nonetheless, back-patch to 9.1 where the troublesome code  
was introduced.  Noted while poking at bug #11703.  

M src/backend/nodes/outfuncs.c

Fix bug in handling of connections that pg_receivexlog creates.

commit   : 504c717599b20cdaf09e9d7b6ecd152cc7a3a71a    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 18 Oct 2014 03:06:34 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 18 Oct 2014 03:06:34 +0900    

Click here for diff

Previously pg_receivexlog created new connection for WAL streaming  
even though another connection which had been established to create  
or delete the replication slot was being left. This caused the unused  
connection to be left uselessly until pg_receivexlog exited.  
This bug was introduced by the commit d9f38c7.  
  
This patch changes pg_receivexlog so that the connection for  
the replication slot is reused for WAL streaming.  
  
Andres Freund, slightly modified by me, reviewed by Michael Paquier  

M src/bin/pg_basebackup/pg_receivexlog.c

Fix core dump in pg_dump --binary-upgrade on zero-column composite type.

commit   : 5c38a1d4ecce849b1e105f59ccca5a926181e4f0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 12:49:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 12:49:00 -0400    

Click here for diff

This reverts nearly all of commit 28f6cab61ab8958b1a7dfb019724687d92722538  
in favor of just using the typrelid we already have in pg_dump's TypeInfo  
struct for the composite type.  As coded, it'd crash if the composite type  
had no attributes, since then the query would return no rows.  
  
Back-patch to all supported versions.  It seems to not really be a problem  
in 9.0 because that version rejects the syntax "create type t as ()", but  
we might as well keep the logic similar in all affected branches.  
  
Report and fix by Rushabh Lathia.  

M src/bin/pg_dump/pg_dump.c

Re-pgindent src/bin/pg_dump/*.

commit   : 7584649a1c58029a83a7a57d74cedcf1af434c97    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 12:19:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Oct 2014 12:19:05 -0400    

Click here for diff

Seems to have gotten rather messy lately, as a consequence of a couple  
of large recent commits.  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c

Fix pg_dump for UPDATE policies

commit   : 389573fd19edd255736c50dfd0fd779da7535a7b    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 17 Oct 2014 08:07:46 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 17 Oct 2014 08:07:46 -0400    

Click here for diff

pg_dump had the wrong character for update and so was failing when  
attempts were made to pg_dump databases with UPDATE policies.  
  
Pointed out by Fujii Masao (thanks!)  

M src/bin/pg_dump/pg_dump.c

Support timezone abbreviations that sometimes change.

commit   : b2cbced9eef20692b51a84d68d469627f4fc43ac    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Oct 2014 15:22:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Oct 2014 15:22:10 -0400    

Click here for diff

Up to now, PG has assumed that any given timezone abbreviation (such as  
"EDT") represents a constant GMT offset in the usage of any particular  
region; we had a way to configure what that offset was, but not for it  
to be changeable over time.  But, as with most things horological, this  
view of the world is too simplistic: there are numerous regions that have  
at one time or another switched to a different GMT offset but kept using  
the same timezone abbreviation.  Almost the entire Russian Federation did  
that a few years ago, and later this month they're going to do it again.  
And there are similar examples all over the world.  
  
To cope with this, invent the notion of a "dynamic timezone abbreviation",  
which is one that is referenced to a particular underlying timezone  
(as defined in the IANA timezone database) and means whatever it currently  
means in that zone.  For zones that use or have used daylight-savings time,  
the standard and DST abbreviations continue to have the property that you  
can specify standard or DST time and get that time offset whether or not  
DST was theoretically in effect at the time.  However, the abbreviations  
mean what they meant at the time in question (or most recently before that  
time) rather than being absolutely fixed.  
  
The standard abbreviation-list files have been changed to use this behavior  
for abbreviations that have actually varied in meaning since 1970.  The  
old simple-numeric definitions are kept for abbreviations that have not  
changed, since they are a bit faster to resolve.  
  
While this is clearly a new feature, it seems necessary to back-patch it  
into all active branches, because otherwise use of Russian zone  
abbreviations is going to become even more problematic than it already was.  
This change supersedes the changes in commit 513d06ded et al to modify the  
fixed meanings of the Russian abbreviations; since we've not shipped that  
yet, this will avoid an undesirably incompatible (not to mention incorrect)  
change in behavior for timestamps between 2011 and 2014.  
  
This patch makes some cosmetic changes in ecpglib to keep its usage of  
datetime lookup tables as similar as possible to the backend code, but  
doesn't do anything about the increasingly obsolete set of timezone  
abbreviation definitions that are hard-wired into ecpglib.  Whatever we  
do about that will likely not be appropriate material for back-patching.  
Also, a potential free() of a garbage pointer after an out-of-memory  
failure in ecpglib has been fixed.  
  
This patch also fixes pre-existing bugs in DetermineTimeZoneOffset() that  
caused it to produce unexpected results near a timezone transition, if  
both the "before" and "after" states are marked as standard time.  We'd  
only ever thought about or tested transitions between standard and DST  
time, but that's not what's happening when a zone simply redefines their  
base GMT offset.  
  
In passing, update the SGML documentation to refer to the Olson/zoneinfo/  
zic timezone database as the "IANA" database, since it's now being  
maintained under the auspices of IANA.  

M contrib/btree_gist/btree_ts.c
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/installation.sgml
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/misc/tzparser.c
M src/include/pgtime.h
M src/include/utils/datetime.h
M src/include/utils/tzparser.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamptz.sql
M src/timezone/known_abbrevs.txt
M src/timezone/localtime.c
M src/timezone/tznames/America.txt
M src/timezone/tznames/Antarctica.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Atlantic.txt
M src/timezone/tznames/Australia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Indian.txt
M src/timezone/tznames/Pacific.txt
M src/timezone/tznames/README
M src/timezone/zic.c

Print planning time only in EXPLAIN ANALYZE, not plain EXPLAIN.

commit   : 90063a7612e2730f7757c2a80ba384bbe7e35c4b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Oct 2014 18:50:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Oct 2014 18:50:13 -0400    

Click here for diff

We've gotten enough push-back on that change to make it clear that it  
wasn't an especially good idea to do it like that.  Revert plain EXPLAIN  
to its previous behavior, but keep the extra output in EXPLAIN ANALYZE.  
Per discussion.  
  
Internally, I set this up as a separate flag ExplainState.summary that  
controls printing of planning time and execution time.  For now it's  
just copied from the ANALYZE option, but we could consider exposing it  
to users.  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/include/commands/explain.h

Blind attempt at fixing Win32 pg_dump issues

commit   : 076d29a1eed5fe51fb2b25b98fcde9dd7c506902    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 14 Oct 2014 17:33:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 14 Oct 2014 17:33:36 -0300    

Click here for diff

Per buildfarm failures  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_utils.c

pg_dump: Reduce use of global variables

commit   : 0eea8047bf0e15b402b951e383e39236bdfe57d5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 14 Oct 2014 15:00:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 14 Oct 2014 15:00:55 -0300    

Click here for diff

Most pg_dump.c global variables, which were passed down individually to  
dumping routines, are now grouped as members of the new DumpOptions  
struct, which is used as a local variable and passed down into routines  
that need it.  This helps future development efforts; in particular it  
is said to enable a mode in which a parallel pg_dump run can output  
multiple streams, and have them restored in parallel.  
  
Also take the opportunity to clean up the pg_dump header files somewhat,  
to avoid circularity.  
  
Author: Joachim Wieland, revised by Álvaro Herrera  
Reviewed by Peter Eisentraut  

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.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_db.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
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_dump/pg_restore.c

Fix deadlock with LWLockAcquireWithVar and LWLockWaitForVar.

commit   : e0d97d77bf0875e4d5cc7dedfe701d9999bf678c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Oct 2014 09:55:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Oct 2014 09:55:26 +0300    

Click here for diff

LWLockRelease should release all backends waiting with LWLockWaitForVar,  
even when another backend has already been woken up to acquire the lock,  
i.e. when releaseOK is false. LWLockWaitForVar can return as soon as the  
protected value changes, even if the other backend will acquire the lock.  
Fix that by resetting releaseOK to true in LWLockWaitForVar, whenever  
adding itself to the wait queue.  
  
This should fix the bug reported by MauMau, where the system occasionally  
hangs when there is a lot of concurrent WAL activity and a checkpoint.  
Backpatch to 9.4, where this code was added.  

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

Fix typo in docs.

commit   : 0ff5047d52ab84dad682ad140b6992c294580eb1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Oct 2014 09:45:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 Oct 2014 09:45:00 +0300    

Click here for diff

Shigeru Hanada  

M doc/src/sgml/bgworker.sgml

doc: Improve ALTER VIEW / SET documentation

commit   : db75e524856634ce1c41fc1233e85abbb716ef6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Oct 2014 22:17:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Oct 2014 22:17:34 -0400    

Click here for diff

The way the ALTER VIEW / SET options were listed in the synopsis was  
very confusing.  Move the list to the main description, similar to how  
the ALTER TABLE reference page does it.  

M doc/src/sgml/ref/alter_view.sgml

doc: Fix copy-and-paste mistakes

commit   : 5dc4b50b028f430f639c74f5d449ac8ec27d3cf5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Oct 2014 22:10:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Oct 2014 22:10:01 -0400    

Click here for diff

M doc/src/sgml/ref/create_aggregate.sgml

psql: Fix \? output alignment

commit   : 7ce09e614805d2965baaf33e0d6bcbbb04aa9414    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Oct 2014 22:07:30 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Oct 2014 22:07:30 -0400    

Click here for diff

This was inadvertently changed in commit c64e68fd.  

M src/bin/psql/help.c

doc: mention TM is ignored for to_date/to_timestamp()

commit   : 8660b40d0c59e4880f246fa91e2137ddd13655d8    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 17:36:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 17:36:50 -0400    

Click here for diff

Report by Goulven Guillard  

M doc/src/sgml/func.sgml

doc: mention more changes needed to use huge pages

commit   : ebd33f27ab023ef0e72ba162f2974ec49d96e8e3    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 17:23:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 17:23:36 -0400    

Click here for diff

Report by Laurence Parry  

M doc/src/sgml/runtime.sgml

C comments: adjust execTuples.c for new structure

commit   : fe65280fea7e3c930727ed74328613a4410e487a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 16:54:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 16:54:38 -0400    

Click here for diff

Report by Peter Geoghegan  

M src/backend/executor/execTuples.c

docs: error for adding _validated_ domains for existing uses

commit   : 7ab96d18f94d5e8c2deab8a6126632a194ea32f1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 16:44:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 16:44:20 -0400    

Click here for diff

Report by David G Johnston  

M doc/src/sgml/ref/alter_domain.sgml

Consistently use NULL for invalid GUC unit strings

commit   : d6c8e8d7aca9ab175e6aefef9974b65bd589dd80    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 16:11:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 16:11:43 -0400    

Click here for diff

Patch by Euler Taveira  

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

doc: improve USING and NATURAL JOIN descriptions

commit   : 032f3b7e166cfa2818b0a9572324e362bf8895df    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 15:39:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Oct 2014 15:39:49 -0400    

Click here for diff

Patch by David G Johnston  

M doc/src/sgml/queries.sgml

Add --latency-limit option to pgbench.

commit   : 98aed6c721763f2472ccd23b834baed9f83a944b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Oct 2014 20:25:56 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 13 Oct 2014 20:25:56 +0300    

Click here for diff

This allows transactions that take longer than specified limit to be counted  
separately. With --rate, transactions that are already late by the time we  
get to execute them are skipped altogether. Using --latency-limit with  
--rate allows you to "catch up" more quickly, if there's a hickup in the  
server causing a lot of transactions to stall momentarily.  
  
Fabien COELHO, reviewed by Rukh Meski and heavily refactored by me.  

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

Increase number of hash join buckets for underestimate.

commit   : 30d7ae3c76d2de144232ae6ab328ca86b70e72c3    
  
author   : Kevin Grittner <[email protected]>    
date     : Mon, 13 Oct 2014 10:16:36 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Mon, 13 Oct 2014 10:16:36 -0500    

Click here for diff

If we expect batching at the very beginning, we size nbuckets for  
"full work_mem" (see how many tuples we can get into work_mem,  
while not breaking NTUP_PER_BUCKET threshold).  
  
If we expect to be fine without batching, we start with the 'right'  
nbuckets and track the optimal nbuckets as we go (without actually  
resizing the hash table). Once we hit work_mem (considering the  
optimal nbuckets value), we keep the value.  
  
At the end of the first batch, we check whether (nbuckets !=  
nbuckets_optimal) and resize the hash table if needed. Also, we  
keep this value for all batches (it's OK because it assumes full  
work_mem, and it makes the batchno evaluation trivial). So the  
resize happens only once.  
  
There could be cases where it would improve performance to allow  
the NTUP_PER_BUCKET threshold to be exceeded to keep everything in  
one batch rather than spilling to a second batch, but attempts to  
generate such a case have so far been unsuccessful; that issue may  
be addressed with a follow-on patch after further investigation.  
  
Tomas Vondra with minor format and comment cleanup by me  
Reviewed by Robert Haas, Heikki Linnakangas, and Kevin Grittner  

M src/backend/commands/explain.c
M src/backend/executor/nodeHash.c
M src/include/executor/hashjoin.h

Fix quoting in the add_to_path Makefile macro.

commit   : 494affbd900d1c90de17414a575af1a085c3e37a    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Oct 2014 23:33:37 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Oct 2014 23:33:37 -0400    

Click here for diff

The previous quoting caused "make -C src/bin check" to ignore, rather  
than add to, any LD_LIBRARY_PATH content from the environment.  
Back-patch to 9.4, where the macro was introduced.  

M src/Makefile.global.in

pg_ctl: Cast DWORD values to avoid -Wformat warnings.

commit   : 27a23f9dfe81e324e5e51e04aad364bcaaff1096    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Oct 2014 23:33:19 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Oct 2014 23:33:19 -0400    

Click here for diff

This affects pg_ctl alone, because pg_ctl takes the exceptional step of  
calling Windows API functions in a Cygwin build.  

M src/bin/pg_ctl/pg_ctl.c

Suppress dead, unportable src/port/crypt.c code.

commit   : 772945b4dfb6cc7354e79e23e2552d2d3712d5a1    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 Oct 2014 23:27:06 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 Oct 2014 23:27:06 -0400    

Click here for diff

This file used __int64, which is specific to native Windows, rather than  
int64.  Suppress the long-unused union field of this type.  Noticed on  
Cygwin x86_64 with -lcrypt not installed.  Back-patch to 9.0 (all  
supported versions).  

M src/port/crypt.c

pg_recvlogical: Improve --help output

commit   : a0fb59d8bd7711fb8f08a4371074f07c62617d78    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 12 Oct 2014 01:45:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 12 Oct 2014 01:45:25 -0400    

Click here for diff

List the actions first, as they are the most important options.  Group  
the other options more sensibly, consistent with the man page.  Correct  
a few typographical errors, clarify some things.  
  
Also update the pg_receivexlog --help output to make it a bit more  
consistent with that of pg_recvlogical.  

M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c

Message improvements

commit   : b7a08c80283c8d564933381b24c1993d49926e15    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 12 Oct 2014 01:02:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 12 Oct 2014 01:02:56 -0400    

Click here for diff

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/transam/xlog.c
M src/backend/commands/dbcommands.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/libpq/be-secure-openssl.c
M src/test/regress/expected/matview.out

pg_upgrade: prefix Unix shell script name output with "./"

commit   : dc9c612767f20f28f35f06d709d59ed8477bfe32    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Oct 2014 18:38:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Oct 2014 18:38:41 -0400    

Click here for diff

This more clearly suggests the current directory.  While this also works  
on Windows, it might be confusing.  
  
Report by Christoph Berg  

M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/pg_upgrade.h

docs: remove mention that attnotnull should be changed

commit   : 80e6af1272750595c02e910bde907e30c592579b    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Oct 2014 17:23:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Oct 2014 17:23:57 -0400    

Click here for diff

Report by Andres Freund  

M doc/src/sgml/catalogs.sgml

regression: adjust polygon diagrams to not use tabs

commit   : 4f2e5a8a84f39ec027d1018f655b85b1b1513701    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Oct 2014 17:14:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Oct 2014 17:14:16 -0400    

Click here for diff

Also, small diagram adjustments  
  
Patch by Emre Hasegeli  

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

Improve documentation about JSONB array containment behavior.

commit   : 25ad5a52847699527ddba6e86aa353075e578e9b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Oct 2014 14:29:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Oct 2014 14:29:51 -0400    

Click here for diff

Per gripe from Josh Berkus.  

M doc/src/sgml/json.sgml

Fix bogus optimization in JSONB containment tests.

commit   : 4a50de13127b7657f32f14dc17beb2e15a3a4777    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Oct 2014 14:13:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Oct 2014 14:13:51 -0400    

Click here for diff

When determining whether one JSONB object contains another, it's okay to  
make a quick exit if the first object has fewer pairs than the second:  
because we de-duplicate keys within objects, it is impossible that the  
first object has all the keys the second does.  However, the code was  
applying this rule to JSONB arrays as well, where it does *not* hold  
because arrays can contain duplicate entries.  The test was really in  
the wrong place anyway; we should do it within JsonbDeepContains, where  
it can be applied to nested objects not only top-level ones.  
  
Report and test cases by Alexander Korotkov; fix by Peter Geoghegan and  
Tom Lane.  

M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/jsonb.sql

Remove unnecessary initialization of local variables.

commit   : 733be2a5cd124b28a15d5d09de9b227691e6c5a0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Oct 2014 13:00:53 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Oct 2014 13:00:53 +0300    

Click here for diff

Oops, forgot these in the prveious commit.  

M contrib/pg_upgrade/check.c

Change the way encoding and locale checks are done in pg_upgrade.

commit   : 33755e8edf149dabfc0ed9b697a84f70b0cca0de    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Oct 2014 09:59:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 10 Oct 2014 09:59:44 +0300    

Click here for diff

Lc_collate and lc_ctype have been per-database settings since server version  
8.4, but pg_upgrade was still treating them as cluster-wide options. It  
fetched the values for the template0 databases in old and new cluster, and  
compared them. That's backwards; the encoding and locale of the template0  
database doesn't matter, as template0 is guaranteed to contain only ASCII  
characters. But if there are any other databases that exist on both clusters  
(in particular template1 and postgres databases), their encodings and  
locales must be compatible.  
  
Also, make the locale comparison more lenient. If the locale names are not  
equal, try to canonicalize both of them by passing them to setlocale(). We  
used to do that only when upgrading from 9.1 or below, but it seems like a  
good idea even with newer versions. If we change the canonical form of a  
locale, this allows pg_upgrade to still work. I'm about to do just that to  
fix bug #11431, by mapping a locale name that contains non-ASCII characters  
to a pure-ASCII alias of the same locale.  
  
No backpatching, because earlier versions of pg_upgrade still support  
upgrading from 8.3 servers. That would be more complicated, so it doesn't  
seem worth it, given that we haven't received any complaints about this  
from users.  

M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/controldata.c
M contrib/pg_upgrade/info.c
M contrib/pg_upgrade/pg_upgrade.h

Fix broken example in PL/pgSQL document.

commit   : f19f0ee7160e9aa0bec69146a02e544b9030191b    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 10 Oct 2014 03:18:01 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 10 Oct 2014 03:18:01 +0900    

Click here for diff

Back-patch to all supported branches.  
  
Marti Raudsepp, per a report from Marko Tiikkaja  

M doc/src/sgml/plpgsql.sgml

Split builtins.h to a new header ruleutils.h

commit   : 7b1c2a0f2066672b24f6257ec9b8d78a1754f494    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Oct 2014 18:10:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Oct 2014 18:10:47 -0300    

Click here for diff

The new header contains many prototypes for functions in ruleutils.c  
that are not exposed to the SQL level.  
  
Reviewed by Andres Freund and Michael Paquier.  

M src/backend/access/index/genam.c
M src/backend/catalog/heap.c
M src/backend/commands/explain.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ruleutils.c
M src/include/utils/builtins.h
A src/include/utils/ruleutils.h

Extend shm_mq API with new functions shm_mq_sendv, shm_mq_set_handle.

commit   : 7bb0e97407c32cbf7245ef91fcc27d120c81e872    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 8 Oct 2014 14:35:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 8 Oct 2014 14:35:43 -0400    

Click here for diff

shm_mq_sendv sends a message to the queue assembled from multiple  
locations.  This is expected to be used by forthcoming patches to  
allow frontend/backend protocol messages to be sent via shm_mq, but  
might be useful for other purposes as well.  
  
shm_mq_set_handle associates a BackgroundWorkerHandle with an  
already-existing shm_mq_handle.  This solves a timing problem when  
creating a shm_mq to communicate with a newly-launched background  
worker: if you attach to the queue first, and the background worker  
fails to start, you might block forever trying to do I/O on the queue;  
but if you start the background worker first, but then die before  
attaching to the queue, the background worrker might block forever  
trying to do I/O on the queue.  This lets you attach before starting  
the worker (so that the worker is protected) and then associate the  
BackgroundWorkerHandle later (so that you are also protected).  
  
Patch by me, reviewed by Stephen Frost.  

M src/backend/storage/ipc/shm_mq.c
M src/include/storage/shm_mq.h

Implement SKIP LOCKED for row-level locks

commit   : df630b0dd5ea2de52972d456f5978a012436115e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Oct 2014 17:23:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Oct 2014 17:23:34 -0300    

Click here for diff

This clause changes the behavior of SELECT locking clauses in the  
presence of locked rows: instead of causing a process to block waiting  
for the locks held by other processes (or raise an error, with NOWAIT),  
SKIP LOCKED makes the new reader skip over such rows.  While this is not  
appropriate behavior for general purposes, there are some cases in which  
it is useful, such as queue-like tables.  
  
Catalog version bumped because this patch changes the representation of  
stored rules.  
  
Reviewed by Craig Ringer (based on a previous attempt at an  
implementation by Simon Riggs, who also provided input on the syntax  
used in the current patch), David Rowley, and Álvaro Herrera.  
  
Author: Thomas Munro  

M doc/src/sgml/ref/select.sgml
M doc/src/sgml/sql.sgml
M src/backend/access/heap/heapam.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeLockRows.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepsecurity.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/include/access/heapam.h
M src/include/catalog/catversion.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
A src/include/utils/lockwaitpolicy.h
M src/include/utils/snapshot.h
A src/test/isolation/expected/skip-locked-2.out
A src/test/isolation/expected/skip-locked-3.out
A src/test/isolation/expected/skip-locked-4.out
A src/test/isolation/expected/skip-locked-4_1.out
A src/test/isolation/expected/skip-locked.out
M src/test/isolation/isolation_schedule
M src/test/isolation/specs/nowait-4.spec
A src/test/isolation/specs/skip-locked-2.spec
A src/test/isolation/specs/skip-locked-3.spec
A src/test/isolation/specs/skip-locked-4.spec
A src/test/isolation/specs/skip-locked.spec

Fix typo in elog message.

commit   : c421efd21330f2e5bed253b4a53d7ea5e084edf6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Oct 2014 00:08:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Oct 2014 00:08:59 -0400    

Click here for diff

M src/backend/commands/policy.c

Fix array overrun in ecpg's version of ParseDateTime().

commit   : 55bfdd1cfd991af0864535bbca24a606e8be7e45    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Oct 2014 21:23:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Oct 2014 21:23:20 -0400    

Click here for diff

The code wrote a value into the caller's field[] array before checking  
to see if there was room, which of course is backwards.  Per report from  
Michael Paquier.  
  
I fixed the equivalent bug in the backend's version of this code way back  
in 630684d3a130bb93, but failed to think about ecpg's copy.  Fortunately  
this doesn't look like it would be exploitable for anything worse than a  
core dump: an external attacker would have no control over the single word  
that gets written.  

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

Clean up Create/DropReplicationSlot query buffer

commit   : 273b29dbe96b1584dd66615cf8dc83e7e6ae7386    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 6 Oct 2014 11:18:13 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 6 Oct 2014 11:18:13 -0400    

Click here for diff

CreateReplicationSlot() and DropReplicationSlot() were not cleaning up  
the query buffer in some cases (mostly error conditions) which meant a  
small leak.  Not generally an issue as the error case would result in an  
immediate exit, but not difficult to fix either and reduces the number  
of false positives from code analyzers.  
  
In passing, also add appropriate PQclear() calls to RunIdentifySystem().  
  
Pointed out by Coverity.  

M src/bin/pg_basebackup/streamutil.c

Add support for managing physical replication slots to pg_receivexlog.

commit   : d9f38c7a555dd5a6b81100c6d1e4aa68342d8771    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 6 Oct 2014 12:51:37 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 6 Oct 2014 12:51:37 +0200    

Click here for diff

pg_receivexlog already has the capability to use a replication slot to  
reserve WAL on the upstream node. But the used slot currently has to  
be created via SQL.  
  
To allow using slots directly, without involving SQL, add  
--create-slot and --drop-slot actions, analogous to the logical slot  
manipulation support in pg_recvlogical.  
  
Author: Michael Paquier  
Discussion: CABUevEx+zrOHZOQg+dPapNPFRJdsk59b=TSVf30Z71GnFXhQaw@mail.gmail.com  

M doc/src/sgml/ref/pg_receivexlog.sgml
M src/bin/pg_basebackup/pg_receivexlog.c

Rename pg_recvlogical's --create/--drop to --create-slot/--drop-slot.

commit   : c8b6cba84a986ae9154f748e44709a17d6723191    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 6 Oct 2014 12:11:52 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 6 Oct 2014 12:11:52 +0200    

Click here for diff

A future patch (9.5 only) adds slot management to pg_receivexlog. The  
verbs create/drop don't seem descriptive enough there. It seems better  
to rename pg_recvlogical's commands now, in beta, than live with the  
inconsistency forever.  
  
The old form (e.g. --drop) will still be accepted by virtue of most  
getopt_long() options accepting abbreviations for long commands.  
  
Backpatch to 9.4 where pg_recvlogical was introduced.  
  
Author: Michael Paquier and Andres Freund  
Discussion: CAB7nPqQtt79U6FmhwvgqJmNyWcVCbbV-nS72j_jyPEopERg9rg@mail.gmail.com  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M src/bin/pg_basebackup/pg_recvlogical.c

Translation updates

commit   : 1ec4a970fe6b996cba765a7e9c1897c00bf6c968    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Oct 2014 23:22:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Oct 2014 23:22:24 -0400    

Click here for diff

M src/backend/po/de.po
M src/backend/po/it.po
M src/backend/po/ja.po
M src/backend/po/pt_BR.po
M src/backend/po/ru.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/it.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/it.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_ctl/po/ja.po
M src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_resetxlog/po/de.po
M src/bin/pg_resetxlog/po/it.po
M src/bin/pg_resetxlog/po/pt_BR.po
M src/bin/pg_resetxlog/po/ru.po
M src/bin/psql/po/de.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/pt_BR.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/it.po
M src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/preproc/po/it.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/libpq/po/it.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ru.po
M src/pl/plpgsql/src/po/de.po
M src/pl/plpgsql/src/po/it.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpython/po/it.po
M src/pl/plpython/po/ru.po

Update 9.4 release notes for commits through today.

commit   : f706f2c1a06dfd3fe69194a93d417ca4be8951b1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Oct 2014 14:14:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Oct 2014 14:14:04 -0400    

Click here for diff

Add entries for recent changes, including noting the JSONB format change  
and the recent timezone data changes.  We should remove those two items  
before 9.4 final: the JSONB change will be of no interest in the long  
run, and it's not normally our habit to mention timezone updates in  
major-release notes.  But it seems important to document them temporarily  
for beta testers.  
  
I failed to resist the temptation to wordsmith a couple of existing  
entries, too.  

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

commit   : d0410d66037c2f3f9bee45e0a2db9e47eeba2bb4    
  
author   : Robert Haas <[email protected]>    
date     : Sat, 4 Oct 2014 21:25:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sat, 4 Oct 2014 21:25:41 -0400    

Click here for diff

Teach sigusr1_handler() to use the same test for whether a worker  
might need to be started as ServerLoop().  Aside from being perhaps  
a bit simpler, this prevents a potentially-unbounded delay when  
starting a background worker.  On some platforms, select() doesn't  
return when interrupted by a signal, but is instead restarted,  
including a reset of the timeout to the originally-requested value.  
If signals arrive often enough, but no connection requests arrive,  
sigusr1_handler() will be executed repeatedly, but the body of  
ServerLoop() won't be reached.  This change ensures that, even in  
that case, background workers will eventually get launched.  
  
This is far from a perfect fix; really, we need select() to return  
control to ServerLoop() after an interrupt, either via the self-pipe  
trick or some other mechanism.  But that's going to require more  
work and discussion, so let's do this for now to at least mitigate  
the damage.  
  
Per investigation of test_shm_mq failures on buildfarm member anole.  

M src/backend/postmaster/postmaster.c

Update time zone data files to tzdata release 2014h.

commit   : 513d06ded1b44206903b87dabefee5a97243ba67    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Oct 2014 14:18:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Oct 2014 14:18:19 -0400    

Click here for diff

Most zones in the Russian Federation are subtracting one or two hours  
as of 2014-10-26.  Update the meanings of the abbreviations IRKT, KRAT,  
MAGT, MSK, NOVT, OMST, SAKT, VLAT, YAKT, YEKT to match.  
  
The IANA timezone database has adopted abbreviations of the form AxST/AxDT  
for all Australian time zones, reflecting what they believe to be current  
majority practice Down Under.  These names do not conflict with usage  
elsewhere (other than ACST for Acre Summer Time, which has been in disuse  
since 1994).  Accordingly, adopt these names into our "Default" timezone  
abbreviation set.  The "Australia" abbreviation set now contains only  
CST,EAST,EST,SAST,SAT,WST, all of which are thought to be mostly historical  
usage.  Note that SAST has also been changed to be South Africa Standard  
Time in the "Default" abbreviation set.  
  
Add zone abbreviations SRET (Asia/Srednekolymsk) and XJT (Asia/Urumqi),  
and use WSST/WSDT for western Samoa.  
  
Also a DST law change in the Turks & Caicos Islands (America/Grand_Turk),  
and numerous corrections for historical time zone data.  

M src/backend/utils/misc/postgresql.conf.sample
M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backward
A src/timezone/data/backzone
M src/timezone/data/etcetera
M src/timezone/data/europe
M src/timezone/data/factory
M src/timezone/data/iso3166.tab
M src/timezone/data/leapseconds
M src/timezone/data/northamerica
M src/timezone/data/pacificnew
M src/timezone/data/southamerica
M src/timezone/data/systemv
M src/timezone/data/yearistype.sh
M src/timezone/data/zone.tab
A src/timezone/data/zone1970.tab
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/Africa.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Antarctica.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Australia
M src/timezone/tznames/Australia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Pacific.txt

Update time zone abbreviations lists.

commit   : 4f499eee9d4b30e761b04fa28406578c10b4badf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Oct 2014 17:44:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Oct 2014 17:44:38 -0400    

Click here for diff

This updates known_abbrevs.txt to be what it should have been already,  
were my -P patch not broken; and updates some tznames/ entries that  
missed getting any love in previous timezone data updates because zic  
failed to flag the change of abbreviation.  
  
The non-cosmetic updates:  
  
* Remove references to "ADT" as "Arabia Daylight Time", an abbreviation  
that's been out of use since 2007; therefore, claiming there is a conflict  
with "Atlantic Daylight Time" doesn't seem especially helpful.  (We have  
left obsolete entries in the files when they didn't conflict with anything,  
but that seems like a different situation.)  
  
* Fix entirely incorrect GMT offsets for CKT (Cook Islands), FJT, FJST  
(Fiji); we didn't even have them on the proper side of the date line.  
(Seems to have been aboriginal errors in our tznames data; there's no  
evidence anything actually changed recently.)  
  
* FKST (Falkland Islands Summer Time) is now used all year round, so  
don't mark it as a DST abbreviation.  
  
* Update SAKT (Sakhalin) to mean GMT+11 not GMT+10.  
  
In cosmetic changes, I fixed a bunch of wrong (or at least obsolete)  
claims about abbreviations not being present in the zic files, and  
tried to be consistent about how obsolete abbreviations are labeled.  
  
Note the underlying timezone/data files are still at release 2014e;  
this is just trying to get us in sync with what those files actually  
say before we go to the next update.  

M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Atlantic.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt
M src/timezone/tznames/Pacific.txt

Fix CreatePolicy, pg_dump -v; psql and doc updates

commit   : 78d72563ef141ddc507ddd5ae77db613a309041a    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 3 Oct 2014 16:31:53 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 3 Oct 2014 16:31:53 -0400    

Click here for diff

Peter G pointed out that valgrind was, rightfully, complaining about  
CreatePolicy() ending up copying beyond the end of the parsed policy  
name.  Name is a fixed-size type and we need to use namein (through  
DirectFunctionCall1()) to flush out the entire array before we pass  
it down to heap_form_tuple.  
  
Michael Paquier pointed out that pg_dump --verbose was missing a  
newline and Fabrízio de Royes Mello further pointed out that the  
schema was also missing from the messages, so fix those also.  
  
Also, based on an off-list comment from Kevin, rework the psql \d  
output to facilitate copy/pasting into a new CREATE or ALTER POLICY  
command.  
  
Lastly, improve the pg_policies view and update the documentation for  
it, along with a few other minor doc corrections based on an off-list  
discussion with Adam Brightwell.  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/policy.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/test/regress/expected/rules.out

Fix bogus logic for zic -P option.

commit   : 596857043023738099d6d16f8edbe6b7353876c0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Oct 2014 14:48:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Oct 2014 14:48:11 -0400    

Click here for diff

The quick hack I added to zic to dump out currently-in-use timezone  
abbreviations turns out to have a nasty bug: within each zone, it was  
printing the last "struct ttinfo" to be *defined*, not necessarily the  
last one in use.  This was mainly a problem in zones that had changed the  
meaning of their zone abbreviation (to another GMT offset value) and later  
changed it back.  
  
As a result of this error, we'd missed out updating the tznames/ files  
for some jurisdictions that have changed their zone abbreviations since  
the tznames/ files were originally created.  I'll address the missing data  
updates in a separate commit.  

M src/timezone/zic.c

Don't balance vacuum cost delay when per-table settings are in effect

commit   : 1021bd6a89bc756c2a72b29eeee1a7a5c25f64f5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Oct 2014 13:01:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Oct 2014 13:01:27 -0300    

Click here for diff

When there are cost-delay-related storage options set for a table,  
trying to make that table participate in the autovacuum cost-limit  
balancing algorithm produces undesirable results: instead of using the  
configured values, the global values are always used,  
as illustrated by Mark Kirkwood in  
http://www.postgresql.org/message-id/[email protected]  
  
Since the mechanism is already complicated, just disable it for those  
cases rather than trying to make it cope.  There are undesirable  
side-effects from this too, namely that the total I/O impact on the  
system will be higher whenever such tables are vacuumed.  However, this  
is seen as less harmful than slowing down vacuum, because that would  
cause bloat to accumulate.  Anyway, in the new system it is possible to  
tweak options to get the precise behavior one wants, whereas with the  
previous system one was simply hosed.  
  
This has been broken forever, so backpatch to all supported branches.  
This might affect systems where cost_limit and cost_delay have been set  
for individual tables.  

M doc/src/sgml/maintenance.sgml
M src/backend/postmaster/autovacuum.c

Fix typos in comments.

commit   : 017b2e9822cf6c28fc5024a5f9a6f0d3dde885a4    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Oct 2014 11:47:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Oct 2014 11:47:27 -0400    

Click here for diff

Etsuro Fujita  

M src/backend/rewrite/rewriteHandler.c

Still another typo fix for 0709b7ee72e4bc71ad07b7120acd117265ab51d0.

commit   : 9019264f2e2f87c879855449f57aeeb336ee3c88    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Oct 2014 11:25:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Oct 2014 11:25:28 -0400    

Click here for diff

Buildfarm member anole caught this one.  

M src/include/storage/s_lock.h

Check for GiST index tuples that don't fit on a page.

commit   : 7690ddea0c1f6d16584b3e90010a9933ca7134e0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Oct 2014 12:07:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Oct 2014 12:07:10 +0300    

Click here for diff

The page splitting code would go into infinite recursion if you try to  
insert an index tuple that doesn't fit even on an empty page.  
  
Per analysis and suggested fix by Andrew Gierth. Fixes bug #11555, reported  
by Bryan Seitz (analysis happened over IRC). Backpatch to all supported  
versions.  

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

Fix documentation for CREATE SEQUENCE IF NOT EXISTS.

commit   : 7a08e21f35454ced4050598b09be571a98bdb104    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Oct 2014 10:24:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 3 Oct 2014 10:24:10 +0300    

Click here for diff

The [ IF NOT EXISTS ] was put in wrong place in the syntax.  
  
Pointed out by Marti Raudsepp.  

M doc/src/sgml/ref/create_sequence.sgml

Increase the number of buffer mapping partitions to 128.

commit   : 3acc10c997f916f6a741d0b4876126b7b08e3892    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Oct 2014 13:58:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Oct 2014 13:58:50 -0400    

Click here for diff

Testing by Amit Kapila, Andres Freund, and myself, with and without  
other patches that also aim to improve scalability, seems to indicate  
that this change is a significant win over the current value and over  
smaller values such as 64.  It's not clear how high we can push this  
value before it starts to have negative side-effects elsewhere, but  
going this far looks OK.  

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

Install all headers for the new atomics API.

commit   : 952872698d9443fdf9b808a1376017f00c91065a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 2 Oct 2014 16:39:36 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 2 Oct 2014 16:39:36 +0200    

Click here for diff

Previously, by mistake, only atomics.h was installed.  
  
Kohei KaiGai  

M src/include/Makefile

Fix typo in error message.

commit   : 86f809088c2c4f931b2a7554f4be92cd3f33ba13    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Oct 2014 15:51:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Oct 2014 15:51:31 +0300    

Click here for diff

M contrib/pgbench/pgbench.c

Refactor pgbench log-writing code to a separate function.

commit   : 84f0ea3f68aed5e5b9cc1ef8599a7c28b0b97b0f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Oct 2014 12:58:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 2 Oct 2014 12:58:14 +0300    

Click here for diff

The doCustom function was incredibly long, this makes it a little bit more  
readable.  

M contrib/pgbench/pgbench.c

Fix some more problems with nested append relations.

commit   : 5a6c168c7859e150c61e30b7519471045bab065e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Oct 2014 19:30:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Oct 2014 19:30:24 -0400    

Click here for diff

As of commit a87c72915 (which later got backpatched as far as 9.1),  
we're explicitly supporting the notion that append relations can be  
nested; this can occur when UNION ALL constructs are nested, or when  
a UNION ALL contains a table with inheritance children.  
  
Bug #11457 from Nelson Page, as well as an earlier report from Elvis  
Pranskevichus, showed that there were still nasty bugs associated with such  
cases: in particular the EquivalenceClass mechanism could try to generate  
"join" clauses connecting an appendrel child to some grandparent appendrel,  
which would result in assertion failures or bogus plans.  
  
Upon investigation I concluded that all current callers of  
find_childrel_appendrelinfo() need to be fixed to explicitly consider  
multiple levels of parent appendrels.  The most complex fix was in  
processing of "broken" EquivalenceClasses, which are ECs for which we have  
been unable to generate all the derived equality clauses we would like to  
because of missing cross-type equality operators in the underlying btree  
operator family.  That code path is more or less entirely untested by  
the regression tests to date, because no standard opfamilies have such  
holes in them.  So I wrote a new regression test script to try to exercise  
it a bit, which turned out to be quite a worthwhile activity as it exposed  
existing bugs in all supported branches.  
  
The present patch is essentially the same as far back as 9.2, which is  
where parameterized paths were introduced.  In 9.0 and 9.1, we only need  
to back-patch a small fragment of commit 5b7b5518d, which fixes failure to  
propagate out the original WHERE clauses when a broken EC contains constant  
members.  (The regression test case results show that these older branches  
are noticeably stupider than 9.2+ in terms of the quality of the plans  
generated; but we don't really care about plan quality in such cases,  
only that the plan not be outright wrong.  A more invasive fix in the  
older branches would not be a good idea anyway from a plan-stability  
standpoint.)  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/pathnode.h
M src/include/optimizer/prep.h
A src/test/regress/expected/equivclass.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/equivclass.sql

Refactor replication connection code of various pg_basebackup utilities.

commit   : 0c013e08cfbebd35ec982c4df15d44b521094d52    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 17:22:21 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 17:22:21 +0200    

Click here for diff

Move some more code to manage replication connection command to  
streamutil.c. A later patch will introduce replication slot via  
pg_receivexlog and this avoid duplicating relevant code between  
pg_receivexlog and pg_recvlogical.  
  
Author: Michael Paquier, with some editing by me.  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h

pg_recvlogical.c code review.

commit   : fdf81c9a6cf94921084e52c8d2ff903bae362620    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Sep 2014 15:35:40 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Sep 2014 15:35:40 +0200    

Click here for diff

Several comments still referred to 'initiating', 'freeing', 'stopping'  
replication slots. These were terms used during different phases of  
the development of logical decoding, but are no long accurate.  
  
Also rename StreamLog() to StreamLogicalLog() and add 'void' to the  
prototype.  
  
Author: Michael Paquier, with some editing by me.  
  
Backpatch to 9.4 where pg_recvlogical was introduced.  

M src/bin/pg_basebackup/pg_recvlogical.c

Remove num_xloginsert_locks GUC, replace with a #define

commit   : 5fa6c81a43d047a070eff1f711b90c084c6d3e31    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Oct 2014 16:37:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Oct 2014 16:37:15 +0300    

Click here for diff

I left the GUC in place for the beta period, so that people could experiment  
with different values. No-one's come up with any data that a different value  
would be better under some circumstances, so rather than try to document to  
users what the GUC, let's just hard-code the current value, 8.  

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

Block signals while computing the sleep time in postmaster's main loop.

commit   : a39e78b710eb588e102aedd2828611d7bc74714b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 14:23:43 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 14:23:43 +0200    

Click here for diff

DetermineSleepTime() was previously called without blocked  
signals. That's not good, because it allows signal handlers to  
interrupt its workings.  
  
DetermineSleepTime() was added in 9.3 with the addition of background  
workers (da07a1e856511), where it only read from  
BackgroundWorkerList.  
  
Since 9.4, where dynamic background workers were added (7f7485a0cde),  
the list is also manipulated in DetermineSleepTime(). That's bad  
because the list now can be persistently corrupted if modified by both  
a signal handler and DetermineSleepTime().  
  
This was discovered during the investigation of hangs on buildfarm  
member anole. It's unclear whether this bug is the source of these  
hangs or not, but it's worth fixing either way. I have confirmed that  
it can cause crashes.  
  
It luckily looks like this only can cause problems when bgworkers are  
actively used.  
  
Discussion: [email protected]  
  
Backpatch to 9.3 where background workers were introduced.  

M src/backend/postmaster/postmaster.c

Add functions for dealing with PGP armor header lines to pgcrypto.

commit   : 32984d8fc3dbb90a3fafb69fece0134f1ea790f9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Oct 2014 15:56:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 1 Oct 2014 15:56:26 +0300    

Click here for diff

This add a new pgp_armor_headers function to extract armor headers from an  
ASCII-armored blob, and a new overloaded variant of the armor function, for  
constructing an ASCII-armor with extra headers.  
  
Marko Tiikkaja and me.  

M .gitattributes
M contrib/pgcrypto/Makefile
M contrib/pgcrypto/expected/pgp-armor.out
A contrib/pgcrypto/pgcrypto–1.1–1.2.sql
R094 contrib/pgcrypto/pgcrypto–1.1.sql contrib/pgcrypto/pgcrypto–1.2.sql
M contrib/pgcrypto/pgcrypto.control
M contrib/pgcrypto/pgp-armor.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/sql/pgp-armor.sql
M doc/src/sgml/pgcrypto.sgml

Improve documentation about binary/textual output mode for output plugins.

commit   : 0ef3c29a4b43e72d93cff65a17a9ccccff87618d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 13:13:59 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 13:13:59 +0200    

Click here for diff

Also improve related error message as it contributed to the confusion.  
  
Discussion: CAB7nPqQrqFzjqCjxu4GZzTrD9kpj6HMn9G5aOOMwt1WZ8NfqeA@mail.gmail.com,  
    CAB7nPqQXc_+g95zWnqaa=mVQ4d3BVRs6T41frcEYi2ocUrR3+A@mail.gmail.com  
  
Per discussion between Michael Paquier, Robert Haas and Andres Freund  
  
Backpatch to 9.4 where logical decoding was introduced.  

M contrib/test_decoding/expected/binary.out
M doc/src/sgml/logicaldecoding.sgml
M src/backend/replication/logical/logicalfuncs.c

Rename CACHE_LINE_SIZE to PG_CACHE_LINE_SIZE.

commit   : ef8863844bb0b0dab7b92c5f278302a42b4bf05a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 11:54:05 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 1 Oct 2014 11:54:05 +0200    

Click here for diff

As noted in http://bugs.debian.org/763098 there is a conflict between  
postgres' definition of CACHE_LINE_SIZE and the definition by various  
*bsd platforms. It's debatable who has the right to define such a  
name, but postgres' use was only introduced in 375d8526f290 (9.4), so  
it seems like a good idea to rename it.  
  
Discussion: [email protected]  
  
Per complaint of Christoph Berg in the above email, although he's not  
the original bug reporter.  
  
Backpatch to 9.4 where the define was introduced.  

M src/backend/access/transam/xlog.c
M src/include/pg_config_manual.h

Correct stdin/stdout usage in COPY .. PROGRAM

commit   : 8492d86342915cb466eeb2d896d9b49887f59350    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 30 Sep 2014 15:55:28 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 30 Sep 2014 15:55:28 -0400    

Click here for diff

The COPY documentation incorrectly stated, for the PROGRAM case,  
that we read from stdin and wrote to stdout.  Fix that, and improve  
consistency by referring to the 'PostgreSQL' user instead of the  
'postgres' user, as is done in the rest of the COPY documentation.  
  
Pointed out by Peter van Dijk.  
  
Back-patch to 9.3 where COPY .. PROGRAM was introduced.  

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

Fix pg_dump's --if-exists for large objects

commit   : fd02931a6c83bf3beb2d03f65700600787d569a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Sep 2014 12:06:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Sep 2014 12:06:37 -0300    

Click here for diff

This was born broken in 9067310cc5dd590e36c2c3219dbf3961d7c9f8cb.  
  
Per trouble report from Joachim Wieland.  
  
Pavel Stěhule and Álvaro Herrera  

M src/bin/pg_dump/pg_backup_archiver.c

pg_upgrade: have pg_upgrade fail for old 9.4 JSONB format

commit   : 35419aeb8356e3d6973816846cb6ca64a0f736bf    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 29 Sep 2014 20:19:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 29 Sep 2014 20:19:59 -0400    

Click here for diff

Backpatch through 9.4  

M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/pg_upgrade.h

doc fix for pg_recvlogical: --create doesn't immediately exit.

commit   : 445d262852f7aa83f9973a13bd56320d3a63842c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Sep 2014 01:49:25 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Sep 2014 01:49:25 +0200    

Click here for diff

Author: Michael Paquier  

M doc/src/sgml/ref/pg_recvlogical.sgml

Also revert e3ec0728, JSON regression tests

commit   : 08da8947f4b52ad41770f260a3962b032de77120    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 29 Sep 2014 13:59:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 29 Sep 2014 13:59:32 -0400    

Click here for diff

Managed to forget to update the other JSON regression test output,  
again.  Revert the commit which fixed it before.  
  
Per buildfarm.  

M src/test/regress/expected/json_1.out

Revert 95d737ff to add 'ignore_nulls'

commit   : c8a026e4f15e2063cd7fe6cb9ffe44f2a81398bd    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 29 Sep 2014 13:32:22 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 29 Sep 2014 13:32:22 -0400    

Click here for diff

Per discussion, revert the commit which added 'ignore_nulls' to  
row_to_json.  This capability would be better added as an independent  
function rather than being bolted on to row_to_json.  Additionally,  
the implementation didn't address complex JSON objects, and so was  
incomplete anyway.  
  
Pointed out by Tom and discussed with Andrew and Robert.  

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

Change JSONB's on-disk format for improved performance.

commit   : def4c28cf9147472ba4cfc5b68a098d7a29fb0fb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Sep 2014 12:29:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Sep 2014 12:29:21 -0400    

Click here for diff

The original design used an array of offsets into the variable-length  
portion of a JSONB container.  However, such an array is basically  
uncompressible by simple compression techniques such as TOAST's LZ  
compressor.  That's bad enough, but because the offset array is at the  
front, it tended to trigger the give-up-after-1KB heuristic in the TOAST  
code, so that the entire JSONB object was stored uncompressed; which was  
the root cause of bug #11109 from Larry White.  
  
To fix without losing the ability to extract a random array element in O(1)  
time, change this scheme so that most of the JEntry array elements hold  
lengths rather than offsets.  With data that's compressible at all, there  
tend to be fewer distinct element lengths, so that there is scope for  
compression of the JEntry array.  Every N'th entry is still an offset.  
To determine the length or offset of any specific element, we might have  
to examine up to N preceding JEntrys, but that's still O(1) so far as the  
total container size is concerned.  Testing shows that this cost is  
negligible compared to other costs of accessing a JSONB field, and that  
the method does largely fix the incompressible-data problem.  
  
While at it, rearrange the order of elements in a JSONB object so that  
it's "all the keys, then all the values" not alternating keys and values.  
This doesn't really make much difference right at the moment, but it will  
allow providing a fast path for extracting individual object fields from  
large JSONB values stored EXTERNAL (ie, uncompressed), analogously to the  
existing optimization for substring extraction from large EXTERNAL text  
values.  
  
Bump catversion to denote the incompatibility in on-disk format.  
We will need to fix pg_upgrade to disallow upgrading jsonb data stored  
with 9.4 betas 1 and 2.  
  
Heikki Linnakangas and Tom Lane  

M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/include/catalog/catversion.h
M src/include/utils/jsonb.h

Fix relcache for policies, and doc updates

commit   : ff27fcfa0affe16405e801ed55fed10e7bc75216    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 26 Sep 2014 12:46:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 26 Sep 2014 12:46:26 -0400    

Click here for diff

Andres pointed out that there was an extra ';' in equalPolicies, which  
made me realize that my prior testing with CLOBBER_CACHE_ALWAYS was  
insufficient (it didn't always catch the issue, just most of the time).  
Thanks to that, a different issue was discovered, specifically in  
equalRSDescs.  This change corrects eqaulRSDescs to return 'true' once  
all policies have been confirmed logically identical.  After stepping  
through both functions to ensure correct behavior, I ran this for  
about 12 hours of CLOBBER_CACHE_ALWAYS runs of the regression tests  
with no failures.  
  
In addition, correct a few typos in the documentation which were pointed  
out by Thom Brown (thanks!) and improve the policy documentation further  
by adding a flushed out usage example based on a unix passwd file.  
  
Lastly, clean up a few comments in the regression tests and pg_dump.h.  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/create_policy.sgml
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Fix identify_locking_dependencies for schema-only dumps.

commit   : 07d46a8963ebbf69ef6e6853bb8a45623612dd34    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Sep 2014 11:21:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Sep 2014 11:21:35 -0400    

Click here for diff

Without this fix, parallel restore of a schema-only dump can deadlock,  
because when the dump is schema-only, the dependency will still be  
pointing at the TABLE item rather than the TABLE DATA item.  
  
Robert Haas and Tom Lane  

M src/bin/pg_dump/pg_backup_archiver.c

Further atomic ops portability improvements and bug fixes.

commit   : f9f07411a5b879b232ade66fece7071bd2eb5c26    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 15:55:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 15:55:44 +0200    

Click here for diff

* Don't play tricks for a more efficient pg_atomic_clear_flag() in the  
  generic gcc implementation. The old version was broken on gcc < 4.7  
  on !x86 platforms. Per buildfarm member chipmunk.  
* Make usage of __atomic() fences depend on HAVE_GCC__ATOMIC_INT32_CAS  
  instead of HAVE_GCC__ATOMIC_INT64_CAS - there's platforms with 32bit  
  support that don't support 64bit atomics.  
* Blindly fix two superflous #endif in generic-xlc.h  
* Check for --disable-atomics in platforms but x86.  

M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h

Fix a couple occurrences of 'the the' in the new atomics API.

commit   : a30199b01bd4b06bd13484baefb5f2f411ce14f4    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 09:37:20 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 09:37:20 +0200    

Click here for diff

Author: Erik Rijkers  

M src/include/port/atomics.h

Fix whitespace

commit   : d11339c099fae036f4efffdc69d434c374c820b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Sep 2014 02:43:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Sep 2014 02:43:46 -0400    

Click here for diff

M src/backend/utils/cache/relcache.c
M src/include/port/atomics/generic-gcc.h

Define META_FREE in a way that doesn't cause -Wempty-body warnings.

commit   : 9b6bb9b47153e4bf6d23bef13165491ba440fc23    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 02:55:38 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 02:55:38 +0200    

Click here for diff

That get rids of the only -Wempty-body warning when compiling postgres  
with gcc 4.8/9. As 6550b901f shows, it's useful to be able to use that  
option routinely.  
  
Without asserts there's many more warnings, but that's food for  
another commit.  

M contrib/fuzzystrmatch/dmetaphone.c

Fix atomic ops inline x86 inline assembly for older 32bit gccs.

commit   : f18cad944911f05ad2e876af67362e28584b3c61    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 02:44:44 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 02:44:44 +0200    

Click here for diff

Some x86 32bit versions of gcc apparently generate references to the  
nonexistant %sil register when using when using the r input  
constraint, but not with the =q constraint. The latter restricts  
allocations to a/b/c/d which should all work.  

M src/include/port/atomics/arch-x86.h

Fix atomic ops for x86 gcc compilers that don't understand atomic intrinsics.

commit   : 88bcdf9da5aa67da11ada0921703432ef2b7c21c    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 02:28:52 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Sep 2014 02:28:52 +0200    

Click here for diff

Per buildfarm animal locust.  

M src/include/port/atomics/generic-gcc.h

Add a basic atomic ops API abstracting away platform/architecture details.

commit   : b64d92f1a5602c55ee8b27a7ac474f03b7aee340    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Sep 2014 23:49:05 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Sep 2014 23:49:05 +0200    

Click here for diff

Several upcoming performance/scalability improvements require atomic  
operations. This new API avoids the need to splatter compiler and  
architecture dependent code over all the locations employing atomic  
ops.  
  
For several of the potential usages it'd be problematic to maintain  
both, a atomics using implementation and one using spinlocks or  
similar. In all likelihood one of the implementations would not get  
tested regularly under concurrency. To avoid that scenario the new API  
provides a automatic fallback of atomic operations to spinlocks. All  
properties of atomic operations are maintained. This fallback -  
obviously - isn't as fast as just using atomic ops, but it's not bad  
either. For one of the future users the atomics ontop spinlocks  
implementation was actually slightly faster than the old purely  
spinlock using implementation. That's important because it reduces the  
fear of regressing older platforms when improving the scalability for  
new ones.  
  
The API, loosely modeled after the C11 atomics support, currently  
provides 'atomic flags' and 32 bit unsigned integers. If the platform  
efficiently supports atomic 64 bit unsigned integers those are also  
provided.  
  
To implement atomics support for a platform/architecture/compiler for  
a type of atomics 32bit compare and exchange needs to be  
implemented. If available and more efficient native support for flags,  
32 bit atomic addition, and corresponding 64 bit operations may also  
be provided. Additional useful atomic operations are implemented  
generically ontop of these.  
  
The implementation for various versions of gcc, msvc and sun studio have  
been tested. Additional existing stub implementations for  
* Intel icc  
* HUPX acc  
* IBM xlc  
are included but have never been tested. These will likely require  
fixes based on buildfarm and user feedback.  
  
As atomic operations also require barriers for some operations the  
existing barrier support has been moved into the atomics code.  
  
Author: Andres Freund with contributions from Oskari Saarenmaa  
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera  
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,  
    [email protected],  
    [email protected]  

M config/c-compiler.m4
M configure
M configure.in
M src/backend/main/main.c
M src/backend/port/Makefile
A src/backend/port/atomics.c
M src/backend/storage/lmgr/spin.c
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/pg_config_manual.h
A src/include/port/atomics.h
A src/include/port/atomics/arch-arm.h
A src/include/port/atomics/arch-hppa.h
A src/include/port/atomics/arch-ia64.h
A src/include/port/atomics/arch-ppc.h
A src/include/port/atomics/arch-x86.h
A src/include/port/atomics/fallback.h
A src/include/port/atomics/generic-acc.h
A src/include/port/atomics/generic-gcc.h
A src/include/port/atomics/generic-msvc.h
A src/include/port/atomics/generic-sunpro.h
A src/include/port/atomics/generic-xlc.h
A src/include/port/atomics/generic.h
M src/include/storage/barrier.h
M src/include/storage/s_lock.h
M src/test/regress/expected/lock.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/regress.c
M src/test/regress/sql/lock.sql

Remove ill-conceived ban on zero length json object keys.

commit   : 9111d46351e8c3d82452a7454e43ccbf1991b3dc    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Sep 2014 15:08:42 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Sep 2014 15:08:42 -0400    

Click here for diff

We removed a similar ban on this in json_object recently, but the ban in  
datum_to_json was left, which generate4d sprutious errors in othee json  
generators, notable json_build_object.  
  
Along the way, add an assertion that datum_to_json is not passed a null  
key. All current callers comply with this rule, but the assertion will  
catch any possible future misbehaviour.  

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

Change locking regimen around buffer replacement.

commit   : 5d7962c6797c0baae9ffb3b5b9ac0aec7b598bc3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 25 Sep 2014 10:43:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 25 Sep 2014 10:43:24 -0400    

Click here for diff

Previously, we used an lwlock that was held from the time we began  
seeking a candidate buffer until the time when we found and pinned  
one, which is disastrous for concurrency.  Instead, use a spinlock  
which is held just long enough to pop the freelist or advance the  
clock sweep hand, and then released.  If we need to advance the clock  
sweep further, we reacquire the spinlock once per buffer.  
  
This represents a significant increase in atomic operations around  
buffer eviction, but it still wins on many workloads.  On others, it  
may result in no gain, or even cause a regression, unless the number  
of buffer mapping locks is also increased.  However, that seems like  
material for a separate commit.  We may also need to consider other  
methods of mitigating contention on this spinlock, such as splitting  
it into multiple locks or jumping the clock sweep hand more than one  
buffer at a time, but those, too, seem like separate improvements.  
  
Patch by me, inspired by a much larger patch from Amit Kapila.  
Reviewed by Andres Freund.  

M src/backend/storage/buffer/README
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h
M src/include/storage/lwlock.h

Refactor space allocation for base64 encoding/decoding in pgcrypto.

commit   : 1dcfb8da09c47d2a7502d1dfab06c8be4b6cf323    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 25 Sep 2014 16:32:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 25 Sep 2014 16:32:27 +0300    

Click here for diff

Instead of trying to accurately calculate the space needed, use a StringInfo  
that's enlarged as needed. This is just moving things around currently - the  
old code was not wrong - but this is in preparation for a patch that adds  
support for extra armor headers, and would make the space calculation more  
complicated.  
  
Marko Tiikkaja  

M contrib/pgcrypto/pgp-armor.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp.h

Fix VPATH builds of the replication parser from git for some !gcc compilers.

commit   : 56a312aac8802c2aa01530101d2d19e63568eeda    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Sep 2014 15:22:26 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Sep 2014 15:22:26 +0200    

Click here for diff

Some compilers don't automatically search the current directory for  
included files. 9cc2c182fc2 fixed that for builds from tarballs by  
adding an include to the source directory. But that doesn't work when  
the scanner is generated in the VPATH directory. Use the same search  
path as the other parsers in the tree.  
  
One compiler that definitely was affected is solaris' sun cc.  
  
Backpatch to 9.1 which introduced using an actual parser for  
replication commands.  

M src/backend/replication/Makefile

Return NULL from json_object_agg if it gets no rows.

commit   : ecacbdbcee67e202cfcaa1180da170b9f13654bb    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Sep 2014 08:18:18 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Sep 2014 08:18:18 -0400    

Click here for diff

This makes it consistent with the docs and with all other builtin  
aggregates apart from count().  

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

Add -D option to specify data directory to pg_controldata and pg_resetxlog.

commit   : b0d81adea650a4bc2b9391234345bb935b89a694    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 25 Sep 2014 13:26:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 25 Sep 2014 13:26:18 +0300    

Click here for diff

It was confusing that to other commands, like initdb and postgres, you would  
pass the data directory with "-D datadir", but pg_controldata and  
pg_resetxlog would take just plain path, without the "-D". With this patch,  
pg_controldata and pg_resetxlog also accept "-D datadir".  
  
Abhijit Menon-Sen, with minor kibitzing by me  

M doc/src/sgml/ref/pg_controldata.sgml
M doc/src/sgml/ref/pg_resetxlog.sgml
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetxlog/pg_resetxlog.c

Copy-editing of row security

commit   : afd1d95f5bf0cb48af77e5897eb4c356b5371c7b    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 24 Sep 2014 17:45:11 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 24 Sep 2014 17:45:11 -0400    

Click here for diff

Address a few typos in the row security update, pointed out  
off-list by Adam Brightwell.  Also include 'ALL' in the list  
of commands supported, for completeness.  

M doc/src/sgml/ddl.sgml
M src/backend/commands/policy.c

Code review for row security.

commit   : 6550b901fe7c47c03775400e0c790c6c1234a017    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 24 Sep 2014 16:32:22 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 24 Sep 2014 16:32:22 -0400    

Click here for diff

Buildfarm member tick identified an issue where the policies in the  
relcache for a relation were were being replaced underneath a running  
query, leading to segfaults while processing the policies to be added  
to a query.  Similar to how TupleDesc RuleLocks are handled, add in a  
equalRSDesc() function to check if the policies have actually changed  
and, if not, swap back the rsdesc field (using the original instead of  
the temporairly built one; the whole structure is swapped and then  
specific fields swapped back).  This now passes a CLOBBER_CACHE_ALWAYS  
for me and should resolve the buildfarm error.  
  
In addition to addressing this, add a new chapter in Data Definition  
under Privileges which explains row security and provides examples of  
its usage, change \d to always list policies (even if row security is  
disabled- but note that it is disabled, or enabled with no policies),  
rework check_role_for_policy (it really didn't need the entire policy,  
but it did need to be using has_privs_of_role()), and change the field  
in pg_class to relrowsecurity from relhasrowsecurity, based on  
Heikki's suggestion.  Also from Heikki, only issue SET ROW_SECURITY in  
pg_restore when talking to a 9.5+ server, list Bypass RLS in \du, and  
document --enable-row-security options for pg_dump and pg_restore.  
  
Lastly, fix a number of minor whitespace and typo issues from Heikki,  
Dimitri, add a missing #include, per Peter E, fix a few minor  
variable-assigned-but-not-used and resource leak issues from Coverity  
and add tab completion for role attribute bypassrls as well.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/system_views.sql
M src/backend/commands/policy.c
M src/backend/commands/tablecmds.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_restore.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/commands/policy.h
M src/test/regress/expected/rules.out

Fix bogus variable-mangling in security_barrier_replace_vars().

commit   : 3f6f9260e308a331e6809d5309b17d1613ff900f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Sep 2014 15:59:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Sep 2014 15:59:34 -0400    

Click here for diff

This function created new Vars with varno different from varnoold, which  
is a condition that should never prevail before setrefs.c does the final  
variable-renumbering pass.  The created Vars could not be seen as equal()  
to normal Vars, which among other things broke equivalence-class processing  
for them.  The consequences of this were indeed visible in the regression  
tests, in the form of failure to propagate constants as one would expect.  
I stumbled across it while poking at bug #11457 --- after intentionally  
disabling join equivalence processing, the security-barrier regression  
tests started falling over with fun errors like "could not find pathkey  
item to sort", because of failure to match the corrupted Vars to normal  
ones.  

M src/backend/optimizer/prep/prepsecurity.c
M src/test/regress/expected/updatable_views.out

Fix typos in descriptions of json_object functions.

commit   : b1a52872ae68ce7fe9558a75295200a0d10d1f56    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Sep 2014 11:24:42 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Sep 2014 11:24:42 -0400    

Click here for diff

M src/include/catalog/pg_proc.h

Fix incorrect search for "x?" style matches in creviterdissect().

commit   : 3694b4d7e1aa02f917f9d18c550fbb49b96efa83    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Sep 2014 20:25:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Sep 2014 20:25:31 -0400    

Click here for diff

When the number of allowed iterations is limited (either a "?" quantifier  
or a bound expression), the last sub-match has to reach to the end of the  
target string.  The previous coding here first tried the shortest possible  
match (one character, usually) and then gave up and back-tracked if that  
didn't work, typically leading to failure to match overall, as shown in  
bug #11478 from Christoph Berg.  The minimum change to fix that would be to  
not decrement k before "goto backtrack"; but that would be a pretty stupid  
solution, because we'd laboriously try each possible sub-match length  
before finally discovering that only ending at the end can work.  Instead,  
force the sub-match endpoint limit up to the end for even the first  
shortest() call if we cannot have any more sub-matches after this one.  
  
Bug introduced in my rewrite that added the iterdissect logic, commit  
173e29aa5deefd9e71c183583ba37805c8102a72.  The shortest-first search code  
was too closely modeled on the longest-first code, which hasn't got this  
issue since it tries a match reaching to the end to start with anyway.  
Back-patch to all affected branches.  

M src/backend/regex/regexec.c
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Add unicode_*_linestyle to \? variables

commit   : a564307373089fc81a07bce49236fe2bd66de0fe    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 22 Sep 2014 21:51:25 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 22 Sep 2014 21:51:25 -0400    

Click here for diff

In a2dabf0 we added the ability to have single or double unicode  
linestyle for the border, column, or header.  Unfortunately, the  
\? variables output was not updated for these new psql variables.  
  
This corrects that oversight.  
  
Patch by Pavel Stehule.  

M src/bin/psql/help.c

Log ALTER SYSTEM statements as DDL

commit   : 43bed84c320443ee7247f7ca8d609640651aab93    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 22 Sep 2014 20:50:17 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 22 Sep 2014 20:50:17 -0400    

Click here for diff

Per discussion in bug #11350, log ALTER SYSTEM commands at the  
log_statement=ddl level, rather than at the log_statement=all level.  
  
Pointed out by Tomonari Katsumata.  
  
Back-patch to 9.4 where ALTER SYSTEM was introduced.  

M src/backend/tcop/utility.c

Process withCheckOption exprs in setrefs.c

commit   : 6ef8c658af2127f4e62cb24feade8b465c9e2fea    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 22 Sep 2014 20:12:51 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 22 Sep 2014 20:12:51 -0400    

Click here for diff

While withCheckOption exprs had been handled in many cases by  
happenstance, they need to be handled during set_plan_references and  
more specifically down in set_plan_refs for ModifyTable plan nodes.  
This is to ensure that the opfuncid's are set for operators referenced  
in the withCheckOption exprs.  
  
Identified as an issue by Thom Brown  
  
Patch by Dean Rasheed  
  
Back-patch to 9.4, where withCheckOption was introduced.  

M src/backend/optimizer/plan/setrefs.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Remove most volatile qualifiers from xlog.c

commit   : 6ba4ecbf477e0b25dd7bde1b0c4e07fc2da19348    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Sep 2014 23:35:08 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Sep 2014 23:35:08 +0200    

Click here for diff

For the reason outlined in df4077cda2e also remove volatile qualifiers  
from xlog.c. Some of these uses of volatile have been added after  
noticing problems back when spinlocks didn't imply compiler  
barriers. So they are a good test - in fact removing the volatiles  
breaks when done without the barriers in spinlocks present.  
  
Several uses of volatile remain where they are explicitly used to  
access shared memory without locks. These locations are ok with  
slightly out of date data, but removing the volatile might lead to the  
variables never being reread from memory. These uses could also be  
replaced by barriers, but that's a separate change of doubtful value.  

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

Remove volatile qualifiers from lwlock.c.

commit   : df4077cda2eae3eb4a5cf387da0c1e7616e73204    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Sep 2014 16:42:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Sep 2014 16:42:14 -0400    

Click here for diff

Now that spinlocks (hopefully!) act as compiler barriers, as of commit  
0709b7ee72e4bc71ad07b7120acd117265ab51d0, this should be safe.  This  
serves as a demonstration of the new coding style, and may be optimized  
better on some machines as well.  

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

Fix compiler warning.

commit   : e38da8d6b1bd494b72a6f84310d30b55b3f67c3e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Sep 2014 16:32:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Sep 2014 16:32:35 -0400    

Click here for diff

It is meaningless to declare a pass-by-value return type const.  

M src/backend/commands/policy.c

Fix mishandling of CreateEventTrigStmt's eventname field.

commit   : 763ba1b0f2aa8353e3e3b02bc6bd965deb4575e0    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Sep 2014 16:05:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Sep 2014 16:05:51 -0400    

Click here for diff

It's a string, not a scalar.  
  
Petr Jelinek  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

Remove postgres --help blurb about the removed -A option.

commit   : 0926ef43c160cc8334d3e86f364bf9a7aa2da43f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Sep 2014 16:50:40 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Sep 2014 16:50:40 +0200    

Click here for diff

I missed this in 3bdcf6a5a755503.  
  
Noticed by Merlin Moncure  
Discussion: CAHyXU0yC7uPeeVzQROwtnrOP9dxTEUPYjB0og4qUnbipMEV57w@mail.gmail.com  

M src/backend/main/main.c

Improve code around the recently added rm_identify rmgr callback.

commit   : 604f7956b9460192222dd37bd3baea24cb669a47    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Sep 2014 16:48:14 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Sep 2014 16:48:14 +0200    

Click here for diff

There are four weaknesses in728f152e07f998d2cb4fe5f24ec8da2c3bda98f2:  
  
* append_init() in heapdesc.c was ugly and required that rm_identify  
  return values are only valid till the next call. Instead just add a  
  couple more switch() cases for the INIT_PAGE cases. Now the returned  
  value will always be valid.  
* a couple rm_identify() callbacks missed masking xl_info with  
  ~XLR_INFO_MASK.  
* pg_xlogdump didn't map a NULL rm_identify to UNKNOWN or a similar  
  string.  
* append_init() was called when id=NULL - which should never actually  
  happen. But it's better to be careful.  

M contrib/pg_xlogdump/pg_xlogdump.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/heapdesc.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/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/transam/xlog.c
M src/include/access/xlog_internal.h

Fix failure of contrib/auto_explain to print per-node timing information.

commit   : 898f8a96ef9dfa79eac9ec1621a89e71fe16601c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Sep 2014 13:18:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Sep 2014 13:18:56 -0400    

Click here for diff

This has been broken since commit af7914c6627bcf0b0ca614e9ce95d3f8056602bf,  
which added the EXPLAIN (TIMING) option.  Although that commit included  
updates to auto_explain, they evidently weren't tested very carefully,  
because the code failed to print node timings even when it should, due to  
failure to set es.timing in the ExplainState struct.  Reported off-list by  
Neelakanth Nadgir of Salesforce.  
  
In passing, clean up the documentation for auto_explain's options a  
little bit, including re-ordering them into what seems to me a more  
logical order.  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/auto-explain.sgml

doc: Use <literal> and all-caps for READ COMMITTED isolation level.

commit   : a92b5f969bed9796bcb3c321e7be4124a4533067    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Sep 2014 13:07:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Sep 2014 13:07:24 -0400    

Click here for diff

The documentation overall is not entirely consistent about how we do  
this, but this is consistent with other usages within lock.sgml.  
  
Etsuro Fujita  

M doc/src/sgml/ref/lock.sgml

Add a fast pre-check for equality of equal-length strings.

commit   : e246b3d6eac09d0770e6f68e69f2368d02db88af    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 19 Sep 2014 12:39:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 19 Sep 2014 12:39:00 -0400    

Click here for diff

Testing reveals that that doing a memcmp() before the strcoll() costs  
practically nothing, at least on the systems we tested, and it speeds  
up sorts containing many equal strings significatly.  
  
Peter Geoghegan.  Review by myself and Heikki Linnakangas.  Comments  
rewritten by me.  

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

Row-Level Security Policies (RLS)

commit   : 491c029dbc4206779cf659aa0ff986af7831d2ff    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 19 Sep 2014 11:18:35 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 19 Sep 2014 11:18:35 -0400    

Click here for diff

Building on the updatable security-barrier views work, add the  
ability to define policies on tables to limit the set of rows  
which are returned from a query and which are allowed to be added  
to a table.  Expressions defined by the policy for filtering are  
added to the security barrier quals of the query, while expressions  
defined to check records being added to a table are added to the  
with-check options of the query.  
  
New top-level commands are CREATE/ALTER/DROP POLICY and are  
controlled by the table owner.  Row Security is able to be enabled  
and disabled by the owner on a per-table basis using  
ALTER TABLE .. ENABLE/DISABLE ROW SECURITY.  
  
Per discussion, ROW SECURITY is disabled on tables by default and  
must be enabled for policies on the table to be used.  If no  
policies exist on a table with ROW SECURITY enabled, a default-deny  
policy is used and no records will be visible.  
  
By default, row security is applied at all times except for the  
table owner and the superuser.  A new GUC, row_security, is added  
which can be set to ON, OFF, or FORCE.  When set to FORCE, row  
security will be applied even for the table owner and superusers.  
When set to OFF, row security will be disabled when allowed and an  
error will be thrown if the user does not have rights to bypass row  
security.  
  
Per discussion, pg_dump sets row_security = OFF by default to ensure  
that exports and backups will have all data in the table or will  
error if there are insufficient privileges to bypass row security.  
A new option has been added to pg_dump, --enable-row-security, to  
ask pg_dump to export with row security enabled.  
  
A new role capability, BYPASSRLS, which can only be set by the  
superuser, is added to allow other users to be able to bypass row  
security using row_security = OFF.  
  
Many thanks to the various individuals who have helped with the  
design, particularly Robert Haas for his feedback.  
  
Authors include Craig Ringer, KaiGai Kohei, Adam Brightwell, Dean  
Rasheed, with additional changes and rework by me.  
  
Reviewers have included all of the above, Greg Smith,  
Jeff McCormick, and Robert Haas.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/keywords.sgml
M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/alter_policy.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_table.sgml
A doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_role.sgml
A doc/src/sgml/ref/drop_policy.sgml
M doc/src/sgml/reference.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/system_views.sql
M src/backend/commands/Makefile
M src/backend/commands/alter.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
A src/backend/commands/policy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/user.c
M src/backend/executor/execMain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/gram.y
M src/backend/rewrite/Makefile
M src/backend/rewrite/rewriteHandler.c
A src/backend/rewrite/rowsecurity.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_class.h
A src/include/catalog/pg_rowsecurity.h
A src/include/commands/policy.h
M src/include/miscadmin.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/planmain.h
M src/include/parser/kwlist.h
A src/include/rewrite/rowsecurity.h
M src/include/utils/acl.h
M src/include/utils/plancache.h
M src/include/utils/rel.h
M src/test/regress/expected/dependency.out
M src/test/regress/expected/privileges.out
A src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/rowsecurity.sql

Mark x86's memory barrier inline assembly as clobbering the cpu flags.

commit   : e5603a2f35baa0bc9d61b16373383fdd37e49509    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 17:04:00 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 17:04:00 +0200    

Click here for diff

x86's memory barrier assembly was marked as clobbering "memory" but  
not "cc" even though 'addl' sets various flags. As it turns out gcc on  
x86 implicitly assumes "cc" on every inline assembler statement, so  
it's not a bug. But as that's poorly documented and might get copied  
to architectures or compilers where that's not the case, it seems  
better to be precise.  
  
Discussion: [email protected]  
  
To keep the code common, backpatch to 9.2 where explicit memory  
barriers were introduced.  

M src/include/storage/barrier.h

Avoid 'clobbered by longjmp' warning in psql/copy.c.

commit   : afaefa1b31ba900bdc6987a752483e1580356e48    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 16:41:54 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 16:41:54 +0200    

Click here for diff

This was introduced in 51bb79569f934ad2135c2ff859c61b9ab8d51750.  

M src/bin/psql/copy.c

Add the capability to display summary statistics to pg_xlogdump.

commit   : bdd5726c347016ea34e9fb68d1b8b71046e25d2e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 16:33:16 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 16:33:16 +0200    

Click here for diff

The new --stats/--stats=record options to pg_xlogdump display per  
rmgr/per record statistics about the parsed WAL. This is useful to  
understand what the WAL primarily consists of, to allow targeted  
optimizations on application, configuration, and core code level.  
  
It is likely that we will want to fine tune the statistics further,  
but the feature already is quite helpful.  
  
Author: Abhijit Menon-Sen, slightly editorialized by me  
Reviewed-By: Andres Freund, Dilip Kumar and Furuya Osamu  
Discussion: [email protected]  

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

Add rmgr callback to name xlog record types for display purposes.

commit   : 728f152e07f998d2cb4fe5f24ec8da2c3bda98f2    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 15:17:12 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Sep 2014 15:17:12 +0200    

Click here for diff

This is primarily useful for the upcoming pg_xlogdump --stats feature,  
but also allows to remove some duplicated code in the rmgr_desc  
routines.  
  
Due to the separation and harmonization, the output of dipsplayed  
records changes somewhat. But since this isn't enduser oriented  
content that's ok.  
  
It's potentially desirable to further change pg_xlogdump's display of  
records. It previously wasn't possible to show the record type  
separately from the description forcing it to be in the last  
column. But that's better done in a separate commit.  
  
Author: Abhijit Menon-Sen, slightly editorialized by me  
Reviewed-By: Álvaro Herrera, Andres Freund, and Heikki Linnakangas  
Discussion: [email protected]  

M contrib/pg_xlogdump/pg_xlogdump.c
M contrib/pg_xlogdump/rmgrdesc.c
M contrib/pg_xlogdump/rmgrdesc.h
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/dbasedesc.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/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.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/transam/rmgr.c
M src/backend/access/transam/xlog.c
M src/include/access/clog.h
M src/include/access/gin.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/heapam_xlog.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/rmgr.h
M src/include/access/rmgrlist.h
M src/include/access/spgist.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/storage_xlog.h
M src/include/commands/dbcommands.h
M src/include/commands/sequence.h
M src/include/commands/tablespace.h
M src/include/storage/standby.h
M src/include/utils/relmapper.h

Fix configure check for %z printf support after INT64_MODIFIER changes.

commit   : 7e3f728353fa9b36c7f98b6ec447d3f1b8deec14    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 18 Sep 2014 09:59:10 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 18 Sep 2014 09:59:10 +0200    

Click here for diff

The PGAC_FUNC_SNPRINTF_SIZE_T_SUPPORT test was broken by  
ce486056ecd28050. Among others it made the UINT64_FORMAT macro to be  
defined in c.h, instead of directly being defined by configure.  
  
This lead to the replacement printf being used on all platforms for a  
while. Which seems to work, because this was only used due to  
different profiles ;)  
  
Fix by relying on INT64_MODIFIER instead.  

M config/c-library.m4
M configure

Fix TAP checks when current directory name contains spaces

commit   : f7d6759ec2df9ad10b65aea359a27789e16a353b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Sep 2014 00:54:12 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Sep 2014 00:54:12 -0400    

Click here for diff

Add some quotes in the makefile snippet that creates the temporary  
installation, so that it can handle spaces in the directory name and  
possibly some other oddities.  

M src/Makefile.global.in

Fix the return type of GIN triConsistent support functions to "char".

commit   : 77e65bf369edd0282531794dd907a0943651eff8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Sep 2014 09:11:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Sep 2014 09:11:49 +0300    

Click here for diff

They were marked to return a boolean, but they actually return a  
GinTernaryValue, which is more like a "char". It makes no practical  
difference, as the triConsistent functions cannot be called directly from  
SQL because they have "internal" arguments, but this nevertheless seems  
more correct.  
  
Also fix the GinTernaryValue name in the documentation. I renamed the enum  
earlier, but neglected the docs.  
  
Alexander Korotkov. This is new in 9.4, so backpatch there.  

M doc/src/sgml/gin.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Follow the RFCs more closely in libpq server certificate hostname check.

commit   : 58e70cf9fb42c1ad60b8ba730fd129f2ce6fa332    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 15 Sep 2014 16:14:24 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 15 Sep 2014 16:14:24 +0300    

Click here for diff

The RFCs say that the CN must not be checked if a subjectAltName extension  
of type dNSName is present. IOW, if subjectAltName extension is present,  
but there are no dNSNames, we can still check the CN.  
  
Alexey Klyukin  

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

Fix pointer type in size passed to memset.

commit   : 2df465e696f49bb12c0a362aa6f68f75a752d7a8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 14 Sep 2014 16:45:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 14 Sep 2014 16:45:08 +0300    

Click here for diff

Pointers are all the same size, so it makes no practical difference, but  
let's be tidy.  
  
Found by Coverity, noted off-list by Tom Lane.  

M src/backend/executor/nodeHash.c

Invent PGC_SU_BACKEND and mark log_connections/log_disconnections that way.

commit   : fe550b2ac249af5fbd8e9e19290a4ba43c882f2d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Sep 2014 21:01:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Sep 2014 21:01:49 -0400    

Click here for diff

This new GUC context option allows GUC parameters to have the combined  
properties of PGC_BACKEND and PGC_SUSET, ie, they don't change after  
session start and non-superusers can't change them.  This is a more  
appropriate choice for log_connections and log_disconnections than their  
previous context of PGC_BACKEND, because we don't want non-superusers  
to be able to affect whether their sessions get logged.  
  
Note: the behavior for log_connections is still a bit odd, in that when  
a superuser attempts to set it from PGOPTIONS, the setting takes effect  
but it's too late to enable or suppress connection startup logging.  
It's debatable whether that's worth fixing, and in any case there is  
a reasonable argument for PGC_SU_BACKEND to exist.  
  
In passing, re-pgindent the files touched by this commit.  
  
Fujii Masao, reviewed by Joe Conway and Amit Kapila  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Run missing documentation tools through "missing"

commit   : c2a01439c04404ad8b271f788188c807a3de67d1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Sep 2014 20:14:17 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Sep 2014 20:14:17 -0400    

Click here for diff

Instead of just erroring out when a tool is missing, wrap the call with  
the "missing" script that we are already using for bison, flex, and  
perl, so that the users get a useful error message.  

M configure
M configure.in
M doc/src/sgml/Makefile
M src/Makefile.global.in

pg_ctl: Add tests for behavior with nonexistent data directory

commit   : 839acf9461deb0affb0dd710723cffeb72ffd82f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Sep 2014 15:18:49 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Sep 2014 15:18:49 -0400    

Click here for diff

This behavior was made more precise in commit  
11d205e2bd66cefe0b7d69c02e831cd055cbb5bb.  

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

Revert f68dc5d86b9f287f80f4417f5a24d876eb13771d

commit   : 95c38a989569abe4981ae25ef03ffb2c328f6c83    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Sep 2014 20:42:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Sep 2014 20:42:19 -0400    

Click here for diff

Renaming will have to be more comprehensive, so I need approval.  

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

More formatting.c variable renaming, for clarity

commit   : f68dc5d86b9f287f80f4417f5a24d876eb13771d    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Sep 2014 20:34:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Sep 2014 20:34:25 -0400    

Click here for diff

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

Change NTUP_PER_BUCKET to 1 to improve hash join lookup speed.

commit   : 8cce08f168481c5fc5be4e7e29b968e314f1b41e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Sep 2014 16:11:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Sep 2014 16:11:58 -0400    

Click here for diff

Since this makes the bucket headers use ~10x as much memory, properly  
account for that memory when we figure out whether everything fits  
in work_mem.  This might result in some cases that previously used  
only a single batch getting split into multiple batches, but it's  
unclear as yet whether we need defenses against that case, and if so,  
what the shape of those defenses should be.  
  
It's worth noting that even in these edge cases, users should still be  
no worse off than they would have been last week, because commit  
45f6240a8fa9d35548eb2ef23dba2c11540aa02a saved a big pile of memory  
on exactly the same workloads.  
  
Tomas Vondra, reviewed and somewhat revised by me.  

M src/backend/executor/nodeHash.c

Add GUC to enable logging of replication commands.

commit   : 4ad2a548050fdde07fed93e6c60a4d0a7eba0622    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 13 Sep 2014 02:55:45 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 13 Sep 2014 02:55:45 +0900    

Click here for diff

Previously replication commands like IDENTIFY_COMMAND were not logged  
even when log_statements is set to all. Some users who want to audit  
all types of statements were not satisfied with this situation. To  
address the problem, this commit adds new GUC log_replication_commands.  
If it's enabled, all replication commands are logged in the server log.  
  
There are many ways to allow us to enable that logging. For example,  
we can extend log_statement so that replication commands are logged  
when it's set to all. But per discussion in the community, we reached  
the consensus to add separate GUC for that.  
  
Reviewed by Ian Barwick, Robert Haas and Heikki Linnakangas.  

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

Add unicode_{column|header|border}_style to psql

commit   : a2dabf0e1dda93c860b10bff7b73617e7b090108    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 12 Sep 2014 12:04:37 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 12 Sep 2014 12:04:37 -0400    

Click here for diff

With the unicode linestyle, this adds support to control if the  
column, header, or border style should be single or double line  
unicode characters.  The default remains 'single'.  
  
In passing, clean up the border documentation and address some  
minor formatting/spelling issues.  
  
Pavel Stehule, with some additional changes by me.  

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

Handle border = 3 in expanded mode

commit   : 82962838d4bea2a20babbd2efacb48b268b4a689    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 12 Sep 2014 11:11:53 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 12 Sep 2014 11:11:53 -0400    

Click here for diff

In psql, expanded mode was not being displayed correctly when using  
the normal ascii or unicode linestyles and border set to '3'.  Now,  
per the documentation, border '3' is really only sensible for HTML  
and LaTeX formats, however, that's no excuse for ascii/unicode to  
break in that case, and provisions had been made for psql to cleanly  
handle this case (and it did, in non-expanded mode).  
  
This was broken when ascii/unicode was initially added a good five  
years ago because print_aligned_vertical_line wasn't passed in the  
border setting being used by print_aligned_vertical but instead was  
given the whole printTableContent.  There really isn't a good reason  
for vertical_line to have the entire printTableContent structure, so  
just pass in the printTextFormat and border setting (similar to how  
this is handled in horizontal_line).  
  
Pointed out by Pavel Stehule, fix by me.  
  
Back-patch to all currently-supported versions.  

M src/bin/psql/print.c

Support Subject Alternative Names in SSL server certificates.

commit   : acd08d764a361dcebd346227281ff0ca62b60936    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Sep 2014 17:12:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Sep 2014 17:12:11 +0300    

Click here for diff

This patch makes libpq check the server's hostname against DNS names listed  
in the X509 subjectAltName extension field in the server certificate. This  
allows the same certificate to be used for multiple domain names. If there  
are no SANs in the certificate, the Common Name field is used, like before  
this patch. If both are given, the Common Name is ignored. That is a bit  
surprising, but that's the behavior mandated by the relevant RFCs, and it's  
also what the common web browsers do.  
  
This also adds a libpq_ngettext helper macro to allow plural messages to be  
translated in libpq. Apparently this happened to be the first plural message  
in libpq, so it was not needed before.  
  
Alexey Klyukin, with some kibitzing by me.  

M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h

Fix GIN data page split ratio calculation.

commit   : 774a78ffe47557313d69c2b27e7d61480a3b9d1f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Sep 2014 11:23:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 12 Sep 2014 11:23:59 +0300    

Click here for diff

The code that tried to split a page at 75/25 ratio, when appending to the  
end of an index, was buggy in two ways. First, there was a silly typo that  
caused it to just fill the left page as full as possible. But the logic as  
it was intended wasn't correct either, and would actually have given a ratio  
closer to 60/40 than 75/25.  
  
Gaetano Mendola spotted the typo. Backpatch to 9.4, where this code was added.  

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

Fix power_var_int() for large integer exponents.

commit   : 1d352325b88afef6effbd2c3a52930b824944375    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Sep 2014 23:30:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Sep 2014 23:30:51 -0400    

Click here for diff

The code for raising a NUMERIC value to an integer power wasn't very  
careful about large powers.  It got an outright wrong answer for an  
exponent of INT_MIN, due to failure to consider overflow of the Abs(exp)  
operation; which is fixable by using an unsigned rather than signed  
exponent value after that point.  Also, even though the number of  
iterations of the power-computation loop is pretty limited, it's easy for  
the repeated squarings to result in ridiculously enormous intermediate  
values, which can take unreasonable amounts of time/memory to process,  
or even overflow the internal "weight" field and so produce a wrong answer.  
We can forestall misbehaviors of that sort by bailing out as soon as the  
weight value exceeds what will fit in int16, since then the final answer  
must overflow (if exp > 0) or underflow (if exp < 0) the packed numeric  
format.  
  
Per off-list report from Pavel Stehule.  Back-patch to all supported  
branches.  

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

Fix JSON regression tests.

commit   : e3ec07280cc2bd4201f62cbde9a15a62eb54bc40    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Sep 2014 22:34:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Sep 2014 22:34:32 -0400    

Click here for diff

Commit 95d737ff45a38809130a2c633d9e6bc26c825036 neglected to update  
expected/json_1.out.  Per buildfarm.  

M src/test/regress/expected/json_1.out

Fix vacuumdb --analyze-in-stages --all order

commit   : da24813c2079c67363d5333bab5cfb3fcf969713    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Sep 2014 21:08:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Sep 2014 21:08:59 -0400    

Click here for diff

When running vacuumdb --analyze-in-stages --all, it needs to run the  
first stage across all databases before the second one, instead of  
running all stages in a database before processing the next one.  
  
Also respect the --quiet option with --analyze-in-stages.  

M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/vacuumdb.c

Add 'ignore_nulls' option to row_to_json

commit   : 95d737ff45a38809130a2c633d9e6bc26c825036    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 11 Sep 2014 21:23:51 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 11 Sep 2014 21:23:51 -0400    

Click here for diff

Provide an option to skip NULL values in a row when generating a JSON  
object from that row with row_to_json.  This can reduce the size of the  
JSON object in cases where columns are NULL without really reducing the  
information in the JSON object.  
  
This also makes row_to_json into a single function with default values,  
rather than having multiple functions.  In passing, change array_to_json  
to also be a single function with default values (we don't add an  
'ignore_nulls' option yet- it's not clear that there is a sensible  
use-case there, and it hasn't been asked for in any case).  
  
Pavel Stehule  

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

pg_upgrade: adjust C comments

commit   : c3c75fcd7a03067d87b830e98e3698b683446762    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Sep 2014 18:44:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Sep 2014 18:44:00 -0400    

Click here for diff

M contrib/pg_upgrade/controldata.c

Remove dead InRecovery check.

commit   : aae7af3df8054d83b3080f94ca98a5698e8b3de0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 22:43:56 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 22:43:56 +0300    

Click here for diff

With the new B-tree incomplete split handling in 9.4, _bt_insert_parent is  
never called in recovery.  

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

improve hash creation warning message

commit   : 849462a9fafbb30856e47f7862543b1aefa95796    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Sep 2014 13:40:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Sep 2014 13:40:06 -0400    

Click here for diff

This improves the wording of commit 84aa8ba128a08e6fdebb2497c7a79ebf18093e12.  
  
Report by Kevin Grittner  

M src/backend/commands/indexcmds.c
M src/test/regress/expected/create_index.out
M src/test/regress/expected/enum.out
M src/test/regress/expected/macaddr.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/uuid.out

Add missing volatile qualifier.

commit   : 68e66923ff629c324e219090860dc9e0e0a6f5d6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Sep 2014 09:05:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Sep 2014 09:05:48 -0400    

Click here for diff

Yet another silly mistake in 0709b7ee72e4bc71ad07b7120acd117265ab51d0,  
again found by buildfarm member castoroides.  

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

Fix Windows build.

commit   : 01a2bfd172b21ce86894bfa00f6896f504607ab4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 15:15:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 15:15:40 +0300    

Click here for diff

I renamed a variable, but missed an #ifdef WIN32 block.  

M contrib/pgbench/pgbench.c

Silence compiler warning on Windows.

commit   : 0ed41529f6ab92b836336fdd096f924838eea1d7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 13:50:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 13:50:14 +0300    

Click here for diff

David Rowley.  

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

Simplify calculation of Poisson distributed delays in pgbench --rate mode.

commit   : 54a2d5b37b790cbfaf568fbbe6d2cc89650551d1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 13:00:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 13:00:48 +0300    

Click here for diff

The previous coding first generated a uniform random value between 0.0 and  
1.0, then converted that to an integer between 1 and 10000, and divided that  
again by 10000. Those conversions are unnecessary; we can use the double  
value that pg_erand48() returns directly. While we're at it, put the logic  
into a helper function, getPoissonRand().  
  
The largest delay generated by the old coding was about 9.2 times the  
average, because of the way the uniformly distributed value used for the  
calculation was truncated to 1/10000 granularity. The new coding doesn't  
have such clamping. With my laptop's DBL_MIN value, the maximum delay with  
the new coding is about 700x the average. That seems acceptable - any  
reasonable pgbench session should last long enough to average that out.  
  
Backpatch to 9.4.  

M contrib/pgbench/pgbench.c

Change the way latency is calculated with pgbench --rate option.

commit   : 02e3bcc661598275a75a8649b48602dca7aeec79    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 12:40:01 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 11 Sep 2014 12:40:01 +0300    

Click here for diff

The reported latency values now include the "schedule lag" time, that is,  
the time between the transaction's scheduled start time and the time it  
actually started. This relates better to a model where requests arrive at a  
certain rate, and we are interested in the response time to the end user or  
application, rather than the response time of the database itself.  
  
Also, when --rate is used, include the schedule lag time in the log output.  
  
The --rate option is new in 9.4, so backpatch to 9.4. It seems better to  
make this change in 9.4, while we're still in the beta period, than ship a  
9.4 version that calculates the values differently than 9.5.  

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

Handle old versions of Test::More

commit   : 75717ce8f0cdca6a6778d0a9a6ef6d3196b9e483    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Sep 2014 20:39:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Sep 2014 20:39:28 -0400    

Click here for diff

Really old versions of Test::More don't support subplans, so skip the  
tests in that case.  

M src/test/perl/TestLib.pm

Support older versions of "prove"

commit   : 8632ba6de4f3c61cb247267c6885f025bfadbb84    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Sep 2014 20:05:56 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Sep 2014 20:05:56 -0400    

Click here for diff

Apparently, older versions of "prove" (couldn't identify the exact  
version from the changelog) don't look into the t/ directory for tests  
by default, so specify it explicitly.  

M src/Makefile.global.in

doc: improve configuration management section

commit   : 4c4654afeb5208c80720b8c373a31c499237989b    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 20:50:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 20:50:15 -0400    

Click here for diff

Patch by David Johnston  
  
Backpatch through 9.4  

M doc/src/sgml/config.sgml

pg_upgrade: compare control version, not catalog version

commit   : acc8e41681b4c07c60b2663e2e94bbff338189be    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 20:22:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 20:22:10 -0400    

Click here for diff

Also modify test for the possibility the large object value might not  
exist in the old cluster.  
  
Fix for commit e1598a15f4fb0f076a6034d3d3debb9776aff07a  

M contrib/pg_upgrade/controldata.c

pg_upgrade: check for large object size compatibility

commit   : e1598a15f4fb0f076a6034d3d3debb9776aff07a    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 19:23:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 19:23:36 -0400    

Click here for diff

M contrib/pg_upgrade/controldata.c
M contrib/pg_upgrade/pg_upgrade.h

Implement mxid_age() to compute multi-xid age

commit   : 36ad1a87a368d837d5c2260b2fd2ff83e976425a    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 17:13:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 17:13:04 -0400    

Click here for diff

Report by Josh Berkus  

M doc/src/sgml/maintenance.sgml
M src/backend/utils/adt/xid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Issue a warning during the creation of hash indexes

commit   : 84aa8ba128a08e6fdebb2497c7a79ebf18093e12    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 16:54:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Sep 2014 16:54:40 -0400    

Click here for diff

M src/backend/commands/indexcmds.c
M src/test/regress/expected/create_index.out
M src/test/regress/expected/enum.out
M src/test/regress/expected/macaddr.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/uuid.out

Fix thinko in 0709b7ee72e4bc71ad07b7120acd117265ab51d0.

commit   : 5b26278822c69dd76ef89fd50ecc7cdba9c3f035    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Sep 2014 14:40:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Sep 2014 14:40:21 -0400    

Click here for diff

Buildfarm member castoroides is unhappy with this, for entirely  
understandable reasons.  

M src/include/storage/s_lock.h

Pack tuples in a hash join batch densely, to save memory.

commit   : 45f6240a8fa9d35548eb2ef23dba2c11540aa02a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 10 Sep 2014 21:24:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 10 Sep 2014 21:24:52 +0300    

Click here for diff

Instead of palloc'ing each HashJoinTuple individually, allocate 32kB chunks  
and pack the tuples densely in the chunks. This avoids the AllocChunk  
header overhead, and the space wasted by standard allocator's habit of  
rounding sizes up to the nearest power of two.  
  
This doesn't contain any planner changes, because the planner's estimate of  
memory usage ignores the palloc overhead. Now that the overhead is smaller,  
the planner's estimates are in fact more accurate.  
  
Tomas Vondra, reviewed by Robert Haas.  

M src/backend/executor/nodeHash.c
M src/include/executor/hashjoin.h

Add support for optional_argument to our own getopt_long() implementation.

commit   : 311da16439ef69fc2054af3f4377fd4acd29a0e3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 10 Sep 2014 17:21:50 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 10 Sep 2014 17:21:50 +0200    

Click here for diff

07c8651dd91d5a currently causes compilation errors on mscv (and  
probably some other) compilers because our getopt_long()  
implementation doesn't have support for optional_argument.  
  
Thus implement optional_argument in our fallback implemenation. It's  
quite possibly also useful in other cases.  
  
Arguably this needs a configure check for optional_argument, but it  
has existed pretty much since getopt_long() was introduced and thus  
doesn't seem worth the configure runtime.  
  
Normally I'd would not push a patch this fast, but this allows msvc to  
build again and has low risk as only optional_argument behaviour has  
changed.  
  
Author: Michael Paquier and Andres Freund  
  
Discussion: CAB7nPqS5VeedSCxrK=QouokbawgGKLpyc1Q++RRFCa_sjcSVrg@mail.gmail.com  

M src/include/getopt_long.h
M src/port/getopt_long.c

Fix typo in 07c8651dd91d5 causing WIN32_ONLY_COMPILER builds to fail.

commit   : b4c28d1b92c81941e4fc124884e51a7c110316bf    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 10 Sep 2014 02:43:18 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 10 Sep 2014 02:43:18 +0200    

Click here for diff

M src/include/storage/s_lock.h

Preserve AND/OR flatness while extracting restriction OR clauses.

commit   : 1b4cc493d2b5216c14ba3ee781cbeff56f96d1b7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Sep 2014 18:35:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Sep 2014 18:35:14 -0400    

Click here for diff

The code I added in commit f343a880d5555faf1dad0286c5632047c8f599ad was  
careless about preserving AND/OR flatness: it could create a structure with  
an OR node directly underneath another one.  That breaks an assumption  
that's fairly important for planning efficiency, not to mention triggering  
various Asserts (as reported by Benjamin Smith).  Add a trifle more logic  
to handle the case properly.  

M src/backend/optimizer/util/orclauses.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Add new psql help topics, accessible to both --help and \?.

commit   : 07c8651dd91d5aea38bee268acb582674ca4b5ea    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 9 Sep 2014 22:19:14 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 9 Sep 2014 22:19:14 +0200    

Click here for diff

Add --help=<topic> for the commandline, and \? <topic> as a backslash  
command, to show more help than the invocations without parameters  
do. "commands", "variables" and "options" currently exist as help  
topics describing, respectively, backslash commands, psql variables,  
and commandline switches. Without parameters the help commands show  
their previous topic.  
  
Some further wordsmithing or extending of the added help content might  
be needed; but there seems little benefit delaying the overall feature  
further.  
  
Author: Pavel Stehule, editorialized by many  
  
Reviewed-By: Andres Freund, Petr Jelinek, Fujii Masao, MauMau, Abhijit  
    Menon-Sen and Erik Rijkers.  
  
Discussion: CAFj8pRDVGuC-nXBfe2CK8vpyzd2Dsr9GVpbrATAnZO=2YQ0s2Q@mail.gmail.com,  
    CAFj8pRA54AbTv2RXDTRxiAd8hy8wxmoVLqhJDRCwEnhdd7OUkw@mail.gmail.com  

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

Change the spinlock primitives to function as compiler barriers.

commit   : 0709b7ee72e4bc71ad07b7120acd117265ab51d0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Sep 2014 17:45:20 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Sep 2014 17:45:20 -0400    

Click here for diff

Previously, they functioned as barriers against CPU reordering but not  
compiler reordering, an odd API that required extensive use of volatile  
everywhere that spinlocks are used.  That's error-prone and has negative  
implications for performance, so change it.  
  
In theory, this makes it safe to remove many of the uses of volatile  
that we currently have in our code base, but we may find that there are  
some bugs in this effort when we do.  In the long run, though, this  
should make for much more maintainable code.  
  
Patch by me.  Review by Andres Freund.  

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

Add width_bucket(anyelement, anyarray).

commit   : e80252d424278abf65b624669c8e6b3fe8587cac    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Sep 2014 15:34:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Sep 2014 15:34:10 -0400    

Click here for diff

This provides a convenient method of classifying input values into buckets  
that are not necessarily equal-width.  It works on any sortable data type.  
  
The choice of function name is a bit debatable, perhaps, but showing that  
there's a relationship to the SQL standard's width_bucket() function seems  
more attractive than the other proposals.  
  
Petr Jelinek, reviewed by Pavel Stehule  

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

doc: Reflect renaming of Mac OS X to OS X

commit   : 220bb39dee8044937a963e81be8796e99bd8508b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Sep 2014 13:56:29 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Sep 2014 13:56:29 -0400    

Click here for diff

bug #10528  

M contrib/start-scripts/osx/PostgreSQL
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/wal.sgml

Allow empty content in xml type

commit   : 57b1085df55d092e2a728043ec607db8fdef2483    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Sep 2014 11:34:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Sep 2014 11:34:52 -0400    

Click here for diff

The xml type previously rejected "content" that is empty or consists  
only of spaces.  But the SQL/XML standard allows that, so change that.  
The accepted values for XML "documents" are not changed.  
  
Reviewed-by: Ali Akbar <[email protected]>  

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

Move ALTER ... ALL IN to ProcessUtilitySlow

commit   : f0051c1a142ecaff7828b87315c26c7acbf8e583    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 9 Sep 2014 10:52:10 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 9 Sep 2014 10:52:10 -0400    

Click here for diff

Now that ALTER TABLE .. ALL IN TABLESPACE has replaced the previous  
ALTER TABLESPACE approach, it makes sense to move the calls down in  
to ProcessUtilitySlow where the rest of ALTER TABLE is handled.  
  
This also means that event triggers will support ALTER TABLE .. ALL  
(which was the impetus for the original change, though it has other  
good qualities also).  
  
Álvaro Herrera  
  
Back-patch to 9.4 as the original rework was.  

M src/backend/tcop/utility.c

Fix typo in solaris spinlock fix.

commit   : 50881036b17dc07cc61535d5bf27c56abaa4fbbb    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 9 Sep 2014 13:57:38 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 9 Sep 2014 13:57:38 +0200    

Click here for diff

07968dbfaad03 missed part of the S_UNLOCK define when building for  
sparcv8+.  

M src/include/storage/s_lock.h

Fix spinlock implementation for some !solaris sparc platforms.

commit   : 07968dbfaad03001db632a5c0ce4acccd5e463e2    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 9 Sep 2014 00:47:32 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 9 Sep 2014 00:47:32 +0200    

Click here for diff

Some Sparc CPUs can be run in various coherence models, ranging from  
RMO (relaxed) over PSO (partial) to TSO (total). Solaris has always  
run CPUs in TSO mode while in userland, but linux didn't use to and  
the various *BSDs still don't. Unfortunately the sparc TAS/S_UNLOCK  
were only correct under TSO. Fix that by adding the necessary memory  
barrier instructions. On sparcv8+, which should be all relevant CPUs,  
these are treated as NOPs if the current consistency model doesn't  
require the barriers.  
  
Discussion: [email protected]  
  
Will be backpatched to all released branches once a few buildfarm  
cycles haven't shown up problems. As I've no access to sparc, this is  
blindly written.  

M src/backend/port/tas/sunstudio_sparc.s
M src/include/storage/s_lock.h

Fix psql \s to work with recent libedit, and add pager support.

commit   : 750c5ee6ce4410faaa4bf2b8d861100f30d97c73    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Sep 2014 16:09:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Sep 2014 16:09:45 -0400    

Click here for diff

psql's \s (print command history) doesn't work at all with recent libedit  
versions when printing to the terminal, because libedit tries to do an  
fchmod() on the target file which will fail if the target is /dev/tty.  
(We'd already noted this in the context of the target being /dev/null.)  
Even before that, it didn't work pleasantly, because libedit likes to  
encode the command history file (to ensure successful reloading), which  
renders it nigh unreadable, not to mention significantly different-looking  
depending on exactly which libedit version you have.  So let's forget using  
write_history() for this purpose, and instead print the data ourselves,  
using logic similar to that used to iterate over the history for newline  
encoding/decoding purposes.  
  
While we're at it, insert the ability to use the pager when \s is printing  
to the terminal.  This has been an acknowledged shortcoming of \s for many  
years, so while you could argue it's not exactly a back-patchable bug fix  
it still seems like a good improvement.  Anyone who's seriously annoyed  
at this can use "\s /dev/tty" or local equivalent to get the old behavior.  
  
Experimentation with this showed that the history iteration logic was  
actually rather broken when used with libedit.  It turns out that with  
libedit you have to use previous_history() not next_history() to advance  
to more recent history entries.  The easiest and most robust fix for this  
seems to be to make a run-time test to verify which function to call.  
We had not noticed this because libedit doesn't really need the newline  
encoding logic: its own encoding ensures that command entries containing  
newlines are reloaded correctly (unlike libreadline).  So the effective  
behavior with recent libedits was that only the oldest history entry got  
newline-encoded or newline-decoded.  However, because of yet other bugs in  
history_set_pos(), some old versions of libedit allowed the existing loop  
logic to reach entries besides the oldest, which means there may be libedit  
~/.psql_history files out there containing encoded newlines in more than  
just the oldest entry.  To ensure we can reload such files, it seems  
appropriate to back-patch this fix, even though that will result in some  
incompatibility with older psql versions (ie, multiline history entries  
written by a psql with this fix will look corrupted to a psql without it,  
if its libedit is reasonably up to date).  
  
Stepan Rutz and Tom Lane  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/input.c
M src/bin/psql/input.h

Documentation fix: sum(float4) returns float4, not float8.

commit   : 0640c1bfc09138f136fc1239d2c27b6d37f7d1af    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Sep 2014 22:40:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Sep 2014 22:40:41 -0400    

Click here for diff

The old claim is from my commit d06ebdb8d3425185d7e641d15e45908658a0177d of  
2000-07-17, but it seems to have been a plain old thinko; sum(float4) has  
been distinct from sum(float8) since Berkeley days.  Noted by KaiGai Kohei.  
  
While at it, mention the existence of sum(money), which is also of  
embarrassingly ancient vintage.  

M doc/src/sgml/func.sgml

Tab completion for ALTER .. ALL IN TABLESPACE

commit   : b2de2a1172d52b9a9596d4366e758749cc586f2b    
  
author   : Stephen Frost <[email protected]>    
date     : Sun, 7 Sep 2014 08:04:35 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sun, 7 Sep 2014 08:04:35 -0400    

Click here for diff

Update the tab completion for the changes made in  
3c4cf080879b386d4ed1814667aca025caafe608, which rework 'MOVE ALL' to be  
'ALTER .. ALL IN TABLESPACE'.  
  
Fujii Masao  
  
Back-patch to 9.4, as the original change was.  

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

docs: Improve pg_isready details about username/dbname

commit   : 465b52e74ca1994d6ee2d5d345a4c09ca3d02f18    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 6 Sep 2014 12:43:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 6 Sep 2014 12:43:11 -0400    

Click here for diff

Report by Erik Rijkers  
  
Backpatch through 9.4  

M doc/src/sgml/ref/pg_isready.sgml

Properly document that -r is only honored from the command-line.

commit   : d42f67c52af19c4301561608f8f5dba6ae504c67    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 6 Sep 2014 11:10:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 6 Sep 2014 11:10:52 -0400    

Click here for diff

This is for postgres/postmaster options.  
  
Report by Tom Lane  
  
Backpatch through 9.4  

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

Report timezone offset in pg_dump/pg_dumpall

commit   : ad5d46a4494b0b480a3af246bb4227d9bdadca37    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 19:22:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 19:22:31 -0400    

Click here for diff

Use consistent format for all such displays.  
  
Report by Gavin Flower  

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

pg_upgrade: preserve the timestamp epoch

commit   : a74a4aa23bb95b590ff01ee564219d2eacea3706    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 19:19:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 19:19:41 -0400    

Click here for diff

This is useful for replication tools like Slony and Skytools.  
  
Report by Sergey Konoplev  

M contrib/pg_upgrade/controldata.c
M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_upgrade/pg_upgrade.h
M doc/src/sgml/ref/pg_resetxlog.sgml

Clarify documentation about "peer" rows in window functions

commit   : 1f4d1074c5d83a682e71104114211f6ddee129a5    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 18:59:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 18:59:41 -0400    

Click here for diff

Peer rows are matching rows when ORDER BY is specified.  
  
Report by [email protected], David G Johnston  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/syntax.sgml

Rename C variables in formatting.c, for clarity

commit   : a9c22d1480aa8e6d97a000292d05ef2b31bbde4e    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 09:52:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Sep 2014 09:52:31 -0400    

Click here for diff

Also add C comments.  This should help future debugging of this  
notorious file.  

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

Assorted message fixes and improvements

commit   : 303f4d1012a20102d9fec6f486da0b381184a718    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Sep 2014 01:20:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Sep 2014 01:20:33 -0400    

Click here for diff

M contrib/test_decoding/expected/ddl.out
M src/backend/access/heap/rewriteheap.c
M src/backend/commands/dbcommands.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/storage/ipc/dsm_impl.c
M src/test/regress/expected/matview.out

Add tab-completion for reloptions like user_catalog_table.

commit   : d85e7fac415722bccc83dc96baccdb398ea5a2f4    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 5 Sep 2014 11:40:08 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 5 Sep 2014 11:40:08 +0900    

Click here for diff

Back-patch to 9.4 where user_catalog_table was added.  
  
Review by Michael Paquier  

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

doc: Remove dead link

commit   : 8b896abe8eb5ff85ba92710e4a1f0f28097d3ac3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Sep 2014 14:11:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Sep 2014 14:11:23 -0400    

Click here for diff

The link to the NIST web page about DES standards leads to nowhere, and  
according to archive.org has been forwarded to an unrelated page for  
many years.  Therefore, just remove that link.  More up to date  
information can be found via Wikipedia, for example.  

M doc/src/sgml/pgcrypto.sgml

Fix segmentation fault that an empty prepared statement could cause.

commit   : a73c9dbab0165b3395dfe8a44a7dfd16166963c4    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 5 Sep 2014 02:17:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 5 Sep 2014 02:17:57 +0900    

Click here for diff

Back-patch to all supported branches.  
  
Per bug #11335 from Haruka Takatsuka  

M src/backend/tcop/utility.c

Update comment to reflect commit 1d41739e5a04b0e93304d24d864b6bfa3efc45f2.

commit   : d8d4965dc29263462932be03d4206aa694e2cd7e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Sep 2014 12:17:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Sep 2014 12:17:10 -0400    

Click here for diff

Peter Geoghegan  

M src/include/utils/sortsupport.h

Allow \watch to display query execution time if \timing is enabled.

commit   : f6f654ff12c527310ddbeaf53d463d22ab46ee2c    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 4 Sep 2014 12:31:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 4 Sep 2014 12:31:48 +0900    

Click here for diff

Previously \watch could not display the query execution time even  
when \timing was enabled because it used PSQLexec instead of  
SendQuery and that function didn't support \timing. This patch  
introduces PSQLexecWatch and changes \watch so as to use it, instead.  
PSQLexecWatch is the function to run the query, print its results and  
display how long it took (only when \timing is enabled).  
  
This patch also changes --echo-hidden so that it doesn't print  
the query that \watch executes. Since \watch cannot execute  
backslash command queries, they should not be printed even  
when --echo-hidden is set.  
  
Patch by me, review by Heikki Linnakangas and Michael Paquier  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h

Update URL reference material in /contrib/isn docs

commit   : 4b91ade41fcda805a50e136edad7f95d8f35a7a9    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 3 Sep 2014 17:22:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 3 Sep 2014 17:22:20 -0400    

Click here for diff

Report by Peter Eisentraut  

M doc/src/sgml/isn.sgml

Document use of partial indexes for partial unique constraints

commit   : 4b224011751d1d4a300a0a179fc006658c6868a3    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 3 Sep 2014 14:32:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 3 Sep 2014 14:32:57 -0400    

Click here for diff

Report by Tomáš Greif  
  
Backpatch through 9.4  

M doc/src/sgml/ddl.sgml

Issue clearer notice when inherited merged columns are moved

commit   : 4011f8c98bd8bb67715449d2db5fc97dffa6a41f    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 3 Sep 2014 11:54:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 3 Sep 2014 11:54:31 -0400    

Click here for diff

CREATE TABLE INHERIT moves user-specified columns to the location of the  
inherited column.  
  
Report by Fatal Majid  

M src/backend/commands/tablecmds.c

Check number of parameters in RAISE statement at compile time.

commit   : c1008f0037ec9c738127c2fa6d7f6c88d885f45f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Sep 2014 15:53:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Sep 2014 15:53:06 +0300    

Click here for diff

The number of % parameter markers in RAISE statement should match the number  
of parameters given. We used to check that at execution time, but we have  
all the information needed at compile time, so let's check it at compile  
time instead. It's generally better to find mistakes earlier.  
  
Marko Tiikkaja, reviewed by Fabien Coelho  

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Refactor per-page logic common to all redo routines to a new function.

commit   : f8f4227976a2cdb8ac7c611e49da03aa9e65e0d2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Aug 2014 15:39:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Aug 2014 15:39:08 +0300    

Click here for diff

Every redo routine uses the same idiom to determine what to do to a page:  
check if there's a backup block for it, and if not read, the buffer if the  
block exists, and check its LSN. Refactor that into a common function,  
XLogReadBufferForRedo, making all the redo routines shorter and more  
readable.  
  
This has no user-visible effect, and makes no changes to the WAL format.  
  
Reviewed by Andres Freund, Alvaro Herrera, Michael Paquier.  

M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/README
M src/backend/access/transam/xlogutils.c
M src/include/access/xlogutils.h

Silence warning on new versions of clang.

commit   : 26f8b99b248aae989e63ca0969a746f30b0c8c21    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Sep 2014 14:22:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Sep 2014 14:22:42 +0300    

Click here for diff

Andres Freund  

M src/include/access/gin_private.h

Add psql PROMPT variable showing which line of a statement is being edited.

commit   : 51bb79569f934ad2135c2ff859c61b9ab8d51750    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 2 Sep 2014 13:05:48 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 2 Sep 2014 13:05:48 +0200    

Click here for diff

The new %l substitution shows the line number inside a (potentially  
multi-line) statement starting from one.  
  
Author: Sawada Masahiko, heavily editorialized by me.  
Reviewed-By: Jeevan Chalke, Alvaro Herrera  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/copy.c
M src/bin/psql/mainloop.c
M src/bin/psql/prompt.c
M src/bin/psql/settings.h

Support ALTER SYSTEM RESET command.

commit   : bd3b7a9eef6fd8d71ad9aa5eaf1f90e904e96f0b    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 2 Sep 2014 16:06:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 2 Sep 2014 16:06:58 +0900    

Click here for diff

This patch allows us to execute ALTER SYSTEM RESET command to  
remove the configuration entry from postgresql.auto.conf.  
  
Vik Fearing, reviewed by Amit Kapila and me.  

M doc/src/sgml/ref/alter_system.sgml
M src/backend/parser/gram.y
M src/backend/utils/misc/guc.c
M src/bin/psql/tab-complete.c

Fix unportable use of isspace().

commit   : 01b6976c13a9cf87f3c6767c9722576166c1b081    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Sep 2014 18:37:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Sep 2014 18:37:45 -0400    

Click here for diff

Introduced in commit 11a020eb6.  

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

Add skip-empty-xacts option to test_decoding for use in the regression tests.

commit   : d6fa44fce7c27459e2d7a46cca18779b765c8b15    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 13:42:43 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 13:42:43 +0200    

Click here for diff

The regression tests for contrib/test_decoding regularly failed on  
postgres instances that were very slow. Either because the hardware  
itself was slow or because very expensive debugging options like  
CLOBBER_CACHE_ALWAYS were used.  
  
The reason they failed was just that some additional transactions were  
decoded. Analyze and vacuum, triggered by autovac.  
  
To fix just add a option to test_decoding to only display transactions  
in which a change was actually displayed. That's not pretty because it  
removes information from the tests; but better than constantly failing  
tests in very likely harmless ways.  
  
Backpatch to 9.4 where logical decoding was introduced.  
  
Discussion: [email protected]  

M contrib/test_decoding/expected/concurrent_ddl_dml.out
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/expected/permissions.out
M contrib/test_decoding/expected/prepared.out
M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/specs/concurrent_ddl_dml.spec
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/decoding_in_xact.sql
M contrib/test_decoding/sql/permissions.sql
M contrib/test_decoding/sql/prepared.sql
M contrib/test_decoding/sql/rewrite.sql
M contrib/test_decoding/sql/toast.sql
M contrib/test_decoding/test_decoding.c

Add valgrind suppression for padding bytes in twophase records.

commit   : 9a0a12f683235d3e10b873baba974f6414297a7e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 12:19:00 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 12:19:00 +0200    

Click here for diff

M src/tools/valgrind.supp

Fix s/pluggins/plugins/ typo in two comments.

commit   : 5a64cb740dc7de868a1395a53778686c0a72f6a7    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 12:01:29 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 12:01:29 +0200    

Click here for diff

Michael Paquier  

M src/backend/replication/logical/logicalfuncs.c
M src/include/catalog/objectaccess.h

Declare lwlock.c's LWLockAcquireCommon() as a static inline.

commit   : 9c4b55db1dc901dc184b1b3ab9cca3f2089ec311    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 00:16:55 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 00:16:55 +0200    

Click here for diff

68a2e52bbaf98f136 has introduced LWLockAcquireCommon() containing the  
previous contents of LWLockAcquire() plus added functionality. The  
latter then calls it, just like LWLockAcquireWithVar(). Because the  
majority of callers don't need the added functionality, declare the  
common code as inline. The compiler then can optimize away the unused  
code. Doing so is also useful when looking at profiles, to  
differentiate the users.  
  
Backpatch to 9.4, the first branch to contain LWLockAcquireCommon().  

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

Protect definition of SpinlockSemaArray, just like its declaration.

commit   : 5c1faa7ba729c780b0ac598dbc23dbb1d6e1b872    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 00:03:53 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Sep 2014 00:03:53 +0200    

Click here for diff

Found via clang's -Wmissing-variable-declarations.  

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

Declare two variables in snapbuild.c as static.

commit   : 8fff977e29cda7c1641c43f9b293134adc77b65a    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 31 Aug 2014 23:53:12 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 31 Aug 2014 23:53:12 +0200    

Click here for diff

Neither is accessed externally, I just seem to have missed the static  
when writing the code.  

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

doc: Various typo/grammar fixes

commit   : 05258761bf12a64befc9caec1947b254cdeb74c5    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 30 Aug 2014 10:52:36 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 30 Aug 2014 10:52:36 -0500    

Click here for diff

Errors detected using Topy (https://github.com/intgr/topy), all  
changes verified by hand and some manual tweaks added.  
  
Marti Raudsepp  
  
Individual changes backpatched, where applicable, as far as 9.0.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/pgbench.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/alter_tsdictionary.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/release-7.4.sgml
M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-old.sgml
M doc/src/sgml/stylesheet.dsl
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/xml2.sgml
M doc/src/sgml/xoper.sgml

Again update C comments for pg_attribute.attislocal

commit   : d5d7d07765443175a49441bad7a799dedc072511    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 30 Aug 2014 10:24:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 30 Aug 2014 10:24:34 -0400    

Click here for diff

M src/include/catalog/pg_attribute.h

Make backend local tracking of buffer pins memory efficient.

commit   : 4b4b680c3d6d8485155d4d4bf0a92d3a874b7a65    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 30 Aug 2014 14:03:21 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 30 Aug 2014 14:03:21 +0200    

Click here for diff

Since the dawn of time (aka Postgres95) multiple pins of the same  
buffer by one backend have been optimized not to modify the shared  
refcount more than once. This optimization has always used a NBuffer  
sized array in each backend keeping track of a backend's pins.  
  
That array (PrivateRefCount) was one of the biggest per-backend memory  
allocations, depending on the shared_buffers setting. Besides the  
waste of memory it also has proven to be a performance bottleneck when  
assertions are enabled as we make sure that there's no remaining pins  
left at the end of transactions. Also, on servers with lots of memory  
and a correspondingly high shared_buffers setting the amount of random  
memory accesses can also lead to poor cpu cache efficiency.  
  
Because of these reasons a backend's buffers pins are now kept track  
of in a small statically sized array that overflows into a hash table  
when necessary. Benchmarks have shown neutral to positive performance  
results with considerably lower memory usage.  
  
Patch by me, review by Robert Haas.  
  
Discussion: [email protected]  

M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

Update C comment for pg_attribute.attislocal

commit   : c6eaa880eea67a711b30903a9ee2e996bccb775e    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 29 Aug 2014 19:01:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 29 Aug 2014 19:01:04 -0400    

Click here for diff

Indicates if column has ever been local/non-inherited  

M src/include/catalog/pg_attribute.h

pg_is_xlog_replay_paused(): remove super-user-only restriction

commit   : 01363beae52700c7425cb2d2452177133dad3e93    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 29 Aug 2014 09:05:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 29 Aug 2014 09:05:35 -0400    

Click here for diff

Also update docs to mention which function are super-user-only.  
  
Report by [email protected]  
  
Backpatch through 9.4  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c

Fix bug in compressed GIN data leaf page splitting code.

commit   : 88231ec5784a00ce406553276be8a5a443dd3ba0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 29 Aug 2014 14:19:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 29 Aug 2014 14:19:34 +0300    

Click here for diff

The list of posting lists it's dealing with can contain placeholders for  
deleted posting lists. The placeholders are kept around so that they can  
be WAL-logged, but we must be careful to not try to access them.  
  
This fixes bug #11280, reported by Mårten Svantesson. Backpatch to 9.4,  
where the compressed data leaf page code was added.  

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

Assorted message improvements

commit   : 65c9dc231a261691c76550f61f5b22f954dfcfd5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Aug 2014 00:01:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Aug 2014 00:01:34 -0400    

Click here for diff

M src/backend/commands/view.c
M src/backend/port/sysv_shmem.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/misc/guc.c
M src/bin/pg_ctl/nls.mk
M src/bin/psql/command.c
M src/bin/psql/copy.c
M src/test/regress/expected/updatable_views.out

doc: Revert ALTER TABLESPACE summary line

commit   : 14b7c8f2d062d50f2ad5d306c5cc26b7ec5cf11e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Aug 2014 23:59:03 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Aug 2014 23:59:03 -0400    

Click here for diff

It was changed when ALTER TABLESPACE / MOVE was added but then not  
updated when that was moved back out.  

M doc/src/sgml/ref/alter_tablespace.sgml

Add min and max aggregates for inet/cidr data types.

commit   : 6c40f8316ed38a92049784b3e3d3b514ed379b5a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Aug 2014 22:37:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Aug 2014 22:37:58 -0400    

Click here for diff

Haribabu Kommi, reviewed by Muhammad Asif Naeem  

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

Always use our getaddrinfo.c on Windows.

commit   : ec544a65c9090bc9da11ea384d1369fd552ca8b0    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 28 Aug 2014 20:36:27 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 28 Aug 2014 20:36:27 -0400    

Click here for diff

Commit a16bac36eca8158cbf78987e95376f610095f792 let "configure" detect  
the system getaddrinfo() when building under 64-bit MinGW-w64.  However,  
src/include/port/win32/sys/socket.h assumes all native Windows  
configurations use our replacement.  This change placates buildfarm  
member jacana until we establish a plan for getaddrinfo() on Windows.  

M configure
M configure.in

Fix citext upgrade script for disallowance of oidvector element assignment.

commit   : 7f7eec89b66947e4098773cf286653b9c4f01c88    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Aug 2014 18:21:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Aug 2014 18:21:05 -0400    

Click here for diff

In commit 45e02e3232ac7cc5ffe36f7986159b5e0b1f6fdc, we intentionally  
disallowed updates on individual elements of oidvector columns.  While that  
still seems like a sane idea in the abstract, we (I) forgot that citext's  
"upgrade from unpackaged" script did in fact perform exactly such updates,  
in order to fix the problem that citext indexes should have a collation  
but would not in databases dumped or upgraded from pre-9.1 installations.  
  
Even if we wanted to add casts to allow such updates, there's no practical  
way to do so in the back branches, so the only real alternative is to make  
citext's kluge even klugier.  In this patch, I cast the oidvector to text,  
fix its contents with regexp_replace, and cast back to oidvector.  (Ugh!)  
  
Since the aforementioned commit went into all active branches, we have to  
fix this in all branches that contain the now-broken update script.  
  
Per report from Eric Malm.  

M contrib/citext/citext–unpackaged–1.0.sql

Revert "Allow units to be specified in relation option setting value."

commit   : 9df492664a74a948c87232f523eea637920a516b    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 29 Aug 2014 05:10:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 29 Aug 2014 05:10:47 +0900    

Click here for diff

This reverts commit e23014f3d40f7d2c23bc97207fd28efbe5ba102b.  
  
As the side effect of the reverted commit, when the unit is  
specified, the reloption was stored in the catalog with the unit.  
This broke pg_dump (specifically, it prevented pg_dump from  
outputting restorable backup regarding the reloption) and  
turned the buildfarm red. Revert the commit until the fixed  
version is ready.  

M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Allow escaping of option values for options passed at connection start.

commit   : 11a020eb6e4023a1570a2788ba22dd6aafbd02dc    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Aug 2014 13:59:29 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Aug 2014 13:59:29 +0200    

Click here for diff

This is useful to allow to set GUCs to values that include spaces;  
something that wasn't previously possible. The primary case motivating  
this is the desire to set default_transaction_isolation to 'repeatable  
read' on a per connection basis, but other usecases like seach_path do  
also exist.  
  
This introduces a slight backward incompatibility: Previously a \ in  
an option value would have been passed on literally, now it'll be  
taken as an escape.  
  
The relevant mailing list discussion starts with  
[email protected].  

M doc/src/sgml/protocol.sgml
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c

Allow units to be specified in relation option setting value.

commit   : e23014f3d40f7d2c23bc97207fd28efbe5ba102b    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 28 Aug 2014 15:55:50 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 28 Aug 2014 15:55:50 +0900    

Click here for diff

This introduces an infrastructure which allows us to specify the units  
like ms (milliseconds) in integer relation option, like GUC parameter.  
Currently only autovacuum_vacuum_cost_delay reloption can accept  
the units.  
  
Reviewed by Michael Paquier  

M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Allow multibyte characters as escape in SIMILAR TO and SUBSTRING.

commit   : 8167a3883a3c49f2f77785f8e5f638920c9f14ef    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 27 Aug 2014 21:07:36 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 27 Aug 2014 21:07:36 -0700    

Click here for diff

Previously, only a single-byte character was allowed as an  
escape. This patch allows it to be a multi-byte character, though it  
still must be a single character.  
  
Reviewed by Heikki Linnakangas and Tom Lane.  

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

Fix FOR UPDATE NOWAIT on updated tuple chains

commit   : 1c9701cfe58267cf5d79543a42ee4f0967cc73ab    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 27 Aug 2014 19:15:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 27 Aug 2014 19:15:18 -0400    

Click here for diff

If SELECT FOR UPDATE NOWAIT tries to lock a tuple that is concurrently  
being updated, it might fail to honor its NOWAIT specification and block  
instead of raising an error.  
  
Fix by adding a no-wait flag to EvalPlanQualFetch which it can pass down  
to heap_lock_tuple; also use it in EvalPlanQualFetch itself to avoid  
blocking while waiting for a concurrent transaction.  
  
Authors: Craig Ringer and Thomas Munro, tweaked by Álvaro  
http://www.postgresql.org/message-id/[email protected]  
  
Per Thomas Munro in the course of his SKIP LOCKED feature submission,  
who also provided one of the isolation test specs.  
  
Backpatch to 9.4, because that's as far back as it applies without  
conflicts (although the bug goes all the way back).  To that branch also  
backpatch Thomas Munro's new NOWAIT test cases, committed in master by  
Heikki as commit 9ee16b49f0aac819bd4823d9b94485ef608b34e8 .  

M src/backend/executor/execMain.c
M src/backend/executor/nodeLockRows.c
M src/include/executor/executor.h
A src/test/isolation/expected/nowait-4.out
A src/test/isolation/expected/nowait-4_1.out
A src/test/isolation/expected/nowait-5.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/nowait-4.spec
A src/test/isolation/specs/nowait-5.spec

Add header comments to receivelog.h and streamutil.h.

commit   : 9a2d94892f6a793d52ebabb8283b98a6e3ede3d6    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 27 Aug 2014 19:31:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 27 Aug 2014 19:31:48 +0900    

Click here for diff

This commit also adds the include guards to those header files.  
  
Michael Paquier  

M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.h

Fix Var handling for security barrier views

commit   : e414ba93add966dfe03e22994764e718ed89ee98    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 26 Aug 2014 23:08:41 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 26 Aug 2014 23:08:41 -0400    

Click here for diff

In some cases, not all Vars were being correctly marked as having been  
modified for updatable security barrier views, which resulted in invalid  
plans (eg: when security barrier views were created over top of  
inheiritance structures).  
  
In passing, be sure to update both varattno and varonattno, as _equalVar  
won't consider the Vars identical otherwise.  This isn't known to cause  
any issues with updatable security barrier views, but was noticed as  
missing while working on RLS and makes sense to get fixed.  
  
Back-patch to 9.4 where updatable security barrier views were  
introduced.  

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

doc: Document valid checkpoint_timeout range

commit   : 8e484bc4abccc03d49af25d32a5ffaecd3c6cf2d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Aug 2014 22:43:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Aug 2014 22:43:37 -0400    

Click here for diff

Author: Fabien COELHO <[email protected]>  

M doc/src/sgml/config.sgml

Fix whitespace

commit   : 2d759341d97eb863477d6170a84c24ade570f567    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Aug 2014 17:26:45 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Aug 2014 17:26:45 -0400    

Click here for diff

M contrib/pg_upgrade/info.c

Fix typo in b34e37bfefbed1bf9396dde18f308d8b96fd176c.

commit   : 9522ec3e707a93d25a99e477af76d7b186fe20de    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Aug 2014 15:58:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Aug 2014 15:58:50 -0400    

Click here for diff

Spotted by Peter Geoghegan.  

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

Fix superuser concurrent refresh of matview owned by another.

commit   : a9d0f1cff3fb10151be05be61d24ac9b680c170c    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 26 Aug 2014 09:56:26 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 26 Aug 2014 09:56:26 -0500    

Click here for diff

Use SECURITY_LOCAL_USERID_CHANGE while building temporary tables;  
only escalate to SECURITY_RESTRICTED_OPERATION while potentially  
running user-supplied code.  The more secure mode was preventing  
temp table creation.  Add regression tests to cover this problem.  
  
This fixes Bug #11208 reported by Bruno Emanuel de Andrade Silva.  
  
Backpatch to 9.4, where the bug was introduced.  

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

Mark IsBinaryUpgrade as PGDLLIMPORT to fix windows builds after a7ae1dc.

commit   : 5569d75d6a82f0d11d26404fceb848ae59869126    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Aug 2014 15:25:18 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Aug 2014 15:25:18 +0200    

Click here for diff

Author: David Rowley  

M src/include/miscadmin.h

Implement IF NOT EXISTS for CREATE SEQUENCE.

commit   : 0076f264b6f24854219d49b159602e2042c38ee7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 26 Aug 2014 16:05:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 26 Aug 2014 16:05:18 +0300    

Click here for diff

Fabrízio de Royes Mello  

M doc/src/sgml/ref/create_sequence.sgml
M src/backend/commands/sequence.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/sequence.out
M src/test/regress/sql/sequence.sql

commit   : 57ca1d4f0175f60e9cfb0f997c864173d9c72607    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Aug 2014 12:21:06 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Aug 2014 12:21:06 +0200    

Click here for diff

That allows to run those tests against a postmaster listening on a  
nonstandard port without requiring to export PGPORT in postmaster's  
environment.  
  
This still doesn't support connecting to a nondefault host without  
configuring it in postmaster's environment. That's harder and less  
frequently used though. So this is a useful step.  

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

commit   : ddc2504dbcf2af97b58a91b071768c17774d58d1    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Aug 2014 02:54:53 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Aug 2014 02:54:53 +0200    

Click here for diff

That allows parallel installcheck to succeed inside contrib/. The  
output is not particularly pretty unless make's -O option to  
synchronize the output is used.  
  
There's other tests, outside contrib, that use a hardcoded,  
non-unique, database name. Those prohibit paralell installcheck to be  
used across more directories; but that's something for a separate  
patch.  

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

Show schema names in pg_dump verbose output.

commit   : 2bde29739d1e28f58e901b7e53057b8ddc0ec286    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 26 Aug 2014 11:50:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 26 Aug 2014 11:50:48 +0300    

Click here for diff

Fabrízio de Royes Mello, reviewed by Michael Paquier  

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

pg_upgrade: prevent automatic oid assignment

commit   : a7ae1dcf4939cf643c5abe8dd673e4b87a6efd42    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 22:19:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 22:19:05 -0400    

Click here for diff

Prevent automatic oid assignment when in binary upgrade mode.  Also  
throw an error when contrib/pg_upgrade_support functions are called when  
not in binary upgrade mode.  
  
This prevent automatically-assigned oids from conflicting with later  
pre-assigned oids coming from the old cluster.  It also makes sure oids  
are preserved in call important cases.  

M contrib/pg_upgrade_support/pg_upgrade_support.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c

rename macro isTempOrToastNamespace to isTempOrTempToastNamespace

commit   : 73fe87503f23144a27f0bdecc55587deb5aa425f    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 21:28:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 21:28:19 -0400    

Click here for diff

Done for clarity  

M src/backend/catalog/namespace.c
M src/backend/catalog/toasting.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/namespace.h

pg_upgrade: use CTE query rather than temp table

commit   : 5d16332e96977d8166ea631891f6e2cf3ff11f45    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 21:22:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 21:22:08 -0400    

Click here for diff

Now that 8.3 is not supported, we can use a CTE and not temp tables.  
This allows for auto-oid assignment protection in a future patch.  

M contrib/pg_upgrade/info.c

pg_upgrade docs: update docs for 8.3 support removal

commit   : e8c81b1b8e51475dd5a787660e6754c4bafbff47    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 20:11:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 20:11:48 -0400    

Click here for diff

M doc/src/sgml/pgupgrade.sgml

revert "Throw error for ALTER TABLE RESET of an invalid option"

commit   : 6cb74a67e26523eb2408f441bfc589c80f76c465    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 20:07:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 20:07:37 -0400    

Click here for diff

Reverts commits 73d78e11a0f7183c80b93eefbbb6026fe9664015 and  
b0488e5c4fbfdce8acc989bdc17d9f0ec09ac281.  Also reverts pg_upgrade  
changes.  

M contrib/pg_upgrade/dump.c
M src/backend/access/common/reloptions.c

pg_upgrade: remove support for 8.3 old clusters

commit   : 2209b3923a7afe0b6033ecfea972219df252ca8e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 20:05:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 20:05:07 -0400    

Click here for diff

This trims down the code, and is in preparation for hardening pg_upgrade  
against auto-oid assignment.  

M contrib/pg_upgrade/Makefile
M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/controldata.c
M contrib/pg_upgrade/info.c
M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_upgrade/pg_upgrade.h
D contrib/pg_upgrade/version_old_8_3.c

pg_upgrade: add SET log_min_error_statement = warning

commit   : b0488e5c4fbfdce8acc989bdc17d9f0ec09ac281    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 17:24:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 17:24:33 -0400    

Click here for diff

Add to commit 73d78e11a0f7183c80b93eefbbb6026fe9664015  

M contrib/pg_upgrade/dump.c

Throw error for ALTER TABLE RESET of an invalid option

commit   : 73d78e11a0f7183c80b93eefbbb6026fe9664015    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 17:06:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 17:06:40 -0400    

Click here for diff

Also adjust pg_upgrade to not use this method for optional TOAST table  
creation.  
  
Patch by Fabrízio de Royes Mello  

M contrib/pg_upgrade/dump.c
M src/backend/access/common/reloptions.c

pg_ctl, pg_upgrade: allow multiple -o/-O options, append them

commit   : ebe30ad59bb2d127f576be07e036a473999c4b80    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 16:30:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 16:30:26 -0400    

Click here for diff

Report by Pavel Raiskup  

M contrib/pg_upgrade/option.c
M doc/src/sgml/pgupgrade.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M src/bin/pg_ctl/pg_ctl.c

upgrade docs: highlight pg_upgrade, warn about globals preservation

commit   : bf1c866597a0e59a30b13a66f3ae505655b61853    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 15:34:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 Aug 2014 15:34:51 -0400    

Click here for diff

Also, remove OID preservation mention, mention non-text dump formats  
  
Backpatch through 9.4  

M doc/src/sgml/backup.sgml
M doc/src/sgml/runtime.sgml

Revert XactLockTableWait context setup in conditional multixact wait

commit   : 3adba736620c85112e0f9f6d043d3574e1c5830f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:33:17 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:33:17 -0400    

Click here for diff

There's no point in setting up a context error callback when doing  
conditional lock acquisition, because we never actually wait and so the  
user wouldn't be able to see the context message anywhere.  In fact,  
this is more in line with what ConditionalXactLockTableWait is doing.  
  
Backpatch to 9.4, where this was added.  

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

Use newly added InvalidCommandId instead of 0

commit   : 6f822952eea112d3e19a0ddaad32e99d1943f29d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:30 -0400    

Click here for diff

The symbol was added by 71901ab6d; the original code was introduced by  
6868ed749.  Development of both overlapped which is why we apparently  
failed to notice.  
  
This is a (very slight) behavior change, so I'm not backpatching this to  
9.4 for now, even though the symbol does exist there.  

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

DefineType: return base type OID, not its array

commit   : 832a12f65e91d4295be73e26079aa8508de0cf32    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:26 -0400    

Click here for diff

Event triggers want to know the OID of the interesting object created,  
which is the main type.  The array created as part of the operation is  
just a subsidiary object which is not of much interest.  

M src/backend/commands/typecmds.c

Have CREATE TABLE AS and REFRESH return an OID

commit   : 301fcf33eb7fcbcf1da113dabeed90b8eaf656eb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:18 -0400    

Click here for diff

Other DDL commands are already returning the OID, which is required for  
future additional event trigger work.  This is merely making these  
commands in line with the rest of utility command support.  

M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/include/commands/createas.h
M src/include/commands/matview.h

More psprintf goodness

commit   : d6d6020f1cf33a63bbae59d370b75fa5e98017f0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:15 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:15 -0400    

Click here for diff

M src/backend/parser/gram.y

Oops, forgot to "git add" one last change

commit   : ac41769fd9dca9f4a6ee5fa859a56c08e8bb95fe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:06 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 15:32:06 -0400    

Click here for diff

M src/backend/commands/tablecmds.c

Editorial review of SET UNLOGGED

commit   : 7636c0c821f669e134a0f2fd1c6225bb3ec820d4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 13:50:19 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Aug 2014 13:50:19 -0400    

Click here for diff

Add a succint comment explaining why it's correct to change the  
persistence in this way.  Also s/loggedness/persistence/ because native  
speakers didn't like the latter term.  
  
Fabrízio and Álvaro  

M src/backend/commands/tablecmds.c

Add regression tests for SELECT FOR UPDATE/SHARE NOWAIT.

commit   : 9ee16b49f0aac819bd4823d9b94485ef608b34e8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Aug 2014 20:12:01 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Aug 2014 20:12:01 +0300    

Click here for diff

Thomas Munro  

A src/test/isolation/expected/nowait-2.out
A src/test/isolation/expected/nowait-3.out
A src/test/isolation/expected/nowait.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/nowait-2.spec
A src/test/isolation/specs/nowait-3.spec
A src/test/isolation/specs/nowait.spec

Fix typos in some error messages thrown by extension scripts when fed to psql.

commit   : d153b801611f6fdc58c7941e85dddb0cb25ca4ef    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Aug 2014 18:30:37 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Aug 2014 18:30:37 +0200    

Click here for diff

Some of the many error messages introduced in 458857cc missed 'FROM  
unpackaged'. Also e016b724 and 45ffeb7e forgot to quote extension  
version numbers.  
  
Backpatch to 9.1, just like 458857cc which introduced the messages. Do  
so because the error messages thrown when the wrong command is copy &  
pasted aren't easy to understand.  

M contrib/btree_gin/btree_gin–unpackaged–1.0.sql
M contrib/btree_gist/btree_gist–unpackaged–1.0.sql
M contrib/chkpass/chkpass–unpackaged–1.0.sql
M contrib/citext/citext–unpackaged–1.0.sql
M contrib/cube/cube–unpackaged–1.0.sql
M contrib/dblink/dblink–unpackaged–1.0.sql
M contrib/dict_int/dict_int–unpackaged–1.0.sql
M contrib/dict_xsyn/dict_xsyn–unpackaged–1.0.sql
M contrib/earthdistance/earthdistance–unpackaged–1.0.sql
M contrib/fuzzystrmatch/fuzzystrmatch–unpackaged–1.0.sql
M contrib/hstore/hstore–unpackaged–1.0.sql
M contrib/intagg/intagg–unpackaged–1.0.sql
M contrib/intarray/intarray–unpackaged–1.0.sql
M contrib/isn/isn–unpackaged–1.0.sql
M contrib/lo/lo–unpackaged–1.0.sql
M contrib/ltree/ltree–unpackaged–1.0.sql
M contrib/pageinspect/pageinspect–1.0–1.1.sql
M contrib/pageinspect/pageinspect–1.1–1.2.sql
M contrib/pageinspect/pageinspect–unpackaged–1.0.sql
M contrib/pg_buffercache/pg_buffercache–unpackaged–1.0.sql
M contrib/pg_freespacemap/pg_freespacemap–unpackaged–1.0.sql
M contrib/pg_stat_statements/pg_stat_statements–unpackaged–1.0.sql
M contrib/pg_trgm/pg_trgm–unpackaged–1.0.sql
M contrib/pgcrypto/pgcrypto–unpackaged–1.0.sql
M contrib/pgrowlocks/pgrowlocks–unpackaged–1.0.sql
M contrib/pgstattuple/pgstattuple–unpackaged–1.0.sql
M contrib/seg/seg–unpackaged–1.0.sql
M contrib/spi/autoinc–unpackaged–1.0.sql
M contrib/spi/insert_username–unpackaged–1.0.sql
M contrib/spi/moddatetime–unpackaged–1.0.sql
M contrib/spi/refint–unpackaged–1.0.sql
M contrib/spi/timetravel–unpackaged–1.0.sql
M contrib/sslinfo/sslinfo–unpackaged–1.0.sql
M contrib/tablefunc/tablefunc–unpackaged–1.0.sql
M contrib/test_parser/test_parser–unpackaged–1.0.sql
M contrib/tsearch2/tsearch2–unpackaged–1.0.sql
M contrib/unaccent/unaccent–unpackaged–1.0.sql
M contrib/uuid-ossp/uuid-ossp–unpackaged–1.0.sql
M contrib/xml2/xml2–unpackaged–1.0.sql

Don't track DEALLOCATE in pg_stat_statements.

commit   : 3cd934f635699b7c8b0027be69fddfc36be6f9b8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Aug 2014 19:13:24 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Aug 2014 19:13:24 +0300    

Click here for diff

We also don't track PREPARE, nor do we track planning time in general, so  
let's ignore DEALLOCATE as well for consistency.  
  
Backpatch to 9.4, but not further than that. Although it seems unlikely that  
anyone is relying on the current behavior, this is a behavioral change.  
  
Fabien Coelho  

M contrib/pg_stat_statements/pg_stat_statements.c

Fix another ancient memory-leak bug in relcache.c.

commit   : 73eba19aebe0101837668e39267469ca34373552    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Aug 2014 11:56:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Aug 2014 11:56:52 -0400    

Click here for diff

CheckConstraintFetch() leaked a cstring in the caller's context for each  
CHECK constraint expression it copied into the relcache.  Ordinarily that  
isn't problematic, but it can be during CLOBBER_CACHE testing because so  
many reloads can happen during a single query; so complicate the code  
slightly to allow freeing the cstring after use.  Per testing on buildfarm  
member barnacle.  
  
This is exactly like the leak fixed in AttrDefaultFetch() by commit  
078b2ed291c758e7125d72c3a235f128d40a232b.  (Yes, this time I did look for  
other instances of the same coding pattern :-(.)  Like that patch, no  
back-patch, since it seems unlikely that there's any problem except under  
very artificial test conditions.  
  
BTW, it strikes me that both of these places would require further work  
comparable to commit ab8c84db2f7af008151b848cf1d6a4672a39eecd, if we ever  
supported defaults or check constraints on system catalogs: they both  
assume they are copying into an empty relcache data structure, and that  
conceivably wouldn't be the case during recursive reloading of a system  
catalog.  This does not seem worth worrying about for the moment, since  
there is no near-term prospect of supporting any such thing.  So I'll  
just note the possibility for the archives' sake.  

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

doc: Improve pg_restore help output

commit   : 256bfb2c9ab89eefb963db025dfcc91893f0b8b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Aug 2014 00:23:34 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Aug 2014 00:23:34 -0400    

Click here for diff

Add a note that some options can be specified multiple times to select  
multiple objects to restore.  This replaces the somewhat confusing use  
of plurals in the option descriptions themselves.  

M src/bin/pg_dump/pg_restore.c

Implement ALTER TABLE .. SET LOGGED / UNLOGGED

commit   : f41872d0c1239d36ab03393c39ec0b70e9ee2a3c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Aug 2014 14:27:00 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Aug 2014 14:27:00 -0400    

Click here for diff

This enables changing permanent (logged) tables to unlogged and  
vice-versa.  
  
(Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that  
hopefully makes more sense than the original.)  
  
Author: Fabrízio de Royes Mello  
Reviewed by: Christoph Berg, Andres Freund, Thom Brown  
Some tweaking by Álvaro Herrera  

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

Fix outdated comment

commit   : 01d15a2677c738489e62295924298ef8a72528a8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Aug 2014 13:55:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Aug 2014 13:55:34 -0400    

Click here for diff

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

Fix corner-case behaviors in JSON/JSONB field extraction operators.

commit   : 41dd50e84df39e31595f3472b0cb6d00f63b3f99    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Aug 2014 13:17:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Aug 2014 13:17:58 -0400    

Click here for diff

Cause the path extraction operators to return their lefthand input,  
not NULL, if the path array has no elements.  This seems more consistent  
since the case ought to correspond to applying the simple extraction  
operator (->) zero times.  
  
Cause other corner cases in field/element/path extraction to return NULL  
rather than failing.  This behavior is arguably more useful than throwing  
an error, since it allows an expression index using these operators to be  
built even when not all values in the column are suitable for the  
extraction being indexed.  Moreover, we already had multiple  
inconsistencies between the path extraction operators and the simple  
extraction operators, as well as inconsistencies between the JSON and  
JSONB code paths.  Adopt a uniform rule of returning NULL rather than  
throwing an error when the JSON input does not have a structure that  
permits the request to be satisfied.  
  
Back-patch to 9.4.  Update the release notes to list this as a behavior  
change since 9.3.  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/release-9.4.sgml
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Fix newly introduced misspelling of existence in pg_buffercache.

commit   : ebf20f65d9383166d4b883258c091b245cf36217    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 22 Aug 2014 09:25:47 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 22 Aug 2014 09:25:47 +0200    

Click here for diff

Peter Geoghegan  

M contrib/pg_buffercache/pg_buffercache_pages.c

Fix comment in pg_basebackup.

commit   : 2af93640ad14028297fbc750e4c2338ad11a3c58    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Aug 2014 13:45:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Aug 2014 13:45:38 +0300    

Click here for diff

The option is called --tablespace-mapping, not --tablespace.  
  
Amit Kapila  

M src/bin/pg_basebackup/pg_basebackup.c

Change the way pg_basebackup's tablespace mapping is implemented.

commit   : 8d938eb0797e7acd925a2adf72315f8ab1586d83    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Aug 2014 10:16:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Aug 2014 10:16:26 +0300    

Click here for diff

Previously, we would first create the symlinks the way they are in the  
original system, and at the end replace them with the mapped symlinks.  
That never really made much sense, so now we create the symlink pointing  
to the correct location to begin with, so that there's no need to fix  
them at the end.  
  
The old coding didn't work correctly on Windows, because Windows junction  
points look more like directories than files, and ought to be removed with  
rmdir rather than unlink. Also, it incorrectly used "%d" rather than "%u"  
to print an Oid, but that's gone now.  
  
Report and patch by Amit Kapila, with minor changes by me. Reviewed by  
MauMau. Backpatch to 9.4, where the --tablespace feature was added.  

M src/bin/pg_basebackup/pg_basebackup.c

Fix whitespace

commit   : 3feda1bcbb653e954092bddd9c3eb681ab51fa2b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Aug 2014 21:37:41 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Aug 2014 21:37:41 -0400    

Click here for diff

M src/bin/psql/print.c

Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE'

commit   : 3c4cf080879b386d4ed1814667aca025caafe608    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 21 Aug 2014 19:06:17 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 21 Aug 2014 19:06:17 -0400    

Click here for diff

As 'ALTER TABLESPACE .. MOVE ALL' really didn't change the tablespace  
but instead changed objects inside tablespaces, it made sense to  
rework the syntax and supporting functions to operate under the  
'ALTER (TABLE|INDEX|MATERIALIZED VIEW)' syntax and to be in  
tablecmds.c.  
  
Pointed out by Alvaro, who also suggested the new syntax.  
  
Back-patch to 9.4.  

M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/release-9.4.sgml
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source
M src/tools/pgindent/typedefs.list

Add pinning_backends column to the pg_buffercache extension.

commit   : f57791985ac3d776cb67e9d69befde538cfdf13b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 22 Aug 2014 00:28:37 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 22 Aug 2014 00:28:37 +0200    

Click here for diff

The new column shows how many backends have a buffer pinned. That can  
be useful during development or to diagnose production issues  
e.g. caused by vacuum waiting for cleanup locks.  
  
To handle upgrades transparently - the extension might be used in  
views - deal with callers expecting the old number of columns.  
  
Reviewed by Fujii Masao and Rajeev rastogi.  

M contrib/pg_buffercache/Makefile
A contrib/pg_buffercache/pg_buffercache–1.0–1.1.sql
R088 contrib/pg_buffercache/pg_buffercache–1.0.sql contrib/pg_buffercache/pg_buffercache–1.1.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M doc/src/sgml/pgbuffercache.sgml

Add #define INT64_MODIFIER for the printf length modifier for 64-bit ints.

commit   : ce486056ecd28050f367894a2b5aad3656d37511    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 21 Aug 2014 09:56:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 21 Aug 2014 09:56:44 +0300    

Click here for diff

We have had INT64_FORMAT and UINT64_FORMAT for a long time, but that's not  
good enough if you want something more exotic, like "%20lld".  
  
Abhijit Menon-Sen, per Andres Freund's suggestion.  

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

More regression test cases for json/jsonb extraction operators.

commit   : fa069822f5a02bbbe46bada0b6e420a89c5f7484    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Aug 2014 19:05:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Aug 2014 19:05:05 -0400    

Click here for diff

Cover some cases I omitted before, such as null and empty-string  
elements in the path array.  This exposes another inconsistency:  
json_extract_path complains about empty path elements but  
jsonb_extract_path does not.  

M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Fix core dump in jsonb #> operator, and add regression test cases.

commit   : 9bac66020db75871463bafdb394568bf946e8991    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Aug 2014 16:48:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Aug 2014 16:48:35 -0400    

Click here for diff

jsonb's #> operator segfaulted (dereferencing a null pointer) if the RHS  
was a zero-length array, as reported in bug #11207 from Justin Van Winkle.  
json's #> operator returns NULL in such cases, so for the moment let's  
make jsonb act likewise.  
  
Also add a bunch of regression test queries memorializing the -> and #>  
operators' behavior for this and other corner cases.  
  
There is a good argument for changing some of these behaviors, as they  
are not very consistent with each other, and throwing an error isn't  
necessarily a desirable behavior for operators that are likely to be  
used in indexes.  However, everybody can agree that a core dump is the  
Wrong Thing, and we need test cases even if we decide to change their  
expected output later.  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

pg_upgrade: adjust logging to use QUERY_ALLOC lengths

commit   : 7567d94910c100a28a79122e86297cd7a4c90df6    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 20 Aug 2014 13:03:58 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 20 Aug 2014 13:03:58 -0400    

Click here for diff

Allows the logging to print the entire text of failed queries, rather  
than a truncated version.  

M contrib/pg_upgrade/server.c
M contrib/pg_upgrade/util.c

Use comma+space as the separator in the default search_path.

commit   : 02587dcddc2cb5d9f7a17cb0281d168f5a0d6297    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Aug 2014 12:04:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 20 Aug 2014 12:04:32 +0300    

Click here for diff

While the space is optional, it seems nicer to be consistent with what  
you get if you do "SET search_path=...". SET always normalizes the  
separator to be comma+space.  
  
Christoph Martin  

M doc/src/sgml/ddl.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Revert "Fix bug in checking of IDENTIFY_SYSTEM result."

commit   : c4762886539b06da682045e19ba73dcee3789638    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 19 Aug 2014 18:30:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 19 Aug 2014 18:30:38 +0900    

Click here for diff

This reverts commit 083d29c65b7897f90c70e6dc0a4240a5fa75c8f2.  
  
The commit changed the code so that it causes an errors when  
IDENTIFY_SYSTEM returns three columns. But which prevents us  
from using the replication-related utilities against the server  
with older version. This is not what we want. For that  
compatibility, we allow the utilities to receive three columns  
as the result of IDENTIFY_SYSTEM eventhough it actually returns  
four columns in 9.4 or later.  
  
Pointed out by Andres Freund.  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c

Fix bug in checking of IDENTIFY_SYSTEM result.

commit   : 083d29c65b7897f90c70e6dc0a4240a5fa75c8f2    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 19 Aug 2014 17:26:07 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 19 Aug 2014 17:26:07 +0900    

Click here for diff

5a991ef8692ed0d170b44958a81a6bd70e90585 added new column into  
the result of IDENTIFY_SYSTEM command. But it was not reflected into  
several codes checking that result. Specifically though the number of  
columns in the result was increased to 4, it was still compared with 3  
in some replication codes.  
  
Back-patch to 9.4 where the number of columns in IDENTIFY_SYSTEM  
result was increased.  
  
Report from Michael Paquier  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c

Install libpq DLL with $(INSTALL_SHLIB).

commit   : 8605bc75219fd9a46fbb38909f83bcdae56b6e01    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 23:00:38 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 23:00:38 -0400    

Click here for diff

Programs need execute permission on a DLL file to load it.  MSYS  
"install" ignores the mode argument, and our Cygwin build statically  
links libpq into programs.  That explains the lack of buildfarm trouble.  
Back-patch to 9.0 (all supported versions).  

M src/interfaces/libpq/Makefile

Finish adding file version information to installed Windows binaries.

commit   : ee9569e4df1c3bdb6858f4f65d0770783c32a84d    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:59:53 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:59:53 -0400    

Click here for diff

In support of this, have the MSVC build follow GNU make in preferring  
GNUmakefile over Makefile when a directory contains both.  
  
Michael Paquier, reviewed by MauMau.  

M src/backend/snowball/Makefile
M src/interfaces/ecpg/test/Makefile
M src/test/isolation/Makefile
M src/test/regress/GNUmakefile
M src/timezone/Makefile
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/clean.bat

Replace a few strncmp() calls with strlcpy().

commit   : fb2aece8ae4e6f23310d7c87c7da3fec6f5df3a1    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:59:31 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:59:31 -0400    

Click here for diff

strncmp() is a specialized API unsuited for routine copying into  
fixed-size buffers.  On a system where the length of a single filename  
can exceed MAXPGPATH, the pg_archivecleanup change prevents a simple  
crash in the subsequent strlen().  Few filesystems support names that  
long, and calling pg_archivecleanup with untrusted input is still not a  
credible use case.  Therefore, no back-patch.  
  
David Rowley  

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

Make pg_service.conf sample LDIF more portable.

commit   : 7fc5f1a3550ca9395051b592df150de79804131a    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:58:57 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:58:57 -0400    

Click here for diff

The aboriginal sample placed connection parameters in  
groupOfUniqueNames/uniqueMember.  OpenLDAP, at least as early as version  
2.4.23, rejects uniqueMember entries that do not conform to the syntax  
for a distinguished name.  Use device/description, which is free-form.  
Back-patch to 9.4 for web site visibility.  

M doc/src/sgml/libpq.sgml

commit   : 10718612fb23a5853e56eb792a6b1503ebddf190    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:58:25 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 18 Aug 2014 22:58:25 -0400    

Click here for diff

Oversight in commit 7cbe57c34dec4860243e6d0f81738cfbb6e5d069.  
Back-patch to 9.4, where that commit first appeared.  In passing,  
release-note the FDW API postcondition change from the same commit.  

M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/release-9.4.sgml

Adjust Release Notes to reflect holding off wrapped expanded mode until 9.5 (thanks Michael Paquier)

commit   : 663675885ec2c97c8b59ce3e30f6ad05d162a584    
  
author   : Greg Stark <[email protected]>    
date     : Mon, 18 Aug 2014 23:12:59 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Mon, 18 Aug 2014 23:12:59 +0100    

Click here for diff

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

Fix further concerns about psql wrapping in expanded mode having collateral damage on other formats, by Sergey Muraviov.

commit   : 458ef6bad15702a3ac9b7b302a0378f8817620c0    
  
author   : Greg Stark <[email protected]>    
date     : Mon, 18 Aug 2014 12:06:11 +0100    
  
committer: Greg Stark <[email protected]>    
date     : Mon, 18 Aug 2014 12:06:11 +0100    

Click here for diff

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

Reorganize functions in be-secure-openssl.c

commit   : 48d50840d53eb62842c0d9b54eab9cd7c9a3a46d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Aug 2014 13:04:47 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Aug 2014 13:04:47 +0300    

Click here for diff

Move the functions within the file so that public interface functions come  
first, followed by internal functions. Previously, be_tls_write was first,  
then internal stuff, and finally the rest of the public interface, which  
clearly didn't make much sense.  
  
Per Andres Freund's complaint.  

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

Fix obsolete mention of non-int64 support in CREATE SEQUENCE documentation.

commit   : 2b475c5946bc8a9beaff3f57b45cc440a78561a1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Aug 2014 01:17:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Aug 2014 01:17:49 -0400    

Click here for diff

The old text explained what happened if we didn't have working int64  
arithmetic.  Since that case has been explicitly rejected by configure  
since 8.4.3, documenting it in the 9.x branches can only produce confusion.  

M doc/src/sgml/ref/create_sequence.sgml

Use ISO 8601 format for dates converted to JSON, too.

commit   : e56ec50c1622010c010e1c84bc02ce44285c4f41    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Aug 2014 22:57:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Aug 2014 22:57:15 -0400    

Click here for diff

Commit f30015b6d794c15d52abbb3df3a65081fbefb1ed made this happen for  
timestamp and timestamptz, but it seems pretty inconsistent to not  
do it for simple dates as well.  
  
(In passing, I re-pgindent'd json.c.)  

M doc/src/sgml/release-9.4.sgml
M src/backend/utils/adt/json.c

Add missing index terms for replication commands in the document.

commit   : 3e9f70f1287b9324e398a084a8e881ea6aefc3eb    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 18 Aug 2014 11:18:53 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 18 Aug 2014 11:18:53 +0900    

Click here for diff

Previously only CREATE_REPLICATION_SLOT was exposed as an index term.  
That's odd and there is no reason not to add index terms for other  
replication commands.  
  
Back-patch to 9.4.  

M doc/src/sgml/protocol.sgml

Make an editorial pass over the 9.4 release notes.

commit   : f66faadc4420fdc34f66057f493a0e09c0ad8a58    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Aug 2014 22:26:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Aug 2014 22:26:44 -0400    

Click here for diff

Update the notes to include commits through today, and do a lot of  
wordsmithing and markup adjustment.  Notably, don't use <link> where <xref>  
will do; since we got rid of the text-format HISTORY file, there is no  
longer a reason to avoid <xref>.  

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

Improve DISCARD documentation.

commit   : 259904ecd42a46f5bb66bb85d547eba5b64a2cfa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Aug 2014 15:59:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Aug 2014 15:59:03 -0400    

Click here for diff

The new DISCARD SEQUENCES option was inadequately described, and hadn't  
been mentioned at all in the initial Description paragraph.  Rather than  
rectifying the latter the hard way, it seemed better to rewrite the  
description as a summary, instead of having it basically duplicate  
statements made under Parameters.  Be more consistent about the ordering  
of the options, too.  

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

doc: Work around stylesheet bug for man build

commit   : 1330e2922c7f7d42780109247c28ad50a790f96c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Aug 2014 09:10:28 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Aug 2014 09:10:28 -0400    

Click here for diff

The upstream stylesheets for man output insert a *roff comment for an  
occurrence of an indexterm, for reasons that have apparently been lost  
in history.  This, however, is done incorrectly and causes some  
formatting problems.  This hasn't been an issue until now, but the  
reorganization of indexterm elements inside variablelists has triggered  
this issue.  
  
The upstream fix (http://sourceforge.net/p/docbook/bugs/1340/) is to  
drop indexterms altogether in man output, and so we'll do the same here.  

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

Fix bogus return macros in range_overright_internal().

commit   : 737cdc2d1412f3e4115137ca6fa14d1b3c39dcbc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Aug 2014 13:48:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Aug 2014 13:48:39 -0400    

Click here for diff

PG_RETURN_BOOL() should only be used in functions following the V1 SQL  
function API.  This coding accidentally fails to fail since letting the  
compiler coerce the Datum representation of bool back to plain bool  
does give the right answer; but that doesn't make it a good idea.  
  
Back-patch to older branches just to avoid unnecessary code divergence.  

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

commit   : a068b5b65f83660fc99c3faf39ed50493b010fbb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Aug 2014 13:22:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Aug 2014 13:22:52 -0400    

Click here for diff

Make lists of the names of all operators that are claimed to be commutator  
pairs or negator pairs.  This is analogous to the existing queries that  
make lists of all operator names appearing in particular opclass strategy  
slots.  Unexpected additions to these lists are likely to be mistakes; had  
we had these queries in place before, bug #11178 might've been prevented.  

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

commit   : e3f9c16838358b6b3679dd014455d310919d7efa    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Aug 2014 12:53:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Aug 2014 12:53:54 -0400    

Click here for diff

<@ and @> are each other's commutators, but they were incorrectly marked  
as being each other's negators instead.  (This was actually questioned  
in a comment in the original commit, but nobody followed through :-(.)  
Per bug #11178 from Christian Pronovost.  
  
In passing, fix some JSONB operator descriptions that were randomly  
different from the phrasing of every other similar description.  
  
catversion bump for pg_catalog contents change.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h

Fix whitespace

commit   : 9ee9ca545bda210fec78381e8ad4ad1e1618b67c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Aug 2014 14:52:06 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Aug 2014 14:52:06 -0400    

Click here for diff

M contrib/pg_upgrade/option.c

pg_upgrade: fix define adjusted during testing

commit   : ea9b8abd6f457706a3501849d21587af178113a1    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 Aug 2014 12:28:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 Aug 2014 12:28:18 -0400    

Click here for diff

from commit e4c3c99ac3d4777458ef3e94b037438b244b72b6  

M contrib/pg_upgrade/option.c

pg_upgrade: error if run from top of new PGDATA on Windows

commit   : e4c3c99ac3d4777458ef3e94b037438b244b72b6    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 Aug 2014 12:03:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 Aug 2014 12:03:49 -0400    

Click here for diff

Print a clear error message in this case, rather than wait for initdb  
--sync-only to generate a "Permission denied" error.  

M contrib/pg_upgrade/option.c

Doc fix: New York State's capital is Albany.

commit   : ef153ecc55a8f945d576a1e69a51b91046f24bb1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Aug 2014 09:57:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Aug 2014 09:57:46 +0300    

Click here for diff

The inheritance example in the manual implies that the capital of New York  
is New York City, but in reality it's Albany.  
  
George Hartzell  

M doc/src/sgml/ddl.sgml

Remove remnants of a JENTRY_ISFIRST flag bit.

commit   : c07693f0c7cde7d269025fe714a124223a189e71    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Aug 2014 09:39:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 15 Aug 2014 09:39:38 +0300    

Click here for diff

I removed the flag earlier, but missed a few references in jsonb.h.  

M src/include/utils/jsonb.h

Set shared library path for in-tree TAP tests

commit   : f669b61476b2efd79701a7a104e9de2fe11e4e42    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Aug 2014 00:01:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Aug 2014 00:01:14 -0400    

Click here for diff

When the TAP tests are run in-tree (make check), set the shared library  
path using the appropriate environment variable, using a logic similar  
to pg_regress, so that the right libraries are used.  

M src/Makefile.global.in

doc: Fix DocBook XML validity

commit   : d34b48a021b181e30c53280d336820740f67570b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Aug 2014 21:47:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Aug 2014 21:47:11 -0400    

Click here for diff

See 3a9d430af515e9dd8a9d34a4011367e667a66521.  A new one snuck in.  

M doc/src/sgml/config.sgml

Update SysV parameter configuration documentation for FreeBSD.

commit   : 5ff5bfb5f0d83a538766903275b230499fa9ebe1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Aug 2014 16:05:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Aug 2014 16:05:46 -0400    

Click here for diff

FreeBSD hasn't made any use of kern.ipc.semmap since 1.1, and newer  
releases reject attempts to set it altogether; so stop recommending  
that it be adjusted.  Per bug #11161.  
  
Back-patch to all supported branches.  Before 9.3, also incorporate  
commit 7a42dff47, which touches the same text and for some reason  
was not back-patched at the time.  

M doc/src/sgml/runtime.sgml

docs: Add missing period.

commit   : 751b7041050b7b19bf3001633740616089973ab3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Aug 2014 15:19:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Aug 2014 15:19:43 -0400    

Click here for diff

Fabien COELHO and Robert Haas  

M doc/src/sgml/pgbench.sgml

Add sortsupport routines for text.

commit   : b34e37bfefbed1bf9396dde18f308d8b96fd176c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Aug 2014 12:09:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Aug 2014 12:09:52 -0400    

Click here for diff

This provides a small but worthwhile speedup when sorting text, at least  
in cases to which the sortsupport machinery applies.  
  
Robert Haas and Peter Geoghegan  

M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_proc.h
M src/include/utils/builtins.h

Fix help message in pg_ctl.

commit   : a4287a689d10bd4863e3dfbf9c4f232feeca0cdd    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 14 Aug 2014 13:57:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 14 Aug 2014 13:57:52 +0900    

Click here for diff

Previously the help message described that -m is an option for  
"stop", "restart" and "promote" commands in pg_ctl. But actually  
that's not an option for "promote". So this commit fixes that  
incorrect description in the help message.  
  
Back-patch to 9.3 where the incorrect description was added.  

M src/bin/pg_ctl/pg_ctl.c

Fix whitespace

commit   : 5333c72c951cd30e46cece18e75bea53f7149b1b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Aug 2014 23:15:26 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Aug 2014 23:15:26 -0400    

Click here for diff

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

Add some noreturn attributes based on compiler recommendations

commit   : 1d678bf7bc66d4478bdee51278946dcc9ae8cae5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Aug 2014 22:40:48 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Aug 2014 22:40:48 -0400    

Click here for diff

M contrib/test_shm_mq/test_shm_mq.h
M contrib/worker_spi/worker_spi.c
M src/include/bootstrap/bootstrap.h
M src/include/parser/scanner.h
M src/include/postmaster/bgworker_internals.h

doc: Remove obsolete set element DSSSL customizations

commit   : faa14acc9b958d7b811d0aa624774f36e3fab750    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Aug 2014 22:10:25 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Aug 2014 22:10:25 -0400    

Click here for diff

We don't use set elements (collection of books) anymore, so this is just  
dead code.  

M doc/src/sgml/stylesheet.dsl

Prevent memory leaks in parseRelOptions().

commit   : a844c29966d7c0cd6a457e9324f175349bb12df0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Aug 2014 11:35:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Aug 2014 11:35:51 -0400    

Click here for diff

parseRelOptions() tended to leak memory in the caller's context.  Most  
of the time this doesn't really matter since the caller's context is  
at most query-lifespan, and the function won't be invoked very many times.  
However, when testing with CLOBBER_CACHE_RECURSIVELY, the same relcache  
entry can get rebuilt a *lot* of times in one query, leading to significant  
intraquery memory bloat if it has any reloptions.  Noted while  
investigating a related report from Tomas Vondra.  
  
In passing, get rid of some Asserts that are redundant with the one  
done by deconstruct_array().  
  
As with other patches to avoid leaks in CLOBBER_CACHE testing, it doesn't  
really seem worth back-patching this.  

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

Prevent memory leaks in RelationGetIndexList, RelationGetIndexAttrBitmap.

commit   : ab8c84db2f7af008151b848cf1d6a4672a39eecd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Aug 2014 11:27:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Aug 2014 11:27:28 -0400    

Click here for diff

When replacing rd_indexlist, rd_indexattr, etc, we neglected to pfree any  
old value of these fields.  Under ordinary circumstances, the old value  
would always be NULL, so this seemed reasonable enough.  However, in cases  
where we're rebuilding a system catalog's relcache entry and another cache  
flush occurs on that same catalog meanwhile, it's possible for the field to  
not be NULL when we return to the outer level, because we already refilled  
it while recovering from the inner flush.  This leads to a fairly small  
session-lifespan leak in CacheMemoryContext.  In real-world usage the leak  
would be too small to notice; but in testing with CLOBBER_CACHE_RECURSIVELY  
the leakage can add up to the point of causing OOM failures, as reported by  
Tomas Vondra.  
  
The issue has been there a long time, but it only seems worth fixing in  
HEAD, like the previous fix in this area (commit 078b2ed291c758e7).  

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

Expose -S option in pg_receivexlog.

commit   : 52bffe3499d8e5f61efa385ab3c6a074314ee5db    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 13 Aug 2014 10:42:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 13 Aug 2014 10:42:16 +0900    

Click here for diff

This option is equivalent to --slot option which pg_receivexlog has  
already supported, which specifies the replication slot to use for  
WAL streaming. pg_recvlogical has already supported both options,  
and this commit makes pg_receivexlog consistent with pg_recvlogical  
regarding the slot option.  
  
Back-patch to 9.4 where the slot option was added.  
  
Michael Paquier  

M doc/src/sgml/ref/pg_receivexlog.sgml
M src/bin/pg_basebackup/pg_receivexlog.c

pg_recvlogical message and code improvements.

commit   : 596385be06e1c8ac7291958a556b10b37ee333d5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Aug 2014 11:12:16 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Aug 2014 11:12:16 +0200    

Click here for diff

Some error messages complained about --init and --stop being used  
whereas the --create and --drop are the correct verbs. Fix that.  
  
Also a XLogRecPtr was tested in a boolean fashion instead of being  
compared to InvalidXLogRecPtr.  
  
Backpatch to 9.4 where pg_recvlogical was introduced.  
  
Michael Paquier  

M src/bin/pg_basebackup/pg_recvlogical.c

Fix typo in \setrandom document.

commit   : d6ded369a7793c926661f492c153a6dd05afc5bc    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Aug 2014 18:01:01 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Aug 2014 18:01:01 +0900    

Click here for diff

Fabien COELHO  

M doc/src/sgml/pgbench.sgml

Be less aggressive in asking for feedback of logical walsender clients.

commit   : 41d5f8ad734f28ca425636d5ac4c8ea9c29002a5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 12 Aug 2014 11:04:50 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 12 Aug 2014 11:04:50 +0200    

Click here for diff

When doing logical decoding using START_LOGICAL_REPLICATION in a  
walsender process the walsender sometimes was sending out keepalive  
messages too frequently. Asking for feedback every time.  
  
WalSndWaitForWal() sends out keepalive messages when it's waiting for  
new WAL to be generated locally when it sees that the remote side  
hasn't yet flushed WAL up to the local position. That generally is  
good but causes problems if the remote side only writes but doesn't  
flush changes yet. So check for both remote write and flush position.  
  
Additionally we've asked for feedback to the keepalive message which  
isn't warranted when waiting for WAL in contrast to preventing  
timeouts because of wal_sender_timeout.  
  
Complaint and patch by Steve Singer.  

M src/backend/replication/walsender.c

Enhance pgbench's option checking.

commit   : 51222a176624e8529143f26f43da200c5beb0e9e    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 12 Aug 2014 17:27:08 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 12 Aug 2014 17:27:08 +0900    

Click here for diff

Now benchmarking options such as -c cannot be used if initializing  
option (-i) is specified.  Also initializing options such as -F cannot  
be used if initializing option is not specified.  
  
Tatsuo Ishii and Fabien COELHO.  

M contrib/pgbench/pgbench.c

Change first call of ProcessConfigFile so as to process only data_directory.

commit   : 3e3f65973a3c94a699a1659254b89c4f77f0a6a7    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Aug 2014 16:50:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Aug 2014 16:50:09 +0900    

Click here for diff

When both postgresql.conf and postgresql.auto.conf have their own entry of  
the same parameter, PostgreSQL uses the entry in postgresql.auto.conf because  
it appears last in the configuration scan. IOW, the other entries which appear  
earlier are ignored. But, previously, ProcessConfigFile() detected the invalid  
settings of even those unused entries and emitted the error messages  
complaining about them, at postmaster startup. Complaining about the entries  
to ignore is basically useless.  
  
This problem happened because ProcessConfigFile() was called twice at  
postmaster startup and the first call read only postgresql.conf. That is, the  
first call could check the entry which might be ignored eventually by  
the second call which read both postgresql.conf and postgresql.auto.conf.  
To work around the problem, this commit changes ProcessConfigFile so that  
its first call processes only data_directory and the second one does all the  
entries. It's OK to process data_directory in the first call because it's  
ensured that data_directory doesn't exist in postgresql.auto.conf.  
  
Back-patch to 9.4 where postgresql.auto.conf was added.  
  
Patch by me. Review by Amit Kapila  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c

Add tab-completion for \unset and valid setting values of psql variables.

commit   : e15c4ab5fb0de2cab393ed4be2136e1832746412    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Aug 2014 11:57:39 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Aug 2014 11:57:39 +0900    

Click here for diff

This commit also changes tab-completion for \set so that it displays  
all the special variables like COMP_KEYWORD_CASE. Previously it displayed  
only variables having the set values. Which was not user-friendly for  
those who want to set the unset variables.  
  
This commit also changes tab-completion for :variable so that only the  
variables having the set values are displayed. Previously even unset  
variables were displayed.  
  
Pavel Stehule, modified by me.  

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

Fix documentation oversights about pageinspect and initialization fork.

commit   : 7d835ff4db19c515171d6c8de772536c55600753    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 11 Aug 2014 22:52:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 11 Aug 2014 22:52:16 +0900    

Click here for diff

The initialization fork was added in 9.1, but has not been taken into  
consideration in documents of get_raw_page function in pageinspect and  
storage layout. This commit fixes those oversights.  
  
get_raw_page can read not only a table but also an index, etc. So it  
should be documented that the function can read any relation. This commit  
also fixes the document of pageinspect that way.  
  
Back-patch to 9.1 where those oversights existed.  
  
Vik Fearing, review by MauMau  

M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/storage.sgml

Break out OpenSSL-specific code to separate files.

commit   : 680513ab79c7e12e402a2aad7921b95a25a4bcc8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Aug 2014 11:54:19 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 11 Aug 2014 11:54:19 +0300    

Click here for diff

This refactoring is in preparation for adding support for other SSL  
implementations, with no user-visible effects. There are now two #defines,  
USE_OPENSSL which is defined when building with OpenSSL, and USE_SSL which  
is defined when building with any SSL implementation. Currently, OpenSSL is  
the only implementation so the two #defines go together, but USE_SSL is  
supposed to be used for implementation-independent code.  
  
The libpq SSL code is changed to use a custom BIO, which does all the raw  
I/O, like we've been doing in the backend for a long time. That makes it  
possible to use MSG_NOSIGNAL to block SIGPIPE when using SSL, which avoids  
a couple of syscall for each send(). Probably doesn't make much performance  
difference in practice - the SSL encryption is expensive enough to mask the  
effect - but it was a natural result of this refactoring.  
  
Based on a patch by Martijn van Oosterhout from 2006. Briefly reviewed by  
Alvaro Herrera, Andreas Karlsson, Jeff Janes.  

M configure
M configure.in
M src/backend/libpq/Makefile
M src/backend/libpq/auth.c
A src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/hba.c
M src/backend/postmaster/fork_process.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/bin/psql/command.c
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/pg_config_manual.h
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c
A src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/win32.mak
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Clarify type resolution behavior for domain types.

commit   : 6aa61580e08d58909b2a8845a4087b7699335ee0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Aug 2014 16:13:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Aug 2014 16:13:13 -0400    

Click here for diff

The user documentation was vague and not entirely accurate about how  
we treat domain inputs for ambiguous operators/functions.  Clarify  
that, and add an example and some commentary.  Per a recent question  
from Adam Mackler.  
  
It's acted like this ever since we added domains, so back-patch  
to all supported branches.  

M doc/src/sgml/typeconv.sgml

Clean up handling of unknown-type inputs in json_build_object and friends.

commit   : 92f57c9ae95668636bc77d3cda3edbdfd83320d9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Aug 2014 17:31:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Aug 2014 17:31:13 -0400    

Click here for diff

There's actually no need for any special case for unknown-type literals,  
since we only need to push the value through its output function and  
unknownout() works fine.  The code that was here was completely bizarre  
anyway, and would fail outright in cases that should work, not to mention  
suffering from some copy-and-paste bugs.  

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

Further cleanup of JSON-specific error messages.

commit   : 495cadda5ed55f63db9a91d174b6fad0e1816204    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Aug 2014 16:35:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Aug 2014 16:35:29 -0400    

Click here for diff

Fix an obvious typo in json_build_object()'s complaint about invalid  
number of arguments, and make the errhint a bit more sensible too.  
  
Per discussion about how to word the improved hint, change the few places  
in the documentation that refer to JSON object field names as "names" to  
say "keys" instead, since that's what we've said in the vast majority of  
places in the docs.  Arguably "name" is more correct, since that's the  
terminology used in RFC 7159; but we're stuck with "key" in view of the  
naming of json_object_keys() so let's at least be self-consistent.  
  
I adjusted a few code comments to match this as well, and failed to  
resist the temptation to clean up some odd whitespace choices in the  
same area, as well as a useless duplicate PG_ARGISNULL() check.  There's  
still quite a bit of code that uses the phrase "field name" in non-user-  
visible ways, so I left those usages alone.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/json.c

Reject duplicate column names in foreign key referenced-columns lists.

commit   : 9da86753735ab89b0ee685aea985b25c4218ca0b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Aug 2014 13:46:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Aug 2014 13:46:34 -0400    

Click here for diff

Such cases are disallowed by the SQL spec, and even if we wanted to allow  
them, the semantics seem ambiguous: how should the FK columns be matched up  
with the columns of a unique index?  (The matching could be significant in  
the presence of opclasses with different notions of equality, so this issue  
isn't just academic.)  However, our code did not previously reject such  
cases, but instead would either fail to match to any unique index, or  
generate a bizarre opclass-lookup error because of sloppy thinking in the  
index-matching code.  
  
David Rowley  

M src/backend/commands/tablecmds.c

Small message fixes

commit   : f25e0bf5e0af01a687395a76e676dadeb4a60d0a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Aug 2014 00:07:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Aug 2014 00:07:00 -0400    

Click here for diff

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetxlog/pg_resetxlog.c
M src/bin/psql/command.c
M src/common/username.c
M src/pl/plpgsql/src/pl_handler.c

Add -F option to pg_receivexlog, for specifying fsync interval.

commit   : 3dad73e71f08abd86564d5090a58ca71740e07e0    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 8 Aug 2014 16:50:54 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 8 Aug 2014 16:50:54 +0900    

Click here for diff

This allows us to specify the maximum time to issue fsync to ensure  
the received WAL file is safely flushed to disk. Without this,  
pg_receivexlog always flushes WAL file only when it's closed and  
which can cause WAL data to be lost at the event of a crash.  
  
Furuya Osamu, heavily modified by me.  

M doc/src/sgml/ref/pg_receivexlog.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivexlog.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h

Fix typo in docs.

commit   : 1add956ac70384a99ed6606e2963a5a53f567add    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Aug 2014 20:46:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Aug 2014 20:46:41 -0400    

Click here for diff

s/XIDs XIDs/XIDs/ in one place in maintenance.sgml.  
  
Guillaume Lelarge  

M doc/src/sgml/maintenance.sgml

pg_upgrade: prevent oid conflicts with new-cluster TOAST tables

commit   : 4c6780fd17aa43ed6362aa682499cc2f9712cc8b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Aug 2014 14:56:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Aug 2014 14:56:13 -0400    

Click here for diff

Previously, TOAST tables only required in the new cluster could cause  
oid conflicts if they were auto-numbered and a later conflicting oid had  
to be assigned.  
  
Backpatch through 9.3  

M contrib/pg_upgrade/dump.c
M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_upgrade/pg_upgrade.h
M src/backend/catalog/toasting.c
M src/include/catalog/binary_upgrade.h

Improve comment.

commit   : ec903d20e3b4c1a543dbf057055e4ddbfad4d59e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 7 Aug 2014 12:38:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 7 Aug 2014 12:38:16 +0300    

Click here for diff

Based on the old comment, it took me a while to figure out what the  
problem was. The importnat detail is that SSL_read() can return WANT_READ  
even though some raw data was received from the socket.  

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

Add PG_RETURN_UINT16 macro.

commit   : 73cfa37afe3243c0ccdc6ae72cfcc53a37761521    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Aug 2014 16:11:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Aug 2014 16:11:43 -0400    

Click here for diff

Manuel Kniep  

M src/include/fmgr.h

Don't require sort support functions to provide a comparator.

commit   : 1d41739e5a04b0e93304d24d864b6bfa3efc45f2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Aug 2014 16:06:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Aug 2014 16:06:06 -0400    

Click here for diff

This could be useful for datatypes like text, where we might want  
to optimize for some collations but not others.  However, this patch  
doesn't introduce any new sortsupport functions that work this way;  
it merely revises the code so that future patches may do so.  
  
Patch by me.  Review by Peter Geoghegan.  

M src/backend/executor/nodeMergejoin.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/sort/sortsupport.c
M src/include/utils/lsyscache.h

Fix alternate regression test output file.

commit   : 873de34b710196d1e3ce593bd85fa24768e58d6b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Aug 2014 11:18:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Aug 2014 11:18:38 -0400    

Click here for diff

Commit 0ef99bdce3a6cd3195d7df12093042c16328c71c broke this.  
  
Jeff Janes  

M src/test/regress/expected/json_1.out

Refactor pg_receivexlog main loop code, for readability, take 2.

commit   : 6805e02c66eac3857ef1a3d6cfd1ffeea64d9447    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Aug 2014 20:58:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Aug 2014 20:58:13 +0900    

Click here for diff

Previously the source codes for processing the received data and handling  
the end of stream were included in pg_receivexlog main loop. This commit  
splits out them as separate functions. This is useful for improving the  
readability of main loop code and making the future pg_receivexlog-related  
patch simpler.  

M src/bin/pg_basebackup/receivelog.c

Change ParseConfigFp() so that it doesn't process unused entry of each parameter.

commit   : e3da0d4d1a47e2049ae16aa30bb7bf3105dc8c45    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Aug 2014 14:49:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Aug 2014 14:49:43 +0900    

Click here for diff

When more than one setting entries of same parameter exist in the  
configuration file, PostgreSQL uses only entry appearing last in  
configuration file scan. Since the other entries are not used,  
ParseConfigFp() doesn't need to process them, but previously it did  
that. This problematic behavior caused the configuration file scan  
to detect invalid settings of unused entries (e.g., existence of  
multiple entries of PGC_POSTMASTER parameter) and log the messages  
complaining about them.  
  
This commit changes the configuration file scan so that it processes  
only last entry of each parameter.  
  
Note that when multiple entries of same parameter exist both in  
postgresql.conf and postgresql.auto.conf, unused entries in  
postgresql.conf are still processed only at postmaster startup.  
  
The problem has existed since old version, but a user is more likely  
to encounter it since 9.4 where ALTER SYSTEM command was introduced.  
So back-patch to 9.4.  
  
Amit Kapila, slightly modified by me. Per report from Christoph Berg.  

M src/backend/utils/misc/guc-file.l

Fix typo in C comment.

commit   : 49d1e03d64f36a345c92901c4d13bf683f99eeec    
  
author   : Kevin Grittner <[email protected]>    
date     : Tue, 5 Aug 2014 14:17:21 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Tue, 5 Aug 2014 14:17:21 -0500    

Click here for diff

M src/backend/executor/execScan.c

Improve some JSON error messages.

commit   : 0ef99bdce3a6cd3195d7df12093042c16328c71c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Aug 2014 12:26:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Aug 2014 12:26:25 -0400    

Click here for diff

These messages are new in 9.4, which hasn't been released yet, so  
back-patch to REL9_4_STABLE.  
  
Daniele Varrazzo  

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

pg_upgrade: assume user is install user

commit   : ee646df59ae76d14f76e6fd305c1f9f2eeafd682    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 4 Aug 2014 11:56:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 4 Aug 2014 11:56:16 -0400    

Click here for diff

The user specified to the upgrade was effectively the install user, but  
that was not clearly stated in the comments, documentation, or error  
messages.  

M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/pg_upgrade.h
M doc/src/sgml/pgupgrade.sgml

pg_upgrade: remove reference to autovacuum_multixact_freeze_max_age

commit   : b4bd6f6b054f62a4ed70065b7b3fa95c012ae89a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 4 Aug 2014 11:45:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 4 Aug 2014 11:45:45 -0400    

Click here for diff

autovacuum_multixact_freeze_max_age was added as a pg_ctl start  
parameter in 9.3.X to prevent autovacuum from running.  However, only  
some 9.3.X releases have autovacuum_multixact_freeze_max_age as it was  
added in a minor PG 9.3 release.  It also isn't needed because -b turns  
off autovacuum in 9.1+.  
  
Without this fix, trying to upgrade from an early 9.3 release to 9.4  
would fail.  
  
Report by EDB  
  
Backpatch through 9.3  

M contrib/pg_upgrade/server.c

Windows doesn't have M_PI; define it ourselves when needed.

commit   : cd74a151b5a2498f0909074ebc9e8d8fbe6915b1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Aug 2014 18:06:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 4 Aug 2014 18:06:34 +0300    

Click here for diff

This should fix the Windows build, broken by commit ed802e7d.  

M contrib/pgbench/pgbench.c

Add missing PQclear() calls into pg_receivexlog.

commit   : b819dd7cb55aed1d607cef36b0ecd1a0642872b2    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 2 Aug 2014 15:18:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 2 Aug 2014 15:18:09 +0900    

Click here for diff

Back-patch to 9.3.  

M src/bin/pg_basebackup/receivelog.c

Fix bug in pg_receivexlog --verbose.

commit   : 694fd33e23170f64d30ef35e647b824d34938e09    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 2 Aug 2014 14:57:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 2 Aug 2014 14:57:21 +0900    

Click here for diff

In 9.2, pg_receivexlog with verbose option has emitted the messages  
at the end of each WAL file. But the commit 0b63291 suppressed such  
messages by mistake. This commit fixes the bug so that pg_receivexlog  
--verbose outputs such messages again.  
  
Back-patch to 9.3 where the bug was added.  

M src/bin/pg_basebackup/receivelog.c

Fix typo in user manual

commit   : 822ff44c822007ee14cacfebfe0792d1de669df9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 1 Aug 2014 21:13:17 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 1 Aug 2014 21:13:17 +0300    

Click here for diff

M doc/src/sgml/libpq.sgml

Move log_newpage and log_newpage_buffer to xlog.c.

commit   : 54685338e37889eebd473804c3feb006dd83a882    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 31 Jul 2014 16:48:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 31 Jul 2014 16:48:43 +0300    

Click here for diff

log_newpage is used by many indexams, in addition to heap, but for  
historical reasons it's always been part of the heapam rmgr. Starting with  
9.3, we have another WAL record type for logging an image of a page,  
XLOG_FPI. Simplify things by moving log_newpage and log_newpage_buffer to  
xlog.c, and switch to using the XLOG_FPI record type.  
  
Bump the WAL version number because the code to replay the old HEAP_NEWPAGE  
records is removed.  

M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/transam/xlog.c
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/decode.c
M src/include/access/heapam_xlog.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h

Avoid wholesale autovacuuming when autovacuum is nominally off.

commit   : f51ead09df19f0a074c07657b7de8dba0f3050d6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Jul 2014 14:41:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Jul 2014 14:41:35 -0400    

Click here for diff

When autovacuum is nominally off, we will still launch autovac workers  
to vacuum tables that are at risk of XID wraparound.  But after we'd done  
that, an autovac worker would proceed to autovacuum every table in the  
targeted database, if they meet the usual thresholds for autovacuuming.  
This is at best pretty unexpected; at worst it delays response to the  
wraparound threat.  Fix it so that if autovacuum is nominally off, we  
*only* do forced vacuums and not any other work.  
  
Per gripe from Andrey Zhidenkov.  This has been like this all along,  
so back-patch to all supported branches.  

M src/backend/postmaster/autovacuum.c

pgbench: Allow \setrandom to generate Gaussian/exponential distributions.

commit   : ed802e7dc36059efbc6669b4bfeebad43f0898c1    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Jul 2014 13:22:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Jul 2014 13:22:08 -0400    

Click here for diff

Mitsumasa KONDO and Fabien COELHO, with further wordsmithing by me.  

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

Fix mishandling of background worker PGPROCs in EXEC_BACKEND builds.

commit   : e280c630a87e1b8325770c6073097d109d79a00f    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Jul 2014 11:25:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Jul 2014 11:25:58 -0400    

Click here for diff

InitProcess() relies on IsBackgroundWorker to decide whether the PGPROC  
for a new backend should be taken from ProcGlobal's freeProcs or from  
bgworkerFreeProcs.  In EXEC_BACKEND builds, InitProcess() is called  
sooner than in non-EXEC_BACKEND builds, and IsBackgroundWorker wasn't  
getting initialized soon enough.  
  
Report by Noah Misch.  Diagnosis and fix by me.  

M src/backend/postmaster/postmaster.c

doc: Clean up some recently added PL/pgSQL documentation

commit   : 232f1475dce23e2fdd0568b35e9a7c470ae6c8ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jul 2014 23:47:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jul 2014 23:47:16 -0400    

Click here for diff

- Capitalize titles consistently.  
- Fix some grammar.  
- Group "Obtaining Information About an Error" under "Trapping Errors",  
  but make "Obtaining the Call Stack Context Information" its own  
  section, since it's not about errors.  

M doc/src/sgml/plpgsql.sgml

pg_upgrade: improve C comment wording

commit   : d826d8ecce80e318220a8a4e3d989a38397e5689    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 29 Jul 2014 22:08:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 29 Jul 2014 22:08:43 -0400    

Click here for diff

M contrib/pg_upgrade/check.c

Avoid uselessly looking up old LOCK_ONLY multixacts

commit   : 05315498012530d44cd89a209242a243374e274d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jul 2014 15:41:06 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jul 2014 15:41:06 -0400    

Click here for diff

Commit 0ac5ad5134f2 removed an optimization in multixact.c that skipped  
fetching members of MultiXactId that were older than our  
OldestVisibleMXactId value.  The reason this was removed is that it is  
possible for multixacts that contain updates to be older than that  
value.  However, if the caller is certain that the multi does not  
contain an update (because the infomask bits say so), it can pass this  
info down to GetMultiXactIdMembers, enabling it to use the old  
optimization.  
  
Pointed out by Andres Freund in [email protected]  

M contrib/pgrowlocks/pgrowlocks.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/multixact.c
M src/backend/utils/time/tqual.c
M src/include/access/multixact.h

Simplify multixact freezing a bit

commit   : c2581794f37e76c910eb91f1bf1f1e581123abd6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jul 2014 15:40:55 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jul 2014 15:40:55 -0400    

Click here for diff

Testing for abortedness of a multixact member that's being frozen is  
unnecessary: we only need to know whether the transaction is still in  
progress or committed to determine whether it must be kept or not.  This  
let us simplify the code a bit and avoid a useless TransactionIdDidAbort  
test.  
  
Suggested by Andres Freund awhile back.  

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

Oops, fix recoveryStopsBefore functions for regular commits.

commit   : 60d931827b0c37fbce74d04e45d0220d57ddd06a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 29 Jul 2014 17:16:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 29 Jul 2014 17:16:59 +0300    

Click here for diff

Pointed out by Tom Lane. Backpatch to 9.4, the code was structured  
differently in earlier branches and didn't have this mistake.  

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

Treat 2PC commit/abort the same as regular xacts in recovery.

commit   : e74e0906fad5fcdcc807d4655cdc69dded5d58f2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 29 Jul 2014 10:33:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 29 Jul 2014 10:33:15 +0300    

Click here for diff

There were several oversights in recovery code where COMMIT/ABORT PREPARED  
records were ignored:  
  
* pg_last_xact_replay_timestamp() (wasn't updated for 2PC commits)  
* recovery_min_apply_delay (2PC commits were applied immediately)  
* recovery_target_xid (recovery would not stop if the XID used 2PC)  
  
The first of those was reported by Sergiy Zuban in bug #11032, analyzed by  
Tom Lane and Andres Freund. The bug was always there, but was masked before  
commit d19bd29f07aef9e508ff047d128a4046cc8bc1e2, because COMMIT PREPARED  
always created an extra regular transaction that was WAL-logged.  
  
Backpatch to all supported versions (older versions didn't have all the  
features and therefore didn't have all of the above bugs).  

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

Reword the sentence for pg_logical_slot_peek_changes function.

commit   : 61e48efba579682f75332688bdb89f9eee24fb63    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 29 Jul 2014 12:07:54 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 29 Jul 2014 12:07:54 +0900    

Click here for diff

Previously the duplicated paragraphs were used next to each other  
in the document to demonstrate that the changes in the stream  
were not consumed by pg_logical_slot_peek_changes function.  
But some users misunderstood that the duplication of the same  
paragraph was just typo. So this commit rewords the sentence in  
the latter paragraph for less confusing.  
  
Christoph Moench-Tegeder  

M doc/src/sgml/logicaldecoding.sgml

Fix obsolete statement in smgr/README.

commit   : 248fc1f10716964b7e7d0f8ada686801d1e36445    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jul 2014 16:30:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jul 2014 16:30:14 -0400    

Click here for diff

Since commit 2d00190495b22e0d0ba351b2cda9c95fb2e3d083, fork numbers are  
defined in relpath.h not relfilenode.h.  
  
Fabrízio de Royes Mello  

M src/backend/storage/smgr/README

doc: Fix up ALTER TABLESPACE reference page

commit   : b0d3636c1775524c5c480510aa528ed2e9b50536    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Jul 2014 23:19:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Jul 2014 23:19:02 -0400    

Click here for diff

The documentation of ALTER TABLESPACE ... MOVE was added without any  
markup, not even paragraph breaks.  Fix that, and clarify the text in a  
few places.  

M doc/src/sgml/ref/alter_tablespace.sgml

Fix a performance problem in pg_dump's dump order selection logic.

commit   : c8e2e0e7129276440d1806dfe4f930c7177ccaac    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jul 2014 19:48:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jul 2014 19:48:42 -0400    

Click here for diff

findDependencyLoops() was not bright about cases where there are multiple  
dependency paths between the same two dumpable objects.  In most scenarios  
this did not hurt us too badly; but since the introduction of section  
boundary pseudo-objects in commit a1ef01fe163b304760088e3e30eb22036910a495,  
it was possible for this code to take unreasonable amounts of time (tens  
of seconds on a database with a couple thousand objects), as reported in  
bug #11033 from Joe Van Dyk.  Joe's particular problem scenario involved  
"pg_dump -a" mode with long chains of foreign key constraints, but I think  
that similar problems could arise with other situations as long as there  
were enough objects.  To fix, add a flag array that lets us notice when we  
arrive at the same object again while searching from a given start object.  
This simple change seems to be enough to eliminate the performance problem.  
  
Back-patch to 9.1, like the patch that introduced section boundary objects.  

M src/bin/pg_dump/pg_dump_sort.c

Handle WAIT_IO_COMPLETION return from WaitForMultipleObjectsEx().

commit   : de35a9771004b9d521c9d5882db6be4fba20e80e    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 25 Jul 2014 18:51:48 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 25 Jul 2014 18:51:48 -0400    

Click here for diff

This return code is possible wherever we pass bAlertable = TRUE; it  
arises when Windows caused the current thread to run an "I/O completion  
routine" or an "asynchronous procedure call".  PostgreSQL does not  
provoke either of those Windows facilities, hence this bug remaining  
largely unnoticed, but other local code might do so.  Due to a shortage  
of complaints, no back-patch for now.  
  
Per report from Shiv Shivaraju Gowda, this bug can cause  
PGSemaphoreLock() to PANIC.  The bug can also cause select() to report  
timeout expiration too early, which might confuse pgstat_init() and  
CheckRADIUSAuth().  

M src/backend/port/win32/socket.c
M src/backend/port/win32_sema.c

Move PGAC_LDAP_SAFE to config/programs.m4.

commit   : e565ff7553e60b3d13dde410ef96f5256c5525eb    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 25 Jul 2014 18:51:35 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 25 Jul 2014 18:51:35 -0400    

Click here for diff

This restores the style of keeping configure.in free of AC_DEFUN.  Per  
gripe from Tom Lane.  

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

Prevent shm_mq_send from reading uninitialized memory.

commit   : 1144ea3421e4bcc24dd7402a1f21ba94638d591b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 09:19:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 09:19:50 -0400    

Click here for diff

shm_mq_send_bytes didn't invariably initialize *bytes_written before  
returning, which would cause shm_mq_send to read from uninitialized  
memory and add the value it found there to mqh->mqh_partial_bytes.  
This could cause the next attempt to send a message via the queue to  
fail an assertion (if the queue was detached) or copy data from a  
garbage pointer value into the queue (if non-blocking mode was in use).  

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

Fix checkpointer crash in EXEC_BACKEND builds.

commit   : 250c26ba9cf247c2d5b8dbd2435a36d11382c43e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 09:04:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 09:04:59 -0400    

Click here for diff

Nothing in the checkpointer calls InitXLOGAccess(), so WALInsertLocks  
never got initialized there.  Without EXEC_BACKEND, it works anyway  
because the correct value is inherited from the postmaster, but  
with EXEC_BACKEND we've got a problem.  The problem appears to have  
been introduced by commit 68a2e52bbaf98f136a96b3a0d734ca52ca440a95.  
  
To fix, move the relevant initialization steps from InitXLOGAccess()  
to XLOGShmemInit(), making this more parallel to what we do  
elsewhere.  
  
Amit Kapila  

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

Properly remove ephemeral replication slots after a crash restart.

commit   : 93a028f569232fa498279841cb61ad11c2df5c85    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Jul 2014 14:32:34 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Jul 2014 14:32:34 +0200    

Click here for diff

Ephemeral slots - slots that shouldn't survive database restarts -  
weren't properly cleaned up after a immediate/crash restart. They were  
ignored in the sense that they weren't restored into memory and thus  
didn't cause unwanted resource retention; but they prevented a new  
slot with the same name from being created.  
  
Now ephemeral slots are fully removed during startup.  
  
Backpatch to 9.4 where replication slots where added.  

M src/backend/replication/slot.c

Avoid access to already-released lock in LockRefindAndRelease.

commit   : 32d78894c2a92cbb2fe7b9160936fee31672e7d9    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 08:19:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 08:19:19 -0400    

Click here for diff

Spotted by Tom Lane.  

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

docs: Improve documentation of \pset without arguments.

commit   : 967a4e7f3107e3c5b732fe4f8e13a1f31a255e46    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 08:06:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Jul 2014 08:06:54 -0400    

Click here for diff

The syntax summary previously failed to clarify that the first  
argument is also optional.  The textual description did mention it,  
but all the way at the bottom.  It fits better with the command  
overview, so move it there, and fix the summary also.  
  
Dilip Kumar, reviewed by Fabien Coelho  

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

Fix bug where pg_receivexlog goes into busy loop if -s option is set to 0.

commit   : 78493b716802cbe632d36c85f0d7c3bdb708e045    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 24 Jul 2014 15:25:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 24 Jul 2014 15:25:26 +0900    

Click here for diff

The problem is that pg_receivexlog calls select(2) with timeout=0 and  
goes into busy loop when --status-interval option is set to 0. This bug  
was introduced by the commit,  
74cbe966fe2d76de1d607d933c98c144dab58769.  
  
Per report from Sawada Masahiko  

M src/bin/pg_basebackup/receivelog.c

Fix TAP installcheck tests when current directory name contains spaces

commit   : 455044d55a89d16d888f289aeaf1229a04a04b9f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Jul 2014 21:41:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Jul 2014 21:41:59 -0400    

Click here for diff

This fixes the installcheck part.  The check part has additional  
problems that will be addressed in a separate commit.  

M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/002_status.pl
M src/test/perl/TestLib.pm

Rearrange documentation paragraph describing pg_relation_size().

commit   : 4fd9e6ffdd9aae51a935c255cbf7691c369ded1b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Jul 2014 15:20:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Jul 2014 15:20:31 -0400    

Click here for diff

Break the list of available options into an <itemizedlist> instead of  
inline sentences.  This is mostly motivated by wanting to ensure that the  
cross-references to the FSM and VM docs don't cross page boundaries in PDF  
format; but it seems to me to read more easily this way anyway.  I took the  
liberty of editorializing a bit further while at it.  
  
Per complaint from Magnus about 9.0.18 docs not building in A4 format.  
Patch all active branches so we don't get blind-sided by this particular  
issue again in future.  

M doc/src/sgml/func.sgml

Report success when Windows kill() emulation signals an exiting process.

commit   : 0ea1f2a3a8dfcbe8062a65a13700fc5ae83482c6    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 23 Jul 2014 00:35:13 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 23 Jul 2014 00:35:13 -0400    

Click here for diff

This is consistent with the POSIX verdict that kill() shall not report  
ESRCH for a zombie process.  Back-patch to 9.0 (all supported versions).  
Test code from commit d7cdf6ee36adeac9233678fb8f2a112e6678a770 depends  
on it, and log messages about kill() reporting "Invalid argument" will  
cease to appear for this not-unexpected condition.  

M src/port/kill.c

MSVC: Substitute $(top_builddir) in REGRESS_OPTS.

commit   : 31f9bbf05928ed8f20b1c371df8098d8c7dddb37    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 23 Jul 2014 00:35:07 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 23 Jul 2014 00:35:07 -0400    

Click here for diff

Commit d7cdf6ee36adeac9233678fb8f2a112e6678a770 introduced a usage  
thereof.  Back-patch to 9.0, like that commit.  

M src/tools/msvc/vcregress.pl

Re-enable error for "SELECT ... OFFSET -1".

commit   : 27048980f503da22dcd289ec8342b7021c8e73e6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Jul 2014 13:30:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Jul 2014 13:30:01 -0400    

Click here for diff

The executor has thrown errors for negative OFFSET values since 8.4 (see  
commit bfce56eea45b1369b7bb2150a150d1ac109f5073), but in a moment of brain  
fade I taught the planner that OFFSET with a constant negative value was a  
no-op (commit 1a1832eb085e5bca198735e5d0e766a3cb61b8fc).  Reinstate the  
former behavior by only discarding OFFSET with a value of exactly 0.  In  
passing, adjust a planner comment that referenced the ancient behavior.  
  
Back-patch to 9.3 where the mistake was introduced.  

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

Check block number against the correct fork in get_raw_page().

commit   : 27cef0a56111a7a44e0d9b9a7819f7e9f4980a77    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Jul 2014 11:45:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Jul 2014 11:45:46 -0400    

Click here for diff

get_raw_page tried to validate the supplied block number against  
RelationGetNumberOfBlocks(), which of course is only right when  
accessing the main fork.  In most cases, the main fork is longer  
than the others, so that the check was too weak (allowing a  
lower-level error to be reported, but no real harm to be done).  
However, very small tables could have an FSM larger than their heap,  
in which case the mistake prevented access to some FSM pages.  
Per report from Torsten Foertsch.  
  
In passing, make the bad-block-number error into an ereport not elog  
(since it's certainly not an internal error); and fix sloppily  
maintained comment for RelationGetNumberOfBlocksInFork.  
  
This has been wrong since we invented relation forks, so back-patch  
to all supported branches.  

M contrib/pageinspect/rawpage.c
M src/backend/storage/buffer/bufmgr.c

Allow empty string object keys in json_object().

commit   : 4ebe3519e1c12fe02f734aa00f824833181840c7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Jul 2014 11:22:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Jul 2014 11:22:47 -0400    

Click here for diff

This makes the behaviour consistent with the json parser, other  
json-generating functions, and the JSON standards.  

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

Diagnose incompatible OpenLDAP versions during build and test.

commit   : d7cdf6ee36adeac9233678fb8f2a112e6678a770    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 22 Jul 2014 11:01:03 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 22 Jul 2014 11:01:03 -0400    

Click here for diff

With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, PostgreSQL  
backends can crash at exit.  Raise a warning during "configure" based on  
the compile-time OpenLDAP version number, and test the crash scenario in  
the dblink test suite.  Back-patch to 9.0 (all supported versions).  

M configure
M configure.in
M contrib/dblink/Makefile
A contrib/dblink/expected/.gitignore
M contrib/dblink/expected/dblink.out
A contrib/dblink/input/paths.source
A contrib/dblink/output/paths.source
A contrib/dblink/pg_service.conf
A contrib/dblink/sql/.gitignore
M contrib/dblink/sql/dblink.sql
M src/test/regress/regress.c

Unset some local environment variables in TAP tests

commit   : 24e786f056c0bf009815813de1d7f58ee09f554e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Jul 2014 00:42:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Jul 2014 00:42:36 -0400    

Click here for diff

Unset environment variables that control message language, so that we  
can compare some program output with expected strings.  This is very  
similar to what pg_regress does.  

M src/test/perl/TestLib.pm

gitattributes: Ignore time zone data files for whitespace checks

commit   : 8195e9e9c12baea983cb2aab018cda864fa2e223    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jul 2014 23:58:18 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jul 2014 23:58:18 -0400    

Click here for diff

The latest update introduced some funny whitespace, but since they are  
externally maintained files, we add them to the list of files to ignore.  

M .gitattributes

Reject out-of-range numeric timezone specifications.

commit   : 6412f3e2d09b562fafc129c134e7336c4fe790ed    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 22:41:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 22:41:20 -0400    

Click here for diff

In commit 631dc390f49909a5c8ebd6002cfb2bcee5415a9d, we started to handle  
simple numeric timezone offsets via the zic library instead of the old  
CTimeZone/HasCTZSet kluge.  However, we overlooked the fact that the zic  
code will reject UTC offsets exceeding a week (which seems a bit arbitrary,  
but not because it's too tight ...).  This led to possibly setting  
session_timezone to NULL, which results in crashes in most timezone-related  
operations as of 9.4, and crashes in a small number of places even before  
that.  So check for NULL return from pg_tzset_offset() and report an  
appropriate error message.  Per bug #11014 from Duncan Gillis.  
  
Back-patch to all supported branches, like the previous patch.  
(Unfortunately, as of today that no longer includes 8.4.)  

M src/backend/commands/variable.c
M src/timezone/pgtz.c

Release notes for 9.3.5, 9.2.9, 9.1.14, 9.0.18, 8.4.22.

commit   : 212825f8139abbcfe366a8f884193b5b693921de    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 14:59:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 14:59:17 -0400    

Click here for diff

M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.0.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml

Adjust cutoff points in newly-added sanity tests.

commit   : 87f830e0ce03063fc7f856c95fa75a719b3a8ad0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 12:58:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 12:58:41 -0400    

Click here for diff

Per recommendation from Andres.  

M src/backend/commands/vacuum.c

Defend against bad relfrozenxid/relminmxid/datfrozenxid/datminmxid values.

commit   : 78db307bb238f4d2d27e62c06a246e88b92fa53b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 11:41:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jul 2014 11:41:27 -0400    

Click here for diff

In commit a61daa14d56867e90dc011bbba52ef771cea6770, we fixed pg_upgrade so  
that it would install sane relminmxid and datminmxid values, but that does  
not cure the problem for installations that were already pg_upgraded to  
9.3; they'll initially have "1" in those fields.  This is not a big problem  
so long as 1 is "in the past" compared to the current nextMultiXact  
counter.  But if an installation were more than halfway to the MXID wrap  
point at the time of upgrade, 1 would appear to be "in the future" and  
that would effectively disable tracking of oldest MXIDs in those  
tables/databases, until such time as the counter wrapped around.  
  
While in itself this isn't worse than the situation pre-9.3, where we did  
not manage MXID wraparound risk at all, the consequences of premature  
truncation of pg_multixact are worse now; so we ought to make some effort  
to cope with this.  We discussed advising users to fix the tracking values  
manually, but that seems both very tedious and very error-prone.  
  
Instead, this patch adopts two amelioration rules.  First, a relminmxid  
value that is "in the future" is allowed to be overwritten with a  
full-table VACUUM's actual freeze cutoff, ignoring the normal rule that  
relminmxid should never go backwards.  (This essentially assumes that we  
have enough defenses in place that wraparound can never occur anymore,  
and thus that a value "in the future" must be corrupt.)  Second, if we see  
any "in the future" values then we refrain from truncating pg_clog and  
pg_multixact.  This prevents loss of clog data until we have cleaned up  
all the broken tracking data.  In the worst case that could result in  
considerable clog bloat, but in practice we expect that relfrozenxid-driven  
freezing will happen soon enough to fix the problem before clog bloat  
becomes intolerable.  (Users could do manual VACUUM FREEZEs if not.)  
  
Note that this mechanism cannot save us if there are already-wrapped or  
already-truncated-away MXIDs in the table; it's only capable of dealing  
with corrupt tracking values.  But that's the situation we have with the  
pg_upgrade bug.  
  
For consistency, apply the same rules to relfrozenxid/datfrozenxid.  There  
are not known mechanisms for these to get messed up, but if they were, the  
same tactics seem appropriate for fixing them.  

M src/backend/commands/vacuum.c

Properly use DEFAULT_EVENT_SOURCE in pgevent.c

commit   : 4c3c911d26b3944946f8d9b03dbead3ccdf73b19    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 21 Jul 2014 12:24:00 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 21 Jul 2014 12:24:00 +0200    

Click here for diff

This was broken and reverted in a previous commit. The (this time verified)  
fix is to simly add postgres_fe.h.  
  
MauMau, review by Amit Kapila  

M src/bin/pgevent/pgevent.c

Translation updates

commit   : cac0d5193bd56dd6ffb70b9fb5a959eedeca01d3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jul 2014 01:07:36 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jul 2014 01:07:36 -0400    

Click here for diff

M src/backend/po/de.po
M src/backend/po/pl.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/pl.po
M src/bin/initdb/po/pt_BR.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_config/po/pt_BR.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/pl.po
M src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_resetxlog/po/fr.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/pg_resetxlog/po/pt_BR.po
M src/bin/psql/po/pl.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/pt_BR.po
M src/interfaces/ecpg/ecpglib/po/pt_BR.po
M src/interfaces/ecpg/preproc/po/de.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/pt_BR.po
M src/pl/plperl/po/pt_BR.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpython/po/de.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/pt_BR.po
M src/pl/tcl/po/pt_BR.po

Update SQL features list

commit   : 0e819c5e98243b95f622406ab5377422758bbd1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jul 2014 00:42:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jul 2014 00:42:32 -0400    

Click here for diff

M src/backend/catalog/sql_features.txt

Replace "internationalize" with "localize" where appropriate

commit   : 2ee4efc4081e0487d70607ca0d0d4abdbb85106f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 20 Jul 2014 21:39:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 20 Jul 2014 21:39:37 -0400    

Click here for diff

M doc/src/sgml/libpq.sgml
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/preproc/ecpg.header

First-draft release notes for 9.3.5.

commit   : ddc41fd2f4756b529814ad03fa32e8ba10253996    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Jul 2014 18:17:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Jul 2014 18:17:25 -0400    

Click here for diff

As usual, the release notes for older branches will be made by cutting  
these down, but put them up for community review first.  
  
Note: a few of these items actually don't apply to 9.3, but only to older  
branches.  I'll sort that out when copying the text into the older  
release-X.Y.sgml files.  

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

Fix xreflabel for hot_standby_feedback.

commit   : 4cbe3abb3162d14a86bc8ec73fd9331638ec18a0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Jul 2014 22:20:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Jul 2014 22:20:29 -0400    

Click here for diff

Rather remarkable that this has been wrong since 9.1 and nobody noticed.  

M doc/src/sgml/config.sgml

Update time zone data files to tzdata release 2014e.

commit   : b1864fabf93f23e4eaa5ec4599a143ac8f7647e5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Jul 2014 15:00:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Jul 2014 15:00:50 -0400    

Click here for diff

DST law changes in Crimea, Egypt, Morocco.  New zone Antarctica/Troll  
for Norwegian base in Queen Maud Land.  

M src/timezone/data/africa
M src/timezone/data/antarctica
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/zone.tab

Partial fix for dropped columns in functions returning composite.

commit   : 9b35ddce93a2ef336498baa15581b9d10f01db9c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Jul 2014 14:28:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Jul 2014 14:28:22 -0400    

Click here for diff

When a view has a function-returning-composite in FROM, and there are  
some dropped columns in the underlying composite type, ruleutils.c  
printed junk in the column alias list for the reconstructed FROM entry.  
Before 9.3, this was prevented by doing get_rte_attribute_is_dropped  
tests while printing the column alias list; but that solution is not  
currently available to us for reasons I'll explain below.  Instead,  
check for empty-string entries in the alias list, which can only exist  
if that column position had been dropped at the time the view was made.  
(The parser fills in empty strings to preserve the invariant that the  
aliases correspond to physical column positions.)  
  
While this is sufficient to handle the case of columns dropped before  
the view was made, we have still got issues with columns dropped after  
the view was made.  In particular, the view could contain Vars that  
explicitly reference such columns!  The dependency machinery really  
ought to refuse the column drop attempt in such cases, as it would do  
when trying to drop a table column that's explicitly referenced in  
views.  However, we currently neglect to store dependencies on columns  
of composite types, and fixing that is likely to be too big to be  
back-patchable (not to mention that existing views in existing databases  
would not have the needed pg_depend entries anyway).  So I'll leave that  
for a separate patch.  
  
Pre-9.3, ruleutils would print such Vars normally (with their original  
column names) even though it suppressed their entries in the RTE's  
column alias list.  This is certainly bogus, since the printed view  
definition would fail to reload, but at least it didn't crash.  However,  
as of 9.3 the printed column alias list is tightly tied to the names  
printed for Vars; so we can't treat columns as dropped for one purpose  
and not dropped for the other.  This is why we can't just put back the  
get_rte_attribute_is_dropped test: it results in an assertion failure  
if the view in fact contains any Vars referencing the dropped column.  
Once we've got dependencies preventing such cases, we'll probably want  
to do it that way instead of relying on the empty-string test used here.  
  
This fix turned up a very ancient bug in outfuncs/readfuncs, namely  
that T_String nodes containing empty strings were not dumped/reloaded  
correctly: the node was printed as "<>" which is read as a string  
value of <>.  Since (per SQL) we disallow empty-string identifiers,  
such nodes don't occur normally, which is why we'd not noticed.  
(Such nodes aren't used for literal constants, just identifiers.)  
  
Per report from Marc Schablewski.  Back-patch to 9.3 which is where  
the rule printing behavior changed.  The dangling-variable case is  
broken all the way back, but that's not what his complaint is about.  

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

Limit pg_upgrade authentication advice to always-secure techniques.

commit   : 85f95739ec0c2d9c6afb10d9a0b42732191fbbde    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 18 Jul 2014 16:05:17 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 18 Jul 2014 16:05:17 -0400    

Click here for diff

~/.pgpass is a sound choice everywhere, and "peer" authentication is  
safe on every platform it supports.  Cease to recommend "trust"  
authentication, the safety of which is deeply configuration-specific.  
Back-patch to 9.0, where pg_upgrade was introduced.  

M doc/src/sgml/pgupgrade.sgml

Fix two low-probability memory leaks in regular expression parsing.

commit   : 1567e659a877d35ab4b85dafff41b2845d50990f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jul 2014 13:00:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jul 2014 13:00:27 -0400    

Click here for diff

If pg_regcomp failed after having invoked markst/cleanst, it would leak any  
"struct subre" nodes it had created.  (We've already detected all regex  
syntax errors at that point, so the only likely causes of later failure  
would be query cancel or out-of-memory.)  To fix, make sure freesrnode  
knows the difference between the pre-cleanst and post-cleanst cleanup  
procedures.  Add some documentation of this less-than-obvious point.  
  
Also, newlacon did the wrong thing with an out-of-memory failure from  
realloc(), so that the previously allocated array would be leaked.  
  
Both of these are pretty low-probability scenarios, but a bug is a bug,  
so patch all the way back.  
  
Per bug #10976 from Arthur O'Dwyer.  

M src/backend/regex/regcomp.c

Revert broken change to pgevent.c

commit   : 6cd471a6d46b463e5222e5bb2d859311ddc1d86a    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 17 Jul 2014 13:19:32 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 17 Jul 2014 13:19:32 +0200    

Click here for diff

pgevent doesn't include the global PostgreSQL headers, for a reason,  
and therefor cannot rely on defines in it...  

M src/bin/pgevent/pgevent.c

Add option to pg_ctl to choose event source for logging

commit   : c0e4520b1667279389bb0dce8d867df2ac25042a    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 17 Jul 2014 12:42:08 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 17 Jul 2014 12:42:08 +0200    

Click here for diff

pg_ctl will log to the Windows event log when it is running as a service,  
which is the primary way of running PostgreSQL on Windows. This option  
makes it possible to specify which event source to use for this, in order  
to separate different instances. The server logging itself is still controlled  
by the regular logging parameters, including a separate setting for the event  
source. The parameter to pg_ctl only controlls the logging from pg_ctl itself.  
  
MauMau, review in many iterations by Amit Kapila and me.  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pgevent/pgevent.c
M src/include/pg_config_manual.h

doc: Spell checking

commit   : aa688725615a4fb55c460f072fb144900a59582d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jul 2014 22:20:15 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jul 2014 22:20:15 -0400    

Click here for diff

M doc/src/sgml/bgworker.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xml2.sgml

Fix bugs in SP-GiST search with range type's -|- (adjacent) operator.

commit   : 1264ef31a399927f9fe02212e10980bf4ba7b9f2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Jul 2014 09:10:54 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Jul 2014 09:10:54 +0300    

Click here for diff

The consistent function contained several bugs:  
  
* The "if (which2) { ... }"  block was broken. It compared the  argument's  
lower bound against centroid's upper bound, while it was supposed to compare  
the argument's upper bound against the centroid's lower bound (the comment  
was correct, code was wrong). Also, it cleared bits in the "which1"  
variable, while it was supposed to clear bits in "which2".  
  
* If the argument's upper bound was equal to the centroid's lower bound, we  
descended to both halves (= all quadrants). That's unnecessary, searching  
the right quadrants is sufficient. This didn't lead to incorrect query  
results, but was clearly wrong, and slowed down queries unnecessarily.  
  
* In the case that argument's lower bound is adjacent to the centroid's  
upper bound, we also don't need to visit all quadrants. Per similar  
reasoning as previous point.  
  
* The code where we compare the previous centroid with the current centroid  
should match the code where we compare the current centroid with the  
argument. The point of that code is to redo the calculation done in the  
previous level, to see if we were supposed to traverse left or right (or up  
or down), and if we actually did. If we moved in the different direction,  
then we know there are no matches for bound.  
  
Refactor the code and adds comments to make it more readable and easier to  
reason about.  
  
Backpatch to 9.3 where SP-GiST support for range types was introduced.  

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

Allow join removal in some cases involving a left join to a subquery.

commit   : f15821eefd70941d4ec5bd77d75c1da5534ba6b2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Jul 2014 21:12:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Jul 2014 21:12:43 -0400    

Click here for diff

We can remove a left join to a relation if the relation's output is  
provably distinct for the columns involved in the join clause (considering  
only equijoin clauses) and the relation supplies no variables needed above  
the join.  Previously, the join removal logic could only prove distinctness  
by reference to unique indexes of a table.  This patch extends the logic  
to consider subquery relations, wherein distinctness might be proven by  
reference to GROUP BY, DISTINCT, etc.  
  
We actually already had some code to check that a subquery's output was  
provably distinct, but it was hidden inside pathnode.c; which was a pretty  
bad place for it really, since that file is mostly boilerplate Path  
construction and comparison.  Move that code to analyzejoins.c, which is  
arguably a more appropriate location, and is certainly the site of the  
new usage for it.  
  
David Rowley, reviewed by Simon Riggs  

M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/planmain.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Move check for SSL_get_current_compression to run on mingw

commit   : 5571caf42d62ea30c452b0ae5f1748289ae613b4    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 22:00:56 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 22:00:56 +0200    

Click here for diff

Mingw uses a different header file than msvc, so we don't get the  
hardcoded value, so we need the configure test to run.  

M configure
M configure.in

doc: Put new options in right order on reference pages

commit   : 9a218c02b8f10bc5aa3a9227b0a30ad0b6bdf6a6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 14:34:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 14:34:33 -0400    

Click here for diff

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

pg_upgrade: Fix spacing in help output

commit   : e0da6ec618a3890d7d5d8b8342645e6683848d67    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 14:33:59 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 14:33:59 -0400    

Click here for diff

M contrib/pg_upgrade/option.c

pg_basebackup: Add more information about --max-rate option to help output

commit   : e806da6bdbe9544e061b635f33b8ee561094b4d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 14:32:55 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 14:32:55 -0400    

Click here for diff

It was previously not clear what unit the option argument should have.  

M src/bin/pg_basebackup/pg_basebackup.c

json_build_object and json_build_array are stable, not immutable.

commit   : 0f43a55331c5697caa2054189ad8d1e717ccb192    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 15 Jul 2014 14:24:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 15 Jul 2014 14:24:47 -0400    

Click here for diff

These functions indirectly invoke output functions, so they can't be  
immutable.  
  
Backpatch to 9.4 where they were introduced.  
  
Catalog version bumped.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h

Add missing doc changes for ee80f043bc9b

commit   : da6ac4a6683788ed7042a46568f2b040210830f8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 15 Jul 2014 13:59:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 15 Jul 2014 13:59:53 -0400    

Click here for diff

Per note from Tom Lane  

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

Fix REASSIGN OWNED for text search objects

commit   : 6bdf4b9c7dde84902a0cc19c27c51c016485b8e6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 15 Jul 2014 13:24:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 15 Jul 2014 13:24:07 -0400    

Click here for diff

Trying to reassign objects owned by a user that had text search  
dictionaries or configurations used to fail with:  
ERROR:  unexpected classid 3600  
or  
ERROR:  unexpected classid 3602  
  
Fix by adding cases for those object types in a switch in pg_shdepend.c.  
  
Both REASSIGN OWNED and text search objects go back all the way to 8.1,  
so backpatch to all supported branches.  In 9.3 the alter-owner code was  
made generic, so the required change in recent branches is pretty  
simple; however, for 9.2 and older ones we need some additional  
reshuffling to enable specifying objects by OID rather than name.  
  
Text search templates and parsers are not owned objects, so there's no  
change required for them.  
  
Per bug #9749 reported by Michal Novotný  

M src/backend/catalog/pg_shdepend.c

Detect presence of SSL_get_current_compression

commit   : c9e1ad7faf75aeda633e27ba6c042dabe4aa353d    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 18:04:43 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 18:04:43 +0200    

Click here for diff

Apparently we still build against OpenSSL so old that it doesn't  
have this function, so add an autoconf check for it to make the  
buildfarm happy. If the function doesn't exist, always return  
that compression is disabled, since presumably the actual  
compression functionality is always missing.  
  
For now, hardcode the function as present on MSVC, since we should  
hopefully be well beyond those old versions on that platform.  

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

Add missing source files to nls.mk

commit   : f9ddcf75430467493aa6c2b07a45776e4ae8b416    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 10:00:53 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 10:00:53 -0400    

Click here for diff

These are files under common/ that have been moved around.  Updating  
these manually is not satisfactory, but it's the only solution at the  
moment.  

M src/bin/initdb/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/psql/nls.mk
M src/bin/scripts/nls.mk

Include SSL compression status in psql banner and connection logging

commit   : c93bf8c6ccf7ef1cec6b01fec1888f84831295ee    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 15:07:38 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 15:07:38 +0200    

Click here for diff

Both the psql banner and the connection logging already included  
SSL status, cipher and bitlength, this adds the information about  
compression being on or off.  

M src/backend/utils/init/postinit.c
M src/bin/psql/command.c

Small spelling fix

commit   : d90ad5d8abe7947520686239a7547f2eb8cc9a8d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 08:45:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 08:45:27 -0400    

Click here for diff

M src/backend/catalog/objectaddress.c

Add missing serial commas

commit   : d38228fe4029cce3af396bf5b1728d8000ab32c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 08:25:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Jul 2014 08:25:27 -0400    

Click here for diff

Also update one place where the wal_level "logical" was not added to an  
error message.  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/json.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out

Remove dependency on wsock32.lib in favor of ws2_32

commit   : a16bac36eca8158cbf78987e95376f610095f792    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 14:18:39 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 15 Jul 2014 14:18:39 +0200    

Click here for diff

ws2_32 is the new version of the library that should be used, as  
it contains the require functionality from wsock32 as well as some  
more (which is why some binaries were already using ws2_32).  
  
Michael Paquier, reviewed by MauMau  

M configure
M configure.in
M contrib/pgcrypto/Makefile
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/win32.c
M src/interfaces/libpq/win32.mak
M src/test/thread/README
M src/tools/msvc/Mkvcbuild.pm

doc: small fixes for REINDEX reference page

commit   : f162fb75b329bc5370b3ece59f5ef0d5ba0f15d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Jul 2014 20:37:00 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Jul 2014 20:37:00 -0400    

Click here for diff

From: Josh Kupershmidt <[email protected]>  

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

psql: Show tablespace size in \db+

commit   : ee80f043bc9b92dbbb1ff9577c3c601746124092    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 Jul 2014 18:04:52 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 Jul 2014 18:04:52 -0400    

Click here for diff

Fabrízio de Royes Mello  

M src/bin/psql/describe.c

Move view reloptions into their own varlena struct

commit   : 346d7be184a617ca9f64bdf5c25fd6bcd5231293    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 Jul 2014 17:24:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 Jul 2014 17:24:40 -0400    

Click here for diff

Per discussion after a gripe from me in  
http://www.postgresql.org/message-id/[email protected]  
  
Jaime Casanova  

M src/backend/access/common/reloptions.c
M src/backend/commands/tablecmds.c
M src/include/access/reloptions.h
M src/include/utils/rel.h
M src/tools/pgindent/typedefs.list

Add file version information to most installed Windows binaries.

commit   : 0ffc201a51395ca71fe429ef86c872850a5850ee    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:52 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:52 -0400    

Click here for diff

Prominent binaries already had this metadata.  A handful of minor  
binaries, such as pg_regress.exe, still lack it; efforts to eliminate  
such exceptions are welcome.  
  
Michael Paquier, reviewed by MauMau.  

M contrib/adminpack/Makefile
M contrib/auth_delay/Makefile
M contrib/auto_explain/Makefile
M contrib/btree_gin/Makefile
M contrib/btree_gist/Makefile
M contrib/chkpass/Makefile
M contrib/citext/Makefile
M contrib/cube/Makefile
M contrib/dblink/Makefile
M contrib/dict_int/Makefile
M contrib/dict_xsyn/Makefile
M contrib/dummy_seclabel/Makefile
M contrib/earthdistance/Makefile
M contrib/file_fdw/Makefile
M contrib/fuzzystrmatch/Makefile
M contrib/hstore/Makefile
M contrib/intarray/Makefile
M contrib/isn/Makefile
M contrib/lo/Makefile
M contrib/ltree/Makefile
M contrib/oid2name/Makefile
M contrib/pageinspect/Makefile
M contrib/passwordcheck/Makefile
M contrib/pg_archivecleanup/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_test_fsync/Makefile
M contrib/pg_test_timing/Makefile
M contrib/pg_trgm/Makefile
M contrib/pg_xlogdump/Makefile
M contrib/pgbench/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/spi/Makefile
M contrib/sslinfo/Makefile
M contrib/tablefunc/Makefile
M contrib/tcn/Makefile
M contrib/test_decoding/Makefile
M contrib/test_parser/Makefile
M contrib/test_shm_mq/Makefile
M contrib/tsearch2/Makefile
M contrib/unaccent/Makefile
M contrib/uuid-ossp/Makefile
M contrib/vacuumlo/Makefile
M contrib/worker_spi/Makefile
M contrib/xml2/Makefile
M src/backend/replication/libpqwalreceiver/Makefile
M src/backend/utils/mb/conversion_procs/ascii_and_mic/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/Makefile
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/Makefile
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/Makefile
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/Makefile
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/Makefile
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/Makefile
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/Makefile
M src/backend/utils/mb/conversion_procs/latin_and_mic/Makefile
M src/backend/utils/mb/conversion_procs/proc.mk
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_big5/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_johab/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/Makefile
M src/backend/utils/mb/conversion_procs/utf8_and_win/Makefile
M src/bin/pg_basebackup/Makefile
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/test/Makefile
M src/makefiles/Makefile.win32
M src/makefiles/pgxs.mk
M src/pl/plperl/GNUmakefile
M src/pl/plpgsql/src/Makefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile
M src/tools/msvc/clean.bat

contrib/test_decoding/Makefile sets MODULES, so omit OBJS.

commit   : c0e8fb6148ce9c539f6fbde71faa955cab85f214    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:45 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:45 -0400    

Click here for diff

Michael Paquier  

M contrib/test_decoding/Makefile

MSVC: Apply icons to all binaries having them in a MinGW build.

commit   : c4a448eb55f35a7f582e30d15ee0ea10b67b70a2    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:41 -0400    

Click here for diff

M src/tools/msvc/Mkvcbuild.pm

MSVC: Process Makefile line continuations more like "make" does.

commit   : 35d19a9a37c245ff7c640743f37b8df227fd24dc    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:27 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:27 -0400    

Click here for diff

Unlike "make" itself, the MSVC build process recognized a continuation  
even with whitespace after the backslash.  (Due to a typo, some code  
sites accepted the letter "s" instead of whitespace).  Also, it would  
consume any number of newlines following a single backslash.  This is  
mere cleanup; those behaviors were unlikely to cause bugs.  

M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/vcregress.pl

MSVC: Recognize PGFILEDESC in contrib and conversion_procs modules.

commit   : 91f03ba5cf88b393bf2509f3f00dd00437a5bd54    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:21 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:21 -0400    

Click here for diff

Achieve this by consistently using four-argument Solution::AddProject()  
calls.  Remove ad hoc Makefile parsing made redundant by doing that.  
  
Michael Paquier and Noah Misch, reviewed by MauMau.  

M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/clean.bat

Fix warnings added in 8d9a0e85bd6ab4fe5268a1d759a787f72ff9333e.

commit   : 52be3aae5bfe84346b7ce202eae3447a07dfc882    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:12 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 14 Jul 2014 14:07:12 -0400    

Click here for diff

M src/tools/msvc/Solution.pm

Prevent bitmap heap scans from showing unnecessary block info in EXPLAIN ANALYZE.

commit   : d4635b16fe3d0fae65d7735d9e926a1b20a90781    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 14 Jul 2014 20:40:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 14 Jul 2014 20:40:14 +0900    

Click here for diff

EXPLAIN ANALYZE shows the information of the numbers of exact/lossy blocks which  
bitmap heap scan processes. But, previously, when those numbers were both zero,  
it displayed only the prefix "Heap Blocks:" in TEXT output format. This is strange  
and would confuse the users. So this commit suppresses such unnecessary information.  
  
Backpatch to 9.4 where EXPLAIN ANALYZE was changed so that such information was  
displayed.  
  
Etsuro Fujita  

M src/backend/commands/explain.c

Remove incorrect comment from postgres_fdw.c.

commit   : ab774859456eb441ef049bf66af38b259cbdacce    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 14 Jul 2014 19:28:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 14 Jul 2014 19:28:26 +0900    

Click here for diff

Etsuro Fujita  

M contrib/postgres_fdw/postgres_fdw.c

Support --with-extra-version equivalent functionality in MSVC build

commit   : 8d9a0e85bd6ab4fe5268a1d759a787f72ff9333e    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 12 Jul 2014 19:36:28 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 12 Jul 2014 19:36:28 +0200    

Click here for diff

Adds a configuration parameter, extraver, that is appended to the  
version number when built.  
  
Michael Paquier, reviewed by Muhammad Asif Naeem  

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

Minimal psql tab completion support for SET search_path.

commit   : bd409519bd19911d2d2cba64415447d2fa9d766b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Jul 2014 15:44:39 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Jul 2014 15:44:39 +0200    

Click here for diff

Complete SET search_path = ... to non-temporary and non-toast  
schemas. Since there pretty much is no use case to add those to the  
search path and there can be many it's helpful to exclude them.  
  
It'd be nicer to complete multiple search path elements, but that's  
not easy.  
  
Jeff Janes  

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

Fix decoding of consecutive MULTI_INSERTs emitted by one heap_multi_insert().

commit   : 626bfad6cc5701eb385b8995e1431ad6a5f24928    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Jul 2014 14:28:19 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Jul 2014 14:28:19 +0200    

Click here for diff

Commit 1b86c81d2d fixed the decoding of toasted columns for the rows  
contained in one xl_heap_multi_insert record. But that's not actually  
enough, because heap_multi_insert() will actually first toast all  
passed in rows and then emit several *_multi_insert records; one for  
each page it fills with tuples.  
  
Add a XLOG_HEAP_LAST_MULTI_INSERT flag which is set in  
xl_heap_multi_insert->flag denoting that this multi_insert record is  
the last emitted by one heap_multi_insert() call. Then use that flag  
in decode.c to only set clear_toast_afterwards in the right situation.  
  
Expand the number of rows inserted via COPY in the corresponding  
regression test to make sure that more than one heap page is filled  
with tuples by one heap_multi_insert() call.  
  
Backpatch to 9.4 like the previous commit.  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql
M src/backend/access/heap/heapam.c
M src/backend/replication/logical/decode.c
M src/include/access/heapam_xlog.h

Add autocompletion of locale keywords for CREATE DATABASE

commit   : deee42ab015d54baa1b9e0165bf3635dab4f9f7a    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 12 Jul 2014 14:17:43 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 12 Jul 2014 14:17:43 +0200    

Click here for diff

Adds support for autocomplete of LC_COLLATE and LC_CTYPE to  
the CREATE DATABASE command in psql.  

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

Fix bug with whole-row references to append subplans.

commit   : d68581483564ec0fbfdc255e493c4f5bd165e55e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Jul 2014 19:12:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Jul 2014 19:12:35 -0400    

Click here for diff

ExecEvalWholeRowVar incorrectly supposed that it could "bless" the source  
TupleTableSlot just once per query.  But if the input is coming from an  
Append (or, perhaps, other cases?) more than one slot might be returned  
over the query run.  This led to "record type has not been registered"  
errors when a composite datum was extracted from a non-blessed slot.  
  
This bug has been there a long time; I guess it escaped notice because when  
dealing with subqueries the planner tends to expand whole-row Vars into  
RowExprs, which don't have the same problem.  It is possible to trigger  
the problem in all active branches, though, as illustrated by the added  
regression test.  

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

Fix whitespace

commit   : 80ddd04b4d66ad6564b6d77ffc2bd8fb5e0dcdfa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jul 2014 15:12:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jul 2014 15:12:11 -0400    

Click here for diff

M src/backend/utils/sort/tuplesort.c
M src/include/access/hash.h

Implement IMPORT FOREIGN SCHEMA.

commit   : 59efda3e50ca4de6a9d5aa4491464e22b6329b1e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Jul 2014 15:01:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Jul 2014 15:01:31 -0400    

Click here for diff

This command provides an automated way to create foreign table definitions  
that match remote tables, thereby reducing tedium and chances for error.  
In this patch, we provide the necessary core-server infrastructure and  
implement the feature fully in the postgres_fdw foreign-data wrapper.  
Other wrappers will throw a "feature not supported" error until/unless  
they are updated.  
  
Ronan Dunklau and Michael Paquier, additional work by me  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ddl.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
A doc/src/sgml/ref/import_foreign_schema.sgml
M doc/src/sgml/reference.sgml
M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/foreign/foreign.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.c
M src/include/commands/defrem.h
M src/include/foreign/fdwapi.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Adjust blank lines around PG_MODULE_MAGIC defines, for consistency

commit   : 6a605cd6bd9f689b35676623add0de9b90978bf1    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 10 Jul 2014 14:02:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 10 Jul 2014 14:02:08 -0400    

Click here for diff

Report by Robert Haas  

M contrib/dict_int/dict_int.c
M contrib/earthdistance/earthdistance.c
M contrib/intarray/_int_op.c
M contrib/lo/lo.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_freespacemap/pg_freespacemap.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sslinfo/sslinfo.c
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/test_parser/test_parser.c
M contrib/test_shm_mq/test.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/xml2/xpath.c
M src/backend/snowball/dict_snowball.c
M src/pl/plperl/plperl.c
M src/tutorial/complex.c
M src/tutorial/funcs.c
M src/tutorial/funcs_new.c

Add new ECHO mode 'errors' that displays only failed commands in psql.

commit   : 5b214c5dd1de37764797b3fb9164af3c885a7b86    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 10 Jul 2014 14:27:54 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 10 Jul 2014 14:27:54 +0900    

Click here for diff

When the psql variable ECHO is set to 'erros', only failed SQL commands  
are printed to standard error output. Also this patch adds -b option into psql.  
This is equivalent to setting the variable ECHO to 'errors'.  
  
Pavel Stehule, reviewed by Fabrízio de Royes Mello, Samrat Revagade,  
Kumar Rajeev Rastogi, Abhijit Menon-Sen, and me.  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c

Fix error hint style.

commit   : b043985b7aaf62f6978a0c567c8340ad9cf1ad67    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Jul 2014 11:34:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Jul 2014 11:34:47 -0400    

Click here for diff

Mistake caught by Tom Lane.  

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

Improve error messages for bytea decoding failures.

commit   : f73474382cb304b4f043e5de89c28b0365c04156    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 9 Jul 2014 11:04:45 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 9 Jul 2014 11:04:45 -0400    

Click here for diff

Craig Ringer  

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

Fix whitespace

commit   : 8522f21400570fdf6af38c32a2522a5465dccfd5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 23:29:09 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 23:29:09 -0400    

Click here for diff

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgprewarm.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/psql-ref.sgml

Update key words table for 9.4

commit   : 56abcf6b829adcbadcc73e4eb06caefb50d110bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 14:54:32 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 14:54:32 -0400    

Click here for diff

M doc/src/sgml/keywords.sgml

commit   : 889313c76b2d0f3388e3008fb309bb71d4c9978b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 14:14:37 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 14:14:37 -0400    

Click here for diff

M doc/src/sgml/func.sgml

Don't assume a subquery's output is unique if there's a SRF in its tlist.

commit   : 9e2f2d7a0539460dc76dbf76dfae17024d5e031e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Jul 2014 14:03:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Jul 2014 14:03:14 -0400    

Click here for diff

While the x output of "select x from t group by x" can be presumed unique,  
this does not hold for "select x, generate_series(1,10) from t group by x",  
because we may expand the set-returning function after the grouping step.  
(Perhaps that should be re-thought; but considering all the other oddities  
involved with SRFs in targetlists, it seems unlikely we'll change it.)  
Put a check in query_is_distinct_for() so it's not fooled by such cases.  
  
Back-patch to all supported branches.  
  
David Rowley  

M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

doc: Fix spacing in verbatim environments

commit   : 53166fe248c1b4b211094e80e54e5ab330dbf957    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 11:39:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Jul 2014 11:39:07 -0400    

Click here for diff

M doc/src/sgml/config.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/test-decoding.sgml

Fix typo in comment.

commit   : 6048896e4c9679cba89242d77f02ceba01c791d1    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 8 Jul 2014 10:21:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 8 Jul 2014 10:21:16 +0900    

Click here for diff

This typo was accidentally added by recent commit 4cbd128.  

M src/bin/pg_basebackup/receivelog.c

In pg_dump, show server and pg_dump versions with or without --verbose.

commit   : 7700597b34fbb26e377f419271f65be1c13c518f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Jul 2014 19:02:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Jul 2014 19:02:45 -0400    

Click here for diff

We used to print this information only in verbose mode, but it's argued  
that it's useful enough to print always; one reason being that this  
provides some documentation about which Postgres versions the dump is  
meant to reload into.  
  
Jing Wang, reviewed by Jeevan Chalke  

M src/bin/pg_dump/pg_backup_archiver.c

pg_upgrade: allow upgrades for new-only TOAST tables

commit   : 3088cc37044a303fc50857d8d9e7e44b5c250642    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 7 Jul 2014 13:24:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 7 Jul 2014 13:24:08 -0400    

Click here for diff

Previously, when calculations on the need for toast tables changed,  
pg_upgrade could not handle cases where the new cluster needed a TOAST  
table and the old cluster did not.  (It already handled the opposite  
case.)  This fixes the "OID mismatch" error typically generated in this  
case.  
  
Backpatch through 9.2  

M contrib/pg_upgrade/info.c

Fix typos in comments.

commit   : 4cbd12832839830fe58bb5d9d4ba7e2ec84952ce    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 7 Jul 2014 19:39:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 7 Jul 2014 19:39:42 +0900    

Click here for diff

M src/backend/tcop/postgres.c
M src/bin/pg_basebackup/receivelog.c
M src/include/postgres.h

Remove swpb-based spinlock implementation for ARMv5 and earlier.

commit   : 4893ccd02459fdb444f4f4b34c441eb899592879    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 6 Jul 2014 14:52:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 6 Jul 2014 14:52:25 -0400    

Click here for diff

Per recent analysis by Andres Freund, this implementation is in fact  
unsafe, because ARMv5 has weak memory ordering, which means tha the  
CPU could move loads or stores across the volatile store performed by  
the default S_UNLOCK.  We could try to fix this, but have no ARMv5  
hardware to test on, so removing support seems better.  We can still  
support ARMv5 systems on GCC versions new enough to have built-in  
atomics support for this platform, and can also re-add support for  
the old way if someone has hardware that can be used to test a fix.  
However, since the requirement to use a relatively-new GCC hasn't  
been an issue for ARMv6 or ARMv7, which lack the swpb instruction  
altogether, perhaps it won't be an issue for ARMv5 either.  

M src/include/storage/s_lock.h

Fix decoding of MULTI_INSERTs when rows other than the last are toasted.

commit   : 1b86c81d2d255d3fb665ddc77c2bc3dfd751a1df    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 6 Jul 2014 15:58:01 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 6 Jul 2014 15:58:01 +0200    

Click here for diff

When decoding the results of a HEAP2_MULTI_INSERT (currently only  
generated by COPY FROM) toast columns for all but the last tuple  
weren't replaced by their actual contents before being handed to the  
output plugin. The reassembled toast datums where disregarded after  
every REORDER_BUFFER_CHANGE_(INSERT|UPDATE|DELETE) which is correct  
for plain inserts, updates, deletes, but not multi inserts - there we  
generate several REORDER_BUFFER_CHANGE_INSERTs for a single  
xl_heap_multi_insert record.  
  
To solve the problem add a clear_toast_afterwards boolean to  
ReorderBufferChange's union member that's used by modifications. All  
row changes but multi_inserts always set that to true, but  
multi_insert sets it only for the last change generated.  
  
Add a regression test covering decoding of multi_inserts - there was  
none at all before.  
  
Backpatch to 9.4 where logical decoding was introduced.  
  
Bug found by Petr Jelinek.  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/replication/reorderbuffer.h

Consistently pass an "unsigned char" to ctype.h functions.

commit   : 333b7db8b39679acf0665b3fc4ad99cbc14fbba7    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 6 Jul 2014 00:29:51 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 6 Jul 2014 00:29:51 -0400    

Click here for diff

The isxdigit() calls relied on undefined behavior.  The isascii() call  
was well-defined, but our prevailing style is to include the cast.  
Back-patch to 9.4, where the isxdigit() calls were introduced.  

M contrib/pg_upgrade/controldata.c
M src/backend/utils/adt/json.c

Remove dead typeStruct variable from plpy_spi.c.

commit   : e254ff21d1286fe5c2b5ecdfa9bb6b15a7830fcd    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 5 Jul 2014 10:59:08 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 5 Jul 2014 10:59:08 -0500    

Click here for diff

Left behind by 8b6010b8350a1756cd85595705971df81b5ffc07.  

M src/pl/plpython/plpy_spi.c

Fix double-free bug of WAL streaming buffer in pg_receivexlog.

commit   : 4ccac92d08f22ef0f8df29ea6bd9d5e77bf1d246    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 4 Jul 2014 19:48:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 4 Jul 2014 19:48:38 +0900    

Click here for diff

This bug was introduced while refactoring in commit 74cbe96.  

M src/bin/pg_basebackup/receivelog.c

Refactor pg_receivexlog main loop code, for readability.

commit   : 74cbe966fe2d76de1d607d933c98c144dab58769    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 4 Jul 2014 12:00:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 4 Jul 2014 12:00:48 +0900    

Click here for diff

Previously the source codes for receiving the data and for  
polling the socket were included in pg_receivexlog main loop.  
This commit splits out them as separate functions. This is  
useful for improving the readability of main loop code and  
making the future pg_receivexlog-related patch simpler.  

M src/bin/pg_basebackup/receivelog.c

Split out the description of page-level lock as new subsection in document.

commit   : 644d85351e6aa364d31d6c5402e4fd6a3e94e91d    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 4 Jul 2014 11:24:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 4 Jul 2014 11:24:59 +0900    

Click here for diff

Michael Banck  

M doc/src/sgml/mvcc.sgml

Don't cache per-group context across the whole query in orderedsetaggs.c.

commit   : ecd657974478fc713fdc3a625d648cd6a985e3e6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Jul 2014 18:47:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Jul 2014 18:47:09 -0400    

Click here for diff

Although nodeAgg.c currently uses the same per-group memory context for  
all groups of a query, that might change in future.  Avoid assuming it.  
This costs us an extra AggCheckCallContext() call per group, but that's  
pretty cheap and is probably good from a safety standpoint anyway.  
  
Back-patch to 9.4 in case any third-party code copies this logic.  
  
Andrew Gierth  

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

Redesign API presented by nodeAgg.c for ordered-set and similar aggregates.

commit   : 6f5034eda05c4946b65858fb8831d069f2873083    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Jul 2014 18:25:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Jul 2014 18:25:33 -0400    

Click here for diff

The previous design exposed the input and output ExprContexts of the  
Agg plan node, but work on grouping sets has suggested that we'll regret  
doing that.  Instead provide more narrowly-defined APIs that can be  
implemented in multiple ways, namely a way to get a short-term memory  
context and a way to register an aggregate shutdown callback.  
  
Back-patch to 9.4 where the bad APIs were introduced, since we don't  
want third-party code using these APIs and then having to change in 9.5.  
  
Andrew Gierth  

M src/backend/executor/nodeAgg.c
M src/backend/utils/adt/orderedsetaggs.c
M src/include/fmgr.h

Improve support for composite types in PL/Python.

commit   : 8b6010b8350a1756cd85595705971df81b5ffc07    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Jul 2014 16:10:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Jul 2014 16:10:50 -0400    

Click here for diff

Allow PL/Python functions to return arrays of composite types.  
Also, fix the restriction that plpy.prepare/plpy.execute couldn't  
handle query parameters or result columns of composite types.  
  
In passing, adopt a saner arrangement for where to release the  
tupledesc reference counts acquired via lookup_rowtype_tupdesc.  
The callers of PLyObject_ToCompositeDatum were doing the lookups,  
but then the releases happened somewhere down inside subroutines  
of PLyObject_ToCompositeDatum, which is bizarre and bug-prone.  
Instead release in the same function that acquires the refcount.  
  
Ed Behn and Ronan Dunklau, reviewed by Abhijit Menon-Sen  

M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_composite.sql
M src/pl/plpython/sql/plpython_spi.sql
M src/pl/plpython/sql/plpython_types.sql

Use a separate temporary directory for the Unix-domain socket

commit   : f545d233ebce6971b6f9847680e48b679e707d22    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jul 2014 21:44:02 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jul 2014 21:44:02 -0400    

Click here for diff

Creating the Unix-domain socket in the build directory can run into  
name-length limitations.  Therefore, create the socket file in the  
default temporary directory of the operating system.  Keep the temporary  
data directory etc. in the build tree.  

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

Support vpath builds in TAP tests

commit   : 0490db62871dc6888c52bd9465d9ade16ab8e795    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jul 2014 21:47:07 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jul 2014 21:47:07 -0400    

Click here for diff

M src/Makefile.global.in
M src/test/perl/TestLib.pm

Smooth reporting of commit/rollback statistics.

commit   : ac46de56eab9bb93c23c7f34070f3a16e7e76743    
  
author   : Kevin Grittner <[email protected]>    
date     : Wed, 2 Jul 2014 15:20:30 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Wed, 2 Jul 2014 15:20:30 -0500    

Click here for diff

If a connection committed or rolled back any transactions within a  
PGSTAT_STAT_INTERVAL pacing interval without accessing any tables,  
the reporting of those statistics would be held up until the  
connection closed or until it ended a PGSTAT_STAT_INTERVAL interval  
in which it had accessed a table.  This could result in under-  
reporting of transactions for an extended period, followed by a  
spike in reported transactions.  
  
While this is arguably a bug, the impact is minimal, primarily  
affecting, and being affected by, monitoring software.  It might  
cause more confusion than benefit to change the existing behavior  
in released stable branches, so apply only to master and the 9.4  
beta.  
  
Gurjeet Singh, with review and editing by Kevin Grittner,  
incorporating suggested changes from Abhijit Menon-Sen and Tom  
Lane.  

M src/backend/postmaster/pgstat.c

pg_upgrade: preserve database and relation minmxid values

commit   : a61daa14d56867e90dc011bbba52ef771cea6770    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 2 Jul 2014 15:29:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 2 Jul 2014 15:29:38 -0400    

Click here for diff

Also set these values for pre-9.3 old clusters that don't have values to  
preserve.  
  
Analysis by Alvaro  
  
Backpatch through 9.3  

M contrib/pg_upgrade/pg_upgrade.c
M contrib/pg_upgrade/server.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c

Rename logical decoding's pg_llog directory to pg_logical.

commit   : a36a8fa376631e59d006772bcd30f4f827d7e6b9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 2 Jul 2014 21:07:47 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 2 Jul 2014 21:07:47 +0200    

Click here for diff

The old name wasn't very descriptive as of actual contents of the  
directory, which are historical snapshots in the snapshots/  
subdirectory and mappingdata for rewritten tuples in  
mappings/. There's been a fair amount of discussion what would be a  
good name. I'm settling for pg_logical because it's likely that  
further data around logical decoding and replication will need saving  
in the future.  
  
Also add the missing entry for the directory into storage.sgml's list  
of PGDATA contents.  
  
Bumps catversion as the data directories won't be compatible.  

M doc/src/sgml/storage.sgml
M src/backend/access/heap/rewriteheap.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h

pg_upgrade: no need to remove "members" files for pre-9.3 upgrades

commit   : 89cf2d5203085a3b74ab8ce1f323c93f8e410473    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 2 Jul 2014 13:11:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 2 Jul 2014 13:11:05 -0400    

Click here for diff

Per analysis by Alvaro  
  
Backpatch through 9.3  

M contrib/pg_upgrade/pg_upgrade.c

Add some errdetail to checkRuleResultList().

commit   : 7980ab30ecf36162699f138697e2ff5589d9063e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Jul 2014 12:31:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Jul 2014 12:31:24 -0400    

Click here for diff

This function wasn't originally thought to be really user-facing,  
because converting a table to a view isn't something we expect people  
to do manually.  So not all that much effort was spent on the error  
messages; in particular, while the code will complain that you got  
the column types wrong it won't say exactly what they are.  But since  
we repurposed the code to also check compatibility of rule RETURNING  
lists, it's definitely user-facing.  It now seems worthwhile to add  
errdetail messages showing exactly what the conflict is when there's  
a mismatch of column names or types.  This is prompted by bug #10836  
from Matthias Raffelsieper, which might have been forestalled if the  
error message had reported the wrong column type as being "record".  
  
Back-patch to 9.4, but not into older branches where the set of  
translatable error strings is supposed to be stable.  

M src/backend/rewrite/rewriteDefine.c

Prevent psql from issuing BEGIN before ALTER SYSTEM when AUTOCOMMIT is off.

commit   : d97e98e8337e915e3404f7b2a8a6b966b6f5394f    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 2 Jul 2014 12:42:20 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 2 Jul 2014 12:42:20 +0900    

Click here for diff

The autocommit-off mode works by issuing an implicit BEGIN just before  
any command that is not already in a transaction block and is not itself  
a BEGIN or other transaction-control command, nor a command that  
cannot be executed inside a transaction block. This commit prevents psql  
from issuing such an implicit BEGIN before ALTER SYSTEM because it's  
not allowed inside a transaction block.  
  
Backpatch to 9.4 where ALTER SYSTEM was added.  
  
Report by Feike Steenbergen  

M src/bin/psql/common.c

Allow CREATE/ALTER DATABASE to manipulate datistemplate and datallowconn.

commit   : fbb1d7d73f8e23a3a61e702629c53cef48cb0918    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 20:10:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 20:10:38 -0400    

Click here for diff

Historically these database properties could be manipulated only by  
manually updating pg_database, which is error-prone and only possible for  
superusers.  But there seems no good reason not to allow database owners to  
set them for their databases, so invent CREATE/ALTER DATABASE options to do  
that.  Adjust a couple of places that were doing it the hard way to use the  
commands instead.  
  
Vik Fearing, reviewed by Pavel Stehule  

M contrib/pg_upgrade/pg_upgrade.c
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/create_database.sgml
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/tab-complete.c

Refactor CREATE/ALTER DATABASE syntax so options need not be keywords.

commit   : 15c82efd6994affd1d5654d13bc8911a9faff659    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 19:02:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 19:02:21 -0400    

Click here for diff

Most of the existing option names are keywords anyway, but we can get rid  
of LC_COLLATE and LC_CTYPE as keywords known to the lexer/grammar.  This  
immediately reduces the size of the grammar tables by about 8KB, and will  
save more when we add additional CREATE/ALTER DATABASE options in future.  
  
A side effect of the implementation is that the CONNECTION LIMIT option  
can now also be spelled CONNECTION_LIMIT.  We choose not to document this,  
however.  
  
Vik Fearing, based on a suggestion by me; reviewed by Pavel Stehule  

M src/backend/commands/dbcommands.c
M src/backend/parser/gram.y
M src/include/parser/kwlist.h

Remove some useless code in the configure script.

commit   : 2e8ce9ae46d15b2bfd34c2d53193da9858d3471a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 17:51:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 17:51:53 -0400    

Click here for diff

Almost ten years ago, commit e48322a6d6cfce1ec52ab303441df329ddbc04d1 broke  
the logic in ACX_PTHREAD by looping through all the possible flags rather  
than stopping with the first one that would work.  This meant that  
$acx_pthread_ok was no longer meaningful after the loop; it would usually  
be "no", whether or not we'd found working thread flags.  The reason nobody  
noticed is that Postgres doesn't actually use any of the symbols set up  
by the code after the loop.  Rather than complicate things some more to  
make it work as designed, let's just remove all that dead code, and thereby  
save a few cycles in each configure run.  

M config/acx_pthread.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Improve handling of OOM score adjustment in sample Linux start script.

commit   : f23425fa950fec3aff458de117037c9caadbc35c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 17:23:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 17:23:16 -0400    

Click here for diff

Per a suggestion from Christoph Berg.  

M contrib/start-scripts/linux

Fix inadequately-sized output buffer in contrib/unaccent.

commit   : 5a421a47eb1fc4398f42678c09e35aa72dc7cf18    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 11:22:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Jul 2014 11:22:43 -0400    

Click here for diff

The output buffer size in unaccent_lexize() was calculated as input string  
length times pg_database_encoding_max_length(), which effectively assumes  
that replacement strings aren't more than one character.  While that was  
all that we previously documented it to support, the code actually has  
always allowed replacement strings of arbitrary length; so if you tried  
to make use of longer strings, you were at risk of buffer overrun.  To fix,  
use an expansible StringInfo buffer instead of trying to determine the  
maximum space needed a-priori.  
  
This would be a security issue if unaccent rules files could be installed  
by unprivileged users; but fortunately they can't, so in the back branches  
the problem can be labeled as improper configuration by a superuser.  
Nonetheless, a memory stomp isn't a nice way of reacting to improper  
configuration, so let's back-patch the fix.  

M contrib/unaccent/unaccent.c

Avoid copying index tuples when building an index.

commit   : 9f03ca915196dfc871804a1f8aad26207f601fd6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 1 Jul 2014 10:34:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 1 Jul 2014 10:34:42 -0400    

Click here for diff

The previous code, perhaps out of concern for avoid memory leaks, formed  
the tuple in one memory context and then copied it to another memory  
context.  However, this doesn't appear to be necessary, since  
index_form_tuple and the functions it calls take precautions against  
leaking memory.  In my testing, building the tuple directly inside the  
sort context shaves several percent off the index build time.  
Rearrange things so we do that.  
  
Patch by me.  Review by Amit Kapila, Tom Lane, Andres Freund.  

M src/backend/access/common/indextuple.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsort.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/utils/tuplesort.h

Issue a WARNING about invalid rule file format in contrib/unaccent.

commit   : 03a25cec8de3737924c9dd33bb868d4bc7a33ad5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jun 2014 22:03:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jun 2014 22:03:37 -0400    

Click here for diff

We were already issuing a WARNING, albeit only elog not ereport, for  
duplicate source strings; so warning rather than just being stoically  
silent seems like the best thing to do here.  Arguably both of these  
complaints should be upgraded to ERRORs, but that might be more  
behavioral change than people want.  
  
Note: the faulty line is already printed via an errcontext hook,  
so there's no need for more information than these messages provide.  

M contrib/unaccent/unaccent.c

Allow multi-character source strings in contrib/unaccent.

commit   : 1b2488731cc2c87cc9a4cb8d654e4d9981fdf9ac    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jun 2014 21:46:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jun 2014 21:46:29 -0400    

Click here for diff

This could be useful in languages where diacritic signs are represented as  
separate characters; more generally it supports using unaccent dictionaries  
for substring substitutions beyond narrowly conceived "diacritic removal".  
In any case, since the rule-file parser doesn't complain about  
multi-character source strings, it behooves us to do something unsurprising  
with them.  

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

Allow empty replacement strings in contrib/unaccent.

commit   : 97c40ce61465582b96944e41ed6ec06c2016b95c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jun 2014 20:51:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jun 2014 20:51:26 -0400    

Click here for diff

This is useful in languages where diacritic signs are represented as  
separate characters; it's also one step towards letting unaccent be used  
for arbitrary substring substitutions.  
  
In passing, improve the user documentation for unaccent, which was sadly  
vague about some important details.  
  
Mohammad Alhashash, reviewed by Abhijit Menon-Sen  

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

pg_upgrade: update C comments about pg_dumpall

commit   : 55863274d98556acf57013f64f545d9a1e640bba    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 30 Jun 2014 19:55:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 30 Jun 2014 19:55:55 -0400    

Click here for diff

There were some C comments that hadn't been updated from the switch of  
using only pg_dumpall to using pg_dump and pg_dumpall, so update them.  
Also, don't bother using --schema-only for pg_dumpall --globals-only.  
  
Backpatch through 9.4  

M contrib/pg_upgrade/check.c
M contrib/pg_upgrade/dump.c
M contrib/pg_upgrade/exec.c
M contrib/pg_upgrade/function.c
M contrib/pg_upgrade/info.c
M contrib/pg_upgrade/pg_upgrade.c

Don't prematurely free the BufferAccessStrategy in pgstat_heap().

commit   : 9d0826c595e2a376f6645eb575a9d81d5f5ececf    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 30 Jun 2014 16:59:19 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 30 Jun 2014 16:59:19 -0400    

Click here for diff

This function continued to use it after heap_endscan() freed it.  In  
passing, don't explicit create a strategy here.  Instead, use the one  
created by heap_beginscan_strat(), if any.  Back-patch to 9.2, where use  
of a BufferAccessStrategy here was introduced.  

M contrib/pgstattuple/pgstattuple.c

Fix typos in the cluster_name commit.

commit   : 6647f59fd256927aaf9e35929b5c284d10d18839    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 30 Jun 2014 10:48:39 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 30 Jun 2014 10:48:39 +0200    

Click here for diff

Thom Brown and Fujii Masao  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml

Check interrupts during logical decoding more frequently.

commit   : 1cbc9480106241aaa8db112331e93d0a265b6db0    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Jun 2014 17:08:04 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Jun 2014 17:08:04 +0200    

Click here for diff

When reading large amounts of preexisting WAL during logical decoding  
using the SQL interface we possibly could fail to check interrupts in  
due time. Similarly the same could happen on systems with a very high  
WAL volume while creating a new logical replication slot, independent  
of the used interface.  
  
Previously these checks where only performed in xlogreader's read_page  
callbacks, while waiting for new WAL to be produced. That's not  
sufficient though, if there's never a need to wait.  Walsender's send  
loop already contains a interrupt check.  
  
Backpatch to 9.4 where the logical decoding feature was introduced.  

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

Fix and enhance the assertion of no palloc's in a critical section.

commit   : 1c6821be31f91ab92547a8ed4246762c8cefb1b3    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 30 Jun 2014 10:13:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 30 Jun 2014 10:13:48 +0300    

Click here for diff

The assertion failed if WAL_DEBUG or LWLOCK_STATS was enabled; fix that by  
using separate memory contexts for the allocations made within those code  
blocks.  
  
This patch introduces a mechanism for marking any memory context as allowed  
in a critical section. Previously ErrorContext was exempt as a special case.  
  
Instead of a blanket exception of the checkpointer process, only exempt the  
memory context used for the pending ops hash table.  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/checkpointer.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/smgr/md.c
M src/backend/utils/mmgr/mcxt.c
M src/include/nodes/memnodes.h
M src/include/storage/lwlock.h
M src/include/utils/memutils.h

Remove use_json_as_text options from json_to_record/json_populate_record.

commit   : a749a23d7af4dba9b3468076ec561d2cbf69af09    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Jun 2014 13:50:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Jun 2014 13:50:58 -0400    

Click here for diff

The "false" case was really quite useless since all it did was to throw  
an error; a definition not helped in the least by making it the default.  
Instead let's just have the "true" case, which emits nested objects and  
arrays in JSON syntax.  We might later want to provide the ability to  
emit sub-objects in Postgres record or array syntax, but we'd be best off  
to drive that off a check of the target field datatype, not a separate  
argument.  
  
For the functions newly added in 9.4, we can just remove the flag arguments  
outright.  We can't do that for json_populate_record[set], which already  
existed in 9.3, but we can ignore the argument and always behave as if it  
were "true".  It helps that the flag arguments were optional and not  
documented in any useful fashion anyway.  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonb_1.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Add cluster_name GUC which is included in process titles if set.

commit   : 51adcaa0df81da5e94b582d47de64ebb17129937    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Jun 2014 14:15:09 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Jun 2014 14:15:09 +0200    

Click here for diff

When running several postgres clusters on one OS instance it's often  
inconveniently hard to identify which "postgres" process belongs to  
which postgres instance.  
  
Add the cluster_name GUC, whose value will be included as part of the  
process titles if set. With that processes can more easily identified  
using tools like 'ps'.  
  
To avoid problems with encoding mismatches between postgresql.conf,  
consoles, and individual databases replace non-ASCII chars in the name  
with question marks. The length is limited to NAMEDATALEN to make it  
less likely to truncate important information at the end of the  
status.  
  
Thomas Munro, with some adjustments by me and review by a host of people.  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/misc/ps_status.c
M src/include/utils/guc.h

Remove Alpha and Tru64 support.

commit   : a6d488cb538c8761658f0f7edfc40cecc8c29f2d    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 28 Jun 2014 21:40:40 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 28 Jun 2014 21:40:40 +0200    

Click here for diff

Support for running postgres on Alpha hasn't been tested for a long  
while. Due to Alpha's uniquely lax cache coherency model it's a hard  
to develop for platform (especially blindly!) and thought to be  
unlikely to currently work correctly.  
  
As Alpha is the only supported architecture for Tru64 drop support for  
it as well. Tru64's support has ended 2012 and it has been in  
maintenance-only mode for much longer.  
  
Also remove stray references to __ksr__ and ultrix defines.  

M configure
M configure.in
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/installation.sgml
M src/Makefile.shlib
M src/backend/main/main.c
D src/backend/port/dynloader/osf.c
D src/backend/port/dynloader/osf.h
M src/backend/utils/misc/ps_status.c
D src/include/port/osf.h
M src/include/storage/barrier.h
M src/include/storage/s_lock.h
D src/makefiles/Makefile.osf
D src/template/osf

Allow pushdown of WHERE quals into subqueries with window functions.

commit   : d222585a9f7a18f2d793785c82be4c877b90c461    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Jun 2014 23:08:08 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Jun 2014 23:08:08 -0700    

Click here for diff

We can allow this even without any specific knowledge of the semantics  
of the window function, so long as pushed-down quals will either accept  
every row in a given window partition, or reject every such row.  Because  
window functions act only within a partition, such a case can't result  
in changing the window functions' outputs for any surviving row.  
Eliminating entire partitions in this way obviously can reduce the cost  
of the window-function computations substantially.  
  
The fly in the ointment is that it's hard to be entirely sure whether  
this is true for an arbitrary qual condition.  This patch allows pushdown  
if (a) the qual references only partitioning columns, and (b) the qual  
contains no volatile functions.  We are at risk of incorrect results if  
the qual can produce different answers for values that the partitioning  
equality operator sees as equal.  While it's not hard to invent cases  
for which that can happen, it seems to seldom be a problem in practice,  
since no one has complained about a similar assumption that we've had  
for many years with respect to DISTINCT.  The potential performance  
gains seem to be worth the risk.  
  
David Rowley, reviewed by Vik Fearing; some credit is due also to  
Thomas Mayer who did considerable preliminary investigation.  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Have multixact be truncated by checkpoint, not vacuum

commit   : f741300c90141ee274f19a13629ae03a9806b598    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jun 2014 14:43:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jun 2014 14:43:53 -0400    

Click here for diff

Instead of truncating pg_multixact at vacuum time, do it only at  
checkpoint time.  The reason for doing it this way is twofold: first, we  
want it to delete only segments that we're certain will not be required  
if there's a crash immediately after the removal; and second, we want to  
do it relatively often so that older files are not left behind if  
there's an untimely crash.  
  
Per my proposal in  
http://www.postgresql.org/message-id/[email protected]  
we now execute the truncation in the checkpointer process rather than as  
part of vacuum.  Vacuum is in only charge of maintaining in shared  
memory the value to which it's possible to truncate the files; that  
value is stored as part of checkpoints also, and so upon recovery we can  
reuse the same value to re-execute truncate and reset the  
oldest-value-still-safe-to-use to one known to remain after truncation.  
  
Per bug reported by Jeff Janes in the course of his tests involving  
bug #8673.  
  
While at it, update some comments that hadn't been updated since  
multixacts were changed.  
  
Backpatch to 9.3, where persistency of pg_multixact files was  
introduced by commit 0ac5ad5134f2.  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/include/access/multixact.h

Don't allow relminmxid to go backwards during VACUUM FULL

commit   : b7e51d9c06e6a0da50abbbd0603ecb80f0b6f02b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jun 2014 14:43:46 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jun 2014 14:43:46 -0400    

Click here for diff

We were allowing a table's pg_class.relminmxid value to move backwards  
when heaps were swapped by VACUUM FULL or CLUSTER.  There is a  
similar protection against relfrozenxid going backwards, which we  
neglected to clone when the multixact stuff was rejiggered by commit  
0ac5ad5134f276.  
  
Backpatch to 9.3, where relminmxid was introduced.  
  
As reported by Heikki in  
http://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/cluster.c

Fix broken Assert() introduced by 8e9a16ab8f7f0e58

commit   : b2770576486265c2ce35b64e875028672a3bb7b5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jun 2014 14:43:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jun 2014 14:43:39 -0400    

Click here for diff

Don't assert MultiXactIdIsRunning if the multi came from a tuple that  
had been share-locked and later copied over to the new cluster by  
pg_upgrade.  Doing that causes an error to be raised unnecessarily:  
MultiXactIdIsRunning is not open to the possibility that its argument  
came from a pg_upgraded tuple, and all its other callers are already  
checking; but such multis cannot, obviously, have transactions still  
running, so the assert is pointless.  
  
Noticed while investigating the bogus pg_multixact/offsets/0000 file  
left over by pg_upgrade, as reported by Andres Freund in  
http://www.postgresql.org/message-id/[email protected]  
  
Backpatch to 9.3, as the commit that introduced the buglet.  

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

Disallow pushing volatile qual expressions down into DISTINCT subqueries.

commit   : 1147035203a47a424b2399fc74829d097b7061e4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Jun 2014 11:08:48 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Jun 2014 11:08:48 -0700    

Click here for diff

A WHERE clause applied to the output of a subquery with DISTINCT should  
theoretically be applied only once per distinct row; but if we push it  
into the subquery then it will be evaluated at each row before duplicate  
elimination occurs.  If the qual is volatile this can give rise to  
observably wrong results, so don't do that.  
  
While at it, refactor a little bit to allow subquery_is_pushdown_safe  
to report more than one kind of restrictive condition without indefinitely  
expanding its argument list.  
  
Although this is a bug fix, it seems unwise to back-patch it into released  
branches, since it might de-optimize plans for queries that aren't giving  
any trouble in practice.  So apply to 9.4 but not further back.  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Get rid of bogus separate pg_proc entries for json_extract_path operators.

commit   : f71136eeeb5c6a234e19a245db7ae1484fc7bf4f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jun 2014 16:22:15 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jun 2014 16:22:15 -0700    

Click here for diff

These should not have existed to begin with, but there was apparently some  
misunderstanding of the purpose of the opr_sanity regression test item  
that checks for operator implementation functions with their own comments.  
The idea there is to check for unintentional violations of the rule that  
operator implementation functions shouldn't be documented separately  
.... but for these functions, that is in fact what we want, since the  
variadic option is useful and not accessible via the operator syntax.  
Get rid of the extra pg_proc entries and fix the regression test and  
documentation to be explicit about what we're doing here.  

M doc/src/sgml/func.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/test/regress/expected/opr_sanity.out

Forward-patch regression test for "could not find pathkey item to sort".

commit   : 344eed91e9d5bfea698b30351abde69ea4e893a8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jun 2014 10:40:50 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jun 2014 10:40:50 -0700    

Click here for diff

Commit a87c729153e372f3731689a7be007bc2b53f1410 already fixed the bug this  
is checking for, but the regression test case it added didn't cover this  
scenario.  Since we managed to miss the fact that there was a bug at all,  
it seems like a good idea to propagate the extra test case forward to HEAD.  

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

Remove obsolete example of CSV log file name from log_filename document.

commit   : de42ed401a9622917b09f549d80946dda35c5f3f    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 26 Jun 2014 14:27:27 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 26 Jun 2014 14:27:27 +0900    

Click here for diff

7380b63 changed log_filename so that epoch was not appended to it  
when no format specifier is given. But the example of CSV log file name  
with epoch still left in log_filename document. This commit removes  
such obsolete example.  
  
This commit also documents the defaults of log_directory and  
log_filename.  
  
Backpatch to all supported versions.  
  
Christoph Berg  

M doc/src/sgml/config.sgml

Rationalize error messages within jsonfuncs.c.

commit   : 798e2357905f759913166d4f5be249e76a84c662    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jun 2014 15:25:22 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jun 2014 15:25:22 -0700    

Click here for diff

I noticed that the functions in jsonfuncs.c sometimes printed error  
messages that claimed I'd called some other function.  Investigation showed  
that this was from repurposing code into "worker" functions without taking  
much care as to whether it would mention the right SQL-level function if it  
threw an error.  Moreover, there was a weird mismash of messages that  
contained a fixed function name, messages that used %s for a function name,  
and messages that constructed a function name out of spare parts, like  
"json%s_populate_record" (which, quite aside from being ugly as sin, wasn't  
even sufficient to cover all the cases).  This would put an undue burden on  
our long-suffering translators.  Standardize on inserting the SQL function  
name with %s so as to reduce the number of translatable strings, and pass  
function names around as needed to make sure we can report the right one.  
Fix up some gratuitous variations in wording, too.  

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

Cosmetic improvements in jsonfuncs.c.

commit   : 8d2d7ad5aba6fdabd58a2a829038596f48cae723    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jun 2014 11:22:18 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jun 2014 11:22:18 -0700    

Click here for diff

Re-pgindent, remove a lot of random vertical whitespace, remove useless  
(if not counterproductive) inline markings, get rid of unnecessary  
zero-padding of strings for hashtable searches.  No functional changes.  

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

Fix handling of nested JSON objects in json_populate_recordset and friends.

commit   : 57d8c1270e1538d1f02e4fa1cdb1d8ded82f7c70    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Jun 2014 21:22:40 -0700    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Jun 2014 21:22:40 -0700    

Click here for diff

populate_recordset_object_start() improperly created a new hash table  
(overwriting the link to the existing one) if called at nest levels  
greater than one.  This resulted in previous fields not appearing in  
the final output, as reported by Matti Hameister in bug #10728.  
In 9.4 the problem also affects json_to_recordset.  
  
This perhaps missed detection earlier because the default behavior is to  
throw an error for nested objects: you have to pass use_json_as_text = true  
to see the problem.  
  
In addition, fix query-lifespan leakage of the hashtable created by  
json_populate_record().  This is pretty much the same problem recently  
fixed in dblink: creating an intended-to-be-temporary context underneath  
the executor's per-tuple context isn't enough to make it go away at the  
end of the tuple cycle, because MemoryContextReset is not  
MemoryContextResetAndDeleteChildren.  
  
Michael Paquier and Tom Lane  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/json_1.out
M src/test/regress/sql/json.sql

pg_upgrade: remove pg_multixact files left by initdb

commit   : 0f7482733a90a2e0d8917a41d823306975f291ee    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 Jun 2014 16:11:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 Jun 2014 16:11:06 -0400    

Click here for diff

This fixes a bug that caused vacuum to fail when the '0000' files left  
by initdb were accessed as part of vacuum's cleanup of old pg_multixact  
files.  
  
Backpatch through 9.3  

M contrib/pg_upgrade/pg_upgrade.c

Don't allow foreign tables with OIDs.

commit   : a87a7dc8b64a99e5e497591dddb37b3ecdfae2eb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 24 Jun 2014 12:31:36 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 24 Jun 2014 12:31:36 +0300    

Click here for diff

The syntax doesn't let you specify "WITH OIDS" for foreign tables, but it  
was still possible with default_with_oids=true. But the rest of the system,  
including pg_dump, isn't prepared to handle foreign tables with OIDs  
properly.  
  
Backpatch down to 9.1, where foreign tables were introduced. It's possible  
that there are databases out there that already have foreign tables with  
OIDs. There isn't much we can do about that, but at least we can prevent  
them from being created in the future.  
  
Patch by Etsuro Fujita, reviewed by Hadi Moshayedi.  

M src/backend/commands/tablecmds.c

Check for interrupts during tuple-insertion loops.

commit   : c922353b1c7e7fe5fa506664ccf0c87a0abfdda2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 23 Jun 2014 21:45:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 23 Jun 2014 21:45:21 -0400    

Click here for diff

Normally, this won't matter too much; but if I/O is really slow, for  
example because the system is overloaded, we might write many pages  
before checking for interrupts.  A single toast insertion might  
write up to 1GB of data, and a multi-insert could write hundreds  
of tuples (and their corresponding TOAST data).  

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

Improve tab-completion of DROP and ALTER ENABLE/DISABLE on triggers and rules.

commit   : 631e7f6b4e0629077408d3f8caf282627765f3f0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Jun 2014 23:47:39 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Jun 2014 23:47:39 +0300    

Click here for diff

At "DROP RULE/TRIGGER triggername ON ...", tab-complete tables that have  
a rule/trigger with that name.  
  
At "ALTER TABLE tablename ENABLE/DISABLE TRIGGER/RULE ...", tab-complete to  
rules/triggers on that table. Previously, we would tab-complete to all  
rules or triggers, not just those that are on that table.  
  
Also, filter out internal RI triggers from the list. You can't DROP them,  
and enabling/disabling them is such a rare (and dangerous) operation that  
it seems better to hide them.  
  
Andreas Karlsson, reviewed by Ian Barwick.  

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

Fix typo in replication slot function doc.

commit   : f8ad8bd47306d4c34ab8f7cc6f38225b12f18a3c    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Jun 2014 03:51:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Jun 2014 03:51:51 +0900    

Click here for diff

M doc/src/sgml/func.sgml

Add missing closing parenthesis into max_replication_slots doc.

commit   : 394e05996fbb0621cf51c9d99891ca99b0eb2ff2    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Jun 2014 03:25:01 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Jun 2014 03:25:01 +0900    

Click here for diff

M doc/src/sgml/config.sgml

Fix bug in WAL_DEBUG.

commit   : 85ba0748ed5aa069643887af84fc28c380b1e815    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Jun 2014 12:22:36 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Jun 2014 12:22:36 +0300    

Click here for diff

The record header was not copied correctly to the buffer that was passed  
to the rm_desc function. Broken by my rm_desc signature refactoring patch.  

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

doc: adjust JSONB GIN index description

commit   : 884dede37a056622510d6b2768abefb5ef981699    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Jun 2014 15:33:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Jun 2014 15:33:23 -0400    

Click here for diff

Backpatch through 9.4  

M doc/src/sgml/json.sgml

9.4 release notes: adjust some entry wording

commit   : a52f2a0b9cf6767d8c82bbc63725657bd84571d8    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Jun 2014 10:56:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Jun 2014 10:56:38 -0400    

Click here for diff

Backpatch to 9.4  

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

Fix documentation template for CREATE TRIGGER.

commit   : 734bea8a69db9ffd675a697f614e80baeb2ca854    
  
author   : Kevin Grittner <[email protected]>    
date     : Sat, 21 Jun 2014 09:17:04 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Sat, 21 Jun 2014 09:17:04 -0500    

Click here for diff

By using curly braces, the template had specified that one of  
"NOT DEFERRABLE", "INITIALLY IMMEDIATE", or "INITIALLY DEFERRED"  
was required on any CREATE TRIGGER statement, which is not  
accurate.  Change to square brackets makes that optional.  
  
Backpatch to 9.1, where the error was introduced.  

M doc/src/sgml/ref/create_trigger.sgml

Add Asserts to verify that catalog cache keys are unique and not null.

commit   : 8b38a538c0aa5a432dacd90f10805dc667a3d1a0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Jun 2014 18:20:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Jun 2014 18:20:56 -0400    

Click here for diff

The catcache code is effectively assuming this already, so let's insist  
that the catalog and index are actually declared that way.  
  
Having done that, the comments in indexing.h about non-unique indexes  
not being used for catcaches are completely redundant not just mostly so;  
and we didn't have such a comment for every such index anyway.  So let's  
get rid of them.  
  
Per discussion of whether we should identify primary keys for catalogs.  
We might or might not take that further step, but this change in itself  
will allow quicker detection of misdeclared catcaches, so it seems worth  
doing in any case.  

M src/backend/utils/cache/catcache.c
M src/include/catalog/indexing.h

Clean up data conversion short-lived memory context.

commit   : 1dde5782e34a1c5ef2ce9d97cf18007fed5fde92    
  
author   : Joe Conway <[email protected]>    
date     : Fri, 20 Jun 2014 12:22:13 -0700    
  
committer: Joe Conway <[email protected]>    
date     : Fri, 20 Jun 2014 12:22:13 -0700    

Click here for diff

dblink uses a short-lived data conversion memory context. However it  
was not deleted when no longer needed, leading to a noticeable memory  
leak under some circumstances. Plug the hole, along with minor  
refactoring. Backpatch to 9.2 where the leak was introduced.  
  
Report and initial patch by MauMau. Reviewed/modified slightly by  
Tom Lane and me.  

M contrib/dblink/dblink.c

Do all-visible handling in lazy_vacuum_page() outside its critical section.

commit   : ecac0e2b9e8e8e78d771b20fe441e95bb02db2fa    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Jun 2014 11:06:42 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Jun 2014 11:06:42 +0200    

Click here for diff

Since fdf9e21196a lazy_vacuum_page() rechecks the all-visible status  
of pages in the second pass over the heap. It does so inside a  
critical section, but both visibilitymap_test() and  
heap_page_is_all_visible() perform operations that should not happen  
inside one. The former potentially performs IO and both potentially do  
memory allocations.  
  
To fix, simply move all the all-visible handling outside the critical  
section. Doing so means that the PD_ALL_VISIBLE on the page won't be  
included in the full page image of the HEAP2_CLEAN record anymore. But  
that's fine, the flag will be set by the HEAP2_VISIBLE logged later.  
  
Backpatch to 9.3 where the problem was introduced. The bug only came  
to light due to the assertion added in 4a170ee9 and isn't likely to  
cause problems in production scenarios. The worst outcome is a  
avoidable PANIC restart.  
  
This also gets rid of the difference in the order of operations  
between master and standby mentioned in 2a8e1ac5.  
  
Per reports from David Leverton and Keith Fiske in bug #10533.  

M src/backend/commands/vacuumlazy.c

Don't allow to disable backend assertions via the debug_assertions GUC.

commit   : 3bdcf6a5a7555035810e2ba2b8a0fb04dc5c66b8    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Jun 2014 11:06:42 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Jun 2014 11:06:42 +0200    

Click here for diff

The existance of the assert_enabled variable (backing the  
debug_assertions GUC) reduced the amount of knowledge some static code  
checkers (like coverity and various compilers) could infer from the  
existance of the assertion. That could have been solved by optionally  
removing the assertion_enabled variable from the Assert() et al macros  
at compile time when some special macro is defined, but the resulting  
complication doesn't seem to be worth the gain from having  
debug_assertions. Recompiling is fast enough.  
  
The debug_assertions GUC is still available, but readonly, as it's  
useful when diagnosing problems. The commandline/client startup option  
-A, which previously also allowed to enable/disable assertions, has  
been removed as it doesn't serve a purpose anymore.  
  
While at it, reduce code duplication in bufmgr.c and localbuf.c  
assertions checking for spurious buffer pins. That code had to be  
reindented anyway to cope with the assert_enabled removal.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M src/backend/access/gin/ginpostinglist.c
M src/backend/commands/event_trigger.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/misc/guc.c
M src/include/c.h
M src/include/postgres.h

Avoid leaking memory while evaluating arguments for a table function.

commit   : 45b0f357235236dd3198f8abcca277adc0d7459a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jun 2014 22:13:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jun 2014 22:13:41 -0400    

Click here for diff

ExecMakeTableFunctionResult evaluated the arguments for a function-in-FROM  
in the query-lifespan memory context.  This is insignificant in simple  
cases where the function relation is scanned only once; but if the function  
is in a sub-SELECT or is on the inside of a nested loop, any memory  
consumed during argument evaluation can add up quickly.  (The potential for  
trouble here had been foreseen long ago, per existing comments; but we'd  
not previously seen a complaint from the field about it.)  To fix, create  
an additional temporary context just for this purpose.  
  
Per an example from MauMau.  Back-patch to all active branches.  

M src/backend/executor/execQual.c
M src/backend/executor/nodeFunctionscan.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Fix contrib/pg_upgrade/test.sh for $PWD containing spaces.

commit   : 686f362bee126e50280bcd3b35807b02f18a8966    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 19 Jun 2014 21:47:08 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 19 Jun 2014 21:47:08 -0400    

Click here for diff

Most of the necessary quoting was in place; this catches the exceptions.  

M contrib/pg_upgrade/test.sh

Let installcheck-world pass against a server requiring a password.

commit   : c82725edfa1aec1cad940b15b6e22ee3dbd57f20    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 19 Jun 2014 21:41:26 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 19 Jun 2014 21:41:26 -0400    

Click here for diff

Give passwords to each user created in support of an ECPG connection  
test case.  Use SET SESSION AUTHORIZATION, not a fresh connection, to  
reduce privileges during a dblink test case.  
  
To test against such a server, both the "make installcheck-world"  
environment and the postmaster environment must provide the default  
user's password; $PGPASSFILE is the principal way to do so.  (The  
postmaster environment needs it for dblink and postgres_fdw tests.)  

M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/connect-test5.c
M src/interfaces/ecpg/test/expected/connect-test5.stderr

Document SQL functions' behavior of parsing the whole function at once.

commit   : f28d9b10f73440adcb2e094440b4b213673e491b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jun 2014 12:33:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jun 2014 12:33:56 -0400    

Click here for diff

Haribabu Kommi, somewhat rewritten by me  

M doc/src/sgml/xfunc.sgml

Fix calculation of PREDICATELOCK_MANAGER_LWLOCK_OFFSET.

commit   : bfaa8c665fcbd4388e01c53c4b5137f1f53d1787    
  
author   : Kevin Grittner <[email protected]>    
date     : Thu, 19 Jun 2014 08:40:37 -0500    
  
committer: Kevin Grittner <[email protected]>    
date     : Thu, 19 Jun 2014 08:40:37 -0500    

Click here for diff

Commit ea9df812d8502fff74e7bc37d61bdc7d66d77a7f failed to include  
NUM_BUFFER_PARTITIONS in this offset, resulting in a bad offset.  
Ultimately this threw off NUM_FIXED_LWLOCKS which is based on  
earlier offsets, leading to memory allocation problems.  It seems  
likely to have also caused increased LWLOCK contention when  
serializable transactions were used, because lightweight locks used  
for that overlapped others.  
  
Reported by Amit Kapila with analysis and fix.  
Backpatch to 9.4, where the bug was introduced.  

M src/include/storage/lwlock.h

Don't allow data_directory to be set in postgresql.auto.conf by ALTER SYSTEM.

commit   : 9ba78fb0b9e6c5a7115592c2c3116fca16b5184e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 19 Jun 2014 20:31:20 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 19 Jun 2014 20:31:20 +0900    

Click here for diff

data_directory could be set both in postgresql.conf and postgresql.auto.conf so far.  
This could cause some problematic situations like circular definition. To avoid such  
situations, this commit forbids a user to set data_directory in postgresql.auto.conf.  
  
Backpatch this to 9.4 where ALTER SYSTEM command was introduced.  
  
Amit Kapila, reviewed by Abhijit Menon-Sen, with minor adjustments by me.  

M doc/src/sgml/ref/alter_system.sgml
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Improve our mechanism for controlling the Linux out-of-memory killer.

commit   : df8b7bc9ffff5b00aacff774600b569992cddeb8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jun 2014 20:12:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jun 2014 20:12:47 -0400    

Click here for diff

Arrange for postmaster child processes to respond to two environment  
variables, PG_OOM_ADJUST_FILE and PG_OOM_ADJUST_VALUE, to determine whether  
they reset their OOM score adjustments and if so to what.  This is superior  
to the previous design involving #ifdef's in several ways.  The behavior is  
now available in a default build, and both ends of the adjustment --- the  
original adjustment of the postmaster's level and the subsequent  
readjustment by child processes --- can now be controlled in one place,  
namely the postmaster launch script.  So it's no longer necessary for the  
launch script to act on faith that the server was compiled with the  
appropriate options.  In addition, if someone wants to use an OOM score  
other than zero for the child processes, that doesn't take a recompile  
anymore; and we no longer have to cater separately to the two different  
historical kernel APIs for this adjustment.  
  
Gurjeet Singh, somewhat revised by me  

M contrib/start-scripts/linux
M doc/src/sgml/runtime.sgml
M src/backend/postmaster/fork_process.c

Remove unnecessary check for jbvBinary in convertJsonbValue.

commit   : 960661980beb50c5d21e4b2855ae109e9a130326    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 18 Jun 2014 19:28:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 18 Jun 2014 19:28:20 -0400    

Click here for diff

The check was confusing and is a condition that should never in fact  
happen.  
  
Per gripe from Dmitry Dolgov.  

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

Fix weird spacing in error message.

commit   : 66802246e22d51858cd543877fcfddf24e6812f2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jun 2014 15:44:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jun 2014 15:44:15 -0400    

Click here for diff

Seems to have been introduced in 1a3458b6d8d202715a83c88474a1b63726d0929e.  

M src/backend/port/sysv_shmem.c

Document that jsonb has all the standard comparison operators.

commit   : d2a986b74afffbdc3f59258c3dd96d3dc9a238ce    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 18 Jun 2014 15:16:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 18 Jun 2014 15:16:48 -0400    

Click here for diff

M doc/src/sgml/func.sgml

Implement UPDATE tab SET (col1,col2,...) = (SELECT ...), ...

commit   : 8f889b1083f38f4f5b3bd3512008a3f60e939244    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jun 2014 13:22:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jun 2014 13:22:25 -0400    

Click here for diff

This SQL-standard feature allows a sub-SELECT yielding multiple columns  
(but only one row) to be used to compute the new values of several columns  
to be updated.  While the same results can be had with an independent  
sub-SELECT per column, such a workaround can require a great deal of  
duplicated computation.  
  
The standard actually says that the source for a multi-column assignment  
could be any row-valued expression.  The implementation used here is  
tightly tied to our existing sub-SELECT support and can't handle other  
cases; the Bison grammar would have some issues with them too.  However,  
I don't feel too bad about this since other cases can be converted into  
sub-SELECTs.  For instance, "SET (a,b,c) = row_valued_function(x)" could  
be written "SET (a,b,c) = (SELECT * FROM row_valued_function(x))".  

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/rules.sgml
M src/backend/executor/nodeSubplan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/list.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.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/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/primnodes.h
M src/include/nodes/relation.h
M src/include/optimizer/tlist.h
M src/include/parser/parse_node.h
M src/test/regress/expected/update.out
M src/test/regress/sql/update.sql

Fix the MSVC build process for uuid-ossp.

commit   : 230ba02d855de7fac31bfb6af25ebd4ae052640b    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 18 Jun 2014 09:21:50 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 18 Jun 2014 09:21:50 -0400    

Click here for diff

Catch up with commit b8cc8f94730610c0189aa82dfec4ae6ce9b13e34's  
introduction of the HAVE_UUID_OSSP symbol to the principal build  
process.  Back-patch to 9.4, where that commit appeared.  

M src/tools/msvc/Solution.pm

9.4 release notes: improve valgrind mention

commit   : 4cd3b1cbbd7db10600031db5485eab373b76e29a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 17 Jun 2014 11:28:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 17 Jun 2014 11:28:34 -0400    

Click here for diff

Report by Peter Geoghegan  

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

Revert accidental change of WAL_DEBUG default.

commit   : b29e7151434b4403d70fd35da25cec585fbd3114    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Jun 2014 08:49:20 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Jun 2014 08:49:20 +0300    

Click here for diff

Oops.  

M src/include/pg_config_manual.h

Avoid recursion when processing simple lists of AND'ed or OR'ed clauses.

commit   : 2146f13408cdb85c738364fe8f7965209e08c6be    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Jun 2014 15:55:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Jun 2014 15:55:05 -0400    

Click here for diff

Since most of the system thinks AND and OR are N-argument expressions  
anyway, let's have the grammar generate a representation of that form when  
dealing with input like "x AND y AND z AND ...", rather than generating  
a deeply-nested binary tree that just has to be flattened later by the  
planner.  This avoids stack overflow in parse analysis when dealing with  
queries having more than a few thousand such clauses; and in any case it  
removes some rather unsightly inconsistencies, since some parts of parse  
analysis were generating N-argument ANDs/ORs already.  
  
It's still possible to get a stack overflow with weirdly parenthesized  
input, such as "x AND (y AND (z AND ( ... )))", but such cases are not  
mainstream usage.  The maximum depth of parenthesization is already  
limited by Bison's stack in such cases, anyway, so that the limit is  
probably fairly platform-independent.  
  
Patch originally by Gurjeet Singh, heavily revised by me  

M contrib/postgres_fdw/deparse.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/test/regress/expected/rules.out

Use type pgsocket for Windows pipe emulation socket calls

commit   : ac608fe758455804f26179ea7c556e7752e453e8    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 16 Jun 2014 15:24:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 16 Jun 2014 15:24:38 -0400    

Click here for diff

This prevents several compiler warnings on Windows.  

M src/bin/pg_dump/parallel.c

Secure Unix-domain sockets of "make check" temporary clusters.

commit   : be76a6d39e2832d4b88c0e1cc381aa44a7f86881    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 14 Jun 2014 09:41:13 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 14 Jun 2014 09:41:13 -0400    

Click here for diff

Any OS user able to access the socket can connect as the bootstrap  
superuser and proceed to execute arbitrary code as the OS user running  
the test.  Protect against that by placing the socket in a temporary,  
mode-0700 subdirectory of /tmp.  The pg_regress-based test suites and  
the pg_upgrade test suite were vulnerable; the $(prove_check)-based test  
suites were already secure.  Back-patch to 8.4 (all supported versions).  
The hazard remains wherever the temporary cluster accepts TCP  
connections, notably on Windows.  
  
As a convenient side effect, this lets testing proceed smoothly in  
builds that override DEFAULT_PGSOCKET_DIR.  Popular non-default values  
like /var/run/postgresql are often unwritable to the build user.  
  
Security: CVE-2014-0067  

M contrib/pg_upgrade/test.sh
M doc/src/sgml/regress.sgml
M src/test/regress/pg_regress.c

Add mkdtemp() to libpgport.

commit   : 9e6b1bf258170e62dac555fc82ff0536dfe01d29    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 14 Jun 2014 09:41:13 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 14 Jun 2014 09:41:13 -0400    

Click here for diff

This function is pervasive on free software operating systems; import  
NetBSD's implementation.  Back-patch to 8.4, like the commit that will  
harness it.  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
A src/port/mkdtemp.c
M src/tools/msvc/Mkvcbuild.pm

Change the signature of rm_desc so that it's passed a XLogRecord.

commit   : 0ef0b6784c7d7258cae314cb46558873edaf9c0a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 14 Jun 2014 10:46:48 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 14 Jun 2014 10:46:48 +0300    

Click here for diff

Just feels more natural, and is more consistent with rm_redo.  

M contrib/pg_xlogdump/pg_xlogdump.c
M contrib/pg_xlogdump/rmgrdesc.h
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/dbasedesc.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/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.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/transam/xlog.c
M src/include/access/clog.h
M src/include/access/gin.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/heapam_xlog.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/spgist.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/storage_xlog.h
M src/include/commands/dbcommands.h
M src/include/commands/sequence.h
M src/include/commands/tablespace.h
M src/include/pg_config_manual.h
M src/include/storage/standby.h
M src/include/utils/relmapper.h

Harden pg_filenode_relation test against concurrent DROP TABLE.

commit   : f3fdd257a430ff581090740570af9f266bb893e3    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Jun 2014 19:57:59 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Jun 2014 19:57:59 -0400    

Click here for diff

Per buildfarm member prairiedog.  Back-patch to 9.4, where the test was  
introduced.  
  
Reviewed by Tom Lane.  

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

Adjust 9.4 release notes.

commit   : a7205d81573cb0c979f2d463a1d9edb6f97c94aa    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Jun 2014 19:57:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Jun 2014 19:57:41 -0400    

Click here for diff

Back-patch to 9.4.  

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

emacs.samples: Reliably override ".dir-locals.el".

commit   : 81300ea4443766aad2631fad8d02d09dd66954a2    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Jun 2014 19:57:18 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Jun 2014 19:57:18 -0400    

Click here for diff

Back-patch to 9.4, where .dir-locals.el was introduced.  

M src/tools/editors/emacs.samples

Improve predtest.c's ability to reason about operator expressions.

commit   : 3f8c23c4d31d4a0e801041733deb2c7cfa577b32    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jun 2014 00:02:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jun 2014 00:02:56 -0400    

Click here for diff

We have for a long time been able to prove implications and refutations  
between clauses structured like "expr op const" with the same subexpression  
and btree-related operators; for example that "x < 4" implies "x <= 5".  
The implication machinery is needed to detect usability of partial indexes,  
and the refutation machinery is needed to implement constraint exclusion.  
  
This patch extends that machinery to make proofs for operator expressions  
involving the same two immutable-but-not-necessarily-just-Const input  
expressions, ie does "expr1 op1 expr2" prove or refute "expr1 op2 expr2" or  
"expr2 op2 expr1"?  An important example is that we can now prove "x = y"  
given "y = x", which formerly the code could not deduce unless x or y was a  
constant.  We can make use of the system's knowledge of operator commutator  
and negator pairs, and can also make use of btree opclass relationships,  
for example "x < y" implies "x <= y" and refutes "x > y" (notice that  
neither of these could be proven just from commutator or negator links).  
  
Inspired by a gripe from Brian Dunavant.  This seems more like a new  
feature than a bug fix, though, so no back-patch.  

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

Fix pg_restore's processing of old-style BLOB COMMENTS data.

commit   : c81e63d85f0c2c39d3fdfd8b95fc1ead6fdcb89f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 20:14:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 20:14:32 -0400    

Click here for diff

Prior to 9.0, pg_dump handled comments on large objects by dumping a bunch  
of COMMENT commands into a single BLOB COMMENTS archive object.  With  
sufficiently many such comments, some of the commands would likely get  
split across bufferloads when restoring, causing failures in  
direct-to-database restores (though no problem would be evident in text  
output).  This is the same type of issue we have with table data dumped as  
INSERT commands, and it can be fixed in the same way, by using a mini SQL  
lexer to figure out where the command boundaries are.  Fortunately, the  
COMMENT commands are no more complex to lex than INSERTs, so we can just  
re-use the existing lexer for INSERTs.  
  
Per bug #10611 from Jacek Zalewski.  Back-patch to all active branches.  

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

Improve tuplestore's error messages for I/O failures.

commit   : 6554656ea2043c5bb877b427237dc5ddd7c5e5c8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 18:59:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 18:59:06 -0400    

Click here for diff

We should report the errno when we get a failure from functions like  
BufFileWrite.  "ERROR: write failed" is unreasonably taciturn for a  
case that's well within the realm of possibility; I've seen it a  
couple times in the buildfarm recently, in situations that were  
probably out-of-disk-space, but it'd be good to see the errno  
to confirm it.  
  
I think this code was originally written without assuming that  
the buffile.c functions would return useful errno; but most other  
callers *are* assuming that, and a quick look at the buffile code  
gives no reason to suppose otherwise.  
  
Also, a couple of the old messages were phrased on the assumption  
that a short read might indicate a logic bug in tuplestore itself;  
but that code's pretty well tested by now, so a filesystem-level  
problem seems much more likely.  

M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplestore.c

Adjust largeobject regression test to leave a couple of LOs behind.

commit   : 70ad7ed4e88d9de3273f2f875cfaa044a35dfa97    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 17:51:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 17:51:47 -0400    

Click here for diff

Since we commonly test pg_dump/pg_restore by seeing whether they can dump  
and restore the regression test database, it behooves us to include some  
large objects in that test scenario.  
  
I tried to include a comment on one of these large objects to improve  
the test scenario further ... but it turns out that pg_upgrade fails to  
preserve comments on large objects, and its regression test notices  
the discrepancy.  So uncommenting that COMMENT is a TODO for later.  

M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source

Preserve exposed type of subquery outputs when substituting NULLs.

commit   : 9d4444a6fc011b7e2ca16386cf9f1c9f25c114e5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 17:11:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 17:11:53 -0400    

Click here for diff

I thought I could get away with hardcoded int4 here, but the buildfarm  
says differently.  

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

commit   : d2783bee3045d6190dcff0ccf985c4e60a660f99    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 16:51:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 16:51:02 -0400    

Click here for diff

Robert Frost is no longer with us, but his copyrights still are, so  
let's stop using "Stopping by Woods on a Snowy Evening" as test data  
before somebody decides to sue us.  Wordsworth is more safely dead.  

M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source

Add regression test to prevent future breakage of legacy query in libpq.

commit   : 2dd352d4b01648cac0354c754d9617b2e61f065d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 15:54:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 15:54:13 -0400    

Click here for diff

Memorialize the expected output of the query that libpq has been using for  
many years to get the OIDs of large-object support functions.  Although  
we really ought to change the way libpq does this, we must expect that  
this query will remain in use in the field for the foreseeable future,  
so until we're ready to break compatibility with old libpq versions  
we'd better check the results stay the same.  See the recent lo_create()  
fiasco.  

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

Rename lo_create(oid, bytea) to lo_from_bytea().

commit   : 154146d208de7518bb6c8131dc8d2361f7f36f56    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 15:39:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 15:39:09 -0400    

Click here for diff

The previous naming broke the query that libpq's lo_initialize() uses  
to collect the OIDs of the server-side functions it requires, because  
that query effectively assumes that there is only one function named  
lo_create in the pg_catalog schema (and likewise only one lo_open, etc).  
  
While we should certainly make libpq more robust about this, the naive  
query will remain in use in the field for the foreseeable future, so it  
seems the only workable choice is to use a different name for the new  
function.  lo_from_bytea() won a small straw poll.  
  
Back-patch into 9.4 where the new function was introduced.  

M doc/src/sgml/lobj.sgml
M src/backend/libpq/be-fsstubs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.h
M src/include/libpq/be-fsstubs.h
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source

Fix typos

commit   : 7937910781a823382b3f76b4b811791804431927    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Feb 2014 16:43:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Feb 2014 16:43:03 -0300    

Click here for diff

M src/backend/commands/event_trigger.c
M src/backend/utils/adt/json.c

Remove unnecessary output expressions from unflattened subqueries.

commit   : 55d5b3c08279b487cfa44d4b6e6eea67a0af89e4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 13:12:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jun 2014 13:12:53 -0400    

Click here for diff

If a sub-select-in-FROM gets flattened into the upper query, then we  
naturally get rid of any output columns that are defined in the sub-select  
text but not actually used in the upper query.  However, this doesn't  
happen when it's not possible to flatten the subquery, for example because  
it contains GROUP BY, LIMIT, etc.  Allowing the subquery to compute useless  
output columns is often fairly harmless, but sometimes it has significant  
performance cost: the unused output might be an expensive expression,  
or it might be a Var from a relation that we could remove entirely (via  
the join-removal logic) if only we realized that we didn't really need  
that Var.  Situations like this are common when expanding views, so it  
seems worth taking the trouble to detect and remove unused outputs.  
  
Because the upper query's Var numbering for subquery references depends on  
positions in the subquery targetlist, we don't want to renumber the items  
we leave behind.  Instead, we can implement "removal" by replacing the  
unwanted expressions with simple NULL constants.  This wastes a few cycles  
at runtime, but not enough to justify more work in the planner.  

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

Consistency improvements for slot and decoding code.

commit   : e04a9ccd2ccd6e31cc4af6b08257a0a186d0fce8    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 Jun 2014 13:23:46 +0200    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 Jun 2014 13:23:46 +0200    

Click here for diff

Change the order of checks in similar functions to be the same; remove  
a parameter that's not needed anymore; rename a memory context and  
expand a couple of comments.  
  
Per review comments from Amit Kapila  

M src/backend/access/transam/xlog.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/include/replication/slot.h

Have configuration templates augment, not replace, LDFLAGS.

commit   : 4d92b158555452ba62ee3caf5c5546fd4a8cba5b    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 11 Jun 2014 19:50:57 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 11 Jun 2014 19:50:57 -0400    

Click here for diff

This preserves user-specified LDFLAGS; we already kept user-specified  
CFLAGS and CPPFLAGS.  Given the shortage of complaints and the fact that  
any problem caused is likely to appear at build time, no back-patch.  
  
Dag-Erling Smørgrav and Noah Misch  

M src/template/cygwin
M src/template/win32

Consistently define BUILDING_DLL during builds of src/port for Windows.

commit   : bd31794df7dc53719740aa8e2ea1578ea2b87285    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 11 Jun 2014 19:50:41 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 11 Jun 2014 19:50:41 -0400    

Click here for diff

The MSVC build process already did so; this fixes the principal build  
process to match.  Both processes already did likewise for src/common.  
This lets server builds of src/port reference postgres.exe data symbols.  

M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.win32

Fix typos in comments.

commit   : d098b236f301d8e805f3c4d7fe940230c65d7a88    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 11 Jun 2014 19:50:29 -0400    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 11 Jun 2014 19:50:29 -0400    

Click here for diff

M src/backend/catalog/namespace.c
M src/backend/port/win32/socket.c
M src/backend/utils/mb/encnames.c
M src/bin/pg_dump/pg_dump.c

Fix typos in comments.

commit   : a26ae56f5173f1f8990ccf134730b964506f29ba    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 11 Jun 2014 20:54:06 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 11 Jun 2014 20:54:06 +0900    

Click here for diff

M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/receivelog.c

Fix ancient encoding error in hungarian.stop.

commit   : fd90b5d574f7b882a35fe345359643cb1ff2e67e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Jun 2014 22:48:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Jun 2014 22:48:16 -0400    

Click here for diff

When we grabbed this file off the Snowball project's website, we mistakenly  
supposed that it was in LATIN1 encoding, but evidently it was actually in  
LATIN2.  This resulted in ő (o-double-acute, U+0151, which is code 0xF5 in  
LATIN2) being misconverted into õ (o-tilde, U+00F5), as complained of in  
bug #10589 from Zoltán Sörös.  We'd have messed up u-double-acute too,  
but there aren't any of those in the file.  Other characters used in the  
file have the same codes in LATIN1 and LATIN2, which no doubt helped hide  
the problem for so long.  
  
The error is not only ours: the Snowball project also was confused about  
which encoding is required for Hungarian.  But dealing with that will  
require source-code changes that I'm not at all sure we'll wish to  
back-patch.  Fixing the stopword file seems reasonably safe to back-patch  
however.  

M src/backend/snowball/stopwords/hungarian.stop

Stamp shared-library minor version numbers for 9.5.

commit   : 3bd82dd39eb80587b53f7a3af33bf8b2d49632af    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Jun 2014 21:40:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Jun 2014 21:40:21 -0400    

Click here for diff

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Stamp HEAD as 9.5devel.

commit   : a24c104b9a6e4fef0892b2a0b70f4073378e6544    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Jun 2014 21:36:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Jun 2014 21:36:13 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc
M src/tools/git_changelog
M src/tools/version_stamp.pl