Opened 7 years ago

Closed 7 years ago

#7600 closed (duplicate)

bug in postresql sequence_reset_sql causes "loaddata" to fail for derived class with alternate primary key

Reported by: shauncutts Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


django.db.backends.postgresql.operations.sequence_reset.sql loops over "fields" when searching for primary keys:

            for f in model._meta.fields:

But it should loop only over fields specific to that class:

            for f in model._meta.local_fields:

With this fix, loaddata works on such derived models.

Attachments (1)

operations.patch (975 bytes) - added by shaun cutts <shaun@…> 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by shaun cutts <shaun@…>

comment:1 Changed 7 years ago by shaun cutts <shaun@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by mtredinnick

  • Resolution set to duplicate
  • Status changed from new to closed

Looks like a dupe of #7565, which was fixed in [7789].

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