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

incompatible behavior when modifying a stored generated column #10937

Closed
crazycs520 opened this issue Jun 25, 2019 · 2 comments
Closed

incompatible behavior when modifying a stored generated column #10937

crazycs520 opened this issue Jun 25, 2019 · 2 comments
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@crazycs520
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

In TiDB Master

mysql>create table t1 (a int, b int as (a+1) stored, index idx(a,b));
Query OK, 0 rows affected
Time: 0.071s
mysql>insert into t1 set a=1
Query OK, 1 row affected
Time: 0.008s
mysql>alter table t1 modify column b int as (a+5) stored;
Query OK, 0 rows affected
Time: 0.071s
mysql>insert into t1 set a=1
Query OK, 1 row affected
Time: 0.002s
mysql>select a,b from t1;
+---+---+
| a | b |
+---+---+
| 1 | 2 |
| 1 | 6 |
+---+---+

In mysql

mysql>create table t1 (a int, b int as (a+1) stored, index idx(a,b));
Query OK, 0 rows affected
Time: 0.005s
mysql>insert into t1 set a=1
Query OK, 1 row affected
Time: 0.001s
mysql>alter table t1 modify column b int as (a+5) stored;
Query OK, 1 row affected
Time: 0.006s
mysql>insert into t1 set a=1
Query OK, 1 row affected
Time: 0.001s
mysql>select a,b from t1;
+---+---+
| a | b |
+---+---+
| 1 | 6 |
| 1 | 6 |
+---+---+
  1. What did you expect to see?

  2. What did you see instead?

  3. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

mysql>select tidb_version();
+--------------------------------------------------------------------------+
| tidb_version()                                                           |
+--------------------------------------------------------------------------+
| Release Version: v3.0.0-rc.1-235-ga57b6e60a                              |
| Git Commit Hash: a57b6e60a6f7d5f36e5fdc81cc8d82c3eeab464f                |
| Git Branch: master                                                       |
| UTC Build Time: 2019-06-25 04:56:41                                      |
| GoVersion: go version go1.12 darwin/amd64                                |
| Race Enabled: false                                                      |
| TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e |
| Check Table Before Drop: false                                           |
+--------------------------------------------------------------------------+
@bb7133 bb7133 changed the title modify generated stored column behaviour is not compatible with mysql. incompatible behavior modifying a stored generated column Jun 26, 2019
@bb7133 bb7133 changed the title incompatible behavior modifying a stored generated column incompatible behavior when modifying a stored generated column Jun 26, 2019
@zimulala
Copy link
Contributor

Related to #9372

@winkyao winkyao added type/bug The issue is confirmed as a bug. and removed type/compatibility labels Jun 27, 2019
@tangenta
Copy link
Contributor

Here is a similar issue:

create table t (a int, b int);
insert into t value (1, 0);
alter table t modify column b int as (a + 5) stored;
select * from t;

In MySQL :

+---+---+
| a | b |
+---+---+
| 1 | 6 |
+---+---+

In TiDB:

+---+---+
| a | b |
+---+---+
| 1 | 0 |
+---+---+

@tangenta tangenta closed this as completed Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants