From be864d57f52f16eca4c106e78f865e401f042292 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 28 Oct 2021 19:11:03 +0800 Subject: [PATCH] [TD-10700]: fixed tag/column name length 64 issue --- src/client/src/tscParseLineProtocol.c | 6 +++--- src/query/src/qSqlParser.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index 51ccb8c61a..7898017eda 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -161,7 +161,7 @@ static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableNa for (int j = 0; j < point->tagNum; ++j) { taosStringBuilderAppendChar(&sb, ','); TAOS_SML_KV* tagKv = point->tags + j; - char tagName[TSDB_COL_NAME_LEN] = {0}; + char tagName[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; strtolower(tagName, tagKv->key); taosStringBuilderAppendString(&sb, tagName); taosStringBuilderAppendChar(&sb, '='); @@ -261,7 +261,7 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash, SArray* dbAttrArray, bool isTag, char sTableName[], SSchemaAction* action, bool* actionNeeded, SSmlLinesInfo* info) { - char fieldNameLowerCase[TSDB_COL_NAME_LEN] = {0}; + char fieldNameLowerCase[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; strtolower(fieldNameLowerCase, pointColField->name); size_t* pDbIndex = taosHashGet(dbAttrHash, fieldNameLowerCase, strlen(fieldNameLowerCase)); @@ -659,7 +659,7 @@ static int32_t modifyDBSchemas(TAOS* taos, SArray* stableSchemas, SSmlLinesInfo* SSchema* pointColTs = taosArrayGet(pointSchema->fields, 0); SSchema* dbColTs = taosArrayGet(dbSchema.fields, 0); - memcpy(pointColTs->name, dbColTs->name, TSDB_COL_NAME_LEN); + memcpy(pointColTs->name, dbColTs->name, TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE); for (int j = 1; j < pointFieldSize; ++j) { SSchema* pointCol = taosArrayGet(pointSchema->fields, j); diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index d156230efb..dd0e6db876 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -22,6 +22,7 @@ #include "ttoken.h" #include "ttokendef.h" #include "tutil.h" +#include "tscUtil.h" SSqlInfo qSqlParse(const char *pStr) { void *pParser = ParseAlloc(malloc); @@ -67,7 +68,9 @@ SSqlInfo qSqlParse(const char *pStr) { sqlInfo.valid = false; goto abort_parse; } - + case TK_ID: + tscRmEscapeAndTrimToken(&t0); + //fall through default: Parse(pParser, t0.type, t0, &sqlInfo); if (sqlInfo.valid == false) { -- GitLab