[Django] #24573: "Unknown column" exception after removing field in migration.

813 views
Skip to first unread message

Django

unread,
Apr 2, 2015, 8:29:13 PM4/2/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
----------------------------+--------------------
Reporter: tttomekkk | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
When removing field of base class model in my migration and than using
`RunPython` with subclass model query I face exception
`django.db.utils.OperationalError: (1054, "Unknown column
'bugapp_person.name' in 'field list'")`. It looks like during migrating,
current migration state of submodel does not reflect field removal. Base
class is alright though. Additionally, this happens only when at least one
extra model with OTO field to base model exists.

This occurs in Django 1.8. I had no problem with any of 1.7.x version,
last tested was 1.7.7. Simplified snippet attached below runs smoothly
with version 1.7 and should reproduce the error in 1.8.

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

Django

unread,
Apr 2, 2015, 8:32:06 PM4/2/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
------------------------+----------------------------

Reporter: tttomekkk | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------+----------------------------
Changes (by tttomekkk):

* Attachment "0001_inital.py" added.

Django

unread,
Apr 2, 2015, 8:32:17 PM4/2/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
------------------------+----------------------------

Reporter: tttomekkk | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------+----------------------------
Changes (by tttomekkk):

* Attachment "traceback.py" added.

Django

unread,
Apr 2, 2015, 8:36:58 PM4/2/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
----------------------------+--------------------------------------

Reporter: tttomekkk | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> When removing field of base class model in my migration and than using
> `RunPython` with subclass model query I face exception
> `django.db.utils.OperationalError: (1054, "Unknown column
> 'bugapp_person.name' in 'field list'")`. It looks like during migrating,
> current migration state of submodel does not reflect field removal. Base
> class is alright though. Additionally, this happens only when at least
> one extra model with OTO field to base model exists.
>
> This occurs in Django 1.8. I had no problem with any of 1.7.x version,
> last tested was 1.7.7. Simplified snippet attached below runs smoothly
> with version 1.7 and should reproduce the error in 1.8.

New description:

When removing field of base class model in my migration and than using
`RunPython` with subclass model query I face exception
`django.db.utils.OperationalError: (1054, "Unknown column
'bugapp_person.name' in 'field list'")`. It looks like during migrating,
current migration state of submodel does not reflect field removal. Base
class is alright though. Additionally, this happens only when at least one
extra model with OTO field to base model exists.

This occurs in Django 1.8. I had no problem with any of 1.7.x (1.7.7
recently). Simplified snippet attached below runs smoothly with 1.7 and
should reproduce the error under 1.8.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:1>

Django

unread,
Apr 3, 2015, 12:45:58 PM4/3/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
---------------------------------+------------------------------------
Reporter: tttomekkk | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: 1.8
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

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

* status: new => assigned
* severity: Normal => Release blocker
* needs_tests: 0 => 1
* owner: nobody => MarkusH
* needs_docs: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Ok, it took me a while, but I can confirm that bug.

PR: https://github.com/django/django/pull/4447

--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:2>

Django

unread,
Apr 11, 2015, 5:22:28 PM4/11/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
---------------------------------+------------------------------------
Reporter: tttomekkk | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: 1.8

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

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

* cc: joostrijneveld@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:3>

Django

unread,
Apr 17, 2015, 12:27:13 PM4/17/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
---------------------------------+------------------------------------
Reporter: tttomekkk | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: 1.8

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_docs: 1 => 0
* needs_tests: 1 => 0


Comment:

I finally added a test case. Ready for review.

--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:4>

Django

unread,
Apr 20, 2015, 3:06:26 PM4/20/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
-------------------------------------+-------------------------------------

Reporter: tttomekkk | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: 1.8
Severity: Release blocker | Resolution:
Keywords: | 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):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:5>

Django

unread,
Apr 21, 2015, 5:52:25 AM4/21/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
-------------------------------------+-------------------------------------
Reporter: tttomekkk | Owner: MarkusH
Type: Bug | Status: closed
Component: Migrations | Version: 1.8
Severity: Release blocker | Resolution: fixed

Keywords: | 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 Markus Holtermann <info@…>):

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


Comment:

In [changeset:"b93690c4652a108b4305c0df34509bfc267fd927" b93690c4]:
{{{
#!CommitTicketReference repository=""
revision="b93690c4652a108b4305c0df34509bfc267fd927"
Fixed #24573 -- Considered new related models for reloading

Thanks tttomekkk for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:6>

Django

unread,
Apr 21, 2015, 6:29:21 AM4/21/15
to django-...@googlegroups.com
#24573: "Unknown column" exception after removing field in migration.
-------------------------------------+-------------------------------------
Reporter: tttomekkk | Owner: MarkusH
Type: Bug | Status: closed
Component: Migrations | Version: 1.8

Severity: Release blocker | Resolution: fixed
Keywords: | 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 Markus Holtermann <info@…>):

In [changeset:"0cacb8f8ba94b06a78dcdfa22dc406a8a20a7f88" 0cacb8f8]:
{{{
#!CommitTicketReference repository=""
revision="0cacb8f8ba94b06a78dcdfa22dc406a8a20a7f88"
[1.8.x] Fixed #24573 -- Considered new related models for reloading

Thanks tttomekkk for the report.

Backport of b93690c4652a108b4305c0df34509bfc267fd927 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24573#comment:7>

Reply all
Reply to author
Forward
0 new messages