Opened 16 years ago

Closed 16 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: dev
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

Description

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

Download all attachments as: .zip

Change History (3)

by shaun cutts <shaun@…>, 16 years ago

Attachment: operations.patch added

comment:1 by shaun cutts <shaun@…>, 16 years ago

Has patch: set

comment:2 by Malcolm Tredinnick, 16 years ago

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