summaryrefslogtreecommitdiff
path: root/mysql-test/t/invisible_field.test
diff options
context:
space:
mode:
authorSachin Setiya <sachin.setiya@maridb.com>2018-01-29 12:31:07 +0530
committerSachin Setiya <sachin.setiya@mariadb.com>2018-02-02 14:45:44 +0530
commit16be7469ac7b98b5706623d81829b349fb901b1f (patch)
treef00237e025f22f4d5926ff1ade2e2969a4556381 /mysql-test/t/invisible_field.test
parent2d73b581019112e0e9b32b00dbcc6797889649c1 (diff)
downloadmariadb-git-16be7469ac7b98b5706623d81829b349fb901b1f.tar.gz
MDEV-14849 CREATE + ALTER with user-invisible columns produce ...
Problem:- create or replace table t1 (pk int auto_increment primary key invisible, i int); alter table t1 modify pk int invisible; This last alter makes a invisible column which is not null and does not have default value. Analysis:- This is caused because our error check for NOT_NULL_FLAG and NO_DEFAULT_VALUE_FLAG flag misses this sql_field , but this is not the fault of error check :).Actually this field come via mysql_prepare_alter_table and it does not have NO_DEFAULT_VALUE_FLAG flag turned on. (If it was create table NO_DEFAULT_VALUE_FLAG would have turned on Column_definition::check) and this would have generated error. Solution:- I have moved the error check to kind last of mysql_prepare_create_table because upto this point we have applied NO_DEFAULT_VALUE_FLAG to required column.
Diffstat (limited to 'mysql-test/t/invisible_field.test')
-rw-r--r--mysql-test/t/invisible_field.test7
1 files changed, 6 insertions, 1 deletions
diff --git a/mysql-test/t/invisible_field.test b/mysql-test/t/invisible_field.test
index a68e05cf320..b243125e8e1 100644
--- a/mysql-test/t/invisible_field.test
+++ b/mysql-test/t/invisible_field.test
@@ -11,8 +11,13 @@ create table t1(a1 int invisible);
create table t1(a1 blob,invisible(a1));
--error ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT
create table t1(a1 int primary key invisible ,a2 int unique invisible , a3 blob,a4 int not null invisible unique);
---error ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT
+--error ER_TABLE_MUST_HAVE_COLUMNS
create table t1(abc int not null invisible);
+--echo MDEV-14849 CREATE + ALTER with user-invisible columns produce invalid table definition
+create or replace table t1 (pk int auto_increment primary key invisible, i int);
+--error ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT
+alter table t1 modify pk int invisible;
+drop table t1;
create table t1(a int invisible, b int);
#should automatically add null
insert into t1 values(1);