Skip to content

Commit

Permalink
Fixed handling of collation fields in index parser
Browse files Browse the repository at this point in the history
  • Loading branch information
percona-csalguero committed Nov 30, 2017
1 parent 56a568e commit 0ab5552
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tableparser/tableparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type IndexField struct {
KeyName string
SeqInIndex int
ColumnName string
Collation string
Collation sql.NullString
Cardinality int
SubPart sql.NullInt64
Packed sql.NullString
Expand Down Expand Up @@ -190,6 +190,7 @@ func (t *Table) parse() error {

t.Fields = append(t.Fields, f)
}

if rows.Err() != nil {
return rows.Err()
}
Expand Down Expand Up @@ -221,7 +222,7 @@ func getIndexes(db *sql.DB, schema, tableName string) (map[string]Index, error)
&i.ColumnName, &i.Collation, &i.Cardinality, &i.SubPart,
&i.Packed, &i.Null, &i.IndexType, &i.Comment, &i.IndexComment)
if err != nil {
return nil, fmt.Errorf("cannot read constraints: %s", err)
return nil, fmt.Errorf("cannot read indexes: %s", err)
}
if index, ok := indexes[i.KeyName]; !ok {
indexes[i.KeyName] = Index{
Expand Down Expand Up @@ -288,7 +289,7 @@ func getTriggers(db *sql.DB, schema, tableName string) ([]Trigger, error) {
&t.Created, &t.SQLMode, &t.Definer, &t.CharacterSetClient, &t.CollationConnection,
&t.DatabaseCollation)
if err != nil {
return nil, fmt.Errorf("cannot read constraints: %s", err)
return nil, fmt.Errorf("cannot read trigger: %s", err)
}
triggers = append(triggers, t)
}
Expand Down

0 comments on commit 0ab5552

Please sign in to comment.