Error 1054: Unknown column 'INFORMATION_SCHEMA.COLUMNS.ORDINAL_POSITION' in 'order clause' #1743

Closed
opened 1 year ago by zuosc · 2 comments
zuosc commented 1 year ago

Detail here : https://github.com/go-gitea/gitea/issues/12267

when I use watchtower update gitea , it error.

2020/07/17 00:00:23 ...dules/setting/log.go:343:newLogService() [I] Gitea Log Mode: File(File:info)
2020/07/17 00:00:23 ...les/setting/cache.go:70:newCacheService() [I] Cache Service Enabled
2020/07/17 00:00:23 ...les/setting/cache.go:81:newCacheService() [I] Last Commit Cache Service Enabled
2020/07/17 00:00:23 ...s/setting/session.go:63:newSessionService() [I] Session Service Enabled
2020/07/17 00:00:23 ...es/setting/mailer.go:109:newMailService() [I] Mail Service Enabled
2020/07/17 00:00:23 ...es/setting/mailer.go:120:newRegisterMailService() [I] Register Mail Service Enabled
2020/07/17 00:00:23 ...es/setting/mailer.go:131:newNotifyMailService() [I] Notify Mail Service Enabled
2020/07/17 00:00:25 routers/init.go:64:initDBEngine() [I] Beginning ORM engine initialization.
2020/07/17 00:00:25 routers/init.go:71:initDBEngine() [I] ORM engine initialization attempt #1/10...
2020/07/17 00:00:25 ...rm/session_schema.go:25:Ping() [I] PING DATABASE mysql
2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? [giteadb version] - 3.189577ms
2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [giteadb version id] - 2.959628ms
2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [giteadb version version] - 2.821551ms
2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 [1] - 944.612µs
2020/07/17 00:00:25 ...ations/migrations.go:306:Migrate() [I] Migration[140]: Save detected language file size to database instead of percent
2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `TABLE_NAME`, `ENGINE`, `AUTO_INCREMENT`, `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [giteadb] - 6.760164ms
2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `COLUMN_NAME`, `IS_NULLABLE`, `COLUMN_DEFAULT`, `COLUMN_TYPE`, `COLUMN_KEY`, `EXTRA`,`COLUMN_COMMENT` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? ORDER BY `INFORMATION_SCHEMA`.`COLUMNS`.ORDINAL_POSITION [giteadb language_stat] - 1.616564ms
2020/07/17 00:00:25 routers/init.go:77:initDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: Sync2: Error 1054: Unknown column 'INFORMATION_SCHEMA.COLUMNS.ORDINAL_POSITION' in 'order clause'
2020/07/17 00:00:25 routers/init.go:78:initDBEngine() [I] Backing off for 3 seconds
Server listening on :: port 22.
Server listening on 0.0.0.0 port 22.
2020/07/17 08:12:11 cmd/web.go:107:runWeb() [I] Starting Gitea on PID: 16
2020/07/17 08:12:11 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled
2020/07/17 08:12:11 routers/init.go:119:GlobalInit() [T] AppPath: /app/gitea/gitea
2020/07/17 08:12:11 routers/init.go:120:GlobalInit() [T] AppWorkPath: /app/gitea
2020/07/17 08:12:11 routers/init.go:121:GlobalInit() [T] Custom path: /data/gitea
2020/07/17 08:12:11 routers/init.go:122:GlobalInit() [T] Log path: /data/gitea/log
Received signal 15; terminating.

watchtower info:

time="2020-07-17T07:43:54Z" level=info msg="Running a one time update."
time="2020-07-17T07:43:56Z" level=info msg="Found new gitea/gitea:latest image (sha256:be1649af755b46b7c82a03b265fd96c59678c587aa509ceb94f21556c2b87e03)"
time="2020-07-17T07:43:56Z" level=info msg="Stopping /gitea (f6b0bcab9cc0843dc48fb4d85c04bc3acffbecfc0f4a0066e957a05142f38ed9) with SIGTERM"
time="2020-07-17T07:44:05Z" level=info msg="Creating /gitea"

MySQL info:

user docker image

Image details

ID | sha256:b8fd9553f1f06e56173db706cf47dfc64ae3a7aeb213cc0e4fc476983b62bf16 
Size | 444.7 MB
Created | 2019-09-12 12:24:43
Build | Docker 18.06.1-ce on linux, amd64

ENV

PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GOSU_VERSION | 1.7
MYSQL_MAJOR | 8.0
MYSQL_VERSION | 8.0.17-1debian9
Detail here : https://github.com/go-gitea/gitea/issues/12267 when I use watchtower update gitea , it error. ``` 2020/07/17 00:00:23 ...dules/setting/log.go:343:newLogService() [I] Gitea Log Mode: File(File:info) 2020/07/17 00:00:23 ...les/setting/cache.go:70:newCacheService() [I] Cache Service Enabled 2020/07/17 00:00:23 ...les/setting/cache.go:81:newCacheService() [I] Last Commit Cache Service Enabled 2020/07/17 00:00:23 ...s/setting/session.go:63:newSessionService() [I] Session Service Enabled 2020/07/17 00:00:23 ...es/setting/mailer.go:109:newMailService() [I] Mail Service Enabled 2020/07/17 00:00:23 ...es/setting/mailer.go:120:newRegisterMailService() [I] Register Mail Service Enabled 2020/07/17 00:00:23 ...es/setting/mailer.go:131:newNotifyMailService() [I] Notify Mail Service Enabled 2020/07/17 00:00:25 routers/init.go:64:initDBEngine() [I] Beginning ORM engine initialization. 2020/07/17 00:00:25 routers/init.go:71:initDBEngine() [I] ORM engine initialization attempt #1/10... 2020/07/17 00:00:25 ...rm/session_schema.go:25:Ping() [I] PING DATABASE mysql 2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? [giteadb version] - 3.189577ms 2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [giteadb version id] - 2.959628ms 2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [giteadb version version] - 2.821551ms 2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 [1] - 944.612µs 2020/07/17 00:00:25 ...ations/migrations.go:306:Migrate() [I] Migration[140]: Save detected language file size to database instead of percent 2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `TABLE_NAME`, `ENGINE`, `AUTO_INCREMENT`, `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [giteadb] - 6.760164ms 2020/07/17 00:00:25 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT `COLUMN_NAME`, `IS_NULLABLE`, `COLUMN_DEFAULT`, `COLUMN_TYPE`, `COLUMN_KEY`, `EXTRA`,`COLUMN_COMMENT` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? ORDER BY `INFORMATION_SCHEMA`.`COLUMNS`.ORDINAL_POSITION [giteadb language_stat] - 1.616564ms 2020/07/17 00:00:25 routers/init.go:77:initDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: Sync2: Error 1054: Unknown column 'INFORMATION_SCHEMA.COLUMNS.ORDINAL_POSITION' in 'order clause' 2020/07/17 00:00:25 routers/init.go:78:initDBEngine() [I] Backing off for 3 seconds ``` ``` Server listening on :: port 22. Server listening on 0.0.0.0 port 22. 2020/07/17 08:12:11 cmd/web.go:107:runWeb() [I] Starting Gitea on PID: 16 2020/07/17 08:12:11 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled 2020/07/17 08:12:11 routers/init.go:119:GlobalInit() [T] AppPath: /app/gitea/gitea 2020/07/17 08:12:11 routers/init.go:120:GlobalInit() [T] AppWorkPath: /app/gitea 2020/07/17 08:12:11 routers/init.go:121:GlobalInit() [T] Custom path: /data/gitea 2020/07/17 08:12:11 routers/init.go:122:GlobalInit() [T] Log path: /data/gitea/log Received signal 15; terminating. ``` watchtower info: ``` time="2020-07-17T07:43:54Z" level=info msg="Running a one time update." time="2020-07-17T07:43:56Z" level=info msg="Found new gitea/gitea:latest image (sha256:be1649af755b46b7c82a03b265fd96c59678c587aa509ceb94f21556c2b87e03)" time="2020-07-17T07:43:56Z" level=info msg="Stopping /gitea (f6b0bcab9cc0843dc48fb4d85c04bc3acffbecfc0f4a0066e957a05142f38ed9) with SIGTERM" time="2020-07-17T07:44:05Z" level=info msg="Creating /gitea" ``` MySQL info: user docker image Image details ``` ID | sha256:b8fd9553f1f06e56173db706cf47dfc64ae3a7aeb213cc0e4fc476983b62bf16 Size | 444.7 MB Created | 2019-09-12 12:24:43 Build | Docker 18.06.1-ce on linux, amd64 ``` ENV ``` PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin GOSU_VERSION | 1.7 MYSQL_MAJOR | 8.0 MYSQL_VERSION | 8.0.17-1debian9 ```

I've created a PR that should hopefully address this - running 8.0.17 MySQL, I was able to resolve the error by removing the database identifier in the ORDER BY clause. Manual testing of the query returned correct values for the ordinals.

This appears to have been introduced in this commit: 7e6331c666

I've created a PR that should hopefully address this - running 8.0.17 MySQL, I was able to resolve the error by removing the database identifier in the `ORDER BY` clause. Manual testing of the query returned correct values for the ordinals. This appears to have been introduced in this commit: https://gitea.com/xorm/xorm/commit/7e6331c6667ac8719f35b314946973b114028f6c
Poster

@jdkendall Thanks!

@jdkendall Thanks!
lunny added this to the 1.0.4 milestone 1 year ago
lunny closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.