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.
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot