fix: report error when the ttl value is too large

This commit is contained in:
Shungang Li 2024-08-20 19:38:47 +08:00
parent c1df349d4e
commit 22aa4f1528
1 changed files with 5 additions and 4 deletions

View File

@ -1905,10 +1905,11 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType
case TABLE_OPTION_TTL: { case TABLE_OPTION_TTL: {
int64_t ttl = taosStr2Int64(((SToken*)pVal)->z, NULL, 10); int64_t ttl = taosStr2Int64(((SToken*)pVal)->z, NULL, 10);
if (ttl > INT32_MAX) { 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; break;
} }
case TABLE_OPTION_SMA: case TABLE_OPTION_SMA:
@ -2516,7 +2517,7 @@ SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pCreateUserStm
return pCreateUserStmt; 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) { int8_t createDb, int8_t is_import) {
CHECK_PARSER_STATUS(pCxt); CHECK_PARSER_STATUS(pCxt);
char password[TSDB_USET_PASSWORD_LEN + 3] = {0}; char password[TSDB_USET_PASSWORD_LEN + 3] = {0};