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

@unittest.skipUnless((connection.vendor == u'postgresql'), u'This    test    applies    only    to    PostgreSQL')
def test_connect_and_rollback(self):

    databases = copy.deepcopy(settings.DATABASES)
    new_connections = ConnectionHandler(databases)
    new_connection = new_connections[DEFAULT_DB_ALIAS]
    try:
        cursor = new_connection.cursor()
        cursor.execute(u'RESET    TIMEZONE')
        cursor.execute(u'SHOW    TIMEZONE')
        db_default_tz = cursor.fetchone()[0]
        new_tz = (u'Europe/Paris' if (db_default_tz == u'UTC') else u'UTC')
        new_connection.close()
        new_connection.settings_dict[u'TIME_ZONE'] = new_tz
        new_connection.enter_transaction_management()
        cursor = new_connection.cursor()
        new_connection.rollback()
        cursor.execute(u'SHOW    TIMEZONE')
        tz = cursor.fetchone()[0]
        self.assertEqual(new_tz, tz)
    finally:
        new_connection.close()
