-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
mssql: Cannot call methods on nvarchar. #7652
Comments
The term user is a mssql reserved word so in the FROM and WHERE parts of the query the usage of user must be quoted i.e. user.type = '0' should be "user".type or [user].type |
Thanks. Is there something I can do about this? The query is generated by Gogs. |
No this requires a change in gogs to process this correctly for mssql. I did a local recompile with the following changes, if that helps anyone fix this.
|
Gogs version
Gogs 0.13.0
Git version
git version 2.27.0.windows.1
Operating system
Microsoft Windows Server 2016 Standard
Database
mssql
Describe the bug
After upgrade to 0.13.0 Gogs is no longer operational.
gogs.io/gogs/internal/db/users.go:790 mssql: Cannot call methods on nvarchar.
[5.284ms] [rows:0] SELECT "user"."id","user"."lower_name","user"."name","user"."full_name","user"."email","user"."passwd","user"."login_source","user"."login_name","user"."type","user"."location","user"."website","user"."rands","user"."salt","user"."created_unix","user"."updated_unix","user"."last_repo_visibility","user"."max_repo_creation","user"."is_active","user"."is_admin","user"."allow_git_hook","user"."allow_import_local","user"."prohibit_login","user"."avatar","user"."avatar_email","user"."use_custom_avatar","user"."num_followers","user"."num_following","user"."num_stars","user"."num_repos","user"."description","user"."num_teams","user"."num_members" FROM "user" LEFT JOIN email_address ON email_address.uid = user.id WHERE user.type = '0' AND ((user.email = 'xxx.xxx@xxx.com' AND user.is_active = 1) OR (email_address.email = 'xxx.xxx@xxx.com' AND email_address.is_activated = 1)) ORDER BY "user"."id" OFFSET 0 ROW FETCH NEXT 1 ROWS ONLY
To reproduce
Upgrade to .13.0 from 0.11 on Windows Server with MS SQL DB.
Expected behavior
Gogs working as expeced.
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: