ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_issues_on_project_id_and_iid"
gitlab version: 11.9.7-ce.0
I have imported project with external tool called tracboat.
However now noticed that can't create new issues, as it attempts to re-cycle already used iid=3
.
web_1 | 2019-04-29T11:05:23.962966900Z ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_issues_on_project_id_and_iid"
web_1 | 2019-04-29T11:05:23.962999800Z DETAIL: Key (project_id, iid)=(256, 3) already exists.
web_1 | 2019-04-29T11:05:23.963032500Z : INSERT INTO "issues" ("title", "author_id", "project_id", "created_at", "updated_at", "description", "state", "iid", "title_html", "description_html", "relative_position", "cached_markdown_version", "time_estimate") VALUES ('1', 1, 256, '2019-04-29 11:05:23.217881', '2019-04-29 11:05:23.217881', '2', 'opened', 3, '1', '<p data-sourcepos="1:1-1:1" dir="auto">2</p>', 1073742323, 917504, 0) RETURNING "id"):
such row indeed exists, why it tries to use that number?
gitlabhq_production=# select id,iid from issues where project_id=256 and iid=3;
id | iid
------+-----
6653 | 3
(1 row)
where does this "next id" state is stored?
Edited by Elan Ruusamäe