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

Support ZEROFILL attribute for numeric type #6688

Closed
lysu opened this issue May 30, 2018 · 2 comments
Closed

Support ZEROFILL attribute for numeric type #6688

lysu opened this issue May 30, 2018 · 2 comments

Comments

@lysu
Copy link
Contributor

lysu commented May 30, 2018

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
drop table if exists t1;
create table t1 (a int(3) zerofill);
insert into t1 values (3);
  1. What did you expect to see?
mysql> select * from t1;
+------+
| a    |
+------+
|  003 |
+------+
  1. What did you see instead?
mysql> select * from t1;
+------+
| a    |
+------+
|    3 |
+------+
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v2.0.0-rc.4-253-gc1fb53c3-dirty
Git Commit Hash: c1fb53c31fd1ad8a2fbf63a002713810c6fb0014
Git Branch: fix-decimal-overflow-warnings
UTC Build Time: 2018-05-29 01:51:07
GoVersion: go version go1.10.1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.0.0-rc.4.1

Current, when create table with ZEROFILL attribute is no real effact.
Maybe we can support this attribute just like mysql.

  | TINYINT[(length)] [UNSIGNED] [ZEROFILL]
  | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]
  | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]
  | INT[(length)] [UNSIGNED] [ZEROFILL]
  | INTEGER[(length)] [UNSIGNED] [ZEROFILL]
  | BIGINT[(length)] [UNSIGNED] [ZEROFILL]
  | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
  | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
  | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
  | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]
  | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]

https://dev.mysql.com/doc/refman/8.0/en/create-table.html
https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html

@lysu lysu added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label May 30, 2018
@lysu lysu changed the title TiDB support ZEROFILL attribute for numeric type Support ZEROFILL attribute for numeric type May 30, 2018
@morgo
Copy link
Contributor

morgo commented May 30, 2018

I expect that MySQL will deprecate and remove ZEROFILL in the future. I no longer work on the MySQL team, but wrote about this here in 2015:
http://www.tocker.ca/2015/07/02/proposal-to-deprecate-mysql-integer-display-width-and-zerofill.html

@coocood
Copy link
Member

coocood commented May 31, 2018

@morgo
Thank you for your information!
Now we decided to not support this feature.

@coocood coocood closed this as completed May 31, 2018
@lysu lysu removed the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants