Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: tidb6.1.2视图里不能识别原始表里的索引key, force index 报key not found。 用5.4.3的tidb Server正常
【TiDB Usage Environment】Production Environment / Test / Poc
Production
【TiDB Version】
6.1.2
【Reproduction Path】What operations were performed to encounter the issue
The normal task on tidb5.4.2 reported an exception after upgrading to 6.1.2. (We also started a tidbserver of version 5.4.3 and it worked fine)
【Encountered Issue: Problem Phenomenon and Impact】
Error on tidb 6.1.2:
(user:tidbdba time: 11:06)[db: yixintui_operate]select * from tt_advertiser force index(status) limit 3 ;
ERROR 1176 (42000): Key ‘status’ doesn’t exist in table ‘tt_advertiser’
【Resource Configuration】
【Attachments: Screenshots / Logs / Monitoring】
[2022/11/18 13:30:03.887 +08:00] [INFO] [conn.go:1149] [“command dispatched failed”] [conn=213067761280914977] [connInfo=“id:213067761280914977, addr:127.0.0.1:55001 status:10, collation:utf8_general_ci, user:tidbdba”] [command=Query] [status=“inTxn:0, autocommit:1”] [sql=“select * from tt_advertiser force index(status) limit 2”] [txn_mode=PESSIMISTIC] [timestamp=0] [err=“[planner:1176]Key ‘status’ doesn’t exist in table ‘tt_advertiser’\ngithub.com/pingcap/errors.AddStack\n\t/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20211224045212-9687c2b0f87c/errors.go:174\ngithub.com/pingcap/errors.(*Error).GenWithStackByArgs\n\t/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20211224045212-9687c2b0f87c/normalize.go:164\ngithub.com/pingcap/tidb/planner/core.getPossibleAccessPaths\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:1206\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildDataSource\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:4260\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:359\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildJoin\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:684\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:346\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildTableRefs\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:340\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildSelect\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:3823\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).Build\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:730\ngithub.com/pingcap/tidb/planner.optimize\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:354\ngithub.com/pingcap/tidb/planner.Optimize\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/optimize.go:227\ngithub.com/pingcap/tidb/executor.(*Compiler).Compile\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/compiler.go:81\ngithub.com/pingcap/tidb/session.(*session).ExecuteStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:1924\ngithub.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/driver_tidb.go:230\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2022\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1876\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1371\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1121\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:559\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1571”]