Add support for psycopg2 version 2.5 which supports range types, rework tests.