#28792: Index names can be inapropriately truncated when using a namespaced 
table
name
-------------------------------------+-------------------------------------
               Reporter:  Simon      |          Owner:  Simon Charette
  Charette                           |
                   Type:  Bug        |         Status:  assigned
              Component:             |        Version:  1.11
  Migrations                         |
               Severity:  Release    |       Keywords:
  blocker                            |
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When using a namespaced `_meta.db_table` (e.g. Oracle's
 `'schema"."table'`) it's possible that `_create_index_name` returns an
 index name truncating the namespace resulting in an invalid identifier or
 one that isn't namespaced anymore and thus created in the user's
 namespace.

 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.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.13589d82be3f3413c621ac9bbe00f876%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to