Add a SERIALIZE-FOR-POSTGRES generic method.

It can be customized to serialize lisp values directly into the socket
stream either as string or as bytes. Defaults to TO-SQL-STRING.

E.g. the integration with local-time can use it to emit the binary
timestamp format of PostgreSQL and avoid printing and parsing of
human readable timestamp strings.
Add failing test showing database error raised when attempting to write empty arrays.
Fix empty array problem by using Postgres's array literal syntax for empty arrays
Ensure that transaction-open-p, *current-logical-transaction*, and *transaction-level* correctly reflect the state of the transaction (that is, closed) at the time that any abort or commit hooks run. Also add abort-logical-transaction and commit-logical-transaction methods (and documentation) for use with with-logical-transaction, where the user will not know whether the handle represents a savepoint or transaction.