'PostgreSQL shouldn\'t roll back SET TIME ZONE, even if the first
transaction is rolled back (#17062).'

def test_connect_and_rollback(self):

    new_connection = connection.copy()
    try:
        cursor = new_connection.cursor()
        cursor.execute('RESET    TIMEZONE')
        cursor.execute('SHOW    TIMEZONE')
        db_default_tz = cursor.fetchone()[0]
        new_tz = ('Europe/Paris' if (db_default_tz == 'UTC') else 'UTC')
        new_connection.close()
        del new_connection.timezone_name
        with self.settings(TIME_ZONE=new_tz):
            new_connection.set_autocommit(False)
            cursor = new_connection.cursor()
            new_connection.rollback()
            cursor.execute('SHOW    TIMEZONE')
            tz = cursor.fetchone()[0]
            self.assertEqual(new_tz, tz)
    finally:
        new_connection.close()
