git.iko.soy/typeable/postgresql-simple
on master help sign in
Merge pull request #143 from jcristovao/ExclusionViolation

Added ExclusionViolation to ConstraintViolation

commit321ee2e53c468a237ec4d9a6fcc339bc05fb62a1 authorLeon P Smith <leon.p.smith+github@gmail.com> dateFri 1 May 2015, 23:13 (11 years ago) parent28d367628d5175
1 file changed+3
src/Database/PostgreSQL/Simple/Errors.hs+3
src/Database/PostgreSQL/Simple/Errors.hs+3
@@ -55,6 +55,8 @@ data ConstraintViolation
5555 -- ^ Name of violated constraint
5656 | CheckViolation ByteString ByteString
5757 -- ^ Relation name (usually table), constraint name
58+ | ExclusionViolation ByteString
59+ -- ^ Name of the exclusion violation constraint
5860 deriving (Show, Eq, Ord, Typeable)
5961
6062-- Default instance should be enough
@@ -75,6 +77,7 @@ constraintViolation e =
7577 "23503" -> uncurry ForeignKeyViolation <$> parseMaybe parseQ2 msg
7678 "23505" -> UniqueViolation <$> parseMaybe parseQ1 msg
7779 "23514" -> uncurry CheckViolation <$> parseMaybe parseQ2 msg
80+ "23P01" -> ExclusionViolation <$> parseMaybe parseQ1 msg
7881 _ -> Nothing
7982 where msg = sqlErrorMsg e
8083