From c3a31c681d158964363139c33b5e61936aab071f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 21 Oct 2020 15:11:57 +0800 Subject: [PATCH] [td-1765] --- src/client/src/tscSQLParser.c | 2 +- tests/script/general/parser/tags_dynamically_specifiy.sim | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b28dd9cf1c..e2573f7e19 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4750,7 +4750,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { // validate the length of binary if ((pTagsSchema->type == TSDB_DATA_TYPE_BINARY || pTagsSchema->type == TSDB_DATA_TYPE_NCHAR) && - (pVarList->a[1].pVar.nLen + VARSTR_HEADER_SIZE) > pTagsSchema->bytes) { + varDataTLen(pAlterSQL->tagData.data) > pTagsSchema->bytes) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg14); } diff --git a/tests/script/general/parser/tags_dynamically_specifiy.sim b/tests/script/general/parser/tags_dynamically_specifiy.sim index 0a5d5c9716..07bf4d8dd1 100644 --- a/tests/script/general/parser/tags_dynamically_specifiy.sim +++ b/tests/script/general/parser/tags_dynamically_specifiy.sim @@ -96,5 +96,10 @@ if $rows != 14 then return -1 endi +print ===============================> td-1765 +sql create table m1(ts timestamp, k int) tags(a binary(4), b nchar(4)); +sql create table tm0 using m1 tags('abcd', 'abcd'); +sql_error alter table tm0 set tag b = 'abcd1'; +sql_error alter table tm0 set tag a = 'abcd1'; system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file -- GitLab