From 23b6221f8bb02da704b065d7eb441d80b6692623 Mon Sep 17 00:00:00 2001 From: Aaron L Date: Tue, 3 Jan 2017 19:07:00 -0800 Subject: [PATCH] Relax the definition of unique on columns (mysql) - Fix #77 --- bdb/drivers/mysql.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bdb/drivers/mysql.go b/bdb/drivers/mysql.go index 4e74232ca..a803f4a5f 100644 --- a/bdb/drivers/mysql.go +++ b/bdb/drivers/mysql.go @@ -139,7 +139,8 @@ func (m *MySQLDriver) Columns(schema, tableName string) ([]bdb.Column, error) { inner join information_schema.key_column_usage kcu on tc.constraint_name = kcu.constraint_name and tc.table_name = kcu.table_name and tc.table_schema = kcu.table_schema where c.column_name = kcu.column_name and tc.table_name = c.table_name and - (tc.constraint_type = 'PRIMARY KEY' or tc.constraint_type = 'UNIQUE') + (tc.constraint_type = 'PRIMARY KEY' or tc.constraint_type = 'UNIQUE') and + (select count(*) from information_schema.key_column_usage where constraint_name = tc.constraint_name) = 1 ) as is_unique from information_schema.columns as c where table_name = ? and table_schema = ?;