diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 3c140cc668b06314ea6436cfcdeaeae3e5101f0b..7663047429297ce99b0142700bc8d7d87679d208 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -141,16 +141,19 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) { goto _err; } - // preprocess req - pReq->uid = tGenIdPI64(); - pReq->ctime = taosGetTimestampMs(); - // validate req metaReaderInit(&mr, pMeta, 0); if (metaGetTableEntryByName(&mr, pReq->name) == 0) { + pReq->uid = mr.me.uid; + if (pReq->type == TSDB_CHILD_TABLE) { + pReq->ctb.suid = mr.me.ctbEntry.suid; + } terrno = TSDB_CODE_TDB_TABLE_ALREADY_EXIST; metaReaderClear(&mr); return -1; + } else { + pReq->uid = tGenIdPI64(); + pReq->ctime = taosGetTimestampMs(); } metaReaderClear(&mr);