Ticket #2119 (closed defect: fixed)
upgrade-master sets auto-increment counters for id fields incorrectly in postgresql
|Reported by:||szager||Owned by:|
When upgrading master database from 0.7.12 to 0.8.4p1, and creating the new database in postgresql, some of the tables have an 'id' field that uses an auto-increment counter to get a value for newly-added rows; something like this:
CREATE TABLE changes (
changeid PRIMARY KEY DEFAULT nextval('changes_changeid_seq'), ...
The problem is that the state of the counter is set incorrectly after the upgrade. For example, I upgraded a database that had 775 change records. The imported change records had the expected sequential changeid values 1-775, but the 'last_value' field of the changes_changeid_seq counter was 20, rather than the expected 775.
I have seen this in the changes.changeid field and the build.id field.