From a8a757c6bb32bbf291afdf33df861127489889ab Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 1 Mar 2011 13:24:36 +0100 Subject: wl#173 - temporal types with sub-second resolution and collateral changes. * introduce my_hrtime_t, my_timediff_t, and conversion macros * inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(), never from Item::result_type() * pack_time/unpack_time function for "packed" representation of MYSQL_TIME in a longlong that can be compared * ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values * numbers aren't quoted in EXPLAIN EXTENDED * new column I_S.COLUMNS.DATETIME_PRECISION * date/time values are compares to anything as date/time, not as strings or numbers. * old timestamp(X) is no longer supported * MYSQL_TIME to string conversion functions take precision as an argument * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods * Field_timestamp_hires, Field_datetime_hires, Field_time_hires * Field_temporal * Lazy_string class to pass a value (string, number, time) polymorphically down the stack * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants * removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead * introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong() * in many cases date/time types are treated like other types, not as special cases * greatly simplified Arg_comparator (regarding date/time/year code) * SEC_TO_TIME is real function, not integer. * microsecond precision in NOW, CURTIME, etc * Item_temporal. All items derived from it only provide get_date, but no val* methods * replication of NOW(6) * Protocol::store(time) now takes the precision as an argument * @@TIMESTAMP is a double client/mysqlbinlog.cc: remove unneded casts include/my_sys.h: introduce my_hrtime_t, my_timediff_t, and conversion macros include/my_time.h: pack_time/unpack_time, etc. convenience functions to work with MYSQL_TIME::second_part libmysql/libmysql.c: str_to_time() is gone. str_to_datetime() does it now. my_TIME_to_str() takes the precision as an argument mysql-test/include/ps_conv.inc: time is not equal to datetime anymore mysql-test/r/distinct.result: a test for an old MySQL bug mysql-test/r/explain.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/func_default.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/func_sapdb.result: when decimals=NOT_FIXED_DEC it means "not fixed" indeed mysql-test/r/func_test.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/func_time.result: ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values mysql-test/r/having.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/information_schema.result: new column I_S.COLUMNS.DATETIME_PRECISION mysql-test/r/join_outer.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/metadata.result: TIMESTAMP no longer has zerofill flag mysql-test/r/range.result: invalid datetime is not compared with as a string mysql-test/r/select.result: NO_ZERO_IN_DATE, etc only affect storage - according to the manual numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/subselect.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/sysdate_is_now.result: when decimals=NOT_FIXED_DEC it means "not fixed" indeed mysql-test/r/type_blob.result: TIMESTAMP(N) is not deprecated mysql-test/r/type_timestamp.result: old TIMESTAMP(X) semantics is not supported anymore mysql-test/r/union.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/r/varbinary.result: numbers aren't quoted in EXPLAIN EXTENDED mysql-test/t/distinct.test: test for an old MySQL bug mysql-test/t/func_time.test: +- INTERVAL now works with TIME values mysql-test/t/select.test: typo mysql-test/t/subselect.test: only one error per statement, please mysql-test/t/system_mysql_db_fix40123.test: old timestamp(X) is no longer supported mysql-test/t/system_mysql_db_fix50030.test: old timestamp(X) is no longer supported mysql-test/t/system_mysql_db_fix50117.test: old timestamp(X) is no longer supported mysql-test/t/type_blob.test: old timestamp(X) is no longer supported mysql-test/t/type_timestamp.test: old timestamp(X) is no longer supported mysys/my_getsystime.c: functions to get the time with microsecond precision mysys/my_init.c: move the my_getsystime.c initialization code to my_getsystime.c mysys/my_static.c: no need to make these variables extern mysys/my_static.h: no need to make these variables extern scripts/mysql_system_tables.sql: old timestamp(X) is no longer supported scripts/mysql_system_tables_fix.sql: old timestamp(X) is no longer supported scripts/mysqlhotcopy.sh: old timestamp(X) is no longer supported sql-common/my_time.c: * call str_to_time from str_to_datetime, as appropriate * date/time to string conversions take precision as an argument * number_to_time() * TIME_to_double() * pack_time() and unpack_time() sql/event_data_objects.cc: cast is not needed my_datetime_to_str() takes precision as an argument sql/event_db_repository.cc: avoid dangerous downcast (because the pointer is not always Field_timestamp, see events_1.test) sql/event_queue.cc: avoid silly double-work for cond_wait (having an endpoint of wait, subtract the current time to get the timeout, and use set_timespec() macro to fill in struct timespec, by adding the current time to the timeout) sql/field.cc: * remove virtual Field::get_time(), everyone should use only Field::get_date() * remove lots of #ifdef WORDS_BIGENDIAN * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods * Field_timestamp_hires, Field_datetime_hires, Field_time_hires * Field_temporal * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants sql/field.h: * remove virtual Field::get_time(), everyone should use only Field::get_date() * remove lots of #ifdef WORDS_BIGENDIAN * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods * Field_timestamp_hires, Field_datetime_hires, Field_time_hires * Field_temporal * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants * removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead sql/filesort.cc: TIME_RESULT, cmp_time() sql/item.cc: * numbers aren't quoted in EXPLAIN EXTENDED * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong() * virtual Item::get_time() is gone * Item_param::field_type() is set correctly * Item_datetime, for a datetime constant * time to anything is compared as a time * Item_cache::print() prints the value is available * bug fixed in Item_cache_int::val_str() sql/item.h: * Item::print_value(), to be used from Item_xxx::print() when needed * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong() * virtual Item::get_time() is gone * Item_datetime, for a datetime constant * better default for cast_to_int_type() * Item_cache objects now *always* have the field_type() set sql/item_cmpfunc.cc: * get_year_value, get_time_value are gone. get_datetime_value does it all * get_value_a_func, get_value_b_func are gone * can_compare_as_dates() is gone too, TIME_RESULT is used instead * cmp_type() instead or result_type() when doing a comparison * compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong() sql/item_cmpfunc.h: greatly simplified Arg_comparator sql/item_create.cc: * fix a bug in error messages in CAST sql/item_func.cc: Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong() mention all possibitiles in switch over Item_result values, or use default: sql/item_row.h: overwrite the default cmp_type() for Item_row, as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT sql/item_timefunc.cc: rewrite make_datetime to support precision argument SEC_TO_TIME is real function, not integer. many functions that returned temporal values had duplicate code in val_* methods, some of them did not have get_date() which resulted in unnecessary date->str->date conversions. Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods. many fixes to set decimals (datetime precision) correctly. sql/item_timefunc.h: SEC_TO_TIME is real function, not integer. many functions that returned temporal values had duplicate code in val_* methods, some of them did not have get_date() which resulted in unnecessary date->str->date conversions. Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods. many fixes to set decimals (datetime precision) correctly. sql/log_event.cc: replication of NOW(6) sql/log_event.h: replication of NOW(6) sql/mysql_priv.h: Lazy_string class to pass a value (string, number, time) polymorphically down the stack. make_truncated_value_warning() that uses it. sql/mysqld.cc: datetime in Arg_comparator::comparator_matrix sql/opt_range.cc: cleanup: don't disable warnings before calling save_in_field_no_warnings() sql/protocol.cc: Protocol::store(time) now takes the precision as an argument sql/protocol.h: Protocol::store(time) now takes the precision as an argument sql/rpl_rli.cc: small cleanup sql/set_var.cc: SET TIMESTAMP=double sql/set_var.h: @@TIMESTAMP is a double sql/share/errmsg.txt: precision and scale are unsigned sql/slave.cc: replication of NOW(6) sql/sp_head.cc: cleanup sql/sql_class.cc: support for NOW(6) sql/sql_class.h: support for NOW(6) sql/sql_insert.cc: support for NOW(6) sql/sql_select.cc: use item->cmp_type(). move a comment where it belongs sql/sql_show.cc: new column I_S.COLUMNS.DATETIME_PRECISION sql/sql_yacc.yy: TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc sql/time.cc: fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument storage/myisam/ha_myisam.cc: TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible. strings/my_vsnprintf.c: warnings tests/mysql_client_test.c: old timestamp(X) does not work anymore datetime is no longer equal to time --- mysql-test/r/cast.result | 2 +- mysql-test/r/date_formats.result | 12 +- mysql-test/r/distinct.result | 11 + mysql-test/r/events_1.result | 2 +- mysql-test/r/explain.result | 6 +- mysql-test/r/func_default.result | 2 +- mysql-test/r/func_in.result | 6 - mysql-test/r/func_sapdb.result | 8 +- mysql-test/r/func_test.result | 2 +- mysql-test/r/func_time.result | 109 ++++- mysql-test/r/func_time_hires.result | 151 +++++++ mysql-test/r/having.result | 4 +- mysql-test/r/information_schema.result | 8 +- mysql-test/r/join_outer.result | 2 +- mysql-test/r/loaddata.result | 6 +- mysql-test/r/metadata.result | 2 +- mysql-test/r/parser.result | 4 + mysql-test/r/ps.result | 15 + mysql-test/r/ps_2myisam.result | 364 +++++++++++++++- mysql-test/r/ps_3innodb.result | 364 +++++++++++++++- mysql-test/r/ps_4heap.result | 364 +++++++++++++++- mysql-test/r/ps_5merge.result | 728 +++++++++++++++++++++++++++++-- mysql-test/r/range.result | 14 +- mysql-test/r/select.result | 35 +- mysql-test/r/sp-vars.result | 2 +- mysql-test/r/sp.result | 2 +- mysql-test/r/strict.result | 8 +- mysql-test/r/subselect.result | 18 +- mysql-test/r/sysdate_is_now.result | 2 +- mysql-test/r/type_blob.result | 8 +- mysql-test/r/type_date.result | 26 +- mysql-test/r/type_datetime.result | 45 +- mysql-test/r/type_datetime_hires.result | 211 +++++++++ mysql-test/r/type_time.result | 8 +- mysql-test/r/type_time_hires.result | 147 +++++++ mysql-test/r/type_timestamp.result | 28 +- mysql-test/r/type_timestamp_hires.result | 153 +++++++ mysql-test/r/union.result | 2 +- mysql-test/r/varbinary.result | 2 +- 39 files changed, 2604 insertions(+), 279 deletions(-) create mode 100644 mysql-test/r/func_time_hires.result create mode 100644 mysql-test/r/type_datetime_hires.result create mode 100644 mysql-test/r/type_time_hires.result create mode 100644 mysql-test/r/type_timestamp_hires.result (limited to 'mysql-test/r') diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index dd61396e485..0917c1762f6 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -254,7 +254,7 @@ cast("2001-1-1" as datetime) = "2001-01-01 00:00:00" 1 select cast("1:2:3" as TIME) = "1:02:03"; cast("1:2:3" as TIME) = "1:02:03" -0 +1 select cast(NULL as DATE); cast(NULL as DATE) NULL diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index a919a6f8c5e..386f2246530 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -421,14 +421,14 @@ date format str_to_date 2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 Warnings: -Warning 1292 Incorrect datetime value: '10:20:10AM' +Warning 1292 Truncated incorrect datetime value: '10:20:10AM' select date,format,concat(str_to_date(date, format),'') as con from t1; date format con 10:20:10AM %h:%i:%s 0000-00-00 10:20:10 2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 Warnings: -Warning 1292 Incorrect datetime value: '10:20:10AM' +Warning 1292 Truncated incorrect datetime value: '10:20:10AM' drop table t1; select get_format(DATE, 'USA') as a; a @@ -471,14 +471,14 @@ str_to_date("2003-01-02", "%Y-%m-%d") as f3, str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5; describe t1; Field Type Null Key Default Extra -f1 datetime YES NULL -f2 time YES NULL +f1 datetime(6) YES NULL +f2 time(6) YES NULL f3 date YES NULL f4 date YES NULL f5 time YES NULL select * from t1; f1 f2 f3 f4 f5 -2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00 +2003-01-02 10:11:12.001200 10:11:12.001200 2003-01-02 0000-00-02 58:00:00 drop table t1; create table t1 select "02 10" as a, "%d %H" as b; select str_to_date(a,b) from t1; @@ -495,7 +495,7 @@ str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4, str_to_date("02 10:11:12", "%d %H:%i:%S") as f5, str_to_date("02 10", "%d %f") as f6; f1 f2 f3 f4 f5 f6 -2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12 58:11:12 48:00:00.100000 +2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12.000000 58:11:12 48:00:00.100000 Warnings: Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012' drop table t1, t2; diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index b1cb70fa43c..4bef07b9906 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -794,3 +794,14 @@ DROP TABLE t1; SET @@sort_buffer_size = @old_sort_buffer_size; SET @@max_heap_table_size = @old_max_heap_table_size; End of 5.1 tests +create table t1 (a varchar(100)); +insert t1 values ('2010-10-10'), ('20101010'); +select * from t1 where a = DATE('2010-10-10'); +a +2010-10-10 +20101010 +select distinct a from t1 where a = DATE('2010-10-10'); +a +2010-10-10 +20101010 +drop table t1; diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result index e7b645f5556..efc53ab7246 100644 --- a/mysql-test/r/events_1.result +++ b/mysql-test/r/events_1.result @@ -309,7 +309,7 @@ ERROR HY000: Unknown event 'intact_check' DROP EVENT no_such_event; ERROR HY000: Unknown event 'no_such_event' CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5; -ERROR HY000: Failed to store event name. Error code 2 from storage engine. +ERROR HY000: Failed to store event name. Error code 1 from storage engine. ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8; ERROR HY000: Unknown event 'intact_check_1' ALTER EVENT intact_check_1 RENAME TO intact_check_2; diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 4bc6c0409f3..378032d94c3 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -64,7 +64,7 @@ explain extended select * from v1 where f2=1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select '1' AS `f1`,'1' AS `f2` from `test`.`t1` where 1 +Note 1003 select 1 AS `f1`,1 AS `f2` from `test`.`t1` where 1 explain extended select * from t1 where 0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE @@ -74,7 +74,7 @@ explain extended select * from t1 where 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select '1' AS `f1`,'1' AS `f2` from `test`.`t1` where 1 +Note 1003 select 1 AS `f1`,1 AS `f2` from `test`.`t1` where 1 explain extended select * from t1 having 0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING @@ -84,7 +84,7 @@ explain extended select * from t1 having 1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select '1' AS `f1`,'1' AS `f2` from `test`.`t1` having 1 +Note 1003 select 1 AS `f1`,1 AS `f2` from `test`.`t1` having 1 drop view v1; drop table t1; CREATE TABLE t1(c INT); diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result index a8f59f73e88..872cd324275 100644 --- a/mysql-test/r/func_default.result +++ b/mysql-test/r/func_default.result @@ -8,7 +8,7 @@ explain extended select default(str), default(strnull), default(intg), default(r id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select default('') AS `default(str)`,default('') AS `default(strnull)`,default('0') AS `default(intg)`,default('0') AS `default(rel)` from `test`.`t1` +Note 1003 select default('') AS `default(str)`,default('') AS `default(strnull)`,default(0) AS `default(intg)`,default(0) AS `default(rel)` from `test`.`t1` select * from t1 where str <> default(str); str strnull intg rel 0 0 diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index fdeec2755ca..1edf7fcf613 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -544,15 +544,9 @@ id select_type table type possible_keys key key_len ref rows Extra select f2 from t2 where f2 in ('a','b'); f2 0 -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f2 from t2 where f2 in ('a','b'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'a' -Warning 1292 Truncated incorrect DOUBLE value: 'b' select f2 from t2 where f2 in (1,'b'); f2 0 diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index 87b88692a34..c2d9a5c5ffa 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -113,10 +113,10 @@ subtime("01:00:00.999999", "02:00:00.999998") -00:59:59.999999 select subtime("02:01:01.999999", "01:01:01.999999"); subtime("02:01:01.999999", "01:01:01.999999") -01:00:00.000000 +01:00:00 select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002"); timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002") -838:59:59 +838:59:59.999999 Warnings: Warning 1292 Truncated incorrect time value: '8807:59:59.999999' select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002"); @@ -230,8 +230,8 @@ SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq, TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test; ttt qqq eee rrr -744:00:00 NULL NULL NULL -838:59:59 22:58:58 -22:58:58 NULL --838:59:59 -22:58:58 22:58:58 NULL +838:59:59.999999 22:58:58 -22:58:58 NULL +-838:59:59.999999 -22:58:58 22:58:58 NULL NULL 26:02:02 -26:02:02 NULL 00:00:00 -26:02:02 26:02:02 NULL NULL NULL NULL NULL diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index a97e6869d09..5ac1bd7a0ac 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -87,7 +87,7 @@ explain extended select - a from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select -('1') AS `- a` from `test`.`t1` +Note 1003 select -(1) AS `- a` from `test`.`t1` drop table t1; select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 48e837f180f..54cd79113d4 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -8,20 +8,20 @@ period_add("9602",-12) period_diff(199505,"9404") 199502 13 select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now()); now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now()) -0.000000 0 0 +0 0 0 select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0; from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 -1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112.000000 +1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112 select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), sec_to_time(time_to_sec("0:30:47")/6.21); sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21) -02:30:01 23001.000000 54742 00:04:57 +02:30:01 23001 54742 00:04:57.423510 select sec_to_time(time_to_sec('-838:59:59')); sec_to_time(time_to_sec('-838:59:59')) -838:59:59 select now()-curdate()*1000000-curtime(); now()-curdate()*1000000-curtime() -0.000000 +0 select strcmp(current_timestamp(),concat(current_date()," ",current_time())); strcmp(current_timestamp(),concat(current_date()," ",current_time())) 0 @@ -798,9 +798,7 @@ TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29') 2 select date_add(time,INTERVAL 1 SECOND) from t1; date_add(time,INTERVAL 1 SECOND) -NULL -Warnings: -Warning 1264 Out of range value for column 'time' at row 1 +06:07:09 drop table t1; select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2, last_day('2003-03-32') as f3, last_day('2003-04-01') as f4, @@ -941,10 +939,10 @@ sec_to_time(1) + 0, from_unixtime(1) + 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `now() - now()` double(23,6) NOT NULL DEFAULT '0.000000', - `curtime() - curtime()` double(23,6) NOT NULL DEFAULT '0.000000', - `sec_to_time(1) + 0` double(23,6) DEFAULT NULL, - `from_unixtime(1) + 0` double(23,6) DEFAULT NULL + `now() - now()` double(17,0) NOT NULL DEFAULT '0', + `curtime() - curtime()` double(17,0) NOT NULL DEFAULT '0', + `sec_to_time(1) + 0` double(17,0) DEFAULT NULL, + `from_unixtime(1) + 0` double(17,0) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; SELECT SEC_TO_TIME(3300000); @@ -954,7 +952,7 @@ Warnings: Warning 1292 Truncated incorrect time value: '3300000' SELECT SEC_TO_TIME(3300000)+0; SEC_TO_TIME(3300000)+0 -8385959.000000 +8385959 Warnings: Warning 1292 Truncated incorrect time value: '3300000' SELECT SEC_TO_TIME(3600 * 4294967296); @@ -964,31 +962,31 @@ Warnings: Warning 1292 Truncated incorrect time value: '15461882265600' SELECT TIME_TO_SEC('916:40:00'); TIME_TO_SEC('916:40:00') -3020399 +3020399.999999 Warnings: Warning 1292 Truncated incorrect time value: '916:40:00' SELECT ADDTIME('500:00:00', '416:40:00'); ADDTIME('500:00:00', '416:40:00') -838:59:59 +838:59:59.999999 Warnings: Warning 1292 Truncated incorrect time value: '916:40:00' SELECT ADDTIME('916:40:00', '416:40:00'); ADDTIME('916:40:00', '416:40:00') -838:59:59 +838:59:59.999999 Warnings: Warning 1292 Truncated incorrect time value: '916:40:00' -Warning 1292 Truncated incorrect time value: '1255:39:59' +Warning 1292 Truncated incorrect time value: '1255:39:59.999999' SELECT SUBTIME('916:40:00', '416:40:00'); SUBTIME('916:40:00', '416:40:00') -422:19:59 +422:19:59.999999 Warnings: Warning 1292 Truncated incorrect time value: '916:40:00' SELECT SUBTIME('-916:40:00', '416:40:00'); SUBTIME('-916:40:00', '416:40:00') --838:59:59 +-838:59:59.999999 Warnings: Warning 1292 Truncated incorrect time value: '-916:40:00' -Warning 1292 Truncated incorrect time value: '-1255:39:59' +Warning 1292 Truncated incorrect time value: '-1255:39:59.999999' SELECT MAKETIME(916,0,0); MAKETIME(916,0,0) 838:59:59 @@ -1033,7 +1031,7 @@ SELECT SEC_TO_TIME(CAST(-1 AS UNSIGNED)); SEC_TO_TIME(CAST(-1 AS UNSIGNED)) 838:59:59 Warnings: -Warning 1292 Truncated incorrect time value: '18446744073709551615' +Warning 1292 Truncated incorrect time value: '18446744073709551616' SET NAMES latin1; SET character_set_results = NULL; SHOW VARIABLES LIKE 'character_set_results'; @@ -1218,6 +1216,8 @@ set time_zone= @@global.time_zone; select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL +Warnings: +Error 1411 Incorrect datetime value: '10:00 PM' for function str_to_date create table t1 (field DATE); insert into t1 values ('2006-11-06'); select * from t1 where field < '2006-11-06 04:08:36.0'; @@ -1358,3 +1358,72 @@ Warning 1292 Truncated incorrect time value: '' Warning 1292 Truncated incorrect time value: '' DROP TABLE t1; End of 5.1 tests +select time(' 1 02:03:04') + interval 9 microsecond; +time(' 1 02:03:04') + interval 9 microsecond +26:03:04.000009 +select time(' 1 02:03:04') - interval 9 microsecond; +time(' 1 02:03:04') - interval 9 microsecond +26:03:03.999991 +select time('-1 02:03:04') + interval 9 microsecond; +time('-1 02:03:04') + interval 9 microsecond +-26:03:03.999991 +select time('-1 02:03:04') - interval 9 microsecond; +time('-1 02:03:04') - interval 9 microsecond +-26:03:04.000009 +select time(' 1 02:03:04') + interval '4:4:4' hour_second; +time(' 1 02:03:04') + interval '4:4:4' hour_second +30:07:08 +select time(' 1 02:03:04') - interval '4:4:4' hour_second; +time(' 1 02:03:04') - interval '4:4:4' hour_second +21:59:00 +select time('-1 02:03:04') + interval '4:4:4' hour_second; +time('-1 02:03:04') + interval '4:4:4' hour_second +-21:59:00 +select time('-1 02:03:04') - interval '4:4:4' hour_second; +time('-1 02:03:04') - interval '4:4:4' hour_second +-30:07:08 +select time(' 1 02:03:04') + interval 2 day; +time(' 1 02:03:04') + interval 2 day +74:03:04 +select time(' 1 02:03:04') - interval 2 day; +time(' 1 02:03:04') - interval 2 day +-21:56:56 +select time('-1 02:03:04') + interval 2 day; +time('-1 02:03:04') + interval 2 day +21:56:56 +select time('-1 02:03:04') - interval 2 day; +time('-1 02:03:04') - interval 2 day +-74:03:04 +select cast('131415.123e0' as time); +cast('131415.123e0' as time) +NULL +Warnings: +Warning 1292 Truncated incorrect time value: '131415.123e0' +select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'; +cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' +0 +select least(time('1:2:3'), '01:02:04', null) div 1; +least(time('1:2:3'), '01:02:04', null) div 1 +NULL +select truncate(least(time('1:2:3'), '01:02:04', null), 6); +truncate(least(time('1:2:3'), '01:02:04', null), 6) +NULL +select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1)); +cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1)) +NULL +select unix_timestamp(null); +unix_timestamp(null) +NULL +select truncate(date('2010-40-10'), 6); +truncate(date('2010-40-10'), 6) +NULL +Warnings: +Warning 1292 Incorrect datetime value: '2010-40-10' +select extract(month from '2010-40-50'); +extract(month from '2010-40-50') +NULL +Warnings: +Warning 1292 Incorrect datetime value: '2010-40-50' +select subtime('0000-00-10 10:10:10', '30 10:00:00'); +subtime('0000-00-10 10:10:10', '30 10:00:00') +NULL diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result new file mode 100644 index 00000000000..06ad9374725 --- /dev/null +++ b/mysql-test/r/func_time_hires.result @@ -0,0 +1,151 @@ +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456, time_zone='+03:00'; +select sec_to_time(12345), sec_to_time(12345.6789), sec_to_time(1234567e-2); +sec_to_time(12345) 03:25:45 +sec_to_time(12345.6789) 03:25:45.6789 +sec_to_time(1234567e-2) 03:25:45.670000 +select now(), curtime(0), utc_timestamp(1), utc_time(2), current_time(3), +current_timestamp(4), localtime(5), localtimestamp(6), time_to_sec('12:34:56'), +time_to_sec('12:34:56.789'); +now() 2011-01-01 01:01:01 +curtime(0) 01:01:01 +utc_timestamp(1) 2010-12-31 22:01:01.1 +utc_time(2) 22:01:01.12 +current_time(3) 01:01:01.123 +current_timestamp(4) 2011-01-01 01:01:01.1234 +localtime(5) 2011-01-01 01:01:01.12345 +localtimestamp(6) 2011-01-01 01:01:01.123456 +time_to_sec('12:34:56') 45296 +time_to_sec('12:34:56.789') 45296.789 +select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890')); +sec_to_time(time_to_sec('1:2:3')) 01:02:03 +sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.567890 +select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222)); +time_to_sec(sec_to_time(11111)) 11111 +time_to_sec(sec_to_time(11111.22222)) 11111.22222 +select current_timestamp(7); +ERROR HY000: Incorrect arguments to now +select curtime(7); +ERROR HY000: Incorrect arguments to curtime +drop table if exists t1; +create table t1 select sec_to_time(12345), sec_to_time(12345.6789), +sec_to_time(1234567e-2), now(), curtime(0), +utc_timestamp(1), utc_time(2), current_time(3), +current_timestamp(4), localtime(5), localtimestamp(6), +time_to_sec('12:34:56'), time_to_sec('12:34:56.789'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `sec_to_time(12345)` time DEFAULT NULL, + `sec_to_time(12345.6789)` time(4) DEFAULT NULL, + `sec_to_time(1234567e-2)` time DEFAULT NULL, + `now()` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `curtime(0)` time NOT NULL DEFAULT '00:00:00', + `utc_timestamp(1)` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', + `utc_time(2)` time(2) NOT NULL DEFAULT '00:00:00.00', + `current_time(3)` time(3) NOT NULL DEFAULT '00:00:00.000', + `current_timestamp(4)` datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000', + `localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000', + `localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `time_to_sec('12:34:56')` double DEFAULT NULL, + `time_to_sec('12:34:56.789')` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +sec_to_time(12345) 03:25:45 +sec_to_time(12345.6789) 03:25:45.6789 +sec_to_time(1234567e-2) 03:25:45 +now() 2011-01-01 01:01:01 +curtime(0) 01:01:01 +utc_timestamp(1) 2010-12-31 22:01:01.1 +utc_time(2) 22:01:01.12 +current_time(3) 01:01:01.123 +current_timestamp(4) 2011-01-01 01:01:01.1234 +localtime(5) 2011-01-01 01:01:01.12345 +localtimestamp(6) 2011-01-01 01:01:01.123456 +time_to_sec('12:34:56') 45296 +time_to_sec('12:34:56.789') 45296.789 +drop table t1; +set @a=cast('2011-01-02 12:13:14' as datetime); +select @a + interval 1 minute; +@a + interval 1 minute +2011-01-02 12:14:14 +select @a + interval 10 microsecond; +@a + interval 10 microsecond +2011-01-02 12:13:14.000010 +select @a + interval 10 microsecond + interval 999990 microsecond; +@a + interval 10 microsecond + interval 999990 microsecond +2011-01-02 12:13:15.000000 +set @a='2011-01-02 12:13:14.123456'; +create table t1 select CAST(@a AS DATETIME) as dauto, +CAST(@a AS DATETIME(0)) as d0, +CAST(@a AS DATETIME(1)) as d1, +CAST(@a AS DATETIME(2)) as d2, +CAST(@a AS DATETIME(3)) as d3, +CAST(@a AS DATETIME(4)) as d4, +CAST(@a AS DATETIME(5)) as d5, +CAST(@a AS DATETIME(6)) as d6, +CAST(@a AS TIME) as tauto, +CAST(@a AS TIME(0)) as t0, +CAST(@a AS TIME(1)) as t1, +CAST(@a AS TIME(2)) as t2, +CAST(@a AS TIME(3)) as t3, +CAST(@a AS TIME(4)) as t4, +CAST(@a AS TIME(5)) as t5, +CAST(@a AS TIME(6)) as t6; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dauto` datetime DEFAULT NULL, + `d0` datetime DEFAULT NULL, + `d1` datetime(1) DEFAULT NULL, + `d2` datetime(2) DEFAULT NULL, + `d3` datetime(3) DEFAULT NULL, + `d4` datetime(4) DEFAULT NULL, + `d5` datetime(5) DEFAULT NULL, + `d6` datetime(6) DEFAULT NULL, + `tauto` time DEFAULT NULL, + `t0` time DEFAULT NULL, + `t1` time(1) DEFAULT NULL, + `t2` time(2) DEFAULT NULL, + `t3` time(3) DEFAULT NULL, + `t4` time(4) DEFAULT NULL, + `t5` time(5) DEFAULT NULL, + `t6` time(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +dauto 2011-01-02 12:13:14 +d0 2011-01-02 12:13:14 +d1 2011-01-02 12:13:14.1 +d2 2011-01-02 12:13:14.12 +d3 2011-01-02 12:13:14.123 +d4 2011-01-02 12:13:14.1234 +d5 2011-01-02 12:13:14.12345 +d6 2011-01-02 12:13:14.123456 +tauto 12:13:14 +t0 12:13:14 +t1 12:13:14.1 +t2 12:13:14.12 +t3 12:13:14.123 +t4 12:13:14.1234 +t5 12:13:14.12345 +t6 12:13:14.123456 +drop table t1; +select CAST(@a AS DATETIME(7)); +ERROR 42000: Too big precision 7 specified for column '(@a)'. Maximum is 6. +SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); +CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') +2011-01-02 15:00:00 +SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00'); +CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00') +2011-01-02 15:00:00.123000 +SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00'); +CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00') +2011-01-02 15:00:00.123456 +SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00'); +CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00') +2010-10-10 13:10:10.1234 +create table t1 (a varchar(200)); +insert t1 values (now(6)); +select * from t1; +a +2011-01-01 01:01:01.123456 +drop table t1; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index cd1b4ae0218..298a09eb385 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -472,7 +472,7 @@ HAVING (table2.f2 = 8 AND table1.f1 >= 6); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0 +Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having 0 EXPLAIN EXTENDED SELECT table1.f1, table2.f2 FROM t1 AS table1 @@ -483,7 +483,7 @@ HAVING (table2.f2 = 8); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0 +Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having 0 DROP TABLE t1; # # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 0da9ed40b9a..2372e3d0670 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -189,8 +189,8 @@ Field Type Collation Null Key Default Extra Privileges Comment c varchar(64) utf8_general_ci NO select,insert,update,references select * from information_schema.COLUMNS where table_name="t1" and column_name= "a"; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT -NULL mysqltest t1 a 1 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL mysqltest t1 a 1 NULL YES int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references show columns from mysqltest.t1 where field like "%a%"; Field Type Null Key Default Extra a int(11) YES NULL @@ -1581,9 +1581,9 @@ WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db'; TABLE_COLLATION utf8_bin select * from information_schema.columns where table_schema = NULL; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT select * from `information_schema`.`COLUMNS` where `TABLE_NAME` = NULL; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index d9c4ac5478e..4e6db65eedb 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1302,7 +1302,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2))) +Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce(1,NULL),3) in ((1,3),(2,2))) SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); f1 f2 f3 f1 f2 diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 40c278380b1..c8fb5f26e9a 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -5,8 +5,8 @@ Warnings: Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'd' at row 1 -Warning 1265 Data truncated for column 'a' at row 2 -Warning 1265 Data truncated for column 'b' at row 2 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 2 load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; SELECT * from t1; @@ -20,7 +20,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated Warnings: Warning 1265 Data truncated for column 'c' at row 1 Warning 1265 Data truncated for column 'd' at row 1 -Warning 1265 Data truncated for column 'b' at row 2 +Warning 1264 Out of range value for column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 2 SELECT * from t1; a b c d diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 2f9fb6b67f5..4fa3d2f56fc 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -21,7 +21,7 @@ def test t1 t1 g g 5 4 0 Y 32768 3 63 def test t1 t1 h h 246 7 0 Y 0 4 63 def test t1 t1 i i 13 4 0 Y 32864 0 63 def test t1 t1 j j 10 10 0 Y 128 0 63 -def test t1 t1 k k 7 19 0 N 9441 0 63 +def test t1 t1 k k 7 19 0 N 9377 0 63 def test t1 t1 l l 12 19 0 Y 128 0 63 def test t1 t1 m m 254 1 0 Y 256 0 8 def test t1 t1 n n 254 3 0 Y 2048 0 8 diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 7e703de0876..1f5b359199d 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -556,9 +556,13 @@ DROP TABLE IF EXISTS t1; SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL +Warnings: +Error 1411 Incorrect datetime value: '10:00 PM' for function str_to_date SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE NULL +Warnings: +Error 1411 Incorrect datetime value: '10:00 PM' for function str_to_date SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; "1997-12-31 23:59:59" + INTERVAL 1 SECOND 1998-01-01 00:00:00 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 84c64a3905a..4b2ed10f04d 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3040,3 +3040,18 @@ id select_type table type possible_keys key key_len ref rows Extra DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests. +prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?"; +set @a='2010-11-11'; +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +1 +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +1 +set @a='2010-08-08'; +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +0 +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +0 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 56b18ff4476..1edb636a06f 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -63,8 +63,8 @@ def test t9 t9 c11 c11 246 9 6 Y 0 4 63 def test t9 t9 c12 c12 246 10 6 Y 0 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 -def test t9 t9 c15 c15 7 19 19 N 9441 0 63 -def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 9377 0 63 +def test t9 t9 c16 c16 11 9 8 Y 128 0 63 def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 @@ -2762,46 +2762,212 @@ c12 -9999.9999 execute my_delete ; test_sequence -- insert into string columns -- +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '21' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '23'; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary) ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '31' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary) )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= CAST('33' as binary); +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 41 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 43; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 51.0 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 53.0; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, +5.4e+1, 5.4e+1, 5.4e+1 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.5e+1 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, + 5.6e+1, 5.6e+1, 5.6e+1 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.7e+1; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 from t9 where c1 >= 20 order by c1 ; @@ -2960,70 +3126,200 @@ true delete from t9 ; test_sequence -- insert into date/time columns -- +set @arg00= '1991-01-01 01:01:01' ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', +'1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', + '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 30, CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 32, CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime))" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ; +execute stmt1 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 43, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 1.0e+10 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 53, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 60, NULL, NULL, '1991-01-01 01:01:01', +NULL, NULL) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 62, NULL, NULL, '1991-01-01 01:01:01', + NULL, NULL)" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 @@ -3055,25 +3351,25 @@ test_sequence set @arg00= '1991-01-01 01:01:01' ; select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and -c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01' ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and - c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01'" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; found true set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; @@ -3081,12 +3377,11 @@ select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and -c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime) ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true @@ -3094,14 +3389,43 @@ prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and - c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime)" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= CAST('01:01:01' as time) ; +select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time) ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; found true set @arg00= 1991 ; diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 2cd3b2f5820..60d6eb768c6 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -63,8 +63,8 @@ def test t9 t9 c11 c11 246 9 6 Y 0 4 63 def test t9 t9 c12 c12 246 10 6 Y 0 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 -def test t9 t9 c15 c15 7 19 19 N 9441 0 63 -def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 9377 0 63 +def test t9 t9 c16 c16 11 9 8 Y 128 0 63 def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 @@ -2745,46 +2745,212 @@ c12 -9999.9999 execute my_delete ; test_sequence -- insert into string columns -- +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '21' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '23'; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary) ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '31' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary) )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= CAST('33' as binary); +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 41 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 43; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 51.0 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 53.0; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, +5.4e+1, 5.4e+1, 5.4e+1 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.5e+1 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, + 5.6e+1, 5.6e+1, 5.6e+1 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.7e+1; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 from t9 where c1 >= 20 order by c1 ; @@ -2943,70 +3109,200 @@ true delete from t9 ; test_sequence -- insert into date/time columns -- +set @arg00= '1991-01-01 01:01:01' ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', +'1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', + '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 30, CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 32, CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime))" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ; +execute stmt1 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 43, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 1.0e+10 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 53, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 60, NULL, NULL, '1991-01-01 01:01:01', +NULL, NULL) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 62, NULL, NULL, '1991-01-01 01:01:01', + NULL, NULL)" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 @@ -3038,25 +3334,25 @@ test_sequence set @arg00= '1991-01-01 01:01:01' ; select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and -c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01' ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and - c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01'" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; found true set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; @@ -3064,12 +3360,11 @@ select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and -c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime) ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true @@ -3077,14 +3372,43 @@ prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and - c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime)" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= CAST('01:01:01' as time) ; +select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time) ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; found true set @arg00= 1991 ; diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 414267a5616..e4f715edda0 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -64,8 +64,8 @@ def test t9 t9 c11 c11 246 9 6 Y 0 4 63 def test t9 t9 c12 c12 246 10 6 Y 0 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 -def test t9 t9 c15 c15 7 19 19 N 9441 0 63 -def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 9377 0 63 +def test t9 t9 c16 c16 11 9 8 Y 128 0 63 def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 @@ -2746,46 +2746,212 @@ c12 -9999.9999 execute my_delete ; test_sequence -- insert into string columns -- +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '21' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '23'; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary) ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '31' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary) )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= CAST('33' as binary); +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 41 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 43; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 51.0 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 53.0; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, +5.4e+1, 5.4e+1, 5.4e+1 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.5e+1 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, + 5.6e+1, 5.6e+1, 5.6e+1 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.7e+1; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 from t9 where c1 >= 20 order by c1 ; @@ -2944,70 +3110,200 @@ true delete from t9 ; test_sequence -- insert into date/time columns -- +set @arg00= '1991-01-01 01:01:01' ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', +'1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', + '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 30, CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 32, CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime))" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ; +execute stmt1 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 43, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 1.0e+10 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 53, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 60, NULL, NULL, '1991-01-01 01:01:01', +NULL, NULL) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 62, NULL, NULL, '1991-01-01 01:01:01', + NULL, NULL)" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 @@ -3039,25 +3335,25 @@ test_sequence set @arg00= '1991-01-01 01:01:01' ; select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and -c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01' ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and - c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01'" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; found true set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; @@ -3065,12 +3361,11 @@ select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and -c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime) ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true @@ -3078,14 +3373,43 @@ prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and - c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime)" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= CAST('01:01:01' as time) ; +select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time) ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; found true set @arg00= 1991 ; diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index d9e14374bc5..df931fa1c42 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -106,8 +106,8 @@ def test t9 t9 c11 c11 246 9 6 Y 0 4 63 def test t9 t9 c12 c12 246 10 6 Y 0 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 -def test t9 t9 c15 c15 7 19 19 N 9441 0 63 -def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 9377 0 63 +def test t9 t9 c16 c16 11 9 8 Y 128 0 63 def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 @@ -2682,46 +2682,212 @@ c12 -9999.9999 execute my_delete ; test_sequence -- insert into string columns -- +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '21' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '23'; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary) ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '31' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary) )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= CAST('33' as binary); +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 41 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 43; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 51.0 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 53.0; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, +5.4e+1, 5.4e+1, 5.4e+1 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.5e+1 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, + 5.6e+1, 5.6e+1, 5.6e+1 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.7e+1; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 from t9 where c1 >= 20 order by c1 ; @@ -2880,70 +3046,200 @@ true delete from t9 ; test_sequence -- insert into date/time columns -- +set @arg00= '1991-01-01 01:01:01' ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', +'1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', + '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 30, CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 32, CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime))" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ; +execute stmt1 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 43, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 1.0e+10 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 53, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 60, NULL, NULL, '1991-01-01 01:01:01', +NULL, NULL) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 62, NULL, NULL, '1991-01-01 01:01:01', + NULL, NULL)" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 @@ -2975,25 +3271,25 @@ test_sequence set @arg00= '1991-01-01 01:01:01' ; select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and -c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01' ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and - c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01'" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; found true set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; @@ -3001,12 +3297,11 @@ select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and -c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime) ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true @@ -3014,14 +3309,43 @@ prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and - c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime)" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= CAST('01:01:01' as time) ; +select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time) ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; found true set @arg00= 1991 ; @@ -3128,8 +3452,8 @@ def test t9 t9 c11 c11 246 9 6 Y 0 4 63 def test t9 t9 c12 c12 246 10 6 Y 0 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 -def test t9 t9 c15 c15 7 19 19 N 9441 0 63 -def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 9377 0 63 +def test t9 t9 c16 c16 11 9 8 Y 128 0 63 def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 @@ -5704,46 +6028,212 @@ c12 -9999.9999 execute my_delete ; test_sequence -- insert into string columns -- +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '21' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '23'; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary), CAST('30' as binary), +CAST('30' as binary), CAST('30' as binary) ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= '31' ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary), CAST('32' as binary), + CAST('32' as binary), CAST('32' as binary) )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= CAST('33' as binary); +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 41 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 43; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 51.0 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 53.0; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, +5.4e+1, 5.4e+1, 5.4e+1 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.5e+1 ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, + 5.6e+1, 5.6e+1, 5.6e+1 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 5.7e+1; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c20' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 from t9 where c1 >= 20 order by c1 ; @@ -5902,70 +6392,200 @@ true delete from t9 ; test_sequence -- insert into date/time columns -- +set @arg00= '1991-01-01 01:01:01' ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', +'1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', + '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 30, CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime), +CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 32, CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime), + CAST('1991-01-01 01:01:01' as datetime))" ; +execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ; +execute stmt1 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 43, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 1.0e+10 ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ; +execute stmt1 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 53, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 60, NULL, NULL, '1991-01-01 01:01:01', +NULL, NULL) ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 62, NULL, NULL, '1991-01-01 01:01:01', + NULL, NULL)" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ; +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; c1 c13 c14 c15 c16 c17 20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 @@ -5997,25 +6617,25 @@ test_sequence set @arg00= '1991-01-01 01:01:01' ; select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and -c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01' ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and - c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01'" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; found true set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; @@ -6023,12 +6643,11 @@ select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and -c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime) ; found true select 'true' as found from t9 -where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00 +where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c17= @arg00 ; found true @@ -6036,14 +6655,43 @@ prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 00:00:00' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and - c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime)" ; execute stmt1 ; found true prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= CAST('01:01:01' as time) ; +select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time) ; +found +true +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; found true set @arg00= 1991 ; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index d989896514c..8ece431eee2 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1106,14 +1106,11 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where Warnings: Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price -A1 2005-11-01 08:00:00 1000.000 -A1 2005-11-15 00:00:00 2000.000 Warnings: Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 +Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 0 SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00'; item started price A1 2005-11-01 08:00:00 1000.000 @@ -1122,14 +1119,10 @@ DROP INDEX `PRIMARY` ON t1; EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -Warnings: -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price -A1 2005-11-01 08:00:00 1000.000 -A1 2005-11-15 00:00:00 2000.000 Warnings: -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1 +Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 0 SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00'; item started price A1 2005-11-01 08:00:00 1000.000 @@ -1586,14 +1579,13 @@ str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND str_to_date('2007-20-00', '%Y-%m-%d') <= '' NULL Warnings: -Warning 1292 Truncated incorrect date value: '' Error 1411 Incorrect datetime value: '2007-20-00' for function str_to_date Error 1411 Incorrect datetime value: '2007-20-00' for function str_to_date SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' 1 Warnings: -Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Truncated incorrect date value: '' SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' NULL diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index fb3de514f62..efb549a1494 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2115,8 +2115,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12 SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time Warnings: -Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 1 -Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 1 +Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0 +Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0 SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time DROP TABLE t1,t2; @@ -4093,18 +4093,18 @@ str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT' and '2007/10/20 00:00:00 GMT' 1 Warnings: -Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT' -Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT' +Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT' +Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT' select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6' 1 Warnings: Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT-6' -select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; -str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' +select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'; +str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6' 1 Warnings: -Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6' +Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' 1 @@ -4179,22 +4179,17 @@ Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' 0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34:00' select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20' -0 -Warnings: -Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1 -Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1 +1 set SQL_MODE=DEFAULT; select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' 1 Warnings: -Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Truncated incorrect date value: '' select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20' 0 @@ -4221,18 +4216,18 @@ Warnings: Warning 1292 Truncated incorrect date value: '1' select str_to_date('','%Y-%m-%d') = ''; str_to_date('','%Y-%m-%d') = '' -0 +1 Warnings: Warning 1292 Truncated incorrect date value: '' select str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL; str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL -0 +NULL select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00' -0 +NULL select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL -0 +NULL CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, c22 INT DEFAULT NULL, @@ -4629,8 +4624,6 @@ WHERE int_key IN (SELECT 1 FROM A) HAVING date_nokey = '10:41:7' ORDER BY date_key; date_nokey -Warnings: -Warning 1292 Incorrect date value: '10:41:7' for column 'date_nokey' at row 1 DROP TABLE A,C; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); @@ -4638,7 +4631,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select '1' AS `a`,'1' AS `b` from `test`.`t1` where 1 +Note 1003 select 1 AS `a`,1 AS `b` from `test`.`t1` where 1 SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; a b 1 1 diff --git a/mysql-test/r/sp-vars.result b/mysql-test/r/sp-vars.result index f5420a62f63..2e40d8e5e13 100644 --- a/mysql-test/r/sp-vars.result +++ b/mysql-test/r/sp-vars.result @@ -698,7 +698,7 @@ t1 CREATE TABLE "t1" ( "x" datetime DEFAULT NULL ) Warnings: -Warning 1264 Out of range value for column 'x' at row 1 +Warning 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE p1; --------------------------------------------------------------- diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 2180a23b91a..f4d84508a42 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6484,7 +6484,7 @@ DROP TABLE t1; CALL p1('text'); Warnings: -Warning 1264 Out of range value for column 'v' at row 1 +Warning 1265 Data truncated for column 'v' at row 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 241f4198bf7..7ff739c744a 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -41,7 +41,7 @@ INSERT INTO t1 VALUES('0000-00-00'); ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 INSERT IGNORE INTO t1 VALUES('0000-00-00'); Warnings: -Warning 1265 Data truncated for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('2004-0-30'); INSERT INTO t1 VALUES ('2004-2-30'); ERROR 22007: Incorrect date value: '2004-2-30' for column 'col1' at row 1 @@ -51,7 +51,7 @@ set @@sql_mode='ansi,traditional'; INSERT IGNORE INTO t1 VALUES('2004-02-29'),('2004-13-15'),('0000-00-00'); Warnings: Warning 1265 Data truncated for column 'col1' at row 2 -Warning 1265 Data truncated for column 'col1' at row 3 +Warning 1264 Out of range value for column 'col1' at row 3 select * from t1; col1 2004-01-01 @@ -1155,12 +1155,12 @@ set sql_mode='traditional'; create table t1 (col1 date); insert ignore into t1 values ('0000-00-00'); Warnings: -Warning 1265 Data truncated for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 insert into t1 select * from t1; ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 insert ignore into t1 values ('0000-00-00'); Warnings: -Warning 1265 Data truncated for column 'col1' at row 1 +Warning 1264 Out of range value for column 'col1' at row 1 insert ignore into t1 (col1) values (cast('0000-00-00' as date)); Warnings: Warning 1292 Incorrect datetime value: '0000-00-00' diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index dc40e42275b..803f9a16c03 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1') = 1) +Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select 1) = 1) SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -203,7 +203,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where 2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: -Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt` +Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,2 AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt` select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); a 2 @@ -314,7 +314,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 -Note 1003 select (select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` +Note 1003 select (select 2 from `test`.`t1` where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2` select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -540,13 +540,13 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where multiple equal(1, `test`.`t1`.`numeropost`) EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select '3' AS `numreponse` from `test`.`t1` where (('1' = '1')) +Note 1003 select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; CREATE TABLE t1 (a int(1)); INSERT INTO t1 VALUES (1); @@ -586,7 +586,7 @@ a b select * from t1 where b = (select b from t2 where t1.a = t2.a); a b 2 12 -delete from t1 where b = (select b from t1); +delete from t1 where b in (select b from t1); ERROR HY000: You can't specify target table 't1' for update in FROM clause delete from t1 where b = (select b from t2); ERROR 21000: Subquery returns more than 1 row @@ -735,7 +735,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1)) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 2) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index @@ -4353,13 +4353,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: -Note 1003 select 1 AS `1` from `test`.`t1` where (1,(select 1 from `test`.`t1` group by `test`.`t1`.`a` having ((1) = (1)))) +Note 1003 select 1 AS `1` from `test`.`t1` where (1,(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (1 = (1)))) EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select 1 AS `1` from `test`.`t1` where (1,(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having ((1) = (1)))) +Note 1003 select 1 AS `1` from `test`.`t1` where (1,(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = (1)))) DROP TABLE t1; # # Bug#45061: Incorrectly market field caused wrong result. diff --git a/mysql-test/r/sysdate_is_now.result b/mysql-test/r/sysdate_is_now.result index 1ebbb8c1588..82861436ff6 100644 --- a/mysql-test/r/sysdate_is_now.result +++ b/mysql-test/r/sysdate_is_now.result @@ -1,4 +1,4 @@ set timestamp=1; SELECT sleep(1),NOW()-SYSDATE() as zero; sleep(1) zero -0 0.000000 +0 0 diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index e6fd49b4247..5dcbf71ba88 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -890,13 +890,9 @@ DROP TABLE b15776; CREATE TABLE b15776 (a year(-2)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1 CREATE TABLE b15776 (a timestamp(4294967294)); -Warnings: -Warning 1287 'TIMESTAMP(4294967294)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -DROP TABLE b15776; +ERROR 42000: Too big precision 4294967294 specified for column 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967295)); -Warnings: -Warning 1287 'TIMESTAMP(4294967295)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -DROP TABLE b15776; +ERROR 42000: Too big precision 4294967295 specified for column 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967296)); ERROR 42000: Display width out of range for column 'a' (max = 4294967295) CREATE TABLE b15776 (a timestamp(-1)); diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index dab1d78ba27..7a71da1bd09 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -139,8 +139,8 @@ Warning 1292 Incorrect datetime value: '1311' create table t1 (d date , dt datetime , ts timestamp); insert into t1 values (9912101,9912101,9912101); Warnings: -Warning 1264 Out of range value for column 'd' at row 1 -Warning 1264 Out of range value for column 'dt' at row 1 +Warning 1265 Data truncated for column 'd' at row 1 +Warning 1265 Data truncated for column 'dt' at row 1 Warning 1265 Data truncated for column 'ts' at row 1 insert into t1 values (11111,11111,11111); select * from t1; @@ -204,23 +204,18 @@ SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref i i 4 const 1 Using where; Using index -Warnings: -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 SELECT * FROM t1 WHERE a = '0000-00-00'; a 0000-00-00 0000-00-00 Warnings: -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 0 SELECT * FROM t2 WHERE a = '0000-00-00'; a 0000-00-00 0000-00-00 Warnings: -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 0 INSERT INTO t1 VALUES ('0000-00-00'); ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 SET SQL_MODE=DEFAULT; @@ -242,23 +237,14 @@ SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref i i 4 const 1 Using where; Using index -Warnings: -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1 -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1 SELECT * FROM t1 WHERE a = '1000-00-00'; a -1000-00-00 -1000-00-00 Warnings: -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1 -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 0 SELECT * FROM t2 WHERE a = '1000-00-00'; a -1000-00-00 -1000-00-00 Warnings: -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1 -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1 +Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 0 INSERT INTO t1 VALUES ('1000-00-00'); ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1 SET SQL_MODE=DEFAULT; diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 9b18f250d21..8868a4b1af8 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -52,7 +52,7 @@ t truncate table t1; insert into t1 values("2003-0303 12:13:14"); Warnings: -Warning 1264 Out of range value for column 't' at row 1 +Warning 1265 Data truncated for column 't' at row 1 select * from t1; t 0000-00-00 00:00:00 @@ -115,12 +115,12 @@ create table t1 (t datetime); insert into t1 values (20030102030460),(20030102036301),(20030102240401), (20030132030401),(20031302030401),(100001202030401); Warnings: -Warning 1264 Out of range value for column 't' at row 1 -Warning 1264 Out of range value for column 't' at row 2 -Warning 1264 Out of range value for column 't' at row 3 -Warning 1264 Out of range value for column 't' at row 4 -Warning 1264 Out of range value for column 't' at row 5 -Warning 1264 Out of range value for column 't' at row 6 +Warning 1265 Data truncated for column 't' at row 1 +Warning 1265 Data truncated for column 't' at row 2 +Warning 1265 Data truncated for column 't' at row 3 +Warning 1265 Data truncated for column 't' at row 4 +Warning 1265 Data truncated for column 't' at row 5 +Warning 1265 Data truncated for column 't' at row 6 select * from t1; t 0000-00-00 00:00:00 @@ -134,12 +134,12 @@ insert into t1 values ("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"), ("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00"); Warnings: -Warning 1264 Out of range value for column 't' at row 1 -Warning 1264 Out of range value for column 't' at row 2 -Warning 1264 Out of range value for column 't' at row 3 -Warning 1264 Out of range value for column 't' at row 4 -Warning 1264 Out of range value for column 't' at row 5 -Warning 1264 Out of range value for column 't' at row 6 +Warning 1265 Data truncated for column 't' at row 1 +Warning 1265 Data truncated for column 't' at row 2 +Warning 1265 Data truncated for column 't' at row 3 +Warning 1265 Data truncated for column 't' at row 4 +Warning 1265 Data truncated for column 't' at row 5 +Warning 1265 Data truncated for column 't' at row 6 select * from t1; t 0000-00-00 00:00:00 @@ -151,8 +151,8 @@ t delete from t1; insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer"); Warnings: -Warning 1264 Out of range value for column 't' at row 1 -Warning 1264 Out of range value for column 't' at row 2 +Warning 1265 Data truncated for column 't' at row 1 +Warning 1265 Data truncated for column 't' at row 2 select * from t1 order by t; t 0000-00-00 00:00:00 @@ -170,7 +170,7 @@ dt drop table t1; select cast('2006-12-05 22:10:10' as datetime) + 0; cast('2006-12-05 22:10:10' as datetime) + 0 -20061205221010.000000 +20061205221010 CREATE TABLE t1(a DATETIME NOT NULL); INSERT INTO t1 VALUES ('20060606155555'); SELECT a FROM t1 WHERE a=(SELECT MAX(a) FROM t1) AND (a="20060606155555"); @@ -352,7 +352,7 @@ least(cast('01-01-01' as date), '01-01-02') 2001-01-01 select greatest(cast('01-01-01' as date), '01-01-02'); greatest(cast('01-01-01' as date), '01-01-02') -01-01-02 +2001-01-02 select least(cast('01-01-01' as date), '01-01-02') + 0; least(cast('01-01-01' as date), '01-01-02') + 0 20010101 @@ -423,11 +423,11 @@ f1 2001-01-01 00:00:00 2002-02-02 00:00:00 Warnings: -Warning 1292 Incorrect datetime value: '2002010' for column 'f1' at row 1 +Warning 1292 Incorrect datetime value: '2002010' for column 'f1' at row 0 select * from t1 where f1 between 20020101 and 2007010100000; f1 Warnings: -Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1 +Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 0 drop table t1; # # Bug#27216: functions with parameters of different date types may @@ -497,7 +497,8 @@ select * from t1 where (convert(f1,datetime)) != 1; f1 15:44:44 Warnings: -Warning 1292 Incorrect datetime value: '0000-00-00 45:44:44' +Warning 1292 Truncated incorrect datetime value: '45:44:44' +Warning 1292 Truncated incorrect datetime value: '1' drop table t1; create table t1 (a tinyint); insert into t1 values (), (), (); @@ -517,7 +518,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from `test`.`t1` where ('1',(select 1 from `test`.`t1` `x1` where 0)) +Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from `test`.`t1` where (1,(select 1 from `test`.`t1` `x1` where 0)) select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); id cur_date @@ -529,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 -Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` where ('1',(select 1 from `test`.`t2` `x1` where 0)) +Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` where (1,(select 1 from `test`.`t2` `x1` where 0)) select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); id cur_date diff --git a/mysql-test/r/type_datetime_hires.result b/mysql-test/r/type_datetime_hires.result new file mode 100644 index 00000000000..14325224a67 --- /dev/null +++ b/mysql-test/r/type_datetime_hires.result @@ -0,0 +1,211 @@ +drop table if exists t1, t2, t3; +create table t1 (a datetime(7)); +ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. +create table t1 (a datetime(3)); +insert t1 values ('2010-12-11 01:02:03.4567'); +insert t1 values (20101211010203.45678); +insert t1 values (20101211030405.789e0); +insert t1 values (99991231235959e1); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +2010-12-11 01:02:03.456 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +0000-00-00 00:00:00.000 +select truncate(a, 6) from t1; +truncate(a, 6) +20101211010203.457031 +20101211010203.457031 +20101211030405.789062 +0.000000 +select a DIV 1 from t1; +a DIV 1 +20101211010203 +20101211010203 +20101211030405 +0 +select group_concat(distinct a) from t1; +group_concat(distinct a) +2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,0000-00-00 00:00:00.000 +alter table t1 engine=innodb; +select * from t1; +a +2010-12-11 01:02:03.456 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +0000-00-00 00:00:00.000 +drop table t1; +create table t1 (a datetime(4)) engine=innodb; +insert t1 values ('2010-12-11 01:02:03.456789'); +select * from t1; +a +2010-12-11 01:02:03.4567 +select extract(microsecond from a + interval 100 microsecond) from t1 where a>'2010-11-12 01:02:03.456'; +extract(microsecond from a + interval 100 microsecond) +456800 +select a from t1 where a>'2010-11-12 01:02:03.456' group by a; +a +2010-12-11 01:02:03.4567 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` datetime(4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show columns from t1; +Field Type Null Key Default Extra +a datetime(4) YES NULL +select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1'; +table_name t1 +column_name a +column_default NULL +is_nullable YES +data_type datetime +character_maximum_length NULL +character_octet_length NULL +numeric_precision NULL +numeric_scale NULL +datetime_precision 4 +character_set_name NULL +collation_name NULL +column_type datetime(4) +column_key +extra +select a, a+interval 9876543 microsecond from t1; +a a+interval 9876543 microsecond +2010-12-11 01:02:03.4567 2010-12-11 01:02:13.333243 +update t1 set a=a+interval 9876543 microsecond; +select * from t1; +a +2010-12-11 01:02:13.3332 +insert t1 select a + interval 2 year from t1; +select * from t1; +a +2010-12-11 01:02:13.3332 +2012-12-11 01:02:13.3332 +delete from t1 where a < 20110101; +select * from t1; +a +2012-12-11 01:02:13.3332 +create table t2 select * from t1; +create table t3 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` datetime(4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1, t2, t3; +create table t1 (a datetime(6), b datetime(6)); +create procedure foo(x datetime, y datetime(4)) insert into t1 values (x, y); +call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123'); +select * from t1; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +create procedure bar(a int, c datetime(5)) +begin +declare b datetime(4); +set b = c + interval a microsecond; +insert t1 values (b, c + interval a microsecond); +end| +call bar(1111111, '2011-01-02 3:4:5.123456'); +select * from t1; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 +drop procedure foo; +drop procedure bar; +create function xyz(s char(20)) returns datetime(4) +return addtime('2010-10-10 10:10:10.101010', s); +select xyz('1:1:1.010101'); +xyz('1:1:1.010101') +2010-10-10 11:11:11.1111 +drop function xyz; +create view v1 as select * from t1 group by a,b; +select * from v1; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 +show columns from v1; +Field Type Null Key Default Extra +a datetime(6) YES NULL +b datetime(6) YES NULL +create table t2 select * from v1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop view v1; +drop table t1, t2; +CREATE TABLE t1 ( +taken datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00', +id int(11) NOT NULL DEFAULT '0', +PRIMARY KEY (id,taken), +KEY taken (taken) +) +PARTITION BY RANGE (to_days(taken)) +( +PARTITION p01 VALUES LESS THAN (732920), +PARTITION p02 VALUES LESS THAN (732950), +PARTITION p03 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES +('2006-09-27 21:50:01.123456',0), +('2006-09-27 21:50:01.123456',1), +('2006-09-27 21:50:01.123456',2), +('2006-09-28 21:50:01.123456',3), +('2006-09-29 21:50:01.123456',4), +('2006-09-29 21:50:01.123456',5), +('2006-09-30 21:50:01.123456',6), +('2006-10-01 21:50:01.123456',7), +('2006-10-02 21:50:01.123456',8), +('2006-10-02 21:50:01.123456',9); +SELECT id,to_days(taken) FROM t1 order by 2; +id to_days(taken) +0 732946 +1 732946 +2 732946 +3 732947 +5 732948 +4 732948 +6 732949 +7 732950 +8 732951 +9 732951 +CREATE TABLE t2 ( +taken datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00', +id int(11) NOT NULL DEFAULT '0', +PRIMARY KEY (id,taken), +KEY taken (taken) +) +PARTITION BY RANGE (extract(microsecond from taken)) +( +PARTITION p01 VALUES LESS THAN (123000), +PARTITION p02 VALUES LESS THAN (500000), +PARTITION p03 VALUES LESS THAN MAXVALUE); +INSERT INTO t2 VALUES +('2006-09-27 21:50:01',0), +('2006-09-27 21:50:01.1',1), +('2006-09-27 21:50:01.12',2), +('2006-09-28 21:50:01.123',3), +('2006-09-29 21:50:01.1234',4), +('2006-09-29 21:50:01.12345',5), +('2006-09-30 21:50:01.123456',6), +('2006-10-01 21:50:01.56',7), +('2006-10-02 21:50:01.567',8), +('2006-10-02 21:50:01.5678',9); +select table_name,partition_name,partition_method,partition_expression,partition_description,table_rows from information_schema.partitions where table_name in ('t1', 't2'); +table_name partition_name partition_method partition_expression partition_description table_rows +t1 p01 RANGE to_days(taken) 732920 0 +t1 p02 RANGE to_days(taken) 732950 7 +t1 p03 RANGE to_days(taken) MAXVALUE 3 +t2 p01 RANGE extract(microsecond from taken) 123000 3 +t2 p02 RANGE extract(microsecond from taken) 500000 4 +t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3 +drop table t1, t2; diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 86712bebfa1..de04a21c9f7 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -26,7 +26,7 @@ t insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a"); Warnings: Warning 1265 Data truncated for column 't' at row 1 -Warning 1264 Out of range value for column 't' at row 2 +Warning 1265 Data truncated for column 't' at row 2 Warning 1264 Out of range value for column 't' at row 3 Warning 1264 Out of range value for column 't' at row 4 Warning 1265 Data truncated for column 't' at row 6 @@ -148,3 +148,9 @@ TIMESTAMP(f1,'1') NULL DROP TABLE t1; End of 5.1 tests +create table t1 (a time); +insert t1 values (-131415); +select * from t1; +a +-13:14:15 +drop table t1; diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result new file mode 100644 index 00000000000..c4f63d76e45 --- /dev/null +++ b/mysql-test/r/type_time_hires.result @@ -0,0 +1,147 @@ +drop table if exists t1, t2, t3; +create table t1 (a time(7)); +ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. +create table t1 (a time(3)); +insert t1 values ('2010-12-11 01:02:03.4567'); +insert t1 values (20101211010203.45678); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +insert t1 values (20101211030405.789e0); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +insert t1 values (99991231235959e1); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +select * from t1; +a +01:02:03.456 +838:59:59.999 +838:59:59.999 +838:59:59.999 +select truncate(a, 6) from t1; +truncate(a, 6) +10203.456000 +8385959.999000 +8385959.999000 +8385959.999000 +select a DIV 1 from t1; +a DIV 1 +10203 +8385959 +8385959 +8385959 +select group_concat(distinct a) from t1; +group_concat(distinct a) +01:02:03.456,838:59:59.999 +alter table t1 engine=innodb; +select * from t1; +a +01:02:03.456 +838:59:59.999 +838:59:59.999 +838:59:59.999 +drop table t1; +create table t1 (a time(4)) engine=innodb; +insert t1 values ('2010-12-11 01:02:03.456789'); +select * from t1; +a +01:02:03.4567 +select extract(microsecond from a + interval 100 microsecond) from t1 where a>'2010-11-12 01:02:03.456'; +extract(microsecond from a + interval 100 microsecond) +select a from t1 where a>'2010-11-12 01:02:03.456' group by a; +a +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` time(4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show columns from t1; +Field Type Null Key Default Extra +a time(4) YES NULL +select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1'; +table_name t1 +column_name a +column_default NULL +is_nullable YES +data_type time +character_maximum_length NULL +character_octet_length NULL +numeric_precision NULL +numeric_scale NULL +datetime_precision 4 +character_set_name NULL +collation_name NULL +column_type time(4) +column_key +extra +select a, a+interval 9876543 microsecond from t1; +a a+interval 9876543 microsecond +01:02:03.4567 01:02:13.333243 +update t1 set a=a+interval 9876543 microsecond; +select * from t1; +a +01:02:13.3332 +insert t1 select a + interval 2 year from t1; +select * from t1; +a +01:02:13.3332 +01:02:13.3332 +delete from t1 where a < 20110101; +select * from t1; +a +create table t2 select * from t1; +create table t3 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` time(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` time(4) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1, t2, t3; +create table t1 (a time(6), b time(6)); +create procedure foo(x time, y time(4)) insert into t1 values (x, y); +call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123'); +select * from t1; +a b +04:05:06.000000 04:05:06.789100 +create procedure bar(a int, c time(5)) +begin +declare b time(4); +set b = c + interval a microsecond; +insert t1 values (b, c + interval a microsecond); +end| +call bar(1111111, '2011-01-02 3:4:5.123456'); +select * from t1; +a b +04:05:06.000000 04:05:06.789100 +03:04:06.234500 03:04:06.234561 +drop procedure foo; +drop procedure bar; +create function xyz(s char(20)) returns time(4) +return addtime('2010-10-10 10:10:10.101010', s); +select xyz('1:1:1.010101'); +xyz('1:1:1.010101') +11:11:11.1111 +drop function xyz; +create view v1 as select * from t1 group by a,b; +select * from v1; +a b +03:04:06.234500 03:04:06.234561 +04:05:06.000000 04:05:06.789100 +show columns from v1; +Field Type Null Key Default Extra +a time(6) YES NULL +b time(6) YES NULL +create table t2 select * from v1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` time(6) DEFAULT NULL, + `b` time(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop view v1; +drop table t1, t2; diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index e88d3462466..8876e534247 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -97,30 +97,6 @@ date date_time time_stamp 2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00 2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00 drop table t1; -create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6), -t8 timestamp(8), t10 timestamp(10), t12 timestamp(12), -t14 timestamp(14)); -Warnings: -Warning 1287 'TIMESTAMP(2)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -Warning 1287 'TIMESTAMP(4)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -Warning 1287 'TIMESTAMP(6)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -Warning 1287 'TIMESTAMP(8)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -Warning 1287 'TIMESTAMP(10)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -Warning 1287 'TIMESTAMP(12)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -Warning 1287 'TIMESTAMP(14)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead -insert t1 values (0,0,0,0,0,0,0), -("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59", -"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59", -"1997-12-31 23:47:59"); -select * from t1; -t2 t4 t6 t8 t10 t12 t14 -0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 -1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 -select * from t1; -t2 t4 t6 t8 t10 t12 t14 -0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 -1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 -drop table t1; create table t1 (ix timestamp); insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000); Warnings: @@ -436,12 +412,12 @@ max(t) 2004-02-01 00:00:00 drop table t1; set sql_mode='maxdb'; -create table t1 (a timestamp, b timestamp(19)); +create table t1 (a timestamp, b timestamp(5)); show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" datetime DEFAULT NULL, - "b" datetime DEFAULT NULL + "b" datetime(5) DEFAULT NULL ) set sql_mode=''; drop table t1; diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result new file mode 100644 index 00000000000..43510d9e65f --- /dev/null +++ b/mysql-test/r/type_timestamp_hires.result @@ -0,0 +1,153 @@ +drop table if exists t1, t2, t3; +create table t1 (a timestamp(7)); +ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. +create table t1 (a timestamp(3)); +insert t1 values ('2010-12-11 01:02:03.4567'); +insert t1 values (20101211010203.45678); +insert t1 values (20101211030405.789e0); +insert t1 values (99991231235959e1); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +2010-12-11 01:02:03.456 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +0000-00-00 00:00:00.000 +select truncate(a, 6) from t1; +truncate(a, 6) +20101211010203.457031 +20101211010203.457031 +20101211030405.789062 +0.000000 +select a DIV 1 from t1; +a DIV 1 +20101211010203 +20101211010203 +20101211030405 +0 +select group_concat(distinct a) from t1; +group_concat(distinct a) +2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,0000-00-00 00:00:00.000 +alter table t1 engine=innodb; +select * from t1; +a +2010-12-11 01:02:03.456 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +0000-00-00 00:00:00.000 +drop table t1; +create table t1 (a timestamp(4)) engine=innodb; +insert t1 values ('2010-12-11 01:02:03.456789'); +select * from t1; +a +2010-12-11 01:02:03.4567 +select extract(microsecond from a + interval 100 microsecond) from t1 where a>'2010-11-12 01:02:03.456'; +extract(microsecond from a + interval 100 microsecond) +456800 +select a from t1 where a>'2010-11-12 01:02:03.456' group by a; +a +2010-12-11 01:02:03.4567 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show columns from t1; +Field Type Null Key Default Extra +a timestamp(4) NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1'; +table_name t1 +column_name a +column_default CURRENT_TIMESTAMP +is_nullable NO +data_type timestamp +character_maximum_length NULL +character_octet_length NULL +numeric_precision NULL +numeric_scale NULL +datetime_precision 4 +character_set_name NULL +collation_name NULL +column_type timestamp(4) +column_key +extra on update CURRENT_TIMESTAMP +select a, a+interval 9876543 microsecond from t1; +a a+interval 9876543 microsecond +2010-12-11 01:02:03.4567 2010-12-11 01:02:13.333243 +update t1 set a=a+interval 9876543 microsecond; +select * from t1; +a +2010-12-11 01:02:13.3332 +insert t1 select a + interval 2 year from t1; +select * from t1; +a +2010-12-11 01:02:13.3332 +2012-12-11 01:02:13.3332 +delete from t1 where a < 20110101; +select * from t1; +a +2012-12-11 01:02:13.3332 +create table t2 select * from t1; +create table t3 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1, t2, t3; +create table t1 (a timestamp(6), b timestamp(6)); +create procedure foo(x timestamp, y timestamp(4)) insert into t1 values (x, y); +call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123'); +select * from t1; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +create procedure bar(a int, c timestamp(5)) +begin +declare b timestamp(4); +set b = c + interval a microsecond; +insert t1 values (b, c + interval a microsecond); +end| +call bar(1111111, '2011-01-02 3:4:5.123456'); +select * from t1; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 +drop procedure foo; +drop procedure bar; +create function xyz(s char(20)) returns timestamp(4) +return addtime('2010-10-10 10:10:10.101010', s); +select xyz('1:1:1.010101'); +xyz('1:1:1.010101') +2010-10-10 11:11:11.1111 +drop function xyz; +create view v1 as select * from t1 group by a,b; +select * from v1; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 +show columns from v1; +Field Type Null Key Default Extra +a timestamp(6) NO 0000-00-00 00:00:00.000000 +b timestamp(6) NO 0000-00-00 00:00:00.000000 +create table t2 select * from v1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop view v1; +drop table t1, t2; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456, time_zone='+03:00'; +create table t1 (a timestamp(5)); +insert t1 values (); +select * from t1; +a +2011-01-01 01:01:01.12345 +drop table t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 1ee313a2b46..f1aab949677 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -522,7 +522,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 UNION t2 const PRIMARY PRIMARY 4 const 1 100.00 NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 (select '1' AS `a`,'1' AS `b` from `test`.`t1` where ('1' = 1)) union (select '1' AS `a`,'10' AS `b` from `test`.`t2` where ('1' = 1)) +Note 1003 (select 1 AS `a`,1 AS `b` from `test`.`t1` where (1 = 1)) union (select 1 AS `a`,10 AS `b` from `test`.`t2` where (1 = 1)) (select * from t1 where a=5) union (select * from t2 where a=1); a b 1 10 diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result index b623ea1d86e..545044fc520 100644 --- a/mysql-test/r/varbinary.result +++ b/mysql-test/r/varbinary.result @@ -15,7 +15,7 @@ explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 const UNIQ UNIQ 8 const 1 100.00 Warnings: -Note 1003 select '00000001' AS `ID`,'004084688022709641610' AS `UNIQ` from `test`.`t1` where 1 +Note 1003 select 00000001 AS `ID`,004084688022709641610 AS `UNIQ` from `test`.`t1` where 1 drop table t1; select x'hello'; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1 -- cgit v1.2.1 From 19a3c29d64e050a4ab99621856455361ffe56eb0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 7 Mar 2011 16:27:49 +0100 Subject: lp:730627 TIME_to_ulonglong: Assertion `0' failed in 5.1-micro on wrong argument to MAKETIME correct the return value of Item_func_maketime::get_date() --- mysql-test/r/func_time.result | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 54cd79113d4..bfbc33b6cab 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1427,3 +1427,6 @@ Warning 1292 Incorrect datetime value: '2010-40-50' select subtime('0000-00-10 10:10:10', '30 10:00:00'); subtime('0000-00-10 10:10:10', '30 10:00:00') NULL +select maketime(20,61,10)+0; +maketime(20,61,10)+0 +NULL -- cgit v1.2.1 From 30e5b4d7196eb56ef3032f016823ecaae2207680 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 7 Mar 2011 21:57:17 +0100 Subject: lp:730637 - Valgrind warnings in 5.1-micro sql/field.cc: initialize ltime completely sql/filesort.cc: don't pack MYSQL_TIME if it's not initialized (safe here, but valgrind complains) sql/item_cmpfunc.cc: don't pack MYSQL_TIME if it's not initialized (safe here, but valgrind complains) sql/item_timefunc.cc: don't check MYSQL_TIME members if it's uninitialized (safe here, but valgrind complains) sql/time.cc: use c_ptr_safe() instead of c_ptr() (make valgrind happy) --- mysql-test/r/func_time.result | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index bfbc33b6cab..bc0fc98cd54 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1427,6 +1427,22 @@ Warning 1292 Incorrect datetime value: '2010-40-50' select subtime('0000-00-10 10:10:10', '30 10:00:00'); subtime('0000-00-10 10:10:10', '30 10:00:00') NULL +select cast(str_to_date(NULL, '%H:%i:%s') as time); +cast(str_to_date(NULL, '%H:%i:%s') as time) +NULL +create table t1 (a timestamp,key(a)); +insert t1 values ('2010-01-01 02:03:04'); +insert t1 select a + interval 1 day from t1; +insert t1 select a + interval 2 day from t1; +insert t1 select a + interval 4 day from t1; +insert t1 select a + interval 8 day from t1; +insert t1 select a + interval 16 day from t1; +explain select * from t1 where a > cast('2010-10-00 01:02:03' as datetime); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a a 4 NULL 32 Using where; Using index +Warnings: +Warning 1292 Incorrect datetime value: '2010-10-00 01:02:03' for column 'a' at row 1 +drop table t1; select maketime(20,61,10)+0; maketime(20,61,10)+0 NULL -- cgit v1.2.1 From b27b5793a0d812cb2be535eadd280134efab22a5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 7 Mar 2011 23:19:26 +0100 Subject: followup for lp:730637 mysql-test/t/func_time.test: fixed wrong test case sql-common/my_time.c: negative datetime is invalid. fix check_date() to reflect that. --- mysql-test/r/func_time.result | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index bc0fc98cd54..654ab0f7351 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1430,18 +1430,14 @@ NULL select cast(str_to_date(NULL, '%H:%i:%s') as time); cast(str_to_date(NULL, '%H:%i:%s') as time) NULL -create table t1 (a timestamp,key(a)); -insert t1 values ('2010-01-01 02:03:04'); -insert t1 select a + interval 1 day from t1; -insert t1 select a + interval 2 day from t1; -insert t1 select a + interval 4 day from t1; -insert t1 select a + interval 8 day from t1; -insert t1 select a + interval 16 day from t1; -explain select * from t1 where a > cast('2010-10-00 01:02:03' as datetime); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index a a 4 NULL 32 Using where; Using index +create table t1 (f1 datetime, key (f1)); +insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49'); +select * from t1 where f1 > time('-23:00:06'); +f1 +2000-09-12 00:00:00 +2007-04-25 05:08:49 Warnings: -Warning 1292 Incorrect datetime value: '2010-10-00 01:02:03' for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '-23:00:06' for column 'f1' at row 1 drop table t1; select maketime(20,61,10)+0; maketime(20,61,10)+0 -- cgit v1.2.1 From 2c80662d231414eb98b5cd4cede069d1482ccc20 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Mar 2011 10:14:43 +0100 Subject: lp:731103 Assertion `maybe_null && item->null_value' failed with ORDER BY LAST_DAY() Item_func_last_day did not set mayby_null=1 --- mysql-test/r/func_time.result | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 654ab0f7351..781d2bf3e97 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -812,7 +812,7 @@ create table t1 select last_day('2000-02-05') as a, from_days(to_days("960101")) as b; describe t1; Field Type Null Key Default Extra -a date NO 0000-00-00 +a date YES NULL b date YES NULL select * from t1; a b @@ -1442,3 +1442,29 @@ drop table t1; select maketime(20,61,10)+0; maketime(20,61,10)+0 NULL +create table t1 (f2 int not null) ; +insert into t1 values (0),(0); +select last_day(f2) from t1; +last_day(f2) +NULL +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +select last_day(f2) from t1 where last_day(f2) is null; +last_day(f2) +NULL +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +select * from t1 order by last_day (f2); +f2 +0 +0 +Warnings: +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +drop table t1; -- cgit v1.2.1 From 8b7fd8f577fe3edc84eea54288c7d30775a1559b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Mar 2011 19:41:58 +0100 Subject: lp:731124 Loss of precision on DISTINCT many changes: * NOT_FIXED_DEC now create hires fields, not old ones. As a result, temp tables preserve microseconds (on DISTINCT, GROUP BY) * I_S tables force decimals=0 on temporal types (backward compatibility) * Item_func_coalesce calculates decimals for temporal types * no precision for TIME/DATETIME in CAST means 0, not NOT_FIXED_DEC * addtime/timediff calculate decimals from arguments (not NOT_FIXED_DEC) sql/field.h: NOT_FIXED_DEC now create hires fields, not old ones sql/item.h: force decimals=0 for I_S tables sql/item_cmpfunc.cc: Item_func_coalesce calculates decimals for temporal types sql/item_create.cc: no precision for TIME/DATETIME in CAST means 0, not NOT_FIXED_DEC sql/item_timefunc.cc: addtime calculates decimals from arguments (not NOT_FIXED_DEC) sql/item_timefunc.h: timediff calculates decimals from arguments (not NOT_FIXED_DEC) --- mysql-test/r/date_formats.result | 10 +++++----- mysql-test/r/distinct.result | 13 +++++++++++++ mysql-test/r/func_sapdb.result | 18 +++++++++--------- mysql-test/r/func_time_hires.result | 4 ++-- 4 files changed, 29 insertions(+), 16 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 386f2246530..dd346cb94dc 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -196,16 +196,16 @@ date format datetime 0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02 03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 -2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450 -2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 -2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 10:20:10 %H:%i:%s 0000-00-00 10:20:10 10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10 10:20:10 %T 0000-00-00 10:20:10 10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10 10:20:10AM %r 0000-00-00 10:20:10 -10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 15 September 2001 %d %M %Y 2001-09-15 00:00:00 15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00 @@ -487,7 +487,7 @@ str_to_date(a,b) create table t2 select str_to_date(a,b) from t1; describe t2; Field Type Null Key Default Extra -str_to_date(a,b) datetime YES NULL +str_to_date(a,b) datetime(6) YES NULL select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1, str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2, str_to_date("2003-01-02", "%Y-%m-%d") as f3, diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 4bef07b9906..f0de0e68c28 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -805,3 +805,16 @@ a 2010-10-10 20101010 drop table t1; +create table t1 (f1 varchar(40)); +insert into t1 values ('2010-10-10 00:00:00.0001'),('2010-10-10 00:00:00.0002'),('2010-10-10 00:00:00.0003'); +select time(f1) from t1 ; +time(f1) +00:00:00.000100 +00:00:00.000200 +00:00:00.000300 +select distinct time(f1) from t1 ; +time(f1) +00:00:00.000100 +00:00:00.000200 +00:00:00.000300 +drop table t1; diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index c2d9a5c5ffa..f7a388237e8 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -195,17 +195,17 @@ time("1997-12-31 23:59:59.000001") as f9; describe t1; Field Type Null Key Default Extra f1 date YES NULL -f2 datetime YES NULL -f3 time YES NULL -f4 time YES NULL -f5 time YES NULL +f2 datetime(6) YES NULL +f3 time(6) YES NULL +f4 time(6) YES NULL +f5 time(6) YES NULL f6 time YES NULL -f7 datetime YES NULL +f7 datetime(6) YES NULL f8 date YES NULL -f9 time YES NULL +f9 time(6) YES NULL select * from t1; f1 f2 f3 f4 f5 f6 f7 f8 f9 -1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -24:00:00 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59 +1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 8275:29:36.710655 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001 create table test(t1 datetime, t2 time, t3 time, t4 datetime); insert into test values ('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'), @@ -230,8 +230,8 @@ SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq, TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test; ttt qqq eee rrr -744:00:00 NULL NULL NULL -838:59:59.999999 22:58:58 -22:58:58 NULL --838:59:59.999999 -22:58:58 22:58:58 NULL +838:59:59 22:58:58 -22:58:58 NULL +-838:59:59 -22:58:58 22:58:58 NULL NULL 26:02:02 -26:02:02 NULL 00:00:00 -26:02:02 26:02:02 NULL NULL NULL NULL NULL diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 06ad9374725..0fe79c65882 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -37,7 +37,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `sec_to_time(12345)` time DEFAULT NULL, `sec_to_time(12345.6789)` time(4) DEFAULT NULL, - `sec_to_time(1234567e-2)` time DEFAULT NULL, + `sec_to_time(1234567e-2)` time(6) DEFAULT NULL, `now()` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `curtime(0)` time NOT NULL DEFAULT '00:00:00', `utc_timestamp(1)` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', @@ -52,7 +52,7 @@ t1 CREATE TABLE `t1` ( select * from t1; sec_to_time(12345) 03:25:45 sec_to_time(12345.6789) 03:25:45.6789 -sec_to_time(1234567e-2) 03:25:45 +sec_to_time(1234567e-2) 03:25:45.670000 now() 2011-01-01 01:01:01 curtime(0) 01:01:01 utc_timestamp(1) 2010-12-31 22:01:01.1 -- cgit v1.2.1 From 743b6f866b3fdc7a40e5b3e81228be61353aeba6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Mar 2011 22:01:40 +0100 Subject: lp:731229 Different results depending on table access method with TIME column and CURDATE() issue a warning when a datetime is truncated for storing in a TIME column. this automatically prevents optimizer from using indexes when comparing time column to a datetime --- mysql-test/r/ps_2myisam.result | 8 ++++++++ mysql-test/r/ps_3innodb.result | 8 ++++++++ mysql-test/r/ps_4heap.result | 8 ++++++++ mysql-test/r/ps_5merge.result | 16 ++++++++++++++++ mysql-test/r/type_time.result | 13 +++++++++++++ mysql-test/r/type_time_hires.result | 13 +++++++++++++ 6 files changed, 66 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 1edb636a06f..6df671de88c 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -3134,6 +3134,7 @@ values '1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3141,6 +3142,7 @@ values ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3150,6 +3152,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3158,6 +3161,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; insert into t9 @@ -3170,6 +3174,7 @@ CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3177,6 +3182,7 @@ values ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3189,6 +3195,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3197,6 +3204,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= 2000000000 ; insert into t9 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 60d6eb768c6..7563a9c223b 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -3117,6 +3117,7 @@ values '1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3124,6 +3125,7 @@ values ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3133,6 +3135,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3141,6 +3144,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; insert into t9 @@ -3153,6 +3157,7 @@ CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3160,6 +3165,7 @@ values ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3172,6 +3178,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3180,6 +3187,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= 2000000000 ; insert into t9 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index e4f715edda0..70bcc2d6d4d 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -3118,6 +3118,7 @@ values '1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3125,6 +3126,7 @@ values ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3134,6 +3136,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3142,6 +3145,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; insert into t9 @@ -3154,6 +3158,7 @@ CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3161,6 +3166,7 @@ values ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3173,6 +3179,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3181,6 +3188,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= 2000000000 ; insert into t9 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index df931fa1c42..87d587b69da 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -3054,6 +3054,7 @@ values '1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3061,6 +3062,7 @@ values ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3070,6 +3072,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3078,6 +3081,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; insert into t9 @@ -3090,6 +3094,7 @@ CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3097,6 +3102,7 @@ values ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3109,6 +3115,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -3117,6 +3124,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= 2000000000 ; insert into t9 @@ -6400,6 +6408,7 @@ values '1991-01-01 01:01:01', '1991-01-01 01:01:01') ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -6407,6 +6416,7 @@ values ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -6416,6 +6426,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -6424,6 +6435,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; insert into t9 @@ -6436,6 +6448,7 @@ CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime)) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -6443,6 +6456,7 @@ values ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -6455,6 +6469,7 @@ values execute stmt1 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -6463,6 +6478,7 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 set @arg00= 2000000000 ; insert into t9 diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index de04a21c9f7..797ee706fb9 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -1,6 +1,8 @@ drop table if exists t1; create table t1 (t time); insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34"); +Warnings: +Note 1265 Data truncated for column 't' at row 13 insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32"); select * from t1; t @@ -154,3 +156,14 @@ select * from t1; a -13:14:15 drop table t1; +create table t1 (f1 time , f2 varchar(5), key(f1)); +insert into t1 values ('00:20:01','a'),('00:20:03','b'); +select * from t1 force key (f1) where f1 < curdate(); +f1 f2 +00:20:01 a +00:20:03 b +select * from t1 ignore key (f1) where f1 < curdate(); +f1 f2 +00:20:01 a +00:20:03 b +drop table t1; diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result index c4f63d76e45..c6bcc2b9651 100644 --- a/mysql-test/r/type_time_hires.result +++ b/mysql-test/r/type_time_hires.result @@ -3,6 +3,8 @@ create table t1 (a time(7)); ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. create table t1 (a time(3)); insert t1 values ('2010-12-11 01:02:03.4567'); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 insert t1 values (20101211010203.45678); Warnings: Warning 1264 Out of range value for column 'a' at row 1 @@ -43,6 +45,8 @@ a drop table t1; create table t1 (a time(4)) engine=innodb; insert t1 values ('2010-12-11 01:02:03.456789'); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 select * from t1; a 01:02:03.4567 @@ -82,6 +86,8 @@ select * from t1; a 01:02:13.3332 insert t1 select a + interval 2 year from t1; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 select * from t1; a 01:02:13.3332 @@ -105,6 +111,9 @@ drop table t1, t2, t3; create table t1 (a time(6), b time(6)); create procedure foo(x time, y time(4)) insert into t1 values (x, y); call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123'); +Warnings: +Note 1265 Data truncated for column 'x' at row 1 +Note 1265 Data truncated for column 'y' at row 1 select * from t1; a b 04:05:06.000000 04:05:06.789100 @@ -115,6 +124,8 @@ set b = c + interval a microsecond; insert t1 values (b, c + interval a microsecond); end| call bar(1111111, '2011-01-02 3:4:5.123456'); +Warnings: +Note 1265 Data truncated for column 'c' at row 1 select * from t1; a b 04:05:06.000000 04:05:06.789100 @@ -126,6 +137,8 @@ return addtime('2010-10-10 10:10:10.101010', s); select xyz('1:1:1.010101'); xyz('1:1:1.010101') 11:11:11.1111 +Warnings: +Note 1265 Data truncated for column 'xyz('1:1:1.010101')' at row 1 drop function xyz; create view v1 as select * from t1 group by a,b; select * from v1; -- cgit v1.2.1 From 3c6ff364ca31c9b8bc14f5fe583cd60ee5516bfd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 9 Mar 2011 11:59:47 +0100 Subject: lp:731815 Crash/valgrind warning Item::send with 5.1-micro Two problems: * Item_func_convert_tz() did not tell args[0] that it needs TIME_NO_ZERO_IN_DATE result * Item_func_timediff did not respect fuzzy_date limitations, truncated seconds when casting to signed long, resulting in invalid time value (hours, seconds = (uint)-1). --- mysql-test/r/func_time.result | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 781d2bf3e97..b5c35d40a0f 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1468,3 +1468,11 @@ Warnings: Warning 1292 Incorrect datetime value: '0' Warning 1292 Incorrect datetime value: '0' drop table t1; +select timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)); +timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-596523:14:07' +select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); +convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow') +NULL -- cgit v1.2.1 From a169ede155937cba04b01ea104d7904d89f87007 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2011 11:54:36 +0100 Subject: lp:736358 Unexpected increased timestamp resolution with UNION partial fix --- mysql-test/r/func_time_hires.result | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 0fe79c65882..f96815a6977 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -149,3 +149,21 @@ select * from t1; a 2011-01-01 01:01:01.123456 drop table t1; +create table t1 (f1 timestamp(6)); +insert into t1 values ('2002-07-15 21:00:00'); +select time(f1) from t1; +time(f1) +21:00:00.000000 +select time(f1) from t1 union all select time(f1) from t1; +time(f1) +21:00:00.000000 +21:00:00.000000 +alter table t1 modify f1 varchar(100); +select time(f1) from t1; +time(f1) +21:00:00 +select time(f1) from t1 union all select time(f1) from t1; +time(f1) +21:00:00.000000 +21:00:00.000000 +drop table t1; -- cgit v1.2.1 From 1cda2654578b82da52c29a829d463955f8795cc9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2011 14:13:03 +0100 Subject: * fix for ALTER TABLE ... MODIFY timestamp->timestamp. Use dedicated do_field_temporal() for Copy_field. * check_time_range() needs to know TIME's precision to use the correct max value. --- mysql-test/r/func_time_hires.result | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index f96815a6977..4a3dc9b5d5c 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -158,6 +158,14 @@ select time(f1) from t1 union all select time(f1) from t1; time(f1) 21:00:00.000000 21:00:00.000000 +alter table t1 modify f1 timestamp; +select time(f1) from t1; +time(f1) +21:00:00 +select time(f1) from t1 union all select time(f1) from t1; +time(f1) +21:00:00 +21:00:00 alter table t1 modify f1 varchar(100); select time(f1) from t1; time(f1) -- cgit v1.2.1 From d72f05fc5b330c3507b44538d5e5559a2c70288a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2011 15:57:04 +0100 Subject: lp:736791 Crash in make_truncated_value_warningwith LEAST()/GREATEST/COALESCE and a test case for lp:736370 Datetime functions in subquery context cause wrong result --- mysql-test/r/func_time.result | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index b5c35d40a0f..5ee050e5cba 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1476,3 +1476,21 @@ Warning 1292 Truncated incorrect time value: '-596523:14:07' select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow') NULL +create table t1 (f1 integer, f2 date); +insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'); +select * from t1 where (f1, f2) in (select f1, makedate(2011 , 125) from t1); +f1 f2 +1 2011-05-05 +2 2011-05-05 +3 2011-05-05 +4 2011-05-05 +5 2011-05-05 +drop table t1; +create table t1 (f1 timestamp); +insert into t1 values ('0000-00-00 00:00:00'); +select least(1, f1) from t1; +least(1, f1) +0000-00-00 00:00:00 +Warnings: +Warning 1292 Incorrect datetime value: '1' for column 'f1' at row 1 +drop table t1; -- cgit v1.2.1 From 256185c50d5f8ccfa05abf07129fc7bbc7a15991 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2011 18:19:47 +0100 Subject: lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micro Don't cache temporal value in an Item_string, it is compared differently. --- mysql-test/r/func_time.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 5ee050e5cba..964828c6c7e 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1478,7 +1478,7 @@ convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetim NULL create table t1 (f1 integer, f2 date); insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'); -select * from t1 where (f1, f2) in (select f1, makedate(2011 , 125) from t1); +select * from t1 where 1 and concat(f2)=MAKEDATE(2011, 125); f1 f2 1 2011-05-05 2 2011-05-05 -- cgit v1.2.1 From 684405e74126c81545f62338322d40b8f2975ca4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2011 22:04:45 +0100 Subject: lp:737092 Assertion `item->null_value' failed in get_datetime_value in 5.1-micro Implement Item_func_coalesce::get_date() --- mysql-test/r/func_time.result | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 964828c6c7e..94bca821504 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1494,3 +1494,6 @@ least(1, f1) Warnings: Warning 1292 Incorrect datetime value: '1' for column 'f1' at row 1 drop table t1; +select now() > coalesce(time('21:43:24'), date('2010-05-03')); +now() > coalesce(time('21:43:24'), date('2010-05-03')) +1 -- cgit v1.2.1 From 1a963822c80ada2ea82a8a07c09870070fb6a820 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2011 22:38:34 +0100 Subject: lp:737104 Crash in DTCollation::set in 5.1-micro and a different fix for lp:736370 cache temporal expression in Item_cache_int, not in Item_string. invoke get_datetime_value() to create a correct Item_cache_int. Implement Item_cache_int::clone, as it's a proper constant --- mysql-test/r/func_time.result | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 94bca821504..67d14ee1c07 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1497,3 +1497,7 @@ drop table t1; select now() > coalesce(time('21:43:24'), date('2010-05-03')); now() > coalesce(time('21:43:24'), date('2010-05-03')) 1 +create table t1 (f1 timestamp); +select * from t1 where f1 > f1 and f1 <=> timestampadd(hour, 9 , '2010-01-01 16:55:35'); +f1 +drop table t1; -- cgit v1.2.1 From 5ff5c4b8a32a74501aace277766df4c336c62157 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2011 13:43:33 +0100 Subject: lp:737111 Different behavior for TIMESTAMPADD with 0000-00-00 argument in 5.1-micro respect fuzzydate flags in Item_*::get_date() methods --- mysql-test/r/func_time.result | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 67d14ee1c07..8f96a9ff5d9 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1501,3 +1501,14 @@ create table t1 (f1 timestamp); select * from t1 where f1 > f1 and f1 <=> timestampadd(hour, 9 , '2010-01-01 16:55:35'); f1 drop table t1; +create table t1 (f1 date); +insert into t1 values ('0000-00-00'); +select timestampadd(week, 1, f1) from t1; +timestampadd(week, 1, f1) +NULL +select timestampadd(week, 1, date("0000-00-00")); +timestampadd(week, 1, date("0000-00-00")) +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +drop table t1; -- cgit v1.2.1 From db9c46de40549d26fd71e43cee38355f5141c549 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2011 13:50:39 +0100 Subject: number to time comparison --- mysql-test/r/func_time.result | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 8f96a9ff5d9..1ada270b326 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1358,6 +1358,21 @@ Warning 1292 Truncated incorrect time value: '' Warning 1292 Truncated incorrect time value: '' DROP TABLE t1; End of 5.1 tests +select time('10:10:10') > 10; +time('10:10:10') > 10 +1 +select time('10:10:10') > 1010; +time('10:10:10') > 1010 +1 +select time('10:10:09') > 101010; +time('10:10:09') > 101010 +0 +select time('10:10:10') > 101010; +time('10:10:10') > 101010 +0 +select time('10:10:11') > 101010; +time('10:10:11') > 101010 +1 select time(' 1 02:03:04') + interval 9 microsecond; time(' 1 02:03:04') + interval 9 microsecond 26:03:04.000009 -- cgit v1.2.1 From 6998bacfb34ba23c3298510ec86ff7e4b06b9261 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2011 14:52:20 +0100 Subject: lp:737458 Casting dates and times into integers works differently in 5.1-micro better default for Field::cast_to_int_type() --- mysql-test/r/cast.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 0917c1762f6..2d65f8816e7 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -452,3 +452,9 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1 1 DROP TABLE t1; End of 5.1 tests +create table t1 (f1 time, f2 date, f3 datetime); +insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33'); +select cast(f1 as unsigned), cast(f2 as unsigned), cast(f3 as unsigned) from t1; +cast(f1 as unsigned) cast(f2 as unsigned) cast(f3 as unsigned) +112233 20111213 20111213112233 +drop table t1; -- cgit v1.2.1 From 5122e43a935a75a232b08b39e14b01e892bebb7e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2011 19:23:32 +0100 Subject: lp:737450 Second Assertion `item->null_value' failed in 5.1-micro implement Item_func_min_max::get_date() --- mysql-test/r/func_time.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 1ada270b326..039640a5036 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1527,3 +1527,9 @@ NULL Warnings: Warning 1292 Incorrect datetime value: '0000-00-00' drop table t1; +create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp); +insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00'); +select least(greatest(f3, f2, f4), f5) from t1; +least(greatest(f3, f2, f4), f5) +0000-00-00 00:00:00 +drop table t1; -- cgit v1.2.1 From c629477981cc491a12c3664b81f9fb33db00e481 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2011 19:29:52 +0100 Subject: lp:737474 Wrong result with DAY(COALESCE(NULL)) in 5.1-micro fix the return value of Item_func_coalesce::get_date() --- mysql-test/r/func_time.result | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 039640a5036..75c57c34171 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1533,3 +1533,6 @@ select least(greatest(f3, f2, f4), f5) from t1; least(greatest(f3, f2, f4), f5) 0000-00-00 00:00:00 drop table t1; +select day(coalesce(null)); +day(coalesce(null)) +NULL -- cgit v1.2.1 From e79a72a410ef74e5105616da8eceb2798f485c57 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2011 19:45:00 +0100 Subject: lp:737496 Assertion `(was_cut & 1) == 0' failed in Field_temporal::store_TIME_with_warning() in 5.1-micro fix incorrect assert --- mysql-test/r/type_date.result | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 7a71da1bd09..846225be141 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -283,3 +283,8 @@ the_date the_time the_date the_time DROP TABLE t1; DROP VIEW v1; End of 5.1 tests +create table t1 (f1 date, key (f1)); +insert t1 values ('2010-10-10 15:foobar'); +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +drop table t1; -- cgit v1.2.1 From a67bf98f02237e39a475bedc362e8fc28dbe44fb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 19 Mar 2011 14:54:46 +0100 Subject: lp:738067 Crash in get_datetime_value() in 5.1-micro --- mysql-test/r/func_time.result | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 75c57c34171..9e04078f1ee 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1536,3 +1536,6 @@ drop table t1; select day(coalesce(null)); day(coalesce(null)) NULL +select timestamp(greatest('2002-08-20', '0000-00-00 00:00:00')); +timestamp(greatest('2002-08-20', '0000-00-00 00:00:00')) +2002-08-20 00:00:00 -- cgit v1.2.1 From 299b29b27300f7c4c6600deaf077a98e322fdc86 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 19 Mar 2011 15:19:05 +0100 Subject: lp:738091 cast(timestamp() AS time returns NULL for 0000-00-00 00:00:00 in 5.1-micro --- mysql-test/r/func_time.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 9e04078f1ee..0b20b7e9b61 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1539,3 +1539,9 @@ NULL select timestamp(greatest('2002-08-20', '0000-00-00 00:00:00')); timestamp(greatest('2002-08-20', '0000-00-00 00:00:00')) 2002-08-20 00:00:00 +create table t1 (f1 datetime); +insert into t1 values ('0000-00-00 00:00:00'); +select cast(f1 AS time) from t1; +cast(f1 AS time) +00:00:00 +drop table t1; -- cgit v1.2.1 From e2d71ef3e661b1d3f8225c8ed289fe198d84b21f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 19 Mar 2011 15:49:36 +0100 Subject: ps-protocol fix --- mysql-test/r/func_time.result | 5 ----- 1 file changed, 5 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 0b20b7e9b61..9d494619068 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1483,11 +1483,6 @@ Warnings: Warning 1292 Incorrect datetime value: '0' Warning 1292 Incorrect datetime value: '0' drop table t1; -select timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)); -timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)) --838:59:59.999999 -Warnings: -Warning 1292 Truncated incorrect time value: '-596523:14:07' select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow') NULL -- cgit v1.2.1 From 8d2738367efc79a0adf5dfbb159de3d2ec84d6f1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 23 Mar 2011 13:31:06 +0100 Subject: lp:740173 5.1-micro reports incorrect Length metadata for TIME expressions --- mysql-test/r/metadata.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 4fa3d2f56fc..e209193a2c0 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -210,3 +210,9 @@ f1 DROP VIEW v1; DROP TABLE t1; End of 5.0 tests +select cast('01:01:01' as time), cast('01:01:01' as time(2)); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def cast('01:01:01' as time) 11 9 8 Y 128 0 63 +def cast('01:01:01' as time(2)) 11 12 11 Y 128 2 63 +cast('01:01:01' as time) cast('01:01:01' as time(2)) +01:01:01 01:01:01.00 -- cgit v1.2.1 From 8de6199b164fe6616db056465b75b318bd5f8a4a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 29 Mar 2011 14:48:48 +0200 Subject: lp:743017 Diverging results with TIME(3) and ranges depending on the execution plan in 5.1-micro rewrite get_innobase_type_from_mysql_type() to use types as reported by the Field objects, instead of relying on ad-hoc assumptions. --- mysql-test/r/type_datetime_hires.result | 27 ++++++++++++++++----------- mysql-test/r/type_time_hires.result | 21 ++++++++++++++------- mysql-test/r/type_timestamp_hires.result | 27 ++++++++++++++++----------- 3 files changed, 46 insertions(+), 29 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/type_datetime_hires.result b/mysql-test/r/type_datetime_hires.result index 14325224a67..095519cda94 100644 --- a/mysql-test/r/type_datetime_hires.result +++ b/mysql-test/r/type_datetime_hires.result @@ -1,8 +1,9 @@ drop table if exists t1, t2, t3; create table t1 (a datetime(7)); ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. -create table t1 (a datetime(3)); -insert t1 values ('2010-12-11 01:02:03.4567'); +create table t1 (a datetime(3), key(a)); +insert t1 values ('2010-12-11 00:20:03.1234'); +insert t1 values ('2010-12-11 15:47:11.1234'); insert t1 values (20101211010203.45678); insert t1 values (20101211030405.789e0); insert t1 values (99991231235959e1); @@ -10,32 +11,36 @@ Warnings: Warning 1265 Data truncated for column 'a' at row 1 select * from t1; a -2010-12-11 01:02:03.456 +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 2010-12-11 01:02:03.456 2010-12-11 03:04:05.789 -0000-00-00 00:00:00.000 +2010-12-11 15:47:11.123 select truncate(a, 6) from t1; truncate(a, 6) -20101211010203.457031 +0.000000 +20101211002003.121094 20101211010203.457031 20101211030405.789062 -0.000000 +20101211154711.121094 select a DIV 1 from t1; a DIV 1 -20101211010203 +0 +20101211002003 20101211010203 20101211030405 -0 +20101211154711 select group_concat(distinct a) from t1; group_concat(distinct a) -2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,0000-00-00 00:00:00.000 +0000-00-00 00:00:00.000,2010-12-11 00:20:03.123,2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,2010-12-11 15:47:11.123 alter table t1 engine=innodb; select * from t1; a -2010-12-11 01:02:03.456 +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 2010-12-11 01:02:03.456 2010-12-11 03:04:05.789 -0000-00-00 00:00:00.000 +2010-12-11 15:47:11.123 drop table t1; create table t1 (a datetime(4)) engine=innodb; insert t1 values ('2010-12-11 01:02:03.456789'); diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result index c6bcc2b9651..10ef9d3f3f3 100644 --- a/mysql-test/r/type_time_hires.result +++ b/mysql-test/r/type_time_hires.result @@ -1,8 +1,11 @@ drop table if exists t1, t2, t3; create table t1 (a time(7)); ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. -create table t1 (a time(3)); -insert t1 values ('2010-12-11 01:02:03.4567'); +create table t1 (a time(3), key(a)); +insert t1 values ('2010-12-11 00:20:03.1234'); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +insert t1 values ('2010-12-11 15:47:11.1234'); Warnings: Note 1265 Data truncated for column 'a' at row 1 insert t1 values (20101211010203.45678); @@ -16,29 +19,33 @@ Warnings: Warning 1264 Out of range value for column 'a' at row 1 select * from t1; a -01:02:03.456 +00:20:03.123 +15:47:11.123 838:59:59.999 838:59:59.999 838:59:59.999 select truncate(a, 6) from t1; truncate(a, 6) -10203.456000 +2003.123000 +154711.123000 8385959.999000 8385959.999000 8385959.999000 select a DIV 1 from t1; a DIV 1 -10203 +2003 +154711 8385959 8385959 8385959 select group_concat(distinct a) from t1; group_concat(distinct a) -01:02:03.456,838:59:59.999 +00:20:03.123,15:47:11.123,838:59:59.999 alter table t1 engine=innodb; select * from t1; a -01:02:03.456 +00:20:03.123 +15:47:11.123 838:59:59.999 838:59:59.999 838:59:59.999 diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result index 43510d9e65f..ade5354304b 100644 --- a/mysql-test/r/type_timestamp_hires.result +++ b/mysql-test/r/type_timestamp_hires.result @@ -1,8 +1,9 @@ drop table if exists t1, t2, t3; create table t1 (a timestamp(7)); ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. -create table t1 (a timestamp(3)); -insert t1 values ('2010-12-11 01:02:03.4567'); +create table t1 (a timestamp(3), key(a)); +insert t1 values ('2010-12-11 00:20:03.1234'); +insert t1 values ('2010-12-11 15:47:11.1234'); insert t1 values (20101211010203.45678); insert t1 values (20101211030405.789e0); insert t1 values (99991231235959e1); @@ -10,32 +11,36 @@ Warnings: Warning 1265 Data truncated for column 'a' at row 1 select * from t1; a -2010-12-11 01:02:03.456 +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 2010-12-11 01:02:03.456 2010-12-11 03:04:05.789 -0000-00-00 00:00:00.000 +2010-12-11 15:47:11.123 select truncate(a, 6) from t1; truncate(a, 6) -20101211010203.457031 +0.000000 +20101211002003.121094 20101211010203.457031 20101211030405.789062 -0.000000 +20101211154711.121094 select a DIV 1 from t1; a DIV 1 -20101211010203 +0 +20101211002003 20101211010203 20101211030405 -0 +20101211154711 select group_concat(distinct a) from t1; group_concat(distinct a) -2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,0000-00-00 00:00:00.000 +0000-00-00 00:00:00.000,2010-12-11 00:20:03.123,2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,2010-12-11 15:47:11.123 alter table t1 engine=innodb; select * from t1; a -2010-12-11 01:02:03.456 +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 2010-12-11 01:02:03.456 2010-12-11 03:04:05.789 -0000-00-00 00:00:00.000 +2010-12-11 15:47:11.123 drop table t1; create table t1 (a timestamp(4)) engine=innodb; insert t1 values ('2010-12-11 01:02:03.456789'); -- cgit v1.2.1 From a7ff7918a055a8dbae10c59279b2d9ee7f5c07e0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 18 Apr 2011 21:01:49 +0200 Subject: lp:750117 Bogus warning with aggregate and datetime column implement Item_cache_int::getdate() and Item_cache_int::save_in_field() that handle the case of the cached packed datetime value. --- mysql-test/r/range.result | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 8ece431eee2..a472772a7e9 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1659,3 +1659,9 @@ c_key c_notkey 3 3 DROP TABLE t1; End of 5.1 tests +create table t1 (f1 datetime, key (f1)); +insert into t1 values ('2000-03-09 15:56:59'),('2000-05-05 23:24:28'),('2000-06-13 13:12:06'); +select min(f1) from t1 where f1 >= '2006-05-25 07:00:20' and f1 between '2003-11-23 10:00:09' and '2010-01-01 01:01:01' and f1 > '2001-01-01 01:01:01'; +min(f1) +NULL +drop table t1; -- cgit v1.2.1 From 8ddcd0cda8e6e90a58e9ea64f0f3773ea0037f0b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 19 May 2011 19:01:46 +0200 Subject: post-review changes 1 include/my_time.h: remove duplicate defines. cast to ulonglong to avoid overflow sql/field.cc: perform sign extension when reading packed TIME values sql/item_cmpfunc.cc: when converting a string to a date for the purpose of comparing it with another date, we should ignore strict sql mode. sql/item_timefunc.cc: better error message sql/item_timefunc.h: limit decimals appropriately sql/share/errmsg.txt: don't refer to an object as a "column" in error messages that are used not only for columns. --- mysql-test/r/func_sapdb.result | 2 +- mysql-test/r/func_time.result | 7 +- mysql-test/r/func_time_hires.result | 18 ++--- mysql-test/r/select.result | 32 +++++--- mysql-test/r/type_blob.result | 4 +- mysql-test/r/type_date.result | 12 +-- mysql-test/r/type_datetime_hires.result | 132 ++++++++++++++++++++++++++++++- mysql-test/r/type_decimal.result | 2 +- mysql-test/r/type_float.result | 2 +- mysql-test/r/type_newdecimal.result | 12 +-- mysql-test/r/type_time.result | 6 ++ mysql-test/r/type_time_hires.result | 21 ++++- mysql-test/r/type_timestamp_hires.result | 6 +- 13 files changed, 213 insertions(+), 43 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index f7a388237e8..ca79f53ff5b 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -205,7 +205,7 @@ f8 date YES NULL f9 time(6) YES NULL select * from t1; f1 f2 f3 f4 f5 f6 f7 f8 f9 -1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 8275:29:36.710655 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001 +1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 -24:00:00.000001 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001 create table test(t1 datetime, t2 time, t3 time, t4 datetime); insert into test values ('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'), diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 9d494619068..6a8805dfb3a 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -16,6 +16,11 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), sec_to_time(time_to_sec("0:30:47")/6.21); sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21) 02:30:01 23001 54742 00:04:57.423510 +select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899); +sec_to_time(9001.1) time_to_sec('15:12:22.123456') time_to_sec(15.5566778899) +02:30:01.1 54742.123456 15.556677 +Warnings: +Warning 1292 Truncated incorrect time value: '15.5566778899' select sec_to_time(time_to_sec('-838:59:59')); sec_to_time(time_to_sec('-838:59:59')) -838:59:59 @@ -1487,7 +1492,7 @@ select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow') NULL create table t1 (f1 integer, f2 date); -insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'); +insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'),(6, '2011-05-06'); select * from t1 where 1 and concat(f2)=MAKEDATE(2011, 125); f1 f2 1 2011-05-05 diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 4a3dc9b5d5c..a3f915bba27 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -23,9 +23,9 @@ select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222)); time_to_sec(sec_to_time(11111)) 11111 time_to_sec(sec_to_time(11111.22222)) 11111.22222 select current_timestamp(7); -ERROR HY000: Incorrect arguments to now +ERROR 42000: Too big precision 7 specified for 'now'. Maximum is 6. select curtime(7); -ERROR HY000: Incorrect arguments to curtime +ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6. drop table if exists t1; create table t1 select sec_to_time(12345), sec_to_time(12345.6789), sec_to_time(1234567e-2), now(), curtime(0), @@ -130,7 +130,7 @@ t5 12:13:14.12345 t6 12:13:14.123456 drop table t1; select CAST(@a AS DATETIME(7)); -ERROR 42000: Too big precision 7 specified for column '(@a)'. Maximum is 6. +ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6. SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00') 2011-01-02 15:00:00 @@ -154,24 +154,24 @@ insert into t1 values ('2002-07-15 21:00:00'); select time(f1) from t1; time(f1) 21:00:00.000000 -select time(f1) from t1 union all select time(f1) from t1; +select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; time(f1) 21:00:00.000000 -21:00:00.000000 +21:00:01.000000 alter table t1 modify f1 timestamp; select time(f1) from t1; time(f1) 21:00:00 -select time(f1) from t1 union all select time(f1) from t1; +select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; time(f1) 21:00:00 -21:00:00 +21:00:01 alter table t1 modify f1 varchar(100); select time(f1) from t1; time(f1) 21:00:00 -select time(f1) from t1 union all select time(f1) from t1; +select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; time(f1) 21:00:00.000000 -21:00:00.000000 +21:00:01.000000 drop table t1; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index efb549a1494..69733162818 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4105,6 +4105,11 @@ str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6' 1 Warnings: Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT-6' +select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; +str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' +0 +Warnings: +Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' 1 @@ -4168,14 +4173,10 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' set SQL_MODE=TRADITIONAL; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' -0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +1 select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' 0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' 0 @@ -4219,14 +4220,23 @@ str_to_date('','%Y-%m-%d') = '' 1 Warnings: Warning 1292 Truncated incorrect date value: '' -select str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL; -str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' +1 +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL NULL -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00' +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' NULL -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL +select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL +0 +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' +0 +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL NULL CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 5dcbf71ba88..44166d15015 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -890,9 +890,9 @@ DROP TABLE b15776; CREATE TABLE b15776 (a year(-2)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1 CREATE TABLE b15776 (a timestamp(4294967294)); -ERROR 42000: Too big precision 4294967294 specified for column 'a'. Maximum is 6. +ERROR 42000: Too big precision 4294967294 specified for 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967295)); -ERROR 42000: Too big precision 4294967295 specified for column 'a'. Maximum is 6. +ERROR 42000: Too big precision 4294967295 specified for 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967296)); ERROR 42000: Display width out of range for column 'a' (max = 4294967295) CREATE TABLE b15776 (a timestamp(-1)); diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 846225be141..1e6f2de86db 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -208,14 +208,10 @@ SELECT * FROM t1 WHERE a = '0000-00-00'; a 0000-00-00 0000-00-00 -Warnings: -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 0 SELECT * FROM t2 WHERE a = '0000-00-00'; a 0000-00-00 0000-00-00 -Warnings: -Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 0 INSERT INTO t1 VALUES ('0000-00-00'); ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 SET SQL_MODE=DEFAULT; @@ -239,12 +235,12 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref i i 4 const 1 Using where; Using index SELECT * FROM t1 WHERE a = '1000-00-00'; a -Warnings: -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 0 +1000-00-00 +1000-00-00 SELECT * FROM t2 WHERE a = '1000-00-00'; a -Warnings: -Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 0 +1000-00-00 +1000-00-00 INSERT INTO t1 VALUES ('1000-00-00'); ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1 SET SQL_MODE=DEFAULT; diff --git a/mysql-test/r/type_datetime_hires.result b/mysql-test/r/type_datetime_hires.result index 095519cda94..3351eb54631 100644 --- a/mysql-test/r/type_datetime_hires.result +++ b/mysql-test/r/type_datetime_hires.result @@ -1,6 +1,6 @@ drop table if exists t1, t2, t3; create table t1 (a datetime(7)); -ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. +ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6. create table t1 (a datetime(3), key(a)); insert t1 values ('2010-12-11 00:20:03.1234'); insert t1 values ('2010-12-11 15:47:11.1234'); @@ -147,6 +147,10 @@ t2 CREATE TABLE `t2` ( `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t2; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 drop view v1; drop table t1, t2; CREATE TABLE t1 ( @@ -214,3 +218,129 @@ t2 p01 RANGE extract(microsecond from taken) 123000 3 t2 p02 RANGE extract(microsecond from taken) 500000 4 t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3 drop table t1, t2; +create table t1 ( +q_date date, +q_time time, +q_time5 time(5), +q_datetime datetime, +q_datetime1 datetime(1), +q_datetime3 datetime(3), +q_datetime5 datetime(5), +q_timestamp timestamp, +q_timestamp2 timestamp(2), +q_timestamp4 timestamp(4), +q_timestamp6 timestamp(6), +q_varchar50 varchar(50), +q_varchar60 varchar(60), +q_varchar70 varchar(70), +q_varchar80 varchar(80)); +create table t2 ( +date_datetime datetime, +time_datetime datetime, +time5_varchar100 varchar(100), +datetime_time time, +datetime1_date date, +datetime3_timestamp timestamp, +datetime5_varchar100 varchar(100), +timestamp_datetime datetime, +timestamp2_date date, +timestamp4_time time, +timestamp6_varchar100 varchar(100), +varchar50_date date, +varchar60_datetime datetime, +varchar70_time time, +varchar80_timestamp timestamp); +insert t1 values ('2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432'); +Warnings: +Note 1265 Data truncated for column 'q_date' at row 1 +Note 1265 Data truncated for column 'q_time' at row 1 +Note 1265 Data truncated for column 'q_time5' at row 1 +select * from t1;; +q_date 2010-11-12 +q_time 11:14:17 +q_time5 11:14:17.76543 +q_datetime 2010-11-12 11:14:17 +q_datetime1 2010-11-12 11:14:17.7 +q_datetime3 2010-11-12 11:14:17.765 +q_datetime5 2010-11-12 11:14:17.76543 +q_timestamp 2010-11-12 11:14:17 +q_timestamp2 2010-11-12 11:14:17.76 +q_timestamp4 2010-11-12 11:14:17.7654 +q_timestamp6 2010-11-12 11:14:17.765432 +q_varchar50 2010-11-12 11:14:17.765432 +q_varchar60 2010-11-12 11:14:17.765432 +q_varchar70 2010-11-12 11:14:17.765432 +q_varchar80 2010-11-12 11:14:17.765432 +insert t2 select * from t1; +Warnings: +Warning 1265 Data truncated for column 'time_datetime' at row 1 +Note 1265 Data truncated for column 'datetime_time' at row 1 +Note 1265 Data truncated for column 'datetime1_date' at row 1 +Note 1265 Data truncated for column 'timestamp2_date' at row 1 +Note 1265 Data truncated for column 'timestamp4_time' at row 1 +Note 1265 Data truncated for column 'varchar50_date' at row 1 +Note 1265 Data truncated for column 'varchar70_time' at row 1 +select * from t2;; +date_datetime 2010-11-12 00:00:00 +time_datetime 0000-00-00 00:00:00 +time5_varchar100 11:14:17.76543 +datetime_time 11:14:17 +datetime1_date 2010-11-12 +datetime3_timestamp 2010-11-12 11:14:17 +datetime5_varchar100 2010-11-12 11:14:17.76543 +timestamp_datetime 2010-11-12 11:14:17 +timestamp2_date 2010-11-12 +timestamp4_time 11:14:17 +timestamp6_varchar100 2010-11-12 11:14:17.765432 +varchar50_date 2010-11-12 +varchar60_datetime 2010-11-12 11:14:17 +varchar70_time 11:14:17 +varchar80_timestamp 2010-11-12 11:14:17 +alter table t1 +change q_date date_datetime datetime, +change q_time time_datetime datetime, +change q_time5 time5_varchar100 varchar(100), +change q_datetime datetime_time time, +change q_datetime1 datetime1_date date, +change q_datetime3 datetime3_timestamp timestamp, +change q_datetime5 datetime5_varchar100 varchar(100), +change q_timestamp timestamp_datetime datetime, +change q_timestamp2 timestamp2_date date, +change q_timestamp4 timestamp4_time time, +change q_timestamp6 timestamp6_varchar100 varchar(100), +change q_varchar50 varchar50_date date, +change q_varchar60 varchar60_datetime datetime, +change q_varchar70 varchar70_time time, +change q_varchar80 varchar80_timestamp timestamp; +Warnings: +Warning 1265 Data truncated for column 'time_datetime' at row 1 +Note 1265 Data truncated for column 'datetime_time' at row 1 +Note 1265 Data truncated for column 'datetime1_date' at row 1 +Note 1265 Data truncated for column 'timestamp2_date' at row 1 +Note 1265 Data truncated for column 'timestamp4_time' at row 1 +Note 1265 Data truncated for column 'varchar50_date' at row 1 +Note 1265 Data truncated for column 'varchar70_time' at row 1 +select * from t1;; +date_datetime 2010-11-12 00:00:00 +time_datetime 0000-00-00 00:00:00 +time5_varchar100 11:14:17.76543 +datetime_time 11:14:17 +datetime1_date 2010-11-12 +datetime3_timestamp 2010-11-12 11:14:17 +datetime5_varchar100 2010-11-12 11:14:17.76543 +timestamp_datetime 2010-11-12 11:14:17 +timestamp2_date 2010-11-12 +timestamp4_time 11:14:17 +timestamp6_varchar100 2010-11-12 11:14:17.765432 +varchar50_date 2010-11-12 +varchar60_datetime 2010-11-12 11:14:17 +varchar70_time 11:14:17 +varchar80_timestamp 2010-11-12 11:14:17 +drop table t1, t2; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 76c5ea8f756..a0252676d65 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -721,7 +721,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (d decimal(66,0)); -ERROR 42000: Too big precision 66 specified for column 'd'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65. 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), diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index a3a13bb0435..386bb4569d8 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -133,7 +133,7 @@ min(a) -0.010 drop table t1; create table t1 (a float(200,100), b double(200,100)); -ERROR 42000: Too big scale 100 specified for column 'a'. Maximum is 30. +ERROR 42000: Too big scale 100 specified for 'a'. Maximum is 30. create table t1 (c20 char); insert into t1 values (5000.0); Warnings: diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 70ee3a56cf3..5faa3444ce8 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -923,11 +923,11 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column select cast(ln(14000) as decimal(2,3)) c1; ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column ''). create table t1 (sl decimal(70,30)); -ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65. +ERROR 42000: Too big precision 70 specified for 'sl'. Maximum is 65. create table t1 (sl decimal(32,31)); -ERROR 42000: Too big scale 31 specified for column 'sl'. Maximum is 30. +ERROR 42000: Too big scale 31 specified for 'sl'. Maximum is 30. create table t1 (sl decimal(0,38)); -ERROR 42000: Too big scale 38 specified for column 'sl'. Maximum is 30. +ERROR 42000: Too big scale 38 specified for 'sl'. Maximum is 30. create table t1 (sl decimal(0,30)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl'). create table t1 (sl decimal(5, 5)); @@ -1485,12 +1485,12 @@ SELECT CAST(1 AS decimal(65,10)); CAST(1 AS decimal(65,10)) 1.0000000000 SELECT CAST(1 AS decimal(66,10)); -ERROR 42000: Too big precision 66 specified for column '1'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65. SELECT CAST(1 AS decimal(65,30)); CAST(1 AS decimal(65,30)) 1.000000000000000000000000000000 SELECT CAST(1 AS decimal(65,31)); -ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +ERROR 42000: Too big scale 31 specified for '1'. Maximum is 30. CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); INSERT INTO t1 VALUES (3,30), (1,10), (2,10); SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa; @@ -1499,7 +1499,7 @@ aa SUM(b) 3.000000000000000000000000000000 10 4.000000000000000000000000000000 30 SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa; -ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +ERROR 42000: Too big scale 31 specified for '1'. Maximum is 30. DROP TABLE t1; CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); INSERT INTO t1 VALUES (3,30), (1,10), (2,10); diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 797ee706fb9..86153cbb05d 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -167,3 +167,9 @@ f1 f2 00:20:01 a 00:20:03 b drop table t1; +create table t1(f1 time); +insert into t1 values ('23:38:57'); +select f1, f1 = '2010-10-11 23:38:57' from t1; +f1 f1 = '2010-10-11 23:38:57' +23:38:57 0 +drop table t1; diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result index 10ef9d3f3f3..eb21d1773ff 100644 --- a/mysql-test/r/type_time_hires.result +++ b/mysql-test/r/type_time_hires.result @@ -1,6 +1,6 @@ drop table if exists t1, t2, t3; create table t1 (a time(7)); -ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. +ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6. create table t1 (a time(3), key(a)); insert t1 values ('2010-12-11 00:20:03.1234'); Warnings: @@ -163,5 +163,24 @@ t2 CREATE TABLE `t2` ( `a` time(6) DEFAULT NULL, `b` time(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t2; +a b +03:04:06.234500 03:04:06.234561 +04:05:06.000000 04:05:06.789100 drop view v1; drop table t1, t2; +create table t1 (a time(4) not null); +insert into t1 values ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000'); +select * from t1; +a +-00:00:00.6000 +-00:00:00.7000 +-00:00:00.8000 +-00:00:00.9000 +-00:00:01.0000 +-00:00:01.1000 +-00:00:01.0000 +-00:00:01.1000 +-00:00:01.0000 +-00:00:01.0900 +drop table t1; diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result index ade5354304b..75b6b60e4d5 100644 --- a/mysql-test/r/type_timestamp_hires.result +++ b/mysql-test/r/type_timestamp_hires.result @@ -1,6 +1,6 @@ drop table if exists t1, t2, t3; create table t1 (a timestamp(7)); -ERROR 42000: Too big precision 7 specified for column 'a'. Maximum is 6. +ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6. create table t1 (a timestamp(3), key(a)); insert t1 values ('2010-12-11 00:20:03.1234'); insert t1 values ('2010-12-11 15:47:11.1234'); @@ -147,6 +147,10 @@ t2 CREATE TABLE `t2` ( `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t2; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 drop view v1; drop table t1, t2; set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456, time_zone='+03:00'; -- cgit v1.2.1 From f06cac336ba7a27493fc753d2bf37e87137a1cdc Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 19 May 2011 19:16:17 +0200 Subject: post review changes 2 sql/event_parse_data.cc: don't use "not_used" variable sql/item_timefunc.cc: Item_temporal_func::fix_length_and_dec() and other changes sql/item_timefunc.h: introducing Item_timefunc::fix_length_and_dec() sql/share/errmsg.txt: don't say "column X" in the error message that used not only for columns --- mysql-test/r/cast.result | 6 +++++ mysql-test/r/errors.result | 2 +- mysql-test/r/func_time.result | 16 +++++++++++++- mysql-test/r/func_time_hires.result | 13 +++++++++++ mysql-test/r/type_bit.result | 2 +- mysql-test/r/type_bit_innodb.result | 2 +- mysql-test/r/type_blob.result | 44 ++++++++++++++++++------------------- 7 files changed, 59 insertions(+), 26 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 2d65f8816e7..33c8c9b4547 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -452,6 +452,12 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1 1 DROP TABLE t1; End of 5.1 tests +select cast("2101-00-01 02:03:04" as datetime); +cast("2101-00-01 02:03:04" as datetime) +2101-00-01 02:03:04 +select cast(cast("2101-00-01 02:03:04" as datetime) as time); +cast(cast("2101-00-01 02:03:04" as datetime) as time) +02:03:04 create table t1 (f1 time, f2 date, f3 datetime); insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33'); select cast(f1 as unsigned), cast(f2 as unsigned), cast(f3 as unsigned) from t1; diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 022a32d9c9b..4f21fd57b88 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -24,7 +24,7 @@ select count(*),b from t1; ERROR 42S22: Unknown column 'b' in 'field list' drop table t1; create table t1 (a int(256)); -ERROR 42000: Display width out of range for column 'a' (max = 255) +ERROR 42000: Display width out of range for 'a' (max = 255) set sql_mode='traditional'; create table t1 (a varchar(66000)); ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 6a8805dfb3a..3194e618bb8 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1036,7 +1036,7 @@ SELECT SEC_TO_TIME(CAST(-1 AS UNSIGNED)); SEC_TO_TIME(CAST(-1 AS UNSIGNED)) 838:59:59 Warnings: -Warning 1292 Truncated incorrect time value: '18446744073709551616' +Warning 1292 Truncated incorrect time value: '1.84467440737096e+19' SET NAMES latin1; SET character_set_results = NULL; SHOW VARIABLES LIKE 'character_set_results'; @@ -1223,6 +1223,11 @@ str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL Warnings: Error 1411 Incorrect datetime value: '10:00 PM' for function str_to_date +select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute; +str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute +NULL +Warnings: +Error 1411 Incorrect datetime value: '1997-00-04 22:23:00' for function str_to_date create table t1 (field DATE); insert into t1 values ('2006-11-06'); select * from t1 where field < '2006-11-06 04:08:36.0'; @@ -1545,3 +1550,12 @@ select cast(f1 AS time) from t1; cast(f1 AS time) 00:00:00 drop table t1; +select greatest(cast("0-0-0" as date), cast("10:20:05" as time)); +greatest(cast("0-0-0" as date), cast("10:20:05" as time)) +0000-00-00 +select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'; +greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' +1 +select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)); +cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) +0000-00-00 00:00:00.000000 diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index a3f915bba27..1e48c4e8905 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -64,6 +64,19 @@ localtimestamp(6) 2011-01-01 01:01:01.123456 time_to_sec('12:34:56') 45296 time_to_sec('12:34:56.789') 45296.789 drop table t1; +select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999); +sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999) +838:59:59.99998 838:59:59.999999 838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '3020399.9999999' +select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999); +sec_to_time(-3020399.99999) sec_to_time(-3020399.999999) sec_to_time(-3020399.9999999) +-838:59:59.99998 -838:59:59.999999 -838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-3020399.9999999' +select 20010101000203.000000004 + interval 1 day; +20010101000203.000000004 + interval 1 day +2001-01-02 00:02:03.000000 set @a=cast('2011-01-02 12:13:14' as datetime); select @a + interval 1 minute; @a + interval 1 minute diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 9f32a10a3fb..50042a428c7 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -36,7 +36,7 @@ select 0 + b'1000000000000001'; 32769 drop table if exists t1,t2; create table t1 (a bit(65)); -ERROR 42000: Display width out of range for column 'a' (max = 64) +ERROR 42000: Display width out of range for 'a' (max = 64) create table t1 (a bit(0)); show create table t1; Table Create Table diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result index a9c3cae1770..071b1c3b97b 100644 --- a/mysql-test/r/type_bit_innodb.result +++ b/mysql-test/r/type_bit_innodb.result @@ -36,7 +36,7 @@ select 0 + b'1000000000000001'; 32769 drop table if exists t1; create table t1 (a bit(65)) engine=innodb; -ERROR 42000: Display width out of range for column 'a' (max = 64) +ERROR 42000: Display width out of range for 'a' (max = 64) create table t1 (a bit(0)) engine=innodb; show create table t1; Table Create Table diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 44166d15015..67b56179c8d 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -833,7 +833,7 @@ drop table b15776; create table b15776 (data blob(4294967295)); drop table b15776; create table b15776 (data blob(4294967296)); -ERROR 42000: Display width out of range for column 'data' (max = 4294967295) +ERROR 42000: Display width out of range for 'data' (max = 4294967295) CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) ); show columns from b15776; Field Type Null Key Default Extra @@ -845,13 +845,13 @@ b1 longtext YES NULL c1 longtext YES NULL drop table b15776; CREATE TABLE b15776 (a blob(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a text(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a int(0)); INSERT INTO b15776 values (NULL), (1), (42), (654); SELECT * from b15776 ORDER BY a; @@ -866,7 +866,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp CREATE TABLE b15776 (a int(255)); DROP TABLE b15776; CREATE TABLE b15776 (a int(256)); -ERROR 42000: Display width out of range for column 'a' (max = 255) +ERROR 42000: Display width out of range for 'a' (max = 255) CREATE TABLE b15776 (data blob(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1 CREATE TABLE b15776 (a char(2147483647)); @@ -876,7 +876,7 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT CREATE TABLE b15776 (a char(4294967295)); ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead CREATE TABLE b15776 (a char(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a year(4294967295)); INSERT INTO b15776 VALUES (42); SELECT * FROM b15776; @@ -884,7 +884,7 @@ a 2042 DROP TABLE b15776; CREATE TABLE b15776 (a year(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a year(0)); DROP TABLE b15776; CREATE TABLE b15776 (a year(-2)); @@ -894,19 +894,19 @@ ERROR 42000: Too big precision 4294967294 specified for 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967295)); ERROR 42000: Too big precision 4294967295 specified for 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a timestamp(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1 CREATE TABLE b15776 (a timestamp(-2)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1 CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 select cast(null as char(4294967295)); show columns from b15776; Field Type Null Key Default Extra @@ -932,11 +932,11 @@ explain select cast(1 as binary(4294967295)); 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 explain select cast(1 as char(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as nchar(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as binary(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as decimal(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1 explain select cast(1 as decimal(64, 30)); @@ -952,23 +952,23 @@ explain select convert(1, char(4294967295)); 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 explain select convert(1, char(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, nchar(4294967295)); 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 explain select convert(1, nchar(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, binary(4294967295)); 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 explain select convert(1, binary(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) End of 5.0 tests # Bug #52160: crash and inconsistent results when grouping # by a function and column -- cgit v1.2.1 From 8767540a43b28c977714e2f35aadcfd1bcefef5f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 19 May 2011 19:19:44 +0200 Subject: microseconds in log tables: TIMESTAMP -> TIMESTAMP(6) TIME -> TIME(6) in general_log and slow_log tables. include/my_sys.h: use constants --- mysql-test/r/log_state.result | 2 +- mysql-test/r/log_tables.result | 60 ++++++++++++++++++------------------- mysql-test/r/system_mysql_db.result | 8 ++--- 3 files changed, 35 insertions(+), 35 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 654f9d127d3..6987ab94d74 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -55,7 +55,7 @@ sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text -TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(@long_query_time + 1) +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 1) # Switch to connection default show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index fcde09db7c5..65e8599fa5d 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -53,7 +53,7 @@ ERROR HY000: You can't use locks with log tables. show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -62,7 +62,7 @@ general_log CREATE TABLE `general_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' show fields from mysql.general_log; Field Type Null Key Default Extra -event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +event_time timestamp(6) NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP user_host mediumtext NO NULL thread_id int(11) NO NULL server_id int(10) unsigned NO NULL @@ -71,10 +71,10 @@ argument mediumtext NO NULL show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -85,10 +85,10 @@ slow_log CREATE TABLE `slow_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +start_time timestamp(6) NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP user_host mediumtext NO NULL -query_time time NO NULL -lock_time time NO NULL +query_time time(6) NO NULL +lock_time time(6) NO NULL rows_sent int(11) NO NULL rows_examined int(11) NO NULL db varchar(512) NO NULL @@ -147,7 +147,7 @@ sleep(2) 0 select * from mysql.slow_log; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text -TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 mysql 0 0 1 select sleep(2) +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) set @@session.long_query_time = @saved_long_query_time; alter table mysql.general_log engine=myisam; ERROR HY000: You cannot 'ALTER' a log table if logging is enabled @@ -164,7 +164,7 @@ set global slow_query_log='OFF'; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -174,10 +174,10 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -191,7 +191,7 @@ alter table mysql.slow_log engine=myisam; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -201,10 +201,10 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -264,7 +264,7 @@ drop table mysql.slow_log; ERROR 42S02: Unknown table 'slow_log' use mysql; CREATE TABLE `general_log` ( -`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, @@ -273,11 +273,11 @@ ON UPDATE CURRENT_TIMESTAMP, `argument` mediumtext NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; CREATE TABLE `slow_log` ( -`start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +`start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, -`query_time` time NOT NULL, -`lock_time` time NOT NULL, +`query_time` time(6) NOT NULL, +`lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -429,9 +429,9 @@ My own slow query sleep(2) My own slow query 0 SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text seq -START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 -START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 -START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 SET GLOBAL slow_query_log = 0; SET SESSION long_query_time =@saved_long_query_time; FLUSH LOGS; @@ -525,10 +525,10 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`; DROP DATABASE IF EXISTS `db_17876`; CREATE DATABASE db_17876; CREATE TABLE `db_17876.slow_log_data` ( -`start_time` timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, +`start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `user_host` mediumtext , -`query_time` time , -`lock_time` time , +`query_time` time(6) , +`lock_time` time(6) , `rows_sent` int(11) , `rows_examined` int(11) , `db` varchar(512) default NULL, @@ -538,7 +538,7 @@ CREATE TABLE `db_17876.slow_log_data` ( `sql_text` mediumtext ); CREATE TABLE `db_17876.general_log_data` ( -`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext, `thread_id` int(11) DEFAULT NULL, `server_id` int(11) DEFAULT NULL, @@ -547,7 +547,7 @@ CREATE TABLE `db_17876.general_log_data` ( ); CREATE procedure `db_17876.archiveSlowLog`() BEGIN -DECLARE start_time, query_time, lock_time CHAR(20); +DECLARE start_time, query_time, lock_time CHAR(28); DECLARE user_host MEDIUMTEXT; DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; DECLARE dbname MEDIUMTEXT; @@ -580,7 +580,7 @@ TRUNCATE mysql.slow_log; END // CREATE procedure `db_17876.archiveGeneralLog`() BEGIN -DECLARE event_time CHAR(20); +DECLARE event_time CHAR(28); DECLARE user_host, argument MEDIUMTEXT; DECLARE thread_id, server_id INT; DECLARE sql_text BLOB; diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 17fd95ab1c8..76f6bd100b1 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -238,7 +238,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -248,10 +248,10 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, -- cgit v1.2.1 From 7c459960ece917dcdc4dedc9f3dd0c9f5d07c3b8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 20 May 2011 23:56:13 +0200 Subject: db_low_byte_first is gone --- mysql-test/r/type_datetime_hires.result | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/type_datetime_hires.result b/mysql-test/r/type_datetime_hires.result index 3351eb54631..78e634c9e99 100644 --- a/mysql-test/r/type_datetime_hires.result +++ b/mysql-test/r/type_datetime_hires.result @@ -344,3 +344,10 @@ varchar60_datetime 2010-11-12 11:14:17 varchar70_time 11:14:17 varchar80_timestamp 2010-11-12 11:14:17 drop table t1, t2; +create table t1 (a datetime, b datetime(6)); +insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912'); +update t1 set b=a; +select * from t1; +a b +2010-01-02 03:04:05 2010-01-02 03:04:05.000000 +drop table t1; -- cgit v1.2.1 From 306ed65302e14f303fdc33cfa9d19016fb319440 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 22 May 2011 11:58:48 +0200 Subject: unix_timestamp() and from_unixtime() supports microseconds. unix_timestamp() and time_to_sec() are hybrid items, returning integer or double depending on the argument. --- mysql-test/r/func_time_hires.result | 18 ++++++++++++++---- mysql-test/r/ps_2myisam.result | 8 ++++---- mysql-test/r/ps_3innodb.result | 8 ++++---- mysql-test/r/ps_4heap.result | 8 ++++---- mysql-test/r/ps_5merge.result | 16 ++++++++-------- 5 files changed, 34 insertions(+), 24 deletions(-) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 1e48c4e8905..0def9625b37 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -1,4 +1,4 @@ -set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456, time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01.123456'), time_zone='+03:00'; select sec_to_time(12345), sec_to_time(12345.6789), sec_to_time(1234567e-2); sec_to_time(12345) 03:25:45 sec_to_time(12345.6789) 03:25:45.6789 @@ -31,7 +31,7 @@ create table t1 select sec_to_time(12345), sec_to_time(12345.6789), sec_to_time(1234567e-2), now(), curtime(0), utc_timestamp(1), utc_time(2), current_time(3), current_timestamp(4), localtime(5), localtimestamp(6), -time_to_sec('12:34:56'), time_to_sec('12:34:56.789'); +time_to_sec(123456), time_to_sec('12:34:56.789'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -46,7 +46,7 @@ t1 CREATE TABLE `t1` ( `current_timestamp(4)` datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000', `localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000', `localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `time_to_sec('12:34:56')` double DEFAULT NULL, + `time_to_sec(123456)` bigint(17) DEFAULT NULL, `time_to_sec('12:34:56.789')` double DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; @@ -61,9 +61,19 @@ current_time(3) 01:01:01.123 current_timestamp(4) 2011-01-01 01:01:01.1234 localtime(5) 2011-01-01 01:01:01.12345 localtimestamp(6) 2011-01-01 01:01:01.123456 -time_to_sec('12:34:56') 45296 +time_to_sec(123456) 45296 time_to_sec('12:34:56.789') 45296.789 drop table t1; +select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));; +unix_timestamp('2011-01-01 01:01:01') 1293832861 +unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.12346 +unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861 +unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1235 +select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));; +from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01 +from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456 +from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01 +from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234 select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999); sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999) 838:59:59.99998 838:59:59.999999 838:59:59.999999 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 6df671de88c..2fa07c5de6e 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1793,8 +1793,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1823,8 +1823,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 7563a9c223b..06062193951 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1776,8 +1776,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1806,8 +1806,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 70bcc2d6d4d..1819a9e649b 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1777,8 +1777,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1807,8 +1807,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 87d587b69da..4a8e0adf46f 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1713,8 +1713,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1743,8 +1743,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -5067,8 +5067,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -5097,8 +5097,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 -- cgit v1.2.1