Skip to content

collation and flag of some functions are wrong #23759

Closed
@xiongjiwei

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a char(10) collate utf8mb4_general_ci, b char(10) collate utf8mb4_unicode_ci);
insert into t values ('a', 'a')
select concat(a, 0x80) from t;

2. What did you expect to see? (Required)

mysql> select concat(a, 0x80) from t;
Field   1:  `concat(a, 0x80)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  utf8mb4_0900_ai_ci (255)
Length:     44
Max_length: 4
Decimals:   31
Flags:


+-----------------+
| concat(a, 0x80) |
+-----------------+
| a�               |
| 一�              |
+-----------------+
2 rows in set (0.00 sec)

3. What did you see instead (Required)

Database changed
mysql> select concat(a, 0x80) from t;
Field   1:  `concat(a, 0x80)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     13
Max_length: 4
Decimals:   31
Flags:      NOT_NULL BINARY


+----------------------------------+
| concat(a, 0x80)                  |
+----------------------------------+
| 0x6180                           |
| 0xE4B88080                       |
+----------------------------------+
2 rows in set (0.02 sec)

it should not be binary

4. What is your TiDB version? (Required)

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions