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

Fix postgres ID sequences broken by recreate-table #15015

Merged

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Mar 16, 2021

Unfortunately there is a subtle problem with recreatetable on postgres which
leads to the sequences not being renamed and being left at 0.

Fix #14725

Signed-off-by: Andrew Thornton art27@cantab.net

@zeripath zeripath added this to the 1.14.0 milestone Mar 16, 2021
@zeripath
Copy link
Contributor Author

Should be backportable without the migration of course.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 16, 2021
Unfortunately there is a subtle problem with recreatetable on postgres which
leads to the sequences not being renamed and not being left at 0.

Fix go-gitea#14725

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath force-pushed the recreate-table-postgres-sequences branch from eb5759a to 9411c21 Compare March 16, 2021 21:25
@zeripath
Copy link
Contributor Author

zeripath commented Mar 16, 2021

Grargh looks like we can't rely on pg_sequences

I think information_schema.sequences might just work

@lafriks
Copy link
Member

lafriks commented Mar 17, 2021

Fails with relation "pg_sequences" does not exist

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Contributor Author

Should now be fixed

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 17, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 18, 2021
@techknowlogick
Copy link
Member

🚀

@techknowlogick techknowlogick merged commit 070c578 into go-gitea:master Mar 18, 2021
@zeripath zeripath deleted the recreate-table-postgres-sequences branch March 18, 2021 17:20
zeripath added a commit to zeripath/gitea that referenced this pull request Mar 18, 2021
Backport go-gitea#15015

Unfortunately there is a subtle problem with recreatetable on postgres which
leads to the sequences not being renamed and not being left at 0.

Fix go-gitea#14725

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the backport/done All backports for this PR have been created label Mar 18, 2021
6543 pushed a commit that referenced this pull request Mar 19, 2021
Backport #15015

Unfortunately there is a subtle problem with recreatetable on postgres which
leads to the sequences not being renamed and not being left at 0.

Fix #14725

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

postgres ERROR: duplicate key value violates unique constraint "email_hash_pkey"
5 participants