Debian Codegraph @

storage/test_sql_discovery/mysql-test/sql_discovery/simple.test

raw
1 --source inc.inc
2
3 show variables like 'test_sql_discovery%';
4 set sql_quote_show_create=0;
5 let $mysqld_datadir= `select @@datadir`;
6
7 --error ER_CANT_CREATE_TABLE
8 create table t1 (a int) engine=test_sql_discovery;
9
10 --error ER_NO_SUCH_TABLE
11 select * from t1;
12
13 set @@test_sql_discovery_statement='t1:foobar bwa-ha-ha';
14 --error ER_NO_SUCH_TABLE
15 select * from t0;
16 --error ER_SQL_DISCOVER_ERROR
17 select * from t1;
18 show warnings;
19
20 #
21 # test different invalid discovering statements
22 #
23
24 set @@test_sql_discovery_statement='t1:select 1';
25 --error ER_SQL_DISCOVER_ERROR
26 select * from t1;
27 show warnings;
28
29 set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
30 --error ER_SQL_DISCOVER_ERROR
31 select * from t1;
32 --replace_result 1289 1290 "The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working" "The MariaDB server is running with the --skip-partition option so it cannot execute this statement"
33 show warnings;
34
35 set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
36 --error ER_SQL_DISCOVER_ERROR
37 select * from t1;
38 show warnings;
39
40 set @@test_sql_discovery_statement='t1:create table t1 like t2';
41 --error ER_SQL_DISCOVER_ERROR
42 select * from t1;
43 show warnings;
44
45 set @@test_sql_discovery_statement='t1:create table t1 select * from t2';
46 --error ER_SQL_DISCOVER_ERROR
47 select * from t1;
48 show warnings;
49
50 set @@test_sql_discovery_statement='t1:create table t1 (a int) index directory="/tmp"';
51 --error ER_SQL_DISCOVER_ERROR
52 select * from t1;
53 show warnings;
54
55 set @@test_sql_discovery_statement='t1:create table t1 (a int) data directory="/tmp"';
56 --error ER_SQL_DISCOVER_ERROR
57 select * from t1;
58 show warnings;
59
60 set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=myisam';
61 --error ER_SQL_DISCOVER_ERROR
62 select * from t1;
63 show warnings;
64
65 set @@test_sql_discovery_statement='t1:create temporary table t1 (a int)';
66 --error ER_SQL_DISCOVER_ERROR
67 select * from t1;
68 show warnings;
69
70 set @@test_sql_discovery_statement='t1:create table if not exists t1 (a int)';
71 --error ER_SQL_DISCOVER_ERROR
72 select * from t1;
73 show warnings;
74
75 set @@test_sql_discovery_statement='t1:create table t1 (a uint)';
76 --error ER_SQL_DISCOVER_ERROR
77 select * from t1;
78 show warnings;
79
80 #
81 # this should work:
82 #
83 set @@test_sql_discovery_statement='t1:create table t1 (a int)';
84 select * from t1;
85 show create table t1;
86 drop table t1;
87
88 # table name in the create table statement is ignored
89 set @@test_sql_discovery_statement='t1:create table t2 (a int)';
90 select * from t1;
91 --error ER_NO_SUCH_TABLE
92 select * from t2;
93 drop table t1;
94
95 set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=test_sql_discovery';
96 select * from t1;
97 drop table t1;
98
99 # and something more complex
100 set @@test_sql_discovery_statement='t1:
101 create table t1 (
102 a int not null default 5 primary key,
103 b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
104 c tinyblob,
105 d decimal(5,2),
106 e varchar(30) character set ascii,
107 f geometry not null,
108 index (d,b),
109 unique index (c(10)),
110 fulltext (e),
111 spatial (f)
112 ) comment="abc" default character set utf8 max_rows=100 min_rows=10 checksum=1';
113 show status like 'handler_discover';
114 show create table t1;
115 show status like 'handler_discover';
116 --echo ----
117 --list_files $mysqld_datadir/test t*
118 --echo ----
119 show open tables from test;
120 select * from t1;
121 show status like 'handler_discover';
122 flush tables;
123 select * from t1;
124 show status like 'handler_discover';
125 drop table t1;
126
127 set @@test_sql_discovery_write_frm=0;
128 set @@test_sql_discovery_statement='t1:create table t1 (a int)';
129 show status like 'handler_discover';
130 show create table t1;
131 show status like 'handler_discover';
132 --echo ----
133 --list_files $mysqld_datadir/test t*
134 --echo ----
135 show open tables from test;
136 select * from t1;
137 show status like 'handler_discover';
138 flush tables;
139 select * from t1;
140 show status like 'handler_discover';
141 drop table t1;
142 show status like 'handler_discover';
143