public boolean isDuplicateKeyError(Throwable t) {
    SQLException sqlEx = TxnUtils.getSqlException(t); 
    switch (dbType) {
    case DERBY:
    case CUSTOM: // ANSI SQL
      if("23505".equals(sqlEx.getSQLState())) {
        return true;
      }
      break;
    case MYSQL:
      //https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
      if((sqlEx.getErrorCode() == 1022 || sqlEx.getErrorCode() == 1062 || sqlEx.getErrorCode() == 1586)
        && "23000".equals(sqlEx.getSQLState())) {
        return true;
      }
      break;
    case SQLSERVER:
      //2627 is unique constaint violation incl PK, 2601 - unique key
      if ((sqlEx.getErrorCode() == 2627 || sqlEx.getErrorCode() == 2601) && "23000".equals(sqlEx.getSQLState())) {
        return true;
      }
      break;
    case ORACLE:
      if(sqlEx.getErrorCode() == 1 && "23000".equals(sqlEx.getSQLState())) {
        return true;
      }
      break;
    case POSTGRES:
      //http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html
      if("23505".equals(sqlEx.getSQLState())) {
        return true;
      }
      break;
    default:
      String msg = sqlEx.getMessage() +
                " (SQLState=" + sqlEx.getSQLState() + ", ErrorCode=" + sqlEx.getErrorCode() + ")";
      throw new IllegalArgumentException("Unexpected DB type: " + dbType + "; " + msg);
  }
  return false;

  }
Checks if the dbms supports the getGeneratedKeys for multiline insert statements.
@return true if supports
@throws MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java