code: func TableInfo2SchemaWithDBName(ctx sessionctx.Context, dbName model.CIStr, tbl *model.TableInfo) *Schema {
  	cols := ColumnInfos2ColumnsWithDBName(ctx, dbName, tbl.Name, tbl.Columns)
  	keys := make([]KeyInfo, 0, len(tbl.Indices)+1)
  	for _, idx := range tbl.Indices {
  		if !idx.Unique || idx.State != model.StatePublic {
  			continue
  		}
  		ok := true
  		newKey := make([]*Column, 0, len(idx.Columns))
  		for _, idxCol := range idx.Columns {
  			find := false
  			for i, col := range tbl.Columns {
  				if idxCol.Name.L == col.Name.L {
  					if !mysql.HasNotNullFlag(col.Flag) {
  						break
  					}
  					newKey = append(newKey, cols[i])
  					find = true
  					break
  				}
  			}
  			if !find {
  				ok = false
  				break
  			}
  		}
  		if ok {
  			keys = append(keys, newKey)
  		}
  	}
  	if tbl.PKIsHandle {
  		for i, col := range tbl.Columns {
  			if mysql.HasPriKeyFlag(col.Flag) {
  				keys = append(keys, KeyInfo{cols[i]})
  				break
  			}
  		}
  	}
  	schema := NewSchema(cols...)
  	schema.SetUniqueKeys(keys)
  	return schema
  }
docs: // TableInfo2SchemaWithDBName converts table info to schema.