summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_time.result17
-rw-r--r--mysql-test/r/subselect.result29
-rw-r--r--mysql-test/t/func_time.test13
-rw-r--r--mysql-test/t/subselect.test20
4 files changed, 78 insertions, 1 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 9d38083f48a..feaebc9b514 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -468,6 +468,23 @@ select date_add(time,INTERVAL 1 SECOND) from t1;
date_add(time,INTERVAL 1 SECOND)
2006-07-08 00:00:01
drop table t1;
+select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
+last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
+last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
+last_day('2001-02-12');
+f1 f2 f3 f4 f5 last_day(NULL) last_day('2001-02-12')
+2000-02-29 2002-12-31 NULL 2003-04-30 2001-01-31 NULL 2001-02-28
+create table t1 select last_day('2000-02-05') as a;
+describe t1;
+Field Type Null Key Default Extra
+a date 0000-00-00
+select * from t1;
+a
+2000-02-29
+drop table t1;
+select last_day('2000-02-05');
+last_day('2000-02-05')
+2000-02-29
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0
1
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 31b5ff84365..518cc699c38 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1569,3 +1569,32 @@ INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
DROP TABLE t1, t2;
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(22, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+a b
+0 10
+1 11
+2 12
+select * from t12;
+a b
+33 10
+22 11
+2 12
+select * from t2;
+a b
+1 21
+2 12
+3 23
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b > (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+select * from t2;
+a b
+1 21
+2 12
+3 23
+drop table t11, t12, t2;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 96bdb547469..f1a24a4c3cb 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -224,6 +224,19 @@ select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
select date_add(time,INTERVAL 1 SECOND) from t1;
drop table t1;
+# test for last_day
+select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
+ last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
+ last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
+ last_day('2001-02-12');
+
+create table t1 select last_day('2000-02-05') as a;
+describe t1;
+select * from t1;
+drop table t1;
+select last_day('2000-02-05');
+
+
# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
# TZ variable set to GMT-3
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index f356e7931c8..90d5ad24d17 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1008,4 +1008,22 @@ CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PR
INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
-DROP TABLE t1, t2;s
+DROP TABLE t1, t2;
+
+#
+# errors handling
+#
+
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(22, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+select * from t12;
+select * from t2;
+-- error 1241
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b > (select b from t2);
+select * from t2;
+drop table t11, t12, t2;