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
623d9360
Commit
623d9360
authored
May 16, 2007
by
msvensson@pilot.blaudden
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-new-maint
parents
3156fb92
3d723860
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+35
-0
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+25
-0
No files found.
mysql-test/r/type_datetime.result
View file @
623d9360
...
...
@@ -192,6 +192,41 @@ CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMA
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6))
101112.098700
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
Warnings:
Note 1265 Data truncated for column 'da' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`da` date default '1962-03-03',
`dt` datetime default '1962-03-03 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ();
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
Warnings:
Note 1265 Data truncated for column 'da' at row 1
set @@sql_mode='ansi,traditional';
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
Warnings:
Note 1265 Data truncated for column 'da' at row 1
insert into t1 set dt='2007-03-23 13:49:38',da=dt;
Warnings:
Note 1265 Data truncated for column 'da' at row 1
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
select * from t1;
da dt
1962-03-03 1962-03-03 00:00:00
2007-03-23 2007-03-23 13:49:38
2007-03-23 2007-03-23 13:49:38
2007-03-23 2007-03-23 13:49:38
drop table t1;
create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
ERROR 42000: Invalid default value for 'da'
create table t1 (t time default '916:00:00 a');
ERROR 42000: Invalid default value for 't'
set @@sql_mode= @org_mode;
create table t1 (f1 date, f2 datetime, f3 timestamp);
insert into t1(f1) values(curdate());
select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1;
...
...
mysql-test/t/type_datetime.test
View file @
623d9360
...
...
@@ -141,6 +141,31 @@ SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
SELECT
CAST
(
CAST
(
'2006-08-10 10:11:12'
AS
DATETIME
)
+
INTERVAL
14
MICROSECOND
AS
DECIMAL
(
20
,
6
));
SELECT
CAST
(
CAST
(
'10:11:12.098700'
AS
TIME
)
AS
DECIMAL
(
20
,
6
));
#
# Test of storing datetime into date fields
#
set
@
org_mode
=@@
sql_mode
;
create
table
t1
(
da
date
default
'1962-03-03 23:33:34'
,
dt
datetime
default
'1962-03-03'
);
show
create
table
t1
;
insert
into
t1
values
();
insert
into
t1
values
(
'2007-03-23 13:49:38'
,
'2007-03-23 13:49:38'
);
set
@@
sql_mode
=
'ansi,traditional'
;
insert
into
t1
values
(
'2007-03-23 13:49:38'
,
'2007-03-23 13:49:38'
);
insert
into
t1
set
dt
=
'2007-03-23 13:49:38'
,
da
=
dt
;
# Test error handling
--
error
1292
insert
into
t1
values
(
'2007-03-32'
,
'2007-03-23 13:49:38'
);
select
*
from
t1
;
drop
table
t1
;
--
error
1067
create
table
t1
(
da
date
default
'1962-03-32 23:33:34'
,
dt
datetime
default
'1962-03-03'
);
--
error
1067
create
table
t1
(
t
time
default
'916:00:00 a'
);
set
@@
sql_mode
=
@
org_mode
;
#
# Bug#27590: Wrong DATE/DATETIME comparison.
#
...
...
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