Fix typo in comment.

Etsuro Fujita
Mention that VACUUM FREEZE also effectively zeroes the table freeze age.

Maciek Sakrejda, reviewed by Amit Kapila
Documentation for test_shm_mq.

Commit 4db3744f1f43554b03d8193da4645a0a5326eb18 added this contrib
module but neglected to document it.  Oops.
Fix multiple bugs in index page locking during hot-standby WAL replay.

In ordinary operation, VACUUM must be careful to take a cleanup lock on
each leaf page of a btree index; this ensures that no indexscans could
still be "in flight" to heap tuples due to be deleted.  (Because of
possible index-tuple motion due to concurrent page splits, it's not enough
to lock only the pages we're deleting index tuples from.)  In Hot Standby,
the WAL replay process must likewise lock every leaf page.  There were
several bugs in the code for that:

* The replay scan might come across unused, all-zero pages in the index.
While btree_xlog_vacuum itself did the right thing (ie, nothing) with
such pages, xlogutils.c supposed that such pages must be corrupt and
would throw an error.  This accounts for various reports of replication
failures with "PANIC: WAL contains references to invalid pages".  To
fix, add a ReadBufferMode value that instructs XLogReadBufferExtended
not to complain when we're doing this.

* btree_xlog_vacuum performed the extra locking if standbyState ==
STANDBY_SNAPSHOT_READY, but that's not the correct test: we won't open up
for hot standby queries until the database has reached consistency, and
we don't want to do the extra locking till then either, for fear of reading
corrupted pages (which bufmgr.c would complain about).  Fix by exporting a
new function from xlog.c that will report whether we're actually in hot
standby replay mode.

* To ensure full coverage of the index in the replay scan, btvacuumscan
would emit a dummy WAL record for the last page of the index, if no
vacuuming work had been done on that page.  However, if the last page
of the index is all-zero, that would result in corruption of said page,
since the functions called on it weren't prepared to handle that case.
There's no need to lock any such pages, so change the logic to target
the last normal leaf page instead.

The first two of these bugs were diagnosed by Andres Freund, the other one
by me.  Fixes based on ideas from Heikki Linnakangas and myself.

This has been wrong since Hot Standby was introduced, so back-patch to 9.0.
Improve FILES section of psql reference page.

Primarily, explain where to find the system-wide psqlrc file, per recent
gripe from John Sutton.  Do some general wordsmithing and improve the
markup, too.

Also adjust psqlrc.sample so its comments about file location are somewhat
trustworthy.  (Not sure why we bother with this file when it's empty,
but whatever.)

Back-patch to 9.2 where the startup file naming scheme was last changed.
Fix compiler warning: Size isn't 64 bits on 32 bit platforms.

Report by Peter Eisentraut.
Fix compiler warning.

Kevin Gritter reports that his compiler complains about inq and outq
being possibly-uninitialized at the point where they are passed to
shm_mq_attach().  They are initialized by the call to
setup_dynamic_shared_memory, but apparently his compiler is inlining
that function and then having doubts about whether the for loop will
always execute at least once.  Fix by initializing them to NULL.
test_shm_mq: Fix checks for negative queue size.

Noted while addressing compiler warnings pointed out on pgsql-hackers.
Fix missing parentheses resulting in wrong order of dereference.

This could result in referencing uninitialized memory.

Michael Paquier, in response to a complaint from Andres Freund
Logging running transactions every 15 seconds.

Previously, we did this just once per checkpoint, but that could make
Hot Standby take a long time to initialize.  To avoid busying an
otherwise-idle system, we don't do this if no WAL has been written
since we did it last.

Andres Freund
test_shm_mq: Try again to fix compiler warning.

Per complaints from Andres Freund and Tom Lane.
Fix whitespace
Suppress Coverity complaints in readfuncs.c.

Coverity is complaining that the value returned by pg_strtok in
READ_LOCATION_FIELD and READ_BITMAPSET_FIELD macros is not used. In commit
39bfc94c86f1990e9db8ea3da0e82995cc1b76db, we did this to the other macros
to placate compilers that complained when the variable was completely
unused, this extends that to the last remaining macros.
Split ECPGdo() in constituent parts

This splits ECPGdo() into ecpg_prologue(), ecpg_do() and
ecpg_epilogue(), and renames free_params() into ecpg_free_params() and
exports it.  This makes it possible for future code to use these
routines for their own purposes.

There is no user-visible functionality change here, only code
reorganization.

Zoltán Böszörményi

Reviewed by Antonin Houska.  Larger, older versions of this patch were
reviewed by Noah Misch and Michael Meskes.
Add display of oprcode (the underlying function's name) to psql's \do+.

The + modifier of \do didn't use to do anything, but now it adds an oprcode
column.  This is useful both as an additional form of documentation of what
the operator does, and to save a step when finding out properties of the
underlying function.

Marko Tiikkaja, reviewed by Rushabh Lathia, adjusted a bit by me
Split ecpg_execute() in constituent parts

Split the rather long ecpg_execute() function into ecpg_build_params(),
ecpg_autostart_transaction(), a smaller ecpg_execute() and
ecpg_process_output().  There is no user-visible change here, only code
reorganization to support future patches.

Author: Zoltán Böszörményi

Reviewed by Antonin Houska.  Larger, older versions of this patch were
reviewed by Noah Misch and Michael Meskes.
Fix Hot Standby feedback sending when streaming busily.

Commit 6f60fdd7015b032bf49273c99f80913d57eac284 accidentally removed a
call to XLogWalRcvSendHSFeedback() after flushing received WAL to disk.
The consequence is that when walsender is busy streaming WAL, it doesn't
send HS feedback messages. One is sent if nothing is received from the
master for 100ms, but if there's a steady stream of WAL, it never happens.

Backpatch to 9.3.

Andres Freund and Amit Kapila
docs:  update PL/pgSQL docs about the use of := and =
doc: fix := description typo.
doc:  rename "Equals" to "Equal"