You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2022/02/18 03:27:23 UTC

[iotdb] branch master updated: [IOTDB-2487] Time series containing special characters can be created but connot be used normally (#4985)

This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 09e0903  [IOTDB-2487] Time series containing special characters can be created but connot be used normally (#4985)
09e0903 is described below

commit 09e0903daf5f2096c7ae72f0fd4e3249affdcaa4
Author: liuminghui233 <36...@users.noreply.github.com>
AuthorDate: Fri Feb 18 11:26:47 2022 +0800

    [IOTDB-2487] Time series containing special characters can be created but connot be used normally (#4985)
---
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4    |  14 +-
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   |   8 +-
 docs/UserGuide/Reference/Syntax-Conventions.md     |  51 ++++--
 docs/zh/UserGuide/Reference/Syntax-Conventions.md  |  55 +++++--
 .../iotdb/db/integration/IoTDBDeletionIT.java      |  10 +-
 .../iotdb/db/integration/IoTDBQuotedPathIT.java    |   2 +-
 .../db/integration/IoTDBSyntaxConventionIT.java    | 177 +++++++++++++++++++--
 .../db/integration/aligned/IoTDBDeletionIT.java    |  10 +-
 .../IoTDBSyntaxConventionVersionAdaptionIT.java    |  16 ++
 .../apache/iotdb/session/IoTDBSessionSimpleIT.java |  53 ------
 .../session/IoTDBSessionSyntaxConventionIT.java    | 146 +++++++++++++++++
 .../apache/iotdb/db/metadata/utils/MetaUtils.java  |   6 +
 .../apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java    | 177 +++++++++------------
 13 files changed, 511 insertions(+), 214 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
index 1b537c3..459d01f 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
@@ -937,8 +937,8 @@ ID
     : NAME_CHAR+
     ;
 
-QUTOED_ID_WITHOUT_DOT
-    : BQUOTA_STRING_WITHOUT_DOT
+QUTOED_ID_IN_NODE_NAME
+    : BQUOTA_STRING_IN_NODE_NAME
     ;
 
 QUTOED_ID
@@ -964,19 +964,19 @@ fragment CN_CHAR
     ;
 
 fragment DQUOTA_STRING
-    : '"' ( '\\'. | '""' | ~('"'| '\\') )* '"'
+    : '"' ( '\\'. | ~('"'| '\\') )* '"'
     ;
 
 fragment SQUOTA_STRING
-    : '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\''
+    : '\'' ( '\\'. | ~('\''| '\\') )* '\''
     ;
 
 fragment BQUOTA_STRING
-    : '`' ( '\\'. | '``' | ~('`'|'\\'))* '`'
+    : '`' ( '\\'. | ~('`'| '\\') )* '`'
     ;
 
-fragment BQUOTA_STRING_WITHOUT_DOT
-    : '`' ( '\\'. | '``' | ~('`'|'\\'|'.'))* '`'
+fragment BQUOTA_STRING_IN_NODE_NAME
+    : '`' ( '\\' ('`'|'\\'|'\''|'"') | ~('`'|'\\'|'.'|'\''|'"'))* '`'
     ;
 
 // Characters and write it this way for case sensitivity
diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 7a2e82f..a218d15 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -704,14 +704,14 @@ nodeName
     : wildcard
     | wildcard? ID wildcard?
     | wildcard? INTEGER_LITERAL wildcard?
-    | QUTOED_ID_WITHOUT_DOT
+    | QUTOED_ID_IN_NODE_NAME
     | STRING_LITERAL
     ;
 
 nodeNameWithoutWildcard
     : ID
     | INTEGER_LITERAL
-    | QUTOED_ID_WITHOUT_DOT
+    | QUTOED_ID_IN_NODE_NAME
     | STRING_LITERAL
     ;
 
@@ -723,7 +723,7 @@ nodeNameCanInExpr
     : wildcard
     | wildcard? ID wildcard?
     | QUTOED_ID
-    | QUTOED_ID_WITHOUT_DOT
+    | QUTOED_ID_IN_NODE_NAME
     ;
 
 wildcard
@@ -737,7 +737,7 @@ wildcard
 identifier
     : ID
     | QUTOED_ID
-    | QUTOED_ID_WITHOUT_DOT
+    | QUTOED_ID_IN_NODE_NAME
     | INTEGER_LITERAL
     ;
 
diff --git a/docs/UserGuide/Reference/Syntax-Conventions.md b/docs/UserGuide/Reference/Syntax-Conventions.md
index 81b2167..2c6e79a 100644
--- a/docs/UserGuide/Reference/Syntax-Conventions.md
+++ b/docs/UserGuide/Reference/Syntax-Conventions.md
@@ -43,22 +43,20 @@ Usages of string literals:
 
 There are several ways to include quote characters within a string:
 
- - A `'` inside a string quoted with `'` may be written as `''`.
- - A `"` inside a string quoted with `"` may be written as `""`.
  - Precede the quote character by an escape character (\\).
- - `'` inside a string quoted with `"` needs no special treatment and need not be doubled or escaped. In the same way, `"` inside a string quoted with `'` needs no special treatment. (but escaping still works)
+ - `'` inside a string quoted with `"` needs no special treatment and need not be doubled or escaped. In the same way, `"` inside a string quoted with `'` needs no special treatment.
 
 The following examples demonstrate how quoting and escaping work:
 ```js
 'string'  // string
 '"string"'  // "string"
 '""string""'  // ""string""
-'str''ing'  // str'ing
+'str\'ing'  // str'ing
 '\'string'  // 'string
 "string" // string
 "'string'"  // 'string'
 "''string''"  // ''string''
-"str""ing"  // str"ing
+"str\"ing"  // str"ing
 "\"string"  // "string
 ```
 
@@ -116,11 +114,7 @@ _id  // parsed as _id
 ab!  // invalid
 `ab!`  // parsed as ab!
 `"ab"`  // parsed as "ab"
-```
-
-Identifier quote characters can be included within an identifier if you quote the identifier. If the character to be included within the identifier is the same as that used to quote the identifier itself, then you need to double the character.
-```sql
-`a``b`  // parsed as a`b
+`a`b`  // invalid
 `a\`b`  // parsed as a`b
 ```
 
@@ -132,6 +126,7 @@ The constraints of node names are almost the same as the identifiers, but you sh
 
 - `root` is a reserved word, and it is only allowed to appear at the beginning layer of the time series. If `root` appears in other layers, it cannot be parsed and an error will be reported.
 - Character `.` is not permitted in unquoted or quoted node names. If you must do it (even if it is not recommended), you can enclose it within either single quote (`'`) or double quote (`"`). In this case, quotes are recognized as part of the node name to avoid ambiguity.
+- Among the node name enclosed in the reverse quota, single quotes and double quotes need to use a backslash to escape.
 - In particular, if the system is deployed on a Windows machine, the storage group layer name will be **case-insensitive**. For example, creating both `root.ln` and `root.LN` at the same time is not allowed.
 
 Examples:
@@ -160,6 +155,14 @@ CREATE TIMESERIES root.a.b."s1.s2".c WITH DATATYPE=INT32, ENCODING=RLE
 // root.a.b."s1.s2".c will be parsed as Path[root, a, b, "s1.s2", c]
 ```
 
+```sql
+CREATE TIMESERIES root.a.b.`s1"s2`.c WITH DATATYPE=INT32, ENCODING=RLE
+// invalid!
+
+CREATE TIMESERIES root.a.b.`s1\"s2`.c WITH DATATYPE=INT32, ENCODING=RLE
+// root.a.b.`s1\"s2`.c be parsed as Path[root, a, b, s1\"s2, c]
+```
+
 ## Keywords and Reserved Words
 
 Keywords are words that have significance in SQL require special treatment for use as identifiers and node names, and need to be escaped with backticks.
@@ -182,6 +185,34 @@ select `0` + 0 from root.sg.d -- valid expression, add number 0 to each point of
 select myudf(`'a'`, 'x') from root.sg.d -- valid expression, call function myudf with timeseries root.sg.d.'a' as the 1st parameter, and a string constant 'x' as the 2nd parameter
 ```
 
+## Quote Symbol
+
+### Double quotes ("), single quotes (')
+
+Double quotes and single quotes are used in the following scenarios:
+
+1. String literals are represented by strings enclosed in single or double quotes.
+2. If you want to use the path separator (`.`) in the path node name, you need to enclose the node name in single or double quotes. In this case, to avoid ambiguity, the quotes are treated as part of the node name by the system.
+
+### Backticks (\`)
+
+Backticks are used in the following scenarios:
+
+1. When using special characters in an identifier, the identifier needs to be enclosed in backticks.
+2. When using special characters other than path separators in the path node name, the path node name needs to be enclosed in backticks. In this case, the backticks are not considered part of the node name by the system.
+
+### Backslash (\\)
+
+backslashes are used in the following scenarios:
+
+- In string literals, double or single quote should be escaped with a backslash.
+  - e.g. "str\\"ing" is parsed as str"ing, 'str\\'ing' is parsed as str'ing.
+- In an identifier, backtick should be escaped with a backslash.
+  - e.g. \`na\\\`me\` is parsed as na\`me.
+- In path node names, double or single quote should be escaped with a backslash. To avoid ambiguity, backslashes are recognized as part of the node name.
+  - e.g. root.sg1.d1."a\\"b" is parsed as Path[root, sg1, d1, "a\\"b"], root.sg1.d1.'a\\'b' is parsed as Path[ root, sg1, d1, 'a\\'b'], root.sg1.d1.\`a\\"b\` is parsed as Path[root, sg1, d1, a\\"b], root.sg1.d1.\`a\\'b\` is parsed as Path[root, sg1, d1, a\\'b].
+  
+
 ## Learn More
 
 Please read the lexical and grammar description files in our code repository:
diff --git a/docs/zh/UserGuide/Reference/Syntax-Conventions.md b/docs/zh/UserGuide/Reference/Syntax-Conventions.md
index a0c7a53..8ca5c96 100644
--- a/docs/zh/UserGuide/Reference/Syntax-Conventions.md
+++ b/docs/zh/UserGuide/Reference/Syntax-Conventions.md
@@ -44,22 +44,20 @@
 
 通过以下几种方式可以在字符串内使用引号:
 
-- 使用两个连续单引号转义单引号,即 `''` 转义为 `'`。
-- 使用两个连续双引号转义双引号,即 `""` 转义为 `"`。
 - 在引号前使用转义符 (\\)。
-- 在单引号括的的字符串内,双引号无需特殊处理。同理,在双引号括的的字符串内,单引号无需特殊处理。(但转义依然生效)
+- 在单引号括的的字符串内,双引号无需特殊处理。同理,在双引号括的的字符串内,单引号无需特殊处理。
 
 关于引号和转义字符的使用示例如下:
 ```js
 'string'  // string
 '"string"'  // "string"
 '""string""'  // ""string""
-'str''ing'  // str'ing
+'str\'ing'  // str'ing
 '\'string'  // 'string
 "string" // string
 "'string'"  // 'string'
 "''string''"  // ''string''
-"str""ing"  // str"ing
+"str\"ing"  // str"ing
 "\"string"  // "string
 ```
 
@@ -89,7 +87,6 @@
 
 `NULL`值表示没有数据。`NULL`对大小写不敏感。
 
-
 ## 标识符
 
 在 IoTDB 中,触发器名称、UDF函数名、元数据模板名称、用户与角色名等被称为标识符。
@@ -103,7 +100,7 @@
 - 标识符是大小写敏感的。
 - 注意:用户与角色名对大小写不敏感,并且不允许转义特殊字符。
 
-如果标识符要包含不允许的特殊字符,或者使用系统关键字,需要用反引号(`)对标识符进行引用。
+如果标识符要包含不允许的特殊字符,或者使用系统关键字,需要用反引号(`)对标识符进行引用。反引号引用的标识符中出现反引号需要反斜杠转义。
 
 示例如下:
 ```sql
@@ -116,11 +113,7 @@ _id  // 合法,被解析为 _id
 ab!  // 不合法,包含不被允许的特殊字符
 `ab!`  // 合法,被解析为 ab!
 `"ab"`  // 合法,被解析为 "ab"
-```
-
-引用的标识符中仍然可以使用反引号,但是需要使用两个反引号或反斜杠进行转义。示例如下:
-```sql
-`a``b`  // 合法,被解析为 a`b
+`a`b`  // 不合法,反引号应使用反斜杠进行转义
 `a\`b`  // 合法,被解析为 a`b
 ```
 
@@ -131,7 +124,8 @@ ab!  // 不合法,包含不被允许的特殊字符
 路径节点名的约束与标识符基本一致,但要额外注意以下几点:
 
 - `root` 只允许出现时间序列的开头,若其他层级出现 `root`,则无法解析,提示报错。
-- 无论是否使用引用符,`.` 字符都不能出现在路径节点名中。如果一定要使用 `.` (不推荐!),需要用单引号或双引号括起。在这种情况下,为避免引发歧义,引号被系统视为节点名的一部分。
+- 无论是否使用反引号引用,路径分隔符(`.`)都不能出现在路径节点名中。 如果路径节点名中一定要出现 `.` (不推荐!),需要用单引号或双引号括起。在这种情况下,为避免引发歧义,引号被系统视为节点名的一部分。
+- 在反引号括起的路径节点名中,单引号和双引号需要使用反斜杠进行转义。
 - 特别地,如果系统在 Windows 系统上部署,那么存储组层级名称是**大小写不敏感**的。例如,同时创建 `root.ln` 和 `root.LN` 是不被允许的。
 
 示例如下:
@@ -160,6 +154,14 @@ CREATE TIMESERIES root.a.b."s1.s2".c WITH DATATYPE=INT32, ENCODING=RLE
 // root.a.b."s1.s2".c 将被解析为 Path[root, a, b, "s1.s2", c]
 ```
 
+```sql
+CREATE TIMESERIES root.a.b.`s1"s2`.c WITH DATATYPE=INT32, ENCODING=RLE
+// 解析失败!
+
+CREATE TIMESERIES root.a.b.`s1\"s2`.c WITH DATATYPE=INT32, ENCODING=RLE
+// root.a.b.`s1\"s2`.c 将被解析为 Path[root, a, b, s1\"s2, c]
+```
+
 ## 关键字和保留字
 
 关键字是在 SQL 具有特定含义的词,不能直接用于标识符或路径节点名,需要使用反引号进行转义。保留字是关键字的一个子集,保留字不能用于标识符或路径节点名(即使进行了转义)。
@@ -181,6 +183,33 @@ select `0` + 0 from root.sg.d -- 表达式,对时间序列 root.sg.d.0 的每
 select myudf(`'a'`, 'x') from root.sg.d -- 表达式,调用函数 myudf,第一个参数为时间序列 root.sg.d.'a',第二个参数为字符串常量 'x'
 ```
 
+## 引用符号
+
+### 双引号(")、单引号(')
+
+双引号、单引号的使用场景如下:
+
+1. 字符串字面值由单引号或双引号括起的字符串表示。
+2. 如果要在路径节点名中使用路径分隔符(`.`),则需要将路径节点名用单引号或双引号括起。在这种情况下,为避免引发歧义,引号被系统视为节点名的一部分。
+
+### 反引号(\`)
+
+反引号的使用场景如下:
+
+1. 在标识符中使用特殊字符时,标识符需要使用反引号括起。
+2. 在路径节点名中使用除路径分隔符之外的特殊字符时,路径节点名需要使用反引号括起。在这种情况下,反引号不会被系统视为节点名的一部分。
+
+### 反斜杠(\)
+
+反斜杠的使用场景如下:
+- 在字符串常量中,出现双引号或单引号时,要使用反斜杠进行转义。
+  - 如:"str\\"ing" 解析为 str"ing、'str\\'ing' 解析为 str'ing。
+- 在标识符中,出现反引号时,要使用反斜杠进行转义。
+  - 如:\`na\\\`me\` 解析为 na\`me。
+- 在路径节点名中,出现双引号或单引号时,要使用反斜杠进行转义。注意,为了避免歧义,反斜杠会被系统视为节点名的一部分。 
+  - 如:root.sg1.d1."a\\"b" 解析为 Path[root, sg1, d1, "a\\"b"]、root.sg1.d1.'a\\'b' 解析为 Path[root, sg1, d1, 'a\\'b']、root.sg1.d1.\`a\\"b\` 解析为 Path[root, sg1, d1, a\\"b]、root.sg1.d1.\`a\\'b\` 解析为 Path[root, sg1, d1, a\\'b]。
+
+
 ## 了解更多
 
 请阅读代码仓库中的词法和语法描述文件:
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
index 17389e0..92089fd 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
@@ -428,9 +428,9 @@ public class IoTDBDeletionIT {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       statement.execute(
-          "CREATE TIMESERIES root.ln.d1.`\"status,01\"` WITH DATATYPE=BOOLEAN, ENCODING=PLAIN");
-      statement.execute("INSERT INTO root.ln.d1(timestamp,`\"status,01\"`) VALUES(300, true)");
-      statement.execute("INSERT INTO root.ln.d1(timestamp,`\"status,01\"`) VALUES(500, false)");
+          "CREATE TIMESERIES root.ln.d1.\"status,01\" WITH DATATYPE=BOOLEAN, ENCODING=PLAIN");
+      statement.execute("INSERT INTO root.ln.d1(timestamp,\"status,01\") VALUES(300, true)");
+      statement.execute("INSERT INTO root.ln.d1(timestamp,\"status,01\") VALUES(500, false)");
 
       try (ResultSet resultSet = statement.executeQuery("select `\"status,01\"` from root.ln.d1")) {
         int cnt = 0;
@@ -440,7 +440,7 @@ public class IoTDBDeletionIT {
         Assert.assertEquals(2, cnt);
       }
 
-      statement.execute("DELETE FROM root.ln.d1.`\"status,01\"` WHERE time <= 400");
+      statement.execute("DELETE FROM root.ln.d1.\"status,01\" WHERE time <= 400");
 
       try (ResultSet resultSet = statement.executeQuery("select `\"status,01\"` from root.ln.d1")) {
         int cnt = 0;
@@ -450,7 +450,7 @@ public class IoTDBDeletionIT {
         Assert.assertEquals(1, cnt);
       }
 
-      statement.execute("DELETE FROM root.ln.d1.`\"status,01\"`");
+      statement.execute("DELETE FROM root.ln.d1.\"status,01\"");
 
       try (ResultSet resultSet = statement.executeQuery("select `\"status,01\"` from root.ln.d1")) {
         int cnt = 0;
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBQuotedPathIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBQuotedPathIT.java
index 51e0f56..5977865 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBQuotedPathIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBQuotedPathIT.java
@@ -112,7 +112,7 @@ public class IoTDBQuotedPathIT {
   public void testIllegalStorageGroup() throws SQLException {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
-      statement.execute("SET STORAGE GROUP TO root.`\"ln\"`");
+      statement.execute("SET STORAGE GROUP TO root.\"ln\"");
     } catch (IoTDBSQLException e) {
       Assert.assertEquals(
           "315: The storage group name can only be characters, numbers and underscores. root.\"ln\" is not a legal path",
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java
index ad62e8c..0d868ca 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSyntaxConventionIT.java
@@ -58,24 +58,20 @@ public class IoTDBSyntaxConventionIT {
       "'string'",
       "'\"string\"'",
       "'\"\"string\"\"'",
-      "'str''ing'",
       "'\\'string'",
       "\"string\"",
       "\"'string'\"",
       "\"''string''\"",
-      "\"str\"\"ing\"",
       "\"\\\"string\""
     };
     String[] resultData = {
       "string",
       "\"string\"",
       "\"\"string\"\"",
-      "str'ing",
       "'string",
       "string",
       "'string'",
       "''string''",
-      "str\"ing",
       "\"string"
     };
 
@@ -98,7 +94,7 @@ public class IoTDBSyntaxConventionIT {
         Assert.assertEquals(resultData[cnt], resultSet.getString("root.sg1.d1.s1"));
         cnt++;
       }
-      Assert.assertEquals(10, cnt);
+      Assert.assertEquals(8, cnt);
 
       for (int i = 0; i < insertData.length; i++) {
         String querySql = String.format("SELECT s1 FROM root.sg1.d1 WHERE s1 = %s", insertData[i]);
@@ -223,7 +219,7 @@ public class IoTDBSyntaxConventionIT {
   public void testIllegalExpression4() {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
-      statement.execute("CREATE TIMESERIES root.sg1.d1.`'a'` INT64");
+      statement.execute("CREATE TIMESERIES root.sg1.d1.'a' INT64");
       try {
         statement.execute("SELECT 'a' FROM root.sg1.d1");
         fail();
@@ -239,7 +235,22 @@ public class IoTDBSyntaxConventionIT {
   @Test
   public void testNodeName() {
     String[] createNodeNames = {
-      "`select`", "'select'", "\"select\"", "`a+b`", "'a+b'", "\"a+b\"", "'a.b'", "\"a.b\""
+      "`select`",
+      "'select'",
+      "\"select\"",
+      "`a+b`",
+      "'a+b'",
+      "\"a+b\"",
+      "'a.b'",
+      "\"a.b\"",
+      "\"a'.'b\"",
+      "\"a.\"",
+      "\".a\"",
+      "'a.'",
+      "'.a'",
+      "`\\\"a`",
+      "`a\\\"`",
+      "\"a\\\".\\\"b\""
     };
     String[] selectNodeNames = {
       "`select`",
@@ -249,10 +260,33 @@ public class IoTDBSyntaxConventionIT {
       "`'a+b'`",
       "`\"a+b\"`",
       "`'a.b'`",
-      "`\"a.b\"`"
+      "`\"a.b\"`",
+      "`\"a'.'b\"`",
+      "`\"a.\"`",
+      "`\".a\"`",
+      "`'a.'`",
+      "`'.a'`",
+      "`\\\"a`",
+      "`a\\\"`",
+      "`\"a\\\".\\\"b\"`"
     };
     String[] resultNodeNames = {
-      "select", "'select'", "\"select\"", "a+b", "'a+b'", "\"a+b\"", "'a.b'", "\"a.b\""
+      "select",
+      "'select'",
+      "\"select\"",
+      "a+b",
+      "'a+b'",
+      "\"a+b\"",
+      "'a.b'",
+      "\"a.b\"",
+      "\"a'.'b\"",
+      "\"a.\"",
+      "\".a\"",
+      "'a.'",
+      "'.a'",
+      "\\\"a",
+      "a\\\"",
+      "\"a\\\".\\\"b\""
     };
     String[] resultTimeseries = {
       "root.sg1.d1.select",
@@ -262,7 +296,15 @@ public class IoTDBSyntaxConventionIT {
       "root.sg1.d1.'a+b'",
       "root.sg1.d1.\"a+b\"",
       "root.sg1.d1.'a.b'",
-      "root.sg1.d1.\"a.b\""
+      "root.sg1.d1.\"a.b\"",
+      "root.sg1.d1.\"a'.'b\"",
+      "root.sg1.d1.\"a.\"",
+      "root.sg1.d1.\".a\"",
+      "root.sg1.d1.'a.'",
+      "root.sg1.d1.'.a'",
+      "root.sg1.d1.\\\"a",
+      "root.sg1.d1.a\\\"",
+      "root.sg1.d1.\"a\\\".\\\"b\""
     };
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
@@ -306,12 +348,121 @@ public class IoTDBSyntaxConventionIT {
   }
 
   @Test
-  public void testIllegalNodeName1() {
+  public void testIllegalNodeName() {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
-      statement.execute("CREATE TIMESERIES root.sg1.d1.`a.b` TEXT");
+      try {
+        statement.execute("CREATE TIMESERIES root.sg1.d1.`a.b` TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg.d1.`\"a`.s1 TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg.d1.`a\"`.s1 TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg.d1.`'a`.s1 TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg.d1.`a'`.s1 TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg1.d1.\"a\".b\" TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg.`\"a`.`\"` TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute("CREATE TIMESERIES root.sg.`\"ab`.`cd\"` TEXT");
+        fail();
+      } catch (SQLException ignored) {
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
+      fail();
+    }
+  }
+
+  @Test
+  public void testIdentifier() {
+    String[] createIdentifiers = {
+      "id",
+      "ID",
+      "id0",
+      "_id",
+      "0id",
+      "233",
+      "`ab!`",
+      "`\"ab\"`",
+      "`\\\"ac\\\"`",
+      "`'ab'`",
+      "`a.b`",
+      "`a\\`b`"
+    };
+    String[] resultIdentifiers = {
+      "id", "ID", "id0", "_id", "0id", "233", "ab!", "\"ab\"", "\"ac\"", "'ab'", "a.b", "a`b"
+    };
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      for (int i = 0; i < createIdentifiers.length; i++) {
+        String createTemplateSql =
+            String.format(
+                "create schema template %s (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)",
+                createIdentifiers[i]);
+        System.out.println("CREATE TEMPLATE: " + createTemplateSql);
+        statement.execute(createTemplateSql);
+      }
+
+      boolean hasResult = statement.execute("SHOW TEMPLATES");
+      Assert.assertTrue(hasResult);
+      Set<String> expectedResult = new HashSet<>(Arrays.asList(resultIdentifiers));
+
+      ResultSet resultSet = statement.getResultSet();
+      while (resultSet.next()) {
+        Assert.assertTrue(expectedResult.contains(resultSet.getString("template name")));
+        expectedResult.remove(resultSet.getString("template name"));
+      }
+      Assert.assertEquals(0, expectedResult.size());
+
+    } catch (SQLException e) {
+      e.printStackTrace();
+      fail();
+    }
+  }
+
+  @Test
+  public void testIllegaltIdentifier() {
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      try {
+        statement.execute(
+            "create schema template ab! (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+        fail();
+      } catch (SQLException ignored) {
+      }
+      try {
+        statement.execute(
+            "create schema template `a`b` (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+        fail();
+      } catch (SQLException ignored) {
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
       fail();
-    } catch (SQLException ignored) {
     }
   }
 }
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java
index 200d5ab..2cc0716 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java
@@ -384,9 +384,9 @@ public class IoTDBDeletionIT {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       statement.execute(
-          "CREATE TIMESERIES root.ln.d1.`\"status,01\"` WITH DATATYPE=BOOLEAN, ENCODING=PLAIN");
-      statement.execute("INSERT INTO root.ln.d1(timestamp,`\"status,01\"`) VALUES(300, true)");
-      statement.execute("INSERT INTO root.ln.d1(timestamp,`\"status,01\"`) VALUES(500, false)");
+          "CREATE TIMESERIES root.ln.d1.\"status,01\" WITH DATATYPE=BOOLEAN, ENCODING=PLAIN");
+      statement.execute("INSERT INTO root.ln.d1(timestamp,\"status,01\") VALUES(300, true)");
+      statement.execute("INSERT INTO root.ln.d1(timestamp,\"status,01\") VALUES(500, false)");
 
       try (ResultSet resultSet = statement.executeQuery("select `\"status,01\"` from root.ln.d1")) {
         int cnt = 0;
@@ -396,7 +396,7 @@ public class IoTDBDeletionIT {
         Assert.assertEquals(2, cnt);
       }
 
-      statement.execute("DELETE FROM root.ln.d1.`\"status,01\"` WHERE time <= 400");
+      statement.execute("DELETE FROM root.ln.d1.\"status,01\" WHERE time <= 400");
 
       try (ResultSet resultSet = statement.executeQuery("select `\"status,01\"` from root.ln.d1")) {
         int cnt = 0;
@@ -406,7 +406,7 @@ public class IoTDBDeletionIT {
         Assert.assertEquals(1, cnt);
       }
 
-      statement.execute("DELETE FROM root.ln.d1.`\"status,01\"`");
+      statement.execute("DELETE FROM root.ln.d1.\"status,01\"");
 
       try (ResultSet resultSet = statement.executeQuery("select `\"status,01\"` from root.ln.d1")) {
         int cnt = 0;
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/versionadaption/IoTDBSyntaxConventionVersionAdaptionIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/versionadaption/IoTDBSyntaxConventionVersionAdaptionIT.java
index af3b5ca..e514d11 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/versionadaption/IoTDBSyntaxConventionVersionAdaptionIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/versionadaption/IoTDBSyntaxConventionVersionAdaptionIT.java
@@ -81,4 +81,20 @@ public class IoTDBSyntaxConventionVersionAdaptionIT {
       fail();
     }
   }
+
+  @Test
+  public void testExpression3() {
+    try (Connection connection = EnvFactory.getEnv().getConnection(Constant.Version.V_0_12);
+        Statement statement = connection.createStatement()) {
+      statement.execute("CREATE TIMESERIES root.sg1.d1.\"a\" with datatype = INT64");
+      boolean hasResult = statement.execute("SELECT \"a\" FROM root.sg1.d1");
+      Assert.assertTrue(hasResult);
+
+      ResultSet resultSet = statement.getResultSet();
+      Assert.assertFalse(resultSet.next());
+    } catch (SQLException e) {
+      e.printStackTrace();
+      fail();
+    }
+  }
 }
diff --git a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
index 2ce313e..613f4af 100644
--- a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+++ b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
@@ -1632,57 +1632,4 @@ public class IoTDBSessionSimpleIT {
       Assert.assertNull(record.getFields().get(i).getDataType());
     }
   }
-
-  @Test
-  public void testInsertWithIllegalMeasurementId() throws Exception {
-    session = new Session("127.0.0.1", 6667, "root", "root");
-    session.open();
-
-    String deviceId = "root.sg1.d1";
-    List<String> measurements = new ArrayList<>();
-    measurements.add("a.b");
-    measurements.add("a\".\"b");
-
-    List<String> values = new ArrayList<>();
-    values.add("1");
-    values.add("1.2");
-
-    try {
-      session.insertRecord(deviceId, 1L, measurements, values);
-      fail();
-    } catch (Exception ignored) {
-
-    }
-
-    SessionDataSet dataSet = session.executeQueryStatement("show timeseries root");
-    Assert.assertFalse(dataSet.hasNext());
-
-    measurements.clear();
-    measurements.add("\"a.b\"");
-    measurements.add("\"a“(Φ)”b\"");
-    measurements.add("\"a>b\"");
-    measurements.add("'a.b'");
-    measurements.add("'a“(Φ)”b'");
-    measurements.add("'a>b'");
-    measurements.add("a“(Φ)”b");
-    measurements.add("a>b");
-
-    values.clear();
-    for (int i = 0; i < measurements.size(); i++) {
-      values.add("1");
-    }
-
-    session.insertRecord(deviceId, 1L, measurements, values);
-
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.\"a.b\""));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.\"a“(Φ)”b\""));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.\"a>b\""));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.'a.b'"));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.'a“(Φ)”b'"));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.'a>b'"));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a“(Φ)”b`"));
-    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a>b`"));
-
-    session.close();
-  }
 }
diff --git a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSyntaxConventionIT.java b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSyntaxConventionIT.java
new file mode 100644
index 0000000..53ed5ee
--- /dev/null
+++ b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSyntaxConventionIT.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.session;
+
+import org.apache.iotdb.db.conf.IoTDBConstant;
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.itbase.category.LocalStandaloneTest;
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+@Category({LocalStandaloneTest.class})
+public class IoTDBSessionSyntaxConventionIT {
+
+  private Session session;
+
+  @Before
+  public void setUp() {
+    System.setProperty(IoTDBConstant.IOTDB_CONF, "src/test/resources/");
+    EnvironmentUtils.envSetUp();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    session.close();
+    EnvironmentUtils.cleanEnv();
+  }
+
+  @Test
+  public void createTimeSeries() throws IoTDBConnectionException, StatementExecutionException {
+    session = new Session("127.0.0.1", 6667, "root", "root");
+    session.open();
+
+    String storageGroup = "root.sg";
+    session.setStorageGroup(storageGroup);
+
+    try {
+      session.createTimeseries(
+          "root.sg.d1.\"a.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY);
+      fail();
+    } catch (Exception e) {
+      Assert.assertTrue(e.getMessage().contains("is not a legal path"));
+    }
+
+    try {
+      session.createTimeseries(
+          "root.sg.d1.a\".s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY);
+      fail();
+    } catch (Exception e) {
+      Assert.assertTrue(e.getMessage().contains("is not a legal path"));
+    }
+
+    final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES");
+    assertFalse(dataSet.hasNext());
+
+    session.deleteStorageGroup(storageGroup);
+    session.close();
+  }
+
+  @Test
+  public void testInsert() throws Exception {
+    session = new Session("127.0.0.1", 6667, "root", "root");
+    session.open();
+
+    String deviceId = "root.sg1.d1";
+    List<String> measurements = new ArrayList<>();
+    measurements.add("a.b");
+    measurements.add("a\".\"b");
+    measurements.add("\"a.b");
+
+    List<String> values = new ArrayList<>();
+    for (int i = 0; i < measurements.size(); i++) {
+      values.add("1");
+    }
+
+    try {
+      session.insertRecord(deviceId, 1L, measurements, values);
+      fail();
+    } catch (Exception ignored) {
+
+    }
+
+    SessionDataSet dataSet = session.executeQueryStatement("show timeseries root");
+    Assert.assertFalse(dataSet.hasNext());
+
+    measurements.clear();
+    measurements.add("\"a.b\"");
+    measurements.add("\"a“(Φ)”b\"");
+    measurements.add("\"a>b\"");
+    measurements.add("'a.b'");
+    measurements.add("'a“(Φ)”b'");
+    measurements.add("'a>b'");
+    measurements.add("a“(Φ)”b");
+    measurements.add("a>b");
+    measurements.add("\\\"a");
+
+    values.clear();
+    for (int i = 0; i < measurements.size(); i++) {
+      values.add("1");
+    }
+
+    session.insertRecord(deviceId, 1L, measurements, values);
+
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.\"a.b\""));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.\"a“(Φ)”b\""));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.\"a>b\""));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.'a.b'"));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.'a“(Φ)”b'"));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.'a>b'"));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a“(Φ)”b`"));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a>b`"));
+    Assert.assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\\\"a`"));
+
+    session.close();
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
index 1be2982..9b2ae8b 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
@@ -60,6 +60,9 @@ public class MetaUtils {
           throw new IllegalPathException(path);
         }
       } else if (path.charAt(i) == '"') {
+        if (i > 0 && path.charAt(i - 1) == '\\') {
+          continue;
+        }
         int endIndex = path.indexOf('"', i + 1);
         // if a double quotes with escape character
         while (endIndex != -1 && path.charAt(endIndex - 1) == '\\') {
@@ -77,6 +80,9 @@ public class MetaUtils {
           throw new IllegalPathException(path);
         }
       } else if (path.charAt(i) == '\'') {
+        if (i > 0 && path.charAt(i - 1) == '\\') {
+          continue;
+        }
         int endIndex = path.indexOf('\'', i + 1);
         // if a double quotes with escape character
         while (endIndex != -1 && path.charAt(endIndex - 1) == '\\') {
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
index 97a0158..48af4d9 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
@@ -218,7 +218,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       CreateAlignedTimeSeriesOperator createAlignedTimeSeriesOperator) {
     for (int i = 0; i < ctx.nodeNameWithoutWildcard().size(); i++) {
       createAlignedTimeSeriesOperator.addMeasurement(
-          parseNodeNameWithoutWildcard(ctx.nodeNameWithoutWildcard(i)));
+          parseNodeName(ctx.nodeNameWithoutWildcard(i).getText()));
       parseAttributeClauses(ctx.attributeClauses(i), createAlignedTimeSeriesOperator);
     }
   }
@@ -227,7 +227,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       IoTDBSqlParser.AttributeClausesContext ctx,
       CreateTimeSeriesOperator createTimeSeriesOperator) {
     if (ctx.alias() != null) {
-      createTimeSeriesOperator.setAlias(parseNodeNameCanInExpr(ctx.alias().nodeNameCanInExpr()));
+      createTimeSeriesOperator.setAlias(parseNodeName(ctx.alias().nodeNameCanInExpr().getText()));
     }
     final String dataType = ctx.dataType.getText().toUpperCase();
     final TSDataType tsDataType = TSDataType.valueOf(dataType);
@@ -253,8 +253,8 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       props = new HashMap<>(properties.size());
       for (IoTDBSqlParser.PropertyClauseContext property : properties) {
         props.put(
-            parseStringWithQuotes(property.identifier().getText()).toLowerCase(),
-            parseStringWithQuotes(property.propertyValue().getText().toLowerCase()));
+            parseIdentifier(property.identifier().getText()).toLowerCase(),
+            parseStringLiteral(property.propertyValue().getText().toLowerCase()));
       }
     }
     createTimeSeriesOperator.setCompressor(compressor);
@@ -310,7 +310,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitCreateSchemaTemplate(IoTDBSqlParser.CreateSchemaTemplateContext ctx) {
     CreateTemplateOperator createTemplateOperator =
         new CreateTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_CREATE);
-    createTemplateOperator.setName(ctx.templateName.getText());
+    createTemplateOperator.setName(parseIdentifier(ctx.templateName.getText()));
     if (ctx.ALIGNED() != null) {
       // aligned
       List<String> measurements = new ArrayList<>();
@@ -319,8 +319,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       List<CompressionType> compressors = new ArrayList<>();
       for (IoTDBSqlParser.TemplateMeasurementClauseContext templateClauseContext :
           ctx.templateMeasurementClause()) {
-        measurements.add(
-            parseNodeNameWithoutWildcard(templateClauseContext.nodeNameWithoutWildcard()));
+        measurements.add(parseNodeName(templateClauseContext.nodeNameWithoutWildcard().getText()));
         parseAttributeClause(
             templateClauseContext.attributeClauses(), dataTypes, encodings, compressors);
       }
@@ -346,7 +345,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     List<TSEncoding> encodings = new ArrayList<>();
     List<CompressionType> compressors = new ArrayList<>();
     // single template measurement
-    measurements.add(parseNodeNameWithoutWildcard(ctx.nodeNameWithoutWildcard()));
+    measurements.add(parseNodeName(ctx.nodeNameWithoutWildcard().getText()));
     parseAttributeClause(ctx.attributeClauses(), dataTypes, encodings, compressors);
     createTemplateOperator.addMeasurements(measurements);
     createTemplateOperator.addDataTypes(dataTypes);
@@ -411,8 +410,8 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitCreateFunction(IoTDBSqlParser.CreateFunctionContext ctx) {
     CreateFunctionOperator createFunctionOperator =
         new CreateFunctionOperator(SQLConstant.TOK_FUNCTION_CREATE);
-    createFunctionOperator.setUdfName(parseStringWithQuotes(ctx.udfName.getText()));
-    createFunctionOperator.setClassName(parseStringWithQuotes(ctx.className.getText()));
+    createFunctionOperator.setUdfName(parseIdentifier(ctx.udfName.getText()));
+    createFunctionOperator.setClassName(parseStringLiteral(ctx.className.getText()));
     return createFunctionOperator;
   }
 
@@ -422,19 +421,19 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitCreateTrigger(IoTDBSqlParser.CreateTriggerContext ctx) {
     CreateTriggerOperator createTriggerOperator =
         new CreateTriggerOperator(SQLConstant.TOK_TRIGGER_CREATE);
-    createTriggerOperator.setTriggerName(parseStringWithQuotes(ctx.triggerName.getText()));
+    createTriggerOperator.setTriggerName(parseIdentifier(ctx.triggerName.getText()));
     createTriggerOperator.setEvent(
         ctx.triggerEventClause().BEFORE() != null
             ? TriggerEvent.BEFORE_INSERT
             : TriggerEvent.AFTER_INSERT);
     createTriggerOperator.setFullPath(parseFullPath(ctx.fullPath()));
-    createTriggerOperator.setClassName(parseStringWithQuotes(ctx.className.getText()));
+    createTriggerOperator.setClassName(parseStringLiteral(ctx.className.getText()));
     if (ctx.triggerAttributeClause() != null) {
       for (IoTDBSqlParser.TriggerAttributeContext triggerAttributeContext :
           ctx.triggerAttributeClause().triggerAttribute()) {
         createTriggerOperator.addAttribute(
-            parseStringWithQuotes(triggerAttributeContext.key.getText()),
-            parseStringWithQuotes(triggerAttributeContext.value.getText()));
+            parseStringLiteral(triggerAttributeContext.key.getText()),
+            parseStringLiteral(triggerAttributeContext.value.getText()));
       }
     }
     return createTriggerOperator;
@@ -450,7 +449,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     createContinuousQueryOperator.setQuerySql(ctx.getText());
 
     createContinuousQueryOperator.setContinuousQueryName(
-        parseStringWithQuotes(ctx.continuousQueryName.getText()));
+        parseIdentifier(ctx.continuousQueryName.getText()));
 
     if (ctx.resampleClause() != null) {
       parseResampleClause(ctx.resampleClause(), createContinuousQueryOperator);
@@ -607,8 +606,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     if (ctx.RENAME() != null) {
       alterTimeSeriesOperator.setAlterType(AlterType.RENAME);
       alterMap.put(
-          parseStringWithQuotes(ctx.beforeName.getText()),
-          parseStringWithQuotes(ctx.currentName.getText()));
+          parseIdentifier(ctx.beforeName.getText()), parseIdentifier(ctx.currentName.getText()));
     } else if (ctx.SET() != null) {
       // set
       alterTimeSeriesOperator.setAlterType(AlterType.SET);
@@ -617,7 +615,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       // drop
       alterTimeSeriesOperator.setAlterType(AlterType.DROP);
       for (IoTDBSqlParser.IdentifierContext dropId : ctx.identifier()) {
-        alterMap.put(parseStringWithQuotes(dropId.getText()), null);
+        alterMap.put(parseIdentifier(dropId.getText()), null);
       }
     } else if (ctx.TAGS() != null) {
       // add tag
@@ -646,7 +644,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public void parseAliasClause(
       IoTDBSqlParser.AliasClauseContext ctx, AlterTimeSeriesOperator alterTimeSeriesOperator) {
     if (alterTimeSeriesOperator != null && ctx.identifier() != null) {
-      alterTimeSeriesOperator.setAlias(parseStringWithQuotes(ctx.identifier().getText()));
+      alterTimeSeriesOperator.setAlias(parseIdentifier(ctx.identifier().getText()));
     }
   }
 
@@ -701,7 +699,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitDropFunction(IoTDBSqlParser.DropFunctionContext ctx) {
     DropFunctionOperator dropFunctionOperator =
         new DropFunctionOperator(SQLConstant.TOK_FUNCTION_DROP);
-    dropFunctionOperator.setUdfName(parseStringWithQuotes(ctx.udfName.getText()));
+    dropFunctionOperator.setUdfName(parseIdentifier(ctx.udfName.getText()));
     return dropFunctionOperator;
   }
 
@@ -710,7 +708,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   @Override
   public Operator visitDropTrigger(IoTDBSqlParser.DropTriggerContext ctx) {
     DropTriggerOperator dropTriggerOperator = new DropTriggerOperator(SQLConstant.TOK_TRIGGER_DROP);
-    dropTriggerOperator.setTriggerName(parseStringWithQuotes(ctx.triggerName.getText()));
+    dropTriggerOperator.setTriggerName(parseIdentifier(ctx.triggerName.getText()));
     return dropTriggerOperator;
   }
 
@@ -721,7 +719,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     DropContinuousQueryOperator dropContinuousQueryOperator =
         new DropContinuousQueryOperator(SQLConstant.TOK_CONTINUOUS_QUERY_DROP);
     dropContinuousQueryOperator.setContinuousQueryName(
-        parseStringWithQuotes(ctx.continuousQueryName.getText()));
+        parseIdentifier(ctx.continuousQueryName.getText()));
     return dropContinuousQueryOperator;
   }
 
@@ -731,7 +729,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitDropSchemaTemplate(IoTDBSqlParser.DropSchemaTemplateContext ctx) {
     DropTemplateOperator dropTemplateOperator =
         new DropTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_DROP);
-    dropTemplateOperator.setTemplateName(parseStringWithQuotes((ctx.templateName.getText())));
+    dropTemplateOperator.setTemplateName(parseIdentifier((ctx.templateName.getText())));
     return dropTemplateOperator;
   }
 
