diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index c9cb161a4b6237f28fefaece20a5d4d3f9f36cf1..4156bc7649ee06ae46aee9fa0ed04075be7fb700 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2155,7 +2155,7 @@ int tscProcessShowRsp(SSqlObj *pSql) { uint64_t uid = pTableMetaInfo->pTableMeta->id.uid; for (int16_t i = 0; i < pMetaMsg->numOfColumns; ++i, ++pSchema) { index.columnIndex = i; - tscColumnListInsert(pQueryInfo->colList, i, uid, &pSchema[i]); + tscColumnListInsert(pQueryInfo->colList, i, uid, pSchema); TAOS_FIELD f = tscCreateField(pSchema->type, pSchema->name, pSchema->bytes); SInternalField* pInfo = tscFieldInfoAppend(pFieldInfo, &f); diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index 1fb92008fd65b602fa7903c3c7fa9ade70037d1e..63dc7b37611daf3f79bb5dd326931c53fe8ddee9 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -106,11 +106,6 @@ typedef struct STableNamePair { SStrToken aliasName; } STableNamePair; -//typedef struct SSubclauseInfo { // "UNION" multiple select sub-clause -// SSqlNode **pClause; -// int32_t numOfClause; -//} SSubclauseInfo; - typedef struct SRelationInfo { int32_t type; // nested query|table name list SArray *list; // SArray|SArray @@ -253,7 +248,7 @@ SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t s SRelationInfo *setTableNameList(SRelationInfo* pFromInfo, SStrToken *pName, SStrToken* pAlias); SRelationInfo *setSubquery(SRelationInfo* pFromInfo, SArray* pSqlNode); -void *destroyFromInfo(SRelationInfo* pFromInfo); +void *destroyRelationInfo(SRelationInfo* pFromInfo); // sql expr leaf node tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType); diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index b4a8ec97f8c89a46eed5f2b0eed02402cd3d0650..8ca0dee2d6e511da0f1afd2268a26d40f8923ea1 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -506,10 +506,12 @@ distinct(X) ::= . { X.n = 0;} // A complete FROM clause. %type from {SRelationInfo*} +%destructor from {destroyRelationInfo($$);} from(A) ::= FROM tablelist(X). {A = X;} from(A) ::= FROM LP union(Y) RP. {A = setSubquery(NULL, Y);} %type tablelist {SRelationInfo*} +%destructor tablelist {destroyRelationInfo($$);} tablelist(A) ::= ids(X) cpxName(Y). { X.n += Y.n; A = setTableNameList(NULL, &X, NULL); diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index f8f5aafbd8bc7d164c83a721354f0b61f2971ec9..0cb832f358241114f5fbf4522eed3122aa4b0333 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -552,7 +552,7 @@ SRelationInfo* setSubquery(SRelationInfo* pRelationInfo, SArray* pList) { return pRelationInfo; } -void* destroyFromInfo(SRelationInfo* pRelationInfo) { +void* destroyRelationInfo(SRelationInfo* pRelationInfo) { if (pRelationInfo == NULL) { return NULL; } @@ -799,7 +799,7 @@ void destroySqlNode(SSqlNode *pSqlNode) { taosArrayDestroyEx(pSqlNode->pGroupby, freeVariant); pSqlNode->pGroupby = NULL; - pSqlNode->from = destroyFromInfo(pSqlNode->from); + pSqlNode->from = destroyRelationInfo(pSqlNode->from); taosArrayDestroyEx(pSqlNode->fillType, freeVariant); pSqlNode->fillType = NULL; diff --git a/src/query/src/sql.c b/src/query/src/sql.c index a4bc8602016cecd47fcec62c8b35607eda8c04e6..a283a8b916e5f453729ff575ebff2bdd28e8ad37 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -1433,6 +1433,12 @@ destroySqlNode((yypminor->yy116)); case 261: /* exprlist */ { tSqlExprListDestroy((yypminor->yy159)); +} + break; + case 238: /* from */ + case 254: /* tablelist */ +{ +destroyRelationInfo((yypminor->yy236)); } break; case 239: /* where_opt */