From 123bfad69c405b0e78e3031d8064fd7621416867 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Tue, 17 May 2016 12:52:10 -0700 Subject: Fixing LDAP issue with Postgres (#3033) --- store/sql_store.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'store/sql_store.go') diff --git a/store/sql_store.go b/store/sql_store.go index 688e1b116..0979579df 100644 --- a/store/sql_store.go +++ b/store/sql_store.go @@ -582,9 +582,16 @@ func (ss SqlStore) RemoveIndexIfExists(indexName string, tableName string) { } } -func IsUniqueConstraintError(err string, mysql string, postgres string) bool { +func IsUniqueConstraintError(err string, indexName []string) bool { unique := strings.Contains(err, "unique constraint") || strings.Contains(err, "Duplicate entry") - field := strings.Contains(err, mysql) || strings.Contains(err, postgres) + field := false + for _, contain := range indexName { + if strings.Contains(err, contain) { + field = true + break + } + } + return unique && field } -- cgit v1.2.3-1-g7c22