diff --git a/db/sql/SqlDb.go b/db/sql/SqlDb.go index 32224787b..a1fd7dfa5 100644 --- a/db/sql/SqlDb.go +++ b/db/sql/SqlDb.go @@ -51,6 +51,9 @@ var ( // validateMutationResult checks the success of the update query func validateMutationResult(res sql.Result, err error) error { if err != nil { + if strings.Contains(err.Error(), "foreign key") { + err = db.ErrInvalidOperation + } return err }