From b986843d7d7b84a816e05aac59361ac7f0da73ab Mon Sep 17 00:00:00 2001 From: liu0x54 Date: Wed, 17 Jun 2020 11:01:00 +0000 Subject: [PATCH] [TD-657] fix describe the table bugs --- src/client/src/tscLocal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index a880f4487e..b1a6e1595e 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -183,8 +183,12 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { // type length int32_t bytes = pSchema[i].bytes; pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 2); - if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { - bytes = bytes / TSDB_NCHAR_SIZE; + if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { + bytes -= VARSTR_HEADER_SIZE; + + if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { + bytes = bytes / TSDB_NCHAR_SIZE; + } } *(int32_t *)(pRes->data + tscFieldInfoGetOffset(pQueryInfo, 2) * totalNumOfRows + pField->bytes * i) = bytes;