Opened 8 years ago

Closed 7 years ago

#15216 closed Bug (fixed)

list/set inconsistency breaks syncdb

Reported by: arthur@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: inspectdb
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


Found on SVN as of rev 15400.

$ python syncdb
Creating tables ...
Traceback (most recent call last):
  File "", line 11, in <module>
  File "django/core/management/", line 438, in execute_manager
  File "django/core/management/", line 379, in execute
  File "django/core/management/", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "django/core/management/", line 220, in execute
    output = self.handle(*args, **options)
  File "django/core/management/", line 351, in handle
    return self.handle_noargs(**options)
  File "django/core/management/commands/", line 102, in handle_noargs
AttributeError: 'set' object has no attribute 'append'

tables is expected to be a list here but is created at django/trunk/django/db/backends/ BaseDatabaseIntrospection.django_tables_name as a set (but a list instead if only_existing is True..).
A simple tables = list(table) at the appropriate line in django_tables_names has fixed syncdb for me.

Attachments (1)

django-set-object-has-no-attribute-append.patch (515 bytes) - added by Obey Arthur Liu <arthur@…> 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Obey Arthur Liu <arthur@…>


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

Needs tests: set
Triage Stage: UnreviewedAccepted

The regressiontests/introspection tests contains tests for django_table_names(); tests for this case should be added.

comment:2 Changed 8 years ago by Łukasz Rekucki

Severity: Normal
Type: Bug

comment:3 Changed 7 years ago by Ramiro Morales

Easy pickings: unset
Keywords: inspectdb added
UI/UX: unset

comment:4 Changed 7 years ago by Ramiro Morales

Actually, the tables variable is obtained from a a call to the backend DatabaseIntrospection table_names() method and not from a call to django_table_names() so I don't see how a value returned by the latter would end being used at that point.

I agree with the proposal that the django_table_names() return value inconsistency should be fixed, though.

comment:5 Changed 7 years ago by Ramiro Morales

Resolution: fixed
Status: newclosed

In [17510]:

Fixed #15216 -- Made return type of an internal DB introspection method consistent.

Thanks arthur AT milliways DOT fr for the report and patch.

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