diff options
Diffstat (limited to 'mysql-test/r')
62 files changed, 3567 insertions, 580 deletions
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index a45aca67694..169108a320d 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -66,27 +66,96 @@ cast(cast("20:01:01" as time) as datetime) select cast(cast("8:46:06.23434" AS time) as decimal(32,10)); cast(cast("8:46:06.23434" AS time) as decimal(32,10)) 84606.2343400000 +select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6)); +cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6)) +20110405084606.234340 +# +# Check handling of cast with microseconds +# select cast(cast(20010203101112.121314 as double) as datetime); cast(cast(20010203101112.121314 as double) as datetime) -2001-02-03 10:11:12.125000 +2001-02-03 10:11:12 select cast(cast(010203101112.12 as double) as datetime); cast(cast(010203101112.12 as double) as datetime) -2001-02-03 10:11:12.120000 +2001-02-03 10:11:12 select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime); cast(cast(20010203101112.121314 as decimal(32,6)) as datetime) -2001-02-03 10:11:12.121314 +2001-02-03 10:11:12 select cast(20010203101112.121314 as datetime); cast(20010203101112.121314 as datetime) -2001-02-03 10:11:12.121314 +2001-02-03 10:11:12 select cast(110203101112.121314 as datetime); cast(110203101112.121314 as datetime) -2011-02-03 10:11:12.121314 +2011-02-03 10:11:12 select cast(cast(010203101112.12 as double) as datetime); cast(cast(010203101112.12 as double) as datetime) +2001-02-03 10:11:12 +select cast("2011-02-03 10:11:12.123456" as datetime); +cast("2011-02-03 10:11:12.123456" as datetime) +2011-02-03 10:11:12 +select cast("2011-02-03 10:11:12.123456" as datetime(0)); +cast("2011-02-03 10:11:12.123456" as datetime(0)) +2011-02-03 10:11:12 +select cast("2011-02-03 10:11:12.123456" as datetime(5)); +cast("2011-02-03 10:11:12.123456" as datetime(5)) +2011-02-03 10:11:12.12345 +select cast("2011-02-03 10:11:12.123456" as datetime(6)); +cast("2011-02-03 10:11:12.123456" as datetime(6)) +2011-02-03 10:11:12.123456 +select cast("2011-02-03 10:11:12" as datetime(6)); +cast("2011-02-03 10:11:12" as datetime(6)) +2011-02-03 10:11:12.000000 +select cast(cast(20010203101112.1 as double) as datetime(1)); +cast(cast(20010203101112.1 as double) as datetime(1)) +2001-02-03 10:11:12.1 +select cast(cast(010203101112.12 as double) as datetime(2)); +cast(cast(010203101112.12 as double) as datetime(2)) +2001-02-03 10:11:12.12 +select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)); +cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)) +2001-02-03 10:11:12.121314 +select cast(20010203101112.121314 as datetime(6)); +cast(20010203101112.121314 as datetime(6)) +2001-02-03 10:11:12.121314 +select cast(110203101112.121314 as datetime(6)); +cast(110203101112.121314 as datetime(6)) +2011-02-03 10:11:12.121314 +select cast(cast(010203101112.12 as double) as datetime(6)); +cast(cast(010203101112.12 as double) as datetime(6)) 2001-02-03 10:11:12.120000 -select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as time); -cast(cast("2011-04-05 8:46:06.23434" AS datetime) as time) -08:46:06.234340 +select cast("2011-02-03 10:11:12.123456" as time); +cast("2011-02-03 10:11:12.123456" as time) +10:11:12 +select cast("2011-02-03 10:11:12.123456" as time(6)); +cast("2011-02-03 10:11:12.123456" as time(6)) +10:11:12.123456 +select cast("10:11:12.123456" as time); +cast("10:11:12.123456" as time) +10:11:12 +select cast("10:11:12.123456" as time(0)); +cast("10:11:12.123456" as time(0)) +10:11:12 +select cast("10:11:12.123456" as time(5)); +cast("10:11:12.123456" as time(5)) +10:11:12.12345 +select cast("10:11:12.123456" as time(6)); +cast("10:11:12.123456" as time(6)) +10:11:12.123456 +select cast("10:11:12" as time(6)); +cast("10:11:12" as time(6)) +10:11:12.000000 +select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time); +cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time) +08:46:06 +select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6)); +cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6)) +08:46:06.123456 +select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time); +cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time) +08:46:06 +select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6)); +cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6)) +08:46:06.123456 select cast(NULL as unsigned), cast(1/0 as unsigned); cast(NULL as unsigned) cast(1/0 as unsigned) NULL NULL @@ -318,13 +387,13 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column select cast(1 as decimal(5,6)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column ''). select cast(1 as double(66,6)); -ERROR 42000: Too big precision 66 specified for column '1'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65. select cast(1 as decimal(66,6)); -ERROR 42000: Too big precision 66 specified for column '1'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65. select cast(1 as decimal(64,63)); -ERROR 42000: Too big scale 63 specified for column '1'. Maximum is 30. +ERROR 42000: Too big scale 63 specified for '1'. Maximum is 30. select cast(1 as double(64,63)); -ERROR 42000: Too big scale 63 specified for column '1'. Maximum is 30. +ERROR 42000: Too big scale 63 specified for '1'. Maximum is 30. set names binary; select cast(_latin1'test' as char character set latin2); cast(_latin1'test' as char character set latin2) @@ -433,7 +502,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 CREATE TABLE t1 (a enum ('aac','aab','aaa') not null); INSERT INTO t1 VALUES ('aaa'),('aab'),('aac'); SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ; @@ -640,3 +709,29 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1 1 DROP TABLE t1; End of 5.1 tests +select cast("2101-00-01 02:03:04" as datetime); +cast("2101-00-01 02:03:04" as datetime) +2101-00-01 02:03:04 +select cast(cast("2101-00-01 02:03:04" as datetime) as time); +cast(cast("2101-00-01 02:03:04" as datetime) as time) +02:03:04 +SELECT CAST(CAST('20:05:05' AS TIME) as date); +CAST(CAST('20:05:05' AS TIME) as date) +0000-00-00 +set sql_mode= TRADITIONAL; +select cast("2101-00-01 02:03:04" as datetime); +cast("2101-00-01 02:03:04" as datetime) +2101-00-01 02:03:04 +select cast(cast("2101-00-01 02:03:04" as datetime) as time); +cast(cast("2101-00-01 02:03:04" as datetime) as time) +02:03:04 +SELECT CAST(CAST('20:05:05' AS TIME) as date); +CAST(CAST('20:05:05' AS TIME) as date) +0000-00-00 +set sql_mode=DEFAULT; +create table t1 (f1 time, f2 date, f3 datetime); +insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33'); +select cast(f1 as unsigned), cast(f2 as unsigned), cast(f3 as unsigned) from t1; +cast(f1 as unsigned) cast(f2 as unsigned) cast(f3 as unsigned) +112233 20111213 20111213112233 +drop table t1; diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index a919a6f8c5e..dd346cb94dc 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -196,16 +196,16 @@ date format datetime 0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02 03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 -2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450 -2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 -2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12 2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 10:20:10 %H:%i:%s 0000-00-00 10:20:10 10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10 10:20:10 %T 0000-00-00 10:20:10 10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10 10:20:10AM %r 0000-00-00 10:20:10 -10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10 15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 15 September 2001 %d %M %Y 2001-09-15 00:00:00 15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00 @@ -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; @@ -487,7 +487,7 @@ str_to_date(a,b) create table t2 select str_to_date(a,b) from t1; describe t2; Field Type Null Key Default Extra -str_to_date(a,b) datetime YES NULL +str_to_date(a,b) datetime(6) YES NULL select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1, str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2, str_to_date("2003-01-02", "%Y-%m-%d") as f3, @@ -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 ac87ea049a0..fdd26d7e543 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -794,3 +794,27 @@ 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; +create table t1 (f1 varchar(40)); +insert into t1 values ('2010-10-10 00:00:00.0001'),('2010-10-10 00:00:00.0002'),('2010-10-10 00:00:00.0003'); +select time(f1) from t1 ; +time(f1) +00:00:00.000100 +00:00:00.000200 +00:00:00.000300 +select distinct time(f1) from t1 ; +time(f1) +00:00:00.000100 +00:00:00.000200 +00:00:00.000300 +drop table t1; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 95750d02cda..ec1d623f3df 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -292,8 +292,11 @@ column_get(column_create(1, "2011-04-05" AS date), 1 as int) select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int); column_get(column_create(1, "8:46:06.23434" AS time), 1 as int) 84606 -select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as int); -column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as int) +select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int); +column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int) +84606 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int) 20110405084606 select column_get(column_create(1, NULL AS int), 1 as int); column_get(column_create(1, NULL AS int), 1 as int) @@ -393,9 +396,21 @@ column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8) select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8); column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8) 08:46:06.234340 +select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8); +column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8) +08:46:06.234340 +select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8); +column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8) +08:46:06.234340 select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8); column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8) 2011-04-05 08:46:06.234340 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8) +2011-04-05 08:46:06.234340 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8) +2011-04-05 08:46:06.234340 select column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8); column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8) NULL @@ -447,9 +462,15 @@ column_get(column_create(1, "2011-04-05" AS date), 1 as double) select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double); column_get(column_create(1, "8:46:06.23434" AS time), 1 as double) 84606.23434 +select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double); +column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double) +84606.23434 select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double); column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double) 20110405084606.2 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double) +20110405084606.2 select round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3); round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3) 20110405084606.234 @@ -516,9 +537,20 @@ column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6)) select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6)); column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6)) 84606.234340 -select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal(32,6)); -column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal(32,6)) -20110405084606.230000 +select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6)); +column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6)) +84606.234340 +select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6)); +column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6)) +20110405084606.123456 +select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6)); +column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6)) +20110405084606.123456 +select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8)); +column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8)) +20110405084606.12345600 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2011-04-05 8:46:06.12345678' select column_get(column_create(1, NULL as decimal), 1 as decimal(32,10)); column_get(column_create(1, NULL as decimal), 1 as decimal(32,10)) NULL @@ -589,10 +621,10 @@ column_get(column_create(1, 0.0 AS decimal,2, 0.0 as decimal), 1 as decimal) # select column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime); column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime) -2001-02-03 10:11:12.125000 +2001-02-03 10:11:12 select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime); column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime) -2001-02-03 10:11:12.121314 +2001-02-03 10:11:12 select column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime); column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime) 2001-02-03 10:11:12 @@ -607,19 +639,25 @@ column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as datetime) 2001-02-03 10:11:12 select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime); column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime) -2001-02-03 10:11:12.121314 +2001-02-03 10:11:12 select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime); column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime) -2001-02-03 10:11:12.121314 +2001-02-03 10:11:12 select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime); column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime) +2011-04-05 08:46:06 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0)); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0)) +2011-04-05 08:46:06 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6)); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6)) 2011-04-05 08:46:06.234340 select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime); column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime) -2011-00-00 08:46:06.234340 +2011-00-00 08:46:06 select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime); column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime) -2011-00-01 08:46:06.234340 +2011-00-01 08:46:06 select column_get(column_create(1, 20010203 as unsigned int), 1 as datetime); column_get(column_create(1, 20010203 as unsigned int), 1 as datetime) 2001-02-03 00:00:00 @@ -649,11 +687,11 @@ column_get(column_create(1, "2001021"), 1 as datetime) 2020-01-02 01:00:00 select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime); column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime) -0000-00-00 08:46:06.234340 +0000-00-00 08:46:06 set @@sql_mode="allow_invalid_dates"; select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime); column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime) -2011-02-30 18:46:06.234340 +2011-02-30 18:46:06 select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime); column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime) 0000-00-00 00:00:00 @@ -852,10 +890,10 @@ Warning 1292 Incorrect datetime value: '0' # select column_get(column_create(1, 20010203101112.121314 as double), 1 as time); column_get(column_create(1, 20010203101112.121314 as double), 1 as time) -10:11:12.100000 +10:11:12 select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time); column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time) -10:11:12.121314 +10:11:12 select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time); column_get(column_create(1, 20010203101112 as unsigned int), 1 as time) 10:11:12 @@ -870,33 +908,39 @@ column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time) 10:11:12 select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time); column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time) +10:11:12 +select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6)); +column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6)) 10:11:12.121314 select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time); column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time) -10:11:12.121314 -select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time); -column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time) +10:11:12 +select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6)); +column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6)) 08:46:06.234340 -select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time); -column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time) +select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6)); +column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6)) 08:46:06.234340 -select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time); -column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time) +select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6)); +column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6)) 08:46:06.234340 -select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time); -column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time) +select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6)); +column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6)) 830:46:06.234340 -select cast("-830:46:06.23434" AS time); -cast("-830:46:06.23434" AS time) +select column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6)); +column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6)) +830:46:06.000000 +select cast("-830:46:06.23434" AS time(6)); +cast("-830:46:06.23434" AS time(6)) -830:46:06.234340 -select 1,cast("-830:46:06.23434" AS time); -1 cast("-830:46:06.23434" AS time) +select 1,cast("-830:46:06.23434" AS time(6)); +1 cast("-830:46:06.23434" AS time(6)) 1 -830:46:06.234340 select hex(column_create(1, "-830:46:06.23434" AS CHAR)); hex(column_create(1, "-830:46:06.23434" AS CHAR)) 000100010003082D3833303A34363A30362E3233343334 -select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time); -column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time) +select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6)); +column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6)) -830:46:06.234340 select column_get(column_create(1, "0" AS CHAR), 1 as time); column_get(column_create(1, "0" AS CHAR), 1 as time) @@ -919,12 +963,17 @@ column_get(column_create(1, "2001021"), 1 as time) set @@sql_mode="allow_invalid_dates"; select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time); column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time) -18:46:06.234340 +18:46:06 set @@sql_mode=""; # column get date truncation & warnings select column_get(column_create(1, "1223.5aa" AS char), 1 as time); column_get(column_create(1, "1223.5aa" AS char), 1 as time) -00:12:23.500000 +00:12:23 +Warnings: +Warning 1292 Truncated incorrect time value: '1223.5aa' +select column_get(column_create(1, "1223.5aa" AS char), 1 as time(3)); +column_get(column_create(1, "1223.5aa" AS char), 1 as time(3)) +00:12:23.500 Warnings: Warning 1292 Truncated incorrect time value: '1223.5aa' select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time); diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 022a32d9c9b..4f21fd57b88 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -24,7 +24,7 @@ select count(*),b from t1; ERROR 42S22: Unknown column 'b' in 'field list' drop table t1; create table t1 (a int(256)); -ERROR 42000: Display width out of range for column 'a' (max = 255) +ERROR 42000: Display width out of range for 'a' (max = 255) set sql_mode='traditional'; create table t1 (a varchar(66000)); ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead diff --git a/mysql-test/r/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 2e6dcb23e41..c7b30e4d4fb 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 49c6655a937..bdaa45374a7 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..ca79f53ff5b 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"); @@ -195,17 +195,17 @@ time("1997-12-31 23:59:59.000001") as f9; describe t1; Field Type Null Key Default Extra f1 date YES NULL -f2 datetime YES NULL -f3 time YES NULL -f4 time YES NULL -f5 time YES NULL +f2 datetime(6) YES NULL +f3 time(6) YES NULL +f4 time(6) YES NULL +f5 time(6) YES NULL f6 time YES NULL -f7 datetime YES NULL +f7 datetime(6) YES NULL f8 date YES NULL -f9 time YES NULL +f9 time(6) YES NULL select * from t1; f1 f2 f3 f4 f5 f6 f7 f8 f9 -1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -24:00:00 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59 +1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 -24:00:00.000001 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001 create table test(t1 datetime, t2 time, t3 time, t4 datetime); insert into test values ('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'), diff --git a/mysql-test/r/func_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 f99f2a09fc9..b2a47377b05 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -8,20 +8,25 @@ 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(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899); +sec_to_time(9001.1) time_to_sec('15:12:22.123456') time_to_sec(15.5566778899) +02:30:01.1 54742.123456 15.556677 +Warnings: +Warning 1292 Truncated incorrect time value: '15.5566778899' select sec_to_time(time_to_sec('-838:59:59')); sec_to_time(time_to_sec('-838:59:59')) -838:59:59 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 @@ -52,6 +57,9 @@ DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303) select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322); HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322) 23 3 22 +select TIME(230322), TIME(230322.33), TIME("230322.33"); +TIME(230322) TIME(230322.33) TIME("230322.33") +23:03:22 23:03:22.33 23:03:22.330000 select week(19980101),week(19970101),week(19980101,1),week(19970101,1); week(19980101) week(19970101) week(19980101,1) week(19970101,1) 0 0 1 1 @@ -546,7 +554,7 @@ unix_timestamp(@a) 1 select unix_timestamp('1969-12-01 19:00:01'); unix_timestamp('1969-12-01 19:00:01') -0 +NULL select from_unixtime(-1); from_unixtime(-1) NULL @@ -567,22 +575,22 @@ unix_timestamp(from_unixtime(2147483648)) NULL select unix_timestamp('2039-01-20 01:00:00'); unix_timestamp('2039-01-20 01:00:00') -0 +NULL select unix_timestamp('1968-01-20 01:00:00'); unix_timestamp('1968-01-20 01:00:00') -0 +NULL select unix_timestamp('2038-02-10 01:00:00'); unix_timestamp('2038-02-10 01:00:00') -0 +NULL select unix_timestamp('1969-11-20 01:00:00'); unix_timestamp('1969-11-20 01:00:00') -0 +NULL select unix_timestamp('2038-01-20 01:00:00'); unix_timestamp('2038-01-20 01:00:00') -0 +NULL select unix_timestamp('1969-12-30 01:00:00'); unix_timestamp('1969-12-30 01:00:00') -0 +NULL select unix_timestamp('2038-01-17 12:00:00'); unix_timestamp('2038-01-17 12:00:00') 2147331600 @@ -591,7 +599,7 @@ unix_timestamp('1970-01-01 03:00:01') 1 select unix_timestamp('2038-01-19 07:14:07'); unix_timestamp('2038-01-19 07:14:07') -0 +NULL SELECT CHARSET(DAYNAME(19700101)); CHARSET(DAYNAME(19700101)) latin1 @@ -798,9 +806,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, @@ -814,7 +820,7 @@ create table t1 select last_day('2000-02-05') as a, from_days(to_days("960101")) as b; describe t1; Field Type Null Key Default Extra -a date NO 0000-00-00 +a date YES NULL b date YES NULL select * from t1; a b @@ -941,10 +947,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 +960,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 +970,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 @@ -1220,6 +1226,13 @@ 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 +select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute; +str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute +NULL +Warnings: +Error 1411 Incorrect datetime value: '1997-00-04 22:23:00' for function str_to_date create table t1 (field DATE); insert into t1 values ('2006-11-06'); select * from t1 where field < '2006-11-06 04:08:36.0'; @@ -1399,8 +1412,6 @@ NULL # Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING # SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025)); -CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025)) -NULL # # Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME # @@ -1420,3 +1431,194 @@ SELECT DATE_FORMAT('0000-00-11', '%w'); DATE_FORMAT('0000-00-11', '%w') NULL End of 5.1 tests +select time('10:10:10') > 10; +time('10:10:10') > 10 +1 +select time('10:10:10') > 1010; +time('10:10:10') > 1010 +1 +select time('10:10:09') > 101010; +time('10:10:09') > 101010 +0 +select time('10:10:10') > 101010; +time('10:10:10') > 101010 +0 +select time('10:10:11') > 101010; +time('10:10:11') > 101010 +1 +select time(' 1 02:03:04') + interval 9 microsecond; +time(' 1 02:03:04') + interval 9 microsecond +26:03:04.000009 +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 +select cast(str_to_date(NULL, '%H:%i:%s') as time); +cast(str_to_date(NULL, '%H:%i:%s') as time) +NULL +create table t1 (f1 datetime, key (f1)); +insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49'); +select * from t1 where f1 > time('-23:00:06'); +f1 +2000-09-12 00:00:00 +2007-04-25 05:08:49 +Warnings: +Warning 1292 Incorrect datetime value: '-23:00:06' for column 'f1' at row 1 +drop table t1; +select maketime(20,61,10)+0; +maketime(20,61,10)+0 +NULL +create table t1 (f2 int not null) ; +insert into t1 values (0),(0); +select last_day(f2) from t1; +last_day(f2) +NULL +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +select last_day(f2) from t1 where last_day(f2) is null; +last_day(f2) +NULL +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +select * from t1 order by last_day (f2); +f2 +0 +0 +Warnings: +Warning 1292 Incorrect datetime value: '0' +Warning 1292 Incorrect datetime value: '0' +drop table t1; +select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); +convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow') +NULL +create table t1 (f1 integer, f2 date); +insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'),(6, '2011-05-06'); +select * from t1 where 1 and concat(f2)=MAKEDATE(2011, 125); +f1 f2 +1 2011-05-05 +2 2011-05-05 +3 2011-05-05 +4 2011-05-05 +5 2011-05-05 +drop table t1; +create table t1 (f1 timestamp); +insert into t1 values ('0000-00-00 00:00:00'); +select least(1, f1) from t1; +least(1, f1) +0000-00-00 00:00:00 +Warnings: +Warning 1292 Incorrect datetime value: '1' for column 'f1' at row 1 +drop table t1; +select now() > coalesce(time('21:43:24'), date('2010-05-03')); +now() > coalesce(time('21:43:24'), date('2010-05-03')) +1 +create table t1 (f1 timestamp); +select * from t1 where f1 > f1 and f1 <=> timestampadd(hour, 9 , '2010-01-01 16:55:35'); +f1 +drop table t1; +create table t1 (f1 date); +insert into t1 values ('0000-00-00'); +select timestampadd(week, 1, f1) from t1; +timestampadd(week, 1, f1) +NULL +select timestampadd(week, 1, date("0000-00-00")); +timestampadd(week, 1, date("0000-00-00")) +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +drop table t1; +create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp); +insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00'); +select least(greatest(f3, f2, f4), f5) from t1; +least(greatest(f3, f2, f4), f5) +0000-00-00 00:00:00 +drop table t1; +select day(coalesce(null)); +day(coalesce(null)) +NULL +select timestamp(greatest('2002-08-20', '0000-00-00 00:00:00')); +timestamp(greatest('2002-08-20', '0000-00-00 00:00:00')) +2002-08-20 00:00:00 +create table t1 (f1 datetime); +insert into t1 values ('0000-00-00 00:00:00'); +select cast(f1 AS time) from t1; +cast(f1 AS time) +00:00:00 +drop table t1; +select greatest(cast("0-0-0" as date), cast("10:20:05" as time)); +greatest(cast("0-0-0" as date), cast("10:20:05" as time)) +0000-00-00 +select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'; +greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' +1 +select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)); +cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) +0000-00-00 00:00:00.000000 diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result new file mode 100644 index 00000000000..8a4a9db8da5 --- /dev/null +++ b/mysql-test/r/func_time_hires.result @@ -0,0 +1,206 @@ +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01.123456'); +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 42000: Too big precision 7 specified for 'now'. Maximum is 6. +select curtime(7); +ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6. +drop table if exists t1; +create table t1 select sec_to_time(12345), sec_to_time(12345.6789), +sec_to_time(1234567e-2), now(), curtime(0), +utc_timestamp(1), utc_time(2), current_time(3), +current_timestamp(4), localtime(5), localtimestamp(6), +time_to_sec(123456), 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(6) DEFAULT NULL, + `now()` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `curtime(0)` time NOT NULL DEFAULT '00:00:00', + `utc_timestamp(1)` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', + `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(123456)` bigint(17) 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.670000 +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(123456) 45296 +time_to_sec('12:34:56.789') 45296.789 +drop table t1; +select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));; +unix_timestamp('2011-01-01 01:01:01') 1293832861 +unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.12346 +unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861 +unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1235 +select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));; +from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01 +from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456 +from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01 +from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234 +select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999); +sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999) +838:59:59.99999 838:59:59.999999 838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '3020399.9999999' +select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999); +sec_to_time(-3020399.99999) sec_to_time(-3020399.999999) sec_to_time(-3020399.9999999) +-838:59:59.99999 -838:59:59.999999 -838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-3020399.9999999' +select 20010101000203.000000004 + interval 1 day; +20010101000203.000000004 + interval 1 day +2001-01-02 00:02:03.000000 +Warnings: +Warning 1292 Truncated incorrect datetime value: '20010101000203.000000004' +select 20010101000203.00004 + interval 1 day; +20010101000203.00004 + interval 1 day +2001-01-02 00:02:03.00004 +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 '(@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; +create table t1 (f1 timestamp(6)); +insert into t1 values ('2002-07-15 21:00:00'); +select time(f1) from t1; +time(f1) +21:00:00.000000 +select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; +time(f1) +21:00:00.000000 +21:00:01.000000 +alter table t1 modify f1 timestamp; +select time(f1) from t1; +time(f1) +21:00:00 +select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; +time(f1) +21:00:00 +21:00:01 +alter table t1 modify f1 varchar(100); +select time(f1) from t1; +time(f1) +21:00:00 +select time(f1) from t1 union all select time(f1 + interval 1 second) from t1; +time(f1) +21:00:00.000000 +21:00:01.000000 +drop table t1; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index fb229cf9e3b..fc2df2b7fc2 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -473,7 +473,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort 1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where 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 (('7' = 8) and (`test`.`table1`.`f1` >= 6)) +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 ((7 = 8) and (`test`.`table1`.`f1` >= 6)) EXPLAIN EXTENDED SELECT table1.f1, table2.f2 FROM t1 AS table1 @@ -485,7 +485,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort 1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where 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 ('7' = 8) +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 (7 = 8) 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 b32e25ef07e..943f22318f5 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -216,8 +216,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 @@ -1489,9 +1489,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_cache.result b/mysql-test/r/join_cache.result index 3bc8392e25a..bb28ed36f62 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -3032,7 +3032,7 @@ t6.formattypeid IN (2) AND (t3.formatid IN (31, 8, 76)) AND t1.metaid = t2.metaid AND t1.affiliateid = '2'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t6 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t1 ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 1 +1 SIMPLE t1 ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 1 Using index condition 1 SIMPLE t4 ref PRIMARY,t4_formatclassid,t4_formats_idx t4_formats_idx 1 const 1 Using index condition; Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t5 eq_ref PRIMARY,t5_formattypeid PRIMARY 4 test.t4.formatclassid 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index c1171570dca..c8e174f5a58 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(0) 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(0) 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/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 5b679b9b083..eb04e7170a7 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1309,7 +1309,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(0) 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(0) 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 59a1b904744..4826fc8fb4b 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/log_slow.result b/mysql-test/r/log_slow.result index b6341109556..276dc5db3a7 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -45,10 +45,10 @@ select @@log_slow_verbosity; innodb show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +start_time timestamp(6) NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP user_host mediumtext NO NULL -query_time time NO NULL -lock_time time NO NULL +query_time time(6) NO NULL +lock_time time(6) NO NULL rows_sent int(11) NO NULL rows_examined int(11) NO NULL db varchar(512) NO NULL diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 654f9d127d3..6987ab94d74 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -55,7 +55,7 @@ sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text -TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(@long_query_time + 1) +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 1) # Switch to connection default show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index c6eaf9b6625..4b83ce31bd0 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -53,7 +53,7 @@ ERROR HY000: You can't use locks with log tables. show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -62,7 +62,7 @@ general_log CREATE TABLE `general_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' show fields from mysql.general_log; Field Type Null Key Default Extra -event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +event_time timestamp(6) NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP user_host mediumtext NO NULL thread_id int(11) NO NULL server_id int(10) unsigned NO NULL @@ -71,10 +71,10 @@ argument mediumtext NO NULL show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -85,10 +85,10 @@ slow_log CREATE TABLE `slow_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +start_time timestamp(6) NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP user_host mediumtext NO NULL -query_time time NO NULL -lock_time time NO NULL +query_time time(6) NO NULL +lock_time time(6) NO NULL rows_sent int(11) NO NULL rows_examined int(11) NO NULL db varchar(512) NO NULL @@ -147,7 +147,7 @@ sleep(2) 0 select * from mysql.slow_log; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text -TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 mysql 0 0 1 select sleep(2) +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) set @@session.long_query_time = @saved_long_query_time; alter table mysql.general_log engine=myisam; ERROR HY000: You cannot 'ALTER' a log table if logging is enabled @@ -164,7 +164,7 @@ set global slow_query_log='OFF'; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -174,10 +174,10 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -191,7 +191,7 @@ alter table mysql.slow_log engine=myisam; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -201,10 +201,10 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -264,7 +264,7 @@ drop table mysql.slow_log; ERROR 42S02: Unknown table 'slow_log' use mysql; CREATE TABLE `general_log` ( -`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, @@ -273,11 +273,11 @@ ON UPDATE CURRENT_TIMESTAMP, `argument` mediumtext NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; CREATE TABLE `slow_log` ( -`start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +`start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, -`query_time` time NOT NULL, -`lock_time` time NOT NULL, +`query_time` time(6) NOT NULL, +`lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, @@ -429,9 +429,9 @@ My own slow query sleep(2) My own slow query 0 SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text seq -START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 -START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 -START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 2 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 SET GLOBAL slow_query_log = 0; SET SESSION long_query_time =@saved_long_query_time; FLUSH LOGS; @@ -525,10 +525,10 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`; DROP DATABASE IF EXISTS `db_17876`; CREATE DATABASE db_17876; CREATE TABLE `db_17876.slow_log_data` ( -`start_time` timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, +`start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `user_host` mediumtext , -`query_time` time , -`lock_time` time , +`query_time` time(6) , +`lock_time` time(6) , `rows_sent` int(11) , `rows_examined` int(11) , `db` varchar(512) default NULL, @@ -538,7 +538,7 @@ CREATE TABLE `db_17876.slow_log_data` ( `sql_text` mediumtext ); CREATE TABLE `db_17876.general_log_data` ( -`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext, `thread_id` int(11) DEFAULT NULL, `server_id` int(11) DEFAULT NULL, @@ -547,7 +547,7 @@ CREATE TABLE `db_17876.general_log_data` ( ); CREATE procedure `db_17876.archiveSlowLog`() BEGIN -DECLARE start_time, query_time, lock_time CHAR(20); +DECLARE start_time, query_time, lock_time CHAR(28); DECLARE user_host MEDIUMTEXT; DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; DECLARE dbname MEDIUMTEXT; @@ -580,7 +580,7 @@ TRUNCATE mysql.slow_log; END // CREATE procedure `db_17876.archiveGeneralLog`() BEGIN -DECLARE event_time CHAR(20); +DECLARE event_time CHAR(28); DECLARE user_host, argument MEDIUMTEXT; DECLARE thread_id, server_id INT; DECLARE sql_text BLOB; diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 2f9fb6b67f5..e209193a2c0 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 @@ -210,3 +210,9 @@ f1 DROP VIEW v1; DROP TABLE t1; End of 5.0 tests +select cast('01:01:01' as time), cast('01:01:01' as time(2)); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def cast('01:01:01' as time) 11 9 8 Y 128 0 63 +def cast('01:01:01' as time(2)) 11 12 11 Y 128 2 63 +cast('01:01:01' as time) cast('01:01:01' as time(2)) +01:01:01 01:01:01.00 diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index df3d7be6714..0a6bf354f5d 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -667,7 +667,7 @@ CREATE TABLE t1 (f1 DATE); INSERT INTO t1 VALUES('2001-01-01'); UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; Warnings: -Warning 1292 Truncated incorrect datetime value: '1' +Warning 1292 Truncated incorrect date value: '1' DROP FUNCTION f1; DROP TABLE t1; end of tests 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/partition_error.result b/mysql-test/r/partition_error.result index 269b6875430..0791b979da1 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -51,14 +51,14 @@ PARTITION BY RANGE (DAYOFWEEK(a)) (PARTITION a1 VALUES LESS THAN (60)); INSERT INTO t1 VALUES ('test'),('a'),('5'); Warnings: -Warning 1264 Out of range value for column 'a' at row 1 -Warning 1264 Out of range value for column 'a' at row 2 -Warning 1264 Out of range value for column 'a' at row 3 +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 SHOW WARNINGS; Level Code Message -Warning 1264 Out of range value for column 'a' at row 1 -Warning 1264 Out of range value for column 'a' at row 2 -Warning 1264 Out of range value for column 'a' at row 3 +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 DROP TABLE t1; CREATE TABLE t1 (a TIME) PARTITION BY RANGE (DAYOFWEEK(a)) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index e13790f8eaf..ca847188ce9 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3043,3 +3043,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 751a545d988..b1ecd0d5d2e 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 @@ -1793,8 +1793,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1823,8 +1823,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -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,208 @@ 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( 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 +3359,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 +3385,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 +3397,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 9ba5e607b5d..c99d5596ace 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 @@ -1776,8 +1776,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1806,8 +1806,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -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,208 @@ 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( 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 +3342,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 +3368,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 +3380,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 e7252473c49..1f7f981ef64 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 @@ -1777,8 +1777,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1807,8 +1807,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -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,208 @@ 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( 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 +3343,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 +3369,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 +3381,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 7530b3ebe0b..b965f2e968f 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 @@ -1713,8 +1713,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -1743,8 +1743,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -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,208 @@ 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( 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 +3279,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 +3305,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 +3317,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 +3460,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 @@ -4735,8 +5067,8 @@ t5 CREATE TABLE `t5` ( `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, + `const10` double NOT NULL DEFAULT '0', + `param10` double DEFAULT NULL, `const11` int(4) DEFAULT NULL, `param11` bigint(20) DEFAULT NULL, `const12` binary(0) DEFAULT NULL, @@ -4765,8 +5097,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const10 const10 5 49 9 N 32769 31 63 +def test t5 t5 param10 param10 5 23 9 Y 32768 31 63 def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 @@ -5704,46 +6036,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 +6400,208 @@ 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 23, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +insert into t9 +( 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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +insert into t9 +( c1, c13, c14, c15, c16, c17 ) +values +( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt1 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +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 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +prepare stmt2 from "insert into t9 + ( c1, c13, c14, c15, c16, c17 ) +values + ( 33, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ; Warnings: Note 1265 Data truncated for column 'c13' at row 1 +Note 1265 Data truncated for column 'c16' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 +set @arg00= 2000000000 ; +insert into t9 +( 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 +6633,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 +6659,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 +6671,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 eb0c009d92a..c8242708217 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 index condition 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 @@ -1768,3 +1760,9 @@ SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk; pk i4 pk i4 DROP TABLE t1; End of 5.1 tests +create table t1 (f1 datetime, key (f1)); +insert into t1 values ('2000-03-09 15:56:59'),('2000-05-05 23:24:28'),('2000-06-13 13:12:06'); +select min(f1) from t1 where f1 >= '2006-05-25 07:00:20' and f1 between '2003-11-23 10:00:09' and '2010-01-01 01:01:01' and f1 > '2001-01-01 01:01:01'; +min(f1) +NULL +drop table t1; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index f9d6c80018b..5161292af76 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; @@ -4092,16 +4092,21 @@ 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/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/20 00:00:00 GMT-6' select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' -1 +0 Warnings: Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; @@ -4167,33 +4172,24 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' set SQL_MODE=TRADITIONAL; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' -0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +1 select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' 0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' 0 -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 @@ -4220,18 +4216,27 @@ 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 -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00' +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' +1 +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL +NULL +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' +NULL +select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL 0 -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' 0 +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL +NULL CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, c22 INT DEFAULT NULL, @@ -4606,8 +4611,8 @@ a 4 5 DROP TABLE t1; -CREATE TABLE A (date_key date); -CREATE TABLE C ( +CREATE TABLE t1 (date_key date); +CREATE TABLE t2 ( pk int, int_nokey int, int_key int, @@ -4615,29 +4620,27 @@ date_key date NOT NULL, date_nokey date, varchar_key varchar(1) ); -INSERT INTO C VALUES +INSERT INTO t2 VALUES (1,1,1,'0000-00-00',NULL,NULL), (1,1,1,'0000-00-00',NULL,NULL); -SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); +SELECT 1 FROM t2 WHERE pk > ANY (SELECT 1 FROM t2); 1 -SELECT COUNT(DISTINCT 1) FROM C -WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +SELECT COUNT(DISTINCT 1) FROM t2 +WHERE date_key = (SELECT 1 FROM t1 WHERE t2.date_key IS NULL) GROUP BY pk; COUNT(DISTINCT 1) -SELECT date_nokey FROM C -WHERE int_key IN (SELECT 1 FROM A) +SELECT date_nokey FROM t2 +WHERE int_key IN (SELECT 1 FROM t1) 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; +DROP TABLE t1,t2; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); 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/select_jcl6.result b/mysql-test/r/select_jcl6.result index ca7241d8f87..9b0e2fa01fa 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -2122,8 +2122,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; @@ -4099,16 +4099,21 @@ 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/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/20 00:00:00 GMT-6' select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' -1 +0 Warnings: Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; @@ -4174,33 +4179,24 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' set SQL_MODE=TRADITIONAL; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' -0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +1 select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' 0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' 0 -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 @@ -4227,18 +4223,27 @@ 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 -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00' +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' +1 +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL +NULL +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' +NULL +select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL 0 -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' 0 +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL +NULL CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, c22 INT DEFAULT NULL, @@ -4613,8 +4618,8 @@ a 4 5 DROP TABLE t1; -CREATE TABLE A (date_key date); -CREATE TABLE C ( +CREATE TABLE t1 (date_key date); +CREATE TABLE t2 ( pk int, int_nokey int, int_key int, @@ -4622,29 +4627,27 @@ date_key date NOT NULL, date_nokey date, varchar_key varchar(1) ); -INSERT INTO C VALUES +INSERT INTO t2 VALUES (1,1,1,'0000-00-00',NULL,NULL), (1,1,1,'0000-00-00',NULL,NULL); -SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); +SELECT 1 FROM t2 WHERE pk > ANY (SELECT 1 FROM t2); 1 -SELECT COUNT(DISTINCT 1) FROM C -WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +SELECT COUNT(DISTINCT 1) FROM t2 +WHERE date_key = (SELECT 1 FROM t1 WHERE t2.date_key IS NULL) GROUP BY pk; COUNT(DISTINCT 1) -SELECT date_nokey FROM C -WHERE int_key IN (SELECT 1 FROM A) +SELECT date_nokey FROM t2 +WHERE int_key IN (SELECT 1 FROM t1) 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; +DROP TABLE t1,t2; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); 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/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index f9d6c80018b..5161292af76 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.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; @@ -4092,16 +4092,21 @@ 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/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/20 00:00:00 GMT-6' select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' -1 +0 Warnings: Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; @@ -4167,33 +4172,24 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' set SQL_MODE=TRADITIONAL; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' -0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +1 select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' 0 -Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' 0 -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 @@ -4220,18 +4216,27 @@ 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 -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00' +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' +1 +select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL +NULL +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' +NULL +select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL 0 -select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL; -str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' 0 +select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL; +str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL +NULL CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, c22 INT DEFAULT NULL, @@ -4606,8 +4611,8 @@ a 4 5 DROP TABLE t1; -CREATE TABLE A (date_key date); -CREATE TABLE C ( +CREATE TABLE t1 (date_key date); +CREATE TABLE t2 ( pk int, int_nokey int, int_key int, @@ -4615,29 +4620,27 @@ date_key date NOT NULL, date_nokey date, varchar_key varchar(1) ); -INSERT INTO C VALUES +INSERT INTO t2 VALUES (1,1,1,'0000-00-00',NULL,NULL), (1,1,1,'0000-00-00',NULL,NULL); -SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); +SELECT 1 FROM t2 WHERE pk > ANY (SELECT 1 FROM t2); 1 -SELECT COUNT(DISTINCT 1) FROM C -WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +SELECT COUNT(DISTINCT 1) FROM t2 +WHERE date_key = (SELECT 1 FROM t1 WHERE t2.date_key IS NULL) GROUP BY pk; COUNT(DISTINCT 1) -SELECT date_nokey FROM C -WHERE int_key IN (SELECT 1 FROM A) +SELECT date_nokey FROM t2 +WHERE int_key IN (SELECT 1 FROM t1) 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; +DROP TABLE t1,t2; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); 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 6cd70466d1b..15ddc2b44f5 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 9370b63e847..3f057c1ad2d 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 88c6ddbfd95..31159051749 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 @@ -260,26 +260,26 @@ INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE)); INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE)); -ERROR 22007: Incorrect datetime value: '2004-10-0' +ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE)); -ERROR 22007: Incorrect datetime value: '2004-0-10' +ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30' +ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-0-10 15:30' +ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col2' at row 1 INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30' +ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-0-10 15:30' +ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col3' at row 1 drop table t1; CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp); INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE)); @@ -287,28 +287,28 @@ INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE)); INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE)); -ERROR 22007: Incorrect datetime value: '2004-10-0' +ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE)); -ERROR 22007: Incorrect datetime value: '2004-0-10' +ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES('2004-0-10'); ERROR 22007: Incorrect date value: '2004-0-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30' +ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-0-10 15:30' +ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col2' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30' +ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); -ERROR 22007: Incorrect datetime value: '2004-0-10 15:30' +ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col3' at row 1 drop table t1; CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED); INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0); @@ -1136,9 +1136,9 @@ ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1 insert into t1 values (0.0,0.0,0.0); ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1 insert into t1 (col1) values (convert('0000-00-00',date)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 insert into t1 (col1) values (cast('0000-00-00' as date)); -ERROR 22007: Incorrect datetime value: '0000-00-00' +ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 set sql_mode='no_zero_date'; insert into t1 values (0,0,0); Warnings: @@ -1155,15 +1155,15 @@ 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' +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 alter table t1 modify col1 datetime; @@ -1172,13 +1172,14 @@ alter ignore table t1 modify col1 datetime; Warnings: Warning 1264 Out of range value for column 'col1' at row 1 Warning 1264 Out of range value for column 'col1' at row 2 +Warning 1264 Out of range value for column 'col1' at row 3 insert into t1 select * from t1; ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1 select * from t1; col1 0000-00-00 00:00:00 0000-00-00 00:00:00 -NULL +0000-00-00 00:00:00 drop table t1; create table t1 (col1 tinyint); drop procedure if exists t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index f289e46c42c..475f868b64d 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -53,7 +53,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 (<expr_cache><'1'>((select '1')) = 1) +Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><1>((select 1)) = 1) SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -206,7 +206,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 @@ -317,7 +317,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 <expr_cache><`test`.`t2`.`a`>((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 <expr_cache><`test`.`t2`.`a`>((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)); @@ -546,13 +546,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); @@ -592,7 +592,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 @@ -1185,7 +1185,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1195,7 +1195,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 1aa45d467e6..c701f90ed3d 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -57,7 +57,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 (<expr_cache><'1'>((select '1')) = 1) +Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><1>((select 1)) = 1) SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -210,7 +210,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 @@ -321,7 +321,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 <expr_cache><`test`.`t2`.`a`>((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 <expr_cache><`test`.`t2`.`a`>((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)); @@ -550,13 +550,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); @@ -596,7 +596,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 @@ -1189,7 +1189,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1199,7 +1199,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index d1aaebedcb5..ff22469f092 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -54,7 +54,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 (<expr_cache><'1'>((select '1')) = 1) +Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><1>((select 1)) = 1) SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -207,7 +207,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 @@ -318,7 +318,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 <expr_cache><`test`.`t2`.`a`>((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 <expr_cache><`test`.`t2`.`a`>((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)); @@ -547,13 +547,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); @@ -593,7 +593,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 @@ -1186,7 +1186,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1196,7 +1196,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 1d25894c8ce..18d365e9c79 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -54,7 +54,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 (<expr_cache><'1'>((select '1')) = 1) +Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><1>((select 1)) = 1) SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -207,7 +207,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 @@ -318,7 +318,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 <expr_cache><`test`.`t2`.`a`>((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 <expr_cache><`test`.`t2`.`a`>((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)); @@ -547,13 +547,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); @@ -593,7 +593,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 @@ -1186,7 +1186,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) @@ -1196,7 +1196,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (<cache>(0) = 1))) AS `0 IN (SELECT 1 FROM t1 a)` +Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; CREATE TABLE `t1` ( `i` int(11) NOT NULL default '0', 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/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index aa407b25401..d3cbc134de9 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -240,7 +240,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, `thread_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -250,10 +250,10 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext NOT NULL, - `query_time` time NOT NULL, - `lock_time` time NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, `rows_sent` int(11) NOT NULL, `rows_examined` int(11) NOT NULL, `db` varchar(512) NOT NULL, diff --git a/mysql-test/r/timezone.result b/mysql-test/r/timezone.result index 1223fff36c6..d84fe54ba8c 100644 --- a/mysql-test/r/timezone.result +++ b/mysql-test/r/timezone.result @@ -44,4 +44,7 @@ unix_timestamp('1970-01-01 01:00:01'), unix_timestamp('2038-01-19 04:14:07'), unix_timestamp('2038-01-19 04:14:08'); unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-19 04:14:07') unix_timestamp('2038-01-19 04:14:08') -0 1 2147483647 0 +0 1 2147483647 NULL +select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59'); +unix_timestamp('1969-12-31 23:59:59') unix_timestamp('1970-01-01 00:00:00') unix_timestamp('1970-01-01 00:59:59') +NULL NULL NULL diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index e2e337628ce..8c2cd4cb88d 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -119,7 +119,6 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'), ('2038-01-19 03:14:07'),('2038-01-19 03:14:08'); Warnings: Warning 1264 Out of range value for column 'ts' at row 2 -Warning 1264 Out of range value for column 'ts' at row 3 Warning 1264 Out of range value for column 'ts' at row 6 select * from t1; ts @@ -136,7 +135,6 @@ insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'), ('2038-01-19 04:14:07'),('2038-01-19 04:14:08'); Warnings: Warning 1264 Out of range value for column 'ts' at row 2 -Warning 1264 Out of range value for column 'ts' at row 3 Warning 1264 Out of range value for column 'ts' at row 6 select * from t1; ts @@ -153,7 +151,6 @@ insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'), ('2038-01-19 04:44:07'),('2038-01-19 04:44:08'); Warnings: Warning 1264 Out of range value for column 'ts' at row 2 -Warning 1264 Out of range value for column 'ts' at row 3 Warning 1264 Out of range value for column 'ts' at row 6 select * from t1; ts diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 9f32a10a3fb..50042a428c7 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -36,7 +36,7 @@ select 0 + b'1000000000000001'; 32769 drop table if exists t1,t2; create table t1 (a bit(65)); -ERROR 42000: Display width out of range for column 'a' (max = 64) +ERROR 42000: Display width out of range for 'a' (max = 64) create table t1 (a bit(0)); show create table t1; Table Create Table diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result index a9c3cae1770..071b1c3b97b 100644 --- a/mysql-test/r/type_bit_innodb.result +++ b/mysql-test/r/type_bit_innodb.result @@ -36,7 +36,7 @@ select 0 + b'1000000000000001'; 32769 drop table if exists t1; create table t1 (a bit(65)) engine=innodb; -ERROR 42000: Display width out of range for column 'a' (max = 64) +ERROR 42000: Display width out of range for 'a' (max = 64) create table t1 (a bit(0)) engine=innodb; show create table t1; Table Create Table diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 1de119f0d24..7736fc4350a 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -833,7 +833,7 @@ drop table b15776; create table b15776 (data blob(4294967295)); drop table b15776; create table b15776 (data blob(4294967296)); -ERROR 42000: Display width out of range for column 'data' (max = 4294967295) +ERROR 42000: Display width out of range for 'data' (max = 4294967295) CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) ); show columns from b15776; Field Type Null Key Default Extra @@ -845,13 +845,13 @@ b1 longtext YES NULL c1 longtext YES NULL drop table b15776; CREATE TABLE b15776 (a blob(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a text(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a int(0)); INSERT INTO b15776 values (NULL), (1), (42), (654); SELECT * from b15776 ORDER BY a; @@ -866,7 +866,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp CREATE TABLE b15776 (a int(255)); DROP TABLE b15776; CREATE TABLE b15776 (a int(256)); -ERROR 42000: Display width out of range for column 'a' (max = 255) +ERROR 42000: Display width out of range for 'a' (max = 255) CREATE TABLE b15776 (data blob(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1 CREATE TABLE b15776 (a char(2147483647)); @@ -876,7 +876,7 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT CREATE TABLE b15776 (a char(4294967295)); ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead CREATE TABLE b15776 (a char(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a year(4294967295)); INSERT INTO b15776 VALUES (42); SELECT * FROM b15776; @@ -884,33 +884,29 @@ a 2042 DROP TABLE b15776; CREATE TABLE b15776 (a year(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a year(0)); DROP TABLE b15776; CREATE TABLE b15776 (a year(-2)); 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 '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 'a'. Maximum is 6. CREATE TABLE b15776 (a timestamp(4294967296)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a timestamp(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1 CREATE TABLE b15776 (a timestamp(-2)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1 CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'a' (max = 4294967295) +ERROR 42000: Display width out of range for 'a' (max = 4294967295) CREATE TABLE b15776 select cast(null as char(4294967295)); show columns from b15776; Field Type Null Key Default Extra @@ -936,11 +932,11 @@ explain select cast(1 as binary(4294967295)); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used explain select cast(1 as char(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as nchar(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as binary(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as decimal(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1 explain select cast(1 as decimal(64, 30)); @@ -956,23 +952,23 @@ explain select convert(1, char(4294967295)); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used explain select convert(1, char(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, nchar(4294967295)); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used explain select convert(1, nchar(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, binary(4294967295)); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used explain select convert(1, binary(4294967296)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); -ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) +ERROR 42000: Display width out of range for '1' (max = 4294967295) End of 5.0 tests # Bug #52160: crash and inconsistent results when grouping # by a function and column diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 8c07668cf58..d33a52c0a71 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; @@ -205,24 +205,17 @@ 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 -Warning 1265 Data truncated for column 'a' at row 1 +Warning 1264 Out of range value 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 1265 Data truncated for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 1 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 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; @@ -245,24 +238,17 @@ 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 Warning 1265 Data truncated 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 1265 Data truncated for column 'a' at row 1 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 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; @@ -301,3 +287,8 @@ the_date the_time the_date the_time DROP TABLE t1; DROP VIEW v1; End of 5.1 tests +create table t1 (f1 date, key (f1)); +insert t1 values ('2010-10-10 15:foobar'); +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +drop table t1; diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index d375d54d20d..5e9a0435450 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 (), (), (); @@ -516,7 +517,7 @@ 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 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` semi join (`test`.`t1` `x1`) where (('2007-04-25 18:30:22' = 0)) +Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where (('2007-04-25 18:30:22' = 0)) select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); id cur_date @@ -527,7 +528,7 @@ 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 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` semi join (`test`.`t2` `x1`) where (('2007-04-25' = 0)) +Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where (('2007-04-25' = 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..b0ea2e871fb --- /dev/null +++ b/mysql-test/r/type_datetime_hires.result @@ -0,0 +1,363 @@ +drop table if exists t1, t2, t3; +create table t1 (a datetime(7)); +ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6. +create table t1 (a datetime(3), key(a)); +insert t1 values ('2010-12-11 00:20:03.1234'); +insert t1 values ('2010-12-11 15:47:11.1234'); +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 +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +2010-12-11 15:47:11.123 +select truncate(a, 6) from t1; +truncate(a, 6) +0.000000 +20101211002003.121094 +20101211010203.457031 +20101211030405.789062 +20101211154711.121094 +select a DIV 1 from t1; +a DIV 1 +0 +20101211002003 +20101211010203 +20101211030405 +20101211154711 +select group_concat(distinct a) from t1; +group_concat(distinct a) +0000-00-00 00:00:00.000,2010-12-11 00:20:03.123,2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,2010-12-11 15:47:11.123 +alter table t1 engine=innodb; +select * from t1 order by a; +a +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +2010-12-11 15:47:11.123 +select * from t1 order by a+0; +a +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +2010-12-11 15:47:11.123 +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 +select a, a + interval 2 year from t1; +a a + interval 2 year +2010-12-11 01:02:13.3332 2012-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 +select * from t2; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 +drop view v1; +drop table t1, t2; +CREATE TABLE t1 ( +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; +create table t1 ( +q_date date, +q_time time, +q_time5 time(5), +q_datetime datetime, +q_datetime1 datetime(1), +q_datetime3 datetime(3), +q_datetime5 datetime(5), +q_timestamp timestamp, +q_timestamp2 timestamp(2), +q_timestamp4 timestamp(4), +q_timestamp6 timestamp(6), +q_varchar50 varchar(50), +q_varchar60 varchar(60), +q_varchar70 varchar(70), +q_varchar80 varchar(80)); +create table t2 ( +date_datetime datetime, +time_datetime datetime, +time5_varchar100 varchar(100), +datetime_time time, +datetime1_date date, +datetime3_timestamp timestamp, +datetime5_varchar100 varchar(100), +timestamp_datetime datetime, +timestamp2_date date, +timestamp4_time time, +timestamp6_varchar100 varchar(100), +varchar50_date date, +varchar60_datetime datetime, +varchar70_time time, +varchar80_timestamp timestamp); +insert t1 values ('2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', +'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432'); +Warnings: +Note 1265 Data truncated for column 'q_date' at row 1 +Note 1265 Data truncated for column 'q_time' at row 1 +Note 1265 Data truncated for column 'q_time5' at row 1 +select * from t1;; +q_date 2010-11-12 +q_time 11:14:17 +q_time5 11:14:17.76543 +q_datetime 2010-11-12 11:14:17 +q_datetime1 2010-11-12 11:14:17.7 +q_datetime3 2010-11-12 11:14:17.765 +q_datetime5 2010-11-12 11:14:17.76543 +q_timestamp 2010-11-12 11:14:17 +q_timestamp2 2010-11-12 11:14:17.76 +q_timestamp4 2010-11-12 11:14:17.7654 +q_timestamp6 2010-11-12 11:14:17.765432 +q_varchar50 2010-11-12 11:14:17.765432 +q_varchar60 2010-11-12 11:14:17.765432 +q_varchar70 2010-11-12 11:14:17.765432 +q_varchar80 2010-11-12 11:14:17.765432 +insert t2 select * from t1; +Warnings: +Warning 1265 Data truncated for column 'time_datetime' at row 1 +Note 1265 Data truncated for column 'datetime_time' at row 1 +Note 1265 Data truncated for column 'datetime1_date' at row 1 +Note 1265 Data truncated for column 'timestamp2_date' at row 1 +Note 1265 Data truncated for column 'timestamp4_time' at row 1 +Note 1265 Data truncated for column 'varchar50_date' at row 1 +Note 1265 Data truncated for column 'varchar70_time' at row 1 +select * from t2;; +date_datetime 2010-11-12 00:00:00 +time_datetime 0000-00-00 00:00:00 +time5_varchar100 11:14:17.76543 +datetime_time 11:14:17 +datetime1_date 2010-11-12 +datetime3_timestamp 2010-11-12 11:14:17 +datetime5_varchar100 2010-11-12 11:14:17.76543 +timestamp_datetime 2010-11-12 11:14:17 +timestamp2_date 2010-11-12 +timestamp4_time 11:14:17 +timestamp6_varchar100 2010-11-12 11:14:17.765432 +varchar50_date 2010-11-12 +varchar60_datetime 2010-11-12 11:14:17 +varchar70_time 11:14:17 +varchar80_timestamp 2010-11-12 11:14:17 +alter table t1 +change q_date date_datetime datetime, +change q_time time_datetime datetime, +change q_time5 time5_varchar100 varchar(100), +change q_datetime datetime_time time, +change q_datetime1 datetime1_date date, +change q_datetime3 datetime3_timestamp timestamp, +change q_datetime5 datetime5_varchar100 varchar(100), +change q_timestamp timestamp_datetime datetime, +change q_timestamp2 timestamp2_date date, +change q_timestamp4 timestamp4_time time, +change q_timestamp6 timestamp6_varchar100 varchar(100), +change q_varchar50 varchar50_date date, +change q_varchar60 varchar60_datetime datetime, +change q_varchar70 varchar70_time time, +change q_varchar80 varchar80_timestamp timestamp; +Warnings: +Warning 1265 Data truncated for column 'time_datetime' at row 1 +Note 1265 Data truncated for column 'datetime_time' at row 1 +Note 1265 Data truncated for column 'datetime1_date' at row 1 +Note 1265 Data truncated for column 'timestamp2_date' at row 1 +Note 1265 Data truncated for column 'timestamp4_time' at row 1 +Note 1265 Data truncated for column 'varchar50_date' at row 1 +Note 1265 Data truncated for column 'varchar70_time' at row 1 +select * from t1;; +date_datetime 2010-11-12 00:00:00 +time_datetime 0000-00-00 00:00:00 +time5_varchar100 11:14:17.76543 +datetime_time 11:14:17 +datetime1_date 2010-11-12 +datetime3_timestamp 2010-11-12 11:14:17 +datetime5_varchar100 2010-11-12 11:14:17.76543 +timestamp_datetime 2010-11-12 11:14:17 +timestamp2_date 2010-11-12 +timestamp4_time 11:14:17 +timestamp6_varchar100 2010-11-12 11:14:17.765432 +varchar50_date 2010-11-12 +varchar60_datetime 2010-11-12 11:14:17 +varchar70_time 11:14:17 +varchar80_timestamp 2010-11-12 11:14:17 +drop table t1, t2; +create table t1 (a datetime, b datetime(6)); +insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912'); +update t1 set b=a; +select * from t1; +a b +2010-01-02 03:04:05 2010-01-02 03:04:05.000000 +drop table t1; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 76c5ea8f756..a0252676d65 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -721,7 +721,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (d decimal(66,0)); -ERROR 42000: Too big precision 66 specified for column 'd'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65. CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2)); INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00), (2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40), diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index a3a13bb0435..386bb4569d8 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -133,7 +133,7 @@ min(a) -0.010 drop table t1; create table t1 (a float(200,100), b double(200,100)); -ERROR 42000: Too big scale 100 specified for column 'a'. Maximum is 30. +ERROR 42000: Too big scale 100 specified for 'a'. Maximum is 30. create table t1 (c20 char); insert into t1 values (5000.0); Warnings: diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 5d4c66bad32..69b99a80b75 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -923,11 +923,11 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column select cast(ln(14000) as decimal(2,3)) c1; ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column ''). create table t1 (sl decimal(70,30)); -ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65. +ERROR 42000: Too big precision 70 specified for 'sl'. Maximum is 65. create table t1 (sl decimal(32,31)); -ERROR 42000: Too big scale 31 specified for column 'sl'. Maximum is 30. +ERROR 42000: Too big scale 31 specified for 'sl'. Maximum is 30. create table t1 (sl decimal(0,38)); -ERROR 42000: Too big scale 38 specified for column 'sl'. Maximum is 30. +ERROR 42000: Too big scale 38 specified for 'sl'. Maximum is 30. create table t1 (sl decimal(0,30)); ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl'). create table t1 (sl decimal(5, 5)); @@ -1485,12 +1485,12 @@ SELECT CAST(1 AS decimal(65,10)); CAST(1 AS decimal(65,10)) 1.0000000000 SELECT CAST(1 AS decimal(66,10)); -ERROR 42000: Too big precision 66 specified for column '1'. Maximum is 65. +ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65. SELECT CAST(1 AS decimal(65,30)); CAST(1 AS decimal(65,30)) 1.000000000000000000000000000000 SELECT CAST(1 AS decimal(65,31)); -ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +ERROR 42000: Too big scale 31 specified for '1'. Maximum is 30. CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); INSERT INTO t1 VALUES (3,30), (1,10), (2,10); SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa; @@ -1499,7 +1499,7 @@ aa SUM(b) 3.000000000000000000000000000000 10 4.000000000000000000000000000000 30 SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa; -ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +ERROR 42000: Too big scale 31 specified for '1'. Maximum is 30. DROP TABLE t1; CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL); INSERT INTO t1 VALUES (3,30), (1,10), (2,10); diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 86712bebfa1..86153cbb05d 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -1,6 +1,8 @@ drop table if exists t1; create table t1 (t time); insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34"); +Warnings: +Note 1265 Data truncated for column 't' at row 13 insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32"); select * from t1; t @@ -26,7 +28,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 +150,26 @@ 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; +create table t1 (f1 time , f2 varchar(5), key(f1)); +insert into t1 values ('00:20:01','a'),('00:20:03','b'); +select * from t1 force key (f1) where f1 < curdate(); +f1 f2 +00:20:01 a +00:20:03 b +select * from t1 ignore key (f1) where f1 < curdate(); +f1 f2 +00:20:01 a +00:20:03 b +drop table t1; +create table t1(f1 time); +insert into t1 values ('23:38:57'); +select f1, f1 = '2010-10-11 23:38:57' from t1; +f1 f1 = '2010-10-11 23:38:57' +23:38:57 0 +drop table t1; diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result new file mode 100644 index 00000000000..e5a32cc6b1c --- /dev/null +++ b/mysql-test/r/type_time_hires.result @@ -0,0 +1,196 @@ +drop table if exists t1, t2, t3; +create table t1 (a time(7)); +ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6. +create table t1 (a time(3), key(a)); +insert t1 values ('2010-12-11 00:20:03.1234'); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +insert t1 values ('2010-12-11 15:47:11.1234'); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +insert t1 values (20101211010203.45678); +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 +00:20:03.123 +15:47:11.123 +838:59:59.999 +838:59:59.999 +838:59:59.999 +select truncate(a, 6) from t1; +truncate(a, 6) +2003.123000 +154711.123000 +8385959.999000 +8385959.999000 +8385959.999000 +select a DIV 1 from t1; +a DIV 1 +2003 +154711 +8385959 +8385959 +8385959 +select group_concat(distinct a) from t1; +group_concat(distinct a) +00:20:03.123,15:47:11.123,838:59:59.999 +alter table t1 engine=innodb; +select * from t1 order by a; +a +00:20:03.123 +15:47:11.123 +838:59:59.999 +838:59:59.999 +838:59:59.999 +select * from t1 order by a+0; +a +00:20:03.123 +15:47:11.123 +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'); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +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 +select a, a + interval 2 year from t1; +a a + interval 2 year +01:02:13.3332 0002-00-00 01:02:13.3332 +insert t1 select a + interval 2 year from t1; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +01:02:13.3332 +00:00:00.0000 +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'); +Warnings: +Note 1265 Data truncated for column 'x' at row 1 +Note 1265 Data truncated for column 'y' at row 1 +select * from t1; +a b +04:05:06.000000 04:05:06.789100 +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'); +Warnings: +Note 1265 Data truncated for column 'c' at row 1 +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 +Warnings: +Note 1265 Data truncated for column 'xyz('1:1:1.010101')' at row 1 +drop function xyz; +create view v1 as select * from t1 group by a,b; +select * from v1; +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 +select * from t2; +a b +03:04:06.234500 03:04:06.234561 +04:05:06.000000 04:05:06.789100 +drop view v1; +drop table t1, t2; +create table t1 (a time(4) not null); +insert into t1 values ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000'); +select * from t1; +a +-00:00:00.6000 +-00:00:00.7000 +-00:00:00.8000 +-00:00:00.9000 +-00:00:01.0000 +-00:00:01.1000 +-00:00:01.0000 +-00:00:01.1000 +-00:00:01.0000 +-00:00:01.0900 +drop table t1; diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 3176879343c..cfe229d2d15 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..5bb980a3ba7 --- /dev/null +++ b/mysql-test/r/type_timestamp_hires.result @@ -0,0 +1,173 @@ +drop table if exists t1, t2, t3; +create table t1 (a timestamp(7)); +ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6. +create table t1 (a timestamp(3), key(a)); +insert t1 values ('2010-12-11 00:20:03.1234'); +insert t1 values ('2010-12-11 15:47:11.1234'); +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 +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +2010-12-11 15:47:11.123 +select truncate(a, 6) from t1; +truncate(a, 6) +0.000000 +20101211002003.121094 +20101211010203.457031 +20101211030405.789062 +20101211154711.121094 +select a DIV 1 from t1; +a DIV 1 +0 +20101211002003 +20101211010203 +20101211030405 +20101211154711 +select group_concat(distinct a) from t1; +group_concat(distinct a) +0000-00-00 00:00:00.000,2010-12-11 00:20:03.123,2010-12-11 01:02:03.456,2010-12-11 03:04:05.789,2010-12-11 15:47:11.123 +alter table t1 engine=innodb; +select * from t1 order by a; +a +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +2010-12-11 15:47:11.123 +select * from t1 order by a+0; +a +0000-00-00 00:00:00.000 +2010-12-11 00:20:03.123 +2010-12-11 01:02:03.456 +2010-12-11 03:04:05.789 +2010-12-11 15:47:11.123 +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 +select a, a + interval 2 year from t1; +a a + interval 2 year +2010-12-11 01:02:13.3332 2012-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 +select * from t2; +a b +2010-02-03 04:05:06.000000 2010-02-03 04:05:06.789100 +2011-01-02 03:04:06.234500 2011-01-02 03:04:06.234561 +drop view v1; +drop table t1, t2; +set time_zone='+03:00'; +set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; +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/type_year.result b/mysql-test/r/type_year.result index 2dc491c6166..5a484f3ce3c 100644 --- a/mysql-test/r/type_year.result +++ b/mysql-test/r/type_year.result @@ -353,6 +353,9 @@ c1 SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; total_rows min_value MAX(c1) 3 0 2155 +SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1; +total_rows min_value MAX(c1+0) +3 0 2155 DROP TABLE t1; # End of 5.1 tests diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index ca08c7b60f3..4495836f568 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) union (select '1' AS `a`,'10' AS `b` from `test`.`t2` where 1) +Note 1003 (select 1 AS `a`,1 AS `b` from `test`.`t1` where 1) union (select 1 AS `a`,10 AS `b` from `test`.`t2` where 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 |