deparse: Take pg_catalog out of search_path
deparse: add support for CREATE RULE
Initial cut at ALTER TABLE support

This supports ADD COLUMN.
Merge remote-tracking branch 'alvherre/deparse' into HEAD

* alvherre/deparse:
  deparse: Take pg_catalog out of search_path
  Add support for CREATE EXTENSION
  CREATE TABLE: Add support for the WITH clause
  apply override search path globally to deparsing
  report schema in pg_event_trigger_get_creation_commands
  better support for temporary objects
  support CREATE TYPE AS RANGE
  move pg_get_trigger_whenclause to ruleutils.h
  builtins.h: split to new include/utils/ruleutils.h
  use PG_FUNCNAME_MACRO to avoid stale name
  Add support for JSON command deparsing
  gram.y: more psprintf()
  json.c: fix typo
  jsonfuncs.c: fix a couple of typos
  event_trigger.c: Fix typo in comment
  ExecRefreshMatView: return OID of the affected matview
  CREATE TABLE AS return OID
committs 0.4

Alvaro Herrera, from 20131022221600.GE4987@eldon.alvh.no-ip.org
Introduce "replication_identifiers" to keep track of remote nodes.

Replication identifiers can be used to track & lookup remote nodes identified
via (sysid, tlid, remote_dbid, local_dbid, name) and map that tuple to a local
uint16.

Keyed by that replication identifier the progress of replication from
that system is tracked in a crashsafe manner.

Support for tracking that via output plugins is added as well.

Needs a catversion bump.
seqam 0.2.1
wal_decoding: Add pg_xlog_wait_remote_{apply,receive} functions

We want to use these in isolationtester tests, but they're more
generally useful for "inter-node synchronisation".
bdr: isolationtester: Isolationtester with multi-server support

The spec file can now start with declarations like this:

    conninfo "cname1" "port=NNNN dbname=XYZ"
    conninfo "cname2" "port=MMMM dbname=PQR"

And sessions may include connection declarations like this:

    session "s1"
    connection "cname1"

Both are optional. If no connection information is explicitly specified,
then the earlier behaviour (use conninfo from commandline or fall back
to "dbname=postgres") is retained.

If connection information is specified, we open one "global" connection
per conninfo (for lock checking) and one connection per session. Setup
SQL is executed only on conns[0], as before (but perhaps it would help
to execute it on all until DDL replication is implemented?).

Includes the rudimentary tests from before, including some failing ones.
bdr: Allow repeatedly qualified IDs in postgresql.conf and allow them to start with numbers from the second ID
bdr: Add database oid to IDENTIFY_SYSTEM

Adjust all IDENTIFY_SYSTEM callers
bdr: bdr plugin

Andres Freund, Alvaro Herrera, Abhijit Menon-Sen
bdr: pgbench: delete instead of truncate
bdr: fix nasty typo leading to pkey extraction using the wrong type
bdr: Initialize bgw_notify_pid to 0

Failure to do this resulted in a bgworker that would not run in some
cases.
bdr: Initial DDL replication

This simply accumulates DDL commands in a table, and has the bdr_apply
background worker execute it.
bdr: ignore temp objects when queueing
bdr: moved GUCs to one-dot notation
bdr: formatting fixes for bdr--0.5.sql
bdr: Don't insert commands into bdr_queued_commands during replay.