Opened 22 months ago

Closed 22 months ago

Last modified 13 months ago

#27843 closed Bug (fixed)

M2M db table names with explicit `username`

Reported by: felixxm Owned by: felixxm
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 Changed 22 months ago by felixxm

Owner: changed from nobody to felixxm
Status: newassigned

comment:2 Changed 22 months ago by felixxm

Has patch: set

comment:3 Changed 22 months ago by Simon Charette

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

comment:4 Changed 22 months ago by Tim Graham

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

comment:5 in reply to:  3 Changed 22 months ago by felixxm

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 Changed 22 months ago by felixxm

Needs tests: unset
Patch needs improvement: unset

comment:7 Changed 22 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In b9351905:

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

comment:8 Changed 22 months ago by Tim Graham <timograham@…>

In 87775b64:

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

Backport of b9351905721771fb49ea0020c751ae4280754c43 from master

comment:9 Changed 22 months ago by Tim Graham <timograham@…>

In 82026d61:

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

comment:10 Changed 22 months ago by Tim Graham <timograham@…>

In 3a3145bf:

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

Backport of 82026d61a383d07cd840a0d30443ee66bd99798b from master

comment:11 Changed 13 months ago 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.

comment:12 Changed 13 months ago by Simon Charette <charette.s@…>

In ee85ef8:

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

Refs #27458, #27843.

Thanks Tim and Mariusz for the review.

comment:13 Changed 13 months ago by Simon Charette <charette.s@…>

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 Changed 13 months ago by Tim Graham <timograham@…>

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