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

*: Refine error message about "Out of range value for column" #6334

Merged
merged 25 commits into from
May 9, 2018

Conversation

spongedu
Copy link
Contributor

  1. When a value in a numeric column that is outside the permissible range of the column data type, the error message in TiDB is not consistent with MySQL.

In MySQL:

mysql> create table t ( a decimal);
Query OK, 0 rows affected (0.04 sec)

mysql> insert into t values( 1.7976931348623157E308);
ERROR 1264 (22003): Out of range value for column 'a' at row 1

In TiDB

tidb> create table t ( a decimal);
Query OK, 0 rows affected (0.11 sec)

tidb> insert into t values( 1.7976931348623157E308);
ERROR 1690 (22003): %s value is out of range in '%s'
  1. According to https://golang.org/pkg/fmt/ , The format string does't support %ld , %u

@sre-bot
Copy link
Contributor

sre-bot commented Apr 22, 2018

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

@spongedu spongedu changed the title Refine insert err mysql, ddl: Refine error message Apr 22, 2018
@ngaut
Copy link
Member

ngaut commented Apr 22, 2018

well done.

@shenli
Copy link
Member

shenli commented Apr 22, 2018

/add-to-whitelist

@shenli
Copy link
Member

shenli commented Apr 22, 2018

/run-all-tests

@shenli shenli added the contribution This PR is from a community contributor. label Apr 22, 2018
@zz-jason zz-jason changed the title mysql, ddl: Refine error message *: Refine error message about "Out of range value for column" Apr 23, 2018
@spongedu
Copy link
Contributor Author

spongedu commented Apr 23, 2018

@zz-jason @shenli
The failed test cases such as

insert into t1 values (-1);
Error 1690: constant -1 overflows int

seems should be modified.

@zz-jason
Copy link
Member

@spongedu OK, I'll handle this.

types/errors.go Outdated
@@ -73,6 +76,8 @@ const (
codeUnknown = terror.ErrCode(mysql.ErrUnknown)
codeInvalidDefault = terror.ErrCode(mysql.ErrInvalidDefault)
codeMBiggerThanD = terror.ErrCode(mysql.ErrMBiggerThanD)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this empty line ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 28, 2018
@zz-jason
Copy link
Member

/run-all-tests

@zz-jason
Copy link
Member

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

@zz-jason
Copy link
Member

zz-jason commented May 7, 2018

@XuHuaiyu @winoros PTAL

@shenli
Copy link
Member

shenli commented May 8, 2018

/run-all-tests

@shenli
Copy link
Member

shenli commented May 8, 2018

LGTM

@shenli shenli added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 8, 2018
@zz-jason
Copy link
Member

zz-jason commented May 8, 2018

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

@shenli
Copy link
Member

shenli commented May 8, 2018

@zz-jason We need to update the integration test cases.

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason merged commit 3db7594 into pingcap:master May 9, 2018
zz-jason pushed a commit to zz-jason/tidb that referenced this pull request May 9, 2018
ngaut pushed a commit that referenced this pull request May 12, 2018
…#6509)

* *: Refine error message about "Out of range value for column" (#6334)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants