mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Fixed #17713 -- Renamed BaseDatabaseFeatures.allows_primary_key_0 to allows_auto_pk_0.
MySQL does allow primary key with value 0. It only forbids autoincrement primary key with value 0. Thanks Claude Paroz for the report.
This commit is contained in:
@@ -389,10 +389,10 @@ if connection.features.interprets_empty_strings_as_nulls:
|
||||
data[2]._meta.get_field('data').empty_strings_allowed and
|
||||
data[3] is None)]
|
||||
|
||||
# Regression test for #8651 -- a FK to an object iwth PK of 0
|
||||
# Regression test for #8651 -- a FK to an object with PK of 0
|
||||
# This won't work on MySQL since it won't let you create an object
|
||||
# with a primary key of 0,
|
||||
if connection.features.allows_primary_key_0:
|
||||
# with an autoincrement primary key of 0,
|
||||
if connection.features.allows_auto_pk_0:
|
||||
test_data.extend([
|
||||
(data_obj, 0, Anchor, "Anchor 0"),
|
||||
(fk_obj, 465, FKData, 0),
|
||||
|
||||
Reference in New Issue
Block a user