#30903 closed Bug (fixed)
Creating an index with specified ordering and opclass results in syntax error.
| Reported by: | Hannes Ljungberg | Owned by: | Hannes Ljungberg |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 2.2 |
| Severity: | Release blocker | Keywords: | db-indexes |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Creating an index on postgres with both order and opclass specified crashes with a syntax error.
index = Index( name=indexname, fields=['-body'], opclasses=['text_pattern_ops'], )
django.db.utils.ProgrammingError: syntax error at or near "text_pattern_ops"
LINE 1: ...rdered" ON "indexes_indexedarticle2" ("body" DESC text_patte...
This is because opclass is supposed to be inserted before ASC | DESC in CREATE INDEX.
See https://www.postgresql.org/docs/current/sql-createindex.html
Change History (5)
comment:1 by , 6 years ago
| Has patch: | set |
|---|
comment:2 by , 6 years ago
| Severity: | Normal → Release blocker |
|---|---|
| Summary: | Creating an index with specified ordering and opclass results in syntax error → Creating an index with specified ordering and opclass results in syntax error. |
| Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
PR: https://github.com/django/django/pull/11966