fix: bi mode create tbname col error

This commit is contained in:
slzhou 2023-11-23 11:18:05 +08:00
parent f44ff199f2
commit 3de91de7f9
3 changed files with 13 additions and 1 deletions

View File

@ -23,6 +23,7 @@ extern "C" {
#include "parToken.h"
#include "parUtil.h"
#include "parser.h"
#include "cmdnodes.h"
typedef struct STranslateContext {
SParseContext* pParseCxt;
@ -48,6 +49,7 @@ typedef struct STranslateContext {
bool biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode);
int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect);
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt);
int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput);
int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta, bool couldBeView);

View File

@ -5726,6 +5726,12 @@ static int32_t checkTableDeleteMarkOption(STranslateContext* pCxt, STableOptions
return code;
}
#ifndef TD_ENTERPRISE
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt) {
return TSDB_CODE_SUCCESS;
}
#endif
static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt, bool createStable) {
if (NULL != strchr(pStmt->tableName, '.')) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME,
@ -5764,7 +5770,9 @@ static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt
"configured with the 'TTL' option");
}
}
if (pCxt->pParseCxt->biMode != 0 && TSDB_CODE_SUCCESS == code) {
code = biCheckCreateTableTbnameCol(pCxt, pStmt);
}
return code;
}

View File

@ -31,4 +31,6 @@ if $data10 != @tba2@ then
return -1
endi
sql_error create table stc(ts timestamp, `tbname` binary(200));
sql_error create table std(ts timestamp, f1 int) tags(`tbname` binary(200));
system sh/exec.sh -n dnode1 -s stop -x SIGINT