@@ -759,7 +757,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitSetSchemaTemplate(IoTDBSqlParser.SetSchemaTemplateContext ctx) {
     SetTemplateOperator operator = new SetTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_SET);
     operator.setPrefixPath(parsePrefixPath(ctx.prefixPath()));
-    operator.setTemplateName(ctx.templateName.getText());
+    operator.setTemplateName(parseIdentifier(ctx.templateName.getText()));
     return operator;
   }
 
@@ -770,7 +768,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     UnsetTemplateOperator operator =
         new UnsetTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_UNSET);
     operator.setPrefixPath(parsePrefixPath(ctx.prefixPath()));
-    operator.setTemplateName(ctx.templateName.getText());
+    operator.setTemplateName(parseIdentifier(ctx.templateName.getText()));
     return operator;
   }
 
@@ -780,7 +778,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   public Operator visitStartTrigger(IoTDBSqlParser.StartTriggerContext ctx) {
     StartTriggerOperator startTriggerOperator =
         new StartTriggerOperator(SQLConstant.TOK_TRIGGER_START);
-    startTriggerOperator.setTriggerName(parseStringWithQuotes(ctx.triggerName.getText()));
+    startTriggerOperator.setTriggerName(parseIdentifier(ctx.triggerName.getText()));
     return startTriggerOperator;
   }
 
