Merge pull request #15649 from taosdata/feature/3.0_wxy
fix: database name cannot contain '.'
This commit is contained in:
commit
18364a6bd2
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue