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
23 --disable_warnings
24 drop table if exists t1;
25 --enable_warnings
26
27 ##############################
28 # Creating two new tables #
29 ##############################
30
31 --echo ## Creating new table t1 ##
32 CREATE TABLE t1
33 (
34 id INT NOT NULL auto_increment,
35 PRIMARY KEY (id),
36 name VARCHAR(30)
37 );
38
39 --echo ## Creating another table t2 ##
40 CREATE TABLE t2
41 (
42 id INT NOT NULL auto_increment,
43 PRIMARY KEY (id),
44 name VARCHAR(30)
45 );
46
47 #########################################
48 # Inserting some data in both tables #
49 #########################################
50
51 --echo ## Inserting records in both the tables ##
52 INSERT INTO t1(name) VALUES('Record_1');
53 INSERT INTO t1(name) VALUES('Record_2');
54 INSERT INTO t1(name) VALUES('Record_3');
55 INSERT INTO t1(name) VALUES('Record_4');
56 INSERT INTO t1(name) VALUES('Record_5');
57
58 INSERT INTO t2(name) VALUES('Record_1_1');
59 INSERT INTO t2(name) VALUES('Record_2_1');
60 INSERT INTO t2(name) VALUES('Record_3_1');
61 INSERT INTO t2(name) VALUES('Record_4_1');
62 INSERT INTO t2(name) VALUES('Record_5_1');
63
64
65 --echo '#--------------------FN_DYNVARS_079_01-------------------------#'
66 #######################################################################
67 # Verifying case where max_join_size is greater than the join size #
68 #######################################################################
69
70
71 --echo ## Setting max_join size value to 10 ##
72 SET @@session.max_join_size=10;
73
74 --echo ## This should work ##
75 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
76
77
78 --echo '#--------------------FN_DYNVARS_079_02-------------------------#'
79 ####################################################################
80 # Verifying case where max_join_size is less than the join size #
81 ####################################################################
82
83 connect (test_con1, localhost, root,,);
84 connection test_con1;
85
86 --echo ## Setting value of max_join_size ##
87 SET @@session.max_join_size=4;
88
89 --echo ## Since total joins are more than max_join_size value so error will occur ##
90 --Error ER_TOO_BIG_SELECT
91 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
92
93
94 --echo '#--------------------FN_DYNVARS_079_03-------------------------#'
95 ##########################################################
96 # Verifying behavior of max_join_size on global scope #
97 ##########################################################
98
99 --echo ## Setting global value of variable ##
100 SET @@global.max_join_size=4;
101
102 connect (test_con2, localhost, root,,);
103 connection test_con2;
104
105 --echo ## Verifying value of max_join_size ##
106 SELECT @@global.max_join_size;
107
108 --echo ## Since total joins are more than max_join_size value so error will occur ##
109 --Error ER_TOO_BIG_SELECT
110 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
111
112 --echo ## Dropping both the tables ##
113 Drop table t1, t2;
114
115 --echo ## Restoring values ##
116 SET @@global.max_join_size = DEFAULT;
117 SET @@session.max_join_size = DEFAULT;
118
119 disconnect test_con1;
120 disconnect test_con2;