diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 6b55780af93554446f7f0599fe267e42e258ae81..1be5e29230d6234015b8d443558bd9d3dd85ba7c 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -713,13 +713,12 @@ static int32_t tscProcessShowCreateDatabase(SSqlObj *pSql) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } - SCreateBuilder *param = (SCreateBuilder *)malloc(sizeof(SCreateBuilder)); + SCreateBuilder *param = (SCreateBuilder *)calloc(1, sizeof(SCreateBuilder)); if (param == NULL) { free(pInterSql); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - - strncpy(param->buf, tNameGetTableName(&pTableMetaInfo->name), TSDB_TABLE_NAME_LEN); + tNameGetDbName(&pTableMetaInfo->name, param->buf); param->pParentSql = pSql; param->pInterSql = pInterSql; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e2ce0da739fcdb9089f1514025e01d49444e8ddf..acfc1b0cf54e4c6f4485c98d4e583bfc12475f4c 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -467,8 +467,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { if (pToken->n > TSDB_DB_NAME_LEN) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } - - return tscSetTableFullName(pTableMetaInfo, pToken, pSql); + return tNameSetDbName(&pTableMetaInfo->name, getAccountId(pSql), pToken); } case TSDB_SQL_CFG_DNODE: { const char* msg2 = "invalid configure options or values, such as resetlog / debugFlag 135 / balance 'vnode:2-dnode:2' / monitor 1 ";