mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0 sql/log_event.cc: Auto merged sql/share/errmsg.txt: Auto merged
This commit is contained in:
@ -122,6 +122,7 @@ SET datetime_format=default;
|
||||
--disable_ps_protocol
|
||||
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
||||
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
|
||||
|
||||
create table t1 (date char(30), format char(30) not null);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
set @org_mode=@@sql_mode;
|
||||
set @@sql_mode='ansi,traditional';
|
||||
select @@sql_mode;
|
||||
|
||||
@ -962,3 +963,44 @@ insert into t1 (tinytextcol) values (repeat('x',256));
|
||||
insert into t1 (tinyblobcol) values (repeat('x',256));
|
||||
select * from 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;
|
||||
|
@ -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);
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user