@Override
  public ResultSet getPrimaryKeys(String catalog, String schemaPattern, String tableNamePattern)
      throws SQLException {

    Statement stmt = connection.createStatement();
    boolean legacyMode = true;
    ResultSet rs;

    try {
      String sql =
          String.format(
              "select * from information_schema.columns where database like '%s'  escape '\\' and table_name like '%s' escape '\\' and (category='TAG' or category='TIME')",
              schemaPattern, tableNamePattern);
      rs = stmt.executeQuery(sql);
    } catch (SQLException e) {
      LOGGER.error(SHOW_TABLES_ERROR_MSG, e.getMessage());

      try {
        String sql =
            String.format(
                "desc %s.%s", removeEscape(schemaPattern), removeEscape(tableNamePattern));
        rs = stmt.executeQuery(sql);
        legacyMode = false;
      } catch (SQLException e1) {
        LOGGER.error(SHOW_TABLES_ERROR_MSG, e.getMessage());
        throw e;
      }

    } finally {
      stmt.close();
    }

    Field[] fields = new Field[6];
    fields[0] = new Field("", TABLE_CAT, "TEXT");
    fields[1] = new Field("", TABLE_SCHEM, "TEXT");
    fields[2] = new Field("", TABLE_NAME, "TEXT");
    fields[3] = new Field("", COLUMN_NAME, "TEXT");
    fields[4] = new Field("", KEY_SEQ, INT32);
    fields[5] = new Field("", PK_NAME, "TEXT");
    List<TSDataType> tsDataTypeList =
        Arrays.asList(
            TSDataType.TEXT,
            TSDataType.TEXT,
            TSDataType.TEXT,
            TSDataType.TEXT,
            TSDataType.INT32,
            TSDataType.TEXT);
    List<String> columnNameList = new ArrayList<>();
    List<String> columnTypeList = new ArrayList<>();
    Map<String, Integer> columnNameIndex = new HashMap<>();
    List<List<Object>> valuesList = new ArrayList<>();
    for (int i = 0; i < fields.length; i++) {
      columnNameList.add(fields[i].getName());
      columnTypeList.add(fields[i].getSqlType());
      columnNameIndex.put(fields[i].getName(), i);
    }

    int count = 1;
    while (rs.next()) {
      String columnName = legacyMode ? rs.getString("column_name") : rs.getString("ColumnName");
      String category = legacyMode ? rs.getString("category") : rs.getString("Category");
      if (category.equals("TAG") || category.equals("TIME")) {
        List<Object> valueInRow = new ArrayList<>();
        for (int i = 0; i < fields.length; ++i) {
          if (i == 0) {
            valueInRow.add(schemaPattern);
          } else if (i == 1) {
            valueInRow.add(schemaPattern);
          } else if (i == 2) {
            valueInRow.add(tableNamePattern);
          } else if (i == 3) {
            valueInRow.add(columnName);
          } else if (i == 4) {
            valueInRow.add(count++);
          } else {
            valueInRow.add(PRIMARY);
          }
        }
        valuesList.add(valueInRow);
      }
    }

    ByteBuffer tsBlock = null;
    try {
      tsBlock = convertTsBlock(valuesList, tsDataTypeList);
    } catch (IOException e) {
      LOGGER.error("Get primary keys error: {}", e.getMessage());
    } finally {
      close(null, stmt);
    }

    return new IoTDBJDBCResultSet(
        stmt,
        columnNameList,
        columnTypeList,
        columnNameIndex,
        true,
        client,
        null,
        -1,
        sessionId,
        Collections.singletonList(tsBlock),
        null,
        (long) 60 * 1000,
        false,
        zoneId);
  }
some tools pass in parameters that will escape '_', but some syntax does not support escaping,
such as dataGrip

@param pattern eg. information\_schema
@return eg. information_schema
iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/relational/IoTDBRelationalDatabaseMetadata.java