Set names with COLLATE specified. |
SET [ SESSION | LOCAL ] NAMES {'charset_name' [COLLATE 'collation_name'] | DEFAULT}; |
In GaussDB, you cannot specify charset_name to be different from that of the database character set. For details, see "SQL Reference > SQL Syntax > SQL Statements > S > SET" in M Compatibility Developer Guide.
If no character set is specified, MySQL reports an error but GaussDB does not. |
DESCRIBE statements are supported. |
{DESCRIBE | DESC}
tbl_name [col_name | wild] |
- User permission verification is different from that of MySQL.
- In GaussDB, you need the USAGE permission on the schema of a specified table and table-level or column-level permissions on the specified table. Only information about columns with the SELECT, INSERT, UPDATE, REFERENCES, and COMMENT permissions is displayed.
- In MySQL, you need table-level or column-level permissions on a specified table. Only information about columns with the SELECT, INSERT, UPDATE, REFERENCES, and COMMENT permissions is displayed.
- If character string comparison is involved in fuzzy match, the Field field uses the character set utf8mb4 and collation utf8mb4_general_ci.
|
SET sets user variables. |
SET @var_name := expr |
- In MySQL, user-defined variable names can be escaped using escape characters or double quotation marks, but this feature is not supported in GaussDB.
Variable names enclosed in single quotation marks cannot contain other single quotation marks. For example, @'', @''', and @'\'' are not supported. During parsing, the single quotation marks (') cannot be matched or an error will be reported. For example:
-- An error is reported during parsing.
db_mysql=# SET @'''' = 1;
ERROR: syntax error at or near "@"
LINE 1: SET @'''' = 1;
-- The single quotation marks (') cannot be matched during parsing.
db_mysql=# SET @'\'' = 1;
db_mysql'#
Variable names enclosed in double quotation marks cannot contain double quotation marks ("). For example, @"", @"""" and @"\"" are not supported. The double quotation marks cannot be matched or an error will be reported during parsing. For example:
-- An error is reported during parsing.
db_mysql=# SET @"""" = 1;
ERROR: syntax error at or near "@"
LINE 1: SET @"""" = 1;
-- The double quotation marks (") cannot be matched during parsing.
db_mysql=# SET @"\"" = 1;
db_mysql"#
The variable name enclosed by backquotes cannot contain backquotes. For example, @````, @`````, and @`\`` are not supported. During parsing, the backquotes (`) cannot be matched or an error will be reported. For example:
-- An error is reported during parsing.
db_mysql=# SET @```` = 1;
ERROR: syntax error at or near "@"
LINE 1: SET @```` = 1;
-- The backquotes (`) cannot be matched during parsing.
db_mysql=# SET @`\`` = 1;
db_mysql`#
|
SET sets system parameters. |
SET [ SESSION | @@SESSION. | @@ | LOCAL | @@LOCAL.] {config_parameter { TO | = } { expr | DEFAULT } | FROM CURRENT }}; |
- When config_parameter is a system parameter of the BOOLEAN type:
- The parameter value can be set to '1' or '0' or 'true' or 'false' in the character string format in GaussDB but cannot in MySQL.
- If the parameter value is set to the subquery result, when the result is 'true' or 'false' and the non-integer type is 1 or 0, the setting will be successful in GaussDB but will fail in MySQL. When the query result is NULL, the setting in GaussDB will fail but will be successful in MySQL.
|
Switch the current mode with USE. |
USE schema_name |
If the USE statement is used to specify a schema and the user does not have USAGE permissions on the schema, MySQL reports an error while GaussDB specifies the current schema as null.
-- MySQL
mysql> USE test;
ERROR 1044 (42000): Access denied for user 'u1'@'%' to database 'test'
-- GaussDB
m_db=> USE test;
SET
m_db=> SELECT database();
ERROR: function returned NULL
CONTEXT: referenced column: database
|