summaryrefslogtreecommitdiff
path: root/django/db/models/sql/compiler.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2025-01-11 00:02:52 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-13 11:13:29 +0100
commitbfcb34076e3c0c04cb5080a37d93225444ac1b82 (patch)
tree7f66bcfdd543dacd02f578d646104e7e55c948ef /django/db/models/sql/compiler.py
parent8bee7fa45cd7bfe70b68784314e994e2d193fd70 (diff)
Refs #373 -- Removed unused composite pk code in SQLInsertCompiler.
This logic could only be exercised if the composite primary key included an AutoField but it's not allowed yet (refs #35957). It was also slightly broken as it expected the AutoField to always be the first member of returning_fields.
Diffstat (limited to 'django/db/models/sql/compiler.py')
-rw-r--r--django/db/models/sql/compiler.py15
1 files changed, 0 insertions, 15 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 251cc08e51..0d5cd764da 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -9,7 +9,6 @@ from django.db import DatabaseError, NotSupportedError
from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import ColPairs, F, OrderBy, RawSQL, Ref, Value
from django.db.models.fields import composite
-from django.db.models.fields.composite import CompositePrimaryKey
from django.db.models.functions import Cast, Random
from django.db.models.lookups import Lookup
from django.db.models.query_utils import select_related_descend
@@ -1911,18 +1910,6 @@ class SQLInsertCompiler(SQLCompiler):
)
]
cols = [field.get_col(opts.db_table) for field in self.returning_fields]
- elif isinstance(opts.pk, CompositePrimaryKey):
- returning_field = returning_fields[0]
- cols = [returning_field.get_col(opts.db_table)]
- rows = [
- (
- self.connection.ops.last_insert_id(
- cursor,
- opts.db_table,
- returning_field.column,
- ),
- )
- ]
else:
cols = [opts.pk.get_col(opts.db_table)]
rows = [
@@ -1937,8 +1924,6 @@ class SQLInsertCompiler(SQLCompiler):
converters = self.get_converters(cols)
if converters:
rows = self.apply_converters(rows, converters)
- if self.has_composite_fields(cols):
- rows = self.composite_fields_to_tuples(rows, cols)
return list(rows)