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

Django 4.2 requires PostgreSQL 12+ #19446

Open
1 task done
aminmaghsodi opened this issue Oct 9, 2023 · 10 comments
Open
1 task done

Django 4.2 requires PostgreSQL 12+ #19446

aminmaghsodi opened this issue Oct 9, 2023 · 10 comments
Labels
area/ecosystem Label for all ecosystem related projects kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@aminmaghsodi
Copy link

aminmaghsodi commented Oct 9, 2023

Jira Link: DB-8237

Description

Hi, Django v4 was launched and it is now on 4.2.6
When I startup my application with the below config,
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'db', 'USER': 'user', 'PASSWORD': 'lJUD0YCB', 'HOST': '10.10.10.1', 'PORT': '5433', } }

it says: django.db.utils.NotSupportedError: PostgreSQL 12 or later is required (found 11.2).
I am now on latest version of Yugabyte. 2.18

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@aminmaghsodi aminmaghsodi added area/ecosystem Label for all ecosystem related projects area/ybd yugabyted project related Github tickets. status/awaiting-triage Issue awaiting triage labels Oct 9, 2023
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue labels Oct 9, 2023
@ddorian
Copy link
Contributor

ddorian commented Oct 9, 2023

@aminmaghsodi

Please paste the full error trace

@aminmaghsodi aminmaghsodi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
@aminmaghsodi aminmaghsodi reopened this Oct 9, 2023
@aminmaghsodi
Copy link
Author

aminmaghsodi commented Oct 9, 2023

I think it is because of using array field in model and it is an open issue on yugabyte, isn't it?

 File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.FeatureNotSupported: This ALTER TABLE command is not yet supported.

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 "/home/amin/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/amin/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/amin/venv/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/amin/venv/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/home/amin/venv/lib/python3.8/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/home/amin/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/migrations/operations/fields.py", line 108, in database_forwards
    schema_editor.add_field(
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 712, in add_field
    self.execute(sql, params)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
    return super().execute(sql, None)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/amin/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
django.db.utils.NotSupportedError: This ALTER TABLE command is not yet supported.`

@ddorian
Copy link
Contributor

ddorian commented Oct 9, 2023

Can you print the migration query that is failing?

@yugabyte-ci yugabyte-ci removed area/ybd yugabyted project related Github tickets. status/awaiting-triage Issue awaiting triage labels Oct 10, 2023
@aminmaghsodi
Copy link
Author

Actually it is django that raise the Error. it does not support postgres version lower than 12.
For example you can clone this CRUD project from github, then change django version to 4.2.6. then it raises the bellow error:
File "/home/amin/projects/Django-CRUD-Operations-Using-PostgreSQL/vnv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 214, in check_database_version_supported raise NotSupportedError( django.db.utils.NotSupportedError: PostgreSQL 12 or later is required (found 11.2).

@aminmaghsodi
Copy link
Author

I have tested some Django CRUD projects on yugabyte.
Actually yugabyte just works with Django version lower than 4.

@ddorian ddorian changed the title Support yugabyte for django v4 and higher Django 4.2 requires PostgreSQL 12+ Oct 16, 2023
@ddorian
Copy link
Contributor

ddorian commented Oct 16, 2023

Looks like support was dropped in 4.2 https://docs.djangoproject.com/en/4.2/releases/4.2/#dropped-support-for-postgresql-11

This will be available in #9797

@ddorian
Copy link
Contributor

ddorian commented Oct 16, 2023

Maybe we can disable this check in https://github.com/yugabyte/yb-django ?

cc @Sfurti-yb @nmalladi

@aminmaghsodi
Copy link
Author

Anyone any help?

@ashetkar
Copy link
Contributor

@aminmaghsodi We'll have to see if simply removing the version check is possible and check if it breaks anything. cc @Sfurti-yb. If not, we'll have to wait until #9797 gets resolved. We will get back on this soon.

@Sfurti-yb
Copy link
Contributor

Using the YugabyteDB backend for django should resolve this issue. The version check for it requires minimum database version as postgresql 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ecosystem Label for all ecosystem related projects kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

5 participants