Fix bogus commutator/negator links for JSONB containment operators.

<@ 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.
Fix bogus return macros in range_overright_internal().

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.
doc: Work around stylesheet bug for man build

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.
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.
Revert psql changes to support wrapped expanded mode. That feature is
nice and we'll keep it in 9.5 but it'll take more time to iron out the
collateral damage on other queries and also on tools like
check_postgres.

revert dbe31616c9be7380b8a88cdfbeaa68dbdcdebc36
revert 6513633b94173fc1d9e2b213c43f9422ddbf5faa
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.
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.
Fix core dump in jsonb #> operator, and add regression test cases.

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.
More regression test cases for json/jsonb extraction operators.

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.
Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE'

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.
Change the way pg_basebackup's tablespace mapping is implemented.

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.
Fix comment in pg_basebackup.

The option is called --tablespace-mapping, not --tablespace.

Amit Kapila