diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index f39169c193d3483e4db6a35aa42f5187ef1bf723..1c198fb8c6b0d80c58077da6ae2299fb366ca965 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -346,7 +346,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { if (pSql->pStream == NULL) { SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd); - if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_INSERT)) { + if (pQueryInfo != NULL && TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_INSERT)) { tscDebug("0x%" PRIx64 " continue parse sql after get table-meta", pSql->self); code = tsParseSql(pSql, false); @@ -376,7 +376,6 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { } else { if (pSql->retryReason != TSDB_CODE_SUCCESS) { tscDebug("0x%" PRIx64 " update cached table-meta, re-validate sql statement and send query again", pSql->self); - tscResetSqlCmd(pCmd, false); pSql->retryReason = TSDB_CODE_SUCCESS; } else { tscDebug("0x%" PRIx64 " cached table-meta, continue validate sql statement and send query", pSql->self); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index b2ed942b5e62ff9c4b5911abea467e25a47d34e4..b278235269874fefcf417290fb232f06144733a1 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2241,6 +2241,10 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) { pMsg = buf; } + if (pParentCmd->pTableMetaMap == NULL) { + pParentCmd->pTableMetaMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + } + for (int32_t i = 0; i < pMultiMeta->numOfTables; i++) { STableMetaMsg *pMetaMsg = (STableMetaMsg *)pMsg; int32_t code = tableMetaMsgConvert(pMetaMsg);