Help Center/ Database and Application Migration UGO/ User Guide/ Syntax Conversion/ Conversion Error Codes/ Error Codes Generated During Conversion from MySQL to GaussDB/ U0400022: Some GaussDB time functions do not support input parameters of the TIME or TIMETZ data type
Updated on 2025-06-07 GMT+08:00

U0400022: Some GaussDB time functions do not support input parameters of the TIME or TIMETZ data type

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 of versions earlier than V2.0-8.0

Syntax Example

During migration from MySQL to GaussDB of versions earlier than V2.0-8.0, the ADDTIME, DAY, EXTRACT, DAYOFMONTH, DAYOFWEEK, DATEDIFF, MONTH, TO_DAYS, TRUNCATE, UNIX_TIMESTAMP and YEAR functions are converted and rewritten, and this error is reported.

The YEAR and MONTH functions of MySQL can be used to obtain time information of the TIME or TIMETZ data type, but they need to be changed to the DATE_PART function when used in a GaussDB database, for example:

MySQL:

SELECT YEAR(CURRENT_TIME);
SELECT MONTH(CURRENT_TIME);

GaussDB:

SELECT DATE_PART('YEAR', CURRENT_TIME);
SELECT DATE_PART('MONTH', CURRENT_TIME);

Suggestion

Evaluate when these time functions need to be used and check whether the TIME or TIMETZ data type is used for input parameters. If yes, you need to refactor application code to ensure that the converted time functions are correct.