Opened 2 years ago

Closed 2 years ago

#21097 closed Bug (fixed)

IntrospectionTests incorrectly validates an AutoField as an IntegerField

Reported by: manfre Owned by: manfre
Component: Testing framework Version: master
Severity: Normal Keywords: inspectdb
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


The Reporter model doesn't have an explicitly defined primary_key and should have an implicit AutoField(primary_key=True) added to the model.

None of the core backends support introspecting an AutoField, but some 3rd party backends do (django-mssql). I propose adding a new DatabaseFeature can_introspect_autofield that allows backends to decide whether they can distinguish between an AutoField and an IntegerField.

Change History (5)

comment:1 Changed 2 years ago by manfre

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to anonymous
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 2 years ago by manfre

  • Owner changed from anonymous to manfre

comment:3 Changed 2 years ago by manfre

  • Easy pickings set
  • Has patch set

comment:4 Changed 2 years ago by akaariai

  • Triage Stage changed from Unreviewed to Ready for checkin

Seems to be ready. I can likely commit this tomorrow.

comment:5 Changed 2 years ago by Anssi Kääriäinen <anssi.kaariainen@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In c89d80e2cc9bf1f401aa3af4047bdc6f3dc5bfa4:

Fixed #21097 - Added DatabaseFeature.can_introspect_autofield

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