From 908edd304d4b4feec82e7f7a561cd2a2cb5a985f Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Mon, 1 Jun 2020 17:52:25 +0200 Subject: [PATCH] Revert "Also check sqlite for constraint error" This reverts commit 7d310514 --- internal/postgres.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/internal/postgres.go b/internal/postgres.go index de29da49f..7ae40d8fd 100644 --- a/internal/postgres.go +++ b/internal/postgres.go @@ -16,22 +16,10 @@ package internal -import ( - "errors" +import "github.com/lib/pq" - "github.com/lib/pq" - "github.com/mattn/go-sqlite3" -) - -// IsUniqueConstraintViolationErr returns true if the error is a postgresql unique_violation or sqlite3.ErrConstraint +// IsUniqueConstraintViolationErr returns true if the error is a postgresql unique_violation error func IsUniqueConstraintViolationErr(err error) bool { pqErr, ok := err.(*pq.Error) - if ok { - return pqErr.Code == "23505" - } - sqliteErr, ok := err.(*sqlite3.Error) - if ok { - return errors.Is(sqliteErr, sqlite3.ErrConstraint) - } - return false + return ok && pqErr.Code == "23505" }