See here for an example of the error you would get:
http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-
database-sql-2e0f-1254ba7-to-database-table
I have a patch which fixes the issue:
https://github.com/EikeDehling/django/commit/dbe0c4692fe1a7d73e4de345a171b8cbb35651b2
Please let me know what i can do to get this merged/fixed in django.
--
Ticket URL: <https://code.djangoproject.com/ticket/24995>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 1
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
A regression test in `tests/schema` is also needed.
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:1>
Comment (by EikeDehling):
Commit with test here:
https://github.com/EikeDehling/django/commit/72aa1b92551137da69104ab917079ea7e3ac8854
This would only fail on mysql though, which the test-framework does not
use i think?
So the test also passes without my patch.
Suggestions?
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:2>
Comment (by timgraham):
You need to [https://docs.djangoproject.com/en/dev/internals/contributing
/writing-code/unit-tests/#using-another-settings-module create another
settings file] in order to run the tests with a different database. Please
send a pull request with the fix and test.
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:3>
Comment (by EikeDehling):
Thanks, testing with settings for mysql indeed shows the issue
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:4>
Comment (by EikeDehling):
https://github.com/django/django/pull/4881
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:5>
* needs_better_patch: 0 => 1
* needs_tests: 1 => 0
Comment:
The current test on the pull request doesn't appear to be a regression
test as it passes even with the fix reverted.
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:6>
Comment (by timgraham):
As noted in ticket:26384#comment:16:
Prior to MySQL 5.6.6, adding and dropping a foreign key in the same ALTER
TABLE statement may be problematic in some cases and is therefore
unsupported. Separate statements should be used for each operation. As of
MySQL 5.6.6, adding and dropping a foreign key in the same ALTER TABLE
statement is supported for ALTER TABLE ... ALGORITHM=INPLACE but remains
unsupported for ALTER TABLE ... ALGORITHM=COPY.
So the reason I didn't find the proposed test to be a regression test is
because I'm using a newer version of MySQL. The test added in #26384 is
similar to the one proposed in the pull request and has revealed the
issue. Unfortunately both the test added in the other ticket and the test
proposed in the pull request for this ticket are still failing on MySQL
5.5.x, even with the proposed fix (`OperationalError: (1025, "Error on
rename of './test_django/#sql-58c_2b9' to './test_django/schema_author'
(errno: 150)")`).
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:7>
Comment (by Tim Graham <timograham@…>):
In [changeset:"f3595b25496691966d4ff858a3b395735ad85a6e" f3595b2]:
{{{
#!CommitTicketReference repository=""
revision="f3595b25496691966d4ff858a3b395735ad85a6e"
Refs #26384, #24995 -- Skipped a schema test on older MySQL versions.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"a0e3cbaa2bcbab682dfc3fb2998c3b43b21a3741" a0e3cbaa]:
{{{
#!CommitTicketReference repository=""
revision="a0e3cbaa2bcbab682dfc3fb2998c3b43b21a3741"
[1.9.x] Refs #26384, #24995 -- Skipped a schema test on older MySQL
versions.
Backport of f3595b25496691966d4ff858a3b395735ad85a6e from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"d81d02d449edd046a94de5f171f4ae87fa331c7d" d81d02d]:
{{{
#!CommitTicketReference repository=""
revision="d81d02d449edd046a94de5f171f4ae87fa331c7d"
Refs #26384, #24995 -- Avoided a module-level MySQL query in the schema
tests.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:10>
Comment (by Tim Graham <timograham@…>):
In [changeset:"5c1944f9184649a05b3c18b17636bf61c8613f9c" 5c1944f9]:
{{{
#!CommitTicketReference repository=""
revision="5c1944f9184649a05b3c18b17636bf61c8613f9c"
[1.9.x] Refs #26384, #24995 -- Avoided a module-level MySQL query in the
schema tests.
Backport of d81d02d449edd046a94de5f171f4ae87fa331c7d from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:11>
* status: new => closed
* resolution: => wontfix
Comment:
It looks like a patch isn't forthcoming and master will drop support for
MySQL 5.5 following Django 2.0 alpha (#28552), so I think we can close
this.
--
Ticket URL: <https://code.djangoproject.com/ticket/24995#comment:12>