From 0ec762866d1764c602f30c4fc31eaa748ba8e261 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 10 Mar 2021 10:49:58 +0800 Subject: [PATCH] fix bug --- src/client/src/tscServer.c | 2 ++ src/inc/ttokendef.h | 1 + src/query/inc/sql.y | 4 ++-- src/query/src/qParserImpl.c | 6 +++--- src/query/src/sql.c | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index c34b285508..9e43ae674d 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1518,6 +1518,8 @@ int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pCmd->msgType = (pInfo->pMiscInfo->dbOpt.dbType == TSDB_DB_TYPE_DEFAULT) ? TSDB_MSG_TYPE_CM_ALTER_DB : TSDB_MSG_TYPE_CM_ALTER_TP; SAlterDbMsg *pAlterDbMsg = (SAlterDbMsg* )pCmd->payload; + pAlterDbMsg->dbType = -1; + STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); tNameExtractFullName(&pTableMetaInfo->name, pAlterDbMsg->db); diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 88d730ce00..5ee0ec376a 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -238,6 +238,7 @@ + #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 94ba5dcf9d..1bafe241e3 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -255,7 +255,7 @@ cachelast(Y) ::= CACHELAST INTEGER(X). { Y = X; } partitions(Y) ::= PARTITIONS INTEGER(X). { Y = X; } %type db_optr {SCreateDbInfo} -db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);} +db_optr(Y) ::= . {setDefaultCreateDbOption(&Y); Y.dbType = TSDB_DB_TYPE_DEFAULT;} db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } @@ -279,7 +279,7 @@ topic_optr(Y) ::= db_optr(Z). { Y = Z; Y.dbType = TSDB_DB_ topic_optr(Y) ::= topic_optr(Z) partitions(X). { Y = Z; Y.partitions = strtol(X.z, NULL, 10); } %type alter_db_optr {SCreateDbInfo} -alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y);} +alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y); Y.dbType = TSDB_DB_TYPE_DEFAULT;} alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } alter_db_optr(Y) ::= alter_db_optr(Z) quorum(X). { Y = Z; Y.quorum = strtol(X.z, NULL, 10); } diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c index c855b38d4a..eed602a8c2 100644 --- a/src/query/src/qParserImpl.c +++ b/src/query/src/qParserImpl.c @@ -936,10 +936,10 @@ void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo) { pDBInfo->keep = NULL; pDBInfo->update = -1; - pDBInfo->cachelast = 0; + pDBInfo->cachelast = -1; - pDBInfo->dbType = TSDB_DB_TYPE_DEFAULT; - pDBInfo->partitions = TSDB_DEFAULT_DB_PARTITON_OPTION; + pDBInfo->dbType = -1; + pDBInfo->partitions = -1; memset(&pDBInfo->precision, 0, sizeof(SStrToken)); } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index ef66300f66..bed9121b04 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -2682,7 +2682,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 93: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy100);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy100); yymsp[1].minor.yy100.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 94: /* db_optr ::= db_optr cache */ { yylhsminor.yy100 = yymsp[-1].minor.yy100; yylhsminor.yy100.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } @@ -2764,7 +2764,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy100 = yylhsminor.yy100; break; case 111: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy100);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy100); yymsp[1].minor.yy100.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 123: /* typename ::= ids */ { -- GitLab