You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What did you do?
If possible, provide a recipe for reproducing the error.
createtablet (a int, b intas (a +1), c intas (b +1))
insert into t set a=1;
altertable t add column e intas (c +1) first; -- this will get error in mysql: 'Generated column can refer only to generated columns defined prior to it.'select*from t
+--------+---+---+---+
| e | a | b | c |
+--------+---+---+---+
| <null> | 1 | 2 | 3 |
+--------+---+---+---+1 row insetdescselect*from t;
+-----------------+----------+------+-------------------------------------------------------------------------------------------------------------------+
| id | count | task | operator info |
+-----------------+----------+------+-------------------------------------------------------------------------------------------------------------------+
| Projection_5 | 10000.00 | root | cast(plus(cast(plus(test.t.b, 1)), 1)), test.t.a, cast(plus(test.t.a, 1)), cast(plus(cast(plus(test.t.a, 1)), 1)) |
| └─TableReader_7 | 10000.00 | root | data:TableScan_6 |
| └─TableScan_6 | 10000.00 | cop | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |
+-----------------+----------+------+-------------------------------------------------------------------------------------------------------------------+
What did you expect to see?
mysql>alter table t add column e intas (c +1) first;
(3107, u'Generated column can refer only to generated columns defined prior to it.')
What did you see instead?
altertable t add column e intas (c +1) first;
--successselect*from t
+--------+---+---+---+
| e | a | b | c |
+--------+---+---+---+
| <null> | 1 | 2 | 3 | -- the result of e should not null.+--------+---+---+---+
What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
▶ bin/tidb-server -V
Release Version: v3.0.0-rc.1-360-g85de5df03
Git Commit Hash: 85de5df03fd47f80b90c36a63b7d213aeda4468b
Git Branch: master
UTC Build Time: 2019-07-2206:40:48
GoVersion: go version go1.12 darwin/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
The text was updated successfully, but these errors were encountered:
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: