Track spinlock delay in microsecond granularity.

On many platforms the OS will round the sleep time to millisecond
resolution, but there is no reason for us to pre-emptively round the
argument to pg_usleep.

When the delay was measured in milliseconds and started from 1 ms, it
sometimes took many attempts until the logic that increases the delay by
multiplying with a random value between 1 and 2 actually managed to bump it
from 1 ms to 2 ms. That lead to a sequence of 1 ms waits until the delay
started to increase. This wasn't really a problem but it looked odd if you
observed the waits. There is no measurable difference in performance, but
it's more readable this way.

Jeff Janes
Define Trap and TrapMacro even in non-cassert builds.

In some cases, the use of these macros may be preferable to Assert()
or AssertMacro(), since this way the caller can set the trap message.

Andres Freund and Robert Haas
Make the OVER keyword unreserved.

This results in a slightly less specific error message when OVER
is used in a context where we don't accept window functions, but
per discussion, it's worth it to get the benefit of not needing
to reserve this keyword any more.  This same refactoring will
also let us avoid reserving some other keywords that we expect
to add in upcoming patches (specifically, IGNORE, RESPECT, and
FILTER).

Troels Nielsen, with minor changes by me
pg_upgrade:  change -u to -U, for consistency
Change -u (user) option to -U, for consistency with other tools like
pg_dump and psql.  Also expand --user to --username, again for
consistency.
BACKWARD INCOMPATIBILITY
Send SIGKILL to children if they don't die quickly in immediate shutdown

On immediate shutdown, or during a restart-after-crash sequence,
postmaster used to send SIGQUIT (and then abandon ship if shutdown); but
this is not a good strategy if backends don't die because of that
signal.  (This might happen, for example, if a backend gets tangled
trying to malloc() due to gettext(), as in an example illustrated by
MauMau.)  This causes problems when later trying to restart the server,
because some processes are still attached to the shared memory segment.

Instead of just abandoning such backends to their fates, we now have
postmaster hang around for a little while longer, send a SIGKILL after
some reasonable waiting period, and then exit.  This makes immediate
shutdown more reliable.

There is disagreement on whether it's best for postmaster to exit after
sending SIGKILL, or to stick around until all children have reported
death.  If this controversy is resolved differently than what this patch
implements, it's an easy change to make.

Bug reported by MauMau in message 20DAEA8949EC4E2289C6E8E58560DEC0@maumau

MauMau and Álvaro Herrera
pg_upgrade:  trim down --help and doc option descriptions
Previous code had old/new prefixes on option values, e.g.
--old-datadir=OLDDATADIR.  Remove them, for simplicity;  now:
--old-datadir=DATADIR.  Also update docs to do the same.
pg_upgrade:  remove -h option
-h (help) is not needed;  pg_upgrade already supports --help and -?,
which is consistent with other tools.
pg_upgrade:  pass username to analyze script
If -U (user) is specified, pass the username into the created analyze
script.
Per request from Ray Stell
Assert that ALTER TABLE subcommands have pass set
ALTER TABLE ... ALTER CONSTRAINT for FKs

Allow constraint attributes to be altered,
so the default setting of NOT DEFERRABLE
can be altered to DEFERRABLE and back.

Review by Abhijit Menon-Sen
Change errcode for lock_timeout to match NOWAIT

Set errcode to ERRCODE_LOCK_NOT_AVAILABLE

Zoltán Bsöszörményi