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

Field type compatibility for blob types in MySQL protocol #60195

Open
dveeden opened this issue Mar 20, 2025 · 0 comments · May be fixed by #60196
Open

Field type compatibility for blob types in MySQL protocol #60195

dveeden opened this issue Mar 20, 2025 · 0 comments · May be fixed by #60196
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) compatibility-mysql80 This is a compatibility issue with MySQL 8.0(but NOT 5.7) compatibility-mysql84 This is a compatibility issue with MySQL 8.4 component/mysql-protocol sig/sql-infra SIG: SQL Infra type/compatibility type/enhancement The issue or PR belongs to an enhancement.

Comments

@dveeden
Copy link
Contributor

dveeden commented Mar 20, 2025

Enhancement

This returns different types for MySQL 9.2.0 and TiDB v8.5.1:

CREATE TABLE t1(id int primary key, f1 longblob, f2 blob, f3 mediumblob, f4 tinyblob);
INSERT INTO t1 VALUES (1, 0x1, 0x2, 0x3, 0x4);
TABLE t1;

MySQL:

mysql-9.2.0> CREATE TABLE t1(id int primary key, f1 longblob, f2 blob, f3 mediumblob, f4 tinyblob);
Query OK, 0 rows affected (0.03 sec)
mysql-9.2.0> INSERT INTO t1 VALUES (1, 0x1, 0x2, 0x3, 0x4);
Query OK, 1 row affected (0.00 sec)
mysql-9.2.0> TABLE t1;
Field   1:  `id`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       LONG
Collation:  binary (63)
Length:     11
Max_length: 1
Decimals:   0
Flags:      NOT_NULL PRI_KEY NO_DEFAULT_VALUE NUM PART_KEY 
Field   2:  `f1`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       BLOB
Collation:  binary (63)
Length:     4294967295
Max_length: 1
Decimals:   0
Flags:      BLOB BINARY 
Field   3:  `f2`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       BLOB
Collation:  binary (63)
Length:     65535
Max_length: 1
Decimals:   0
Flags:      BLOB BINARY 
Field   4:  `f3`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       BLOB
Collation:  binary (63)
Length:     16777215
Max_length: 1
Decimals:   0
Flags:      BLOB BINARY 
Field   5:  `f4`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       BLOB
Collation:  binary (63)
Length:     255
Max_length: 1
Decimals:   0
Flags:      BLOB BINARY 
+----+------------+------------+------------+------------+
| id | f1         | f2         | f3         | f4         |
+----+------------+------------+------------+------------+
|  1 | 0x01       | 0x02       | 0x03       | 0x04       |
+----+------------+------------+------------+------------+
1 row in set (0.00 sec)
mysql-9.2.0> 

TiDB

mysql-8.0.11-TiDB-v8.5.1> CREATE TABLE t1(id int primary key, f1 longblob, f2 blob, f3 mediumblob, f4 tinyblob);
Query OK, 0 rows affected (0.05 sec)
mysql-8.0.11-TiDB-v8.5.1> INSERT INTO t1 VALUES (1, 0x1, 0x2, 0x3, 0x4);
Query OK, 1 row affected (0.02 sec)
mysql-8.0.11-TiDB-v8.5.1> TABLE t1;
Field   1:  `id`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       LONG
Collation:  binary (63)
Length:     11
Max_length: 1
Decimals:   0
Flags:      NOT_NULL PRI_KEY NO_DEFAULT_VALUE NUM 
Field   2:  `f1`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       LONG_BLOB
Collation:  binary (63)
Length:     4294967295
Max_length: 1
Decimals:   0
Flags:      BINARY 
Field   3:  `f2`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       BLOB
Collation:  binary (63)
Length:     65535
Max_length: 1
Decimals:   0
Flags:      BINARY 
Field   4:  `f3`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       MEDIUM_BLOB
Collation:  binary (63)
Length:     16777215
Max_length: 1
Decimals:   0
Flags:      BINARY 
Field   5:  `f4`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       TINY_BLOB
Collation:  binary (63)
Length:     255
Max_length: 1
Decimals:   0
Flags:      BINARY 
+----+------------+------------+------------+------------+
| id | f1         | f2         | f3         | f4         |
+----+------------+------------+------------+------------+
|  1 | 0x01       | 0x02       | 0x03       | 0x04       |
+----+------------+------------+------------+------------+
1 row in set (0.00 sec)
mysql-8.0.11-TiDB-v8.5.1> 
@dveeden dveeden added the type/enhancement The issue or PR belongs to an enhancement. label Mar 20, 2025
@dveeden dveeden linked a pull request Mar 20, 2025 that will close this issue
13 tasks
@dveeden dveeden added type/compatibility compatibility-mysql80 This is a compatibility issue with MySQL 8.0(but NOT 5.7) compatibility-mysql84 This is a compatibility issue with MySQL 8.4 compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) component/mysql-protocol sig/sql-infra SIG: SQL Infra labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) compatibility-mysql80 This is a compatibility issue with MySQL 8.0(but NOT 5.7) compatibility-mysql84 This is a compatibility issue with MySQL 8.4 component/mysql-protocol sig/sql-infra SIG: SQL Infra type/compatibility type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant