#13203: Deletion error of model with generic relation to inherited model --------------------------------------+------------------------------------ Reporter: ramusus | Owner: nobody Type: Bug | Status: new Component: contrib.contenttypes | Version: 1.1 Severity: Normal | Resolution: Keywords: content_type | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by ramiro): Updated the proposed fix to current master: https://github.com/ramiro/django/compare/13203 There isn't actually need of running any test code. Just by providing a models design like the one added in the patch is enough to get the syncdb process to the test DB to crash under Postgres because of invalid DDL: {{{ $ ~/django_test/pg84 generic_relations_regress -v2 Python version: 3.3.0 (default, Oct 7 2012, 14:43:21) [GCC 4.6.3] Importing application generic_relations_regress Creating test database for alias 'default' ('test_django_default')... Creating tables ... Creating table django_content_type Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Creating table auth_user_groups Creating table auth_user_user_permissions Creating table auth_user Creating table django_site Creating table django_flatpage_sites Creating table django_flatpage Creating table django_redirect Creating table django_session Creating table django_comments Creating table django_comment_flags Creating table django_admin_log Creating table generic_relations_regress_link Creating table generic_relations_regress_place Creating table generic_relations_regress_restaurant Creating table generic_relations_regress_address Creating table generic_relations_regress_person Creating table generic_relations_regress_charlink Creating table generic_relations_regress_textlink Creating table generic_relations_regress_oddrelation1 Creating table generic_relations_regress_oddrelation2 Creating table generic_relations_regress_note Creating table generic_relations_regress_contact Creating table generic_relations_regress_organization_contacts Creating table generic_relations_regress_organization Creating table generic_relations_regress_company Creating table generic_relations_regress_reference Creating table generic_relations_regress_venue Installing custom SQL ... Installing indexes ... Traceback (most recent call last): File "django/upstream/django/db/backends/postgresql_psycopg2/base.py", line 54, in execute return self.cursor.execute(query, args) psycopg2.ProgrammingError: column "id" of relation "generic_relations_regress_reference" does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "django/upstream/django/core/management/commands/flush.py", line 62, in handle_noargs cursor.execute(sql) File "django/upstream/django/db/backends/postgresql_psycopg2/base.py", line 58, in execute six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2]) File "django/upstream/django/utils/six.py", line 312, in reraise raise value.with_traceback(tb) File "django/upstream/django/db/backends/postgresql_psycopg2/base.py", line 54, in execute return self.cursor.execute(query, args) django.db.utils.DatabaseError: column "id" of relation "generic_relations_regress_reference" does not exist During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./runtests.py", line 323, in <module> options.failfast, args) File "./runtests.py", line 166, in django_tests failures = test_runner.run_tests(test_labels, extra_tests=extra_tests) File "django/upstream/django/test/simple.py", line 368, in run_tests old_config = self.setup_databases() File "django/upstream/django/test/simple.py", line 316, in setup_databases self.verbosity, autoclobber=not self.interactive) File "django/upstream/django/db/backends/creation.py", line 305, in create_test_db database=self.connection.alias) File "django/upstream/django/core/management/__init__.py", line 161, in call_command return klass.execute(*args, **defaults) File "django/upstream/django/core/management/base.py", line 255, in execute output = self.handle(*args, **options) File "django/upstream/django/core/management/base.py", line 385, in handle return self.handle_noargs(**options) File "django/upstream/django/core/management/commands/flush.py", line 70, in handle_noargs The full error: %s""" % (connection.settings_dict['NAME'], e)) django.core.management.base.CommandError: Database test_django_default couldn't be flushed. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the expected database tables doesn't exist. * The SQL was invalid. Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run. The full error: column "id" of relation "generic_relations_regress_reference" does not exist }}} -- Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:8> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.