Debian Codegraph @

mysql-test/suite/innodb/t/temporary_table.test

raw
1 #
2 # InnoDB temporary table test case, including
3 # WL#6560: InnoDB: separate tablespace for innodb-temp-tables.
4 # WL#7899: InnoDB: Map compressed temporary tables to uncompressed
5 #
6
7 --source include/have_innodb.inc
8 --source include/innodb_page_size.inc
9 # Embedded server does not restart of server
10 --source include/not_embedded.inc
11 --source include/no_valgrind_without_big.inc
12
13 --disable_query_log
14 call mtr.add_suppression("Can't create/write to file '' \\\(Errcode: 20 \"Not a directory\"\\\)");
15 call mtr.add_suppression("Can't create/write to file '/dev/null/.*/ib");
16 call mtr.add_suppression("InnoDB: Unable to create temporary file");
17 call mtr.add_suppression("last file in setting innodb_temp_data_file_path");
18 call mtr.add_suppression("The table 't1' is full");
19 call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
20 call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
21 call mtr.add_suppression("InnoDB: Tablespace doesn't support raw devices");
22 call mtr.add_suppression("InnoDB: Plugin initialization aborted");
23 call mtr.add_suppression("innodb_temporary and innodb_system file names seem to be the same");
24 call mtr.add_suppression("Could not create the shared innodb_temporary");
25 call mtr.add_suppression("InnoDB: syntax error in file path");
26 call mtr.add_suppression("InnoDB: Unable to parse innodb_temp_data_file_path=");
27 --enable_query_log
28
29 let $MYSQL_TMP_DIR = `select @@tmpdir`;
30 let $MYSQL_DATA_DIR = `select @@datadir`;
31
32 --echo # files in MYSQL_DATA_DIR
33 --list_files $MYSQL_DATA_DIR/ ibtmp*
34
35 create temporary table t1 (i int, f float, c char(100)) engine=innodb;
36 insert into t1 values (100, 1.1, 'pune');
37 insert into t1 values (99, 1.2, 'mumbai');
38 insert into t1 values (98, 1.3, 'jaipur');
39 insert into t1 values (97, 1.4, 'delhi');
40 insert into t1 values (96, 1.5, 'ahmedabad');
41 select * from t1;
42 select * from t1 where i = 98;
43 select * from t1 where i < 100;
44
45 explain select * from t1 where f > 1.29999;
46 alter table t1 add index sec_index(f);
47 explain select * from t1 where f > 1.29999;
48 select * from t1 where f > 1.29999;
49
50 explain select * from t1 where i = 100;
51 alter table t1 add unique index pri_index(i);
52 explain select * from t1 where i = 100;
53 select * from t1 where i = 100;
54
55 delete from t1 where i < 97;
56 select * from t1;
57 insert into t1 values (96, 1.5, 'kolkata');
58 select * from t1;
59
60 update t1 set f = 1.44 where c = 'delhi';
61 select * from t1;
62
63 truncate table t1;
64 insert into t1 values (100, 1.1, 'pune');
65 insert into t1 values (99, 1.2, 'mumbai');
66 insert into t1 values (98, 1.3, 'jaipur');
67 insert into t1 values (97, 1.4, 'delhi');
68 insert into t1 values (96, 1.5, 'ahmedabad');
69 select * from t1;
70
71 --error ER_CANNOT_DISCARD_TEMPORARY_TABLE
72 alter table t1 discard tablespace;
73 --error ER_CANNOT_DISCARD_TEMPORARY_TABLE
74 alter table t1 import tablespace;
75 drop temporary table t1;
76
77 create temporary table t1
78 (keyc int, c1 char(100), c2 char(100),
79 primary key(keyc)) engine = innodb;
80 delimiter |;
81 CREATE PROCEDURE populate_t1()
82 BEGIN
83 DECLARE i INT DEFAULT 1;
84 while (i <= 20000) DO
85 insert into t1 values (i, 'a', 'b');
86 SET i = i + 1;
87 END WHILE;
88 END|
89 delimiter ;|
90 set autocommit=0;
91 select count(*) from t1;
92 call populate_t1();
93 select count(*) from t1;
94 select * from t1 limit 10;
95 set autocommit=1;
96 truncate table t1;
97 select * from t1;
98 #
99
100 --echo # test condition of full-temp-tablespace
101 --let $restart_parameters= --innodb_temp_data_file_path=ibtmp1:12M
102 --source include/restart_mysqld.inc
103
104 create temporary table t1
105 (keyc int, c1 char(100), c2 char(100),
106 primary key(keyc)) engine = innodb;
107 begin;
108 --error ER_RECORD_FILE_FULL
109 call populate_t1();
110
111 drop procedure populate_t1;
112
113 --echo # test read-only mode
114 --let $restart_parameters = --innodb-read-only
115 --source include/restart_mysqld.inc
116
117 --echo # files in MYSQL_DATA_DIR
118 --list_files $MYSQL_DATA_DIR/ ibtmp*
119
120 --error ER_NO_SUCH_TABLE
121 select * from t1;
122 show tables;
123 --error ER_CANT_CREATE_TABLE
124 create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
125
126 SET GLOBAL innodb_encrypt_tables=DEFAULT;
127
128 --echo # test various bad start-up parameters
129
130 let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
131 let SEARCH_ABORT = NOT FOUND;
132 let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
133 AND support IN ('YES', 'DEFAULT', 'ENABLED');
134
135 # We cannot use include/restart_mysqld.inc in this particular test,
136 # because SHOW STATUS would fail due to unwritable (nonexistent) tmpdir.
137 --source include/shutdown_mysqld.inc
138 --write_line "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" $_expect_file_name
139 --enable_reconnect
140 --disable_result_log
141 --disable_query_log
142 let $counter= 5000;
143 let $mysql_errno= 9999;
144 while ($mysql_errno)
145 {
146 --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,2026
147 select 1;
148
149 dec $counter;
150 if (!$counter)
151 {
152 --die Server failed to restart
153 }
154 --sleep 0.1
155 }
156 --enable_query_log
157 --enable_result_log
158 --disable_reconnect
159 --let SEARCH_PATTERN= InnoDB: Unable to create temporary file
160 --source include/search_pattern_in_file.inc
161
162 --let $restart_parameters= --innodb_data_file_path=ibdata1:12M:autoextend --innodb_temp_data_file_path=ibdata1:12M:autoextend
163 --source include/restart_mysqld.inc
164 --let SEARCH_PATTERN = innodb_temporary and innodb_system file names seem to be the same
165 --source include/search_pattern_in_file.inc
166 eval $check_no_innodb;
167
168 --let $restart_parameters= --innodb_temp_data_file_path=foobar:3Gnewraw
169 --source include/restart_mysqld.inc
170 --let SEARCH_PATTERN = support raw device
171 --source include/search_pattern_in_file.inc
172 eval $check_no_innodb;
173
174 --let $restart_parameters= --innodb_temp_data_file_path=barbar:3Graw
175 --source include/restart_mysqld.inc
176 --source include/search_pattern_in_file.inc
177 eval $check_no_innodb;
178
179 --let $restart_parameters= --innodb_temp_data_file_path=
180 --source include/restart_mysqld.inc
181 --let SEARCH_PATTERN = InnoDB: syntax error in file path
182 --source include/search_pattern_in_file.inc
183 eval $check_no_innodb;
184
185 --let $restart_parameters=
186 --source include/restart_mysqld.inc
187
188 --error ER_UNSUPPORTED_COMPRESSED_TABLE
189 create temporary table t (
190 i int)
191 engine = innodb row_format = compressed;
192 #
193 --error ER_UNSUPPORTED_COMPRESSED_TABLE
194 create temporary table t (
195 i int)
196 engine = innodb row_format = compressed key_block_size = 8;
197 #
198 create temporary table t (
199 i int)
200 engine = innodb row_format = dynamic;
201 show warnings;
202 drop table t;
203 #
204 create temporary table t (
205 i int)
206 engine = innodb row_format = dynamic;
207 show warnings;
208 drop table t;
209 set innodb_strict_mode = off;
210 #
211 create temporary table t (
212 i int)
213 engine = innodb row_format = compressed key_block_size = 8;
214 show warnings;
215 set innodb_strict_mode = default;
216 #
217 drop table t;
218 --error ER_UNSUPPORTED_COMPRESSED_TABLE
219 create temporary table t (
220 i int)
221 engine = innodb row_format = compressed;
222 --echo #files in MYSQL_TMP_DIR, expecting only default temporary tablespace file
223 --list_files $MYSQL_TMP_DIR/ *.ibd
224 --list_files $MYSQL_DATA_DIR/ ibtmp*
225 #
226 create temporary table t (
227 i int)
228 engine = innodb row_format = dynamic;
229 show warnings;
230 drop table t;
231 #
232 create temporary table t (
233 i int)
234 engine = innodb row_format = dynamic;
235 show warnings;
236 drop table t;
237 set innodb_strict_mode = off;
238 #
239 create temporary table t (
240 i int)
241 engine = innodb row_format = dynamic key_block_size = 4;
242 show warnings;
243 drop table t;
244 #
245 create temporary table t (
246 i int)
247 engine = innodb row_format = compact;
248 show warnings;
249 drop table t;
250 #
251 create temporary table t (
252 i int)
253 engine = innodb key_block_size = 4;
254 show warnings;
255 drop table t;
256 #
257
258 CREATE TEMPORARY TABLE t1 (
259 i INT NOT NULL PRIMARY KEY,
260 c CHAR(10) NOT NULL
261 ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
262 SHOW WARNINGS;
263 SHOW CREATE TABLE t1;
264 DROP TABLE t1;
265 #
266 CREATE TEMPORARY TABLE t1 (
267 i INT NOT NULL PRIMARY KEY,
268 c CHAR(10) NOT NULL
269 ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
270 SHOW WARNINGS;
271 SHOW CREATE TABLE t1;
272 DROP TABLE t1;
273 #
274 CREATE TEMPORARY TABLE t1 (
275 i INT NOT NULL PRIMARY KEY,
276 c CHAR(10) NOT NULL
277 ) ENGINE = InnoDB ROW_FORMAT = COMPACT;
278 SHOW WARNINGS;
279 SHOW CREATE TABLE t1;
280 DROP TABLE t1;
281 #
282
283 CREATE TEMPORARY TABLE t1 (
284 i INT NOT NULL PRIMARY KEY,
285 c CHAR(10) NOT NULL
286 ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
287 SHOW WARNINGS;
288 SHOW CREATE TABLE t1;
289 DROP TABLE t1;
290 #
291 CREATE TEMPORARY TABLE t1 (
292 i INT NOT NULL PRIMARY KEY,
293 c CHAR(10) NOT NULL
294 ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
295 SHOW WARNINGS;
296 SHOW CREATE TABLE t1;
297 DROP TABLE t1;
298 #
299 CREATE TEMPORARY TABLE t1 (
300 i INT NOT NULL PRIMARY KEY,
301 c CHAR(10) NOT NULL
302 ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
303 SHOW WARNINGS;
304 SHOW CREATE TABLE t1;
305 DROP TABLE t1;
306 #
307 CREATE TEMPORARY TABLE t1 (
308 i INT NOT NULL PRIMARY KEY,
309 c CHAR(10) NOT NULL
310 ) ENGINE = InnoDB ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 8;
311 SHOW WARNINGS;
312 SHOW CREATE TABLE t1;
313 DROP TABLE t1;
314 #
315 CREATE TEMPORARY TABLE t1 (
316 i INT NOT NULL PRIMARY KEY,
317 c CHAR(10) NOT NULL
318 ) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
319 SHOW WARNINGS;
320 SHOW CREATE TABLE t1;
321 DROP TABLE t1;
322 #
323
324 # Test alter table for temporary tables with row format = compressed or
325 # key_block_size
326 CREATE TEMPORARY TABLE t1 (
327 i INT NOT NULL PRIMARY KEY
328 ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
329
330 ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
331 SHOW WARNINGS;
332 SHOW CREATE TABLE t1;
333 ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
334 SHOW WARNINGS;
335 SHOW CREATE TABLE t1;
336 ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED;
337 SHOW WARNINGS;
338 SHOW CREATE TABLE t1;
339
340 ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
341 SHOW WARNINGS;
342 SHOW CREATE TABLE t1;
343 ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
344 SHOW WARNINGS;
345 SHOW CREATE TABLE t1;
346 DROP TABLE t1;
347
348 # Set innodb_strict_mode=ON and test compressed temporary tables again.
349 set innodb_strict_mode = ON;
350
351 --error ER_UNSUPPORTED_COMPRESSED_TABLE
352 CREATE TEMPORARY TABLE t1 (
353 i INT NOT NULL PRIMARY KEY,
354 c CHAR(10) NOT NULL
355 ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
356 SHOW WARNINGS;
357 #
358
359 --error ER_UNSUPPORTED_COMPRESSED_TABLE
360 CREATE TEMPORARY TABLE t1 (
361 i INT NOT NULL PRIMARY KEY,
362 c CHAR(10) NOT NULL
363 ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT;
364 SHOW WARNINGS;
365 #
366
367 CREATE TEMPORARY TABLE t1 (
368 i INT NOT NULL PRIMARY KEY,
369 c CHAR(10) NOT NULL
370 ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
371 SHOW WARNINGS;
372 SHOW CREATE TABLE t1;
373 DROP TABLE t1;
374 #
375
376 --error ER_UNSUPPORTED_COMPRESSED_TABLE
377 CREATE TEMPORARY TABLE t1 (
378 i INT NOT NULL PRIMARY KEY,
379 c CHAR(10) NOT NULL
380 ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
381 SHOW WARNINGS;
382 #
383
384 --error ER_UNSUPPORTED_COMPRESSED_TABLE
385 CREATE TEMPORARY TABLE t1 (
386 i INT NOT NULL PRIMARY KEY,
387 c CHAR(10) NOT NULL
388 ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
389 SHOW WARNINGS;
390 #
391
392 --error ER_UNSUPPORTED_COMPRESSED_TABLE
393 CREATE TEMPORARY TABLE t1 (
394 i INT NOT NULL PRIMARY KEY,
395 c CHAR(10) NOT NULL
396 ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
397 SHOW WARNINGS;
398 #
399
400 --error ER_UNSUPPORTED_COMPRESSED_TABLE
401 CREATE TEMPORARY TABLE t1 (
402 i INT NOT NULL PRIMARY KEY,
403 c CHAR(10) NOT NULL
404 ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7;
405 SHOW WARNINGS;
406 #
407
408 CREATE TEMPORARY TABLE t1 (
409 i INT NOT NULL PRIMARY KEY,
410 c CHAR(10) NOT NULL
411 ) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
412 SHOW WARNINGS;
413 SHOW CREATE TABLE t1;
414 DROP TABLE t1;
415 #
416
417 CREATE TEMPORARY TABLE t1 (
418 i INT NOT NULL PRIMARY KEY
419 ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
420
421 --error ER_UNSUPPORTED_COMPRESSED_TABLE
422 ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
423 SHOW WARNINGS;
424
425 --error ER_UNSUPPORTED_COMPRESSED_TABLE
426 ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
427 SHOW WARNINGS;
428
429 --error ER_UNSUPPORTED_COMPRESSED_TABLE
430 ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
431 SHOW WARNINGS;
432
433 ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
434
435 #
436 # Some checking for turning innodb_strict_mode ON and OFF.
437 set innodb_strict_mode = OFF;
438
439 ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
440 SHOW WARNINGS;
441
442 set innodb_strict_mode = ON;
443
444 ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
445 SHOW CREATE TABLE t1;
446
447 set innodb_strict_mode = OFF;
448
449 ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
450 SHOW WARNINGS;
451
452 ALTER TABLE t1 KEY_BLOCK_SIZE = 8;
453 SHOW WARNINGS;
454
455 set innodb_strict_mode = ON;
456
457 --error ER_UNSUPPORTED_COMPRESSED_TABLE
458 ALTER TABLE t1 ADD COLUMN j INT;
459 SHOW WARNINGS;
460 SHOW CREATE TABLE t1;
461
462 set innodb_strict_mode = OFF;
463
464 ALTER TABLE t1 KEY_BLOCK_SIZE = 0;
465 SHOW CREATE TABLE t1;
466
467 ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
468
469 set innodb_strict_mode = ON;
470 ALTER TABLE t1 ADD COLUMN j INT;
471 SHOW CREATE TABLE t1;
472 DROP TABLE t1;
473
474 CREATE TEMPORARY TABLE t1(f1 INT, KEY(f1)) ENGINE=InnoDB;
475 INSERT INTO t1 VALUES(NULL);
476 UPDATE t1 SET f1 = 0;
477 START TRANSACTION;
478 UPDATE t1 SET f1 = 4;
479 UPDATE t1 SET f1 = 0;
480 ROLLBACK;
481 SELECT * FROM t1;
482 DROP TABLE t1;
483
484 delimiter //;
485 create procedure t1_proc()
486 begin
487 DECLARE var INT UNSIGNED;
488 CREATE TEMPORARY TABLE t1(f1 INT UNSIGNED, f2 INT UNSIGNED, KEY( f1, f2 ) )engine=innodb;
489 SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
490 START TRANSACTION;
491 INSERT INTO t1 SET f1 = 1, f2 = 1;
492 UPDATE t1 SET f2 = 2;
493 SET var = ( SELECT 1 FROM t1 );
494 DROP TABLE t1;
495 END//
496 delimiter ;//
497
498 call t1_proc;
499 drop procedure t1_proc;
500
501 --echo #
502 --echo # MDEV-15874 CREATE TABLE creates extra transaction
503 --echo #
504 call mtr.add_suppression("Warning 150 Create table `mysqld.1`.`t1` with foreign key constraint failed. Temporary tables can't have foreign key constraints.*");
505 SET FOREIGN_KEY_CHECKS = 0;
506 --error ER_CANT_CREATE_TABLE
507 CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
508 FOREIGN KEY(f1) REFERENCES t0(f1))ENGINE=InnoDB;
509
510 CREATE TABLE t (c INT) ENGINE=InnoDB;
511 INSERT INTO t VALUES(0);
512 CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB;
513 START TRANSACTION READ ONLY;
514 INSERT INTO t2 SELECT * FROM t;
515 COMMIT;
516 DROP TABLE t, t2;
517
518 CREATE TEMPORARY TABLE t (c INT,c2 INT) ENGINE=InnoDB;
519 START TRANSACTION READ ONLY;
520 --error ER_WRONG_VALUE_COUNT_ON_ROW
521 INSERT INTO t VALUES(0);
522 SAVEPOINT s;
523 INSERT INTO t VALUES(0,0);
524 COMMIT;
525 DROP TABLE t;
526
527 CREATE TEMPORARY TABLE t (c INT,c2 INT) ENGINE=InnoDB;
528 START TRANSACTION READ ONLY;
529 --error ER_WRONG_VALUE_COUNT_ON_ROW
530 INSERT INTO t VALUES(0);
531 SAVEPOINT s;
532 INSERT INTO t VALUES(0,0);
533 ROLLBACK;
534 DROP TABLE t;
535
536 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
537 INSERT INTO t1 VALUES (1);
538 START TRANSACTION READ ONLY;
539 UPDATE t1 SET a= 2;
540 COMMIT;
541 DROP TABLE t1;
542
543 CREATE TEMPORARY TABLE t(c INT) ENGINE=InnoDB;
544 SET SESSION TRANSACTION_READ_ONLY=TRUE;
545 LOCK TABLE test.t READ;
546 SELECT * FROM t;
547 INSERT INTO t VALUES(0xADC3);
548 SET SESSION TRANSACTION_READ_ONLY=FALSE;
549 DROP TABLE t;
550
551 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
552 INSERT INTO t1 VALUES (1);
553 START TRANSACTION READ ONLY;
554 UPDATE t1 SET a= 2;
555 COMMIT;
556 DROP TABLE t1;
557
558 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY, b int) ENGINE=InnoDB;
559 INSERT INTO t1 VALUES (1, 1);
560 START TRANSACTION READ ONLY;
561 UPDATE t1 SET b= 2;
562 COMMIT;
563 DROP TABLE t1;
564
565 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY, b int, c varchar(255)) ENGINE=InnoDB;
566 INSERT INTO t1 VALUES (1, 1, repeat('a', 200));
567 START TRANSACTION READ ONLY;
568 UPDATE t1 SET b= 2, c=repeat('a', 250);
569 COMMIT;
570 DROP TABLE t1;
571
572 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
573 INSERT INTO t1 VALUES (1);
574 START TRANSACTION READ ONLY;
575 UPDATE t1 SET a= 2;
576 ROLLBACK;
577 DROP TABLE t1;
578
579 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
580 INSERT INTO t1 VALUES (1);
581 START TRANSACTION READ ONLY;
582 DELETE FROM t1 WHERE a= 2;
583 COMMIT;
584 DROP TABLE t1;
585
586 CREATE TEMPORARY TABLE tmp (a INT) ENGINE=InnoDB;
587 INSERT INTO tmp () VALUES (),();
588 SET TRANSACTION_READ_ONLY= 1;
589 INSERT INTO tmp SELECT * FROM tmp;
590 SET TRANSACTION_READ_ONLY= 0;
591 DROP TABLE tmp;
592
593 SET sql_mode='';
594 SET GLOBAL TRANSACTION_READ_ONLY=TRUE;
595 CREATE TEMPORARY TABLE t (c INT);
596 SET SESSION TRANSACTION_READ_ONLY=DEFAULT;
597 INSERT INTO t VALUES(1);
598 INSERT INTO t SELECT * FROM t;
599 SET SESSION TRANSACTION_READ_ONLY=FALSE;
600 SET GLOBAL TRANSACTION_READ_ONLY=OFF;
601 DROP TABLE t;
602
603 CREATE TEMPORARY TABLE t(a INT);
604 SET SESSION TRANSACTION_READ_ONLY=ON;
605 LOCK TABLE t READ;
606 SELECT COUNT(*)FROM t;
607 INSERT INTO t VALUES (0);
608 SET SESSION TRANSACTION_READ_ONLY=OFF;
609 DROP TABLE t;
610
611 CREATE TEMPORARY TABLE t (a INT) ENGINE=InnoDB;
612 INSERT INTO t VALUES (1);
613 START TRANSACTION READ ONLY;
614 UPDATE t SET a = NULL;
615 ROLLBACK;
616 DROP TABLE t;
617
618 --echo #
619 --echo # MDEV-29886 Assertion !index->table->is_temporary() failed
620 --echo # in trx_undo_prev_version_build upon CHECK
621 --echo #
622 CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1;
623 UPDATE t SET a=2;
624 CHECK TABLE t;
625 CHECK TABLE t EXTENDED;
626 DROP TEMPORARY TABLE t;
627
628 --echo #
629 --echo # MDEV-29978 Corruption errors upon CHECK on temporary InnoDB table
630 --echo #
631
632 CREATE TEMPORARY TABLE t (f INT UNIQUE) ENGINE=InnoDB;
633 INSERT INTO t (f) VALUES (1),(2);
634 CHECK TABLE t;
635 CHECK TABLE t EXTENDED;
636 DROP TEMPORARY TABLE t;
637
638 --echo #
639 --echo # MDEV-34118 fsp_alloc_free_extent() fails to flag DB_OUT_OF_FILE_SPACE
640 --echo #
641 SET @save_increment = @@GLOBAL.innodb_autoextend_increment;
642 SET GLOBAL innodb_autoextend_increment=1;
643 CREATE TEMPORARY TABLE t (c LONGTEXT) ENGINE=INNODB;
644 if ($MTR_COMBINATION_4K)
645 {
646 --error ER_RECORD_FILE_FULL
647 INSERT INTO t VALUES (REPEAT ('1',16777216));
648 }
649 if (!$MTR_COMBINATION_4K)
650 {
651 INSERT INTO t VALUES (REPEAT ('1',16777216));
652 --echo ERROR HY000: The table 't' is full
653 }
654 DROP TEMPORARY TABLE t;
655 SET GLOBAL innodb_autoextend_increment=@save_increment;
656
657 --echo # End of 10.6 tests