@@ -789,7 +787,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   @Override
   public Operator visitStopTrigger(IoTDBSqlParser.StopTriggerContext ctx) {
     StopTriggerOperator stopTriggerOperator = new StopTriggerOperator(SQLConstant.TOK_TRIGGER_STOP);
-    stopTriggerOperator.setTriggerName(parseStringWithQuotes(ctx.triggerName.getText()));
+    stopTriggerOperator.setTriggerName(parseIdentifier(ctx.triggerName.getText()));
     return stopTriggerOperator;
   }
 
@@ -861,13 +859,13 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     if (ctx.containsExpression() != null) {
       operator.setContains(true);
       propertyValueContext = ctx.containsExpression().propertyValue();
-      operator.setKey(parseStringWithQuotes(ctx.containsExpression().identifier().getText()));
+      operator.setKey(parseIdentifier(ctx.containsExpression().identifier().getText()));
     } else {
       operator.setContains(false);
       propertyValueContext = ctx.propertyClause().propertyValue();
-      operator.setKey(parseStringWithQuotes(ctx.propertyClause().identifier().getText()));
+      operator.setKey(parseIdentifier(ctx.propertyClause().identifier().getText()));
     }
-    operator.setValue(parseStringWithQuotes(propertyValueContext.getText()));
+    operator.setValue(parseStringLiteral(propertyValueContext.getText()));
   }
 
   // Show Child Paths
@@ -948,7 +946,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
 
   public Operator visitShowNodesInSchemaTemplate(
       IoTDBSqlParser.ShowNodesInSchemaTemplateContext ctx) {
-    String templateName = parseStringWithQuotes(ctx.templateName.getText());
+    String templateName = parseIdentifier(ctx.templateName.getText());
     return new ShowNodesInTemplateOperator(
         SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW_NODES, templateName);
   }
@@ -957,7 +955,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
 
   public Operator visitShowPathsSetSchemaTemplate(
       IoTDBSqlParser.ShowPathsSetSchemaTemplateContext ctx) {
-    String templateName = parseStringWithQuotes(ctx.templateName.getText());
+    String templateName = parseIdentifier(ctx.templateName.getText());
     return new ShowPathsSetTemplateOperator(
         SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET, templateName);
   }
@@ -966,7 +964,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
 
   public Operator visitShowPathsUsingSchemaTemplate(
       IoTDBSqlParser.ShowPathsUsingSchemaTemplateContext ctx) {
-    String templateName = parseStringWithQuotes(ctx.templateName.getText());
+    String templateName = parseIdentifier(ctx.templateName.getText());
     return new ShowPathsUsingTemplateOperator(
         SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING, templateName);
   }
@@ -1116,7 +1114,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       }
       for (int i = 1; i <= nodeNameWithoutStars.size(); ++i) {
         intoPathNodes[levelLimitOfSourcePrefixPath + i] =
-            parseNodeNameWithoutWildcard(nodeNameWithoutStars.get(i - 1));
+            parseNodeName(nodeNameWithoutStars.get(i - 1).getText());
       }
 
       intoPath = new PartialPath(intoPathNodes);
@@ -1607,7 +1605,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     List<String> measurementList = new ArrayList<>();
     for (IoTDBSqlParser.NodeNameWithoutWildcardContext measurementName :
         ctx.nodeNameWithoutWildcard()) {
-      measurementList.add(parseNodeNameWithoutWildcard(measurementName));
+      measurementList.add(parseNodeName(measurementName.getText()));
     }
     insertOp.setMeasurementList(measurementList.toArray(new String[0]));
     return (ctx.TIME() == null && ctx.TIMESTAMP() == null);
@@ -1718,7 +1716,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     AuthorOperator authorOperator =
         new AuthorOperator(SQLConstant.TOK_AUTHOR_CREATE, AuthorOperator.AuthorType.CREATE_USER);
     authorOperator.setUserName(ctx.userName.getText());
-    authorOperator.setPassWord(parseStringWithQuotes(ctx.password.getText()));
+    authorOperator.setPassWord(parseStringLiteral(ctx.password.getText()));
     return authorOperator;
   }
 
@@ -1740,7 +1738,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
         new AuthorOperator(
             SQLConstant.TOK_AUTHOR_UPDATE_USER, AuthorOperator.AuthorType.UPDATE_USER);
     authorOperator.setUserName(ctx.userName.getText());
-    authorOperator.setNewPassword(parseStringWithQuotes(ctx.password.getText()));
+    authorOperator.setNewPassword(parseStringLiteral(ctx.password.getText()));
     return authorOperator;
   }
 
