diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 612a3d4798791c9632ac89b9fc701935294f17e8..66eb5bca110a000741ca3a85c9363942888fab11 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3994,7 +3994,13 @@ static int32_t getColQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlEx UNUSED(code); // TODO: more error handling } END_TRY - + + if (tbufTell(&bw) >= TSDB_MAX_WHERE_LEN ) { + char tmp[64] = {0}; + sprintf(tmp, "where condition string should be less than %d characters", TSDB_MAX_WHERE_LEN); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), tmp); + } + // add to required table column list STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i); int64_t uid = pTableMetaInfo->pTableMeta->id.uid; @@ -5238,7 +5244,13 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE UNUSED(code); // TODO: more error handling } END_TRY - + + if (tbufTell(&bw) >= TSDB_MAX_WHERE_LEN ) { + char tmp[64] = {0}; + sprintf(tmp, "where condition string should be less than %d characters", TSDB_MAX_WHERE_LEN); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), tmp); + } + // add to required table column list STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i); int64_t uid = pTableMetaInfo->pTableMeta->id.uid; diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index fceeaea0ae786af9935cde6a7c7569823bcbbe5b..2983be90e0687576fbe4a6061b1c7a6c7d202e55 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -210,6 +210,7 @@ do { \ #define TSDB_MAX_TAGS_LEN 16384 #define TSDB_MAX_TAGS 128 #define TSDB_MAX_TAG_CONDITIONS 1024 +#define TSDB_MAX_WHERE_LEN 65535 #define TSDB_AUTH_LEN 16 #define TSDB_KEY_LEN 16