diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index d045000e24485f27d9cbde89ff76e794d12b2c32..824fff574e2fd1160eaa2cef1d6edc0869ea2a67 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -2127,7 +2127,11 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t pTableMetaInfo->tagColList, pTableMetaInfo->pVgroupTables); } else { // transfer the ownership of pTableMeta to the newly create sql object. STableMetaInfo* pPrevInfo = tscGetTableMetaInfoFromCmd(&pPrevSql->cmd, pPrevSql->cmd.clauseIndex, 0); - + if (pPrevInfo->pTableMeta && pPrevInfo->pTableMeta->tableType < 0) { + terrno = TSDB_CODE_TSC_APP_ERROR; + goto _error; + } + STableMeta* pPrevTableMeta = tscTableMetaDup(pPrevInfo->pTableMeta); SVgroupsInfo* pVgroupsInfo = pPrevInfo->vgroupList; pFinalInfo = tscAddTableMetaInfo(pNewQueryInfo, &pTableMetaInfo->name, pPrevTableMeta, pVgroupsInfo, pTableMetaInfo->tagColList,