Parse server version with LooseVersion

Parse the PostgreSQL server version string with
distutils.version.LooseVersion, as this is easier and more robust than
doing it manually.
Run through tests for all versions of PostgreSQL