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

infoschema: fix default NUMBER_SCALE value of float type #7602

Merged
merged 6 commits into from Sep 11, 2018

Conversation

@imtbkcat
Copy link
Contributor

imtbkcat commented Sep 4, 2018

What problem does this PR solve?

Fix wrong value for default numberScale value for float and double type.

Test Case:

create table floatschema(a float, b double(7, 3));
select NUMERIC_SCALE from information_schema.COLUMNS where table_name='floatschema';

MySQL:

mysql> select NUMERIC_SCALE from information_schema.COLUMNS where 
table_name='floatschema';
+---------------+
| NUMERIC_SCALE |
+---------------+
|          NULL |
|             3 |
+---------------+
2 rows in set (0.01 sec)

TiDB:

+----------------------+
| NUMERIC_SCALE        |
+----------------------+
| 18446744073709551615 |
|                    3 |
+----------------------+
2 rows in set (0.01 sec)

This is because the default value of NUMERIC_SCALE for float and double type is -1, but NUMERIC_SCALE is a UNSIGNED LONG.

What is changed and how it works?

add code to make NUMERIC_SCALE same as MySQL.

Check List

Tests

  • Unit test

Code changes

  • Has exported variable/fields change

Side effects

-No

@@ -1006,24 +1010,24 @@ func dataForTableConstraints(schemas []*model.DBInfo) [][]types.Datum {
func dataForPseudoProfiling() [][]types.Datum {
var rows [][]types.Datum
row := types.MakeDatums(
0, // QUERY_ID

This comment has been minimized.

Copy link
@jackysp

jackysp Sep 4, 2018

Member

Please update your golang version to 1.11.

@@ -1006,24 +1010,24 @@ func dataForTableConstraints(schemas []*model.DBInfo) [][]types.Datum {
func dataForPseudoProfiling() [][]types.Datum {
var rows [][]types.Datum
row := types.MakeDatums(
0, // QUERY_ID

This comment has been minimized.

Copy link
@jackysp

jackysp Sep 4, 2018

Member

Please update your golang version to 1.11, then format again.

@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 4, 2018

PTAL @jackysp

@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 4, 2018

/run-all-tests

@shenli

This comment has been minimized.

Copy link
Member

shenli commented Sep 5, 2018

@imtbkcat Please fix the CI.

@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 10, 2018

/run-all-tests

@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 10, 2018

@shenli ok.

@lysu

This comment has been minimized.

Copy link
Member

lysu commented Sep 10, 2018

/run-all-tests tidb-test=pr/619

1 similar comment
@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 10, 2018

/run-all-tests tidb-test=pr/619

@coocood

This comment has been minimized.

Copy link
Member

coocood commented Sep 10, 2018

LGTM

@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 10, 2018

/run-all-tests tidb-test=pr/619

@coocood

This comment has been minimized.

Copy link
Member

coocood commented Sep 10, 2018

/run-all-tests tidb-test=pr/619

@coocood

This comment has been minimized.

Copy link
Member

coocood commented Sep 10, 2018

/run-all-tests tidb-test=pr/619

@imtbkcat

This comment has been minimized.

Copy link
Contributor Author

imtbkcat commented Sep 10, 2018

/run-all-tests

Copy link
Member

zz-jason left a comment

LGTM

@zz-jason zz-jason added status/LGT2 and removed status/LGT1 labels Sep 11, 2018
@zz-jason zz-jason merged commit 4423937 into pingcap:master Sep 11, 2018
3 checks passed
3 checks passed
ci/circleci Your tests passed on CircleCI!
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
@imtbkcat imtbkcat deleted the imtbkcat:jdbc branch Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.