[Django] #29778: Unique index cannot be created for db table, whose name should be quoted

2 views
Skip to first unread message

Django

unread,
Sep 20, 2018, 4:35:13 AM9/20/18
to django-...@googlegroups.com
#29778: Unique index cannot be created for db table, whose name should be quoted
-------------------------------------+-------------------------------------
Reporter: K0Te | Owner: K0Te
Type: | Status: assigned
Uncategorized |
Component: Database | Version: 2.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
It is not possible to create unqiue indexes for tables, whose names should
be quoted, for example `db_table = 'test-table' `.
ORM does not quote index name, so exception is raised:
>return Database.Cursor.execute(self, query, params)
>E django.db.utils.OperationalError: near "-": syntax error

This was supported in version 1.11 and should be work according to
documentation:

> If your database table name is an SQL reserved word, or contains
characters that aren’t allowed in Python variable names – notably, the
hyphen – that’s OK. Django quotes column and table names behind the
scenes.

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

Django

unread,
Sep 20, 2018, 5:09:02 AM9/20/18
to django-...@googlegroups.com
#29778: Unique index cannot be created for db table, whose name should be quoted
-------------------------------------+-------------------------------------
Reporter: K0Te | Owner: K0Te
Type: Bug | Status: assigned
Component: Database layer | Version: 2.1
(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 Carlton Gibson):

* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


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

Django

unread,
Sep 20, 2018, 5:09:33 AM9/20/18
to django-...@googlegroups.com
#29778: Unique index cannot be created for db table, whose name should be quoted
-------------------------------------+-------------------------------------
Reporter: K0Te | Owner: K0Te
Type: Bug | Status: assigned
Component: Database layer | Version: 2.1
(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
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

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

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

Django

unread,
Sep 20, 2018, 5:25:18 AM9/20/18
to django-...@googlegroups.com
#29778: Unique index cannot be created for db table, whose name should be quoted
-------------------------------------+-------------------------------------
Reporter: K0Te | Owner: K0Te
Type: Bug | Status: assigned
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Sep 25, 2018, 4:00:48 PM9/25/18
to django-...@googlegroups.com
#29778: Unique index cannot be created for db table, whose name should be quoted
-------------------------------------+-------------------------------------
Reporter: Oleg | Owner: Oleg
Type: Bug | Status: closed

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
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:"d1d5c97bc2821bf8c0f4b2d9c7ab16200845b494" d1d5c97b]:
{{{
#!CommitTicketReference repository=""
revision="d1d5c97bc2821bf8c0f4b2d9c7ab16200845b494"
Fixed #29778 -- Fixed quoting of unique index names.

Regression in 3b429c96736b8328c40e5d77282b0d30de563c3c.
}}}

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

Django

unread,
Sep 25, 2018, 4:11:30 PM9/25/18
to django-...@googlegroups.com
#29778: Unique index cannot be created for db table, whose name should be quoted
-------------------------------------+-------------------------------------
Reporter: Oleg | Owner: Oleg
Type: Bug | Status: closed
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
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:"cdb8ee741d0bc72713baf6612e4218d44cfd3958" cdb8ee7]:
{{{
#!CommitTicketReference repository=""
revision="cdb8ee741d0bc72713baf6612e4218d44cfd3958"
[2.1.x] Fixed #29778 -- Fixed quoting of unique index names.

Regression in 3b429c96736b8328c40e5d77282b0d30de563c3c.
Backport of d1d5c97bc2821bf8c0f4b2d9c7ab16200845b494 from master.
}}}

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

Reply all
Reply to author
Forward
0 new messages