diff --git a/source/common/src/tname.c b/source/common/src/tname.c index 7c9f476f4395ef9591efece2f22ee43084ed1747..887c449c56e9758412dbc201bf625f3a80281c2c 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 1930adcfa41bf0516d9af027e4767cefba091c37..c21cc65142ce633e24c2b237f38a4d56b20cd513 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3344,6 +3344,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 44d8784b7fd76818664ae12f9e2b8681a96a83d3..e51800aece4cdb4bdaee5386490277b65ec366f5 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); }