Help Center/
GaussDB/
M-Compatibility Developer Guide(Centralized)/
SQL Reference/
SQL Syntax/
Identifier Description
Updated on 2025-10-23 GMT+08:00
Identifier Description
The M-compatible naming rules for identifiers are as follows:
- Identifiers support backquotes (``) by default.
- When sql_mode is set to ANSI_QUOTES, identifiers support backquotes (``) and double quotation marks ("").
- In special cases, quotation marks can be used to avoid special character errors.
- Characters allowed in unquoted identifiers are as follows:
- ASCII: letters, digits (0-9), underscores (_), dollar signs ($), and number signs (#)
- Extended characters: U+0080 to U+00FF
- Only letters, digits, underscores (_), and extended characters from U+0080 to U+00FF are allowed at the beginning.
- Characters allowed in quoted identifiers are as follows:
- ASCII: U+0001 to U+007F
- Extended characters: U+0080 to U+FFFF
- Identifiers cannot be U+0000 characters or characters greater than U+10000.
- An identifier can start with a digit but cannot consist of only digits unless it is enclosed in quotation marks.
The case sensitivity of M-compatible identifiers is as follows:
- When the GUC parameter lower_case_table_names is set to 0, case-sensitive identifiers include databases, schemas, tables, and views. These identifiers must be case-sensitive during creation and use.
- When the GUC parameter lower_case_table_names is set to 1, databases, schemas, tables (including the sequence names generated by the auto_increment column), and views are case-insensitive during creation and use. In addition, when backquotes or double quotation marks are used to qualify these objects, the objects are still case-insensitive.
- Column names are case-sensitive when they are stored and are case-insensitive when they are used for comparison. Column names are stored as they are in the system and are case-insensitive when they are used.
- Other identifiers:
- They are lowercase in the system. If an identifier is enclosed in double quotation marks (SQL_MODE must be set to ANSI_QUOTES) or backquotes, it is case-sensitive.
- If a schema or table is specified and the GUC parameter lower_case_table_names is set to 0, the schema and table names are case-sensitive. If the GUC parameter lower_case_table_names is set to 1, the schema and table names are case-insensitive.
Parent topic: SQL Syntax
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot