Opened 10 years ago

Closed 10 years ago

#7600 closed (duplicate)

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

Reported by: Shaun Cutts 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: no UI/UX: no


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@…> 10 years ago.

Download all attachments as: .zip

Change History (3)

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

Attachment: operations.patch added

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

Has patch: set

comment:2 Changed 10 years ago by Malcolm Tredinnick

Resolution: duplicate
Status: newclosed

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

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