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: {
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;
}
break;
}
case TABLE_OPTION_SMA: