Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#27843 closed Bug (fixed)

M2M db table names with explicit `username`

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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".

Change History (14)

comment:1 by Mariusz Felisiak, 8 years ago

Owner: changed from nobody to Mariusz Felisiak
Status: newassigned

comment:2 by Mariusz Felisiak, 8 years ago

Has patch: set

comment:3 by Simon Charette, 8 years ago

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

comment:4 by Tim Graham, 8 years ago

Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

in reply to:  3 comment:5 by Mariusz Felisiak, 8 years ago

Replying to 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.

comment:6 by Mariusz Felisiak, 8 years ago

Needs tests: unset
Patch needs improvement: unset

comment:7 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In b9351905:

Fixed #27843 -- Fixed truncate_name() when the name contains a username.

comment:8 by Tim Graham <timograham@…>, 8 years ago

In 87775b64:

[1.11.x] Fixed #27843 -- Fixed truncate_name() when the name contains a username.

Backport of b9351905721771fb49ea0020c751ae4280754c43 from master

comment:9 by Tim Graham <timograham@…>, 8 years ago

In 82026d61:

Refs #27843 -- Fixed 'invalid escape sequence' warning in truncate_name().

comment:10 by Tim Graham <timograham@…>, 8 years ago

In 3a3145bf:

[1.11.x] Refs #27843 -- Fixed 'invalid escape sequence' warning in truncate_name().

Backport of 82026d61a383d07cd840a0d30443ee66bd99798b from master

comment:11 by Simon Charette, 7 years ago

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.

comment:12 by Simon Charette <charette.s@…>, 7 years ago

In ee85ef8:

Fixed #28792 -- Fixed index name truncation of namespaced tables.

Refs #27458, #27843.

Thanks Tim and Mariusz for the review.

comment:13 by Simon Charette <charette.s@…>, 7 years ago

In a35ab95e:

[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

comment:14 by Tim Graham <timograham@…>, 7 years ago

In 0696edbc:

[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

Note: See TracTickets for help on using tickets.
Back to Top