[td-3361]<fix>: nchar tag filter caused client crash.
This commit is contained in:
parent
8286820a1c
commit
7447a8c562
|
@ -4138,13 +4138,21 @@ static int32_t validateTagCondExpr(SSqlCmd* pCmd, tExprNode *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t retVal = TSDB_CODE_SUCCESS;
|
int32_t retVal = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
int32_t bufLen = 0;
|
||||||
|
if (IS_NUMERIC_TYPE(vVariant->nType)) {
|
||||||
|
bufLen = 60; // The maximum length of string that a number is converted to.
|
||||||
|
} else {
|
||||||
|
bufLen = vVariant->nLen + 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (schemaType == TSDB_DATA_TYPE_BINARY) {
|
if (schemaType == TSDB_DATA_TYPE_BINARY) {
|
||||||
char *tmp = calloc(1, vVariant->nLen + TSDB_NCHAR_SIZE);
|
char *tmp = calloc(1, bufLen * TSDB_NCHAR_SIZE);
|
||||||
retVal = tVariantDump(vVariant, tmp, schemaType, false);
|
retVal = tVariantDump(vVariant, tmp, schemaType, false);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else if (schemaType == TSDB_DATA_TYPE_NCHAR) {
|
} else if (schemaType == TSDB_DATA_TYPE_NCHAR) {
|
||||||
// pRight->value.nLen + 1 is larger than the actual nchar string length
|
// pRight->value.nLen + 1 is larger than the actual nchar string length
|
||||||
char *tmp = calloc(1, (vVariant->nLen + 1) * TSDB_NCHAR_SIZE);
|
char *tmp = calloc(1, bufLen * TSDB_NCHAR_SIZE);
|
||||||
retVal = tVariantDump(vVariant, tmp, schemaType, false);
|
retVal = tVariantDump(vVariant, tmp, schemaType, false);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -316,4 +316,13 @@ if $data13 != @20-02-02 01:01:01.000@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
print ===============================>td-3361
|
||||||
|
sql create table ttm1(ts timestamp, k int) tags(a nchar(12));
|
||||||
|
sql create table ttm1_t1 using ttm1 tags('abcdef')
|
||||||
|
sql insert into ttm1_t1 values(now, 1)
|
||||||
|
sql select * from ttm1 where a=123456789012
|
||||||
|
if $row != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
Loading…
Reference in New Issue