Commit 349a595b authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: tests

* combine two test files with seemingly the same name
* comments
parent c1cef1af
set @save_default_storage_engine=@@global.default_storage_engine;
set global default_storage_engine=myisam;
set session default_storage_engine=myisam;
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
create table t1 (a int not null primary key auto_increment, message char(20));
create table t2 (a int not null primary key auto_increment, message char(20));
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
......@@ -2266,7 +2264,6 @@ DROP TABLE t1;
# Bug45781 infinite hang/crash in "opening tables" after handler tries to
# open merge table
#
DROP TABLE IF EXISTS m1,t1;
CREATE TABLE t1(a int)engine=myisam;
CREATE TABLE t2(a int)engine=myisam;
CREATE TABLE t3(a int)engine=myisam;
......@@ -2376,7 +2373,6 @@ DROP TABLE t2, t1;
#
# Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
#
DROP TABLE IF EXISTS m1, t1;
CREATE TABLE t1 (c1 INT) ENGINE=MYISAM;
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST;
LOCK TABLE m1 READ;
......@@ -2565,7 +2561,6 @@ DROP TABLE t1;
#
# Test merge table with too many merge children.
#
drop table if exists t_parent;
set @save_table_open_cache=@@global.table_open_cache;
#
# Set @@global.table_open_cache to minimum
......@@ -2595,7 +2590,6 @@ deallocate prepare stmt;
#
drop table t_parent;
set @@global.table_open_cache=@save_table_open_cache;
DROP DATABASE IF EXISTS mysql_test1;
CREATE DATABASE mysql_test1;
CREATE TABLE t1 ... DATA DIRECTORY=... INDEX DIRECTORY=...
CREATE TABLE mysql_test1.t2 ... DATA DIRECTORY=... INDEX DIRECTORY=...
......@@ -2881,7 +2875,6 @@ DROP TABLE t1;
# More tests with TEMPORARY MERGE table and permanent children.
# First without locked tables.
#
DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2;
#
CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
......@@ -3582,7 +3575,6 @@ DROP TABLE t1, t2, t3, t4, m1, m2;
# Test that merge tables are closed correctly when opened using
# HANDLER ... OPEN.
# The general case.
DROP TABLE IF EXISTS t1, t2, t3;
connect con1,localhost,root,,;
CREATE TABLE t1 (c1 int);
CREATE TABLE t2 (c1 int);
......@@ -3635,7 +3627,6 @@ drop table t4, t3, t2, t1;
#
# Bug#51240 ALTER TABLE of a locked MERGE table fails
#
DROP TABLE IF EXISTS m1, t1;
CREATE TABLE t1 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
LOCK TABLE m1 WRITE;
......@@ -3657,7 +3648,6 @@ DROP TABLE m1, t1;
#
# Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter"
#
drop tables if exists t1, m1, m2;
create table t1 (i int) engine=myisam;
create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first;
create table m2 like m1;
......@@ -3677,7 +3667,6 @@ drop tables m1, m2, t1;
# Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()"
# Check that unique_table() works correctly for merge tables.
#
drop table if exists t1, t2, t3, m1, m2;
create table t1 (a int);
create table t2 (a int);
create table t3 (b int);
......@@ -3723,7 +3712,6 @@ drop table t1, t2, t3, m1, m2;
# Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for
# REPAIR of merge table
#
DROP TABLE IF EXISTS t1, t2, t_not_exists;
CREATE TABLE t1(a INT);
ALTER TABLE t1 engine= MERGE UNION (t_not_exists);
ANALYZE TABLE t1;
......@@ -3767,7 +3755,6 @@ DROP TABLE t1, t2;
# Bug#57002 Assert in upgrade_shared_lock_to_exclusive()
# for ALTER TABLE + MERGE tables
#
DROP TABLE IF EXISTS t1, m1;
CREATE TABLE t1(a INT) engine=myisam;
CREATE TABLE m1(a INT) engine=merge UNION(t1);
LOCK TABLES t1 READ, m1 WRITE;
......@@ -3779,7 +3766,6 @@ DROP TABLE m1, t1;
# Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
# PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
#
drop tables if exists t1, t2, t3, t4, m1;
create table t1(id int) engine=myisam;
create view t3 as select 1 as id;
create table t4(id int) engine=memory;
......@@ -3809,8 +3795,7 @@ test.m1 repair error Corrupt
drop tables m1, t1, t4;
drop view t3;
#
# MDEV-10424 - Assertion `ticket == __null' failed in
# MDL_request::set_type
# MDEV-10424 Assertion `ticket == __null' failed in MDL_request::set_type
#
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1);
......@@ -3829,7 +3814,9 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
DEALLOCATE PREPARE stmt;
DROP TABLE t1, tmerge;
End of 5.5 tests
#
# End of 5.5 tests
#
#
# Additional coverage for refactoring which is made as part
# of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
......@@ -3837,8 +3824,7 @@ End of 5.5 tests
#
# Check that prelocking works correctly for various variants of
# merge tables.
drop table if exists t1, t2, m1;
drop function if exists f1;
#
create table t1 (j int);
insert into t1 values (1);
create function f1() returns int return (select count(*) from m1);
......@@ -3904,11 +3890,6 @@ checksum table m1;
Table Checksum
test.m1 3459908756
drop tables t1, m1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS m1;
DROP TRIGGER IF EXISTS trg1;
DROP TABLE IF EXISTS q1;
DROP TABLE IF EXISTS q2;
CREATE TABLE t1(a INT);
CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2);
CREATE TRIGGER trg1 BEFORE DELETE ON t1
......@@ -3919,3 +3900,7 @@ ERROR HY000: Unable to open underlying table which is differently defined or of
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE m1;
set global default_storage_engine=@save_default_storage_engine;
#
# End of 10.0 tests
#
......@@ -13,12 +13,6 @@ set session default_storage_engine=myisam;
# This test assumes a stable character set
--source include/default_charset.inc
# Clean up resources used in this test case.
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
drop database if exists mysqltest;
--enable_warnings
let $MYSQLD_DATADIR= `select @@datadir`;
create table t1 (a int not null primary key auto_increment, message char(20));
create table t2 (a int not null primary key auto_increment, message char(20));
......@@ -1652,10 +1646,6 @@ DROP TABLE t1;
--echo # open merge table
--echo #
--disable_warnings
DROP TABLE IF EXISTS m1,t1;
--enable_warnings
CREATE TABLE t1(a int)engine=myisam;
CREATE TABLE t2(a int)engine=myisam;
CREATE TABLE t3(a int)engine=myisam;
......@@ -1756,9 +1746,6 @@ DROP TABLE t2, t1;
--echo #
--echo # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
--echo #
--disable_warnings
DROP TABLE IF EXISTS m1, t1;
--enable_warnings
#
# Test derived from a proposal of Shane Bester.
#
......@@ -1893,9 +1880,6 @@ DROP TABLE t1;
--echo #
--echo # Test merge table with too many merge children.
--echo #
--disable_warnings
drop table if exists t_parent;
--enable_warnings
set @save_table_open_cache=@@global.table_open_cache;
--echo #
--echo # Set @@global.table_open_cache to minimum
......@@ -1910,9 +1894,6 @@ let $1 = `select @@table_open_cache;`;
--disable_query_log
while ($1)
{
--disable_warnings
eval drop table if exists t$1;
--enable_warnings
eval create table t$1 (a int) engine=myisam;
eval set @a=ifnull(concat(@a, ", ", "t$1"), "t$1");
dec $1;
......@@ -1956,9 +1937,6 @@ set @@global.table_open_cache=@save_table_open_cache;
#
# Test DATA/INDEX DIRECTORY
#
--disable_warnings
DROP DATABASE IF EXISTS mysql_test1;
--enable_warnings
CREATE DATABASE mysql_test1;
--disable_query_log
# data/index directory don't work in HAVE_purify builds. Disable
......@@ -2269,9 +2247,6 @@ DROP TABLE t1;
--echo # More tests with TEMPORARY MERGE table and permanent children.
--echo # First without locked tables.
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2;
--enable_warnings
#
--echo #
CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
......@@ -2590,9 +2565,6 @@ DROP TABLE t1, t2, t3, t4, m1, m2;
--echo # Test that merge tables are closed correctly when opened using
--echo # HANDLER ... OPEN.
--echo # The general case.
--disable_warnings
DROP TABLE IF EXISTS t1, t2, t3;
--enable_warnings
connect (con1,localhost,root,,);
CREATE TABLE t1 (c1 int);
CREATE TABLE t2 (c1 int);
......@@ -2648,10 +2620,6 @@ drop table t4, t3, t2, t1;
--echo # Bug#51240 ALTER TABLE of a locked MERGE table fails
--echo #
--disable_warnings
DROP TABLE IF EXISTS m1, t1;
--enable_warnings
CREATE TABLE t1 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
LOCK TABLE m1 WRITE;
......@@ -2677,9 +2645,6 @@ DROP TABLE m1, t1;
--echo #
--echo # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter"
--echo #
--disable_warnings
drop tables if exists t1, m1, m2;
--enable_warnings
create table t1 (i int) engine=myisam;
create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first;
create table m2 like m1;
......@@ -2692,9 +2657,6 @@ drop tables m1, m2, t1;
--echo # Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()"
--echo # Check that unique_table() works correctly for merge tables.
--echo #
--disable_warnings
drop table if exists t1, t2, t3, m1, m2;
--enable_warnings
create table t1 (a int);
create table t2 (a int);
create table t3 (b int);
......@@ -2749,10 +2711,6 @@ drop table t1, t2, t3, m1, m2;
--echo # REPAIR of merge table
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2, t_not_exists;
--enable_warnings
CREATE TABLE t1(a INT);
ALTER TABLE t1 engine= MERGE UNION (t_not_exists);
# This caused the segfault
......@@ -2779,10 +2737,6 @@ DROP TABLE t1, t2;
--echo # for ALTER TABLE + MERGE tables
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, m1;
--enable_warnings
CREATE TABLE t1(a INT) engine=myisam;
CREATE TABLE m1(a INT) engine=merge UNION(t1);
LOCK TABLES t1 READ, m1 WRITE;
......@@ -2799,9 +2753,6 @@ DROP TABLE m1, t1;
--echo # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
--echo # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
--echo #
--disable_warnings
drop tables if exists t1, t2, t3, t4, m1;
--enable_warnings
create table t1(id int) engine=myisam;
create view t3 as select 1 as id;
create table t4(id int) engine=memory;
......@@ -2821,8 +2772,7 @@ drop view t3;
--echo #
--echo # MDEV-10424 - Assertion `ticket == __null' failed in
--echo # MDL_request::set_type
--echo # MDEV-10424 Assertion `ticket == __null' failed in MDL_request::set_type
--echo #
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1);
......@@ -2832,9 +2782,9 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1, tmerge;
--echo End of 5.5 tests
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # Additional coverage for refactoring which is made as part
......@@ -2843,10 +2793,7 @@ DROP TABLE t1, tmerge;
--echo #
--echo # Check that prelocking works correctly for various variants of
--echo # merge tables.
--disable_warnings
drop table if exists t1, t2, m1;
drop function if exists f1;
--enable_warnings
--echo #
create table t1 (j int);
insert into t1 values (1);
create function f1() returns int return (select count(*) from m1);
......@@ -2892,14 +2839,6 @@ drop tables t1, m1;
# Check effect of Bug#27480-preliminary patch:
# a merge-table with non-existing children, opened from a prelocked list.
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS m1;
DROP TRIGGER IF EXISTS trg1;
DROP TABLE IF EXISTS q1;
DROP TABLE IF EXISTS q2;
--enable_warnings
CREATE TABLE t1(a INT);
CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2);
......@@ -2914,12 +2853,12 @@ DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE m1;
--disable_result_log
--disable_query_log
set global default_storage_engine=@save_default_storage_engine;
--enable_result_log
--enable_query_log
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
--echo #
--echo # End of 10.0 tests
--echo #
#
# MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
#
create table t1 (pk int primary key, i int) engine=MyISAM;
insert into t1 values (1,1),(2,2);
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connection default;
DROP TABLE t1;
create table t1 (pk int primary key, i int) engine=aria;
insert into t1 values (1,1),(2,2);
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connection default;
DROP TABLE t1;
--echo #
--echo # MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
--echo #
create table t1 (pk int primary key, i int) engine=MyISAM;
insert into t1 values (1,1),(2,2);
--let $datadir=`SELECT @@datadir`
--write_file $datadir/test/t1.TMM
EOF
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
# Cleanup
--connection default
DROP TABLE t1;
#
# Test also Aria
#
create table t1 (pk int primary key, i int) engine=aria;
insert into t1 values (1,1),(2,2);
--let $datadir=`SELECT @@datadir`
--write_file $datadir/test/t1.TMM
EOF
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
# Cleanup
--connection default
DROP TABLE t1;
......@@ -43,3 +43,86 @@ i
UNLOCK TABLES;
DROP TABLE t1;
# End of 10.0 tests
#
# MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
#
create table t1 (pk int primary key, i int) engine=MyISAM;
insert into t1 values (1,1),(2,2);
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connection default;
DROP TABLE t1;
create table t1 (pk int primary key, i int) engine=aria;
insert into t1 values (1,1),(2,2);
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
disconnect con1;
connection default;
DROP TABLE t1;
......@@ -63,3 +63,61 @@ UNLOCK TABLES;
DROP TABLE t1;
--echo # End of 10.0 tests
--echo #
--echo # MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
--echo #
create table t1 (pk int primary key, i int) engine=MyISAM;
insert into t1 values (1,1),(2,2);
--let $datadir=`SELECT @@datadir`
--write_file $datadir/test/t1.TMM
EOF
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
# Cleanup
--connection default
DROP TABLE t1;
#
# Test also Aria
#
create table t1 (pk int primary key, i int) engine=aria;
insert into t1 values (1,1),(2,2);
--let $datadir=`SELECT @@datadir`
--write_file $datadir/test/t1.TMM
EOF
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
--connect (con1,localhost,root,,)
SHOW CREATE TABLE t1;
OPTIMIZE TABLE t1;
--disconnect con1
# Cleanup
--connection default
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
show variables like "system_time_zone";
Variable_name Value
system_time_zone MET
#
# Test unix timestamp
#
select @a:=FROM_UNIXTIME(1);
@a:=FROM_UNIXTIME(1)
1970-01-01 01:00:01
select unix_timestamp(@a);
unix_timestamp(@a)
1
#
# Test of some values, including some with daylight saving time
#
CREATE TABLE t1 (ts int);
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
......@@ -32,6 +37,9 @@ ts from_unixtime(ts)
1048989599 2003-03-30 03:59:59
1048989601 2003-03-30 04:00:01
DROP TABLE t1;
#
# Test of warning for spring time-gap values for system time zone
#
CREATE TABLE t1 (ts timestamp);
INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
('2003-03-30 02:59:59'),
......@@ -39,6 +47,9 @@ INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
Warnings:
Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
DROP TABLE t1;
#
# Test for fix for Bug#2523 Check that boundary dates are processed correctly.
#
select unix_timestamp('1970-01-01 01:00:00'),
unix_timestamp('1970-01-01 01:00:01'),
unix_timestamp('2038-01-19 04:14:07'),
......@@ -48,3 +59,6 @@ unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix
select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59');
unix_timestamp('1969-12-31 23:59:59') unix_timestamp('1970-01-01 00:00:00') unix_timestamp('1970-01-01 00:59:59')
NULL NULL NULL
#
# End of 4.1 tests
#
......@@ -7,24 +7,19 @@ disable_query_log;
select FROM_UNIXTIME(24*3600);
enable_query_log;
# Initialization
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# The following is because of daylight saving time
--replace_result MEST MET
show variables like "system_time_zone";
#
# Test unix timestamp
#
--echo #
--echo # Test unix timestamp
--echo #
select @a:=FROM_UNIXTIME(1);
select unix_timestamp(@a);
#
# Test of some values, including some with daylight saving time
#
--echo #
--echo # Test of some values, including some with daylight saving time
--echo #
CREATE TABLE t1 (ts int);
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
......@@ -42,19 +37,18 @@ SELECT ts,from_unixtime(ts) FROM t1;
DROP TABLE t1;
#
# Test of warning for spring time-gap values for system time zone
#
--echo #
--echo # Test of warning for spring time-gap values for system time zone
--echo #
CREATE TABLE t1 (ts timestamp);
INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
('2003-03-30 02:59:59'),
('2003-03-30 03:00:00');
DROP TABLE t1;
#
# Test for fix for Bug#2523 Check that boundary dates are processed
# correctly.
#
--echo #
--echo # Test for fix for Bug#2523 Check that boundary dates are processed correctly.
--echo #
select unix_timestamp('1970-01-01 01:00:00'),
unix_timestamp('1970-01-01 01:00:01'),
unix_timestamp('2038-01-19 04:14:07'),
......@@ -62,4 +56,6 @@ select unix_timestamp('1970-01-01 01:00:00'),
select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59');
# End of 4.1 tests
--echo #
--echo # End of 4.1 tests
--echo #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment