@Test
  public void testStringLiteralIllegalCase() {
    String errorMsg =
        TSStatusCode.SQL_PARSE_ERROR.getStatusCode()
            + ": Error occurred while parsing SQL to physical plan: "
            + "line 1:45 mismatched input 'string' expecting {FALSE, NAN, NOW, NULL, TRUE, '-', '+', '/', '.', STRING_LITERAL, BINARY_LITERAL, DATETIME_LITERAL, INTEGER_LITERAL, EXPONENT_NUM_PART}";
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT");
    } catch (SQLException e) {
      fail(e.getMessage());
    }
    // without ' or "
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, string)");
      fail();
    } catch (SQLException e) {
      Assert.assertEquals(errorMsg, e.getMessage());
    }

    String errorMsg1 =
        TSStatusCode.SQL_PARSE_ERROR.getStatusCode()
            + ": Error occurred while parsing SQL to physical plan: "
            + "line 1:45 mismatched input '`string`' expecting {FALSE, NAN, NOW, NULL, TRUE, '-', '+', '/', '.', STRING_LITERAL, BINARY_LITERAL, DATETIME_LITERAL, INTEGER_LITERAL, EXPONENT_NUM_PART}";
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      // wrap STRING_LITERAL with ``
      statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, `string`)");
      fail();
    } catch (SQLException e) {
      Assert.assertEquals(errorMsg1, e.getMessage());
    }

    String errorMsg2 =
        TSStatusCode.SQL_PARSE_ERROR.getStatusCode()
            + ": Error occurred while parsing SQL to physical plan: "
            + "line 1:47 extraneous input 'string' expecting {',', ')'}";
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      // single ' in ''
      statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, ''string')");
      fail();
    } catch (SQLException e) {
      Assert.assertEquals(errorMsg2, e.getMessage());
    }

    String errorMsg3 =
        TSStatusCode.SQL_PARSE_ERROR.getStatusCode()
            + ": Error occurred while parsing SQL to physical plan: "
            + "line 1:47 extraneous input 'string' expecting {',', ')'}";
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      // single " in ""
      statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, \"\"string\")");
      fail();
    } catch (SQLException e) {
      Assert.assertEquals(errorMsg3, e.getMessage());
    }
  }
Legal cases of using StringLiteral with double quote in insert and select clause.
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java