mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Add tests for system and completely invisible columns
debug only
This commit is contained in:
committed by
Sachin Setiya
parent
84726906c9
commit
022b163ac8
285
mysql-test/r/invisible_field_debug.result
Normal file
285
mysql-test/r/invisible_field_debug.result
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
set @old_debug= @@debug_dbug;
|
||||||
|
set debug_dbug= "+d,test_pseudo_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
desc t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
desc t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
ERROR 42S22: Unknown column 'invisible' in 'field list'
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug= "+d,test_pseudo_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
desc t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 change invisible b int;
|
||||||
|
ERROR 42S22: Unknown column 'invisible' in 't1'
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 modify invisible char;
|
||||||
|
ERROR 42S22: Unknown column 'invisible' in 't1'
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 drop invisible;
|
||||||
|
ERROR 42000: Can't DROP COLUMN `invisible`; check that it exists
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 add invisible int;
|
||||||
|
ERROR 42S21: Duplicate column name 'invisible'
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 add invisible2 int default 2;
|
||||||
|
select * from t1;
|
||||||
|
a invisible2
|
||||||
|
1 2
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
desc t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 change invisible b int;
|
||||||
|
ERROR 42S22: Unknown column 'invisible' in 't1'
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 modify invisible char;
|
||||||
|
ERROR 42S22: Unknown column 'invisible' in 't1'
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 drop invisible;
|
||||||
|
ERROR 42000: Can't DROP COLUMN `invisible`; check that it exists
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
9 1
|
||||||
|
ALTER table t1 add invisible int;
|
||||||
|
select * from t1;
|
||||||
|
a invisible
|
||||||
|
1 NULL
|
||||||
|
select invisible1, invisible ,a from t1;
|
||||||
|
invisible1 invisible a
|
||||||
|
9 NULL 1
|
||||||
|
ALTER table t1 add hid int default 2;
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
select * from t1;
|
||||||
|
a invisible hid
|
||||||
|
1 NULL 2
|
||||||
|
select invisible ,a from t1;
|
||||||
|
invisible a
|
||||||
|
NULL 1
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
Create table t1( a int default(99) invisible, b int);
|
||||||
|
insert into t1 values(1);
|
||||||
|
insert into t1 values(2);
|
||||||
|
insert into t1 values(3);
|
||||||
|
insert into t1 values(4);
|
||||||
|
select * from t1 order by b;
|
||||||
|
b
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
alter table t1 add index(a);
|
||||||
|
alter table t1 add index(a,b);
|
||||||
|
show index from t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||||
|
t1 1 a 1 a A NULL NULL NULL YES BTREE
|
||||||
|
t1 1 a_2 1 a A NULL NULL NULL YES BTREE
|
||||||
|
t1 1 a_2 2 b A NULL NULL NULL YES BTREE
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug= "+d,test_pseudo_invisible";
|
||||||
|
Create table t1( a int default(99) invisible, b int);
|
||||||
|
Create table t2( a int default(99) invisible, b int, unique(invisible));
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
insert into t1 values(1);
|
||||||
|
insert into t1 values(2);
|
||||||
|
insert into t1 values(3);
|
||||||
|
insert into t1 values(4);
|
||||||
|
select * from t1 order by b;
|
||||||
|
b
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
select invisible, a, b from t1 order by b;
|
||||||
|
invisible a b
|
||||||
|
9 99 1
|
||||||
|
9 99 2
|
||||||
|
9 99 3
|
||||||
|
9 99 4
|
||||||
|
alter table t1 add index(invisible);
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
alter table t1 add index(b,invisible);
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
show index from t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
Create table t1( a int default(99) invisible, b int);
|
||||||
|
Create table t2( a int default(99) invisible, b int, unique(invisible));
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
insert into t1 values(1);
|
||||||
|
insert into t1 values(2);
|
||||||
|
insert into t1 values(3);
|
||||||
|
insert into t1 values(4);
|
||||||
|
select * from t1 order by b;
|
||||||
|
b
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
select invisible, a, b from t1 order by b;
|
||||||
|
invisible a b
|
||||||
|
9 99 1
|
||||||
|
9 99 2
|
||||||
|
9 99 3
|
||||||
|
9 99 4
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
alter table t1 add index(invisible);
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
alter table t1 add index(b,invisible);
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
show index from t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
|
||||||
|
Create table t1( a int default(99) , b int,c int, index(b));
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
Show index from t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||||
|
t1 1 b 1 b A NULL NULL NULL YES BTREE
|
||||||
|
select * from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA ='test' and table_name='t1';
|
||||||
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
|
||||||
|
def test t1 1 test b 1 b A NULL NULL NULL YES BTREE
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT 99,
|
||||||
|
`b` int(11) DEFAULT NULL,
|
||||||
|
`c` int(11) DEFAULT NULL,
|
||||||
|
KEY `b` (`b`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
insert into t1 values(1,1,1);
|
||||||
|
insert into t1 values(2,2,2);
|
||||||
|
insert into t1 values(3,3,3);
|
||||||
|
insert into t1 values(4,4,4);
|
||||||
|
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
|
||||||
|
select invisible, a ,b from t1 order by b;
|
||||||
|
invisible a b
|
||||||
|
9 1 1
|
||||||
|
9 2 2
|
||||||
|
9 3 3
|
||||||
|
9 4 4
|
||||||
|
explain select * from t1 where invisible =9;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ref invisible invisible 5 const 3
|
||||||
|
alter table t1 add x int default 3;
|
||||||
|
select invisible, a ,b from t1;
|
||||||
|
invisible a b
|
||||||
|
9 1 1
|
||||||
|
9 2 2
|
||||||
|
9 3 3
|
||||||
|
9 4 4
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
Show index from t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||||
|
t1 1 b 1 b A NULL NULL NULL YES BTREE
|
||||||
|
create index a1 on t1(invisible);
|
||||||
|
ERROR 42000: Key column 'invisible' doesn't exist in table
|
||||||
|
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
|
||||||
|
drop index invisible on t1;
|
||||||
|
ERROR 42000: Can't DROP INDEX `invisible`; check that it exists
|
||||||
|
explain select * from t1 where invisible =9;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ref invisible invisible 5 const 3
|
||||||
|
create index invisible on t1(c);
|
||||||
|
explain select * from t1 where invisible =9;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ref invisible_2 invisible_2 5 const 3
|
||||||
|
show indexes in t1;
|
||||||
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||||
|
t1 1 b 1 b A NULL NULL NULL YES BTREE
|
||||||
|
t1 1 invisible 1 c A NULL NULL NULL YES BTREE
|
||||||
|
t1 1 invisible_2 1 invisible A NULL NULL NULL YES BTREE
|
||||||
|
drop table t1;
|
||||||
|
set @old_debug= @@debug_dbug;
|
202
mysql-test/t/invisible_field_debug.test
Normal file
202
mysql-test/t/invisible_field_debug.test
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
--source include/have_debug.inc
|
||||||
|
##TEST for invisible coloumn level 2
|
||||||
|
set @old_debug= @@debug_dbug;
|
||||||
|
set debug_dbug= "+d,test_pseudo_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
|
||||||
|
desc t1;
|
||||||
|
show create table t1;
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
##TEST for invisible coloumn level 3
|
||||||
|
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
|
||||||
|
desc t1;
|
||||||
|
show create table t1;
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
select invisible ,a from t1;
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
##TEST for Alter table for invisibleness level 2
|
||||||
|
|
||||||
|
set debug_dbug= "+d,test_pseudo_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
|
||||||
|
desc t1;
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
## Alter should not be possible
|
||||||
|
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
ALTER table t1 change invisible b int;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
ALTER table t1 modify invisible char;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||||
|
ALTER table t1 drop invisible;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
--error ER_DUP_FIELDNAME
|
||||||
|
ALTER table t1 add invisible int;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
ALTER table t1 add invisible2 int default 2;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
##TEST for Alter table for invisibleness level 3
|
||||||
|
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
create table t1(a int);
|
||||||
|
|
||||||
|
desc t1;
|
||||||
|
insert into t1 values(1);
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
## Alter should not be possible
|
||||||
|
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
ALTER table t1 change invisible b int;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
ALTER table t1 modify invisible char;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||||
|
ALTER table t1 drop invisible;
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
ALTER table t1 add invisible int;
|
||||||
|
select * from t1;
|
||||||
|
select invisible1, invisible ,a from t1;
|
||||||
|
|
||||||
|
#set debug_dbug=@old_debug;
|
||||||
|
ALTER table t1 add hid int default 2;
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
select * from t1;
|
||||||
|
select invisible ,a from t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
|
||||||
|
## Test Index on USER_DEFINED_INVISIBLE
|
||||||
|
|
||||||
|
Create table t1( a int default(99) invisible, b int);
|
||||||
|
insert into t1 values(1);
|
||||||
|
insert into t1 values(2);
|
||||||
|
insert into t1 values(3);
|
||||||
|
insert into t1 values(4);
|
||||||
|
select * from t1 order by b;
|
||||||
|
alter table t1 add index(a);
|
||||||
|
alter table t1 add index(a,b);
|
||||||
|
show index from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
## Test Index on PSEUDO_invisible_INVISIBLE
|
||||||
|
|
||||||
|
set debug_dbug= "+d,test_pseudo_invisible";
|
||||||
|
Create table t1( a int default(99) invisible, b int);
|
||||||
|
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
Create table t2( a int default(99) invisible, b int, unique(invisible));
|
||||||
|
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
insert into t1 values(1);
|
||||||
|
insert into t1 values(2);
|
||||||
|
insert into t1 values(3);
|
||||||
|
insert into t1 values(4);
|
||||||
|
select * from t1 order by b;
|
||||||
|
select invisible, a, b from t1 order by b;
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
alter table t1 add index(invisible);
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
alter table t1 add index(b,invisible);
|
||||||
|
show index from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
## Test Index on COMPLETELY_INVISIBLE
|
||||||
|
|
||||||
|
set debug_dbug= "+d,test_completely_invisible";
|
||||||
|
Create table t1( a int default(99) invisible, b int);
|
||||||
|
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
Create table t2( a int default(99) invisible, b int, unique(invisible));
|
||||||
|
insert into t1 values(1);
|
||||||
|
insert into t1 values(2);
|
||||||
|
insert into t1 values(3);
|
||||||
|
insert into t1 values(4);
|
||||||
|
select * from t1 order by b;
|
||||||
|
select invisible, a, b from t1 order by b;
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
alter table t1 add index(invisible);
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
alter table t1 add index(b,invisible);
|
||||||
|
show index from t1;
|
||||||
|
drop table t1;
|
||||||
|
## Sytem Generated index on invisible column
|
||||||
|
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
|
||||||
|
## index name will be invisible
|
||||||
|
Create table t1( a int default(99) , b int,c int, index(b));
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
Show index from t1;
|
||||||
|
select * from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA ='test' and table_name='t1';
|
||||||
|
show create table t1;
|
||||||
|
insert into t1 values(1,1,1);
|
||||||
|
insert into t1 values(2,2,2);
|
||||||
|
insert into t1 values(3,3,3);
|
||||||
|
insert into t1 values(4,4,4);
|
||||||
|
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
|
||||||
|
select invisible, a ,b from t1 order by b;
|
||||||
|
explain select * from t1 where invisible =9;
|
||||||
|
alter table t1 add x int default 3;
|
||||||
|
select invisible, a ,b from t1;
|
||||||
|
set debug_dbug=@old_debug;
|
||||||
|
Show index from t1;
|
||||||
|
## Sytem Generated Index modification
|
||||||
|
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
create index a1 on t1(invisible);
|
||||||
|
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
|
||||||
|
## index does not exist for user
|
||||||
|
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||||
|
drop index invisible on t1;
|
||||||
|
explain select * from t1 where invisible =9;
|
||||||
|
## index name will be changed
|
||||||
|
create index invisible on t1(c);
|
||||||
|
explain select * from t1 where invisible =9;
|
||||||
|
show indexes in t1;
|
||||||
|
drop table t1;
|
||||||
|
set @old_debug= @@debug_dbug;
|
@ -5528,7 +5528,8 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
|
|||||||
|
|
||||||
if (field_ptr && *field_ptr)
|
if (field_ptr && *field_ptr)
|
||||||
{
|
{
|
||||||
if ((*field_ptr)->field_visibility == COMPLETELY_INVISIBLE)
|
if ((*field_ptr)->field_visibility == COMPLETELY_INVISIBLE &&
|
||||||
|
DBUG_EVALUATE_IF("test_completely_invisible", 0, 1))
|
||||||
DBUG_RETURN((Field*)0);
|
DBUG_RETURN((Field*)0);
|
||||||
|
|
||||||
*cached_field_index_ptr= field_ptr - table->field;
|
*cached_field_index_ptr= field_ptr - table->field;
|
||||||
|
@ -6389,7 +6389,8 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
|
|||||||
}
|
}
|
||||||
for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
|
for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
|
||||||
{
|
{
|
||||||
if ((key_info->flags & HA_INVISIBLE_KEY))
|
if ((key_info->flags & HA_INVISIBLE_KEY) &&
|
||||||
|
DBUG_EVALUATE_IF("test_invisible_index", 0, 1))
|
||||||
continue;
|
continue;
|
||||||
KEY_PART_INFO *key_part= key_info->key_part;
|
KEY_PART_INFO *key_part= key_info->key_part;
|
||||||
LEX_CSTRING *str;
|
LEX_CSTRING *str;
|
||||||
|
@ -3378,6 +3378,23 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
bool tmp_table= create_table_mode == C_ALTER_TABLE;
|
bool tmp_table= create_table_mode == C_ALTER_TABLE;
|
||||||
DBUG_ENTER("mysql_prepare_create_table");
|
DBUG_ENTER("mysql_prepare_create_table");
|
||||||
|
|
||||||
|
DBUG_EXECUTE_IF("test_pseudo_invisible",{
|
||||||
|
mysql_add_invisible_field(thd, &alter_info->create_list,
|
||||||
|
"invisible", &type_handler_long, SYSTEM_INVISIBLE,
|
||||||
|
new (thd->mem_root)Item_int(thd, 9));
|
||||||
|
});
|
||||||
|
DBUG_EXECUTE_IF("test_completely_invisible",{
|
||||||
|
mysql_add_invisible_field(thd, &alter_info->create_list,
|
||||||
|
"invisible", &type_handler_long, COMPLETELY_INVISIBLE,
|
||||||
|
new (thd->mem_root)Item_int(thd, 9));
|
||||||
|
});
|
||||||
|
DBUG_EXECUTE_IF("test_invisible_index",{
|
||||||
|
LEX_CSTRING temp;
|
||||||
|
temp.str= "invisible";
|
||||||
|
temp.length= strlen("invisible");
|
||||||
|
mysql_add_invisible_index(thd, &alter_info->key_list
|
||||||
|
, &temp, Key::MULTIPLE);
|
||||||
|
});
|
||||||
LEX_CSTRING* connect_string = &create_info->connect_string;
|
LEX_CSTRING* connect_string = &create_info->connect_string;
|
||||||
if (connect_string->length != 0 &&
|
if (connect_string->length != 0 &&
|
||||||
connect_string->length > CONNECT_STRING_MAXLEN &&
|
connect_string->length > CONNECT_STRING_MAXLEN &&
|
||||||
@ -3812,7 +3829,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (sql_field->field_visibility > USER_DEFINED_INVISIBLE &&
|
if (sql_field->field_visibility > USER_DEFINED_INVISIBLE &&
|
||||||
!key->invisible)
|
!key->invisible && DBUG_EVALUATE_IF("test_invisible_index", 0, 1))
|
||||||
{
|
{
|
||||||
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
|
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
Reference in New Issue
Block a user