fix: ddl in system database
This commit is contained in:
parent
22f46c2eb0
commit
fc0a97c161
|
@ -8609,7 +8609,7 @@ static int32_t translateDropDatabase(STranslateContext* pCxt, SDropDatabaseStmt*
|
|||
}
|
||||
SDropDbReq dropReq = {0};
|
||||
SName name = {0};
|
||||
int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
||||
int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
||||
if (TSDB_CODE_SUCCESS != code) return code;
|
||||
(void)tNameGetFullDbName(&name, dropReq.db);
|
||||
dropReq.ignoreNotExists = pStmt->ignoreNotExists;
|
||||
|
|
|
@ -44,11 +44,16 @@ class TDTestCase:
|
|||
tdSql.error(f'drop database {db}', expectErrInfo="Cannot drop system database", fullMatched=False)
|
||||
|
||||
def ddl_systb(self):
|
||||
tdSql.execute('drop database if exists d0')
|
||||
tdSql.execute('create database if not exists d0')
|
||||
tdSql.execute('create stable d0.stb0 (ts timestamp, c0 int) tags(t0 int)')
|
||||
for db, tbs in sysdb_tables.items():
|
||||
tdSql.execute(f'use {db}')
|
||||
for tb in tbs:
|
||||
tdSql.error(f'create table {tb} (ts timestamp, c0 int)', expectErrInfo="Cannot create table of system database", fullMatched=False)
|
||||
tdSql.error(f'create table d0.ctb0 using db.stb0 tags(0) {tb} using {tb} tags(1)', expectErrInfo="Corresponding super table not in this db", fullMatched=False)
|
||||
tdSql.error(f'create table {db}.{tb} (ts timestamp, c0 int)', expectErrInfo="Cannot create table of system database", fullMatched=False)
|
||||
tdSql.error(f'create table d0.ctb0 using db.stb0 tags(0) {db}.{tb} using {db}.{tb} tags(1)', expectErrInfo="Corresponding super table not in this db", fullMatched=False)
|
||||
tdSql.error(f'create stable {tb} (ts timestamp, c0 int) tags(t0 int)', expectErrInfo="Cannot create table of system database", fullMatched=False)
|
||||
tdSql.error(f'create stable {db}.{tb} (ts timestamp, c0 int) tags(t0 int)', expectErrInfo="Cannot create table of system database", fullMatched=False)
|
||||
tdSql.error(f'alter table {tb} add column c1 int', expectErrInfo="Cannot alter table of system database", fullMatched=False)
|
||||
|
@ -57,6 +62,8 @@ class TDTestCase:
|
|||
tdSql.error(f'alter stable {db}.{tb} add column c1 int', expectErrInfo="Cannot alter table of system database", fullMatched=False)
|
||||
tdSql.error(f'insert into {tb} values (now,1)', expectErrInfo="System table not allowed", fullMatched=False)
|
||||
tdSql.error(f'insert into {db}.{tb} values (now,1)', expectErrInfo="System table not allowed", fullMatched=False)
|
||||
tdSql.error(f'insert into {tb} values (now,1) using stb tags(0) values(now,1)', expectErrInfo="System table not allowed", fullMatched=False)
|
||||
tdSql.error(f'insert into {db}.{tb} values (now,1) using stb tags(0) values(now,1)', expectErrInfo="System table not allowed", fullMatched=False)
|
||||
tdSql.error(f'delete from {tb}', expectErrInfo="Cannot delete from system database", fullMatched=False)
|
||||
tdSql.error(f'delete from {db}.{tb}', expectErrInfo="Cannot delete from system database", fullMatched=False)
|
||||
tdSql.error(f'delete from {tb} where ts >= 0', expectErrInfo="Cannot delete from system database", fullMatched=False)
|
||||
|
@ -69,6 +76,7 @@ class TDTestCase:
|
|||
tdSql.error(f'drop table with {db}.{tb}', expectErrInfo="Cannot drop table of system database", fullMatched=False)
|
||||
tdSql.error(f'drop stable with {tb}', expectErrInfo="Cannot drop table of system database", fullMatched=False)
|
||||
tdSql.error(f'drop stable with {db}.{tb}', expectErrInfo="Cannot drop table of system database", fullMatched=False)
|
||||
tdSql.execute('drop database if exists d0')
|
||||
|
||||
def ddl_in_sysdb(self):
|
||||
self.ddl_sysdb()
|
||||
|
|
Loading…
Reference in New Issue