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

Standard Django migrations use RETURNING syntax that is not supported #1259

Open
timsehn opened this issue Mar 6, 2025 · 0 comments
Open

Comments

@timsehn
Copy link
Collaborator

timsehn commented Mar 6, 2025

  File "/opt/homebrew/lib/python3.13/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
django.db.utils.InternalError: RETURNING is not yet supported

Repro:

  1. Clone: https://github.com/dolthub/dolt_django
  2. Install psycopg2
  3. Apply the following diff to settings.py
$ git diff
diff --git a/dolt_django/settings.py b/dolt_django/settings.py
index 338a28e..621176b 100644
--- a/dolt_django/settings.py
+++ b/dolt_django/settings.py
@@ -77,12 +77,12 @@ WSGI_APPLICATION = 'dolt_django.wsgi.application'
 # https://docs.djangoproject.com/en/5.0/ref/settings/#databases
 DATABASES = {
     'default': {
-        "ENGINE": "django.db.backends.mysql",
+        "ENGINE": "django.db.backends.postgresql",
         "NAME": "mydatabase",
-        "USER": "root",
-        "PASSWORD": "",
+        "USER": "postgres",
+        "PASSWORD": "password",
         "HOST": "127.0.0.1",
-        "PORT": "3306",
+        "PORT": "5432",
     }
 }
  1. Create mydatabase in doltgres
  2. Run python manage.py migrate

Here's the sql query actually being run:

DEBU[0024] Received message: {"Type":"Query","String":"INSERT INTO \"django_migrations\" (\"app\", \"name\", \"applied\") VALUES ('contenttypes', '0001_initial', '2025-03-06T18:53:38.321528+00:00'::timestamptz) RETURNING \"django_migrations\".\"id\""} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant