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 length of binary arithmetic between integer and decimal is different from MySQL #26402

Open
riteme opened this issue Jul 21, 2021 · 0 comments
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@riteme
Copy link
Contributor

riteme commented Jul 21, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Connect to MySQL/TiDB with --column-type-info in command line.

create table test.t (a int, b decimal(1, 0));
select a % b from test.t;

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

In MySQL 5.7/8.0:

Field   1:  `a % b`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     11
Max_length: 0
Decimals:   0
Flags:      BINARY NUM 

3. What did you see instead (Required)

In TiDB:

Field   1:  `a % b`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     12
Max_length: 0
Decimals:   0
Flags:      NOT_NULL BINARY NUM 

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                                |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.2.0-alpha-211-ga8d23fda4-dirty
Edition: Community
Git Commit Hash: a8d23fda419a1d9a40f2b8ba85b6f22a6884b737
Git Branch: master
UTC Build Time: 2021-07-20 10:34:06
GoVersion: go1.16.6
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)
@riteme riteme added the type/bug The issue is confirmed as a bug. label Jul 21, 2021
@riteme riteme changed the title Field length of binary arithmetic between integer and decimal is different from MySQL. Field length of binary arithmetic between integer and decimal is different from MySQL Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants