Commit 16e60651 authored by unknown's avatar unknown

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb


sql/sql_class.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 0547087a e537c5e1
......@@ -62,7 +62,6 @@ From: $FROM
To: $INTERNALS
Subject: bk commit into $VERSION tree ($CHANGESET)$BS
$BH
Below is the list of changes that have just been committed into a local
$VERSION repository of $USER. When $USER does a push these changes will
be propagated to the main repository and, within 24 hours after the
......
......@@ -129,6 +129,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
......@@ -153,6 +155,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-02-29 25:30:00');
......@@ -194,6 +198,85 @@ col1
0000-00-00 00:00:00
0000-00-00 00:00:00
DROP TABLE t1;
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1
drop table t1;
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1
drop table t1;
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1
drop table t1;
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
......
......@@ -2176,3 +2176,103 @@ ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
drop table t1;
CREATE TABLE t1 (
categoryId int(11) NOT NULL,
courseId int(11) NOT NULL,
startDate datetime NOT NULL,
endDate datetime NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL,
attributes text NOT NULL
);
INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
CREATE TABLE t2 (
userId int(11) NOT NULL,
courseId int(11) NOT NULL,
date datetime NOT NULL
);
INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
CREATE TABLE t3 (
groupId int(11) NOT NULL,
parentId int(11) NOT NULL,
startDate datetime NOT NULL,
endDate datetime NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL,
ordering int(11)
);
INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
CREATE TABLE t4 (
id int(11) NOT NULL,
groupTypeId int(11) NOT NULL,
groupKey varchar(50) NOT NULL,
name text,
ordering int(11),
description text,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL
);
INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
CREATE TABLE t5 (
userId int(11) NOT NULL,
groupId int(11) NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL
);
INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
select
count(distinct t2.userid) pass,
groupstuff.*,
count(t2.courseid) crse,
t1.categoryid,
t2.courseid,
date_format(date, '%b%y') as colhead
from t2
join t1 on t2.courseid=t1.courseid
join
(
select
t5.userid,
parentid,
parentgroup,
childid,
groupname,
grouptypeid
from t5
join
(
select t4.id as parentid,
t4.name as parentgroup,
t4.id as childid,
t4.name as groupname,
t4.grouptypeid
from t4
) as gin on t5.groupid=gin.childid
) as groupstuff on t2.userid = groupstuff.userid
group by
groupstuff.groupname, colhead , t2.courseid;
pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead
1 5141 12 group2 12 group2 5 1 5 12 Aug04
1 5141 12 group2 12 group2 5 1 1 41 Aug04
1 5141 12 group2 12 group2 5 1 2 52 Aug04
1 5141 12 group2 12 group2 5 1 2 53 Aug04
1 5141 12 group2 12 group2 5 1 3 51 Oct04
1 5141 12 group2 12 group2 5 1 1 86 Oct04
1 5141 12 group2 12 group2 5 1 1 87 Oct04
1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04
drop table if exists t1, t2, t3, t4, t5;
......@@ -13,6 +13,9 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
--error 1292
INSERT INTO t1 VALUES('2004-0-31');
--error 1292
......@@ -94,6 +97,9 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
--error 1292
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
--error 1292
......@@ -103,6 +109,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
--error 1292
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
......@@ -116,6 +124,9 @@ drop table t1;
CREATE TABLE t1 (col1 timestamp);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
# Standard says we should return ok, but we can't as this is out of range
--error 1292
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
......@@ -128,6 +139,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
--error 1292
INSERT INTO t1 VALUES('2004-02-29 25:30:00');
......@@ -163,6 +176,290 @@ set @@sql_mode='ansi,traditional';
SELECT * FROM t1;
DROP TABLE t1;
#### Test INSERT with STR_TO_DATE into DATE/DATETIME/TIMESTAMP
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
## Test INSERT with STR_TO_DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
# deactivated because of Bug#5902
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
# deactivated because of Bug#5902
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
## Test INSERT with STR_TO_DATE into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
# deactivated because of Bug#5902
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
# deactivated because of Bug#5902
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
#--error 1292
#INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
## Test INSERT with STR_TO_DATE into TIMESTAMP
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
# deactivated because of Bug#5902
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
# deactivated because of Bug#5902
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
#--error 1292
#INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
drop table t1;
#### Test INSERT with CAST AS DATE/DATETIME into DATE/DATETIME/TIMESTAMP
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
## Test INSERT with CAST AS DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
--error 1292
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
--error 1292
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
# deactivated because of Bug#8294
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
# --error 1292
# INSERT INTO t1 (col1) VALUES(CAST('2004-9-31' AS DATE));
# --error 1292
# INSERT INTO t1 (col1) VALUES(CAST('2004-10-32' AS DATE));
# --error 1292
# INSERT INTO t1 (col1) VALUES(CAST('2003-02-29' AS DATE));
# --error 1292
# INSERT INTO t1 (col1) VALUES(CAST('2004-13-15' AS DATE));
# deactivated because of Bug#6145
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
#--error 1292
#INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
## Test INSERT with CAST AS DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
--error 1292
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
--error 1292
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
# deactivated because of Bug#8294
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
#--error 1292
#INSERT INTO t1 (col2) VALUES(CAST('2004-9-31 15:30' AS DATETIME));
#--error 1292
#INSERT INTO t1 (col2) VALUES(CAST('2004-10-32 15:30' AS DATETIME));
#--error 1292
#INSERT INTO t1 (col2) VALUES(CAST('2003-02-29 15:30' AS DATETIME));
#--error 1292
#INSERT INTO t1 (col2) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
# deactivated because of Bug#6145
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
#--error 1292
#INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
## Test INSERT with CAST AS DATETIME into TIMESTAMP
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
!$1292
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-- should return OK
-- We accept this to be a failure
--error 1292
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
--error 1292
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
-- should return SQLSTATE 22007 <invalid datetime value>
# deactivated because of Bug#8294
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
#--error 1292
#INSERT INTO t1 (col3) VALUES(CAST('2004-9-31 15:30' AS DATETIME));
#--error 1292
#INSERT INTO t1 (col3) VALUES(CAST('2004-10-32 15:30' AS DATETIME));
#--error 1292
#INSERT INTO t1 (col3) VALUES(CAST('2003-02-29 15:30' AS DATETIME));
#--error 1292
#INSERT INTO t1 (col3) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
# deactivated because of Bug#6145
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
#--error 1292
#INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
drop table t1;
#### Test INSERT with CONVERT to DATE/DATETIME into DATE/DATETIME/TIMESTAMP
CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
## Test INSERT with CONVERT to DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
--error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
--error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
# deactivated because of Bug#8294
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
#--error 1292
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-9-31' , DATE));
#--error 1292
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-32' , DATE));
#--error 1292
#INSERT INTO t1 (col1) VALUES(CONVERT('2003-02-29' , DATE));
#--error 1292
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-13-15',DATE));
# deactivated because of Bug#6145
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
#--error 1292
#INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
## Test INSERT with CONVERT to DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
--error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
--error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
# deactivated because of Bug#8294
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
#--error 1292
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-9-31 15:30',DATETIME));
#--error 1292
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-32 15:30',DATETIME));
#--error 1292
#INSERT INTO t1 (col2) VALUES(CONVERT('2003-02-29 15:30',DATETIME));
#--error 1292
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
#--error 1292
#INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
## Test INSERT with CONVERT to DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
!$1292
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-- should return OK
-- We accept this to be a failure
--error 1292
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
--error 1292
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
# deactivated because of Bug#8294
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
#--error 1292
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-9-31 15:30',DATETIME));
#--error 1292
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-32 15:30',DATETIME));
#--error 1292
#INSERT INTO t1 (col3) VALUES(CONVERT('2003-02-29 15:30',DATETIME));
#--error 1292
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
# deactivated because of Bug#6145
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
#--error 1292
#INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
drop table t1;
# Test INSERT with TINYINT
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
......
......@@ -1442,3 +1442,104 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
-- error 1247
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
drop table t1;
# Test for BUG#8218
CREATE TABLE t1 (
categoryId int(11) NOT NULL,
courseId int(11) NOT NULL,
startDate datetime NOT NULL,
endDate datetime NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL,
attributes text NOT NULL
);
INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
CREATE TABLE t2 (
userId int(11) NOT NULL,
courseId int(11) NOT NULL,
date datetime NOT NULL
);
INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
CREATE TABLE t3 (
groupId int(11) NOT NULL,
parentId int(11) NOT NULL,
startDate datetime NOT NULL,
endDate datetime NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL,
ordering int(11)
);
INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
CREATE TABLE t4 (
id int(11) NOT NULL,
groupTypeId int(11) NOT NULL,
groupKey varchar(50) NOT NULL,
name text,
ordering int(11),
description text,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL
);
INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
CREATE TABLE t5 (
userId int(11) NOT NULL,
groupId int(11) NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL
);
INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
select
count(distinct t2.userid) pass,
groupstuff.*,
count(t2.courseid) crse,
t1.categoryid,
t2.courseid,
date_format(date, '%b%y') as colhead
from t2
join t1 on t2.courseid=t1.courseid
join
(
select
t5.userid,
parentid,
parentgroup,
childid,
groupname,
grouptypeid
from t5
join
(
select t4.id as parentid,
t4.name as parentgroup,
t4.id as childid,
t4.name as groupname,
t4.grouptypeid
from t4
) as gin on t5.groupid=gin.childid
) as groupstuff on t2.userid = groupstuff.userid
group by
groupstuff.groupname, colhead , t2.courseid;
drop table if exists t1, t2, t3, t4, t5;
......@@ -21,6 +21,8 @@ LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
wrappersdir=$(prefix)/bin
wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
noinst_HEADERS = run-test.hpp $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT
# Don't update the files from bitkeeper
%::SCCS/s.%
......
......@@ -158,8 +158,7 @@ do
*) fail; res_txt="FAILED";;
esac
if [ ! -d "result.$no" ]; then res_dir="&nbsp;"; fi
if [ ! -d "$src_dir/result.$no" ]; then res_dir="&nbsp;"; fi
total=`expr $total + $time`
......
......@@ -1427,7 +1427,11 @@ class select_create: public select_insert {
#include <myisam.h>
/* Param to create temporary tables when doing SELECT:s */
/*
Param to create temporary tables when doing SELECT:s
NOTE
This structure is copied using memcpy as a part of JOIN.
*/
class TMP_TABLE_PARAM :public Sql_alloc
{
......@@ -1439,7 +1443,6 @@ class TMP_TABLE_PARAM :public Sql_alloc
public:
List<Item> copy_funcs;
List<Item> save_copy_funcs;
List_iterator_fast<Item> copy_funcs_it;
Copy_field *copy_field, *copy_field_end;
Copy_field *save_copy_field, *save_copy_field_end;
byte *group_buff;
......@@ -1457,7 +1460,7 @@ class TMP_TABLE_PARAM :public Sql_alloc
CHARSET_INFO *table_charset;
TMP_TABLE_PARAM()
:copy_funcs_it(copy_funcs), copy_field(0), group_parts(0),
:copy_field(0), group_parts(0),
group_length(0), group_null_parts(0), convert_blob_length(0)
{}
~TMP_TABLE_PARAM()
......
......@@ -11948,8 +11948,7 @@ copy_fields(TMP_TABLE_PARAM *param)
for (; ptr != end; ptr++)
(*ptr->do_copy)(ptr);
List_iterator_fast<Item> &it=param->copy_funcs_it;
it.rewind();
List_iterator_fast<Item> it(param->copy_funcs);
Item_copy_string *item;
while ((item = (Item_copy_string*) it++))
item->copy();
......
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