﻿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
31036	MySQL driver has incorrect primary key default, causing failure to insert auto increment rows with no additional values.	Peter Venable	nobody	"The problem:

Given a MySQL table with only one column, an auto-increment primary key integer, inserting a row should be as simple as calling MyTable.objects.create()
However, the generated SQL is:
{{{
INSERT INTO `myapp_mytable` (`id`) VALUES (DEFAULT);
-- Error Code: 1062. Duplicate entry '0' for key 'PRIMARY'
}}}
Instead it should generate:
{{{
INSERT INTO `myapp_mytable` (`id`) VALUES (NULL);
}}}

The fix could be a one-line edit to https://github.com/django/django/blob/master/django/db/backends/base/operations.py#L294 changing 'DEFAULT' to 'NULL'."	Bug	new	Database layer (models, ORM)	2.2	Normal		mysql		Unreviewed	0	0	0	0	1	0
