﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30903	Creating an index with specified ordering and opclass results in syntax error.	Hannes Ljungberg	Hannes Ljungberg	"Creating an index on postgres with both order and opclass specified crashes with a syntax error.

{{{#!python
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
"	Bug	closed	Database layer (models, ORM)	2.2	Release blocker	fixed	db-indexes		Accepted	1	0	0	0	0	0
