Add reconnection support.

Renamed a few vars to make a bigger distinction between
postgresql (the connector), pg (the connection library), and the
individual connection.