From 22aa4f15288edd8d621c04cd4e33eb659b5d0277 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Tue, 20 Aug 2024 19:38:47 +0800 Subject: [PATCH] fix: report error when the ttl value is too large --- source/libs/parser/src/parAstCreater.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 2bf82ba98f..20081b7535 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1905,10 +1905,11 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType case TABLE_OPTION_TTL: { int64_t ttl = taosStr2Int64(((SToken*)pVal)->z, NULL, 10); if (ttl > INT32_MAX) { - ttl = INT32_MAX; + pCxt->errCode = TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; + } else { + // ttl can not be smaller than 0, because there is a limitation in sql.y (TTL NK_INTEGER) + ((STableOptions*)pOptions)->ttl = ttl; } - // ttl can not be smaller than 0, because there is a limitation in sql.y (TTL NK_INTEGER) - ((STableOptions*)pOptions)->ttl = ttl; break; } case TABLE_OPTION_SMA: @@ -2516,7 +2517,7 @@ SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pCreateUserStm return pCreateUserStmt; } -SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo, +SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo, int8_t createDb, int8_t is_import) { CHECK_PARSER_STATUS(pCxt); char password[TSDB_USET_PASSWORD_LEN + 3] = {0};