mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-10 16:44:50 -05:00
upgrade to 1.21.0 view repo on web gives 500 error: GetRecentlyPushedBranches, mssql: Cannot resolve the collation conflict between "Latin1_General_CS_AS" and "Latin1_General_CI_AS" in the equal to operation. #12025
Closed
opened 2025-11-02 09:54:57 -06:00 by GiteaMirror
·
19 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.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rc1
v1.5.0-dev
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.4.0-rc3
v1.4.0-rc2
v1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#12025
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shanepowell on GitHub (Nov 15, 2023).
Description
After upgrading to 1.21.0 and starting the service. Trying to view any repo on the web site displays the following error:
500
GetRecentlyPushedBranches, mssql: Cannot resolve the collation conflict between "Latin1_General_CS_AS" and "Latin1_General_CI_AS" in the equal to operation.
In the log I see:
2023/11/16 07:20:39 ...eb/routing/logger.go:102:func1() [I] router: completed POST /IPFX/OnTrackWeb.git/git-upload-pack for 10.4.0.15:60717, 200 OK in 2586.4ms @ repo/githttp.go:492(repo.ServiceUploadPack)
2023/11/16 07:20:41 ...ers/web/repo/view.go:1000:renderCode() [E] GetRecentlyPushedBranches: mssql: Cannot resolve the collation conflict between "Latin1_General_CS_AS" and "Latin1_General_CI_AS" in the equal to operation.
Gitea Version
1.21.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Setup:
GITEA is installed via chocolatey. So the upgrade was just 'choco upgrade gitea' stop/starting the service around the command.
Database
MSSQL
@KazzmanK commented on GitHub (Nov 15, 2023):
As per
somewhere in this query column collation is different from server collation, or other table collation, resulting in error.
To be absolutely sure, please share your server collation and column collations for tables
pull_requestandissue@SoulSeekkor commented on GitHub (Nov 15, 2023):
If it helps I also have an instance of Gitea running on Windows Server and MSSQL. Currently haven't upgraded yet and still on 1.20.4, but the collation for the database and all text columns in those two tables is SQL_Latin1_General_CP1_CI_AS for us.
@shanepowell commented on GitHub (Nov 16, 2023):
For me, both those tables as: Latin1_General_CI_AS
@R3DST0RM commented on GitHub (Nov 16, 2023):
I do get the same error but with different collation:
pull requestandissuehaveutf8mb4_general_cias column and table collation.Edit:
It seems, that running
gitea doctor convertis able to fix the issue@KazzmanK commented on GitHub (Nov 16, 2023):
What is database collation
and server collation
select convert(sysname, serverproperty(N'collation')) AS [Collation]@KazzmanK commented on GitHub (Nov 16, 2023):
If you run DOCTOR , what is the new outcome of said collations ?
From my perspective, mixing collations in MSSQL is troublesome and exceptional to some specific requirements.
Selever collation
select convert(sysname, serverproperty(N'collation')) AS [Collation]should match database default collation
SELECT name, collation_name FROM sys.databasesand all tables should be with same collation too
select distinct COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS where COLLATION_NAME is not nullIf they are not, anytime it can lead to errors with collation mix.
So , queries must be updated to convert collation or table columns have to be modified
@R3DST0RM commented on GitHub (Nov 16, 2023):
Using doctor all tables and columns got converted to
utf8mb4_general_ci(which in my case is for MySQL)@KazzmanK commented on GitHub (Nov 16, 2023):
for MySql there were changes, especially for utf8mb4
@SoulSeekkor commented on GitHub (Nov 16, 2023):
For me the server collation, databases, and columns are all SQL_Latin1_General_CP1_CI_AS. This is with SQL Server 2019. I haven't done anything with gitea doctor yet, I haven't seen that before.
@lunny commented on GitHub (Nov 16, 2023):
gitea doctor will only fix mysql charactor problem.
@lunny commented on GitHub (Nov 16, 2023):
Please check wether all the columns collation are the same.
If all the column's collations are the same, then check another two tables
pull_requestandissuelike above.@shanepowell commented on GitHub (Nov 16, 2023):
SELECT name, collation_name
FROM sys.databases
Output:
master Latin1_General_CS_AS
tempdb Latin1_General_CS_AS
model Latin1_General_CS_AS
msdb Latin1_General_CS_AS
gitea Latin1_General_CI_AS
select convert(sysname, serverproperty(N'collation')) AS [Collation]
Output:
Latin1_General_CS_AS
SELECT
col.name, col.collation_name
FROM
sys.columns col
WHERE
object_id = OBJECT_ID('branch')
Output:
id NULL
repo_id NULL
name Latin1_General_CI_AS
commit_id Latin1_General_CI_AS
commit_message Latin1_General_CI_AS
pusher_id NULL
is_deleted NULL
deleted_by_id NULL
deleted_unix NULL
commit_time NULL
created_unix NULL
updated_unix NULL
SELECT
col.name, col.collation_name
FROM
sys.columns col
WHERE
object_id = OBJECT_ID('pull_request')
Output:
id NULL
type NULL
status NULL
conflicted_files Latin1_General_CS_AS
commits_ahead NULL
commits_behind NULL
changed_protected_files Latin1_General_CS_AS
issue_id NULL
index NULL
head_repo_id NULL
base_repo_id NULL
head_branch Latin1_General_CS_AS
base_branch Latin1_General_CS_AS
merge_base Latin1_General_CS_AS
allow_maintainer_edit NULL
has_merged NULL
merged_commit_id Latin1_General_CS_AS
merger_id NULL
merged_unix NULL
flow NULL
SELECT
col.name, col.collation_name
FROM
sys.columns col
WHERE
object_id = OBJECT_ID('issue')
Output:
id NULL
repo_id NULL
index NULL
poster_id NULL
original_author Latin1_General_CS_AS
original_author_id NULL
name Latin1_General_CS_AS
content Latin1_General_CS_AS
milestone_id NULL
priority NULL
is_closed NULL
is_pull NULL
num_comments NULL
ref Latin1_General_CS_AS
deadline_unix NULL
created_unix NULL
updated_unix NULL
closed_unix NULL
is_locked NULL
pin_order NULL
I don't know how to run gitea doctor so someone will have to point me to something on how to run that if you think I need to.
@daddy32 commented on GitHub (Nov 21, 2023):
I'm running gitea in docker.
When I run
docker exec srv-captain--git.1.jeglmys2pdkv7v05q7inewhlc gitea doctor convert, I get an error:...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run as root. Sorry. If you need to use privileged TCP ports please instead use setcap and thecap_net_bind_servicepermission.When running without root, I get another -
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:.I'm sure I'm doing something wrong :) But what?
@labronic commented on GitHub (Feb 26, 2024):
Attempt to log into the container, typically using the command
docker exec -ti <name of your Gitea container> /bin/bash.Once inside, execute the commandsu git,followed bygitea doctor convert.Unfortunately, in my case, the result was as follows:
gitea doctor convert
2024/02/26 07:57:55 ...md/doctor_convert.go:32:runDoctorConvert() [I] AppPath: /usr/local/bin/gitea
2024/02/26 07:57:55 ...md/doctor_convert.go:33:runDoctorConvert() [I] AppWorkPath: /data/gitea
2024/02/26 07:57:55 ...md/doctor_convert.go:34:runDoctorConvert() [I] Custom path: /data/gitea
2024/02/26 07:57:55 ...md/doctor_convert.go:35:runDoctorConvert() [I] Log path: /data/gitea/log
2024/02/26 07:57:55 ...md/doctor_convert.go:36:runDoctorConvert() [I] Configuration file: /data/gitea/conf/app.ini
2024/02/26 07:57:55 cmd/main.go:117:func1() [I] [SQL] SELECT 'ALTER TABLE ' + OBJECT_NAME(SC.object_id) + ' MODIFY SC.name NVARCHAR(' + CONVERT(VARCHAR(5),SC.max_length) + ')'
FROM SYS.columns SC
JOIN SYS.types ST
ON SC.system_type_id = ST.system_type_id
AND SC.user_type_id = ST.user_type_id
WHERE ST.name ='varchar' [] - 56.781156ms
2024/02/26 07:57:55 ...md/doctor_convert.go:47:runDoctorConvert() [F] Failed to convert database from varchar to nvarchar: mssql: Incorrect syntax near 'MODIFY'.
2024/02/26 07:57:55 cmd/main.go:117:func1() [I] [SQL] ALTER TABLE upload MODIFY SC.name NVARCHAR(40) [] - 4.071094ms
Version Gitea: 1.21.6
@lunny commented on GitHub (Feb 26, 2024):
What's your mssql version?
@labronic commented on GitHub (Feb 26, 2024):
Hi,
my sql version is 2017
@lunny commented on GitHub (Mar 27, 2024):
I think this should be resolved by #29238
@wxiaoguang commented on GitHub (Mar 27, 2024):
It is not really resolved. Site admin needs to manually convert their database tables/columns to the same collation. There is not builtin tool in Gitea to do the converting.
@lunny commented on GitHub (Sep 3, 2024):
I think this can be resolved by manually converting the collebrations.