Skip to content

Commit

Permalink
fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Apr 19, 2024
1 parent 4d3387b commit a93dc0e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cdc/entry/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,12 +713,19 @@ func getDefaultOrZeroValue(
// Ref: https://github.com/pingcap/tidb/blob/d2c352980a43bb593db81fd1db996f47af596d91/table/column.go#L489
if col.GetOriginDefaultValue() != nil {
datum := types.NewDatum(col.GetOriginDefaultValue())
ctx := types.DefaultStmtNoWarningContext
ctx = ctx.WithLocation(tz)
d, err = datum.ConvertTo(ctx, &col.FieldType)
d, err = datum.ConvertTo(types.DefaultStmtNoWarningContext, &col.FieldType)
if err != nil {
return d, d.GetValue(), sizeOfDatum(d), "", errors.Trace(err)
}
switch col.GetType() {
case mysql.TypeTimestamp:
t := d.GetMysqlTime()
err = t.ConvertTimeZone(time.UTC, tz)
if err != nil {
return d, d.GetValue(), sizeOfDatum(d), "", errors.Trace(err)
}
d.SetMysqlTime(t)
}
} else if !mysql.HasNotNullFlag(col.GetFlag()) {
// NOTICE: NotNullCheck need do after OriginDefaultValue check, as when TiDB meet "amend + add column default xxx",
// ref: https://github.com/pingcap/ticdc/issues/3929
Expand Down

0 comments on commit a93dc0e

Please sign in to comment.