@@ -1973,7 +1971,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
       settleOperator.setIsSgPath(true);
     } else {
       // TsFile Path
-      String tsFilePath = parseStringWithQuotes(ctx.tsFilePath.getText());
+      String tsFilePath = parseStringLiteral(ctx.tsFilePath.getText());
       settleOperator.setTsFilePath(tsFilePath);
       settleOperator.setIsSgPath(false);
     }
@@ -2050,7 +2048,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     List<IoTDBSqlParser.UsernameWithRootContext> usernameList = ctx.usernameWithRoot();
     List<String> users = new ArrayList<>();
     for (IoTDBSqlParser.UsernameWithRootContext username : usernameList) {
-      users.add(parseStringWithQuotes(username.getText()));
+      users.add(username.getText());
     }
     return new DataAuthOperator(SQLConstant.TOK_GRANT_WATERMARK_EMBEDDING, users);
   }
@@ -2063,7 +2061,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     List<IoTDBSqlParser.UsernameWithRootContext> usernameList = ctx.usernameWithRoot();
     List<String> users = new ArrayList<>();
     for (IoTDBSqlParser.UsernameWithRootContext username : usernameList) {
-      users.add(parseStringWithQuotes(username.getText()));
+      users.add(username.getText());
     }
     return new DataAuthOperator(SQLConstant.TOK_REVOKE_WATERMARK_EMBEDDING, users);
   }
