﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28675	Tautology in sql/compiler/SQLInsertCompiler.execute_sql()	Дилян Палаузов	nobody	"In the snippet below, not looking in the specifics of the cursor implementation, I don't think that cursor can evaluate to False, as otherwise cursor.execute() on the line before would have failed.  I propose deleting ""and cursor"":

{{{
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -1256,19 +1256,19 @@ class SQLInsertCompiler(SQLCompiler):
     def execute_sql(self, return_id=False):
         assert not (
             return_id and len(self.query.objs) != 1 and
             not self.connection.features.can_return_ids_from_bulk_insert
         )
         self.return_id = return_id
         with self.connection.cursor() as cursor:
             for sql, params in self.as_sql():
                 cursor.execute(sql, params)
-            if not (return_id and cursor):
+            if not (return_id and cursor): # tautology since 7deb25b8dd5aa1
                 return
             if self.connection.features.can_return_ids_from_bulk_insert and len(self.query.objs) > 1:
                 return self.connection.ops.fetch_returned_insert_ids(cursor)
             if self.connection.features.can_return_id_from_insert:
                 assert len(self.query.objs) == 1
                 return self.connection.ops.fetch_returned_insert_id(cursor)
             return self.connection.ops.last_insert_id(
                 cursor, self.query.get_meta().db_table, self.query.get_meta().pk.column
             )

}}}"	Cleanup/optimization	closed	Database layer (models, ORM)	1.11	Normal	fixed			Ready for checkin	1	0	0	0	0	0
