git.iko.soy/typeable/postgresql-simple
on master help sign in
Merge pull request #143 from jcristovao/ExclusionViolation
321ee2eLeon P Smith
src/Database/PostgreSQL/Simple/Errors.hs+3
@@ -55,6 +55,8 @@ data ConstraintViolation
55 -- ^ Name of violated constraint
55 -- ^ Name of violated constraint
56 | CheckViolation ByteString ByteString
56 | CheckViolation ByteString ByteString
57 -- ^ Relation name (usually table), constraint name
57 -- ^ Relation name (usually table), constraint name
58+ | ExclusionViolation ByteString
59+ -- ^ Name of the exclusion violation constraint
58 deriving (Show, Eq, Ord, Typeable)
60 deriving (Show, Eq, Ord, Typeable)
59
61
60-- Default instance should be enough
62-- Default instance should be enough
@@ -75,6 +77,7 @@ constraintViolation e =
75 "23503" -> uncurry ForeignKeyViolation <$> parseMaybe parseQ2 msg
77 "23503" -> uncurry ForeignKeyViolation <$> parseMaybe parseQ2 msg
76 "23505" -> UniqueViolation <$> parseMaybe parseQ1 msg
78 "23505" -> UniqueViolation <$> parseMaybe parseQ1 msg
77 "23514" -> uncurry CheckViolation <$> parseMaybe parseQ2 msg
79 "23514" -> uncurry CheckViolation <$> parseMaybe parseQ2 msg
80+ "23P01" -> ExclusionViolation <$> parseMaybe parseQ1 msg
78 _ -> Nothing
81 _ -> Nothing
79 where msg = sqlErrorMsg e
82 where msg = sqlErrorMsg e
80
83