Skip to content

Commit

Permalink
modify desc is compatible with MySQL (pingcap#10358)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuguangliang-11 authored and ngaut committed May 8, 2019
1 parent a5f86a3 commit 1ef1d8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
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 @@ -136,7 +136,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

0 comments on commit 1ef1d8a

Please sign in to comment.