@@ -2169,7 +2167,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     }
     for (IoTDBSqlParser.NodeNameWithoutWildcardContext nodeNameWithoutStar : nodeNamesWithoutStar) {
       i++;
-      path[i] = parseNodeNameWithoutWildcard(nodeNameWithoutStar);
+      path[i] = parseNodeName(nodeNameWithoutStar.getText());
     }
     return new PartialPath(path);
   }
@@ -2197,7 +2195,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     List<IoTDBSqlParser.NodeNameCanInExprContext> nodeNames = ctx.nodeNameCanInExpr();
     String[] path = new String[nodeNames.size()];
     for (int i = 0; i < nodeNames.size(); i++) {
-      path[i] = parseNodeNameCanInExpr(nodeNames.get(i));
+      path[i] = parseNodeName(nodeNames.get(i).getText());
     }
     return new PartialPath(path);
   }
@@ -2210,35 +2208,11 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
 
   /** function for parsing node name. */
   public String parseNodeName(IoTDBSqlParser.NodeNameContext ctx) {
-    if (ctx.QUTOED_ID_WITHOUT_DOT() != null) {
-      return parseStringWithQuotes(ctx.QUTOED_ID_WITHOUT_DOT().getText());
-    } else if (ctx.STRING_LITERAL() != null) {
-      return parseStringWithQuotesInNodeName(ctx.STRING_LITERAL().getText());
-    } else {
-      return ctx.getText();
-    }
-  }
-
-  /** function for parsing node name used in expr. */
-  public String parseNodeNameCanInExpr(IoTDBSqlParser.NodeNameCanInExprContext ctx) {
-    if (ctx.QUTOED_ID_WITHOUT_DOT() != null) {
-      return parseStringWithQuotes(ctx.QUTOED_ID_WITHOUT_DOT().getText());
-    } else if (ctx.QUTOED_ID() != null) {
-      return parseStringWithQuotes(ctx.QUTOED_ID().getText());
-    } else {
-      return ctx.getText();
-    }
-  }
-
-  /** function for parsing node name without wildcard. */
-  public String parseNodeNameWithoutWildcard(IoTDBSqlParser.NodeNameWithoutWildcardContext ctx) {
-    if (ctx.QUTOED_ID_WITHOUT_DOT() != null) {
-      return parseStringWithQuotes(ctx.QUTOED_ID_WITHOUT_DOT().getText());
-    } else if (ctx.STRING_LITERAL() != null) {
-      return parseStringWithQuotesInNodeName(ctx.STRING_LITERAL().getText());
-    } else {
-      return ctx.getText();
+    String src = ctx.getText();
+    if (2 <= src.length() && src.charAt(0) == '`' && src.charAt(src.length() - 1) == '`') {
+      return src.substring(1, src.length() - 1);
     }
+    return src;
   }
 
   /** function for parsing datetime literal. */
@@ -2380,7 +2354,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
                 TSDataType.BOOLEAN, constantContext.BOOLEAN_LITERAL().getText());
           } else if (constantContext.STRING_LITERAL() != null) {
             String text = constantContext.STRING_LITERAL().getText();
-            return new ConstantOperand(TSDataType.TEXT, parseStringWithQuotes(text));
+            return new ConstantOperand(TSDataType.TEXT, parseStringLiteral(text));
           } else if (constantContext.INTEGER_LITERAL() != null) {
             return new ConstantOperand(
                 TSDataType.INT64, constantContext.INTEGER_LITERAL().getText());
@@ -2404,7 +2378,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
 
   private Expression parseFunctionExpression(IoTDBSqlParser.ExpressionContext functionClause) {
     FunctionExpression functionExpression =
-        new FunctionExpression(parseStringWithQuotes(functionClause.functionName().getText()));
+        new FunctionExpression(parseIdentifier(functionClause.functionName().getText()));
 
     // expressions
     boolean hasNonPureConstantSubExpression = false;
@@ -2428,8 +2402,8 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     for (IoTDBSqlParser.FunctionAttributeContext functionAttribute :
         functionClause.functionAttribute()) {
       functionExpression.addAttribute(
-          parseStringWithQuotes(functionAttribute.functionAttributeKey.getText()),
-          parseStringWithQuotes(functionAttribute.functionAttributeValue.getText()));
+          parseStringLiteral(functionAttribute.functionAttributeKey.getText()),
+          parseStringLiteral(functionAttribute.functionAttributeValue.getText()));
     }
 
     return functionExpression;
@@ -2539,7 +2513,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
           new BasicFunctionOperator(
               FilterConstant.lexerToFilterType.get(ctx.comparisonOperator().type.getType()),
               path,
-              parseStringWithQuotes(ctx.constant().getText()));
+              parseStringLiteral(ctx.constant().getText()));
     }
     return basic;
   }
