1CREATE TABLE t1 (
2a varchar(32) character set utf8 collate utf8_bin NOT NULL,
3b varchar(32) character set utf8 collate utf8_bin NOT NULL )
4ENGINE=MyISAM DEFAULT CHARSET=utf8;
5INSERT INTO t1 VALUES
6('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '),
7('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'),
8('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'),
9('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'),
10('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'),
11('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK');
12set tmp_table_size=1024;
13SET @saved_dbug = @@SESSION.debug_dbug;
14set session debug_dbug="+d,raise_error";
15SELECT MAX(a) FROM t1 GROUP BY a,b;
16ERROR 23000: Can't write; duplicate key in table '(temporary)'
17set tmp_table_size=default;
18DROP TABLE t1;
19#
20# Bug #50946: fast index creation still seems to copy the table
21#
22CREATE TABLE t1 (a INT(100) NOT NULL);
23INSERT INTO t1 VALUES (1), (0), (2);
24SET SESSION debug_dbug='+d,alter_table_only_index_change';
25ALTER TABLE t1 ADD INDEX a(a);
26SET debug_dbug= @saved_dbug;
27SHOW CREATE TABLE t1;
28Table	Create Table
29t1	CREATE TABLE `t1` (
30  `a` int(100) NOT NULL,
31  KEY `a` (`a`)
32) ENGINE=MyISAM DEFAULT CHARSET=latin1
33SELECT * FROM t1;
34a
350
361
372
38DROP TABLE t1;
39#
40# Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
41#
42CREATE TABLE t1(a BLOB);
43SET SESSION debug_dbug="+d,bug42064_simulate_oom";
44INSERT INTO t1 VALUES("");
45Got one of the listed errors
46SET debug_dbug= @saved_dbug;
47DROP TABLE t1;
48#
49# Bug#41660: Sort-index_merge for non-first join table may require
50# O(#scans) memory
51#
52CREATE TABLE t1 (a INT);
53INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
54CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
55INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
56INSERT INTO t2 VALUES (1, 1, 'data');
57# the example query uses LEFT JOIN only for the sake of being able to
58# demonstrate the issue with a very small dataset. (left outer join
59# disables the use of join buffering, so we get the second table
60# re-scanned for every record in the outer table. if we used inner join,
61# we would need to have thousands of records and/or more columns in both
62# tables so that the join buffer is filled and re-scans are triggered).
63SET @save_optimizer_switch=@@optimizer_switch;
64SET optimizer_switch='outer_join_with_cache=off';
65SET SESSION debug_dbug= '+d,only_one_Unique_may_be_created';
66EXPLAIN
67SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
68id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
69x	x	x	x	x	x	x	x	x
70x	x	x	x	x	x	x	x	x	Using sort_union(a,b); Using where
71SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
72a	a	b	filler
730	1	1	data
741	1	1	data
752	1	1	data
763	1	1	data
774	1	1	data
785	1	1	data
796	1	1	data
807	1	1	data
818	1	1	data
829	1	1	data
83SET debug_dbug= @saved_dbug;
84SET optimizer_switch=@save_optimizer_switch;
85DROP TABLE t1, t2;
86#
87# Bug#11747970 34660: CRASH WHEN FEDERATED TABLE LOSES CONNECTION DURING INSERT ... SELECT
88#
89CREATE TABLE t1(f1 INT, KEY(f1));
90CREATE TABLE t2(f1 INT);
91INSERT INTO t1 VALUES (1),(2);
92INSERT INTO t2 VALUES (1),(2);
93SET SESSION debug_dbug="+d,bug11747970_raise_error";
94INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
95ERROR 70100: Query execution was interrupted
96SET debug_dbug= @saved_dbug;
97DROP TABLE t1,t2;
98#
99# End of 5.1 tests
100#
101#
102# BUG#11747548:DETECT ORPHAN TEMP-POOL FILES, AND HANDLE GRACEFULLY.
103#
104#Set up.
105CREATE TABLE pid_table(pid_no INT);
106CREATE TABLE t1 (a BLOB);
107INSERT INTO t1 VALUES (1), (2);
108#Create MYD and MYI files for intrinsic temp table.
109LOAD DATA LOCAL INFILE 'pid_file' INTO TABLE pid_table;
110#Reports an error since the temp file already exists.
111SELECT a FROM t1 ORDER BY rand(1);
112a
1131
1142
115#With patch, the query executes successfully.
116SELECT a FROM t1 ORDER BY rand(1);
117a
1181
1192
120#cleanup
121DROP TABLE t1, pid_table;
122#
123# MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash
124#
125CREATE FUNCTION f1(a INT) RETURNS INT RETURN a;
126SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
127SELECT f1(1);
128Got one of the listed errors
129DROP FUNCTION f1;
130SET debug_dbug= @saved_dbug;
131