From 99d44db97cccf4ad3cfc0134791ad45330378fba Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Thu, 21 May 2020 17:05:11 +0800 Subject: [PATCH] auto create table: send actual data only --- src/client/src/tscParseInsert.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 059345128e..d1e02f3c63 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); } -- GitLab