#2108: Empty models result in invalid SQL for Sqlite
------------------------------+---------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: mtredinnick
Type: defect | Status: new
Priority: normal | Milestone:
Component: Database wrapper | Version:
Severity: normal | Resolution:
Keywords: sqlite |
------------------------------+---------------------------------------------
Changes (by mtredinnick):
* owner: adrian => mtredinnick
* status: reopened => new
Comment:
I understand your use case now. Sounds reasonable, although a bit of an
unusual case.
Inserting NULL in that field is, as a rule, not correct -- it is invalid
SQL and it's sort of a shame that MySQL and SQL server permit it.
PostgreSQL rejects it. The main problem is SQLite. We should be executing
{{{insert into mytable (id) values (DEFAULT)}}} but SQLite does not
understand the standard DEFAULT value, so you must use NULL in that case
for integer primary keys.
I have made a patch that now inserts the new elements each time and has a
backend-specific hook to get the right value to insert (either DEFAULT or
NULL, as appropriate). Will commit it in a moment and get somebody on the
mailing list to test the SQL Server case.
--
Ticket URL: <http://code.djangoproject.com/ticket/2108>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---