#35957: Allow AutoFields in composite primary keys
-------------------------------------+-------------------------------------
     Reporter:  Csirmaz Bendegúz     |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

 * stage:  Unreviewed => Accepted

Comment:

 Hello Ben, thank for your creating this follow up ticket. I'm accepting
 this because of what was discussed and agreed in
 [https://forum.djangoproject.com/t/serialfields-yay-or-nay/32541/21 this
 Forum comment], but I do have a clarification question: in the Forum
 conversation, I understand it boiled down to two options:

 > Item (1) is tracked in ticket-8576, which is open but in a “Design
 Decision Needed” triage state. Allowing primary_key=False in an AutoField
 would enable all DB backends except SQLite to use such a field as part of
 a composite primary key. However, no backend except PostgreSQL supports
 having more than one AutoField. To progress this ticket, we need someone
 to take ownership and propose an outline for the implementation, so it can
 be moved to “Accepted” and enter the review process. Given the nature of
 the change, I fear this may be a longer and slower process.
 > On the other hand, I see value in having a way to define DB-level
 “counters” (independent of composite PKs), which is what item (2)
 addresses. Only PostgreSQL supports this, so I would prefer a PostgreSQL-
 specific field for this feature. While serial is no longer recommended, a
 GeneratedIdentityField in django.contrib.postgres, as suggested by Simon,
 seems like a promising alternative and could be more actionable in the
 short term. I recommend reopening ticket-27452 and repurposing it for this
 feature.

 If I understand correctly, this ticket would be solving item (2) above, so
 we would be providing a Postgresql-specific field, correct?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35957#comment:1>
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/0107019388558ffa-049aa033-5a99-4308-94f8-73a0977701ab-000000%40eu-central-1.amazonses.com.

Reply via email to