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

creating issue cause an error 500 #16814

Closed
2 of 6 tasks
homburgs opened this issue Aug 24, 2021 · 5 comments
Closed
2 of 6 tasks

creating issue cause an error 500 #16814

homburgs opened this issue Aug 24, 2021 · 5 comments

Comments

@homburgs
Copy link

homburgs commented Aug 24, 2021

  • Gitea version (or commit ref): 1.15.0
  • Git version:
  • Operating system: Ubuntu 10.18-0ubuntu0.18.04.1
  • Database (use [x]):
    • PostgreSQL 9.3.24
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes
    • No
  • Log gist:
    2021/08/24 23:51:38 ...rs/web/repo/issue.go:983:NewIssuePost() [E] NewIssue: generate issue index failed: pq: syntax error at or near "ON"
    2021/08/24 23:51:38 ...s/context/context.go:185:HTML() [D] Template: status/500

Description

After submitting the new issue form the error 500 occurred

@noerw
Copy link
Member

noerw commented Aug 25, 2021

Looks like postgres doesn't like this statement (introduced in #15599)

gitea/models/index.go

Lines 29 to 32 in 06f8264

case setting.Database.UseSQLite3 || setting.Database.UsePostgreSQL:
_, err = e.Exec(fmt.Sprintf("INSERT INTO %s (group_id, max_index) "+
"VALUES (?,1) ON CONFLICT (group_id) DO UPDATE SET max_index = %s.max_index+1",
tableName, tableName), groupID)

edit: your postgres version is old, you may want to consider upgrading (not sure what the minimum supported version by gitea is, I suspect 10)

@noerw noerw added the type/bug label Aug 25, 2021
@noerw noerw added this to the 1.15.1 milestone Aug 25, 2021
@zeripath
Copy link
Contributor

ON CONFLICT was added to Postgres in version 9.5.

I'm not sure we can really support postgres that does not have this

@noerw noerw removed the type/bug label Aug 25, 2021
@noerw noerw removed this from the 1.15.1 milestone Aug 25, 2021
@lunny
Copy link
Member

lunny commented Aug 25, 2021

Since postgres has coming into v12, I think v9.5 is the minimal requirement. I myself had tested this PR before it merged in my postgres 9.5 instance.

@BastienVigneron
Copy link

Hello,

After migrating on gitea 1.15.1 with postgres 12 :

2021-09-03 12:16:59.748 UTC [36] ERROR:  there is no unique or exclusion constraint matching the ON CONFLICT specification
2021-09-03 12:16:59.748 UTC [36] STATEMENT:  INSERT INTO issue_index (group_id, max_index) VALUES ($1,1) ON CONFLICT (group_id) DO UPDATE SET max_index = issue_index.max_index+1

@zeripath
Copy link
Contributor

zeripath commented Sep 3, 2021

See: #16936

gitea doctor recreate-table issue_index

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants