> Sorry, I should have been more clear. > > What I'm trying to do is solicit suggestions from django developers as > to how I *can* move ticket #1946 forward. I can find a way to work > around it in my own project, but it would be ideal to solve it on the > Django side, for everybody. > > I mentioned there were three possible suggestions in the ticket > discussion as to how to solve the problem. If a Django developer can > give me some guidance as to what approach seems to be the best long-term > solution, I'm happy to try my hand at writing a patch that can hopefully > be incorporated into the codebase.
Django doesn't expect the sequence name to be tablename_columname_seq, at least not in trunk. The last_insert_id method in backends/ postgresql/operations.py uses select currval(pg_get_serial_sequence(tablename, columname)). pg_get_serial_sequence will return the correct sequence only if the sequence is owned by the tablename, columname combination. If you happen to have just one table per sequence, then issuing ALTER SEQUENCE sequencename OWNED BY tablename.columname; should fix the problem. There is one more proposal in ticket #13295. The proposed solution should allow using the same sequence for multiple tables, though management of the manually defined sequence is a bit hard when trying to build the schema and when resetting the sequence. Sorry if the proposal is a bit hard to follow... I don't know well enough how databases other than postgresql work, so I don't know if the solution is valid for other databases. - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.