#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.f46ab506848edd5ec09a30537f338325%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.