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

psycopg2.errors.UndefinedColumn: column "public" does not exist #290

Closed
rahulkp220 opened this issue May 9, 2020 · 2 comments
Closed

psycopg2.errors.UndefinedColumn: column "public" does not exist #290

rahulkp220 opened this issue May 9, 2020 · 2 comments

Comments

@rahulkp220
Copy link

rahulkp220 commented May 9, 2020

Using Django==3.0.4 and Python 3.7.3
I am ok for the issue to be closed if this app doesn't support the versions of django or python I am currently using.

Operations to perform:
  Apply all migrations: notifications
Running migrations:
  Applying notifications.0002_auto_20150224_1134... OK
  Applying notifications.0003_notification_data... OK
  Applying notifications.0004_auto_20150826_1508... OK
  Applying notifications.0005_auto_20160504_1520... OK
  Applying notifications.0006_indexes...Traceback (most recent call last):
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedColumn: column "public" does not exist


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

Traceback (most recent call last):
  File "manage.py", line 19, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 233, in handle
    fake_initial=fake_initial,
  File "/Users/me/Documents/Code/MyApp/env/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 "/Users/me/Documents/Code/MyApp/env/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 "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Users/me/Documents/Code/MyApp/env/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 "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 249, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 565, in alter_field
    old_db_params, new_db_params, strict)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/postgresql/schema.py", line 154, in _alter_field
    new_db_params, strict,
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 756, in _alter_field
    self.execute(self._create_index_sql(model, [new_field]))
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 142, in execute
    cursor.execute(sql, params)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Users/me/Documents/Code/MyApp/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "public" does not exist```
@Carewen
Copy link

Carewen commented Apr 8, 2022

I'm getting this same error with Python 3.10 and Django 4.0.3 when adding a column.

@AlvaroLQueiroz
Copy link
Contributor

The first migration was applied before? Because in your log the migrations are starting from the second file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants