Re: [Django] #13203: Deletion error of model with generic relation to inherited model

33 views
Skip to first unread message

Django

unread,
Feb 1, 2013, 9:03:49 PM2/1/13
to django-...@googlegroups.com
#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):

See also #12885.

--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 2, 2013, 4:42:37 PM2/2/13
to django-...@googlegroups.com
#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

unread,
Feb 2, 2013, 5:23:53 PM2/2/13
to django-...@googlegroups.com
#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):

See also #9501.

--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:9>

Django

unread,
Feb 3, 2013, 12:33:09 PM2/3/13
to django-...@googlegroups.com
#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):

#18297 was closed as duplicate of this.

--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:10>

Django

unread,
Oct 2, 2015, 2:31:48 PM10/2/15
to django-...@googlegroups.com
#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: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0


Comment:

It seems this was fixed in Django 1.6 by
97774429aeb54df4c09895c07cd1b09e70201f7d. I've added
[https://github.com/django/django/pull/5385 a regression test].

--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:11>

Django

unread,
Oct 2, 2015, 2:35:08 PM10/2/15
to django-...@googlegroups.com
#13203: Deletion error of model with generic relation to inherited model
-------------------------------------+-------------------------------------

Reporter: ramusus | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.1
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: content_type | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* stage: Accepted => Ready for checkin


Comment:

The added test covers the reported use cases, LGTM given the tests pass.

--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:12>

Django

unread,
Oct 2, 2015, 3:47:24 PM10/2/15
to django-...@googlegroups.com
#13203: Deletion error of model with generic relation to inherited model
-------------------------------------+-------------------------------------
Reporter: ramusus | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.1
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: content_type | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"58c7ff39fb265754fb17ab8d7f8a1401b355777b" 58c7ff3]:
{{{
#!CommitTicketReference repository=""
revision="58c7ff39fb265754fb17ab8d7f8a1401b355777b"
Refs #13203, #9501 -- Added a test for generic relations to child models.

Fixed in 97774429aeb54df4c09895c07cd1b09e70201f7d.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:13>

Django

unread,
Oct 2, 2015, 3:47:54 PM10/2/15
to django-...@googlegroups.com
#13203: Deletion error of model with generic relation to inherited model
-------------------------------------+-------------------------------------
Reporter: ramusus | Owner: nobody
Type: Bug | Status: closed
Component: | Version: 1.1
contrib.contenttypes |
Severity: Normal | Resolution: fixed

Keywords: content_type | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/13203#comment:14>

Reply all
Reply to author
Forward
0 new messages