fix: interval more than 1000 years
This commit is contained in:
parent
b8c379a20d
commit
4186028083
|
@ -657,6 +657,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR TAOS_DEF_ERROR_CODE(0, 0x2618)
|
||||
#define TSDB_CODE_PAR_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x2619)
|
||||
#define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x261A)
|
||||
#define TSDB_CODE_PAR_INTER_VALUE_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x261B)
|
||||
#define TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST TAOS_DEF_ERROR_CODE(0, 0x2624)
|
||||
#define TSDB_CODE_PAR_AGG_FUNC_NESTING TAOS_DEF_ERROR_CODE(0, 0x2627)
|
||||
#define TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE TAOS_DEF_ERROR_CODE(0, 0x2628)
|
||||
|
|
|
@ -3512,6 +3512,7 @@ static void convertVarDuration(SValueNode* pOffset, uint8_t precision) {
|
|||
pOffset->unit = units[precision];
|
||||
}
|
||||
|
||||
static const int64_t maxKeepMS = (int64_t)3600 * 1000 * 24 * (365 * 1000 + 250);
|
||||
static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* pInterval) {
|
||||
uint8_t precision = ((SColumnNode*)pInterval->pCol)->node.resType.precision;
|
||||
|
||||
|
@ -3520,6 +3521,8 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode*
|
|||
if (pInter->datum.i <= 0 || (!valInter && pInter->datum.i < tsMinIntervalTime)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL, tsMinIntervalTime,
|
||||
getPrecisionStr(precision));
|
||||
} else if (pInter->datum.i > maxKeepMS) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_VALUE_TOO_BIG, 1000, "years");
|
||||
}
|
||||
|
||||
if (NULL != pInterval->pOffset) {
|
||||
|
|
|
@ -65,6 +65,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
|
|||
return "This statement is no longer supported";
|
||||
case TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL:
|
||||
return "Interval cannot be less than %d %s";
|
||||
case TSDB_CODE_PAR_INTER_VALUE_TOO_BIG:
|
||||
return "Interval cannot be more than %d %s";
|
||||
case TSDB_CODE_PAR_DB_NOT_SPECIFIED:
|
||||
return "Database not specified";
|
||||
case TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME:
|
||||
|
|
|
@ -477,7 +477,6 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf) {
|
|||
return res;
|
||||
}
|
||||
#ifdef WINDOWS
|
||||
if (*timep < 0) {
|
||||
if (*timep < -2208988800LL) {
|
||||
if (buf != NULL) {
|
||||
sprintf(buf, "NaN");
|
||||
|
@ -510,14 +509,6 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf) {
|
|||
result->tm_wday = s.wDayOfWeek;
|
||||
result->tm_yday = 0;
|
||||
result->tm_isdst = 0;
|
||||
} else {
|
||||
if (localtime_s(result, timep) != 0) {
|
||||
if (buf != NULL) {
|
||||
sprintf(buf, "NaN");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
res = localtime_r(timep, result);
|
||||
if (res == NULL && buf != NULL) {
|
||||
|
|
|
@ -518,6 +518,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PORT, "Port should be an in
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ENDPOINT, "Endpoint should be in the format of 'fqdn:port'")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_EXPRIE_STATEMENT, "This statement is no longer supported")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL, "Interval too small")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_VALUE_TOO_BIG, "Interval too big")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_DB_NOT_SPECIFIED, "Database not specified")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, "Invalid identifier name")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR, "Corresponding super table not in this db")
|
||||
|
|
Loading…
Reference in New Issue