Introduce jsonb, a structured format for storing json.

The new format accepts exactly the same data as the json type. However, it is
stored in a format that does not require reparsing the orgiginal text in order
to process it, making it much more suitable for indexing and other operations.
Insignificant whitespace is discarded, and the order of object keys is not
preserved. Neither are duplicate object keys kept - the later value for a given
key is the only one stored.

The new type has all the functions and operators that the json type has,
with the exception of the json generation functions (to_json, json_agg etc.)
and with identical semantics. In addition, there are operator classes for
hash and btree indexing, and two classes for GIN indexing, that have no
equivalent in the json type.

This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
was intended to provide similar facilities to a nested hstore type, but which
in the end proved to have some significant compatibility issues.

Authors: Oleg Bartunov,  Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
Review: Andres Freund
Fix mis-spelling in jsonb docs.

Per Thom Brown.
Do jsonb regression test input in the conventional way.

This should make the buildfarm happier.
Fix "the the" typos.

Erik Rijkers
Remove dead code and add comments.

'cbuffer' variable was left over from an earlier version of the patch to
rewrite the incomplete split handling.
Fix START_REPLICATION syntax in document.

Enclose "TIMELINE tli" part with brackets because it's optional.

Backport to 9.3 where TIMELINE option was introduced.

Noted by Marko Tiikkaja
Change ginMergeItemPointers to return a palloc'd array.

That seems nicer than making it the caller's responsibility to pass a
suitable-sized array. All the callers were just palloc'ing an array anyway.
Fix ts_rank_cd() to ignore stripped lexemes

Previously, stripped lexemes got a default location and could be
considered if mixed with non-stripped lexemes.

BACKWARD INCOMPATIBILITY CHANGE
docs:  Add short "cover density" description

Also, previous commit 1420f3a9827a39e5c6c998f6fa35a6fc97903145 to fix
ts_rank_cd() for stripped lexemes was from a patch created by Alex Hill.
Remove wchar.c Asserts that were stricter than the main code

Assert errors were thrown for functions being passed invalid encodings,
while the main code handled it just fine.

Also document that libpq's PQclientEncoding() returns -1 for an encoding
lookup failure.

Per report from Peter Geoghegan
Merge pull request #2 from postgres/master

Latest version