diff --git a/source/common/src/tname.c b/source/common/src/tname.c index 7c9f476f43..887c449c56 100644 --- a/source/common/src/tname.c +++ b/source/common/src/tname.c @@ -262,21 +262,11 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) { char* start = (char*)((p == NULL) ? str : (p + 1)); int32_t len = 0; - if (TS_ESCAPE_CHAR == *start) { - ++start; - char* end = start; - while ('`' != *end) { - ++end; - } - len = end - start; - p = ++end; + p = strstr(start, TS_PATH_DELIMITER); + if (p == NULL) { + len = (int32_t)strlen(start); } else { - p = strstr(start, TS_PATH_DELIMITER); - if (p == NULL) { - len = (int32_t)strlen(start); - } else { - len = (int32_t)(p - start); - } + len = (int32_t)(p - start); } // too long account id or too long db name @@ -294,10 +284,6 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) { // too long account id or too long db name int32_t len = (int32_t)strlen(start); - if (TS_ESCAPE_CHAR == *start) { - len -= 2; - ++start; - } if ((len >= tListLen(dst->tname)) || (len <= 0)) { return -1; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 47ce6ceec0..e54bc9eb4c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3370,6 +3370,10 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName } static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) { + if (NULL != strchr(pStmt->dbName, '.')) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, + "The database name cannot contain '.'"); + } return checkDatabaseOptions(pCxt, pStmt->dbName, pStmt->pOptions); } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 44d8784b7f..e51800aece 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -653,7 +653,7 @@ static int32_t reserveTableReqInCacheImpl(const char* pTbFName, int32_t len, SHa static int32_t reserveTableReqInCache(int32_t acctId, const char* pDb, const char* pTable, SHashObj** pTables) { char fullName[TSDB_TABLE_FNAME_LEN]; - int32_t len = snprintf(fullName, sizeof(fullName), "%d.`%s`.`%s`", acctId, pDb, pTable); + int32_t len = snprintf(fullName, sizeof(fullName), "%d.%s.%s", acctId, pDb, pTable); return reserveTableReqInCacheImpl(fullName, len, pTables); }