Skip to content

Search returns 500 error with MSSQL #5148

@izzor

Description

@izzor
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions