Don't VALGRIND_PRINTF() each query string.

Doing so was helpful for some Valgrind usage and distracting for other
usage.  One can achieve the same effect by changing log_statement and
pointing both PostgreSQL and Valgrind logging to stderr.

Per gripe from Andres Freund.
intarray:  return empty zero-dimensional array for an empty array

Previously a one-dimensional empty array was returned, but its text
representation matched a zero-dimensional array, and there is no way to
dump/reload a one-dimensional empty array.

BACKWARD INCOMPATIBILITY

Per report from elein
Close file to no leak file descriptor memory. Found by Coverity.
Return error if allocation of new element was not possible.

Found by Coverity.
Introduce InvalidCommandId.

This allows a 32-bit field to represent an *optional* command ID
without a separate flag bit.

Andres Freund