diff options
author | unknown <monty@mysql.com> | 2005-03-30 16:00:31 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-03-30 16:00:31 +0300 |
commit | a5b1b9d92474e4e1e30e7b1a3570cf4531533b03 (patch) | |
tree | 805fffb7b7262d7e59f1fd8969a0c1670de80a88 /mysql-test/t/strict.test | |
parent | a391ef8dda3326a421f804bb34b4be48782a2848 (diff) | |
download | mariadb-git-a5b1b9d92474e4e1e30e7b1a3570cf4531533b03.tar.gz |
Give warnings if wrong date/time/datetime argument for STR_TO_DATE
Small fixes while doing review of new pushed code
More test cases for decimal
mysql-test/r/date_formats.result:
Warnings added for STR_TO_DATE()
mysql-test/r/ps_1general.result:
Better description for BLACKHOLE
mysql-test/r/strict.result:
Added tests for STR_TO_DATE
mysql-test/r/type_decimal.result:
Test to test ranges of DECIMAL
mysql-test/t/date_formats.test:
More tests
mysql-test/t/strict.test:
Added tests for STR_TO_DATE
mysql-test/t/type_decimal.test:
Test to test ranges of DECIMAL
sql/field.cc:
Simple optimization
sql/handler.cc:
Better description for BLACKHOLE
sql/item_timefunc.cc:
Give warnings if wrong date/time/datetime argument for STR_TO_DATE
sql/log_event.cc:
Indentation fixes
sql/log_event.h:
#ifdef-ed not used code
sql/share/errmsg.txt:
New error message
sql/sql_show.cc:
Ensure that we do a proper restore in case of error
Diffstat (limited to 'mysql-test/t/strict.test')
-rw-r--r-- | mysql-test/t/strict.test | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 8af0d632f7c..4c42a173188 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -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; |