Improve DISCARD documentation.

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.
Make an editorial pass over the 9.4 release notes.

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>.
Add missing index terms for replication commands in the document.

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.
Use ISO 8601 format for dates converted to JSON, too.

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.)
Fix obsolete mention of non-int64 support in CREATE SEQUENCE documentation.

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.
Reorganize functions in be-secure-openssl.c

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.
Fix further concerns about psql wrapping in expanded mode having
collateral damage on other formats, by Sergey Muraviov.
Get successful run of transition tables farther into executor code.
Merge branch 'master' into transition
Adjust Release Notes to reflect holding off wrapped expanded mode until 9.5 (thanks Michael Paquier)
Document new trigger-related forms of ALTER FOREIGN TABLE.

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.
Make pg_service.conf sample LDIF more portable.

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.
Replace a few strncmp() calls with strlcpy().

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
Finish adding file version information to installed Windows binaries.

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.
Install libpq DLL with $(INSTALL_SHLIB).

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).
Fix bug in checking of IDENTIFY_SYSTEM result.

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
Revert "Fix bug in checking of IDENTIFY_SYSTEM result."

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.
Merge branch 'master' into transition
Use comma+space as the separator in the default search_path.

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
pg_upgrade:  adjust logging to use QUERY_ALLOC lengths

Allows the logging to print the entire text of failed queries, rather
than a truncated version.