|
|
|
|
Quelle invisible_field_debug.result
Sprache: Lisp
|
|
set @old_debug= @@debug_dbug;
create table t_tmp(a int, b int);
set debug_dbug= "+d,test_pseudo_invisible";
create table t1(a int);
set debug_dbug=@old_debug;
insert into t1 values(1);
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=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
select a , invisible1 from t1;
a invisible1
1 9
insert into t1(a, invisible1) values(99,99);
ERROR 42S22: Unknown column 'invisible1' in 'INSERT INTO'
select default(invisible1) from t1;
ERROR 42S22: Unknown column 'invisible1' in 'SELECT'
insert into t1(invisible1) values(99);
ERROR 42S22: Unknown column 'invisible1' in 'INSERT INTO'
insert into t_tmp select a, invisible1 from t1;
insert into t1 select * from t_tmp;
ERROR 21S01: Column count doesn't match value count at row 1
insert into t1(a,invisible1) select * from t_tmp;
ERROR 42S22: Unknown column 'invisible1' in 'INSERT INTO'
select a , invisible1 from t1;
a invisible1
1 9
insert into t1 values (5), (invisible1+1);
select a , invisible1 from t1;
a invisible1
1 9
5 9
10 9
delete from t1 where a > 1;
update t1 set a = invisible1 where a=1;
select a , invisible1 from t1;
a invisible1
9 9
update t1 set a = (select invisible1+100 from t1 limit 1) where a=(select a from t1 limit 1);
select a , invisible1 from t1;
a invisible1
109 9
update t1 set invisible1 = 23 where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible1' in 'SET'
update t1 set invisible1 = 101 where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible1' in 'SET'
update t1 set invisible1 = (select invisible1+100 from t1 limit 1) where a=(select invisible1 from t1 limit 1);
ERROR 42S22: Unknown column 'invisible1' in 'SET'
select a , invisible1 from t1;
a invisible1
109 9
set @a=12;
update t1 set invisible1 = (select @a from dual) where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible1' in 'SET'
select a , invisible1 from t1;
a invisible1
109 9
update t1 set invisible1 = (select invisible1+100 from t1 limit 1) where a=(select a from t1 limit 1);
ERROR 42S22: Unknown column 'invisible1' in 'SET'
select a , invisible1 from t1;
a invisible1
109 9
set @a=(select invisible1 from t1 limit 1);
select @a from dual;
@a
9
alter table t1 add constraint a check (invisible1 > 2);
ERROR 42S22: Unknown column 'invisible1' in 'CHECK'
set debug_dbug= "+d,test_pseudo_invisible";
create table t2(a int, b int as (invisible1 +2) virtual);
ERROR 42S22: Unknown column 'invisible1' in 'GENERATED ALWAYS AS'
create table t2(a int , b int);
insert into t2 values(2,2);
insert into t2 select a, invisible1 from t1;
set debug_dbug=@old_debug;
select * from t1;
a
109
select invisible1 ,a from t1;
invisible1 a
9 109
drop table t1,t2,t_tmp;
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=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
insert into t1 values(1);
select * from t1;
a
1
select invisible1 ,a from t1;
ERROR 42S22: Unknown column 'invisible1' in 'SELECT'
set debug_dbug= "+d,test_completely_invisible";
select invisible1 ,a from t1;
invisible1 a
9 1
set debug_dbug=@old_debug;
create table t2 (invisible1 int);
select * from t1 join t2 using (invisible1);
ERROR 42S22: Unknown column 'invisible1' in 'FROM'
select * from t2 join t1 using (invisible1);
ERROR 42S22: Unknown column 'invisible1' in 'FROM'
insert t2 values (8),(9);
select * from t1 natural join t2;
a invisible1
1 8
1 9
select * from t2 natural join t1;
invisible1 a
8 1
9 1
drop table t1, t2;
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 invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 change invisible1 b int;
ERROR 42S22: Unknown column 'invisible1' in 't1'
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 modify invisible1 char;
ERROR 42S22: Unknown column 'invisible1' in 't1'
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 drop invisible1;
ERROR 42000: Can't DROP COLUMN `invisible1`; check that it exists
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 add invisible1 int;
ERROR 42S21: Duplicate column name 'invisible1'
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 add invisible2 int default 2;
select * from t1;
a invisible2
1 2
select invisible1 ,a from t1;
invisible1 a
9 1
create trigger trg before insert on t1 for each row set new.invisible1=1;
ERROR 42S22: Unknown column 'invisible1' in 'NEW'
create trigger trg before insert on t1 for each row set @a:=new.invisible1;
drop table t1;
set debug_dbug= "+d,test_completely_invisible";
create table t1(a int);
set debug_dbug=@old_debug;
create trigger trg before insert on t1 for each row set new.invisible1=1;
ERROR 42S22: Unknown column 'invisible1' in 'NEW'
create trigger trg before insert on t1 for each row set @a:=new.invisible1;
ERROR 42S22: Unknown column 'invisible1' in 'NEW'
set debug_dbug= "+d,test_completely_invisible";
desc t1;
Field Type Null Key Default Extra
a int(11) YES NULL
insert into t1 values(1);
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 change invisible1 b int;
ERROR 42S22: Unknown column 'invisible1' in 't1'
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 modify invisible1 char;
ERROR 42S22: Unknown column 'invisible1' in 't1'
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 drop invisible1;
ERROR 42000: Can't DROP COLUMN `invisible1`; check that it exists
select * from t1;
a
1
select invisible1 ,a from t1;
invisible1 a
9 1
ALTER table t1 add invisible1 int;
select * from t1;
a invisible1
1 NULL
select invisible1, invisible1 ,a from t1;
invisible1 invisible1 a
NULL NULL 1
ALTER table t1 add hid int default 2;
select * from t1;
a invisible1 hid
1 NULL 2
select invisible1 ,a from t1;
invisible1 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 Ignored
t1 1 a 1 a A NULL NULL NULL YES BTREE NO
t1 1 a_2 1 a A NULL NULL NULL YES BTREE NO
t1 1 a_2 2 b A NULL NULL NULL YES BTREE NO
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(invisible1));
ERROR 42000: Key column 'invisible1' 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 invisible1, a, b from t1 order by b;
invisible1 a b
9 99 1
9 99 2
9 99 3
9 99 4
alter table t1 add index(invisible1);
ERROR 42000: Key column 'invisible1' doesn't exist in table
alter table t1 add index(b,invisible1);
ERROR 42000: Key column 'invisible1' 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 Ignored
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(invisible1));
ERROR 42000: Key column 'invisible1' 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 invisible1, a, b from t1 order by b;
invisible1 a b
9 99 1
9 99 2
9 99 3
9 99 4
set debug_dbug=@old_debug;
alter table t1 add index(invisible1);
ERROR 42000: Key column 'invisible1' doesn't exist in table
alter table t1 add index(b,invisible1);
ERROR 42000: Key column 'invisible1' 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 Ignored
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 Ignored
t1 1 b 1 b A NULL NULL NULL YES BTREE NO
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 IGNORED CREATE_OPTIONS
def test t1 1 test b 1 b A NULL NULL NULL YES BTREE NO
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=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
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);
insert into t1 values(5,5,5);
insert into t1 values(6,6,6);
insert into t1 values(7,7,7);
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
select invisible1, a ,b from t1 order by b;
invisible1 a b
9 1 1
9 2 2
9 3 3
9 4 4
9 5 5
9 6 6
9 7 7
explain select * from t1 where invisible1 =9;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref invisible1 invisible1 5 const 7
alter table t1 add x int default 3;
select invisible1, a ,b from t1;
invisible1 a b
9 1 1
9 2 2
9 3 3
9 4 4
9 5 5
9 6 6
9 7 7
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 Ignored
t1 1 b 1 b A NULL NULL NULL YES BTREE NO
create index a1 on t1(invisible1);
ERROR 42000: Key column 'invisible1' doesn't exist in table
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
drop index invisible1 on t1;
ERROR 42000: Can't DROP INDEX `invisible1`; check that it exists
explain select * from t1 where invisible1 =9;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref invisible1 invisible1 5 const 7
create index invisible1 on t1(c);
explain select * from t1 where invisible1 =9;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref invisible1_2 invisible1_2 5 const 7
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 Ignored
t1 1 b 1 b A NULL NULL NULL YES BTREE NO
t1 1 invisible1 1 c A NULL NULL NULL YES BTREE NO
t1 1 invisible1_2 1 invisible1 A NULL NULL NULL YES BTREE NO
drop table t1;
set @old_debug= @@debug_dbug;
CREATE TABLE t1 (i INT );
SET debug_dbug="+d,test_completely_invisible,test_invisible_index";
CREATE TABLE t2 LIKE t1;
SET debug_dbug= DEFAULT;
DROP TABLE t1, t2;
#
# MDEV-20210
# If you have an INVISIBLE VIRTUAL column, SHOW CREATE TABLE doesn't list it as INVISIBLE
#
CREATE TABLE t1 (i INT, v int GENERATED ALWAYS AS (1) VIRTUAL INVISIBLE);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL,
`v` int(11) GENERATED ALWAYS AS (1) VIRTUAL INVISIBLE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
¤ Dauer der Verarbeitung: 0.7 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|