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
e9205dc0
Commit
e9205dc0
authored
Mar 30, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
parents
8098ef79
b43b7dc1
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
319 additions
and
73 deletions
+319
-73
mysql-test/r/date_formats.result
mysql-test/r/date_formats.result
+39
-0
mysql-test/r/ps_1general.result
mysql-test/r/ps_1general.result
+1
-1
mysql-test/r/strict.result
mysql-test/r/strict.result
+60
-0
mysql-test/r/type_decimal.result
mysql-test/r/type_decimal.result
+55
-0
mysql-test/t/date_formats.test
mysql-test/t/date_formats.test
+1
-0
mysql-test/t/strict.test
mysql-test/t/strict.test
+56
-37
mysql-test/t/type_decimal.test
mysql-test/t/type_decimal.test
+41
-0
ndb/src/ndbapi/DictCache.cpp
ndb/src/ndbapi/DictCache.cpp
+1
-1
sql/field.cc
sql/field.cc
+14
-8
sql/handler.cc
sql/handler.cc
+2
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+23
-9
sql/log_event.cc
sql/log_event.cc
+11
-9
sql/log_event.h
sql/log_event.h
+2
-0
sql/share/errmsg.txt
sql/share/errmsg.txt
+2
-0
sql/sql_acl.cc
sql/sql_acl.cc
+6
-3
sql/sql_show.cc
sql/sql_show.cc
+4
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
mysql-test/r/date_formats.result
View file @
e9205dc0
...
@@ -79,6 +79,11 @@ concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
...
@@ -79,6 +79,11 @@ concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
str_to_date(concat('15-01-2001',' 2:59:58.999'),
str_to_date(concat('15-01-2001',' 2:59:58.999'),
concat('%d-%m-%Y',' ','%H:%i:%s.%f'))
concat('%d-%m-%Y',' ','%H:%i:%s.%f'))
2001-01-15 02:59:58.999000
2001-01-15 02:59:58.999000
select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
NULL
Warnings:
Error 1411 Incorrect time value: '22.30.61' for function str_to_time
create table t1 (date char(30), format char(30) not null);
create table t1 (date char(30), format char(30) not null);
insert into t1 values
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
...
@@ -335,6 +340,22 @@ Tuesday 52 2001 %W %V %Y NULL
...
@@ -335,6 +340,22 @@ Tuesday 52 2001 %W %V %Y NULL
Tuesday 52 2001 %W %u %x NULL
Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
NULL %m.%d.%Y NULL
Warnings:
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_time
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_time
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_time
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_time
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_time
select date,format,concat(str_to_date(date, format),'') as con from t1;
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
date format con
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
...
@@ -353,6 +374,22 @@ Tuesday 52 2001 %W %V %Y NULL
...
@@ -353,6 +374,22 @@ Tuesday 52 2001 %W %V %Y NULL
Tuesday 52 2001 %W %u %x NULL
Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
NULL %m.%d.%Y NULL
Warnings:
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_time
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_time
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_time
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_time
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_time
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_time
truncate table t1;
truncate table t1;
insert into t1 values
insert into t1 values
('10:20:10AM', '%h:%i:%s'),
('10:20:10AM', '%h:%i:%s'),
...
@@ -391,6 +428,8 @@ NULL
...
@@ -391,6 +428,8 @@ NULL
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
NULL
NULL
Warnings:
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_time
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
...
...
mysql-test/r/ps_1general.result
View file @
e9205dc0
...
@@ -342,7 +342,7 @@ EXAMPLE YES/NO Example storage engine
...
@@ -342,7 +342,7 @@ EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine
ARCHIVE YES/NO Archive storage engine
CSV YES/NO CSV storage engine
CSV YES/NO CSV storage engine
FEDERATED YES/NO Federated MySQL storage engine
FEDERATED YES/NO Federated MySQL storage engine
BLACKHOLE YES/NO
Storage engine designed to act as null storage
BLACKHOLE YES/NO
/dev/null storage engine (anything you write to it disappears)
drop table if exists t5;
drop table if exists t5;
prepare stmt1 from ' drop table if exists t5 ' ;
prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
execute stmt1 ;
...
...
mysql-test/r/strict.result
View file @
e9205dc0
set @org_mode=@@sql_mode;
set @@sql_mode='ansi,traditional';
set @@sql_mode='ansi,traditional';
select @@sql_mode;
select @@sql_mode;
@@sql_mode
@@sql_mode
...
@@ -209,8 +210,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -209,8 +210,12 @@ 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
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'));
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
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('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
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
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('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
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
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.10.0000 15.30','%d.%m.%Y %H.%i'));
...
@@ -220,8 +225,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -220,8 +225,14 @@ 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
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'));
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
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('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
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
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect datetime value: '0000-00-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'));
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
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'));
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -230,8 +241,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -230,8 +241,12 @@ 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
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'));
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
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('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
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
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('15.13.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
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
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1
drop table t1;
drop table t1;
...
@@ -1030,3 +1045,48 @@ ERROR 22001: Data too long for column 'tinyblobcol' at row 1
...
@@ -1030,3 +1045,48 @@ ERROR 22001: Data too long for column 'tinyblobcol' at row 1
select * from t1;
select * from t1;
charcol varcharcol binarycol varbinarycol tinytextcol tinyblobcol
charcol varcharcol binarycol varbinarycol tinytextcol tinyblobcol
drop table t1;
drop table t1;
set sql_mode='traditional';
create table t1 (col1 datetime);
insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
ERROR 22007: Truncated incorrect datetime value: '31.10.2004 15.30 abc'
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
ERROR HY000: Incorrect time value: '22:22:33 AM' for function str_to_time
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
ERROR HY000: Incorrect time value: 'abc' for function str_to_time
set sql_mode='';
insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
Warnings:
Warning 1292 Truncated incorrect datetime value: '31.10.2004 15.30 abc'
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
Warnings:
Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
Warnings:
Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_time
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
Warnings:
Error 1411 Incorrect time value: 'abc' for function str_to_time
insert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i'));
insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r'));
insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T'));
select * from t1;
col1
2004-10-31 15:30:00
NULL
NULL
NULL
2004-10-31 15:30:00
2004-12-12 11:22:33
2004-12-12 10:22:59
set sql_mode='traditional';
select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') IS NULL;
count(*)
7
Warnings:
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
drop table t1;
set sql_mode=@org_mode;
mysql-test/r/type_decimal.result
View file @
e9205dc0
...
@@ -693,3 +693,58 @@ SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t1);
...
@@ -693,3 +693,58 @@ SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t1);
EMPNUM
EMPNUM
E1
E1
DROP TABLE t1,t2;
DROP TABLE t1,t2;
create table t1 (d decimal(64,0));
insert into t1 values (1);
select * from t1;
d
1
drop table t1;
create table t1 (d decimal(64,99));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` decimal(64,30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1);
select * from t1;
d
1.000000000000000000000000000000
drop table t1;
create table t1 (d decimal(10,12));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` decimal(13,12) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal(5));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` decimal(5,0) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` decimal(10,0) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal(65,0));
ERROR 42000: Incorrect column specifier for column 'd'
CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2));
INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
(2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
(2, 30.40, 30.40), (3, 37.00, 7.40), (3, -29.60, 0.00),
(4, 60.00, 15.40), (4, -10.60, 0.00), (4, -34.00, 0.00),
(5, 33.00, 0.00), (5, -25.80, 0.00), (5, 0.00, 7.20),
(6, 0.00, 0.00), (6, -51.40, 0.00);
SELECT i, SUM(d1) AS a, SUM(d2) AS b FROM t1 GROUP BY i HAVING a <> b;
i a b
6 -51.40 0.00
SELECT i, ROUND(SUM(d1), 2) AS a, ROUND(SUM(d2), 2) AS b FROM t1 GROUP BY i
HAVING a <> b;
i a b
6 -51.40 0.00
drop table t1;
mysql-test/t/date_formats.test
View file @
e9205dc0
...
@@ -122,6 +122,7 @@ SET datetime_format=default;
...
@@ -122,6 +122,7 @@ SET datetime_format=default;
--
disable_ps_protocol
--
disable_ps_protocol
select
str_to_date
(
concat
(
'15-01-2001'
,
' 2:59:58.999'
),
select
str_to_date
(
concat
(
'15-01-2001'
,
' 2:59:58.999'
),
concat
(
'%d-%m-%Y'
,
' '
,
'%H:%i:%s.%f'
));
concat
(
'%d-%m-%Y'
,
' '
,
'%H:%i:%s.%f'
));
select
STR_TO_DATE
(
'2004.12.12 22.30.61'
,
'%Y.%m.%d %T'
);
--
enable_ps_protocol
--
enable_ps_protocol
create
table
t1
(
date
char
(
30
),
format
char
(
30
)
not
null
);
create
table
t1
(
date
char
(
30
),
format
char
(
30
)
not
null
);
...
...
mysql-test/t/strict.test
View file @
e9205dc0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
set
@
org_mode
=@@
sql_mode
;
set
@@
sql_mode
=
'ansi,traditional'
;
set
@@
sql_mode
=
'ansi,traditional'
;
select
@@
sql_mode
;
select
@@
sql_mode
;
...
@@ -197,20 +198,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -197,20 +198,12 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# 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
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# 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
--
error
1292
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
INSERT
INTO
t1
(
col1
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
...
@@ -226,21 +219,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -226,21 +219,14 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# 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
--
error
1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# Bug#5902: Traditional mode: STR_TO_DATE changes invalid value rather than rejecting
--
error
1292
#--error 1292
INSERT
INTO
t1
(
col2
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
#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
## Test INSERT with STR_TO_DATE into TIMESTAMP
# All test cases expected to fail should return
# All test cases expected to fail should return
...
@@ -254,20 +240,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
...
@@ -254,20 +240,12 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'0.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1292
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'31.9.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# 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
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'29.02.2003 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
# deactivated because of Bug#5902
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'15.13.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
# 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
--
error
1292
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
INSERT
INTO
t1
(
col3
)
VALUES
(
STR_TO_DATE
(
'00.00.0000'
,
'%d.%m.%Y'
));
...
@@ -962,3 +940,44 @@ insert into t1 (tinytextcol) values (repeat('x',256));
...
@@ -962,3 +940,44 @@ insert into t1 (tinytextcol) values (repeat('x',256));
insert
into
t1
(
tinyblobcol
)
values
(
repeat
(
'x'
,
256
));
insert
into
t1
(
tinyblobcol
)
values
(
repeat
(
'x'
,
256
));
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #5902: STR_TO_DATE() didn't give errors in traditional mode
#
set
sql_mode
=
'traditional'
;
create
table
t1
(
col1
datetime
);
--
error
1292
insert
into
t1
values
(
STR_TO_DATE
(
'31.10.2004 15.30 abc'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
insert
into
t1
values
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
--
error
1411
insert
into
t1
values
(
STR_TO_DATE
(
'2004.12.12 22:22:33 AM'
,
'%Y.%m.%d %r'
));
--
error
1411
insert
into
t1
values
(
STR_TO_DATE
(
'2004.12.12 abc'
,
'%Y.%m.%d %T'
));
set
sql_mode
=
''
;
insert
into
t1
values
(
STR_TO_DATE
(
'31.10.2004 15.30 abc'
,
'%d.%m.%Y %H.%i'
));
insert
into
t1
values
(
STR_TO_DATE
(
'32.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
insert
into
t1
values
(
STR_TO_DATE
(
'2004.12.12 22:22:33 AM'
,
'%Y.%m.%d %r'
));
insert
into
t1
values
(
STR_TO_DATE
(
'2004.12.12 abc'
,
'%Y.%m.%d %T'
));
# Some correct values, just to test the functions
insert
into
t1
values
(
STR_TO_DATE
(
'31.10.2004 15.30'
,
'%d.%m.%Y %H.%i'
));
insert
into
t1
values
(
STR_TO_DATE
(
'2004.12.12 11:22:33 AM'
,
'%Y.%m.%d %r'
));
insert
into
t1
values
(
STR_TO_DATE
(
'2004.12.12 10:22:59'
,
'%Y.%m.%d %T'
));
select
*
from
t1
;
# Check that select don't abort even in strict mode (for now)
set
sql_mode
=
'traditional'
;
--
disable_ps_warnings
select
count
(
*
)
from
t1
where
STR_TO_DATE
(
'2004.12.12 10:22:61'
,
'%Y.%m.%d %T'
)
IS
NULL
;
--
enable_ps_warnings
drop
table
t1
;
#
# Restore mode
#
set
sql_mode
=@
org_mode
;
mysql-test/t/type_decimal.test
View file @
e9205dc0
...
@@ -285,3 +285,44 @@ SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t2);
...
@@ -285,3 +285,44 @@ SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t2);
SELECT
EMPNUM
FROM
t1
WHERE
HOURS
IN
(
SELECT
HOURS
FROM
t1
);
SELECT
EMPNUM
FROM
t1
WHERE
HOURS
IN
(
SELECT
HOURS
FROM
t1
);
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Test limits of decimal
#
create
table
t1
(
d
decimal
(
64
,
0
));
insert
into
t1
values
(
1
);
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
d
decimal
(
64
,
99
));
show
create
table
t1
;
insert
into
t1
values
(
1
);
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
d
decimal
(
10
,
12
));
show
create
table
t1
;
drop
table
t1
;
create
table
t1
(
d
decimal
(
5
));
show
create
table
t1
;
drop
table
t1
;
create
table
t1
(
d
decimal
);
show
create
table
t1
;
drop
table
t1
;
--
error
1063
create
table
t1
(
d
decimal
(
65
,
0
));
#
# Test example from manual
#
CREATE
TABLE
t1
(
i
INT
,
d1
DECIMAL
(
9
,
2
),
d2
DECIMAL
(
9
,
2
));
INSERT
INTO
t1
VALUES
(
1
,
101.40
,
21.40
),
(
1
,
-
80.00
,
0.00
),
(
2
,
0.00
,
0.00
),
(
2
,
-
13.20
,
0.00
),
(
2
,
59.60
,
46.40
),
(
2
,
30.40
,
30.40
),
(
3
,
37.00
,
7.40
),
(
3
,
-
29.60
,
0.00
),
(
4
,
60.00
,
15.40
),
(
4
,
-
10.60
,
0.00
),
(
4
,
-
34.00
,
0.00
),
(
5
,
33.00
,
0.00
),
(
5
,
-
25.80
,
0.00
),
(
5
,
0.00
,
7.20
),
(
6
,
0.00
,
0.00
),
(
6
,
-
51.40
,
0.00
);
SELECT
i
,
SUM
(
d1
)
AS
a
,
SUM
(
d2
)
AS
b
FROM
t1
GROUP
BY
i
HAVING
a
<>
b
;
SELECT
i
,
ROUND
(
SUM
(
d1
),
2
)
AS
a
,
ROUND
(
SUM
(
d2
),
2
)
AS
b
FROM
t1
GROUP
BY
i
HAVING
a
<>
b
;
drop
table
t1
;
ndb/src/ndbapi/DictCache.cpp
View file @
e9205dc0
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
Ndb_local_table_info
*
Ndb_local_table_info
*
Ndb_local_table_info
::
create
(
NdbTableImpl
*
table_impl
,
Uint32
sz
)
Ndb_local_table_info
::
create
(
NdbTableImpl
*
table_impl
,
Uint32
sz
)
{
{
Uint32
tot_size
=
sizeof
(
NdbTableImpl
*
)
+
((
sz
+
7
)
>>
3
)
<<
3
;
// round to Uint64
Uint32
tot_size
=
sizeof
(
NdbTableImpl
*
)
+
((
sz
+
7
)
&
~
7
)
;
// round to Uint64
void
*
data
=
malloc
(
tot_size
);
void
*
data
=
malloc
(
tot_size
);
if
(
data
==
0
)
if
(
data
==
0
)
return
0
;
return
0
;
...
...
sql/field.cc
View file @
e9205dc0
...
@@ -4699,15 +4699,19 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -4699,15 +4699,19 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
TIME
time_tmp
;
TIME
time_tmp
;
int
error
;
int
error
;
ulonglong
tmp
=
0
;
ulonglong
tmp
=
0
;
enum
enum_mysql_timestamp_type
func_res
;
if
(
str_to_datetime
(
from
,
len
,
&
time_tmp
,
func_res
=
str_to_datetime
(
from
,
len
,
&
time_tmp
,
(
TIME_FUZZY_DATE
|
(
TIME_FUZZY_DATE
|
(
table
->
in_use
->
variables
.
sql_mode
&
(
table
->
in_use
->
variables
.
sql_mode
&
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
|
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
|
MODE_INVALID_DATES
))),
MODE_INVALID_DATES
))),
&
error
)
>
MYSQL_TIMESTAMP_ERROR
)
&
error
);
if
((
int
)
func_res
>
(
int
)
MYSQL_TIMESTAMP_ERROR
)
tmp
=
TIME_to_ulonglong_datetime
(
&
time_tmp
);
tmp
=
TIME_to_ulonglong_datetime
(
&
time_tmp
);
else
error
=
1
;
// Fix if invalid zero date
if
(
error
)
if
(
error
)
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
ER_WARN_DATA_OUT_OF_RANGE
,
...
@@ -7000,8 +7004,10 @@ longlong Field_bit::val_int(void)
...
@@ -7000,8 +7004,10 @@ longlong Field_bit::val_int(void)
{
{
ulonglong
bits
=
0
;
ulonglong
bits
=
0
;
if
(
bit_len
)
if
(
bit_len
)
{
bits
=
get_rec_bits
(
bit_ptr
,
bit_ofs
,
bit_len
);
bits
=
get_rec_bits
(
bit_ptr
,
bit_ofs
,
bit_len
);
bits
<<=
(
field_length
*
8
);
bits
<<=
(
field_length
*
8
);
}
switch
(
field_length
)
{
switch
(
field_length
)
{
case
0
:
return
bits
;
case
0
:
return
bits
;
...
...
sql/handler.cc
View file @
e9205dc0
...
@@ -107,7 +107,8 @@ struct show_table_type_st sys_table_types[]=
...
@@ -107,7 +107,8 @@ struct show_table_type_st sys_table_types[]=
{
"FEDERATED"
,
&
have_federated_db
,
{
"FEDERATED"
,
&
have_federated_db
,
"Federated MySQL storage engine"
,
DB_TYPE_FEDERATED_DB
},
"Federated MySQL storage engine"
,
DB_TYPE_FEDERATED_DB
},
{
"BLACKHOLE"
,
&
have_blackhole_db
,
{
"BLACKHOLE"
,
&
have_blackhole_db
,
"Storage engine designed to act as null storage"
,
DB_TYPE_BLACKHOLE_DB
},
"/dev/null storage engine (anything you write to it disappears)"
,
DB_TYPE_BLACKHOLE_DB
},
{
NullS
,
NULL
,
NullS
,
DB_TYPE_UNKNOWN
}
{
NullS
,
NULL
,
NullS
,
DB_TYPE_UNKNOWN
}
};
};
...
...
sql/item_timefunc.cc
View file @
e9205dc0
...
@@ -160,7 +160,8 @@ static DATE_TIME_FORMAT time_24hrs_format= {{0}, '\0', 0,
...
@@ -160,7 +160,8 @@ static DATE_TIME_FORMAT time_24hrs_format= {{0}, '\0', 0,
static
bool
extract_date_time
(
DATE_TIME_FORMAT
*
format
,
static
bool
extract_date_time
(
DATE_TIME_FORMAT
*
format
,
const
char
*
val
,
uint
length
,
TIME
*
l_time
,
const
char
*
val
,
uint
length
,
TIME
*
l_time
,
timestamp_type
cached_timestamp_type
,
timestamp_type
cached_timestamp_type
,
const
char
**
sub_pattern_end
)
const
char
**
sub_pattern_end
,
const
char
*
date_time_type
)
{
{
int
weekday
=
0
,
yearday
=
0
,
daypart
=
0
;
int
weekday
=
0
,
yearday
=
0
,
daypart
=
0
;
int
week_number
=
-
1
;
int
week_number
=
-
1
;
...
@@ -188,12 +189,12 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
...
@@ -188,12 +189,12 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
for
(;
ptr
!=
end
&&
val
!=
val_end
;
ptr
++
)
for
(;
ptr
!=
end
&&
val
!=
val_end
;
ptr
++
)
{
{
if
(
*
ptr
==
'%'
&&
ptr
+
1
!=
end
)
if
(
*
ptr
==
'%'
&&
ptr
+
1
!=
end
)
{
{
int
val_len
;
int
val_len
;
char
*
tmp
;
char
*
tmp
;
error
=
0
;
/* Skip pre-space between each argument */
/* Skip pre-space between each argument */
while
(
val
!=
val_end
&&
my_isspace
(
cs
,
*
val
))
while
(
val
!=
val_end
&&
my_isspace
(
cs
,
*
val
))
val
++
;
val
++
;
...
@@ -343,16 +344,22 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
...
@@ -343,16 +344,22 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
/* Time in AM/PM notation */
/* Time in AM/PM notation */
case
'r'
:
case
'r'
:
error
=
extract_date_time
(
&
time_ampm_format
,
val
,
/*
(
uint
)(
val_end
-
val
),
l_time
,
We can't just set error here, as we don't want to generate two
cached_timestamp_type
,
&
val
);
warnings in case of errors
*/
if
(
extract_date_time
(
&
time_ampm_format
,
val
,
(
uint
)(
val_end
-
val
),
l_time
,
cached_timestamp_type
,
&
val
,
"time"
))
DBUG_RETURN
(
1
);
break
;
break
;
/* Time in 24-hour notation */
/* Time in 24-hour notation */
case
'T'
:
case
'T'
:
error
=
extract_date_time
(
&
time_24hrs_format
,
val
,
if
(
extract_date_time
(
&
time_24hrs_format
,
val
,
(
uint
)(
val_end
-
val
),
l_time
,
(
uint
)(
val_end
-
val
),
l_time
,
cached_timestamp_type
,
&
val
);
cached_timestamp_type
,
&
val
,
"time"
))
DBUG_RETURN
(
1
);
break
;
break
;
/* Conversion specifiers that match classes of characters */
/* Conversion specifiers that match classes of characters */
...
@@ -471,6 +478,13 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
...
@@ -471,6 +478,13 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
err:
err:
{
char
buff
[
128
];
strmake
(
buff
,
val_begin
,
min
(
length
,
sizeof
(
buff
)
-
1
));
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_WRONG_VALUE_FOR_TYPE
,
ER
(
ER_WRONG_VALUE_FOR_TYPE
),
date_time_type
,
buff
,
"str_to_time"
);
}
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
...
@@ -2972,7 +2986,7 @@ bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
...
@@ -2972,7 +2986,7 @@ bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
date_time_format
.
format
.
str
=
(
char
*
)
format
->
ptr
();
date_time_format
.
format
.
str
=
(
char
*
)
format
->
ptr
();
date_time_format
.
format
.
length
=
format
->
length
();
date_time_format
.
format
.
length
=
format
->
length
();
if
(
extract_date_time
(
&
date_time_format
,
val
->
ptr
(),
val
->
length
(),
if
(
extract_date_time
(
&
date_time_format
,
val
->
ptr
(),
val
->
length
(),
ltime
,
cached_timestamp_type
,
0
))
ltime
,
cached_timestamp_type
,
0
,
"datetime"
))
goto
null_date
;
goto
null_date
;
if
(
cached_timestamp_type
==
MYSQL_TIMESTAMP_TIME
&&
ltime
->
day
)
if
(
cached_timestamp_type
==
MYSQL_TIMESTAMP_TIME
&&
ltime
->
day
)
{
{
...
...
sql/log_event.cc
View file @
e9205dc0
...
@@ -1052,17 +1052,17 @@ bool Query_log_event::write(IO_CACHE* file)
...
@@ -1052,17 +1052,17 @@ bool Query_log_event::write(IO_CACHE* file)
of this x>=4 master segfault (expecting a zero when there is
of this x>=4 master segfault (expecting a zero when there is
none). Remaining compatibility problems are: the older slave will not
none). Remaining compatibility problems are: the older slave will not
find the catalog; but it is will not crash, and it's not an issue
find the catalog; but it is will not crash, and it's not an issue
that it does not find the catalog as catalogs were not used in these
older
that it does not find the catalog as catalogs were not used in these
MySQL versions (we store it in binlog and read it from relay log but do
older MySQL versions (we store it in binlog and read it from relay log
nothing useful with it). What is an issue is that the older slave will
but do nothing useful with it). What is an issue is that the older slave
stop processing the Q_* blocks (and jumps to the db/query) as soon as it
will stop processing the Q_* blocks (and jumps to the db/query) as soon
sees unknown Q_CATALOG_NZ_CODE; so it will not be able to read
as it
sees unknown Q_CATALOG_NZ_CODE; so it will not be able to read
Q_AUTO_INCREMENT*, Q_CHARSET and so replication will fail silently in
Q_AUTO_INCREMENT*, Q_CHARSET and so replication will fail silently in
various ways. Documented that you should not mix alpha/beta versions if
various ways. Documented that you should not mix alpha/beta versions if
they are not exactly the same version, with example of 5.0.3->5.0.2 and
they are not exactly the same version, with example of 5.0.3->5.0.2 and
5.0.4->5.0.3. If replication is from older to new, the new will
5.0.4->5.0.3. If replication is from older to new, the new will
recognize Q_CATALOG_CODE and have no problem.
recognize Q_CATALOG_CODE and have no problem.
*/
*/
}
}
if
(
auto_increment_increment
!=
1
)
if
(
auto_increment_increment
!=
1
)
{
{
...
@@ -1265,7 +1265,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
...
@@ -1265,7 +1265,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
}
}
case
Q_CATALOG_NZ_CODE
:
case
Q_CATALOG_NZ_CODE
:
if
((
catalog_len
=
*
pos
))
if
((
catalog_len
=
*
pos
))
catalog
=
(
char
*
)
pos
+
1
;
// Will be copied later
catalog
=
(
char
*
)
pos
+
1
;
// Will be copied later
pos
+=
catalog_len
+
1
;
pos
+=
catalog_len
+
1
;
break
;
break
;
case
Q_AUTO_INCREMENT
:
case
Q_AUTO_INCREMENT
:
...
@@ -4208,7 +4208,8 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -4208,7 +4208,8 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
goto
err
;
goto
err
;
}
}
}
}
else
if
((
fd
=
my_open
(
fname
,
O_WRONLY
|
O_APPEND
|
O_BINARY
|
O_NOFOLLOW
,
MYF
(
MY_WME
)))
<
0
)
else
if
((
fd
=
my_open
(
fname
,
O_WRONLY
|
O_APPEND
|
O_BINARY
|
O_NOFOLLOW
,
MYF
(
MY_WME
)))
<
0
)
{
{
slave_print_error
(
rli
,
my_errno
,
slave_print_error
(
rli
,
my_errno
,
"Error in %s event: could not open file '%s'"
,
"Error in %s event: could not open file '%s'"
,
...
@@ -4421,7 +4422,8 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -4421,7 +4422,8 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
Load_log_event
*
lev
=
0
;
Load_log_event
*
lev
=
0
;
memcpy
(
p
,
".info"
,
6
);
memcpy
(
p
,
".info"
,
6
);
if
((
fd
=
my_open
(
fname
,
O_RDONLY
|
O_BINARY
|
O_NOFOLLOW
,
MYF
(
MY_WME
)))
<
0
||
if
((
fd
=
my_open
(
fname
,
O_RDONLY
|
O_BINARY
|
O_NOFOLLOW
,
MYF
(
MY_WME
)))
<
0
||
init_io_cache
(
&
file
,
fd
,
IO_SIZE
,
READ_CACHE
,
(
my_off_t
)
0
,
0
,
init_io_cache
(
&
file
,
fd
,
IO_SIZE
,
READ_CACHE
,
(
my_off_t
)
0
,
0
,
MYF
(
MY_WME
|
MY_NABP
)))
MYF
(
MY_WME
|
MY_NABP
)))
{
{
...
...
sql/log_event.h
View file @
e9205dc0
...
@@ -234,11 +234,13 @@ struct sql_ex_info
...
@@ -234,11 +234,13 @@ struct sql_ex_info
/* these are codes, not offsets; not more than 256 values (1 byte). */
/* these are codes, not offsets; not more than 256 values (1 byte). */
#define Q_FLAGS2_CODE 0
#define Q_FLAGS2_CODE 0
#define Q_SQL_MODE_CODE 1
#define Q_SQL_MODE_CODE 1
#ifndef TO_BE_DELETED
/*
/*
Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL
Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL
5.0.x where 0<=x<=3.
5.0.x where 0<=x<=3.
*/
*/
#define Q_CATALOG_CODE 2
#define Q_CATALOG_CODE 2
#endif
#define Q_AUTO_INCREMENT 3
#define Q_AUTO_INCREMENT 3
#define Q_CHARSET_CODE 4
#define Q_CHARSET_CODE 4
#define Q_TIME_ZONE_CODE 5
#define Q_TIME_ZONE_CODE 5
...
...
sql/share/errmsg.txt
View file @
e9205dc0
...
@@ -5334,3 +5334,5 @@ ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR
...
@@ -5334,3 +5334,5 @@ ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR
eng "Can't load value from file with fixed size rows to variable"
eng "Can't load value from file with fixed size rows to variable"
ER_CANT_CREATE_USER_WITH_GRANT 42000
ER_CANT_CREATE_USER_WITH_GRANT 42000
eng "You are not allowed to create a user with GRANT"
eng "You are not allowed to create a user with GRANT"
ER_WRONG_VALUE_FOR_TYPE
eng "Incorrect %-.32s value: '%-.128s' for function %-.32s"
sql/sql_acl.cc
View file @
e9205dc0
...
@@ -2733,7 +2733,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
...
@@ -2733,7 +2733,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
pthread_mutex_lock
(
&
acl_cache
->
lock
);
pthread_mutex_lock
(
&
acl_cache
->
lock
);
error
=
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
error
=
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
0
,
revoke_grant
,
create_new_users
,
0
,
revoke_grant
,
create_new_users
,
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
);
test
(
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
));
pthread_mutex_unlock
(
&
acl_cache
->
lock
);
pthread_mutex_unlock
(
&
acl_cache
->
lock
);
if
(
error
)
if
(
error
)
{
{
...
@@ -2939,7 +2940,8 @@ bool mysql_procedure_grant(THD *thd, TABLE_LIST *table_list,
...
@@ -2939,7 +2940,8 @@ bool mysql_procedure_grant(THD *thd, TABLE_LIST *table_list,
pthread_mutex_lock
(
&
acl_cache
->
lock
);
pthread_mutex_lock
(
&
acl_cache
->
lock
);
error
=
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
error
=
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
0
,
revoke_grant
,
create_new_users
,
0
,
revoke_grant
,
create_new_users
,
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
);
test
(
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
));
pthread_mutex_unlock
(
&
acl_cache
->
lock
);
pthread_mutex_unlock
(
&
acl_cache
->
lock
);
if
(
error
)
if
(
error
)
{
{
...
@@ -3065,7 +3067,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
...
@@ -3065,7 +3067,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
}
if
(
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
if
(
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
(
!
db
?
rights
:
0
),
revoke_grant
,
create_new_users
,
(
!
db
?
rights
:
0
),
revoke_grant
,
create_new_users
,
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
))
test
(
thd
->
variables
.
sql_mode
&
MODE_NO_AUTO_CREATE_USER
)))
result
=
-
1
;
result
=
-
1
;
else
if
(
db
)
else
if
(
db
)
{
{
...
...
sql/sql_show.cc
View file @
e9205dc0
...
@@ -1615,10 +1615,11 @@ typedef struct st_index_field_values
...
@@ -1615,10 +1615,11 @@ typedef struct st_index_field_values
SYNOPSIS
SYNOPSIS
schema_table_store_record()
schema_table_store_record()
thd thread handler
thd thread handler
table I_S table
table Information schema table to be updated
RETURN
RETURN
1 error
0 success
0 success
1 error
*/
*/
static
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
)
static
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
)
...
@@ -1959,7 +1960,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -1959,7 +1960,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
}
}
}
if
(
schema_table_store_record
(
thd
,
table
))
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
error
)
;
goto
err
;
}
}
else
else
{
{
...
...
sql/sql_yacc.yy
View file @
e9205dc0
...
@@ -1398,7 +1398,7 @@ create_function_tail:
...
@@ -1398,7 +1398,7 @@ create_function_tail:
uint unused1= 0;
uint unused1= 0;
int unused2= 0;
int unused2= 0;
if (!(new_field= new_create_field(YYTHD, "",
if (!(new_field= new_create_field(YYTHD,
(char*)
"",
(enum enum_field_types)$8,
(enum enum_field_types)$8,
lex->length, lex->dec, lex->type,
lex->length, lex->dec, lex->type,
(Item *)0, (Item *) 0, &cmt, 0,
(Item *)0, (Item *) 0, &cmt, 0,
...
...
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