test: add test case for create index

This commit is contained in:
kailixu 2024-01-05 00:35:29 +08:00
parent 6bac747ab9
commit 81d8b9b98b
2 changed files with 12 additions and 7 deletions

View File

@ -6930,10 +6930,11 @@ static int32_t translateCreateFullTextIndex(STranslateContext* pCxt, SCreateInde
}
static int32_t translateCreateNormalIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
int32_t code = 0;
SName name;
STableMeta* pMeta = NULL;
int32_t code =
getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), &pMeta, false);
code = getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), &pMeta, false);
if (code) {
taosMemoryFree(pMeta);
return code;
@ -6955,10 +6956,6 @@ static int32_t translateCreateNormalIndex(STranslateContext* pCxt, SCreateIndexS
taosMemoryFree(pMeta);
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnNode*)pNode)->colName);
}
if (IS_IDX_ON(pSchema)) {
code = TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST;
goto _exit;
}
}
SCreateTagIndexReq createTagIdxReq = {0};

View File

@ -88,6 +88,13 @@ class TDTestCase:
tdLog.info(f" create {count} child tables ok.")
def create_tagidx_check(self, stbname):
err_dict = {"NULL","",",","\"","\"\"","undef","t1,t2","t12,t12"}
for errs in err_dict:
sql = (f'create index idx_err_check on {stbname} (%s)'% (errs))
tdLog.info(f' sql={sql}')
tdSql.error(f'{sql}')
tdLog.info(f' create tagidx check ok.')
# create stable and child tables
def create_tagidx(self, stbname):
@ -231,6 +238,7 @@ class TDTestCase:
count = 1000
# do
self.create_table(stable, tbname, count)
self.create_tagidx_check(stable)
self.create_tagidx(stable)
self.insert_data(tbname)
self.show_tagidx(stable)