[Django] #24390: Migration constraint names are non-determinstic due to hash randomization

10 views
Skip to first unread message

Django

unread,
Feb 22, 2015, 12:17:41 PM2/22/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-determinstic due to hash randomization
--------------------------------------+------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+------------------------
[https://github.com/django/django/blob/7901eccf2e591447850be00011a7bb556a3c53f2/django/db/backends/base/schema.py#L801
Index name generation] in migrations uses `hash()` which returns a non-
deterministic result on Python 3 when hash randomization enabled.

I believe constraint names are expected to be generated deterministically.

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

Django

unread,
Feb 22, 2015, 12:23:38 PM2/22/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-deterministic due to hash randomization
----------------------------+--------------------------------------

Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
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
----------------------------+--------------------------------------

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

Django

unread,
Feb 24, 2015, 5:57:02 PM2/24/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-deterministic due to hash randomization
----------------------------+--------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
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
----------------------------+--------------------------------------

Comment (by karolyi):

When fixing this, please look in #24410 too.

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

Django

unread,
Feb 27, 2015, 11:19:17 AM2/27/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-deterministic due to hash randomization
----------------------------+------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

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


Comment:

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

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

Django

unread,
Mar 2, 2015, 9:29:47 AM3/2/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-deterministic due to hash randomization
----------------------------+------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"f37c11eea3cb860112a26f8a65d823842f65b96f"]:
{{{
#!CommitTicketReference repository=""
revision="f37c11eea3cb860112a26f8a65d823842f65b96f"
Fixed #24390 -- Made migration index names deterministic.
}}}

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

Django

unread,
Mar 2, 2015, 1:26:04 PM3/2/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-deterministic due to hash randomization
----------------------------+------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"4e8b167e4d0817b6ae93be8ad97b31bf203698d8"]:
{{{
#!CommitTicketReference repository=""
revision="4e8b167e4d0817b6ae93be8ad97b31bf203698d8"
Fixed MySQL build failure introduced by refs #24390.

Added table_name back to _create_index_sql() to prevent
duplicate index names on MySQL.
}}}

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

Django

unread,
Mar 2, 2015, 5:05:56 PM3/2/15
to django-...@googlegroups.com
#24390: Migration constraint names are non-deterministic due to hash randomization
----------------------------+------------------------------------
Reporter: timgraham | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------

Comment (by Shai Berger <shai@…>):

In [changeset:"8ca35d7c6a639933927f45b439363a1614da56f1"]:
{{{
#!CommitTicketReference repository=""
revision="8ca35d7c6a639933927f45b439363a1614da56f1"
Fixed Oracle build failure introduced by refs #24390.

Used shorter column names to make the generated index name
fit within Oracle's limit of 30 characters
}}}

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

Reply all
Reply to author
Forward
0 new messages