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

Support the definition of null change to not null using alter table #5035

Closed
zimulala opened this issue Nov 7, 2017 · 3 comments
Closed

Comments

@zimulala
Copy link
Contributor

zimulala commented Nov 7, 2017

Refer to https://dev.mysql.com/doc/refman/5.7/en/alter-table.html.

@winkyao
Copy link
Contributor

winkyao commented Apr 4, 2018

If we have no global lock on the table, it is not a trivial work.

@ciscoxll
Copy link
Contributor

ciscoxll commented Apr 4, 2018

Relate to PR #6217 .

@morgo
Copy link
Contributor

morgo commented Mar 21, 2019

I have verified two test cases, behavior is the same as MySQL:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int not null primary key auto_increment, b INT NULL);
INSERT INTO t1 (b) VALUES (1);
ALTER TABLE t1 CHANGE b b INT NOT NULL;

And an error:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int not null primary key auto_increment, b INT NULL);
INSERT INTO t1 (b) VALUES (NULL);
ALTER TABLE t1 CHANGE b b INT NOT NULL;

# Result:
ERROR 1138 (22004): Invalid use of NULL value

I am going to close this task now.

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

No branches or pull requests

5 participants