提交 62e8874d 编写于 作者: A Alex Duan

fix(query): batch create table bug [TS-1508]

上级 bfe0b050
......@@ -9295,13 +9295,16 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
free(row);
bool dbIncluded2 = false;
char tmp[TSDB_TABLE_FNAME_LEN] = {0};
SStrToken tbName = taosTokenDup(&pCreateTableInfo->name, tmp, tListLen(tmp));
// 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);
}
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) {
return ret;
}
......
......@@ -348,6 +348,17 @@ class TDTestCase:
tdSql.query("show create table meter1")
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):
tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册