#34131: Postgres AutoField change from serial to identity
-------------------------------------+-------------------------------------
Reporter: Marco Glauser | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Marco Glauser):
We can confirm that the workaround from Simon is working as expected and
passing all our tests we previously wrote for this specific migration.
Thank you!
While I understand that not every case is supported, the documentation,
including Django 4.0 explicitly specifies that it uses a SERIAL field for
the AutoField on Postgres. (and still is mentioning a sequence in 4.1)
This feels like a big change for a minor feature update buried deep in the
changelog, without any alternative proposed since there is no "official"
SerialField for Django. And to avoid issues, it keeps existing databases
as SERIAL fields. So for us the deeper issue is that while our production
database would happily run with 4.1 because it would still be using SERIAL
under the hood, our unit tests will fail because the new databases use
identity columns.
We originally chose to misuse the AutoField because Django doesn't offer
any SERIAL field and it's easier to patch the default value than to create
the sequences and everything that goes with it ourselves.
--
Ticket URL: <https://code.djangoproject.com/ticket/34131#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070184569dcf22-472e3cf9-5470-409f-875a-5046bd356807-000000%40eu-central-1.amazonses.com.