提交 03a39381 编写于 作者: X Xiaoyu Wang

enh: show command optimize

上级 15fae241
......@@ -166,7 +166,7 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
.pTableName = TSDB_INS_TABLE_USERS,
.numOfShowCols = 1,
.pShowCols = {"name"}
.pShowCols = {"*"}
},
{
.showType = QUERY_NODE_SHOW_LICENCES_STMT,
......
......@@ -365,6 +365,6 @@ endi
sql_error (show tables) union all (show tables)
sql_error (show stables) union all (show stables)
sql_error (select * from information_schema.ins_databases) union all (select * from information_schema.ins_databases)
sql_error (show databases) union all (show databases)
system sh/exec.sh -n dnode1 -s stop -x SIGINT
......@@ -302,7 +302,7 @@ class TDTestCase:
else:
sql3 = "echo 'create table ntbf (ts timestamp, c binary(40))' >> " + sqlFile
sql4 = "echo 'insert into ntbf values (\"2021-04-01 08:00:00.000\", \"test taos -f1\")(\"2021-04-01 08:00:01.000\", \"test taos -f2\")' >> " + sqlFile
sql5 = "echo select * from information_schema.ins_databases >> " + sqlFile
sql5 = "echo show databases >> " + sqlFile
os.system(sql1)
os.system(sql2)
os.system(sql3)
......
......@@ -244,7 +244,7 @@ class TDTestCase:
else:
sql3 = "echo 'create table ntbf (ts timestamp, c binary(40)) no this item' >> " + sqlFile
sql4 = "echo 'insert into ntbf values (\"2021-04-01 08:00:00.000\", \"test taos -f1\")(\"2021-04-01 08:00:01.000\", \"test taos -f2\")' >> " + sqlFile
sql5 = "echo select * from information_schema.ins_databases >> " + sqlFile
sql5 = "echo show databases >> " + sqlFile
os.system(sql1)
os.system(sql2)
os.system(sql3)
......
......@@ -196,7 +196,7 @@ class TDTestCase:
for i in range(self.users_count):
tdSql.execute(f"create user {users[i]} pass '{passwds[i]}' ")
tdSql.query("select * from information_schema.ins_users")
tdSql.query("show users")
tdSql.checkRows(self.users_count + 1)
def create_user_err(self):
......@@ -586,7 +586,7 @@ class TDTestCase:
# 默认只有 root 用户
tdLog.printNoPrefix("==========step0: init, user list only has root account")
tdSql.query("select * from information_schema.ins_users")
tdSql.query("show users")
tdSql.checkData(0, 0, "root")
tdSql.checkData(0, 1, "1")
......@@ -597,7 +597,7 @@ class TDTestCase:
# 查看用户
tdLog.printNoPrefix("==========step2: show user test")
tdSql.query("select * from information_schema.ins_users")
tdSql.query("show users")
tdSql.checkRows(self.users_count + 1)
# 密码登录认证
......@@ -619,7 +619,7 @@ class TDTestCase:
tdDnodes.stop(1)
tdDnodes.start(1)
tdSql.query("select * from information_schema.ins_users")
tdSql.query("show users")
tdSql.checkRows(self.users_count + 1)
# 普通用户权限
......@@ -632,7 +632,7 @@ class TDTestCase:
user.error("create use utest1 pass 'utest1pass'")
# 可以查看用户
tdLog.printNoPrefix("==========step4.2: normal user can show user")
user.query("select * from information_schema.ins_users")
user.query("show users")
assert user.queryRows == self.users_count + 1
# 不可以修改其他用户的密码
tdLog.printNoPrefix("==========step4.3: normal user can not alter other user pass")
......@@ -649,12 +649,12 @@ class TDTestCase:
tdLog.printNoPrefix("==========step5: enable info")
taos1_conn = taos.connect(user=self.__user_list[1], password=f"new{self.__passwd_list[1]}")
taos1_conn.query(f"select * from information_schema.ins_databases")
taos1_conn.query(f"show databases")
tdSql.execute(f"alter user {self.__user_list[1]} enable 0")
tdSql.execute(f"alter user {self.__user_list[2]} enable 0")
taos1_except = True
try:
taos1_conn.query("select * from information_schema.ins_databases")
taos1_conn.query("show databases")
except BaseException:
taos1_except = False
if taos1_except:
......@@ -674,13 +674,13 @@ class TDTestCase:
tdLog.printNoPrefix("==========step6: sysinfo info")
taos3_conn = taos.connect(user=self.__user_list[3], password=f"new{self.__passwd_list[3]}")
taos3_conn.query(f"select * from information_schema.ins_dnodes")
taos3_conn.query(f"show dnodes")
taos3_conn.query(f"show {DBNAME}.vgroups")
tdSql.execute(f"alter user {self.__user_list[3]} sysinfo 0")
tdSql.execute(f"alter user {self.__user_list[4]} sysinfo 0")
taos3_except = True
try:
taos3_conn.query(f"select * from information_schema.ins_dnodes")
taos3_conn.query(f"show dnodes")
taos3_conn.query(f"show {DBNAME}.vgroups")
except BaseException:
taos3_except = False
......@@ -692,7 +692,7 @@ class TDTestCase:
taos4_conn = taos.connect(user=self.__user_list[4], password=f"new{self.__passwd_list[4]}")
taos4_except = True
try:
taos4_conn.query(f"select * from information_schema.ins_mnodes")
taos4_conn.query(f"show mnodes")
taos4_conn.query(f"show {DBNAME}.vgroups")
except BaseException:
taos4_except = False
......@@ -705,7 +705,7 @@ class TDTestCase:
tdLog.printNoPrefix("==========step7: super user drop normal user")
self.test_drop_user()
tdSql.query("select * from information_schema.ins_users")
tdSql.query("show users")
tdSql.checkRows(1)
tdSql.checkData(0, 0, "root")
tdSql.checkData(0, 1, "1")
......@@ -719,7 +719,7 @@ class TDTestCase:
self.login_err(self.__user_list[1], self.__passwd_list[1])
self.login_err(self.__user_list[1], f"new{self.__passwd_list[1]}")
tdSql.query("select * from information_schema.ins_users")
tdSql.query("show users")
tdSql.checkRows(1)
tdSql.checkData(0, 0, "root")
tdSql.checkData(0, 1, "1")
......
......@@ -109,7 +109,7 @@ class TDTestCase:
for i in range(self.tbnum):
tdSql.execute(f"create table {stbname}_{i} using {stbname} tags({tag_values[0]})")
self.insert_data(self.column_dict,f'{stbname}_{i}',self.rowNum)
tdSql.query(f'show {self.dbname}.tables')
tdSql.query(f'select * from information_schema.ins_tables where db_name = "{self.dbname}"')
vgroup_list = []
for i in range(len(tdSql.queryResult)):
vgroup_list.append(tdSql.queryResult[i][6])
......
......@@ -69,7 +69,7 @@ class TDTestCase:
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -86,7 +86,7 @@ class TDTestCase:
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -87,7 +87,7 @@ class TDTestCase:
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -88,7 +88,7 @@ class TDTestCase:
vnode_tables[vgroup_id[0]]=[]
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -87,7 +87,7 @@ class TDTestCase:
vnode_tables[vgroup_id[0]]=[]
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -111,7 +111,7 @@ class TDTestCase:
vnode_tables[vgroup_id[0]]=[]
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -120,7 +120,7 @@ class TDTestCase:
vnode_tables[vgroup_id[0]]=[]
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query(f"show {dbname}.tables like 'ct%'")
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -185,11 +185,11 @@ class TDTestCase:
tdLog.printNoPrefix("===step 0: err case, must return err")
tdSql.error( f"explain select hyperloglog({INT_COL}) from {dbname}.ct8" )
tdSql.error( f"explain select * from information_schema.ins_databases " )
tdSql.error( f"explain show databases " )
tdSql.error( f"explain show {dbname}.stables " )
tdSql.error( f"explain show {dbname}.tables " )
tdSql.error( f"explain show {dbname}.vgroups " )
tdSql.error( f"explain select * from information_schema.ins_dnodes " )
tdSql.error( f"explain show dnodes " )
tdSql.error( f'''explain select hyperloglog(['{INT_COL} + {INT_COL}', '{INT_COL} + {BINT_COL}', '{INT_COL} + {SINT_COL}', '{INT_COL} + {TINT_COL}', '{INT_COL} + {FLOAT_COL}', '{INT_COL} + {DOUBLE_COL}', '{INT_COL} + {BOOL_COL}', '{INT_COL} + {BINARY_COL}', '{INT_COL} + {NCHAR_COL}', '{INT_COL} + {TS_COL}'])
from {dbname}.ct1
where ['{INT_COL} + {INT_COL}', '{INT_COL} + {BINT_COL}', '{INT_COL} + {SINT_COL}', '{INT_COL} + {TINT_COL}', '{INT_COL} + {FLOAT_COL}', '{INT_COL} + {DOUBLE_COL}', '{INT_COL} + {BOOL_COL}', '{INT_COL} + {BINARY_COL}', '{INT_COL} + {NCHAR_COL}', '{INT_COL} + {TS_COL}'] is not null
......
......@@ -125,7 +125,7 @@ class TDTestCase:
tdSql.query(f"select first(*) from {i}")
tdSql.checkRows(1)
tdSql.checkData(0, 1, None)
tdSql.query(f'show {dbname}.tables')
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}'")
vgroup_list = []
for i in range(len(tdSql.queryResult)):
vgroup_list.append(tdSql.queryResult[i][6])
......
......@@ -232,7 +232,7 @@ class TDTestCase:
self.__create_stable(dbname, stbname,column_dict,tag_dict)
for i in range(childtable_num):
tdSql.execute(f"create table {dbname}.{stbname}_{i} using {dbname}.{stbname} tags('beijing')")
tdSql.query(f'show {dbname}.tables')
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}'")
vgroup_list = []
for i in range(len(tdSql.queryResult)):
vgroup_list.append(tdSql.queryResult[i][6])
......
......@@ -202,7 +202,7 @@ class TDTestCase:
f"create table {stbname}_{i} using {stbname} tags('beijing')")
tdSql.execute(
f"insert into {stbname}_{i}(ts) values(%d)" % (self.ts - 1-i))
tdSql.query(f'show {dbname}.tables')
tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}'")
vgroup_list = []
for i in range(len(tdSql.queryResult)):
vgroup_list.append(tdSql.queryResult[i][6])
......
......@@ -167,7 +167,7 @@ class TDTestCase:
# check sub_table of per vnode ,make sure sub_table has been distributed
tdSql.query("show tables like 'ct%'")
tdSql.query("select * from information_schema.ins_tables where db_name = 'testdb' and table_name like 'ct%'")
table_names = tdSql.queryResult
tablenames = []
for table_name in table_names:
......
......@@ -112,7 +112,7 @@ class TDTestCase:
for i in range(self.tbnum):
tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({tag_values[0]})")
self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum)
tdSql.query(f'show {self.dbname}.tables')
tdSql.query(f'select * from information_schema.ins_tables where db_name = "{self.dbname}"')
vgroup_list = []
for i in range(len(tdSql.queryResult)):
vgroup_list.append(tdSql.queryResult[i][6])
......
......@@ -41,50 +41,50 @@ class TDTestCase:
tdSql.execute("create table normal_table2(ts timestamp, i int) comment '' ttl 3")
tdSql.execute("create table normal_table3(ts timestamp, i int) ttl 2100000000020 comment 'hello'")
tdSql.query("show tables like 'normal_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 7, 0)
tdSql.checkData(0, 8, None)
tdSql.query("show tables like 'normal_table2'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table2'")
tdSql.checkData(0, 0, 'normal_table2')
tdSql.checkData(0, 7, 3)
tdSql.checkData(0, 8, '')
tdSql.query("show tables like 'normal_table3'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'")
tdSql.checkData(0, 0, 'normal_table3')
tdSql.checkData(0, 7, 2147483647)
tdSql.checkData(0, 8, 'hello')
tdSql.execute("alter table normal_table1 comment 'nihao'")
tdSql.query("show tables like 'normal_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 8, 'nihao')
tdSql.execute("alter table normal_table1 comment ''")
tdSql.query("show tables like 'normal_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 8, '')
tdSql.execute("alter table normal_table2 comment 'fly'")
tdSql.query("show tables like 'normal_table2'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table2'")
tdSql.checkData(0, 0, 'normal_table2')
tdSql.checkData(0, 8, 'fly')
tdSql.execute("alter table normal_table3 comment 'fly'")
tdSql.query("show tables like 'normal_table3'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'")
tdSql.checkData(0, 0, 'normal_table3')
tdSql.checkData(0, 8, 'fly')
tdSql.execute("alter table normal_table1 ttl 1")
tdSql.query("show tables like 'normal_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table1'")
tdSql.checkData(0, 0, 'normal_table1')
tdSql.checkData(0, 7, 1)
tdSql.execute("alter table normal_table3 ttl 0")
tdSql.query("show tables like 'normal_table3'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'normal_table3'")
tdSql.checkData(0, 0, 'normal_table3')
tdSql.checkData(0, 7, 0)
......@@ -95,38 +95,38 @@ class TDTestCase:
tdSql.execute("create table super_table2(ts timestamp, i int) tags(t int) comment ''")
tdSql.execute("create table super_table3(ts timestamp, i int) tags(t int) comment 'super'")
tdSql.query("show stables like 'super_table1'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'")
tdSql.checkData(0, 0, 'super_table1')
tdSql.checkData(0, 6, None)
tdSql.query("show stables like 'super_table2'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table2'")
tdSql.checkData(0, 0, 'super_table2')
tdSql.checkData(0, 6, '')
tdSql.query("show stables like 'super_table3'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table3'")
tdSql.checkData(0, 0, 'super_table3')
tdSql.checkData(0, 6, 'super')
tdSql.execute("alter table super_table1 comment 'nihao'")
tdSql.query("show stables like 'super_table1'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'")
tdSql.checkData(0, 0, 'super_table1')
tdSql.checkData(0, 6, 'nihao')
tdSql.execute("alter table super_table1 comment ''")
tdSql.query("show stables like 'super_table1'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table1'")
tdSql.checkData(0, 0, 'super_table1')
tdSql.checkData(0, 6, '')
tdSql.execute("alter table super_table2 comment 'fly'")
tdSql.query("show stables like 'super_table2'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table2'")
tdSql.checkData(0, 0, 'super_table2')
tdSql.checkData(0, 6, 'fly')
tdSql.execute("alter table super_table3 comment 'tdengine'")
tdSql.query("show stables like 'super_table3'")
tdSql.query("select * from information_schema.ins_stables where stable_name like 'super_table3'")
tdSql.checkData(0, 0, 'super_table3')
tdSql.checkData(0, 6, 'tdengine')
......@@ -138,61 +138,61 @@ class TDTestCase:
tdSql.execute("insert into child_table4 using super_table1 tags(1) values(now, 1)")
tdSql.query("show tables like 'child_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
tdSql.checkData(0, 0, 'child_table1')
tdSql.checkData(0, 7, 10)
tdSql.checkData(0, 8, None)
tdSql.query("show tables like 'child_table2'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table2'")
tdSql.checkData(0, 0, 'child_table2')
tdSql.checkData(0, 7, 0)
tdSql.checkData(0, 8, '')
tdSql.query("show tables like 'child_table3'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'")
tdSql.checkData(0, 0, 'child_table3')
tdSql.checkData(0, 8, 'child')
tdSql.query("show tables like 'child_table4'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'")
tdSql.checkData(0, 0, 'child_table4')
tdSql.checkData(0, 7, 0)
tdSql.checkData(0, 8, None)
tdSql.execute("alter table child_table1 comment 'nihao'")
tdSql.query("show tables like 'child_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
tdSql.checkData(0, 0, 'child_table1')
tdSql.checkData(0, 8, 'nihao')
tdSql.execute("alter table child_table1 comment ''")
tdSql.query("show tables like 'child_table1'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table1'")
tdSql.checkData(0, 0, 'child_table1')
tdSql.checkData(0, 8, '')
tdSql.execute("alter table child_table2 comment 'fly'")
tdSql.query("show tables like 'child_table2'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table2'")
tdSql.checkData(0, 0, 'child_table2')
tdSql.checkData(0, 8, 'fly')
tdSql.execute("alter table child_table3 comment 'tdengine'")
tdSql.query("show tables like 'child_table3'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'")
tdSql.checkData(0, 0, 'child_table3')
tdSql.checkData(0, 8, 'tdengine')
tdSql.execute("alter table child_table4 comment 'tdengine'")
tdSql.query("show tables like 'child_table4'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'")
tdSql.checkData(0, 0, 'child_table4')
tdSql.checkData(0, 8, 'tdengine')
tdSql.execute("alter table child_table4 ttl 9")
tdSql.query("show tables like 'child_table4'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table4'")
tdSql.checkData(0, 0, 'child_table4')
tdSql.checkData(0, 7, 9)
tdSql.execute("alter table child_table3 ttl 9")
tdSql.query("show tables like 'child_table3'")
tdSql.query("select * from information_schema.ins_tables where table_name like 'child_table3'")
tdSql.checkData(0, 0, 'child_table3')
tdSql.checkData(0, 7, 9)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册