Skip to content

Commit

Permalink
Support the case where name in index_info is NULL.
Browse files Browse the repository at this point in the history
Fix #578
ref: https://www.sqlite.org/pragma.html#pragma_index_info

> 3. The name of the column being indexed. This columns is NULL if the column is the rowid or an expression.
  • Loading branch information
k1LoW committed May 2, 2024
1 parent c3110fa commit b20054c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ WHERE name != 'sqlite_sequence' AND (type = 'table' OR type = 'view');`)
var (
colRank string
colRankWithinTable string
col string
col sql.NullString
cols []string
)
row, err := l.db.Query(fmt.Sprintf("PRAGMA index_info(`%s`)", indexName))
Expand All @@ -264,7 +264,9 @@ WHERE name != 'sqlite_sequence' AND (type = 'table' OR type = 'view');`)
if err != nil {
return errors.WithStack(err)
}
cols = append(cols, col)
if col.Valid {
cols = append(cols, col.String)
}
}

switch indexCreatedBy {
Expand Down

0 comments on commit b20054c

Please sign in to comment.