MySQL is not SQL standards compliant regarding IS NULL criteria on newly-inserted auto-incremented fields
|Reported by:||jamesp||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Severity:||Normal||Keywords:||mysql, sql standards, auto_increment, count|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
MySQL has a setting which allows an auto-increment column to be returned on a newly-inserted row when tested for NULL. This is enabled by default prior to MySQL 5.6.
This is an edge case in Django, which caused the following tests for #15316 to fail:
To correct this behavior, the following statement must be issued, once per connection:
SET SQL_AUTO_IS_NULL = 0;
This setting was introduced in MySQL 4.1 and is disabled in MySQL 5.6. This patch does not check the version of the database, and the documentation currently indicates that MySQL 3.23 may be used with Django. Please advise if version checking ought to be rolled into the provided patch.