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

table:modify 'desc' and 'show columns' statement is compatible with MySQL #10358

Merged
merged 4 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion executor/seqtest/seq_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (s *seqTestSuite) TestShow(c *C) {
"c5|varchar(6)|YES||'C6'|",
"c6|enum('s','m','l','xl')|YES||xl|",
"c7|set('a','b','c','d')|YES||a,c,c|",
"c8|datetime|YES||CURRENT_TIMESTAMP|on update CURRENT_TIMESTAMP",
"c8|datetime|YES||CURRENT_TIMESTAMP|DEFAULT_GENERATED on update CURRENT_TIMESTAMP",
"c9|year(4)|YES||2014|",
))
}
Expand Down
4 changes: 3 additions & 1 deletion table/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ func NewColDesc(col *Column) *ColDesc {
if mysql.HasAutoIncrementFlag(col.Flag) {
extra = "auto_increment"
} else if mysql.HasOnUpdateNowFlag(col.Flag) {
extra = "on update CURRENT_TIMESTAMP"
//in order to match the rules of mysql 8.0.16 version
//see https://github.com/pingcap/tidb/issues/10337
extra = "DEFAULT_GENERATED on update CURRENT_TIMESTAMP"
} else if col.IsGenerated() {
if col.GeneratedStored {
extra = "STORED GENERATED"
Expand Down
2 changes: 1 addition & 1 deletion table/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (t *testTableSuite) TestDesc(c *C) {
NewColDesc(col)
col.Flag = mysql.UniqueKeyFlag | mysql.OnUpdateNowFlag
desc := NewColDesc(col)
c.Assert(desc.Extra, Equals, "on update CURRENT_TIMESTAMP")
c.Assert(desc.Extra, Equals, "DEFAULT_GENERATED on update CURRENT_TIMESTAMP")
col.Flag = 0
col.GeneratedExprString = "test"
col.GeneratedStored = true
Expand Down