diff --git a/cmd/explaintest/r/explain_easy.result b/cmd/explaintest/r/explain_easy.result index c2c61bf79b..766edb8f9e 100644 --- a/cmd/explaintest/r/explain_easy.result +++ b/cmd/explaintest/r/explain_easy.result @@ -191,7 +191,7 @@ TABLE_SCHEMA TABLE_NAME NON_UNIQUE KEY_NAME SEQ_IN_INDEX COLUMN_NAME SUB_PART IN test t4 0 PRIMARY 1 a NULL NULL 0 YES YES test t4 1 idx 1 a NULL NULL 1 YES NO test t4 1 idx 2 b NULL NULL 1 YES NO -test t4 1 expr_idx 1 NULL NULL (`a` + `b` + 1) 2 YES NO +test t4 1 expr_idx 1 NULL NULL `a` + `b` + 1 2 YES NO explain format = 'brief' select count(1) from (select count(1) from (select * from t1 where c3 = 100) k) k2; id estRows task access object operator info StreamAgg 1.00 root funcs:count(1)->Column#5 diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index 958a53bfb3..052cbebbf0 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -438,7 +438,7 @@ func (e *memtableRetriever) setDataForStatisticsInTable(schema *model.DBInfo, ta tblCol := table.Columns[col.Offset] if tblCol.Hidden { colName = "NULL" - expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString) + expression = tblCol.GeneratedExprString } record := types.MakeDatums( @@ -913,7 +913,7 @@ func (e *memtableRetriever) setDataFromIndexes(ctx sessionctx.Context, schemas [ tblCol := tb.Columns[col.Offset] if tblCol.Hidden { colName = "NULL" - expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString) + expression = tblCol.GeneratedExprString } visible := "YES" if idxInfo.Invisible { diff --git a/executor/seqtest/seq_executor_test.go b/executor/seqtest/seq_executor_test.go index 87cd3c0c36..ec09321cbe 100644 --- a/executor/seqtest/seq_executor_test.go +++ b/executor/seqtest/seq_executor_test.go @@ -336,7 +336,7 @@ func (s *seqTestSuite) TestShow(c *C) { "show_index|1|idx7|1|id|A|0||||BTREE| |YES||NO", "show_index|1|idx8|1|id|A|0||||BTREE| |YES||NO", "show_index|1|idx9|1|id|A|0||||BTREE| |NO||NO", - "show_index|1|expr_idx|1|NULL|A|0|||YES|BTREE| |YES|(`id` * 2 + 1)|NO", + "show_index|1|expr_idx|1|NULL|A|0|||YES|BTREE| |YES|`id` * 2 + 1|NO", )) // For show like with escape diff --git a/executor/show.go b/executor/show.go index 8c017d2f64..9374bc944d 100644 --- a/executor/show.go +++ b/executor/show.go @@ -614,7 +614,7 @@ func (e *ShowExec) fetchShowIndex() error { var expression interface{} if tblCol.Hidden { colName = "NULL" - expression = fmt.Sprintf("(%s)", tblCol.GeneratedExprString) + expression = tblCol.GeneratedExprString } e.appendRow([]interface{}{