Silence compiler warnings about possibly unset variables.

They are in fact set in every case where they are needed, but the
compiler doesn't know that.

Per gripe from Tom Lane.
Fix unsafe references to errno within error messaging logic.

Various places were supposing that errno could be expected to hold still
within an ereport() nest or similar contexts.  This isn't true necessarily,
though in some cases it accidentally failed to fail depending on how the
compiler chanced to order the subexpressions.  This class of thinko
explains recent reports of odd failures on clang-built versions, typically
missing or inappropriate HINT fields in messages.

Problem identified by Christian Kruse, who also submitted the patch this
commit is based on.  (I fixed a few issues in his patch and found a couple
of additional places with the same disease.)

Back-patch as appropriate to all supported branches.
Merge branch 'master' into jsonb_and_hstore
PANIC -> ERROR for jsonb
PANIC -> ERROR for hstore
Add notes about nested hstore format.