Updated on 2025-06-30 GMT+08:00

DCL

Table 1 DCL syntax compatibility

Description

Syntax

Difference

Set names with COLLATE specified.

SET [ SESSION | LOCAL ] NAMES {'charset_name' [COLLATE 'collation_name'] | DEFAULT};

GaussDB does not allow charset_name to be different from the database character set. For details, see "SQL Reference > SQL Syntax > SQL Statements > S > SET" in M Compatibility Developer Guide.

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