-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-5.1This bug affects 5.1.x versions.This bug affects 5.1.x versions.affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.impact/panicseverity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
drop table if exists table_abc1;
drop table if exists table_abc2;
drop table if exists table_abc3;
drop table if exists table_abc4;
CREATE TABLE `table_abc1` (
`column_abc1` varchar(10) DEFAULT NULL,
`column_abc2` varchar(10) DEFAULT NULL,
`column_abc3` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE `table_abc3` (
`column_abc5` varchar(10) DEFAULT NULL,
`column_abc6` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE `table_abc4` (
`column_abc3` varchar(10) DEFAULT NULL,
`column_abc7` varchar(10) DEFAULT NULL,
`column_abc5` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
INSERT INTO `table_abc1` VALUES ('KTL157','KTL157','KTL157');
INSERT INTO `table_abc3` VALUES ('1000','20240819');
INSERT INTO `table_abc4` VALUES ('KTL157','test','1000');
DELETE FROM table_abc3 t_abc3
WHERE t_abc3.column_abc5 IN (
SELECT a.column_abc5
FROM (
WITH tree_cte1 AS (
WITH RECURSIVE tree_cte AS (
SELECT t.column_abc1, t.column_abc2, t.column_abc3, 0 AS lv
FROM table_abc1 t
WHERE t.column_abc1 IN ('KTL157', 'KTL159')
UNION ALL
SELECT t.column_abc1, t.column_abc2, t.column_abc3, tcte.lv + 1
FROM table_abc1 t
JOIN tree_cte tcte ON t.column_abc1 = tcte.column_abc2
WHERE tcte.lv <= 1
)
SELECT * FROM tree_cte
)
SELECT e.column_abc5
FROM (
SELECT DISTINCT * FROM tree_cte1
) aa
LEFT JOIN table_abc4 e ON e.column_abc3 = aa.column_abc3
) a
);
2. What did you expect to see? (Required)
no error
3. What did you see instead (Required)
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
[2024/08/26 18:36:20.488 +08:00] [INFO] [conn.go:1183] ["command dispatched failed"] [conn=872415234] [session_alias=] [connInfo="id:872415234, addr:127.0.0.1:56448 status:10, collation:utf8mb4_0900_ai_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="DELETE FROM table_abc3 t_abc3 WHERE t_abc3.column_abc5 IN ( SELECT a.column_abc5 FROM ( WITH tree_cte1 AS ( WITH RECURSIVE tree_cte AS ( SELECT t.column_abc1, t.column_abc2, t.column_abc3, 0 AS lv FROM table_abc1 t WHERE t.column_abc1 IN ('KTL157', 'KTL159') UNION ALL SELECT t.column_abc1, t.column_abc2, t.column_abc3, tcte.lv + 1 FROM table_abc1 t JOIN tree_cte tcte ON t.column_abc1 = tcte.column_abc2 WHERE tcte.lv <= 1 ) SELECT * FROM tree_cte ) SELECT e.column_abc5 FROM ( SELECT DISTINCT * FROM tree_cte1 ) aa LEFT JOIN table_abc4 e ON e.column_abc3 = aa.column_abc3 ) a )"] [txn_mode=PESSIMISTIC] [timestamp=452111520359514125] [err="runtime error: invalid memory address or nil pointer dereference\ngithub.com/pingcap/errors.AddStack\n\t/home/xhy/Development/Golang/GOPATH/pkg/mod/github.com/pingcap/[email protected]/errors.go:178\ngithub.com/pingcap/errors.Trace\n\t/home/xhy/Development/Golang/GOPATH/pkg/mod/github.com/pingcap/[email protected]/juju_adaptor.go:15\ngithub.com/pingcap/tidb/pkg/util.GetRecoverError\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/util/util.go:288\ngithub.com/pingcap/tidb/pkg/executor/internal/exec.Next.func1\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/internal/exec/executor.go:435\nruntime.gopanic\n\t/home/xhy/.gvm/gos/go1.21.5/src/runtime/panic.go:914\nruntime.panicmem\n\t/home/xhy/.gvm/gos/go1.21.5/src/runtime/panic.go:261\nruntime.sigpanic\n\t/home/xhy/.gvm/gos/go1.21.5/src/runtime/signal_unix.go:861\ngithub.com/pingcap/tidb/pkg/executor.(*DeleteExec).deleteOneRow\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/delete.go:70\ngithub.com/pingcap/tidb/pkg/executor.(*DeleteExec).deleteSingleTableByChunk\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/delete.go:140\ngithub.com/pingcap/tidb/pkg/executor.(*DeleteExec).Next\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/delete.go:62\ngithub.com/pingcap/tidb/pkg/executor/internal/exec.Next\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/internal/exec/executor.go:451\ngithub.com/pingcap/tidb/pkg/executor.(*ExecStmt).next\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/adapter.go:1252\ngithub.com/pingc
ap/tidb/pkg/executor.(*ExecStmt).handleNoDelayExecutor\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/adapter.go:1001\ngithub.com/pingcap/tidb/pkg/executor.(*
ExecStmt).handleNoDelay\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/executor/adapter.go:834\ngithub.com/pingcap/tidb/pkg/executor.(*ExecStmt).Exec\n\t/home/xhy/Deve
lopment/github.com/pingcap/tidb/pkg/executor/adapter.go:598\ngithub.com/pingcap/tidb/pkg/session.runStmt\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/session/session
.go:2284\ngithub.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/session/session.go:2145\ngithub.com/pingcap/tidb/pk
g/server.(*TiDBContext).ExecuteStmt\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/server/driver_tidb.go:291\ngithub.com/pingcap/tidb/pkg/server.(*clientConn).handleSt
mt\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/server/conn.go:2056\ngithub.com/pingcap/tidb/pkg/server.(*clientConn).handleQuery\n\t/home/xhy/Development/github.com
/pingcap/tidb/pkg/server/conn.go:1810\ngithub.com/pingcap/tidb/pkg/server.(*clientConn).dispatch\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/server/conn.go:1384\ngi
thub.com/pingcap/tidb/pkg/server.(*clientConn).Run\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/server/conn.go:1146\ngithub.com/pingcap/tidb/pkg/server.(*Server).onC
onn\n\t/home/xhy/Development/github.com/pingcap/tidb/pkg/server/server.go:741\nruntime.goexit\n\t/home/xhy/.gvm/gos/go1.21.5/src/runtime/asm_amd64.s:1650"]
[2024/08/26 18:36:37.383 +08:00] [INFO] [domain.go:3156] ["instance plan eviction"] [detail="memory usage is below the soft limit, currentTot: 0, softLimit: 104857600"] [num
_evicted=0] [time_spent=850ns]
4. What is your TiDB version? (Required)
nightly
Metadata
Metadata
Assignees
Labels
affects-5.1This bug affects 5.1.x versions.This bug affects 5.1.x versions.affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.impact/panicseverity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.