#36985 new Bug

Reversing CreateExtension throws error on non-postgresql database

Reported by: Jori Niemi Owned by:
Component: contrib.postgres Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When run on sqlite, a migration using postgres CreateExtension will skip creating the extension. Trying to reverse the migration throws an error:

django.db.utils.OperationalError: no such table: pg_extension

I assume this is because CreateExtension.database_forwards checks schema_editor.connection.vendor != "postgresql" but CreateExtension.database_backwards does not.

Minimal migration example:

from django.db import migrations
from django.contrib.postgres.operations import CreateExtension

class Migration(migrations.Migration):
    dependencies = []

    operations = [
        CreateExtension("pg_trgm")
    ]

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top