anchor.diff:                       error,                     % Severity
                        Code, Message, _Extra}}) ->
       %% See http://www.postgresql.org/docs/current/static/errcodes-appendix.html
  -    case Code of
  -        <<"23505">> -> % unique constraint violation
  -            {conflict, Message};
  -        <<"23503">> -> % foreign_key_violation
  -            {foreign_key, Message};
  -        _ ->
  +    case lists:keyfind(Code, 1, ?PGSQL_ERROR_CODES) of
  +        {_, ErrorType} ->
  +            {ErrorType, Message};
  +        false ->
               {error, Message}
       end.
   
  
positive.code: -include_lib("eunit/include/eunit.hrl").
  
  -define(MAX_RETRIES, 5).
  
  checkout() ->
      pooler:take_member("sqerl").
  
negative.code: -spec parse_error(mysql | pgsql,{term(), term()}
                          | {error, {error, error, _, _, _}}) ->
                            {'conflict',_} | {'foreign_key',_} | {'error',_}.
  parse_error(mysql, {Code, Message}) ->
      case lists:keyfind(Code, 1, ?MYSQL_ERROR_CODES) of
          {_, ErrorType} ->
              {ErrorType, Message};
          false ->
              {error, Message}
      end;
  
  