Search returns 500 error with MSSQL #2432

Closed
opened 2025-11-02 04:35:58 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @izzor on GitHub (Oct 23, 2018).

  • Gitea version (or commit ref): 1.6
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [] Not relevant
  • Log gist:
    [2018/10/23 09:58:55 [I] [SQL] SELECT TOP 20 repository.* FROM "repository" LEFT JOIN repo_topic ON repo_topic.repo_id = repository.id LEFT JOIN topic ON repo_topic.topic_id = topic.id WHERE (owner_id=? OR ((repository.id IN (SELECT repo_id FROM "access" WHERE access.user_id = ?)) AND owner_id<>?) OR is_private=?) AND (lower_name LIKE ? OR topic.name LIKE ?) GROUP BY repository.id ORDER BY repository.updated_unix DESC []interface {}{2, 2, 2, false, "%foobar%", "%foobar%"}]
    [2018/10/23 09:58:55 [...itea/routers/home.go:138 RenderRepoSearch()] [E] SearchRepositoryByName: Repo: mssql: Column 'repository.owner_id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.]

Description

When using the search field under Explore / Repositories I get a 500, Internal Server Error. I checked the log files and found the query causing the error.
In MS SQL Server all columns must be specified in the Group By clause. MySQL allows it but I guess it may be a problem with other database dialects as well.

Originally created by @izzor on GitHub (Oct 23, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.6 - Git version: 2.7.4 - Operating system: Ubuntu 16.04 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [X] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - [] Not relevant - Log gist: [`2018/10/23 09:58:55 [I] [SQL] SELECT TOP 20 repository.* FROM "repository" LEFT JOIN repo_topic ON repo_topic.repo_id = repository.id LEFT JOIN topic ON repo_topic.topic_id = topic.id WHERE (owner_id=? OR ((repository.id IN (SELECT repo_id FROM "access" WHERE access.user_id = ?)) AND owner_id<>?) OR is_private=?) AND (lower_name LIKE ? OR topic.name LIKE ?) GROUP BY repository.id ORDER BY repository.updated_unix DESC []interface {}{2, 2, 2, false, "%foobar%", "%foobar%"}`] [`2018/10/23 09:58:55 [...itea/routers/home.go:138 RenderRepoSearch()] [E] SearchRepositoryByName: Repo: mssql: Column 'repository.owner_id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.`] ## Description When using the search field under Explore / Repositories I get a 500, Internal Server Error. I checked the log files and found the query causing the error. In MS SQL Server all columns must be specified in the Group By clause. MySQL allows it but I guess it may be a problem with other database dialects as well.
GiteaMirror added the type/bug label 2025-11-02 04:35:58 -06:00
Author
Owner

@alexmejiaec commented on GitHub (Oct 23, 2018):

bump

@alexmejiaec commented on GitHub (Oct 23, 2018): bump
Author
Owner

@lunny commented on GitHub (Oct 24, 2018):

https://github.com/go-gitea/gitea/pull/5136 will try to fix this issue.

@lunny commented on GitHub (Oct 24, 2018): https://github.com/go-gitea/gitea/pull/5136 will try to fix this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2432