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
type: make decimal default precision visible in show create table
#7667
Changes from 3 commits
2c820ef
d14acbd
858bfcf
8b61441
3fe20b7
7a28278
8893d1c
04a4296
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,8 +231,12 @@ func (ft *FieldType) CompactStr() string { | |
suffix = fmt.Sprintf("(%d", displayFlen) | ||
if isDecimalNotDefault { | ||
suffix += fmt.Sprintf(",%d", displayDecimal) | ||
} else { | ||
suffix += fmt.Sprintf(",%d", 0) | ||
} | ||
suffix += ")" | ||
} else { | ||
suffix = fmt.Sprintf("(%d,0)", defaultFlen) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be simpler if calculate the suffix = fmt.Sprintf("(%d,%d)", displayFlen, displayDecimal) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the type is mysql.TypeNewDecimal, why still need to check isFlenNotDefault or isDecimalNotDefault? What about just using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @winkyao , have you checked it with MySQL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When it is a decimal type, mysql show decimal length in show create table anyway. @jackysp |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about
|
||
case mysql.TypeBit, mysql.TypeShort, mysql.TypeTiny, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong, mysql.TypeVarchar, mysql.TypeString, mysql.TypeVarString: | ||
// Flen is always shown. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about: