summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/bigint.result3
-rw-r--r--mysql-test/r/ctype_tis620.result17
-rw-r--r--mysql-test/r/innodb.result4
-rw-r--r--mysql-test/r/rpl_insert_id.result2
-rw-r--r--mysql-test/r/timezone.result6
-rw-r--r--mysql-test/r/type_timestamp.result47
-rw-r--r--mysql-test/t/bigint.test2
-rw-r--r--mysql-test/t/ctype_tis620-master.opt1
-rw-r--r--mysql-test/t/ctype_tis620.test18
-rw-r--r--mysql-test/t/innodb.test4
-rw-r--r--mysql-test/t/rpl_insert_id.test2
-rw-r--r--mysql-test/t/timezone.test7
-rw-r--r--mysql-test/t/type_timestamp.test33
13 files changed, 135 insertions, 11 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index 308adc881f2..f96da579bce 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -81,3 +81,6 @@ quantity
10000000000000000000
10000000000000000000
drop table t1;
+SELECT '0x8000000000000001'+0;
+'0x8000000000000001'+0
+0
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
new file mode 100644
index 00000000000..d939fd12e60
--- /dev/null
+++ b/mysql-test/r/ctype_tis620.result
@@ -0,0 +1,17 @@
+DROP TABLE IF EXISTS t620;
+CREATE TABLE t620 (
+recid int(11) NOT NULL auto_increment,
+dyninfo text,
+PRIMARY KEY (recid)
+) TYPE=MyISAM;
+INSERT INTO t620 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
+INSERT INTO t620 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n');
+SELECT DISTINCT
+(IF( LOCATE( 'year=\"', dyninfo ) = 1,
+SUBSTRING( dyninfo, 6+1, LOCATE('\"\r',dyninfo) - 6 -1),
+IF( LOCATE( '\nyear=\"', dyninfo ),
+SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) + 7,
+LOCATE( '\"\r', SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) +7 )) - 1), '' ))) AS year
+FROM t620
+HAVING year != '' ORDER BY year;
+year
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index ca4a49fea4e..416c583a8d7 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1004,7 +1004,7 @@ select * from t1;
id
select * from t2;
id t1_id
-drop table t1,t2;
+drop table t2,t1;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB;
@@ -1245,4 +1245,4 @@ a
drop table t1;
CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) TYPE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) TYPE=INNODB;
-drop table t1,t2;
+drop table t2,t1;
diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result
index 889e7891770..d2dfbb05675 100644
--- a/mysql-test/r/rpl_insert_id.result
+++ b/mysql-test/r/rpl_insert_id.result
@@ -39,8 +39,8 @@ select * from t2;
b c
5 0
6 11
-drop table t1;
drop table t2;
+drop table t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
diff --git a/mysql-test/r/timezone.result b/mysql-test/r/timezone.result
index 20706408075..15f0d4121c7 100644
--- a/mysql-test/r/timezone.result
+++ b/mysql-test/r/timezone.result
@@ -32,3 +32,9 @@ ts from_unixtime(ts)
1048989599 2003-03-30 03:59:59
1048989601 2003-03-30 04:00:01
DROP TABLE t1;
+select unix_timestamp('1970-01-01 01:00:00'),
+unix_timestamp('1970-01-01 01:00:01'),
+unix_timestamp('2038-01-01 00:59:59'),
+unix_timestamp('2038-01-01 01:00:00');
+unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-01 00:59:59') unix_timestamp('2038-01-01 01:00:00')
+0 1 2145916799 0
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index b513f958787..cd45bcf911d 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -122,5 +122,48 @@ t2 t4 t6 t8 t10 t12 t14
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
drop table t1;
-create table t1 (a timestamp default 1);
-Invalid default value for 'a'
+create table t1 (t1 timestamp default '2003-01-01 00:00:00',
+t2 timestamp default '2003-01-01 00:00:00');
+set TIMESTAMP=1000000000;
+insert into t1 values();
+select * from t1;
+t1 t2
+2001-09-09 04:46:40 2003-01-01 00:00:00
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t1` timestamp(14) NOT NULL,
+ `t2` timestamp(14) NOT NULL default '2003-01-01 00:00:00'
+) TYPE=MyISAM
+show columns from t1;
+Field Type Null Key Default Extra
+t1 timestamp(14) YES NULL
+t2 timestamp(14) YES 2003-01-01 00:00:00
+show columns from t1 like 't2';
+Field Type Null Key Default Extra
+t2 timestamp(14) YES 2003-01-01 00:00:00
+create table t2 (select * from t1);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `t1` timestamp(14) NOT NULL,
+ `t2` timestamp(14) NOT NULL default '2003-01-01 00:00:00'
+) TYPE=MyISAM
+alter table t1 add column t0 timestamp first;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t0` timestamp(14) NOT NULL,
+ `t1` timestamp(14) NOT NULL default '2003-01-01 00:00:00',
+ `t2` timestamp(14) NOT NULL default '2003-01-01 00:00:00'
+) TYPE=MyISAM
+drop table t1,t2;
+create table t1 (ts1 timestamp, ts2 timestamp);
+set TIMESTAMP=1000000000;
+insert into t1 values ();
+insert into t1 values (DEFAULT, DEFAULT);
+select * from t1;
+ts1 ts2
+2001-09-09 04:46:40 0000-00-00 00:00:00
+2001-09-09 04:46:40 0000-00-00 00:00:00
+drop table t1;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index f21f821e45c..0092317dc5e 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -60,3 +60,5 @@ insert into t1 values ('10000000000000000000');
select * from t1;
drop table t1;
+SELECT '0x8000000000000001'+0;
+
diff --git a/mysql-test/t/ctype_tis620-master.opt b/mysql-test/t/ctype_tis620-master.opt
new file mode 100644
index 00000000000..69d47c06e42
--- /dev/null
+++ b/mysql-test/t/ctype_tis620-master.opt
@@ -0,0 +1 @@
+--default-character-set=tis620
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
new file mode 100644
index 00000000000..7a0555515e1
--- /dev/null
+++ b/mysql-test/t/ctype_tis620.test
@@ -0,0 +1,18 @@
+DROP TABLE IF EXISTS t620;
+CREATE TABLE t620 (
+ recid int(11) NOT NULL auto_increment,
+ dyninfo text,
+ PRIMARY KEY (recid)
+) TYPE=MyISAM;
+
+INSERT INTO t620 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
+INSERT INTO t620 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n');
+
+SELECT DISTINCT
+ (IF( LOCATE( 'year=\"', dyninfo ) = 1,
+ SUBSTRING( dyninfo, 6+1, LOCATE('\"\r',dyninfo) - 6 -1),
+ IF( LOCATE( '\nyear=\"', dyninfo ),
+ SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) + 7,
+ LOCATE( '\"\r', SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) +7 )) - 1), '' ))) AS year
+FROM t620
+HAVING year != '' ORDER BY year;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 51fadccdc1c..ec9aa83ae16 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -692,7 +692,7 @@ insert into t2 set id=1, t1_id=1;
delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
select * from t1;
select * from t2;
-drop table t1,t2;
+drop table t2,t1;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB;
@@ -877,4 +877,4 @@ drop table t1;
CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) TYPE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) TYPE=INNODB;
#show create table t2;
-drop table t1,t2;
+drop table t2,t1;
diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test
index 49fefae72b8..a6da44de456 100644
--- a/mysql-test/t/rpl_insert_id.test
+++ b/mysql-test/t/rpl_insert_id.test
@@ -42,8 +42,8 @@ connection master;
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
-drop table t1;
drop table t2;
+drop table t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
diff --git a/mysql-test/t/timezone.test b/mysql-test/t/timezone.test
index ab732c11a34..ba65eb72fe6 100644
--- a/mysql-test/t/timezone.test
+++ b/mysql-test/t/timezone.test
@@ -38,3 +38,10 @@ INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
SELECT ts,from_unixtime(ts) FROM t1;
DROP TABLE t1;
+#
+# Test for fix for Bug#2523
+#
+select unix_timestamp('1970-01-01 01:00:00'),
+ unix_timestamp('1970-01-01 01:00:01'),
+ unix_timestamp('2038-01-01 00:59:59'),
+ unix_timestamp('2038-01-01 01:00:00');
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 17f7b7c487f..3483227376e 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -73,8 +73,35 @@ select * from t1;
drop table t1;
#
-# Bug #1885
+# Bug #1885, bug #2539.
+# Not perfect but still sensible attitude towards defaults for TIMESTAMP
+# We will ignore default value for first TIMESTAMP column.
#
+create table t1 (t1 timestamp default '2003-01-01 00:00:00',
+ t2 timestamp default '2003-01-01 00:00:00');
+set TIMESTAMP=1000000000;
+insert into t1 values();
+select * from t1;
+show create table t1;
+show columns from t1;
+show columns from t1 like 't2';
+create table t2 (select * from t1);
+show create table t2;
+
+# Ugly, but we can't do anything about this in 4.0
+alter table t1 add column t0 timestamp first;
+show create table t1;
---error 1067
-create table t1 (a timestamp default 1);
+drop table t1,t2;
+
+#
+# Test for bug 2464, DEFAULT keyword in INSERT statement should return
+# default value for column.
+#
+
+create table t1 (ts1 timestamp, ts2 timestamp);
+set TIMESTAMP=1000000000;
+insert into t1 values ();
+insert into t1 values (DEFAULT, DEFAULT);
+select * from t1;
+drop table t1;