Opened 4 months ago

Closed 4 months ago

#33021 closed Bug (invalid)

Migration crashes when GIN index with gin_trgm_ops is used

Reported by: Aleksei khatkevich Owned by: nobody
Component: Database layer (models, ORM) Version: 3.2
Severity: Normal Keywords: gin OpClass
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have an index like following:

                OpClass(Upper('text_id'), name='gin_trgm_ops'),

Migration file creates without any troubles on it.

sqlmigrate generates following SQL:

CREATE INDEX "text_id_idx" ON "auction_lot" USING gin ((UPPER("text_id") gin_trgm_ops));

which obviously has one extra set of (), which causes following exception during migration

django.db.utils.ProgrammingError: syntax error at or near "gin_trgm_ops"
LINE 1: ...dx" ON "auction_lot" USING gin ((UPPER("text_id") gin_trgm_o...

Change History (1)

comment:1 Changed 4 months ago by Mariusz Felisiak

Component: MigrationsDatabase layer (models, ORM)
Resolution: invalid
Status: newclosed

Thanks for this ticket, however you're seeing this error because of not adding django.contrib.postgres to INSTALLED_APPS, see OpClass() docs and related ticket #32770.

Note: See TracTickets for help on using tickets.
Back to Top