Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f2a81664
Commit
f2a81664
authored
Nov 26, 2008
by
Ingo Struewing
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
d53224da
0a314d28
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
261 additions
and
183 deletions
+261
-183
mysql-test/r/events_scheduling.result
mysql-test/r/events_scheduling.result
+5
-4
mysql-test/r/events_time_zone.result
mysql-test/r/events_time_zone.result
+7
-4
mysql-test/r/group_concat_max_len_func.result
mysql-test/r/group_concat_max_len_func.result
+42
-32
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+0
-23
mysql-test/r/multi_update2.result
mysql-test/r/multi_update2.result
+25
-0
mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
+1
-1
mysql-test/t/events_scheduling.test
mysql-test/t/events_scheduling.test
+22
-11
mysql-test/t/events_time_zone.test
mysql-test/t/events_time_zone.test
+58
-25
mysql-test/t/group_concat_max_len_func.test
mysql-test/t/group_concat_max_len_func.test
+46
-37
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+11
-46
mysql-test/t/multi_update2-master.opt
mysql-test/t/multi_update2-master.opt
+1
-0
mysql-test/t/multi_update2.test
mysql-test/t/multi_update2.test
+43
-0
No files found.
mysql-test/r/events_scheduling.result
View file @
f2a81664
CREATE DATABASE IF NOT EXISTS events_test;
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
USE events_test;
SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
Try ag
ia
n to make sure it's allowed
Try ag
ai
n to make sure it's allowed
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
Variable_name Value
...
@@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
...
@@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR')
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
OK
SELECT IF(SUM(a) >=
5
, 'OK', 'ERROR') FROM table_2;
SELECT IF(SUM(a) >=
4
, 'OK', 'ERROR') FROM table_2;
IF(SUM(a) >=
5
, 'OK', 'ERROR')
IF(SUM(a) >=
4
, 'OK', 'ERROR')
OK
OK
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
IF(SUM(a) >= 1, 'OK', 'ERROR')
IF(SUM(a) >= 1, 'OK', 'ERROR')
...
@@ -94,4 +95,4 @@ DROP TABLE table_2;
...
@@ -94,4 +95,4 @@ DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_3;
DROP TABLE table_4;
DROP TABLE table_4;
DROP DATABASE events_test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler=
OFF
;
SET GLOBAL event_scheduler=
@event_scheduler
;
mysql-test/r/events_time_zone.result
View file @
f2a81664
...
@@ -14,6 +14,7 @@ RETURN FLOOR((i % (step * n) + 0.1) / step);
...
@@ -14,6 +14,7 @@ RETURN FLOOR((i % (step * n) + 0.1) / step);
END//
END//
SET @step3= @step * 3;
SET @step3= @step * 3;
SET @step6= @step * 6;
SET @step6= @step * 6;
SET @unix_time= UNIX_TIMESTAMP() - 1;
SET @unix_time= @unix_time - @unix_time % @step6;
SET @unix_time= @unix_time - @unix_time % @step6;
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
SET @tzid= LAST_INSERT_ID();
SET @tzid= LAST_INSERT_ID();
...
@@ -21,7 +22,7 @@ INSERT INTO mysql.time_zone_transition_type
...
@@ -21,7 +22,7 @@ INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 0, 0, 0, 'b16420_0');
VALUES (@tzid, 0, 0, 0, 'b16420_0');
INSERT INTO mysql.time_zone_transition_type
INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
INSERT INTO mysql.time_zone_name VALUES ('
bug16420
', @tzid);
INSERT INTO mysql.time_zone_name VALUES ('
<TZ_NAME_1>
', @tzid);
CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
CREATE TABLE t2 (count INT);
CREATE TABLE t2 (count INT);
INSERT INTO t2 VALUES (1);
INSERT INTO t2 VALUES (1);
...
@@ -48,7 +49,7 @@ END//
...
@@ -48,7 +49,7 @@ END//
SET TIME_ZONE= '+00:00';
SET TIME_ZONE= '+00:00';
CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
SET TIME_ZONE= '
bug16420
';
SET TIME_ZONE= '
<TZ_NAME_1>
';
CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= ON;
...
@@ -86,6 +87,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
...
@@ -86,6 +87,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
SET TIME_ZONE= '+00:00';
SET TIME_ZONE= '+00:00';
CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
...
@@ -111,8 +113,8 @@ INSERT INTO mysql.time_zone_transition
...
@@ -111,8 +113,8 @@ INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 7 * @step, 2);
VALUES (@tzid, @now + 7 * @step, 2);
INSERT INTO mysql.time_zone_transition
INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 12 * @step, 3);
VALUES (@tzid, @now + 12 * @step, 3);
INSERT INTO mysql.time_zone_name VALUES ('
bug16420_2
', @tzid);
INSERT INTO mysql.time_zone_name VALUES ('
<TZ_NAME_2>
', @tzid);
SET TIME_ZONE= '
bug16420_2
';
SET TIME_ZONE= '
<TZ_NAME_2>
';
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET GLOBAL EVENT_SCHEDULER= OFF;
Below we should see the following:
Below we should see the following:
...
@@ -143,6 +145,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
...
@@ -143,6 +145,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
DROP FUNCTION round_to_step;
DROP FUNCTION round_to_step;
DROP TABLE t_step;
DROP TABLE t_step;
DROP DATABASE mysqltest_db1;
DROP DATABASE mysqltest_db1;
...
...
mysql-test/r/group_concat_max_len_func.result
View file @
f2a81664
SET @save = @@global.group_concat_max_len;
SET @save = @@global.group_concat_max_len;
drop table if exists
t1;
DROP TABLE IF EXISTS
t1;
## Creating new table t1 ##
## Creating new table t1 ##
CREATE TABLE t1
CREATE TABLE t1
(
(
id INT NOT NULL
auto_increment
,
id INT NOT NULL
AUTO_INCREMENT
,
PRIMARY KEY (id),
PRIMARY KEY (id),
rollno
int
NOT NULL,
rollno
INT
NOT NULL,
name VARCHAR(30)
name VARCHAR(30)
);
);
'#--------------------FN_DYNVARS_034_01-------------------------#'
'#--------------------FN_DYNVARS_034_01-------------------------#'
## Setting initial value of variable to 4 ##
## Setting initial value of variable to 4 ##
SET @@global.group_concat_max_len = 4;
SET @@global.group_concat_max_len = 4;
## Inserting some rows in table ##
## Inserting some rows in table ##
INSERT into t1(rollno, name) values(1, 'Record_1');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
INSERT into t1(rollno, name) values(2, 'Record_2');
INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
INSERT into t1(rollno, name) values(1, 'Record_3');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
INSERT into t1(rollno, name) values(3, 'Record_4');
INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
INSERT into t1(rollno, name) values(1, 'Record_5');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
INSERT into t1(rollno, name) values(3, 'Record_6');
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_7');
INSERT into t1(rollno, name) values(4, 'Record_8');
INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
## Creating two new connections ##
SELECT * FROM t1 ORDER BY id;
id rollno name
1 1 Record_1
2 2 Record_2
3 1 Record_3
4 3 Record_4
5 1 Record_5
6 3 Record_6
7 4 Record_7
8 4 Record_8
## Creating two new connections ##
'#--------------------FN_DYNVARS_034_02-------------------------#'
'#--------------------FN_DYNVARS_034_02-------------------------#'
## Connecting with test_con1 ##
## Connecting with test_con1 ##
## Accessing data and using group_concat on column whose value is greater than 4 ##
## 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;
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
id rollno
GROUP_CONCAT
(name)
1 1 Reco
1 1 Reco
2 2 Reco
2 2 Reco
4 3 Reco
4 3 Reco
...
@@ -33,10 +43,10 @@ id rollno group_concat(name)
...
@@ -33,10 +43,10 @@ id rollno group_concat(name)
Warnings:
Warnings:
Warning 1260 4 line(s) were cut by GROUP_CONCAT()
Warning 1260 4 line(s) were cut by GROUP_CONCAT()
## Changing session value of variable and verifying its behavior, ##
## Changing session value of variable and verifying its behavior, ##
## warning should come here ##
## warning should come here ##
SET @@session.group_concat_max_len = 10;
SET @@session.group_concat_max_len = 10;
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
id rollno
GROUP_CONCAT
(name)
1 1 Record_1,R
1 1 Record_1,R
2 2 Record_2
2 2 Record_2
4 3 Record_4,R
4 3 Record_4,R
...
@@ -44,18 +54,18 @@ id rollno group_concat(name)
...
@@ -44,18 +54,18 @@ id rollno group_concat(name)
Warnings:
Warnings:
Warning 1260 3 line(s) were cut by GROUP_CONCAT()
Warning 1260 3 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_03-------------------------#'
'#--------------------FN_DYNVARS_034_03-------------------------#'
## Connecting with new connection test_con2 ##
## Connecting with new connection test_con2 ##
## Verifying initial value of variable. It should be 4 ##
## Verifying initial value of variable. It should be 4 ##
SELECT @@session.group_concat_max_len = 4;
SELECT @@session.group_concat_max_len = 4;
@@session.group_concat_max_len = 4
@@session.group_concat_max_len = 4
1
1
## Setting session value of variable to 20 and verifying variable is concating ##
## Setting session value of variable to 20 and verifying variable is concating ##
## column's value to 20 or not ##
## column's value to 20 or not ##
SET @@session.group_concat_max_len = 20;
SET @@session.group_concat_max_len = 20;
## Verifying value of name column, it should not me more than 20 characters ##
## Verifying value of name column, it should not me more than 20 characters ##
## Warning should come here ##
## Warning should come here ##
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
id rollno
GROUP_CONCAT
(name)
1 1 Record_1,Record_3,Re
1 1 Record_1,Record_3,Re
2 2 Record_2
2 2 Record_2
4 3 Record_4,Record_6
4 3 Record_4,Record_6
...
@@ -63,17 +73,17 @@ id rollno group_concat(name)
...
@@ -63,17 +73,17 @@ id rollno group_concat(name)
Warnings:
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_04-------------------------#'
'#--------------------FN_DYNVARS_034_04-------------------------#'
## Setting session value of variable to 26. No warning should appear here ##
## Setting session value of variable to 26. No warning should appear here ##
## because the value after concatination is less than 30 ##
## because the value after concatination is less than 30 ##
SET @@session.group_concat_max_len = 26;
SET @@session.group_concat_max_len = 26;
## Verifying value of name column, it should not give warning now ##
## Verifying value of name column, it should not give warning now ##
SELECT id, rollno,
group_concat
(name) FROM t1 GROUP BY rollno;
SELECT id, rollno,
GROUP_CONCAT
(name) FROM t1 GROUP BY rollno;
id rollno
group_concat
(name)
id rollno
GROUP_CONCAT
(name)
1 1 Record_1,Record_3,Record_5
1 1 Record_1,Record_3,Record_5
2 2 Record_2
2 2 Record_2
4 3 Record_4,Record_6
4 3 Record_4,Record_6
7 4 Record_7,Record_8
7 4 Record_7,Record_8
## Dropping table t1 ##
## Dropping table t1 ##
DROP
table
t1;
DROP
TABLE
t1;
## Disconnecting both the connection ##
## Disconnecting both the connection ##
SET @@global.group_concat_max_len = @save;
SET @@global.group_concat_max_len = @save;
mysql-test/r/multi_update.result
View file @
f2a81664
...
@@ -378,29 +378,6 @@ where 0=1;
...
@@ -378,29 +378,6 @@ where 0=1;
delete t1, t2 from t2,t1
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
drop table t1,t2;
create table t1 ( a int not null, b int not null) ;
alter table t1 add index i1(a);
delete from t1 where a > 2000000;
create table t2 like t1;
insert into t2 select * from t1;
select 't2 rows before small delete', count(*) from t1;
t2 rows before small delete count(*)
t2 rows before small delete 2000000
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
select 't2 rows after small delete', count(*) from t2;
t2 rows after small delete count(*)
t2 rows after small delete 1999999
select 't1 rows after small delete', count(*) from t1;
t1 rows after small delete count(*)
t1 rows after small delete 1999999
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
select 't2 rows after big delete', count(*) from t2;
t2 rows after big delete count(*)
t2 rows after big delete 1900001
select 't1 rows after big delete', count(*) from t1;
t1 rows after big delete count(*)
t1 rows after big delete 1900001
drop table t1,t2;
CREATE TABLE t1 ( a int );
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
DELETE t1 FROM t1, t2 AS t3;
...
...
mysql-test/r/multi_update2.result
0 → 100644
View file @
f2a81664
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
# The protocolling of many inserts into t1 is suppressed.
ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 SELECT * FROM t1;
SELECT 't2 rows before small delete', COUNT(*) FROM t1;
t2 rows before small delete COUNT(*)
t2 rows before small delete 2000000
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
SELECT 't2 rows after small delete', COUNT(*) FROM t2;
t2 rows after small delete COUNT(*)
t2 rows after small delete 1999999
SELECT 't1 rows after small delete', COUNT(*) FROM t1;
t1 rows after small delete COUNT(*)
t1 rows after small delete 1999999
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
SELECT 't2 rows after big delete', COUNT(*) FROM t2;
t2 rows after big delete COUNT(*)
t2 rows after big delete 1900001
SELECT 't1 rows after big delete', COUNT(*) FROM t1;
t1 rows after big delete COUNT(*)
t1 rows after big delete 1900001
DROP TABLE t1,t2;
mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
View file @
f2a81664
...
@@ -185,7 +185,7 @@ let $message= use db with trigger privilege on db level and without...:;
...
@@ -185,7 +185,7 @@ let $message= use db with trigger privilege on db level and without...:;
select
f1
from
t1
order
by
f1
;
select
f1
from
t1
order
by
f1
;
--
disable_warnings
--
disable_warnings
disconnect
no_privs
;
disconnect
no_privs
;
--
enable
warnings
--
enable
_
warnings
connection
yes_privs
;
connection
yes_privs
;
select
current_user
;
select
current_user
;
...
...
mysql-test/t/events_scheduling.test
View file @
f2a81664
# Can't test with embedded server that doesn't support
gra
nts
# Can't test with embedded server that doesn't support
eve
nts
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
CREATE
DATABASE
IF
NOT
EXISTS
events_test
;
CREATE
DATABASE
IF
NOT
EXISTS
events_test
;
USE
events_test
;
USE
events_test
;
SET
@
event_scheduler
=@@
global
.
event_scheduler
;
SET
GLOBAL
event_scheduler
=
OFF
;
SET
GLOBAL
event_scheduler
=
OFF
;
--
echo
Try
ag
ia
n
to
make
sure
it
's allowed
--
echo
Try
ag
ai
n
to
make
sure
it
's allowed
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE '
event_scheduler
';
SHOW VARIABLES LIKE '
event_scheduler
';
SET GLOBAL event_scheduler=1;
SET GLOBAL event_scheduler=1;
...
@@ -57,34 +58,44 @@ ON COMPLETION PRESERVE
...
@@ -57,34 +58,44 @@ ON COMPLETION PRESERVE
DO
DO
INSERT
INTO
table_4
VALUES
(
1
);
INSERT
INTO
table_4
VALUES
(
1
);
# Wait for the events to fire and check the data afterwards
# Let event_1 insert at least 4 records into the table
# Let event_1 insert at least 4 records into the table
let
$wait_condition
=
select
count
(
*
)
>=
4
from
table_1
;
let
$wait_condition
=
select
count
(
*
)
>=
4
from
table_1
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Minimum of passed time is 6 seconds assuming
# - event executions starts immediate after creation
# - 4 times event_1 means an insert at ect, ect+2, ect+4, ect+6
# ect = event creation time
# Let event_2 reach the end of its execution interval
# Let event_2 reach the end of its execution interval
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_2'
and
status
=
'enabled'
;
where
event_name
=
'event_2'
and
status
=
'enabled'
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Minimum of passed time is 6 seconds.
# See wait_condition for event_1 above and ENDS condition for event_2.
# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_3'
;
where
event_name
=
'event_3'
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Let event_4 reach the end of its execution interval
# Let event_4 reach the end of its execution interval
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_4'
and
status
=
'enabled'
;
where
event_name
=
'event_4'
and
status
=
'enabled'
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Wait for the events to fire and check the data afterwards
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_1
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_1
;
source
include
/
wait_condition
.
inc
;
source
include
/
wait_condition
.
inc
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_1
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_1
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
5
FROM
table_2
;
# In case of a testing box under heavy load it cannot be guaranteed that
# it is really often enough checked if event_2 has to be executed.
# -> Bug#39854 events_scheduling fails sporadically on pushbuild
# Therefore we lowered here the original expectation of 5 to 4.
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_2
;
source
include
/
wait_condition
.
inc
;
source
include
/
wait_condition
.
inc
;
SELECT
IF
(
SUM
(
a
)
>=
5
,
'OK'
,
'ERROR'
)
FROM
table_2
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_2
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
1
FROM
table_3
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
1
FROM
table_3
;
source
include
/
wait_condition
.
inc
;
source
include
/
wait_condition
.
inc
;
...
@@ -112,9 +123,9 @@ DROP TABLE table_2;
...
@@ -112,9 +123,9 @@ DROP TABLE table_2;
DROP
TABLE
table_3
;
DROP
TABLE
table_3
;
DROP
TABLE
table_4
;
DROP
TABLE
table_4
;
DROP
DATABASE
events_test
;
DROP
DATABASE
events_test
;
SET
GLOBAL
event_scheduler
=
OFF
;
SET
GLOBAL
event_scheduler
=
@
event_scheduler
;
#
#
# End of tests
# End of tests
#
#
...
...
mysql-test/t/events_time_zone.test
View file @
f2a81664
# This test case is sensitive to execution timing. You may control
#
1.
This test case is sensitive to execution timing. You may control
# this sensitivity by the parameter below. Small values will result
#
this sensitivity by the parameter below. Small values will result
# in fast but more unstable execution, large values will improve
#
in fast but more unstable execution, large values will improve
# stability at the cost of speed. Basically, N is a number of seconds
#
stability at the cost of speed. Basically, N is a number of seconds
# to wait for operation to complete. Should be positive. Test runs
#
to wait for operation to complete. Should be positive. Test runs
# about 25*N seconds (it sleeps most of the time, so CPU speed is not
#
about 25*N seconds (it sleeps most of the time, so CPU speed is not
# relevant).
#
relevant).
let
$N
=
5
;
let
$N
=
5
;
#
# 2. Some subtests
# - create a new time zone
# - run some statements
# - delete the new time zone.
# But the time zone name used gets somewhere cached and it cannot be
# "reused" later in the same or another session for a new time zone.
# Experiments (2008-11 MySQL 5.1) showed that none of the available
# RESET/FLUSH commands removes these entries.
# 2008-11 MySQL 5.1 Bug#39979 main.events_time_zone does not clean up
# second bad effect
# Therefore we compute unique and unusual timezone names to minimize
# the likelihood that a later test uses the same name.
#
# 3. The subtests mentioned in 2. cause that the AUTO_INCREMENT value
# within "SHOW CREATE TABLE mysql.timezone" differ from the initial one.
# (Bug#39979 main.events_time_zone does not clean up)
# Therefore we reset this value after each of these subtests.
#
# Note(mleich):
# There is a significant likelihood that future improvements of the server
# cause that the solutions for the issues mentioned in 2. and 3. will no
# more work.
# A mysql-test-run.pl feature which allows to enforce
# 1. Server shutdown (-> Problem mentioned in 2. disappears)
# 2. Reset all data to initial state (-> Problem mentioned in 3. disappears)
# 3. Server start
# after a tests would be a perfect replacement.
#
--
source
include
/
big_test
.
inc
--
source
include
/
big_test
.
inc
...
@@ -73,19 +102,15 @@ delimiter ;//
...
@@ -73,19 +102,15 @@ delimiter ;//
SET
@
step3
=
@
step
*
3
;
SET
@
step3
=
@
step
*
3
;
SET
@
step6
=
@
step
*
6
;
SET
@
step6
=
@
step
*
6
;
# Disable query log to hide current time.
--
disable_query_log
SET
@
unix_time
=
UNIX_TIMESTAMP
()
-
1
;
SET
@
unix_time
=
UNIX_TIMESTAMP
()
-
1
;
--
enable_query_log
SET
@
unix_time
=
@
unix_time
-
@
unix_time
%
@
step6
;
SET
@
unix_time
=
@
unix_time
-
@
unix_time
%
@
step6
;
INSERT
INTO
mysql
.
time_zone
VALUES
(
NULL
,
'N'
);
INSERT
INTO
mysql
.
time_zone
VALUES
(
NULL
,
'N'
);
SET
@
tzid
=
LAST_INSERT_ID
();
SET
@
tzid
=
LAST_INSERT_ID
();
INSERT
INTO
mysql
.
time_zone_transition_type
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
0
,
0
,
0
,
'b16420_0'
);
VALUES
(
@
tzid
,
0
,
0
,
0
,
'b16420_0'
);
INSERT
INTO
mysql
.
time_zone_transition_type
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
1
,
@
step3
-
@
step
,
1
,
'b16420_1'
);
VALUES
(
@
tzid
,
1
,
@
step3
-
@
step
,
1
,
'b16420_1'
);
let
$transition_unix_time
=
`SELECT @unix_time`
;
let
$transition_unix_time
=
`SELECT @unix_time`
;
let
$count
=
30
;
let
$count
=
30
;
...
@@ -99,7 +124,9 @@ while ($count)
...
@@ -99,7 +124,9 @@ while ($count)
dec
$count
;
dec
$count
;
}
}
--
enable_query_log
--
enable_query_log
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'bug16420'
,
@
tzid
);
let
$tz_name
=
`SELECT CONCAT('b16420_a',UNIX_TIMESTAMP())`
;
--
replace_result
$tz_name
<
TZ_NAME_1
>
eval
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'$tz_name'
,
@
tzid
);
CREATE
TABLE
t1
(
count
INT
,
unix_time
INT
,
local_time
INT
,
comment
CHAR
(
80
));
CREATE
TABLE
t1
(
count
INT
,
unix_time
INT
,
local_time
INT
,
comment
CHAR
(
80
));
CREATE
TABLE
t2
(
count
INT
);
CREATE
TABLE
t2
(
count
INT
);
...
@@ -135,7 +162,8 @@ SET TIME_ZONE= '+00:00';
...
@@ -135,7 +162,8 @@ SET TIME_ZONE= '+00:00';
CREATE
EVENT
e1
ON
SCHEDULE
EVERY
@
step
SECOND
CREATE
EVENT
e1
ON
SCHEDULE
EVERY
@
step
SECOND
STARTS
FROM_UNIXTIME
(
@
unix_time
)
DO
SELECT
f1
(
"<e1>"
);
STARTS
FROM_UNIXTIME
(
@
unix_time
)
DO
SELECT
f1
(
"<e1>"
);
SET
TIME_ZONE
=
'bug16420'
;
--
replace_result
$tz_name
<
TZ_NAME_1
>
eval
SET
TIME_ZONE
=
'$tz_name'
;
CREATE
EVENT
e2
ON
SCHEDULE
EVERY
@
step
SECOND
CREATE
EVENT
e2
ON
SCHEDULE
EVERY
@
step
SECOND
STARTS
FROM_UNIXTIME
(
@
unix_time
)
DO
SELECT
f1
(
"<e2>"
);
STARTS
FROM_UNIXTIME
(
@
unix_time
)
DO
SELECT
f1
(
"<e2>"
);
...
@@ -196,6 +224,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
...
@@ -196,6 +224,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE
FROM
mysql
.
time_zone_transition_type
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition_type
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone
WHERE
time_zone_id
=
@
tzid
;
let
$time_zone_auto_inc
=
`SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`
;
eval
ALTER
TABLE
mysql
.
time_zone
AUTO_INCREMENT
=
$time_zone_auto_inc
;
#----------------------------------------------------------------------
#----------------------------------------------------------------------
...
@@ -216,13 +246,13 @@ SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
...
@@ -216,13 +246,13 @@ SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
SET
@
offset_month_04
=
UNIX_TIMESTAMP
(
'2030-04-30 12:00:00'
)
-
@
now
-
13
*@
step
;
SET
@
offset_month_04
=
UNIX_TIMESTAMP
(
'2030-04-30 12:00:00'
)
-
@
now
-
13
*@
step
;
INSERT
INTO
mysql
.
time_zone_transition_type
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
0
,
@
offset_month_01
,
0
,
'b16420_0'
);
VALUES
(
@
tzid
,
0
,
@
offset_month_01
,
0
,
'b16420_0'
);
INSERT
INTO
mysql
.
time_zone_transition_type
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
1
,
@
offset_month_02
,
1
,
'b16420_1'
);
VALUES
(
@
tzid
,
1
,
@
offset_month_02
,
1
,
'b16420_1'
);
INSERT
INTO
mysql
.
time_zone_transition_type
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
2
,
@
offset_month_03
,
1
,
'b16420_2'
);
VALUES
(
@
tzid
,
2
,
@
offset_month_03
,
1
,
'b16420_2'
);
INSERT
INTO
mysql
.
time_zone_transition_type
INSERT
INTO
mysql
.
time_zone_transition_type
VALUES
(
@
tzid
,
3
,
@
offset_month_04
,
1
,
'b16420_3'
);
VALUES
(
@
tzid
,
3
,
@
offset_month_04
,
1
,
'b16420_3'
);
INSERT
INTO
mysql
.
time_zone_transition
INSERT
INTO
mysql
.
time_zone_transition
VALUES
(
@
tzid
,
@
now
,
0
);
VALUES
(
@
tzid
,
@
now
,
0
);
INSERT
INTO
mysql
.
time_zone_transition
INSERT
INTO
mysql
.
time_zone_transition
...
@@ -231,11 +261,12 @@ INSERT INTO mysql.time_zone_transition
...
@@ -231,11 +261,12 @@ INSERT INTO mysql.time_zone_transition
VALUES
(
@
tzid
,
@
now
+
7
*
@
step
,
2
);
VALUES
(
@
tzid
,
@
now
+
7
*
@
step
,
2
);
INSERT
INTO
mysql
.
time_zone_transition
INSERT
INTO
mysql
.
time_zone_transition
VALUES
(
@
tzid
,
@
now
+
12
*
@
step
,
3
);
VALUES
(
@
tzid
,
@
now
+
12
*
@
step
,
3
);
# We have to user a new time zone name, because 'bug16420' has been
let
$tz_name
=
`SELECT CONCAT('b16420_b',UNIX_TIMESTAMP())`
;
# cached already.
--
replace_result
$tz_name
<
TZ_NAME_2
>
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'bug16420_2
'
,
@
tzid
);
eval
INSERT
INTO
mysql
.
time_zone_name
VALUES
(
'$tz_name
'
,
@
tzid
);
SET
TIME_ZONE
=
'bug16420_2'
;
--
replace_result
$tz_name
<
TZ_NAME_2
>
eval
SET
TIME_ZONE
=
'$tz_name'
;
SET
GLOBAL
EVENT_SCHEDULER
=
ON
;
SET
GLOBAL
EVENT_SCHEDULER
=
ON
;
...
@@ -280,6 +311,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
...
@@ -280,6 +311,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE
FROM
mysql
.
time_zone_transition_type
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition_type
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone_transition
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone
WHERE
time_zone_id
=
@
tzid
;
DELETE
FROM
mysql
.
time_zone
WHERE
time_zone_id
=
@
tzid
;
let
$time_zone_auto_inc
=
`SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`
;
eval
ALTER
TABLE
mysql
.
time_zone
AUTO_INCREMENT
=
$time_zone_auto_inc
;
DROP
FUNCTION
round_to_step
;
DROP
FUNCTION
round_to_step
;
DROP
TABLE
t_step
;
DROP
TABLE
t_step
;
...
@@ -291,8 +324,8 @@ eval USE $old_db;
...
@@ -291,8 +324,8 @@ eval USE $old_db;
--
enable_query_log
--
enable_query_log
let
$wait_condition
=
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
processlist
SELECT
COUNT
(
*
)
=
0
FROM
information_schema
.
processlist
where
db
=
'mysqltest_db1'
and
command
=
'Connect'
and
user
=
current_user
();
WHERE
db
=
'mysqltest_db1'
AND
command
=
'Connect'
AND
user
=
current_user
();
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
--
echo
End
of
5.1
tests
.
--
echo
End
of
5.1
tests
.
mysql-test/t/group_concat_max_len_func.test
View file @
f2a81664
...
@@ -11,18 +11,23 @@
...
@@ -11,18 +11,23 @@
# Creation Date: 2008-03-07 #
# Creation Date: 2008-03-07 #
# Author: Salman Rawala #
# Author: Salman Rawala #
# #
# #
# Last modification: #
# 2008-11-14 mleich Fix Bug#40644 main.group_concat_max_len_func random #
# failures #
# + minor improvements #
# #
# Description: Test Cases of Dynamic System Variable group_concat_max_len #
# Description: Test Cases of Dynamic System Variable group_concat_max_len #
# that checks the functionality of this variable #
# that checks the functionality of this variable #
# #
# #
# Reference:
http://dev.mysql.com/doc/refman/5.1/en/
#
# Reference:
#
#
server-system-variables.html
#
#
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
#
# #
# #
###############################################################################
###############################################################################
SET
@
save
=
@@
global
.
group_concat_max_len
;
SET
@
save
=
@@
global
.
group_concat_max_len
;
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
#########################
#########################
...
@@ -32,34 +37,38 @@ drop table if exists t1;
...
@@ -32,34 +37,38 @@ drop table if exists t1;
--
echo
## Creating new table t1 ##
--
echo
## Creating new table t1 ##
CREATE
TABLE
t1
CREATE
TABLE
t1
(
(
id
INT
NOT
NULL
auto_increment
,
id
INT
NOT
NULL
AUTO_INCREMENT
,
PRIMARY
KEY
(
id
),
PRIMARY
KEY
(
id
),
rollno
int
NOT
NULL
,
rollno
INT
NOT
NULL
,
name
VARCHAR
(
30
)
name
VARCHAR
(
30
)
);
);
--
echo
'#--------------------FN_DYNVARS_034_01-------------------------#'
--
echo
'#--------------------FN_DYNVARS_034_01-------------------------#'
########################################################################
########################################################################
# Setting initial value of group_concat_max_len, inserting some rows
# Setting initial value of group_concat_max_len, inserting some rows
# & creating 2 new connections
# & creating 2 new connections
########################################################################
########################################################################
--
echo
## Setting initial value of variable to 4 ##
--
echo
## Setting initial value of variable to 4 ##
SET
@@
global
.
group_concat_max_len
=
4
;
SET
@@
global
.
group_concat_max_len
=
4
;
--
echo
## Inserting some rows in table ##
--
echo
## Inserting some rows in table ##
INSERT
into
t1
(
rollno
,
name
)
values
(
1
,
'Record_1'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
1
,
'Record_1'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
2
,
'Record_2'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
2
,
'Record_2'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
1
,
'Record_3'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
1
,
'Record_3'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
3
,
'Record_4'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
3
,
'Record_4'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
1
,
'Record_5'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
1
,
'Record_5'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
3
,
'Record_6'
);
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_7'
);
INSERT
into
t1
(
rollno
,
name
)
values
(
4
,
'Record_8'
);
INSERT
INTO
t1
(
rollno
,
name
)
VALUES
(
4
,
'Record_8'
);
# The following "auxiliary" select ensures that all records are on disk
--
echo
## Creating two new connections ##
# = result sets got by parallel sessions cannot suffer from effects
CONNECT
(
test_con1
,
localhost
,
root
,,);
# caused by the MyISAM feature "concurrent_inserts".
CONNECT
(
test_con2
,
localhost
,
root
,,);
SELECT
*
FROM
t1
ORDER
BY
id
;
--
echo
## Creating two new connections ##
connect
(
test_con1
,
localhost
,
root
,,);
connect
(
test_con2
,
localhost
,
root
,,);
--
echo
'#--------------------FN_DYNVARS_034_02-------------------------#'
--
echo
'#--------------------FN_DYNVARS_034_02-------------------------#'
...
@@ -68,16 +77,16 @@ CONNECT (test_con2,localhost,root,,);
...
@@ -68,16 +77,16 @@ CONNECT (test_con2,localhost,root,,);
###############################################################################
###############################################################################
--
echo
## Connecting with test_con1 ##
--
echo
## Connecting with test_con1 ##
CONNECTION
test_con1
;
connection
test_con1
;
--
echo
## Accessing data and using group_concat on column whose value is greater than 4 ##
--
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
;
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
## Changing session value of variable and verifying its behavior, ##
--
echo
## Changing session value of variable and verifying its behavior, ##
--
echo
## warning should come here ##
--
echo
## warning should come here ##
SET
@@
session
.
group_concat_max_len
=
10
;
SET
@@
session
.
group_concat_max_len
=
10
;
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
'#--------------------FN_DYNVARS_034_03-------------------------#'
--
echo
'#--------------------FN_DYNVARS_034_03-------------------------#'
...
@@ -85,19 +94,19 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
...
@@ -85,19 +94,19 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
# Verifying behavior of variable by increasing session value of variable #
# Verifying behavior of variable by increasing session value of variable #
##############################################################################
##############################################################################
--
echo
## Connecting with new connection test_con2 ##
--
echo
## Connecting with new connection test_con2 ##
connection
test_con2
;
connection
test_con2
;
--
echo
## Verifying initial value of variable. It should be 4 ##
--
echo
## Verifying initial value of variable. It should be 4 ##
SELECT
@@
session
.
group_concat_max_len
=
4
;
SELECT
@@
session
.
group_concat_max_len
=
4
;
--
echo
## Setting session value of variable to 20 and verifying variable is concating ##
--
echo
## Setting session value of variable to 20 and verifying variable is concating ##
--
echo
## column's value to 20 or not ##
--
echo
## column's value to 20 or not ##
SET
@@
session
.
group_concat_max_len
=
20
;
SET
@@
session
.
group_concat_max_len
=
20
;
--
echo
## Verifying value of name column, it should not me more than 20 characters ##
--
echo
## Verifying value of name column, it should not me more than 20 characters ##
--
echo
## Warning should come here ##
--
echo
## Warning should come here ##
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
--
echo
'#--------------------FN_DYNVARS_034_04-------------------------#'
--
echo
'#--------------------FN_DYNVARS_034_04-------------------------#'
...
@@ -106,12 +115,12 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
...
@@ -106,12 +115,12 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
# greater than the maximum concat length of name column #
# greater than the maximum concat length of name column #
###############################################################################
###############################################################################
--
echo
## Setting session value of variable to 26. No warning should appear here ##
--
echo
## Setting session value of variable to 26. No warning should appear here ##
--
echo
## because the value after concatination is less than 30 ##
--
echo
## because the value after concatination is less than 30 ##
SET
@@
session
.
group_concat_max_len
=
26
;
SET
@@
session
.
group_concat_max_len
=
26
;
--
echo
## Verifying value of name column, it should not give warning now ##
--
echo
## Verifying value of name column, it should not give warning now ##
SELECT
id
,
rollno
,
group_concat
(
name
)
FROM
t1
GROUP
BY
rollno
;
SELECT
id
,
rollno
,
GROUP_CONCAT
(
name
)
FROM
t1
GROUP
BY
rollno
;
############################################################
############################################################
...
@@ -119,11 +128,11 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
...
@@ -119,11 +128,11 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
############################################################
############################################################
--
echo
## Dropping table t1 ##
--
echo
## Dropping table t1 ##
DROP
table
t1
;
DROP
TABLE
t1
;
--
echo
## Disconnecting both the connection ##
--
echo
## Disconnecting both the connection ##
DISCONNECT
test_con2
;
disconnect
test_con2
;
DISCONNECT
test_con1
;
disconnect
test_con1
;
connection
default
;
connection
default
;
...
...
mysql-test/t/multi_update.test
View file @
f2a81664
...
@@ -10,9 +10,9 @@ source include/have_log_bin.inc;
...
@@ -10,9 +10,9 @@ source include/have_log_bin.inc;
drop
table
if
exists
t1
,
t2
,
t3
;
drop
table
if
exists
t1
,
t2
,
t3
;
drop
database
if
exists
mysqltest
;
drop
database
if
exists
mysqltest
;
drop
view
if
exists
v1
;
drop
view
if
exists
v1
;
--
error
0
,
1141
,
1147
--
error
0
,
ER_NONEXISTING_GRANT
,
ER_NONEXISTING_TABLE_GRANT
revoke
all
privileges
on
mysqltest
.
t1
from
mysqltest_1
@
localhost
;
revoke
all
privileges
on
mysqltest
.
t1
from
mysqltest_1
@
localhost
;
--
error
0
,
1141
,
1147
--
error
0
,
ER_NONEXISTING_GRANT
,
ER_NONEXISTING_TABLE_GRANT
revoke
all
privileges
on
mysqltest
.*
from
mysqltest_1
@
localhost
;
revoke
all
privileges
on
mysqltest
.*
from
mysqltest_1
@
localhost
;
delete
from
mysql
.
user
where
user
=
_binary
'mysqltest_1'
;
delete
from
mysql
.
user
where
user
=
_binary
'mysqltest_1'
;
--
enable_warnings
--
enable_warnings
...
@@ -160,9 +160,9 @@ create table t2 (n int(10) not null primary key, d int(10));
...
@@ -160,9 +160,9 @@ create table t2 (n int(10) not null primary key, d int(10));
insert
into
t1
values
(
1
,
1
);
insert
into
t1
values
(
1
,
1
);
insert
into
t2
values
(
1
,
10
),(
2
,
20
);
insert
into
t2
values
(
1
,
10
),(
2
,
20
);
LOCK
TABLES
t1
write
,
t2
read
;
LOCK
TABLES
t1
write
,
t2
read
;
--
error
1099
--
error
ER_TABLE_NOT_LOCKED_FOR_WRITE
DELETE
t1
.*
,
t2
.*
FROM
t1
,
t2
where
t1
.
n
=
t2
.
n
;
DELETE
t1
.*
,
t2
.*
FROM
t1
,
t2
where
t1
.
n
=
t2
.
n
;
--
error
1099
--
error
ER_TABLE_NOT_LOCKED_FOR_WRITE
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
,
t2
.
d
=
30
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
,
t2
.
d
=
30
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
unlock
tables
;
unlock
tables
;
...
@@ -183,7 +183,7 @@ create table t1 (n int(10), d int(10));
...
@@ -183,7 +183,7 @@ create table t1 (n int(10), d int(10));
create
table
t2
(
n
int
(
10
),
d
int
(
10
));
create
table
t2
(
n
int
(
10
),
d
int
(
10
));
insert
into
t1
values
(
1
,
1
);
insert
into
t1
values
(
1
,
1
);
insert
into
t2
values
(
1
,
10
),(
2
,
20
);
insert
into
t2
values
(
1
,
10
),(
2
,
20
);
--
error
1175
--
error
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
set
sql_safe_updates
=
0
;
set
sql_safe_updates
=
0
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
@@ -196,7 +196,7 @@ set timestamp=1038000000;
...
@@ -196,7 +196,7 @@ set timestamp=1038000000;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
t1
.
d
=
t2
.
d
WHERE
t1
.
n
=
t2
.
n
;
select
n
,
d
,
unix_timestamp
(
t
)
from
t1
;
select
n
,
d
,
unix_timestamp
(
t
)
from
t1
;
select
n
,
d
,
unix_timestamp
(
t
)
from
t2
;
select
n
,
d
,
unix_timestamp
(
t
)
from
t2
;
--
error
1064
--
error
ER_PARSE_ERROR
UPDATE
t1
,
t2
SET
1
=
2
WHERE
t1
.
n
=
t2
.
n
;
UPDATE
t1
,
t2
SET
1
=
2
WHERE
t1
.
n
=
t2
.
n
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
set
timestamp
=
0
;
set
timestamp
=
0
;
...
@@ -323,41 +323,6 @@ delete t1, t2 from t2,t1
...
@@ -323,41 +323,6 @@ delete t1, t2 from t2,t1
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Test for bug #1820.
#
create
table
t1
(
a
int
not
null
,
b
int
not
null
)
;
--
disable_query_log
insert
into
t1
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
);
let
$
1
=
19
;
set
@
d
=
4
;
while
(
$
1
)
{
eval
insert
into
t1
select
a
+@
d
,
b
+@
d
from
t1
;
eval
set
@
d
=@
d
*
2
;
dec
$
1
;
}
--
enable_query_log
alter
table
t1
add
index
i1
(
a
);
delete
from
t1
where
a
>
2000000
;
create
table
t2
like
t1
;
insert
into
t2
select
*
from
t1
;
select
't2 rows before small delete'
,
count
(
*
)
from
t1
;
delete
t1
,
t2
from
t1
,
t2
where
t1
.
b
=
t2
.
a
and
t1
.
a
<
2
;
select
't2 rows after small delete'
,
count
(
*
)
from
t2
;
select
't1 rows after small delete'
,
count
(
*
)
from
t1
;
## Try deleting many rows
delete
t1
,
t2
from
t1
,
t2
where
t1
.
b
=
t2
.
a
and
t1
.
a
<
100
*
1000
;
select
't2 rows after big delete'
,
count
(
*
)
from
t2
;
select
't1 rows after big delete'
,
count
(
*
)
from
t1
;
drop
table
t1
,
t2
;
#
#
# Test alias (this is not correct in 4.0)
# Test alias (this is not correct in 4.0)
#
#
...
@@ -367,7 +332,7 @@ CREATE TABLE t2 ( a int );
...
@@ -367,7 +332,7 @@ CREATE TABLE t2 ( a int );
DELETE
t1
FROM
t1
,
t2
AS
t3
;
DELETE
t1
FROM
t1
,
t2
AS
t3
;
DELETE
t4
FROM
t1
,
t1
AS
t4
;
DELETE
t4
FROM
t1
,
t1
AS
t4
;
DELETE
t3
FROM
t1
AS
t3
,
t1
AS
t4
;
DELETE
t3
FROM
t1
AS
t3
,
t1
AS
t4
;
--
error
1109
--
error
ER_UNKNOWN_TABLE
DELETE
t1
FROM
t1
AS
t3
,
t2
AS
t4
;
DELETE
t1
FROM
t1
AS
t3
,
t2
AS
t4
;
INSERT
INTO
t1
values
(
1
),(
2
);
INSERT
INTO
t1
values
(
1
),(
2
);
INSERT
INTO
t2
values
(
1
),(
2
);
INSERT
INTO
t2
values
(
1
),(
2
);
...
@@ -422,7 +387,7 @@ drop database mysqltest;
...
@@ -422,7 +387,7 @@ drop database mysqltest;
create
table
t1
(
a
int
,
primary
key
(
a
));
create
table
t1
(
a
int
,
primary
key
(
a
));
create
table
t2
(
a
int
,
primary
key
(
a
));
create
table
t2
(
a
int
,
primary
key
(
a
));
create
table
t3
(
a
int
,
primary
key
(
a
));
create
table
t3
(
a
int
,
primary
key
(
a
));
--
error
1109
--
error
ER_UNKNOWN_TABLE
delete
t1
,
t3
from
t1
,
t2
where
t1
.
a
=
t2
.
a
and
t2
.
a
=
(
select
t3
.
a
from
t3
where
t1
.
a
=
t3
.
a
);
delete
t1
,
t3
from
t1
,
t2
where
t1
.
a
=
t2
.
a
and
t2
.
a
=
(
select
t3
.
a
from
t3
where
t1
.
a
=
t3
.
a
);
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
...
@@ -431,9 +396,9 @@ drop table t1, t2, t3;
...
@@ -431,9 +396,9 @@ drop table t1, t2, t3;
#
#
create
table
t1
(
col1
int
);
create
table
t1
(
col1
int
);
create
table
t2
(
col1
int
);
create
table
t2
(
col1
int
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
t1
from
t1
,
t2
where
t1
.
col1
<
(
select
max
(
col1
)
from
t1
)
and
t1
.
col1
=
t2
.
col1
;
delete
t1
from
t1
,
t2
where
t1
.
col1
<
(
select
max
(
col1
)
from
t1
)
and
t1
.
col1
=
t2
.
col1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
@@ -458,7 +423,7 @@ drop table t1, t2;
...
@@ -458,7 +423,7 @@ drop table t1, t2;
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
create
table
t2
(
a
int
);
create
table
t2
(
a
int
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
from
t1
,
t2
using
t1
,
t2
where
t1
.
a
=
(
select
a
from
t1
);
delete
from
t1
,
t2
using
t1
,
t2
where
t1
.
a
=
(
select
a
from
t1
);
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
# End of 4.1 tests
# End of 4.1 tests
...
...
mysql-test/t/multi_update2-master.opt
0 → 100644
View file @
f2a81664
--set-variable=tmp_table_size=1024
mysql-test/t/multi_update2.test
0 → 100644
View file @
f2a81664
#
# Test of update statement that uses many tables.
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
#
# Bug#1820 Rows not deleted from second table on multi-table delete
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NOT
NULL
)
;
--
echo
# The protocolling of many inserts into t1 is suppressed.
--
disable_query_log
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
);
let
$
1
=
19
;
set
@
d
=
4
;
while
(
$
1
)
{
eval
INSERT
INTO
t1
SELECT
a
+@
d
,
b
+@
d
FROM
t1
;
eval
SET
@
d
=@
d
*
2
;
dec
$
1
;
}
--
enable_query_log
ALTER
TABLE
t1
ADD
INDEX
i1
(
a
);
DELETE
FROM
t1
WHERE
a
>
2000000
;
CREATE
TABLE
t2
LIKE
t1
;
INSERT
INTO
t2
SELECT
*
FROM
t1
;
SELECT
't2 rows before small delete'
,
COUNT
(
*
)
FROM
t1
;
DELETE
t1
,
t2
FROM
t1
,
t2
WHERE
t1
.
b
=
t2
.
a
AND
t1
.
a
<
2
;
SELECT
't2 rows after small delete'
,
COUNT
(
*
)
FROM
t2
;
SELECT
't1 rows after small delete'
,
COUNT
(
*
)
FROM
t1
;
## Try deleting many rows
DELETE
t1
,
t2
FROM
t1
,
t2
WHERE
t1
.
b
=
t2
.
a
AND
t1
.
a
<
100
*
1000
;
SELECT
't2 rows after big delete'
,
COUNT
(
*
)
FROM
t2
;
SELECT
't1 rows after big delete'
,
COUNT
(
*
)
FROM
t1
;
DROP
TABLE
t1
,
t2
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment