For example, given the following model:
{{{#!python
class Foo(models.Model):
field = models.IntegerField(index=True)
class Meta:
db_table = 'long_name"."table_name'
}}}
The resulting index name will be `'long_name"_field_d21c9e0a'` which is
invalid SQL even when quoted to `'"long_name"_field_d21c9e0a"'`.
Marking as a release blocker because this is a regression which I believe
was introduced by #27458 and wasn't addressed by #27843. I confirm that
this uses to work on Django 1.10 but was broken on 1.11 as I stumbled upon
the issue when upgrading a Django 1.8 LTS codebase to 1.11 LTS on the 1.10
-> 1.11 step.
The tests added by #27458 just happened to work because the index name
truncation cut the string the in a way that both double quotes are
stripped. It should be possible to tweak the table names to trigger the
errors but I felt like directly testing `_create_index_name` was more
appropriate.
--
Ticket URL: <https://code.djangoproject.com/ticket/28792>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/9345
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:1>
* stage: Unreviewed => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:2>
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ee85ef8315db839e5723dea19d8b971420a2ebb4" ee85ef8]:
{{{
#!CommitTicketReference repository=""
revision="ee85ef8315db839e5723dea19d8b971420a2ebb4"
Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843.
Thanks Tim and Mariusz for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:4>
Comment (by Simon Charette <charette.s@…>):
In [changeset:"a35ab95ed4eec5c62fa19bdc69ecfe0eff3e1fca" a35ab95e]:
{{{
#!CommitTicketReference repository=""
revision="a35ab95ed4eec5c62fa19bdc69ecfe0eff3e1fca"
[1.11.x] Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843.
Thanks Tim and Mariusz for the review.
Backport of ee85ef8315db839e5723dea19d8b971420a2ebb4 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:5>
Comment (by Claude Paroz):
Simon, `master` and `1.11`, but not `2.0`?
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"0696edbc6a724ceaba86a977b6d21e57647cb2ac" 0696edbc]:
{{{
#!CommitTicketReference repository=""
revision="0696edbc6a724ceaba86a977b6d21e57647cb2ac"
[2.0.x] Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843.
Thanks Tim and Mariusz for the review.
Backport of ee85ef8315db839e5723dea19d8b971420a2ebb4 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:7>
Comment (by Simon Charette):
Thanks Tim, completely forgot about 2.0.
--
Ticket URL: <https://code.djangoproject.com/ticket/28792#comment:8>