From 3fdc978244a0cbb9ab4556eed9a44c1ad5ed31fe Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 20 Jan 2021 13:44:31 +0800 Subject: [PATCH] [TD-225]fix bugs in regression test. --- src/client/src/tscSQLParser.c | 22 ++++++++++++---------- src/client/src/tscServer.c | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 53bf91cd05..fb92efd40a 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -917,19 +917,21 @@ int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableNam } } else { // get current DB name first, and then set it into path char* t = getCurrentDBName(pSql); - assert(strlen(t) > 0); + if (strlen(t) == 0) { + return TSDB_CODE_TSC_DB_NOT_SELECTED; + } - code = tNameFromString(&pTableMetaInfo->name, t, T_NAME_ACCT|T_NAME_DB); + code = tNameFromString(&pTableMetaInfo->name, t, T_NAME_ACCT | T_NAME_DB); if (code != 0) { - code = TSDB_CODE_TSC_DB_NOT_SELECTED; - } else { - char name[TSDB_TABLE_FNAME_LEN] = {0}; - strncpy(name, pTableName->z, pTableName->n); + return TSDB_CODE_TSC_DB_NOT_SELECTED; + } - code = tNameFromString(&pTableMetaInfo->name, name, T_NAME_TABLE); - if (code != 0) { - code = invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); - } + char name[TSDB_TABLE_FNAME_LEN] = {0}; + strncpy(name, pTableName->z, pTableName->n); + + code = tNameFromString(&pTableMetaInfo->name, name, T_NAME_TABLE); + if (code != 0) { + code = invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 3afae07fbb..4b8fa45619 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2398,7 +2398,7 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) { STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; if (pTableMeta) { tscDebug("%p update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%" PRId64, pSql, name, - tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid); + tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid); } // remove stored tableMeta info in hash table -- GitLab