Opened 14 years ago

Closed 14 years ago

#8331 closed (fixed) sqlclear and friends crash, for unknown reasons

Reported by: Dougal Sutherland Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When I run sqlclear, it often crashes with the following traceback:

$ ./ sqlclear tests
Traceback (most recent call last):
  File "./", line 11, in <module>
  File "/Library/Python/2.5/site-packages/django/core/management/", line 334, in execute_manager
  File "/Library/Python/2.5/site-packages/django/core/management/", line 295, in execute
  File "/Library/Python/2.5/site-packages/django/core/management/", line 77, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/", line 96, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/django/core/management/", line 146, in handle
    app_output = self.handle_app(app, **options)
  File "/Library/Python/2.5/site-packages/django/core/management/commands/", line 10, in handle_app
    return u'\n'.join(sql_delete(app,'utf-8')
  File "/Library/Python/2.5/site-packages/django/core/management/", line 98, in sql_delete
    output.extend(connection.creation.sql_destroy_model(model, references_to_delete, style))
  File "/Library/Python/2.5/site-packages/django/db/backends/", line 263, in sql_destroy_model
    output.extend(self.sql_remove_table_constraints(model, references_to_delete, style))
TypeError: sql_remove_table_constraints() takes exactly 3 arguments (4 given)

As far as I can tell, though, sql_remove_table_constraints() does actually want four arguments (including self).

An example for which this happens is a simple project, with only the one app installed, whose looks like

from django.db import models

class Watcher(models.Model):
    user = models.ForeignKey('User')

class User(models.Model):

If you switch the order of the definitions, however, it works fine (outputting the appropriate DROP statements).

Change History (1)

comment:1 Changed 14 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [8364]) Fixed #8331 -- Added style parameter to sqlite backend implementation of sql_remove_table_constraints, missed in recent db backend refactor. Thanks to d00gs for the report.

Note: See TracTickets for help on using tickets.
Back to Top