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

postgres error: duplicate key value violates unique constraint "email_hash_pkey" #15451

Closed
2 of 6 tasks
ntlspck opened this issue Apr 13, 2021 · 1 comment · Fixed by #15457
Closed
2 of 6 tasks

postgres error: duplicate key value violates unique constraint "email_hash_pkey" #15451

ntlspck opened this issue Apr 13, 2021 · 1 comment · Fixed by #15457

Comments

@ntlspck
Copy link

ntlspck commented Apr 13, 2021

  • Gitea version (or commit ref): v1.13.7 built with GNU Make 4.3, go1.16.3
  • Git version: 2.26.3
  • Operating system: Raspbian GNU/Linux 10, docker kunde21/gitea-arm v1.13.7-armv7
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No

Description

I already opened #14725 and also referring to #12577 and #12287
These issues are closed and a fix released, but it still doesn't fix my duplicate key violation errors.

Using gitea 1.13.7 and postgres 13.0 showing the following reoccuring errors:

2021-04-13 10:06:38.184 UTC [32] ERROR: duplicate key value violates unique constraint "email_hash_pkey"
2021-04-13 10:06:38.184 UTC [32] DETAIL: Key (hash)=(xxxxxxxxxxxxxxxxxxxx) already exists.
2021-04-13 10:06:38.184 UTC [32] STATEMENT: INSERT INTO "email_hash" ("hash","email") VALUES ($1,$2)

Schema Name Type
public email_address table
public email_address_id_seq sequence
public email_hash table

What somebody from previous tickets told me to do, but won't fix the duplicate key violation:

  • gitea doctor recreate-table
  • updating sequences (although email_hash has no sequence! so this suggestion makes no sense)
@zeripath
Copy link
Contributor

I mean - it's in a transaction - it's supposed to fail.

Fine I'll query the bloody db before inserting.

zeripath added a commit to zeripath/gitea that referenced this issue Apr 13, 2021
Some postgres users have logging which logs even failed transactions. So
just query the db before trying to insert.

Fix go-gitea#15451

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue Apr 15, 2021
Some postgres users have logging which logs even failed transactions. So
just query the db before trying to insert.

Fix #15451

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
zeripath added a commit to zeripath/gitea that referenced this issue Apr 15, 2021
…#15457)

Backport go-gitea#15457

Some postgres users have logging which logs even failed transactions. So
just query the db before trying to insert.

Fix go-gitea#15451

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
techknowlogick pushed a commit that referenced this issue Apr 15, 2021
…15491)

Backport #15457

Some postgres users have logging which logs even failed transactions. So
just query the db before trying to insert.

Fix #15451

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Jun 4, 2021
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 10, 2021
…#15457)

Some postgres users have logging which logs even failed transactions. So
just query the db before trying to insert.

Fix go-gitea#15451

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants