Skip to content

mssql: Error 500 on /watchers & /stars #5482

@22222

Description

@22222
  • Gogs version (or commit ref): 0.11.66
  • Git version: 2.19.1
  • Operating system: Windows
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gogs.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist (usually found in log/gogs.log):

2018/10/16 07:14:21 [ERROR] [.../routes/repo/view.go:331 RenderUserCards()] getter: mssql: Cannot call methods on nvarchar.

Description

This is the same issue as #2176, but with mssql instead of postgresql.

The watchers page runs a query like this with mssql:

SELECT  TOP 40 * FROM "user" LEFT JOIN "watch" ON user.id=watch.user_id WHERE watch.repo_id=1

That results in this error:

Cannot call methods on nvarchar.

The fix in commit 9178993 added double quotes to escape the "user" alias just when setting.UsePostgreSQL is true. That same fix should work here if it's updated to use that quoted version when setting.UseMSSQL is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions