未验证 提交 f5d94495 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #13385 from taosdata/fix/TS-1508-V26

fix(query): batch create table bug [TS-1508]
...@@ -9295,13 +9295,16 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -9295,13 +9295,16 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
free(row); free(row);
bool dbIncluded2 = false; bool dbIncluded2 = false;
char tmp[TSDB_TABLE_FNAME_LEN] = {0};
SStrToken tbName = taosTokenDup(&pCreateTableInfo->name, tmp, tListLen(tmp));
// table name // table name
if (tscValidateName(&(pCreateTableInfo->name), true, &dbIncluded2) != TSDB_CODE_SUCCESS) { if (tscValidateName(&tbName, true, &dbIncluded2) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), STR_INVALID_TABLE_NAME); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), STR_INVALID_TABLE_NAME);
} }
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, TABLE_INDEX); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, TABLE_INDEX);
ret = tscSetTableFullName(&pTableMetaInfo->name, &pCreateTableInfo->name, pSql, dbIncluded2); ret = tscSetTableFullName(&pTableMetaInfo->name, &tbName, pSql, dbIncluded2);
if (ret != TSDB_CODE_SUCCESS) { if (ret != TSDB_CODE_SUCCESS) {
return ret; return ret;
} }
......
...@@ -348,6 +348,17 @@ class TDTestCase: ...@@ -348,6 +348,17 @@ class TDTestCase:
tdSql.query("show create table meter1") tdSql.query("show create table meter1")
tdSql.checkData(0, 1, "CREATE TABLE `meter1` USING `meters` TAGS (1,2,3,4,5,6)") tdSql.checkData(0, 1, "CREATE TABLE `meter1` USING `meters` TAGS (1,2,3,4,5,6)")
# TS-1508
tdSql.execute("create database if not exists test")
tdSql.execute("use test")
sql = "CREATE TABLE "
for i in range(7):
tdSql.execute("create table stb%d(ts timestamp, c1 int, c2 nchar(20)) tags(t1 binary(20))" % i)
sql += "IF NOT EXISTS 'tb%d' USING 'stb%d' TAGS ('LZ5NB7D34MB013827') " % (i, i)
tdSql.execute(sql)
tdSql.query("show tables")
tdSql.checkRows(7)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册