Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence problems in breedbase db #5

Open
bellerbrock opened this issue Jan 15, 2020 · 0 comments
Open

Sequence problems in breedbase db #5

bellerbrock opened this issue Jan 15, 2020 · 0 comments

Comments

@bellerbrock
Copy link
Member

Many sequences in the empty breedbase db are not reset, and some of them are out of sync with what data there is, causing problems.

For example even though there is a single example project row in the project table with a project_id of 1, SELECT last_value FROM project_project_id_seq; returns 324.

More importantly the single row in the projectprop table used projectprop_id 456. SELECT last_value FROM projectprop_projectprop_id_seq; returns 455, meaning any additions to the table will increment the seq to 456 and run into a duplicate key value violates unique constraint "projectprop_pkey" error.

To fix the problem for the project tables I ended up just manually deleting the example program and prop, then reset the sequences:

breedbase=# delete from projectprop where project_id = 1;
DELETE 1
breedbase=# delete from project where project_id = 1;
DELETE 1
breedbase=# alter sequence project_project_id_seq restart with 1;
ALTER SEQUENCE
breedbase=# alter sequence projectprop_projectprop_id_seq restart with 1;
ALTER SEQUENCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant