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

ddl: year type should not has unsigned flag #6745

Merged
merged 3 commits into from
Jun 4, 2018
Merged

ddl: year type should not has unsigned flag #6745

merged 3 commits into from
Jun 4, 2018

Conversation

winkyao
Copy link
Contributor

@winkyao winkyao commented Jun 4, 2018

What have you changed? (mandatory)

Remove unsigned flag of mysql.YearType in create table statement.

Before this PR, we got error from:

mysql> create table abc(y year, x int, primary key(y));
Query OK, 0 rows affected (0.12 sec)

mysql> show create table abc;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                             |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| abc   | CREATE TABLE `abc` (
  `y` year UNSIGNED NOT NULL,
  `x` int(11) DEFAULT NULL,
  PRIMARY KEY (`y`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
 
mysql> CREATE TABLE `abc` (
    ->   `y` year UNSIGNED NOT NULL,
    ->   `x` int(11) DEFAULT NULL,
    ->   PRIMARY KEY (`y`)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ERROR 1105 (HY000): line 2 column 20 near " NOT NULL,
  `x` int(11) DEFAULT NULL,
  PRIMARY KEY (`y`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin" (total length 152)

Because show create table output the column y as

`y` year UNSIGNED NOT NULL,

What are the type of the changes (mandatory)?

Bug fix

How has this PR been tested (mandatory)?

unit tests

@shenli
Copy link
Member

shenli commented Jun 4, 2018

We need to add a condition check here. So we could get correct result for the already table with year column.

@winkyao winkyao removed DNM labels Jun 4, 2018
@winkyao
Copy link
Contributor Author

winkyao commented Jun 4, 2018

@shenli Done, PTAL

@shenli
Copy link
Member

shenli commented Jun 4, 2018

LGTM

@shenli
Copy link
Member

shenli commented Jun 4, 2018

/run-all-tests

@winkyao winkyao added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 4, 2018
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@winkyao winkyao added status/LGT2 Indicates that a PR has LGTM 2. all-tests-passed and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 4, 2018
@shenli shenli merged commit 1327ebb into pingcap:master Jun 4, 2018
@winkyao winkyao deleted the fix_year_type branch June 15, 2018 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants