From e453c8bcbd23da75cec12fba28e4ef5f0ce1f40d Mon Sep 17 00:00:00 2001 From: haojun Liao Date: Wed, 19 Feb 2020 14:54:55 +0800 Subject: [PATCH] Update tscServer.c compatible with the case of super table with uid 0 --- src/client/src/tscServer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index f741fc8620..20ae13da1a 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2886,7 +2886,7 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) { int32_t condLen = 0; if (pTagCond->numOfTagCond > 0) { SCond *pCond = tsGetMetricQueryCondPos(pTagCond, uid); - if (pCond != NULL) { + if (pCond != NULL && pCond->cond != NULL) { condLen = strlen(pCond->cond) + 1; bool ret = taosMbsToUcs4(pCond->cond, condLen, pMsg, condLen * TSDB_NCHAR_SIZE); @@ -2909,10 +2909,12 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) { pElem->tableCond = htonl(offset); - uint32_t len = strlen(pTagCond->tbnameCond.cond); - pElem->tableCondLen = htonl(len); - - memcpy(pMsg, pTagCond->tbnameCond.cond, len); + uint32_t len = 0; + if (pTagCond->tbnameCond.cond != NULL) { + len = strlen(pTagCond->tbnameCond.cond); + memcpy(pMsg, pTagCond->tbnameCond.cond, len); + } + pMsg += len; } -- GitLab