From aa068b667aff461f87d49cc0227e162ad8cbadfb Mon Sep 17 00:00:00 2001 From: Alex Suraci Date: Fri, 16 Nov 2018 19:36:56 +0000 Subject: [PATCH] postgres: improve readability of error check --- storage/sql/sql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/sql/sql.go b/storage/sql/sql.go index 2ddccab7..7f20cf9d 100644 --- a/storage/sql/sql.go +++ b/storage/sql/sql.go @@ -71,7 +71,7 @@ var ( err = tx.Commit() if err != nil { - if pqErr, ok := err.(*pq.Error); ok && pqErr.Code == "40001" { + if pqErr, ok := err.(*pq.Error); ok && pqErr.Code.Name() == "serialization_failure" { // serialization error; retry continue }