#2512: [patch] Do not fail on update of a primary-key only table ------------------------------+--------------------------------------------- Reporter: blueyed | Owner: adrian Type: defect | Status: new Priority: normal | Milestone: Component: Database wrapper | Version: SVN Severity: normal | Keywords: ------------------------------+--------------------------------------------- Foo has a model with only id (primary key). Calling: {{{ existing_id = 1 foo = Foo( existing_id ) foo.save() }}} fails like this: {{{ Traceback (most recent call last): File "convert_raw.py", line 7, in ? foo.save() File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 183, in save db_values + [pk_val]) File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 138, in execute self.errorhandler(self, exc, value) File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id`=142' at line 1") }}} The generated SQL is: {{{ UPDATE `proj_foo` SET WHERE `id`=%s }}} A patch to fix this is attached.
-- Ticket URL: <http://code.djangoproject.com/ticket/2512> 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 django-updates@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates -~----------~----~----~----~------~----~------~--~---