#29778 closed Bug (fixed)
Unique index cannot be created for db table, whose name should be quoted
| Reported by: | Oleg | Owned by: | Oleg |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 2.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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.
Change History (5)
comment:1 by , 7 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Uncategorized → Bug |
comment:2 by , 7 years ago
comment:3 by , 7 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
PR