diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index c34b285508cd91584c8a579af0219dbb05c5c711..9e43ae674dfb4a1c845b7ca4db82b1cf6be4d0dd 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 88d730ce00218c76823cb8834d7d6210cd8782cd..5ee0ec376a292360d473e81f56ff1ed487a5e10e 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 94ba5dcf9d7d955ef44f579529bc3f2c3d8a21c2..1bafe241e3e6cb32a102631be9e9620a4ae48429 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 4ac3011ac9a6db8a651f2e383d08dd98314d3f4b..d18eae033b3ecb4dc2b5870e979c0cba5c28d0a2 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 ef66300f661aba3e8bb04ac878751d2714c41be2..bed9121b0411177788193b15afd10490dc187651 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 */ {