-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Shenli/fix hibernate bug #377
Conversation
dataType := types.TypeToStr(col.Tp, col.Charset == charset.CharsetBin) | ||
columnType := fmt.Sprintf("%s(%d)", dataType, colLen) | ||
columnType := types.TypeToStr(col.Tp, col.Charset == charset.CharsetBin) | ||
if col.Decimal == types.UnspecifiedLength { |
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.
I see other similar handing for type(m, n) in util/types and column, maybe we can unify them.
Btw, you can see that float and double don't have (m, n) even they have length and decimal.
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.
Yes.
And for data type without decimal, n will always be UnSpecifiedLength until the data is sent to mysql-client.
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.
PTAL @siddontang
ans := []string{ts} | ||
// SimpleString only consider Tp/CharsetBin/Flen/Deimal. | ||
// This is used for showing column type in infoschema. | ||
func (ft *FieldType) SimpleString() string { |
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.
SimpleString looks strange.
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.
Any suggestion?
…e-quotes Address comment and add testcase
} | ||
|
||
// GetDefaultDecimal returns the default decimal length for column. | ||
func GetDefaultDecimal(tp byte) int { |
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 GetDefaultFieldDecimal?
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.
Decimal is clear enough.
PTAL @siddontang |
@@ -123,7 +123,7 @@ const defaultPrivileges string = "select,insert,update,references" | |||
func (c *Col) GetTypeDesc() string { | |||
var buf bytes.Buffer | |||
|
|||
buf.WriteString(types.FieldTypeToStr(c.Tp, c.Charset)) | |||
buf.WriteString(types.TypeToStr(c.Tp, c.Charset)) | |||
switch c.Tp { |
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.
use CompactStr instead
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.
PTAL
* task, restore: send DDLs parallelly * restore: use moded id to index sessionpool * store: return nil DB when no TiDB session provided * *: use isolated DB instead of Session * *: fix some mis-pushed files :| * *: rename session pool to DB pool * restore: rename some sessions to dbs * restore: add some todos Co-authored-by: 3pointer <luancheng@pingcap.com>
* optimize progress * update Co-authored-by: 3pointer <luancheng@pingcap.com> Co-authored-by: kennytm <kennytm@gmail.com>
Fix this bug:
create table t1 (c double);
create table t2 (c double);
insert into t1 value (73);
insert into t2 value (930);
select c from t1 union select c from t2;
+----+
| c |
+----+
| 73 |
| 0 |
+----+