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

Shenli/fix hibernate bug #377

Merged
merged 8 commits into from
Oct 14, 2015
Merged

Shenli/fix hibernate bug #377

merged 8 commits into from
Oct 14, 2015

Conversation

shenli
Copy link
Member

@shenli shenli commented Oct 13, 2015

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 |
+----+

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 {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ans := []string{ts}
// SimpleString only consider Tp/CharsetBin/Flen/Deimal.
// This is used for showing column type in infoschema.
func (ft *FieldType) SimpleString() string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SimpleString looks strange.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestion?

}

// GetDefaultDecimal returns the default decimal length for column.
func GetDefaultDecimal(tp byte) int {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about GetDefaultFieldDecimal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decimal is clear enough.

@shenli
Copy link
Member Author

shenli commented Oct 14, 2015

PTAL @siddontang

@shenli shenli changed the title [DNM]Shenli/fix hibernate bug Shenli/fix hibernate bug Oct 14, 2015
@@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use CompactStr instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

shenli added a commit that referenced this pull request Oct 14, 2015
@shenli shenli merged commit 8e76265 into master Oct 14, 2015
@shenli shenli deleted the shenli/fix-hibernate-bug branch October 14, 2015 08:35
YuJuncen added a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
* 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>
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
* optimize progress

* update

Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants