Help Center/ Database and Application Migration UGO/ User Guide/ Syntax Conversion/ Conversion Error Codes/ Error Codes Generated During Conversion from MySQL to GaussDB/ U0400039: The default value definition for STRING data types in GaussDB (M-compatible mode) does not support "\0"(0x00)
Updated on 2025-06-07 GMT+08:00

U0400039: The default value definition for STRING data types in GaussDB (M-compatible mode) does not support "\0"(0x00)

Description

Database Type and Version

  • Source database type and version: MySQL 5.5, 5.6, 5.7, and 8.0
  • Target database type and version: GaussDB (M-compatible mode)

Syntax Example

If the value of GUC parameter m_format_behavior_compat_options contains enable_escape_string, GaussDB does not support "\0"(0x00) as the default value of a column. As a result, the table that uses "\0" as the default value of a column fails to be created. If the value of m_format_behavior_compat_options does not contain enable_escape_string, GaussDB does not report an error. Different from MySQL, GaussDB regards "\0" as a common string consisting of two characters. For example, if you execute the following statement, this error will be reported.
CREATE TABLE test_default_val_0x00(    
id          INT,
c_char      CHAR(3)       DEFAULT '\0\0\0',
c_varchar   VARCHAR(10)   DEFAULT '\0\0\0',
c_binary    BINARY(3)     DEFAULT '\0\0\0',
c_varbinary VARBINARY(10) DEFAULT '\0\0\0' 
);

Suggestion

Modify The default value definition for string data types includes the special character'\0'(0x00).