Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Migration Error #103

Open
mzch opened this issue Aug 6, 2022 · 5 comments
Open

[BUG] Migration Error #103

mzch opened this issue Aug 6, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@mzch
Copy link

mzch commented Aug 6, 2022

Describe the bug

When running DJANGO_SETTINGS_MODULE=settings.config python manage.py migrate --noinput, the following error occurred. This seems to happen using PostgreSQL 14 or later. Ref. mailing list article

Running migrations:
  Applying projects.0046_triggers_to_update_tags_colors...Traceback (most recent call last):
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.UndefinedFunction: function array_cat(anyarray, anyarray) does not exist


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/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 "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/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 "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/migrations/operations/special.py", line 105, in database_forwards
    self._run_sql(schema_editor, self.sql)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/migrations/operations/special.py", line 130, in _run_sql
    schema_editor.execute(statement, params=None)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 137, in execute
    cursor.execute(sql, params)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/raven/contrib/django/client.py", line 127, in execute
    return real_execute(self, sql, params)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/srv/taiga/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: function array_cat(anyarray, anyarray) does not exist

How can we reproduce the behavior

Run DJANGO_SETTINGS_MODULE=settings.config python manage.py migrate --noinput

Workarounds

Screenshots

None.

Taiga environment

  • Self-Hosted from source code.
  • PostgreSQL: 14.4

Additional context

@mzch mzch added the bug Something isn't working label Aug 6, 2022
@giorgi17
Copy link

Same error, not working!

@giorgi17
Copy link

giorgi17 commented Feb 21, 2023 via email

@fady-shafeek
Copy link

facing the same error, did you find a solution?

@giorgi17
Copy link

giorgi17 commented Mar 9, 2023 via email

@FelipeSo
Copy link

FelipeSo commented Oct 28, 2023

I solved it using a docker container for the postgres database and changing the database port in the /settings/common.py file as showed below.

I added a docker-compose file in the root folder (above taiga-back) (I don't know if the location matters but worth mention)
The docker-compose.yml :

version: '3.5'

services:
  taiga-db-2:
    container_name: taiga-db-2
    image: postgres:12.3
    restart: always
    environment:
      POSTGRES_DB: taiga
      POSTGRES_USER: taiga
      POSTGRES_PASSWORD: taiga
    ports:
      - "5433:5432"
    volumes:
      - taiga-db-data-2:/var/lib/posrgresql/data
volumes:
  taiga-db-data-2:

Then did docker compose up to run the container

Is worth mention that i ran this code: sudo netstat -nl | grep postgres to check in what port was postgres running, and it showed that it was running in port 5432

I had the database port configured like this, to work with the port that I thought was the appropiate:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": "taiga",
        "USER": "taiga",
        "PASSWORD": "taiga",
        "HOST": "127.0.0.1",
        'PORT': '5432'
    }
}

Then I changed the port to 5433 and it works (when the docker container from above is running):

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": "taiga",
        "USER": "taiga",
        "PASSWORD": "taiga",
        "HOST": "127.0.0.1",
        'PORT': '5433'
    }
}

After this changes the migration ran without error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants