Gitea 1.15 does not work on postgres <9.5: Submitting a new issue gives 500 error #7855

Closed
opened 2025-11-02 07:39:18 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @artu72 on GitHub (Sep 16, 2021).

Gitea Version

1.15.2

Git Version

2.16.5

Operating System

Linux RHEL 7.6

How are you running Gitea?

Downloaded the 64bit version binary Linux executable, and running it as a service.

Database

PostgreSQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

2021/09/16 10:00:32 models/issue.go:1012:NewIssue() [I] [SQL] ROLLBACK [] - 40.9
49µs
2021/09/16 10:00:32 ...rs/web/repo/issue.go:980:NewIssuePost() [E] NewIssue: gen
erate issue index failed: pq: syntax error at or near "ON"

Description

Updated from gitea 1.14.6 to 1.15.2. Now, creating a new issue in every repository gives a 500 error.

Screenshots

No response

Originally created by @artu72 on GitHub (Sep 16, 2021). ### Gitea Version 1.15.2 ### Git Version 2.16.5 ### Operating System Linux RHEL 7.6 ### How are you running Gitea? Downloaded the 64bit version binary Linux executable, and running it as a service. ### Database PostgreSQL ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist 2021/09/16 10:00:32 models/issue.go:1012:NewIssue() [I] [SQL] ROLLBACK [] - 40.9 49µs 2021/09/16 10:00:32 ...rs/web/repo/issue.go:980:NewIssuePost() [E] NewIssue: gen erate issue index failed: pq: syntax error at or near "ON" ### Description Updated from gitea 1.14.6 to 1.15.2. Now, creating a new issue in every repository gives a 500 error. ### Screenshots _No response_
GiteaMirror added the issue/not-a-bug label 2025-11-02 07:39:18 -06:00
Author
Owner

@zeripath commented on GitHub (Sep 17, 2021):

what version of Postgres are you running?

@zeripath commented on GitHub (Sep 17, 2021): what version of Postgres are you running?
Author
Owner

@zeripath commented on GitHub (Sep 17, 2021):

The SQL this is failing on is:

INSERT INTO issue_index (group_id, max_index) "+
			"VALUES (?,1) ON CONFLICT (group_id) DO UPDATE SET max_index = issue_index.max_index+1

which implies you have a version of Postgres that does not support ON CONFLICT

This has been present in Postgres since version 9.5 which itself is so old that it is unsupported by Postgres.

You need to upgrade your version of Postgres.

@zeripath commented on GitHub (Sep 17, 2021): The SQL this is failing on is: ```sql INSERT INTO issue_index (group_id, max_index) "+ "VALUES (?,1) ON CONFLICT (group_id) DO UPDATE SET max_index = issue_index.max_index+1 ``` which implies you have a version of Postgres that does not support ON CONFLICT This has been present in Postgres since version 9.5 which itself is so old that it is unsupported by Postgres. You need to upgrade your version of Postgres.
Author
Owner

@artu72 commented on GitHub (Sep 17, 2021):

what version of Postgres are you running?

9.2. So i will try to update postgres. I'll report you, thanks.

@artu72 commented on GitHub (Sep 17, 2021): > what version of Postgres are you running? 9.2. So i will try to update postgres. I'll report you, thanks.
Author
Owner

@zeripath commented on GitHub (Sep 17, 2021):

I don't think we state anywhere what the minimal supported version of postgres is but I think it's entirely reasonable to set that at at least 9.5.

I guess we need to detect the version of postgres at time of startup and warn users and update the documentation.

@zeripath commented on GitHub (Sep 17, 2021): I don't think we state anywhere what the minimal supported version of postgres is but I think it's entirely reasonable to set that at at least 9.5. I guess we need to detect the version of postgres at time of startup and warn users and update the documentation.
Author
Owner

@zeripath commented on GitHub (Sep 17, 2021):

I've retitled the bug - so a PR doing the above could reference this issue and close it.

@zeripath commented on GitHub (Sep 17, 2021): I've retitled the bug - so a PR doing the above could reference this issue and close it.
Author
Owner

@artu72 commented on GitHub (Sep 17, 2021):

I've retitled the bug - so a PR doing the above could reference this issue and close it.

Ok, thank you for the effort. Ii is fine to specify minimum requirements of the database from now on. However, my only issue is the creation of a issue, git interation is still ok.

@artu72 commented on GitHub (Sep 17, 2021): > I've retitled the bug - so a PR doing the above could reference this issue and close it. Ok, thank you for the effort. Ii is fine to specify minimum requirements of the database from now on. However, my only issue is the creation of a issue, git interation is still ok.
Author
Owner

@zeripath commented on GitHub (Sep 17, 2021):

Yeah unfortunately we absolutely have to have postgres >= 9.5.

I've added a docs PR so I will close this now.

@zeripath commented on GitHub (Sep 17, 2021): Yeah unfortunately we absolutely have to have postgres >= 9.5. I've added a docs PR so I will close this now.
Author
Owner

@artu72 commented on GitHub (Sep 21, 2021):

I confirm that upgrading postgres to 9.6 solved the problem.

@artu72 commented on GitHub (Sep 21, 2021): I confirm that upgrading postgres to 9.6 solved the problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7855