Skip to content

Commit

Permalink
infoschema: fix sub_part in information_schema.statistics table (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Sep 6, 2024
1 parent 973b215 commit f184e16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ func (e *memtableRetriever) setDataForStatisticsInTable(schema *model.DBInfo, ta
expression = tblCol.GeneratedExprString
}

var subPart any
if key.Length != types.UnspecifiedLength {
subPart = key.Length
}

record := types.MakeDatums(
infoschema.CatalogVal, // TABLE_CATALOG
schema.Name.O, // TABLE_SCHEMA
Expand All @@ -598,7 +603,7 @@ func (e *memtableRetriever) setDataForStatisticsInTable(schema *model.DBInfo, ta
colName, // COLUMN_NAME
"A", // COLLATION
0, // CARDINALITY
nil, // SUB_PART
subPart, // SUB_PART
nil, // PACKED
nullable, // NULLABLE
"BTREE", // INDEX_TYPE
Expand Down

0 comments on commit f184e16

Please sign in to comment.