#36466: Relax check E042 preventing including stored generated fields in 
composite
primary keys
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                     Type:
                                     |  Cleanup/optimization
       Status:  new                  |                Component:
                                     |  Uncategorized
      Version:  dev                  |                 Severity:  Normal
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 Currently E042 prevents including `GeneratedField` in a
 `CompositePrimaryKey`.

 Postgres & MySQL are both fine with including stored generated columns in
 primary keys, including when foreign keys reference these pks.  Postgres
 (18) & MySQL both reject the inclusion of virtual generated columns.

 SQLite doesn't allow generated columns altogether:
 https://www.sqlite.org/gencol.html#limitations

 I don't have an Oracle instance to test with.

 Django should not get in the way of a valid database operations for
 vendors that do support a feature. I realise that `--skip-checks` can be
 passed in but then we'd be bypassing other useful checks for the lifetime
 of a codebase.

 Personally I believe we should remove the generated columns part of E042
 altogether as the user will find out the mistake soon enough when the
 database complains during migration.

 Another option may be to just only check for virtual generated columns.

 Forum thread: https://forum.djangoproject.com/t/can-we-relax-the-
 restriction-e042-on-including-generated-fields-in-composite-pks/41438
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36466>
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 visit 
https://groups.google.com/d/msgid/django-updates/010701977b01d720-d8af68d5-e938-41f1-b85d-de2f87b6832c-000000%40eu-central-1.amazonses.com.

Reply via email to