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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2130e7af
Commit
2130e7af
authored
Feb 08, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/matthias/Arbeit/mysql-5.0/src
into mysql.com:/home/matthias/Arbeit/mysql-5.0/src-WL1420
parents
63bcbfc4
a1ae4b05
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
381 additions
and
0 deletions
+381
-0
mysql-test/r/strict.result
mysql-test/r/strict.result
+83
-0
mysql-test/t/strict.test
mysql-test/t/strict.test
+298
-0
No files found.
mysql-test/r/strict.result
View file @
2130e7af
...
@@ -129,6 +129,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
...
@@ -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
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');
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
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');
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
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');
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
...
@@ -153,6 +155,8 @@ INSERT INTO t1 VALUES('2004-09-31 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
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');
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
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');
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
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');
INSERT INTO t1 VALUES('2004-02-29 25:30:00');
...
@@ -194,6 +198,85 @@ col1
...
@@ -194,6 +198,85 @@ col1
0000-00-00 00:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
DROP TABLE t1;
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);
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);
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;
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
...
...
mysql-test/t/strict.test
View file @
2130e7af
...
@@ -13,6 +13,9 @@ DROP TABLE IF EXISTS t1;
...
@@ -13,6 +13,9 @@ DROP TABLE IF EXISTS t1;
CREATE
TABLE
t1
(
col1
date
);
CREATE
TABLE
t1
(
col1
date
);
INSERT
INTO
t1
VALUES
(
'2004-01-01'
),(
'0000-10-31'
),(
'2004-02-29'
);
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
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-0-31'
);
INSERT
INTO
t1
VALUES
(
'2004-0-31'
);
--
error
1292
--
error
1292
...
@@ -94,6 +97,9 @@ set @@sql_mode='ansi,traditional';
...
@@ -94,6 +97,9 @@ set @@sql_mode='ansi,traditional';
CREATE
TABLE
t1
(
col1
datetime
);
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'
);
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
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-0-31 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'2004-0-31 15:30:00'
);
--
error
1292
--
error
1292
...
@@ -103,6 +109,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
...
@@ -103,6 +109,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-10-32 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'2004-10-32 15:30:00'
);
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'2003-02-29 15:30:00'
);
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-13-15 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'2004-13-15 15:30:00'
);
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'0000-00-00 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'0000-00-00 15:30:00'
);
...
@@ -116,6 +124,9 @@ drop table t1;
...
@@ -116,6 +124,9 @@ drop table t1;
CREATE
TABLE
t1
(
col1
timestamp
);
CREATE
TABLE
t1
(
col1
timestamp
);
INSERT
INTO
t1
VALUES
(
'2004-10-31 15:30:00'
),(
'2004-02-29 15:30:00'
);
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
# Standard says we should return ok, but we can't as this is out of range
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'0000-10-31 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'0000-10-31 15:30:00'
);
...
@@ -128,6 +139,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
...
@@ -128,6 +139,8 @@ INSERT INTO t1 VALUES('2004-09-31 15:30:00');
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-10-32 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'2004-10-32 15:30:00'
);
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'2003-02-29 15:30:00'
);
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-13-15 15:30:00'
);
INSERT
INTO
t1
VALUES
(
'2004-13-15 15:30:00'
);
--
error
1292
--
error
1292
INSERT
INTO
t1
VALUES
(
'2004-02-29 25:30:00'
);
INSERT
INTO
t1
VALUES
(
'2004-02-29 25:30:00'
);
...
@@ -163,6 +176,291 @@ set @@sql_mode='ansi,traditional';
...
@@ -163,6 +176,291 @@ set @@sql_mode='ansi,traditional';
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
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
let
$activate6145
=
1
;
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
# Test INSERT with TINYINT
CREATE
TABLE
t1
(
col1
TINYINT
,
col2
TINYINT
UNSIGNED
);
CREATE
TABLE
t1
(
col1
TINYINT
,
col2
TINYINT
UNSIGNED
);
...
...
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