Oracle backend: primary key sequences don't increment if you provide the primary key
|Reported by:||graham_king <graham@…>||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The trigger that the Oracle backend creates on every table only increments the sequence if you don't provide an ID yourself. If you pickle some objects out of one django project / database and unpickle them into another, they already have IDs, so the sequence doesn't move on. Next time you try to add an object (say through the admin interface), the save will fail with a unique primary key violation.
The workaround is the call "SELECT "+ mysequence +".nextval FROM DUAL" every time you save your unpickled object.