`./manage.py migrate` fails with traceback
Created by: chris34
I wanted to setup a local instance. However, migrate fails with the following traceback:
$ ./manage.py migrate
Operations to perform:
Apply all migrations: archweb_manpages
Running migrations:
Applying archweb_manpages.0001_initial...Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql)
psycopg2.errors.UndefinedObject: FEHLER: Datentyp text hat keine Standardoperatorklasse für Zugriffsmethode »gin«
HINT: Sie müssen für den Index eine Operatorklasse angeben oder eine Standardoperatorklasse für den Datentyp definieren.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 231, in handle
post_migrate_state = executor.migrate(
File "/usr/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python3.8/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/lib/python3.8/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/lib/python3.8/site-packages/django/db/migrations/operations/models.py", line 739, in database_forwards
schema_editor.add_index(model, self.index)
File "/usr/lib/python3.8/site-packages/django/db/backends/postgresql/schema.py", line 174, in add_index
self.execute(index.create_sql(model, self, concurrently=concurrently), params=None)
File "/usr/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 142, in execute
cursor.execute(sql, params)
File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: FEHLER: Datentyp text hat keine Standardoperatorklasse für Zugriffsmethode »gin«
HINT: Sie müssen für den Index eine Operatorklasse angeben oder eine Standardoperatorklasse für den Datentyp definieren.
Sorry, for the traceback being in German. I could not get the language changed, even if i changed the locale. As i searched for a solution myself, i found probably the error message in English, but not a solution…
ERROR: data type text has no default operator class for access method "gin"
HINT: You must specify an operator class for the index or define a default operator class for the data type.
Versions currently installed:
$ pacman -Qi python-psycopg2 postgresql python python-django | egrep 'Name|Version'
Name : python-psycopg2
Version : 2.8.5-1
Name : postgresql
Version : 12.3-2
Name : python
Version : 3.8.3-1
Name : python-django
Version : 3.0.8-2
Hope that helps to debug the problem.