@@ -2673,7 +2647,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
         expression,
         resultColumnContext.AS() == null
             ? null
-            : parseStringWithQuotes(resultColumnContext.identifier().getText()));
+            : parseIdentifier(resultColumnContext.identifier().getText()));
   }
 
   // From Clause
@@ -2824,42 +2798,39 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
         || queryOp instanceof UDAFQueryOperator;
   }
 
-  private String parseStringWithQuotes(String src) {
+  private String parseStringLiteral(String src) {
     if (2 <= src.length()) {
-      if (src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"') {
+      if ((src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"')
+          || (src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'')) {
         String unescapeString = StringEscapeUtils.unescapeJava(src.substring(1, src.length() - 1));
-        return unescapeString.length() == 0 ? "" : unescapeString.replace("\"\"", "\"");
-      }
-      if (src.charAt(0) == '`' && src.charAt(src.length() - 1) == '`') {
-        String unescapeString = StringEscapeUtils.unescapeJava(src.substring(1, src.length() - 1));
-        return unescapeString.length() == 0 ? "" : unescapeString.replace("``", "`");
-      }
-      if (src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'') {
-        String unescapeString = StringEscapeUtils.unescapeJava(src.substring(1, src.length() - 1));
-        return unescapeString.length() == 0 ? "" : unescapeString.replace("''", "'");
+        return unescapeString.length() == 0 ? "" : unescapeString;
       }
     }
     return src;
   }
 
-  private String parseStringWithQuotesInNodeName(String src) {
+  private String parseStringLiteralInInsertValue(String src) {
     if (2 <= src.length()) {
-      if (src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"') {
-        String unescapeString = StringEscapeUtils.unescapeJava(src.substring(1, src.length() - 1));
-        return unescapeString.length() == 0
-            ? "\"\""
-            : "\"" + unescapeString.replace("\"\"", "\"") + "\"";
-      }
-      if (src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'') {
-        String unescapeString = StringEscapeUtils.unescapeJava(src.substring(1, src.length() - 1));
-        return unescapeString.length() == 0 ? "''" : "'" + unescapeString.replace("''", "'") + "'";
+      if ((src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"')
+          || (src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'')) {
+        return StringEscapeUtils.unescapeJava(src);
       }
     }
     return src;
   }
 
-  private String parseStringLiteralInInsertValue(String src) {
-    return parseStringWithQuotesInNodeName(src);
+  private String parseIdentifier(String src) {
+    if (2 <= src.length() && src.charAt(0) == '`' && src.charAt(src.length() - 1) == '`') {
+      return StringEscapeUtils.unescapeJava(src.substring(1, src.length() - 1));
+    }
+    return src;
+  }
+
+  private String parseNodeName(String src) {
+    if (2 <= src.length() && src.charAt(0) == '`' && src.charAt(src.length() - 1) == '`') {
+      return src.substring(1, src.length() - 1);
+    }
+    return src;
   }
 
   /** function for parsing file path used by LOAD statement. */
@@ -2890,8 +2861,8 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     if (ctx.propertyClause(0) != null) {
       for (IoTDBSqlParser.PropertyClauseContext property : tagsList) {
         String value;
-        value = parseStringWithQuotes(property.propertyValue().getText());
-        alterMap.put(parseStringWithQuotes(property.identifier().getText()), value);
+        value = parseStringLiteral(property.propertyValue().getText());
+        alterMap.put(parseIdentifier(property.identifier().getText()), value);
       }
     }
   }
@@ -2903,8 +2874,8 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     if (property3 != null) {
       for (IoTDBSqlParser.PropertyClauseContext property : property2) {
         tags.put(
-            parseStringWithQuotes(property.identifier().getText()),
-            parseStringWithQuotes(property.propertyValue().getText()));
+            parseIdentifier(property.identifier().getText()),
+            parseStringLiteral(property.propertyValue().getText()));
       }
     }
     return tags;