diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 0864095a2175a6686f7caed7bc31aa2fc6b352c8..faebe88653c42837621cd28b78e2a30b5689e60c 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2467,6 +2467,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: { @@ -3018,6 +3019,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);