fix:fix error in get db name for schemaless parameters
This commit is contained in:
parent
f160e08fd3
commit
10807abbc8
|
@ -32,7 +32,7 @@ int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery);
|
||||||
int32_t translate(SParseContext* pParseCxt, SQuery* pQuery);
|
int32_t translate(SParseContext* pParseCxt, SQuery* pQuery);
|
||||||
int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema);
|
int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema);
|
||||||
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery);
|
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery);
|
||||||
int32_t isNotSchemalessDb(SParseContext* pContext);
|
int32_t isNotSchemalessDb(SParseContext* pContext, char *dbName);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1404,9 +1404,9 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
return buildOutput(pCxt);
|
return buildOutput(pCxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t isNotSchemalessDb(SParseContext* pContext){
|
int32_t isNotSchemalessDb(SParseContext* pContext, char *dbName){
|
||||||
SName name;
|
SName name;
|
||||||
tNameSetDbName(&name, pContext->acctId, pContext->db, strlen(pContext->db));
|
tNameSetDbName(&name, pContext->acctId, dbName, strlen(dbName));
|
||||||
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
||||||
tNameGetFullDbName(&name, dbFname);
|
tNameGetFullDbName(&name, dbFname);
|
||||||
SDbCfgInfo pInfo = {0};
|
SDbCfgInfo pInfo = {0};
|
||||||
|
|
|
@ -2648,8 +2648,8 @@ static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt
|
||||||
code = checkTableSchema(pCxt, pStmt);
|
code = checkTableSchema(pCxt, pStmt);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if(pCxt->pParseCxt->schemalessType == 0 && isNotSchemalessDb(pCxt->pParseCxt) != TSDB_CODE_SUCCESS){
|
if(pCxt->pParseCxt->schemalessType == 0){
|
||||||
code = TSDB_CODE_SML_INVALID_DB_CONF;
|
code = isNotSchemalessDb(pCxt->pParseCxt, pStmt->dbName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
@ -4430,9 +4430,7 @@ static SArray* serializeVgroupsCreateTableBatch(int32_t acctId, SHashObj* pVgrou
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) {
|
static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
if(pCxt->pParseCxt->schemalessType == 0 && isNotSchemalessDb(pCxt->pParseCxt) != TSDB_CODE_SUCCESS){
|
|
||||||
return TSDB_CODE_SML_INVALID_DB_CONF;
|
|
||||||
}
|
|
||||||
SCreateMultiTableStmt* pStmt = (SCreateMultiTableStmt*)pQuery->pRoot;
|
SCreateMultiTableStmt* pStmt = (SCreateMultiTableStmt*)pQuery->pRoot;
|
||||||
|
|
||||||
SHashObj* pVgroupHashmap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
SHashObj* pVgroupHashmap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||||
|
@ -4443,6 +4441,10 @@ static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery)
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SNode* pNode;
|
SNode* pNode;
|
||||||
FOREACH(pNode, pStmt->pSubTables) {
|
FOREACH(pNode, pStmt->pSubTables) {
|
||||||
|
if(pCxt->pParseCxt->schemalessType == 0 &&
|
||||||
|
(code = isNotSchemalessDb(pCxt->pParseCxt, ((SCreateSubTableClause*)pNode)->dbName)) != TSDB_CODE_SUCCESS){
|
||||||
|
return code;
|
||||||
|
}
|
||||||
code = rewriteCreateSubTable(pCxt, (SCreateSubTableClause*)pNode, pVgroupHashmap);
|
code = rewriteCreateSubTable(pCxt, (SCreateSubTableClause*)pNode, pVgroupHashmap);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
taosHashCleanup(pVgroupHashmap);
|
taosHashCleanup(pVgroupHashmap);
|
||||||
|
@ -4853,13 +4855,15 @@ static int32_t buildModifyVnodeArray(STranslateContext* pCxt, SAlterTableStmt* p
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) {
|
static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
if(pCxt->pParseCxt->schemalessType == 0 && isNotSchemalessDb(pCxt->pParseCxt) != TSDB_CODE_SUCCESS){
|
|
||||||
return TSDB_CODE_SML_INVALID_DB_CONF;
|
|
||||||
}
|
|
||||||
SAlterTableStmt* pStmt = (SAlterTableStmt*)pQuery->pRoot;
|
SAlterTableStmt* pStmt = (SAlterTableStmt*)pQuery->pRoot;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if(pCxt->pParseCxt->schemalessType == 0 &&
|
||||||
|
(code = isNotSchemalessDb(pCxt->pParseCxt, pStmt->dbName)) != TSDB_CODE_SUCCESS){
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta);
|
code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue