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

blob/text/int length isn't accuracy in column metadata #7465

Open
lysu opened this issue Aug 22, 2018 · 2 comments
Open

blob/text/int length isn't accuracy in column metadata #7465

lysu opened this issue Aug 22, 2018 · 2 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/compatibility

Comments

@lysu
Copy link
Contributor

lysu commented Aug 22, 2018

  1. What did you do?

connection tidb with --column-type-info

create table bitest(b blob(2));
select * from bitest;
  1. What did you expect to see?
Length:     255
  1. What did you see instead?
Length:     8
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
2.0.6

ref #7463

@lysu lysu added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/compatibility labels Aug 22, 2018
@lysu lysu changed the title blob/text/int length isn't accuracy in columnm metadata blob/text/int length isn't accuracy in column metadata Aug 23, 2018
@ghost
Copy link

ghost commented Jul 25, 2020

Confirming this issue is still present in master:

mysql> create table bitest(b blob(2));
Query OK, 0 rows affected (0.11 sec)

mysql> select * from bitest;
Field   1:  `b`
Catalog:    `def`
Database:   `test`
Table:      `bitest`
Org_table:  `bitest`
Type:       BLOB
Collation:  binary (63)
Length:     2
Max_length: 0
Decimals:   0
Flags:      NOT_NULL BINARY 


0 rows in set (0.00 sec)

mysql> SHOW CREATE TABLE bitest\G
*************************** 1. row ***************************
       Table: bitest
Create Table: CREATE TABLE `bitest` (
  `b` blob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-835-g1fed1fb89
Edition: Community
Git Commit Hash: 1fed1fb895e133f5a5e6818ac24087b7c3a0d4f8
Git Branch: master
UTC Build Time: 2020-07-24 03:27:11
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

@dveeden
Copy link
Contributor

dveeden commented Oct 26, 2021

Looks like this might have been fixed:

mysql> create table bitest(b blob(2));
Query OK, 0 rows affected (0.01 sec)

mysql> select * from bitest;
Field   1:  `b`
Catalog:    `def`
Database:   `test`
Table:      `bitest`
Org_table:  `bitest`
Type:       TINY_BLOB
Collation:  binary (63)
Length:     255
Max_length: 0
Decimals:   0
Flags:      BINARY 


0 rows in set (0.00 sec)

mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v5.3.0-alpha-1209-g19a2b3c31
Edition: Community
Git Commit Hash: 19a2b3c31106470f83696f8fdaf443f150061a66
Git Branch: master
UTC Build Time: 2021-10-26 12:13:58
GoVersion: go1.16.8
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/compatibility
Projects
None yet
Development

No branches or pull requests

2 participants