Skip to content

Commit ee673e2

Browse files
author
Shlomi Noach
committed
Merge pull request #28 from github/fix-statistics-query
fixed statistics query
2 parents dfdac96 + 800c110 commit ee673e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

go/logic/inspect.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,10 @@ func (this *Inspector) getCandidateUniqueKeys(tableName string) (uniqueKeys [](*
405405
SUBSTRING_INDEX(GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX ASC), ',', 1) AS FIRST_COLUMN_NAME,
406406
SUM(NULLABLE='YES') > 0 AS has_nullable
407407
FROM INFORMATION_SCHEMA.STATISTICS
408-
WHERE NON_UNIQUE=0
408+
WHERE
409+
NON_UNIQUE=0
410+
AND TABLE_SCHEMA = ?
411+
AND TABLE_NAME = ?
409412
GROUP BY TABLE_SCHEMA, TABLE_NAME, INDEX_NAME
410413
) AS UNIQUES
411414
ON (
@@ -448,7 +451,7 @@ func (this *Inspector) getCandidateUniqueKeys(tableName string) (uniqueKeys [](*
448451
}
449452
uniqueKeys = append(uniqueKeys, uniqueKey)
450453
return nil
451-
}, this.migrationContext.DatabaseName, tableName)
454+
}, this.migrationContext.DatabaseName, tableName, this.migrationContext.DatabaseName, tableName)
452455
if err != nil {
453456
return uniqueKeys, err
454457
}

0 commit comments

Comments
 (0)