def skipPGVersionBefore(*ver):
    """Skip PG versions below specific version i.e. (9, 5)."""

    ver = ver + (0,) * (3 - len(ver))

    def skip_before_postgres_(func):
        @wraps(func)
        def skip_before_postgres__(obj, *args, **kwargs):

            if hasattr(obj.conn, 'server_version'):
                server_version = obj.conn.server_version
            else:  # Assume Sqlalchemy
                server_version = obj.conn.connection.connection.server_version

            if server_version < int('%d%02d%02d' % ver):
                return obj.skipTest("Skipped because PostgreSQL {}".format(
                    server_version))
            else:
                return func(obj, *args, **kwargs)
        return skip_before_postgres__
    return skip_before_postgres_
Skip PG versions below specific version i.e. (9, 5).