# [KB]关于 TiDB 的 concat() 函数返回值为非字符串类型

## Issue

在集群 v4.0.7 中， SQL 中的 SELECT CONCAT() 函数返回的结果值类型为字符串，当将集群升级至 v4.0.11 后，发现 CONCAT() 函数返回的结果值类型变成非字符串类型，导致应用程序在传递结果值时报错

## Root Cause

字符串函数获取到错误的二进制标识结果，导致函数返回结果类型错误。已知 BUG [#24296](https://github.com/pingcap/tidb/issues/24296) ，在 v4.0.11 修复 PR [#19186](https://github.com/pingcap/tidb/pull/19186) 时引入的 Bug ，在 v5.0.0 - v5.0.1 也存在。

## Diagnostic Steps

### 复现步骤

```sql
mysql> create table t (dt datetime not null);

mysql> insert into t values ('2021-04-26 14:52:33');

mysql> select concat(unix_timestamp(dt)\*1000, '') from t;
```

## Resolution

PR [**#24297**](https://github.com/pingcap/tidb/pull/24297) 修复了 Bug [**#24296**](https://github.com/pingcap/tidb/pull/24297) ，升级集群至 v4.0.13/v5.0.2 及以上版本。

## Workaround

在 CONCAT() 函数外层加上 CAST() 函数，做一次显示的类型转换