Fix to_char() to use ASCII-only case-folding rules where appropriate.

formatting.c used locale-dependent case folding rules in some code paths
where the result isn't supposed to be locale-dependent, for example
to_char(timestamp, 'DAY').  Since the source data is always just ASCII
in these cases, that usually didn't matter ... but it does matter in
Turkish locales, which have unusual treatment of "i" and "I".  To confuse
matters even more, the misbehavior was only visible in UTF8 encoding,
because in single-byte encodings we used pg_toupper/pg_tolower which
don't have locale-specific behavior for ASCII characters.  Fix by providing
intentionally ASCII-only case-folding functions and using these where
appropriate.  Per bug #7913 from Adnan Dursun.  Back-patch to all active
branches, since it's been like this for a long time.
Remove dependency on the DLL of pythonxx.def file.

This confused Cygwin's make because of the colon in the path. The
DLL isn't likely to change under us so preserving the dependency
doesn't gain us much, and it's useful to be able to do a native
Windows build with the Cygwin mingw toolset.

Noah Misch.
pg_ctl: Add comma to message
Fix message typo.
Fix broken pg_dump for 9.0 and 9.1 caused by the MV patch.

Per report and suggestion from Bernd Helmle
Add docs for pg_matviews, which were missed in the initial MV commit.
WAL-log the extension of a new empty MV heap which is being populated.

This page with no tuples is used to distinguish an MV containing a
zero-row resultset of its backing query from an MV which has not
been populated by its backing query.  Unless WAL-logged, recovery
and hot standby don't work correctly with what should be an empty
but scannable materialized view.

Fixes bugs reported by Fujii Masao in testing MVs on hot standby.
Fix missing #include in commands/matview.h.

It needs parsenodes.h to be compilable regardless of previous headers.
Adjust nls.mk for split out of wait_error.c
Code beautification for object-access hook machinery.

KaiGai Kohei
Add fe_memutils.c to nls.mk where used
Arrange to cache FdwRoutine structs in foreign tables' relcache entries.

This saves several catalog lookups per reference.  It's not all that
exciting right now, because we'd managed to minimize the number of places
that need to fetch the data; but the upcoming writable-foreign-tables patch
needs this info in a lot more places.
Fix tli history file fetching, broken by the archive after crash recevery patch.

If we were about to enter archive recovery after crash recovery, we scanned
the archive for the latest tli history file, and set the recovery target
timeline to that. However, when we actually tried to read the history file,
we would not fetch the file from the archive, because we were not in archive
recovery yet.

To fix, make readTimeLineHistory and existsTimeLineHistory to always fetch
the file from archive if archive recovery is requested, even if we're not in
archive recovery yet.

Backpatch to 9.2. Mitsumasa KONDO
Fix infinite-loop risk in fixempties() stage of regex compilation.

The previous coding of this function could get into situations where it
would never terminate, because successive passes would re-add EMPTY arcs
that had been removed by the previous pass.  Rewrite the function
completely using a new algorithm that is guaranteed to terminate, and
also seems to be usually faster than the old one.  Per Tcl bugs 3604074
and 3606683.

Tom Lane and Don Porter
Fix typo in docs for ALTER MATERIALIZED VIEW.

Fujii Masao
Remove unnecessary #ifdef FRONTEND check to choose between strdup and pstrdup.

The libpgcommon patch made that unnecessary, palloc and friends are now
available in frontend programs too, mapped to plain old malloc.

As pointed out by Alvaro Herrera.
Merge branch 'master' into toastindex
Merge branch 'toastindex' into reconcurrent2