diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-03-01 13:24:36 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-03-01 13:24:36 +0100 |
commit | a8a757c6bb32bbf291afdf33df861127489889ab (patch) | |
tree | cee7858869789964ad21b2b90b420f1128d9a10d /mysql-test | |
parent | 7e0e4b00c971b81b5ffd18db4f1ea977233e98be (diff) | |
download | mariadb-git-a8a757c6bb32bbf291afdf33df861127489889ab.tar.gz |
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
Diffstat (limited to 'mysql-test')
64 files changed, 3097 insertions, 327 deletions
diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index 195d1061664..d1e6e5bac06 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -103,7 +103,7 @@ drop table t5 ; # c1 tinyint, c2 smallint, c3 mediumint, c4 int, # c5 integer, c6 bigint, c7 float, c8 double, # c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -# c13 date, c14 datetime, c15 timestamp(14), c16 time, +# c13 date, c14 datetime, c15 timestamp, c16 time, # c17 year, c18 tinyint, c19 bool, c20 char, # c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, # c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -669,7 +669,6 @@ select '-- insert into string columns --' as test_sequence ; --enable_query_log ######## INSERT into .. string columns values(CHAR(n),LONGTEXT) ######## ---disable_query_log insert into t9 ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 ) values @@ -857,8 +856,6 @@ values execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ; ---enable_query_log - ######## SELECT of all inserted records ######## select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 from t9 where c1 >= 20 @@ -977,14 +974,13 @@ delete from t9 ; ######################### test of date/time columns ######################## # # -# c13 date, c14 datetime, c15 timestamp(14), c16 time, c17 year # +# c13 date, c14 datetime, c15 timestamp, c16 time, c17 year # # # ############################################################################ --disable_query_log select '-- insert into date/time columns --' as test_sequence ; --enable_query_log ######## INSERT into .. date/time columns values(VARCHAR(19),LONGTEXT) ######## ---disable_query_log set @arg00= '1991-01-01 01:01:01' ; insert into t9 ( c1, c13, c14, c15, c16, c17 ) @@ -1140,12 +1136,9 @@ values ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ; execute stmt2 using @arg00, @arg00, @arg00, @arg00 ; ---enable_query_log - ######## SELECT of all inserted records ######## select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; - --disable_query_log select '-- select .. where date/time column = .. --' as test_sequence ; --enable_query_log @@ -1153,19 +1146,19 @@ select '-- select .. where date/time column = .. --' as 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' ; 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 ; 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 ; 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 ; ######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ######## @@ -1174,21 +1167,39 @@ 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) ; 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 ; 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 ; 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 ; + + +######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ######## +set @arg00= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= '01:01:01' ; +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= '01:01:01'" ; +execute stmt1 ; +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; + + +######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ######## +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) ; +select 'true' as found from t9 where c1= 20 and c16= @arg00 ; +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= CAST('01:01:01' as time)" ; +execute stmt1 ; +prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c16= ?" ; +execute stmt1 using @arg00 ; ######## SELECT .. WHERE column(year)=value(INT(10)/BIGINT) ######## diff --git a/mysql-test/include/type_hrtime.inc b/mysql-test/include/type_hrtime.inc new file mode 100644 index 00000000000..bcf72ad400a --- /dev/null +++ b/mysql-test/include/type_hrtime.inc @@ -0,0 +1,94 @@ + +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +--error ER_TOO_BIG_PRECISION +eval create table t1 (a $type(7)); + +eval create table t1 (a $type(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); +select * from t1; +select truncate(a, 6) from t1; # Field::val_real() +select a DIV 1 from t1; # Field::val_int() +select group_concat(distinct a) from t1; # Field::cmp() +alter table t1 engine=innodb; +select * from t1; +drop table t1; +eval create table t1 (a $type(4)) engine=innodb; +insert t1 values ('2010-12-11 01:02:03.456789'); +select * from t1; +select extract(microsecond from a + interval 100 microsecond) from t1 where a>'2010-11-12 01:02:03.456'; +select a from t1 where a>'2010-11-12 01:02:03.456' group by a; + +# +# metadata +# +show create table t1; +show columns from t1; +--query_vertical 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' + +# +# update/delete +# +select a, a+interval 9876543 microsecond from t1; +update t1 set a=a+interval 9876543 microsecond; +select * from t1; +insert t1 select a + interval 2 year from t1; +select * from t1; +delete from t1 where a < 20110101; +select * from t1; + +# +# create ... select +# +create table t2 select * from t1; +create table t3 like t1; + +show create table t2; +show create table t3; + +drop table t1, t2, t3; + +# +# SP +# +eval create table t1 (a $type(6), b $type(6)); +eval create procedure foo(x $type, y $type(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; +delimiter |; +eval create procedure bar(a int, c $type(5)) +begin + declare b $type(4); + set b = c + interval a microsecond; + insert t1 values (b, c + interval a microsecond); +end| +delimiter ;| +call bar(1111111, '2011-01-02 3:4:5.123456'); +select * from t1; +drop procedure foo; +drop procedure bar; +eval create function xyz(s char(20)) returns $type(4) + return addtime('2010-10-10 10:10:10.101010', s); +select xyz('1:1:1.010101'); +drop function xyz; + +# +# Views +# + +create view v1 as select * from t1 group by a,b; +select * from v1; +show columns from v1; +create table t2 select * from v1; +show create table t2; + +drop view v1; +drop table t1, t2; + 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 <union2,3> 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 <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1)))) +Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(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 <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1)))) +Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(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 <in_optimizer>('1',<exists>(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 <in_optimizer>(1,<exists>(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 <in_optimizer>('1',<exists>(select 1 from `test`.`t2` `x1` where 0)) +Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` where <in_optimizer>(1,<exists>(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 <union1,2> 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 diff --git a/mysql-test/suite/rpl/include/hrtime.inc b/mysql-test/suite/rpl/include/hrtime.inc new file mode 100644 index 00000000000..e461f66db1e --- /dev/null +++ b/mysql-test/suite/rpl/include/hrtime.inc @@ -0,0 +1,24 @@ +--source include/master-slave.inc + +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; + +create table t1 (a timestamp(4), b varchar(100), c datetime(2)); + +insert t1 (b,c) values (now(6), now(6)); + +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010'); + +set timestamp=unix_timestamp('2022-02-02 02:02:02') + 0.654321; +insert t1 (b,c) values (now(), now()); +insert t1 (b,c) values (0,0); +insert t1 (a,b,c) values (0,0,now(6)); + +select * from t1; + +sync_slave_with_master; +connection slave; +select * from t1; +connection master; +drop table t1; + diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result new file mode 100644 index 00000000000..4bff97392e9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_hrtime.result @@ -0,0 +1,69 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; +create table t1 (a timestamp(4), b varchar(100), c datetime(2)); +insert t1 (b,c) values (now(6), now(6)); +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010'); +set timestamp=unix_timestamp('2022-02-02 02:02:02') + 0.654321; +insert t1 (b,c) values (now(), now()); +insert t1 (b,c) values (0,0); +insert t1 (a,b,c) values (0,0,now(6)); +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +drop table t1; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1293832861/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t1 (a timestamp(4), b varchar(100), c datetime(2)) +/*!*/; +SET TIMESTAMP=1293832861.123456/*!*/; +SET @@session.time_zone='+03:00'/*!*/; +insert t1 (b,c) values (now(6), now(6)) +/*!*/; +SET TIMESTAMP=1293832861/*!*/; +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010') +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +insert t1 (b,c) values (now(), now()) +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +insert t1 (b,c) values (0,0) +/*!*/; +SET TIMESTAMP=1643756522.654321/*!*/; +insert t1 (a,b,c) values (0,0,now(6)) +/*!*/; +SET TIMESTAMP=1643756522/*!*/; +drop table t1 +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/suite/rpl/r/rpl_hrtime_row.result b/mysql-test/suite/rpl/r/rpl_hrtime_row.result new file mode 100644 index 00000000000..340489910b7 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_hrtime_row.result @@ -0,0 +1,30 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; +create table t1 (a timestamp(4), b varchar(100), c datetime(2)); +insert t1 (b,c) values (now(6), now(6)); +insert t1 values ('2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010','2010-10-10 10:10:10.101010'); +set timestamp=unix_timestamp('2022-02-02 02:02:02') + 0.654321; +insert t1 (b,c) values (now(), now()); +insert t1 (b,c) values (0,0); +insert t1 (a,b,c) values (0,0,now(6)); +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +select * from t1; +a b c +2011-01-01 01:01:01.1234 2011-01-01 01:01:01.123456 2011-01-01 01:01:01.12 +2010-10-10 10:10:10.1010 2010-10-10 10:10:10.101010 2010-10-10 10:10:10.10 +2022-02-02 02:02:02.6543 2022-02-02 02:02:02 2022-02-02 02:02:02.00 +2022-02-02 02:02:02.6543 0 0000-00-00 00:00:00.00 +0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65 +drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result index dae72d83b51..2fce884eecf 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result +++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result @@ -29,8 +29,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 rewrite.t1; @@ -44,7 +44,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 rewrite.t1; a b c d diff --git a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result index 7447d12f9b2..e301f54c0f9 100644 --- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result @@ -139,6 +139,8 @@ create table t2 select rpad(UUID(),100,' '); create table t3 select 1 union select UUID(); create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); +Warnings: +Warning 1292 Incorrect date value: '3' for column '<result>' at row 1 insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); create procedure foo() begin diff --git a/mysql-test/suite/rpl/r/rpl_variables_stm.result b/mysql-test/suite/rpl/r/rpl_variables_stm.result index 51484187215..055dc15ab85 100644 --- a/mysql-test/suite/rpl/r/rpl_variables_stm.result +++ b/mysql-test/suite/rpl/r/rpl_variables_stm.result @@ -486,8 +486,8 @@ id num text 52 NULL latin7 53 NULL latin7_estonian_cs 54 NULL latin7 -55 NULL 47114711 -56 NULL 47124712 +55 NULL 47114711.000000 +56 NULL 47124712.000000 57 NULL 1616 58 NULL 1717 Comparing tables master:test.tstmt and master:test.tproc diff --git a/mysql-test/suite/rpl/t/rpl_hrtime.test b/mysql-test/suite/rpl/t/rpl_hrtime.test new file mode 100644 index 00000000000..98b08abec67 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_hrtime.test @@ -0,0 +1,7 @@ +--source include/have_binlog_format_mixed_or_statement.inc + +--source suite/rpl/include/hrtime.inc + +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 + diff --git a/mysql-test/suite/rpl/t/rpl_hrtime_row.test b/mysql-test/suite/rpl/t/rpl_hrtime_row.test new file mode 100644 index 00000000000..e1d49f5324b --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_hrtime_row.test @@ -0,0 +1,3 @@ +--source include/have_binlog_format_row.inc +--source suite/rpl/include/hrtime.inc + diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index bf4c23562cf..9cc5dce6754 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -614,3 +614,13 @@ SET @@sort_buffer_size = @old_sort_buffer_size; SET @@max_heap_table_size = @old_max_heap_table_size; --echo End of 5.1 tests + +# +# test_if_equality_guarantees_uniqueness() and dates +# +create table t1 (a varchar(100)); +insert t1 values ('2010-10-10'), ('20101010'); +select * from t1 where a = DATE('2010-10-10'); +select distinct a from t1 where a = DATE('2010-10-10'); +drop table t1; + diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 8fce7072319..5d98b2497cb 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -860,3 +860,29 @@ SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); DROP TABLE t1; --echo End of 5.1 tests + +select time(' 1 02:03:04') + interval 9 microsecond; +select time(' 1 02:03:04') - interval 9 microsecond; +select time('-1 02:03:04') + interval 9 microsecond; +select time('-1 02:03:04') - interval 9 microsecond; +select time(' 1 02:03:04') + interval '4:4:4' hour_second; +select time(' 1 02:03:04') - interval '4:4:4' hour_second; +select time('-1 02:03:04') + interval '4:4:4' hour_second; +select time('-1 02:03:04') - interval '4:4:4' hour_second; +select time(' 1 02:03:04') + interval 2 day; +select time(' 1 02:03:04') - interval 2 day; +select time('-1 02:03:04') + interval 2 day; +select time('-1 02:03:04') - interval 2 day; + +# specially constructed queries to reach obscure places in the code +# not touched by the more "normal" queries (and to increase the coverage) +select cast('131415.123e0' as time); +select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'; +select least(time('1:2:3'), '01:02:04', null) div 1; +select truncate(least(time('1:2:3'), '01:02:04', null), 6); +select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1)); +select unix_timestamp(null); +select truncate(date('2010-40-10'), 6); +select extract(month from '2010-40-50'); +select subtime('0000-00-10 10:10:10', '30 10:00:00'); + diff --git a/mysql-test/t/func_time_hires.test b/mysql-test/t/func_time_hires.test new file mode 100644 index 00000000000..6c0f1085cf2 --- /dev/null +++ b/mysql-test/t/func_time_hires.test @@ -0,0 +1,80 @@ + +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456, time_zone='+03:00'; + +--vertical_results +select sec_to_time(12345), sec_to_time(12345.6789), sec_to_time(1234567e-2); +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'); +select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890')); +select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222)); +--horizontal_results +--error ER_WRONG_ARGUMENTS +select current_timestamp(7); +--error ER_WRONG_ARGUMENTS +select curtime(7); + +--disable_warnings +drop table if exists t1; +--enable_warnings + +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; +--query_vertical select * from t1 +drop table t1; + +# +# precision of expressions +# +set @a=cast('2011-01-02 12:13:14' as datetime); +select @a + interval 1 minute; +select @a + interval 10 microsecond; +select @a + interval 10 microsecond + interval 999990 microsecond; + +# +# CAST +# +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; +--query_vertical select * from t1 +drop table t1; + +--error ER_TOO_BIG_PRECISION +select CAST(@a AS DATETIME(7)); + +# +# CONVERT_TZ +# +SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00'); +SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00'); +SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00'); +SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00'); + +# +# Field::store_time() +# +create table t1 (a varchar(200)); +insert t1 values (now(6)); +select * from t1; +drop table t1; + diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 9b3f3e750e1..e19d1e3e680 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3102,3 +3102,15 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1; --echo End of 5.1 tests. + +# +# restoring of the Item tree in BETWEEN with dates +# +prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?"; +set @a='2010-11-11'; +execute stmt using @a; +execute stmt using @a; +set @a='2010-08-08'; +execute stmt using @a; +execute stmt using @a; + diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index db08aad0df0..e655952288f 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3513,7 +3513,7 @@ DROP VIEW v1; select 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'; select str_to_date('2007-10-09','%Y-%m-%d') > '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'; +select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'; # We have all we need -- and trailing garbage: # (leaving out a leading zero in first example to prove it's a diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 1f471b46c4e..7581eb62448 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -310,7 +310,7 @@ insert into t2 values (1, 21),(2, 12),(3, 23); select * from t1; select * from t1 where b = (select b from t2 where t1.a = t2.a); -- error ER_UPDATE_TABLE_USED -delete from t1 where b = (select b from t1); +delete from t1 where b in (select b from t1); -- error ER_SUBQUERY_NO_1_ROW delete from t1 where b = (select b from t2); delete from t1 where b = (select b from t2 where t1.a = t2.a); diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index 440fcc8aa8a..08d40bdae0f 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -41,8 +41,8 @@ INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y',' CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; -CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; -CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; +CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; +CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; CREATE TABLE help_topic ( help_topic_id int unsigned not null, name varchar(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url varchar(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; CREATE TABLE help_category ( help_category_id smallint unsigned not null, name varchar(64) not null, parent_category_id smallint unsigned null, url varchar(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test index 4924c625d57..41e85661fe8 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -39,9 +39,9 @@ INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y',' CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; -CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; +CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; -CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; +CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; CREATE TABLE help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; CREATE TABLE help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; @@ -60,7 +60,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, CREATE TABLE proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob DEFAULT '' NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob DEFAULT '' NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures'; -CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; +CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; CREATE TABLE servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table'; diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test index d88c4edba93..bed00239081 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -44,9 +44,9 @@ CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table'; -CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; +CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; -CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; +CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; @@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint sign CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures'; -CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; +CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 4e097edf73d..a9ae3bc71f6 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -535,10 +535,10 @@ DROP TABLE b15776; CREATE TABLE b15776 (a year(-2)); ## For timestamp, we silently rewrite widths to 14 or 19. +--error ER_TOO_BIG_PRECISION CREATE TABLE b15776 (a timestamp(4294967294)); -DROP TABLE b15776; +--error ER_TOO_BIG_PRECISION CREATE TABLE b15776 (a timestamp(4294967295)); -DROP TABLE b15776; --error ER_TOO_BIG_DISPLAYWIDTH CREATE TABLE b15776 (a timestamp(4294967296)); --error ER_PARSE_ERROR diff --git a/mysql-test/t/type_datetime_hires.test b/mysql-test/t/type_datetime_hires.test new file mode 100644 index 00000000000..7473e01fc57 --- /dev/null +++ b/mysql-test/t/type_datetime_hires.test @@ -0,0 +1,63 @@ + +--source include/have_partition.inc + +let type=datetime; +--source include/type_hrtime.inc + +# +# partitioning +# +eval CREATE TABLE t1 ( + taken $type(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; + +eval CREATE TABLE t2 ( + taken $type(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'); + +drop table t1, t2; + diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 34331b72688..dd32cdc36ab 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -100,3 +100,9 @@ SELECT TIMESTAMP(f1,'1') FROM t1; DROP TABLE t1; --echo End of 5.1 tests + +create table t1 (a time); +insert t1 values (-131415); +select * from t1; +drop table t1; + diff --git a/mysql-test/t/type_time_hires.test b/mysql-test/t/type_time_hires.test new file mode 100644 index 00000000000..c042a7e9bda --- /dev/null +++ b/mysql-test/t/type_time_hires.test @@ -0,0 +1,4 @@ + +let type=time; +--source include/type_hrtime.inc + diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 602f6f089c2..6e61e727925 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -67,17 +67,6 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000); SELECT * FROM t1; 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)); -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; -select * from t1; -drop table t1; - # # Let us check if we properly treat wrong datetimes and produce proper warnings # (for both strings and numbers) @@ -298,7 +287,7 @@ drop table t1; # mode regardless of whether a display width is given. # set sql_mode='maxdb'; -create table t1 (a timestamp, b timestamp(19)); +create table t1 (a timestamp, b timestamp(5)); show create table t1; # restore default mode set sql_mode=''; diff --git a/mysql-test/t/type_timestamp_hires.test b/mysql-test/t/type_timestamp_hires.test new file mode 100644 index 00000000000..b480f8846b1 --- /dev/null +++ b/mysql-test/t/type_timestamp_hires.test @@ -0,0 +1,15 @@ + +let type=timestamp; +--source include/type_hrtime.inc + +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456, time_zone='+03:00'; + +create table t1 (a timestamp(5)); +# +# CREATE ... DEFAULT NOW(X) +# + +insert t1 values (); +select * from t1; +drop table t1; + |