mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
157c8ccf3b
mysql-test/r/group_concat_max_len_func.result: Properly restore global group_concat_max_len value at end of test mysql-test/t/disabled.def: Re-disable user_limits test; it is still failing randomly (bug 33696) mysql-test/t/group_concat_max_len_func.test: Update test results
131 lines
5.5 KiB
Text
131 lines
5.5 KiB
Text
############## mysql-test\t\group_concat_max_len_func.test ####################
|
|
# #
|
|
# Variable Name: group_concat_max_len #
|
|
# Scope: GLOBAL | SESSION #
|
|
# Access Type: Dynamic #
|
|
# Data Type: numeric #
|
|
# Default Value: 1024 #
|
|
# Minimum value: 4 #
|
|
# #
|
|
# #
|
|
# Creation Date: 2008-03-07 #
|
|
# Author: Salman Rawala #
|
|
# #
|
|
# Description: Test Cases of Dynamic System Variable group_concat_max_len #
|
|
# that checks the functionality of this variable #
|
|
# #
|
|
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
|
|
# server-system-variables.html #
|
|
# #
|
|
###############################################################################
|
|
|
|
SET @save = @@global.group_concat_max_len;
|
|
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
|
|
#########################
|
|
# Creating new table #
|
|
#########################
|
|
|
|
--echo ## Creating new table t1 ##
|
|
CREATE TABLE t1
|
|
(
|
|
id INT NOT NULL auto_increment,
|
|
PRIMARY KEY (id),
|
|
rollno int NOT NULL,
|
|
name VARCHAR(30)
|
|
);
|
|
|
|
--echo '#--------------------FN_DYNVARS_034_01-------------------------#'
|
|
########################################################################
|
|
# Setting initial value of group_concat_max_len, inserting some rows
|
|
# & creating 2 new connections
|
|
########################################################################
|
|
|
|
--echo ## Setting initial value of variable to 4 ##
|
|
SET @@global.group_concat_max_len = 4;
|
|
|
|
--echo ## Inserting some rows in table ##
|
|
INSERT into t1(rollno, name) values(1, 'Record_1');
|
|
INSERT into t1(rollno, name) values(2, 'Record_2');
|
|
INSERT into t1(rollno, name) values(1, 'Record_3');
|
|
INSERT into t1(rollno, name) values(3, 'Record_4');
|
|
INSERT into t1(rollno, name) values(1, 'Record_5');
|
|
INSERT into t1(rollno, name) values(3, 'Record_6');
|
|
INSERT into t1(rollno, name) values(4, 'Record_7');
|
|
INSERT into t1(rollno, name) values(4, 'Record_8');
|
|
|
|
--echo ## Creating two new connections ##
|
|
CONNECT (test_con1,localhost,root,,);
|
|
CONNECT (test_con2,localhost,root,,);
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_034_02-------------------------#'
|
|
###############################################################################
|
|
# Verifying initial behavior of variable by concatinating values greater than 4
|
|
###############################################################################
|
|
|
|
--echo ## Connecting with test_con1 ##
|
|
CONNECTION test_con1;
|
|
|
|
--echo ## Accessing data and using group_concat on column whose value is greater than 4 ##
|
|
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
|
|
|
|
--echo ## Changing session value of variable and verifying its behavior, ##
|
|
--echo ## warning should come here ##
|
|
|
|
SET @@session.group_concat_max_len = 10;
|
|
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_034_03-------------------------#'
|
|
##############################################################################
|
|
# Verifying behavior of variable by increasing session value of variable #
|
|
##############################################################################
|
|
|
|
--echo ## Connecting with new connection test_con2 ##
|
|
connection test_con2;
|
|
|
|
--echo ## Verifying initial value of variable. It should be 4 ##
|
|
SELECT @@session.group_concat_max_len = 4;
|
|
|
|
--echo ## Setting session value of variable to 20 and verifying variable is concating ##
|
|
--echo ## column's value to 20 or not ##
|
|
SET @@session.group_concat_max_len = 20;
|
|
|
|
--echo ## Verifying value of name column, it should not me more than 20 characters ##
|
|
--echo ## Warning should come here ##
|
|
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_034_04-------------------------#'
|
|
###############################################################################
|
|
# Verifying behavior of variable by increasing session value of variable #
|
|
# greater than the maximum concat length of name column #
|
|
###############################################################################
|
|
|
|
--echo ## Setting session value of variable to 26. No warning should appear here ##
|
|
--echo ## because the value after concatination is less than 30 ##
|
|
SET @@session.group_concat_max_len = 26;
|
|
|
|
--echo ## Verifying value of name column, it should not give warning now ##
|
|
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
|
|
|
|
|
|
############################################################
|
|
# Disconnecting all connection & dropping table #
|
|
############################################################
|
|
|
|
--echo ## Dropping table t1 ##
|
|
DROP table t1;
|
|
|
|
--echo ## Disconnecting both the connection ##
|
|
DISCONNECT test_con2;
|
|
DISCONNECT test_con1;
|
|
|
|
connection default;
|
|
|
|
SET @@global.group_concat_max_len = @save;
|
|
|