Debian Codegraph @

mysql-test/suite/sys_vars/t/max_join_size_func.test

raw
1 ################# mysql-test\t\max_join_size_func.test ########################
2 # #
3 # Variable Name: max_join_size #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 4294967295 #
8 # Range: 1-4294967295 #
9 # #
10 # #
11 # Creation Date: 2008-03-07 #
12 # Author: Salman Rawala #
13 # #
14 # Description: Test Cases of Dynamic System Variable max_join_size #
15 # that checks the functionality of this variable #
16 # #
17 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
18 # server-system-variables.html #
19 # #
20 ###############################################################################
21
22 --source include/force_myisam_default.inc
23
24 # Skip the test if MyISAM is not available
25 --source include/have_myisam.inc
26
27 --disable_warnings
28 drop table if exists t1;
29 --enable_warnings
30
31 ##############################
32 # Creating two new tables #
33 ##############################
34
35 --echo ## Creating new table t1 ##
36 CREATE TABLE t1
37 (
38 id INT NOT NULL auto_increment,
39 PRIMARY KEY (id),
40 name VARCHAR(30)
41 );
42
43 --echo ## Creating another table t2 ##
44 CREATE TABLE t2
45 (
46 id INT NOT NULL auto_increment,
47 PRIMARY KEY (id),
48 name VARCHAR(30)
49 );
50
51 #########################################
52 # Inserting some data in both tables #
53 #########################################
54
55 --echo ## Inserting records in both the tables ##
56 INSERT INTO t1(name) VALUES('Record_1');
57 INSERT INTO t1(name) VALUES('Record_2');
58 INSERT INTO t1(name) VALUES('Record_3');
59 INSERT INTO t1(name) VALUES('Record_4');
60 INSERT INTO t1(name) VALUES('Record_5');
61
62 INSERT INTO t2(name) VALUES('Record_1_1');
63 INSERT INTO t2(name) VALUES('Record_2_1');
64 INSERT INTO t2(name) VALUES('Record_3_1');
65 INSERT INTO t2(name) VALUES('Record_4_1');
66 INSERT INTO t2(name) VALUES('Record_5_1');
67
68
69 --echo '#--------------------FN_DYNVARS_079_01-------------------------#'
70 #######################################################################
71 # Verifying case where max_join_size is greater than the join size #
72 #######################################################################
73
74
75 --echo ## Setting max_join size value to 10 ##
76 SET @@session.max_join_size=10;
77
78 --echo ## This should work ##
79 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
80
81
82 --echo '#--------------------FN_DYNVARS_079_02-------------------------#'
83 ####################################################################
84 # Verifying case where max_join_size is less than the join size #
85 ####################################################################
86
87 --echo ## Creating new connection test_con1 ##
88 connect (test_con1, localhost, root,,);
89 connection test_con1;
90
91 --echo ## Setting value of max_join_size ##
92 SET @@session.max_join_size=2;
93
94 --echo ## Since total joins are more than max_join_size value so error will occur ##
95 --Error ER_TOO_BIG_SELECT
96 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
97
98
99 --echo '#--------------------FN_DYNVARS_079_03-------------------------#'
100 ##########################################################
101 # Verifying behavior of max_join_size on global scope #
102 ##########################################################
103
104 --echo ## Setting global value of variable ##
105 SET @@global.max_join_size=2;
106
107 --echo ## Creating and switching to new connection test_con2 ##
108 connect (test_con2, localhost, root,,);
109 connection test_con2;
110
111 --echo ## Verifying value of max_join_size ##
112 SELECT @@global.max_join_size;
113
114 --echo ## Since total joins are more than max_join_size value so error will occur ##
115 --Error ER_TOO_BIG_SELECT
116 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
117
118 --echo ## Dropping both the tables ##
119 Drop table t1, t2;
120
121 --echo ## Restoring values ##
122 SET @@global.max_join_size = DEFAULT;
123 SET @@session.max_join_size = DEFAULT;
124
125 --echo ## Dropping connections ##
126 disconnect test_con1;
127 disconnect test_con2;
128