diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 059345128e54d252d3265ec51287359c5d7f10df..d1e02f3c63f099027876589c5b953470477fe927 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -779,7 +779,6 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { STagData *pTag = (STagData *)pCmd->payload; memset(pTag, 0, sizeof(STagData)); - pCmd->payloadLen = sizeof(STagData); /* * the source super table is moved to the secondary position of the pTableMetaInfo list @@ -928,6 +927,12 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { } } + // 3. calculate the actual data size of STagData + pCmd->payloadLen = sizeof(pTag->name); + for (int32_t t = 0; t < numOfTags; ++t) { + pCmd->payloadLen += pTagSchema[t].bytes; + } + if (tscValidateName(&tableToken) != TSDB_CODE_SUCCESS) { return tscInvalidSQLErrMsg(pCmd->payload, "invalid table name", *sqlstr); }