Opened 18 years ago

Closed 18 years ago

#965 closed defect (fixed)

sql sequence reset misses the m2m tables

Reported by: exoweb adrian Owned by: Adrian Holovaty
Component: Core (Management commands) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The sql sequence reset code in django.core.management misses the tables that are generated for the many to many fields.

For example, my Word model is many to many to my Meaning model. Now I have tables "words", "meanings" and "words_meanings". I also have the sequences "words_id_seq", "meanings_id_seq" and "words_meanings_id_seq". I invalidate my id sequences somehow, maybe by manually loading some data into the db, so I have to run the commands given by the get_sql_sequence_reset function. Now the "words_id_seq" and "meanings_id_seq" get fixed, but "words_meanings_id_seq" is still wrong.

This is more a fault of postgresql than django, but it would be nice if the sequence_reset code also worked for those of us with m2m fields in our models.

Change History (2)

comment:1 by exoweb adrian, 18 years ago

In trying to find a fix for this I noticed that the MODEL._meta.get_all_related_many_to_many_objects() method also doesn't work, at least not for my models. Maybe this is also related to ticket #452. (#452 is much more important than this ticket)

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [1517]) Fixed #965 -- 'django-admin.py sqlsequencereset' now includes m2m tables. Thanks for reporting, exoweb adrian

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