-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Error: pq: syntax error at or near "." whilst counting Collaborations without existing user #17485
Comments
CountOrphanedObjects needs to quote the table it is joining with as this table may be `user`. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport go-gitea#17487 CountOrphanedObjects needs to quote the table it is joining with as this table may be `user`. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
CountOrphanedObjects needs to quote the table it is joining with as this table may be `user`. Fix #17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
Are you sure that this is fixed? I'm still getting the error even though I'm running 1.15.7, which supposedly has the fix. |
Is it still the same warning exactly? |
gitea/modules/doctor/dbconsistency.go Line 170 in a9ed1c5
user needs to be backticked in the query at the end |
Yeah, unfortunately there's no specific clarification on the error that lets you see what the specific syntax error is, and it shows up as the same. Maybe worth fixing that as well as the underlying issue. |
Could you apply the following patch and attempt again to see if it solves the problem? diff --git a/modules/doctor/dbconsistency.go b/modules/doctor/dbconsistency.go
index e5f0c5678..cd34994e1 100644
--- a/modules/doctor/dbconsistency.go
+++ b/modules/doctor/dbconsistency.go
@@ -167,13 +167,13 @@ func checkDBConsistency(logger log.Logger, autofix bool) error {
"lfs_lock", "repository", "lfs_lock.repo_id=repository.id"),
// find collaborations without users
genericOrphanCheck("Collaborations without existing user",
- "collaboration", "user", "collaboration.user_id=user.id"),
+ "collaboration", "user", "collaboration.user_id=`user`.id"),
// find collaborations without repository
genericOrphanCheck("Collaborations without existing repository",
"collaboration", "repository", "collaboration.repo_id=repository.id"),
// find access without users
genericOrphanCheck("Access entries without existing user",
- "access", "user", "access.user_id=user.id"),
+ "access", "user", "access.user_id=`user`.id"),
// find access without repository
genericOrphanCheck("Access entries without existing repository",
"access", "repository", "access.repo_id=repository.id"),
|
Although go-gitea#17487 ensured that the table was quoted in the join it missed that the query part of the check also needed to be quoted. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
) Backport go-gitea#18072 Although go-gitea#17487 ensured that the table was quoted in the join it missed that the query part of the check also needed to be quoted. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
CountOrphanedObjects needs to quote the table it is joining with as this table may be `user`. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
) Although go-gitea#17487 ensured that the table was quoted in the join it missed that the query part of the check also needed to be quoted. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
Gitea Version
1.15.6
Git Version
git version 2.20.1
Operating System
Debian 10
How are you running Gitea?
using
deb [arch=amd64] https://packaging.gitlab.io/gitea buster stable
as APT sourceDatabase
PostgreSQL
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
I migrated from Gitea 1.15.2 directly to 1.15.6. If I run the following I get the error.
HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea /usr/bin/gitea -c /etc/gitea/app.ini doctor --all --fix
Anyway, everthing seems to be working fine. The
collaboration
table in the database is empty.Screenshots
No response
The text was updated successfully, but these errors were encountered: