diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 6f4ab16e4d7ced3b6072446fd4b0717714460800..4a02d51b2994191d0a853261e51e1909ff41d56e 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2472,6 +2472,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col const char* msg10 = "derivative duration should be greater than 1 Second"; const char* msg11 = "third parameter in derivative should be 0 or 1"; const char* msg12 = "parameter is out of range [1, 100]"; + const char* msg13 = "parameter list required"; switch (functionId) { case TSDB_FUNC_COUNT: { @@ -3023,6 +3024,10 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg9); } + if (taosArrayGetSize(pItem->pNode->Expr.paramList) <= 0) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg13); + } + tSqlExprItem* pParamElem = taosArrayGet(pItem->pNode->Expr.paramList, 0);; if (pParamElem->pNode->tokenId != TK_ID) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);