code: public static int dimensionFromConstraint(String constraint, String columnName) {
          Matcher matcher = Z_CONSTRAINT_PATTERN.matcher(constraint);
          if(matcher.find()) {
              String extractedColumnName = matcher.group(1).replace("\"","").replace("`", "");
              if(extractedColumnName.equalsIgnoreCase(columnName)) {
                  int constraint_value = Integer.valueOf(matcher.group(8));
                  String sign = matcher.group(5);
                  if("<>".equals(sign) || "!=".equals(sign)) {
                      constraint_value = constraint_value == 3 ? 2 : 3;
                  }
                  if("<".equals(sign)) {
                      constraint_value = 2;
                  }
                  if(">".equals(sign)) {
                      constraint_value = constraint_value == 2 ? 3 : 2;
                  }
                  return constraint_value;
              }
          }
          return 2;
      }
docs: Public for Unit test
  @param constraint Constraint value ex: ST_COORDIM(the_geom) = 3
  @param columnName Column name ex:the_geom
  @return The dimension constraint [2-3]