Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The size of column state in tidb_trx is not defined #53026

Closed
pcqz opened this issue May 6, 2024 · 1 comment · Fixed by #53801
Closed

The size of column state in tidb_trx is not defined #53026

pcqz opened this issue May 6, 2024 · 1 comment · Fixed by #53801
Labels

Comments

@pcqz
Copy link

pcqz commented May 6, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(id int);
begin;
insert into t values(1);
select state from information_schema.tidb_trx as trx  union select state from information_schema.tidb_trx as trx;

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

mysql>  select state from information_schema.tidb_trx as trx  union select state from information_schema.tidb_trx as trx;
+-------+
| state |
+-------+
| Idle  |
+-------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select state from information_schema.tidb_trx as trx  union select state from information_schema.tidb_trx as trx;
+-------+
| state |
+-------+
|       |
+-------+
1 row in set, 2 warnings (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1406 | Data Too Long, field len 0, data len 4 |
| Warning | 1406 | Data Too Long, field len 0, data len 4 |
+---------+------+----------------------------------------+
2 rows in set (0.00 sec)

Because the size of column state in tidb_trx is not defined https://github.com/pingcap/tidb/blob/v6.5.8/infoschema/tables.go#L1466, the cast function uses varchar(0) leading to data too long warning.

mysql> desc select state from information_schema.tidb_trx as trx  union select state from information_schema.tidb_trx as trx;
+-----------------------------+----------+------+----------------+----------------------------------------------------------------------------------+
| id                          | estRows  | task | access object  | operator info                                                                    |
+-----------------------------+----------+------+----------------+----------------------------------------------------------------------------------+
| HashAgg_9                   | 20000.00 | root |                | group by:Column#27, funcs:firstrow(Column#27)->Column#27                         |
| └─Union_10                  | 20000.00 | root |                |                                                                                  |
|   ├─Projection_11           | 10000.00 | root |                | cast(Column#5, varchar(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin)->Column#27  |
|   │ └─MemTableScan_12       | 10000.00 | root | table:TIDB_TRX |                                                                                  |
|   └─Projection_13           | 10000.00 | root |                | cast(Column#18, varchar(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin)->Column#27 |
|     └─MemTableScan_14       | 10000.00 | root | table:TIDB_TRX |                                                                                  |
+-----------------------------+----------+------+----------------+----------------------------------------------------------------------------------+
6 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

v6.5.8

@pcqz pcqz added the type/bug The issue is confirmed as a bug. label May 6, 2024
@ti-chi-bot ti-chi-bot bot added may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels May 6, 2024
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 4, 2024
@cfzjywxk cfzjywxk added affects-6.1 and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants