[Django] #27843: M2M db table names with explicit `username`

38 views
Skip to first unread message

Django

unread,
Feb 15, 2017, 6:22:21 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
`db.models.fields.related._get_m2m_db_table` doesn't work properly if we
use `db_table` with explicit `username` of a length between 24-30 chars
e.g.
{{{
db_table = "d4_pullrequestsoracle_35"."DJANGO_DOCUMENT_TABLE"
name = 'students'
}}}
then `_get_m2m_db_table` returns `"D4_PULLREQUESTSORACLE_35".56C8"`
instead of `"D4_PULLREQUESTSORACLE_35"."DJANGO_DOCUMENT_TABLE_STUDENTS"`.

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

Django

unread,
Feb 15, 2017, 6:22:28 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
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 felixxm):

* status: new => assigned
* owner: nobody => felixxm


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

Django

unread,
Feb 15, 2017, 6:32:47 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8066 PR]

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

Django

unread,
Feb 15, 2017, 10:03:35 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

It looks like all usages of `truncate_name(strip_quote())` are also
affected (see #27458, 69b7d4b116e3b70b250c77829e11038d5d55c2a8)

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

Django

unread,
Feb 15, 2017, 10:10:58 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted


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

Django

unread,
Feb 15, 2017, 11:24:22 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

Replying to [comment:3 Simon Charette]:


> It looks like all usages of `truncate_name(strip_quote())` are also
affected (see #27458, 69b7d4b116e3b70b250c77829e11038d5d55c2a8)

I decided to fix `truncate_name` instead of duplicate this fix in few
other places.

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

Django

unread,
Feb 15, 2017, 11:50:44 AM2/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | 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 felixxm):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


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

Django

unread,
Feb 17, 2017, 9:44:17 AM2/17/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
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 Tim Graham <timograham@…>):

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


Comment:

In [changeset:"b9351905721771fb49ea0020c751ae4280754c43" b9351905]:
{{{
#!CommitTicketReference repository=""
revision="b9351905721771fb49ea0020c751ae4280754c43"
Fixed #27843 -- Fixed truncate_name() when the name contains a username.
}}}

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

Django

unread,
Feb 17, 2017, 9:45:06 AM2/17/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"87775b64cdda97567a33c7bad65ad42853048525" 87775b64]:
{{{
#!CommitTicketReference repository=""
revision="87775b64cdda97567a33c7bad65ad42853048525"
[1.11.x] Fixed #27843 -- Fixed truncate_name() when the name contains a
username.

Backport of b9351905721771fb49ea0020c751ae4280754c43 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27843#comment:8>

Django

unread,
Feb 27, 2017, 9:30:59 AM2/27/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"82026d61a383d07cd840a0d30443ee66bd99798b" 82026d61]:
{{{
#!CommitTicketReference repository=""
revision="82026d61a383d07cd840a0d30443ee66bd99798b"
Refs #27843 -- Fixed 'invalid escape sequence' warning in truncate_name().
}}}

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

Django

unread,
Feb 27, 2017, 12:54:29 PM2/27/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"3a3145bfcd7a1de1e7cda2d3f2ba61a90d34cf11" 3a3145bf]:
{{{
#!CommitTicketReference repository=""
revision="3a3145bfcd7a1de1e7cda2d3f2ba61a90d34cf11"
[1.11.x] Refs #27843 -- Fixed 'invalid escape sequence' warning in
truncate_name().

Backport of 82026d61a383d07cd840a0d30443ee66bd99798b from master
}}}

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

Django

unread,
Nov 11, 2017, 7:17:40 PM11/11/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

This didn't completely fix the regression introduced by #27458 in the
index and foreign key constraint creation cases because
`_create_index_name` still rely on `strip_quotes` without using
`truncate_name`. I'm working on a patch to deal with this issue so I'll
file a new ticket once it's ready for review.

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

Django

unread,
Nov 14, 2017, 9:53:49 PM11/14/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette <charette.s@…>):

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/27843#comment:12>

Django

unread,
Nov 14, 2017, 10:07:31 PM11/14/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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/27843#comment:13>

Django

unread,
Nov 15, 2017, 8:32:00 AM11/15/17
to django-...@googlegroups.com
#27843: M2M db table names with explicit `username`
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"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/27843#comment:14>

Reply all
Reply to author
Forward
0 new messages