提交 186662aa 编写于 作者: H Haojun Liao

[td-225]

上级 8880e515
...@@ -7189,16 +7189,11 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7189,16 +7189,11 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
if (pSqlNode->from->type == SQL_NODE_FROM_SUBQUERY) { if (pSqlNode->from->type == SQL_NODE_FROM_SUBQUERY) {
// parse the subquery in the first place // parse the subquery in the first place
SArray* list = taosArrayGetP(pSqlNode->from->list, 0); SRelElementPair* sub = taosArrayGet(pSqlNode->from->list, 0);
SSqlNode* p = taosArrayGetP(list, 0); SSqlNode* p = taosArrayGetP(sub->pSubquery, 0);
SQueryInfo* pQueryInfo = tscGetQueryInfo(&pSql->cmd, 0);
code = validateSqlNode(pSql, p, pQueryInfo); code = validateSqlNode(pSql, p, pQueryInfo);
if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) { if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS || code != TSDB_CODE_SUCCESS) {
return code;
}
if (code != TSDB_CODE_SUCCESS) {
return code; return code;
} }
...@@ -7211,6 +7206,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf ...@@ -7211,6 +7206,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
STableMetaInfo* pTableMetaInfo1 = calloc(1, sizeof(STableMetaInfo)); STableMetaInfo* pTableMetaInfo1 = calloc(1, sizeof(STableMetaInfo));
pTableMetaInfo1->pTableMeta = pTableMeta; pTableMetaInfo1->pTableMeta = pTableMeta;
if (sub->aliasName.n > 0) {
if (sub->aliasName.n > TSDB_TABLE_FNAME_LEN) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "subquery alias name too long");
}
strncpy(pTableMetaInfo1->aliasName, sub->aliasName.z, sub->aliasName.n);
}
current->pTableMetaInfo = calloc(1, POINTER_BYTES); current->pTableMetaInfo = calloc(1, POINTER_BYTES);
current->pTableMetaInfo[0] = pTableMetaInfo1; current->pTableMetaInfo[0] = pTableMetaInfo1;
current->numOfTables = 1; current->numOfTables = 1;
......
...@@ -111,7 +111,6 @@ typedef struct SRelElementPair { ...@@ -111,7 +111,6 @@ typedef struct SRelElementPair {
union { union {
SStrToken tableName; SStrToken tableName;
SArray *pSubquery; SArray *pSubquery;
//SSqlNode *pSubquery;
}; };
SStrToken aliasName; SStrToken aliasName;
...@@ -119,7 +118,7 @@ typedef struct SRelElementPair { ...@@ -119,7 +118,7 @@ typedef struct SRelElementPair {
typedef struct SRelationInfo { typedef struct SRelationInfo {
int32_t type; // nested query|table name list int32_t type; // nested query|table name list
SArray *list; // SArray<SRelElementPair>|SArray<SSqlNode*> SArray *list; // SArray<SRelElementPair>
} SRelationInfo; } SRelationInfo;
typedef struct SCreatedTableInfo { typedef struct SCreatedTableInfo {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册