Commit e8edf40f authored by unknown's avatar unknown

Merge WL#2984


mysql-test/r/sp-vars.result:
  Merge
mysql-test/r/sp.result:
  Merge
mysql-test/r/type_newdecimal-big.result:
  Merge
mysql-test/t/type_newdecimal-big.test:
  Merge
sql/sp_head.cc:
  Merge
sql/sql_select.cc:
  Merge
parent 16bca982
...@@ -103,18 +103,18 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 ...@@ -103,18 +103,18 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20 v17 v18 v19 v20
12.00 12.12 12.00 12.12 12.00 12.12 12.00 12.12
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'v1' at row 1 Warning 1264 Out of range value for column 'v1' at row 1
Warning 1264 Out of range value adjusted for column 'v1u' at row 1 Warning 1264 Out of range value for column 'v1u' at row 1
Warning 1264 Out of range value adjusted for column 'v2' at row 1 Warning 1264 Out of range value for column 'v2' at row 1
Warning 1264 Out of range value adjusted for column 'v2u' at row 1 Warning 1264 Out of range value for column 'v2u' at row 1
Warning 1264 Out of range value adjusted for column 'v3' at row 1 Warning 1264 Out of range value for column 'v3' at row 1
Warning 1264 Out of range value adjusted for column 'v3u' at row 1 Warning 1264 Out of range value for column 'v3u' at row 1
Warning 1264 Out of range value adjusted for column 'v4' at row 1 Warning 1264 Out of range value for column 'v4' at row 1
Warning 1264 Out of range value adjusted for column 'v4u' at row 1 Warning 1264 Out of range value for column 'v4u' at row 1
Warning 1264 Out of range value adjusted for column 'v5' at row 1 Warning 1264 Out of range value for column 'v5' at row 1
Warning 1264 Out of range value adjusted for column 'v5u' at row 1 Warning 1264 Out of range value for column 'v5u' at row 1
Warning 1264 Out of range value adjusted for column 'v6' at row 1 Warning 1264 Out of range value for column 'v6' at row 1
Warning 1264 Out of range value adjusted for column 'v6u' at row 1 Warning 1264 Out of range value for column 'v6u' at row 1
Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1 Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1
Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1 Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1
Warning 1265 Data truncated for column 'v12' at row 1 Warning 1265 Data truncated for column 'v12' at row 1
...@@ -136,32 +136,32 @@ d1 d2 d3 ...@@ -136,32 +136,32 @@ d1 d2 d3
d1 d2 d3 d1 d2 d3
1234.00 1234.12 1234.12 1234.00 1234.12 1234.12
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'i1' at row 1 Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value adjusted for column 'i2' at row 1 Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value adjusted for column 'i3' at row 1 Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value adjusted for column 'i4' at row 1 Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value adjusted for column 'i1' at row 1 Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value adjusted for column 'i2' at row 1 Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value adjusted for column 'i3' at row 1 Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value adjusted for column 'i4' at row 1 Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value adjusted for column 'u1' at row 1 Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value adjusted for column 'u2' at row 1 Warning 1264 Out of range value for column 'u2' at row 1
Warning 1264 Out of range value adjusted for column 'u3' at row 1 Warning 1264 Out of range value for column 'u3' at row 1
Warning 1264 Out of range value adjusted for column 'u4' at row 1 Warning 1264 Out of range value for column 'u4' at row 1
Warning 1264 Out of range value adjusted for column 'u1' at row 1 Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value adjusted for column 'u2' at row 1 Warning 1264 Out of range value for column 'u2' at row 1
Note 1265 Data truncated for column 'd3' at row 1 Note 1265 Data truncated for column 'd3' at row 1
Note 1265 Data truncated for column 'd3' at row 1 Note 1265 Data truncated for column 'd3' at row 1
SELECT sp_vars_check_ret1(); SELECT sp_vars_check_ret1();
sp_vars_check_ret1() sp_vars_check_ret1()
127 127
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret1()' at row 1 Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2(); SELECT sp_vars_check_ret2();
sp_vars_check_ret2() sp_vars_check_ret2()
127 127
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret2()' at row 1 Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3(); SELECT sp_vars_check_ret3();
sp_vars_check_ret3() sp_vars_check_ret3()
0 0
...@@ -188,18 +188,18 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 ...@@ -188,18 +188,18 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20 v17 v18 v19 v20
12.00 12.12 12.00 12.12 12.00 12.12 12.00 12.12
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'v1' at row 1 Warning 1264 Out of range value for column 'v1' at row 1
Warning 1264 Out of range value adjusted for column 'v1u' at row 1 Warning 1264 Out of range value for column 'v1u' at row 1
Warning 1264 Out of range value adjusted for column 'v2' at row 1 Warning 1264 Out of range value for column 'v2' at row 1
Warning 1264 Out of range value adjusted for column 'v2u' at row 1 Warning 1264 Out of range value for column 'v2u' at row 1
Warning 1264 Out of range value adjusted for column 'v3' at row 1 Warning 1264 Out of range value for column 'v3' at row 1
Warning 1264 Out of range value adjusted for column 'v3u' at row 1 Warning 1264 Out of range value for column 'v3u' at row 1
Warning 1264 Out of range value adjusted for column 'v4' at row 1 Warning 1264 Out of range value for column 'v4' at row 1
Warning 1264 Out of range value adjusted for column 'v4u' at row 1 Warning 1264 Out of range value for column 'v4u' at row 1
Warning 1264 Out of range value adjusted for column 'v5' at row 1 Warning 1264 Out of range value for column 'v5' at row 1
Warning 1264 Out of range value adjusted for column 'v5u' at row 1 Warning 1264 Out of range value for column 'v5u' at row 1
Warning 1264 Out of range value adjusted for column 'v6' at row 1 Warning 1264 Out of range value for column 'v6' at row 1
Warning 1264 Out of range value adjusted for column 'v6u' at row 1 Warning 1264 Out of range value for column 'v6u' at row 1
Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1 Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1
Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1 Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1
Warning 1265 Data truncated for column 'v12' at row 1 Warning 1265 Data truncated for column 'v12' at row 1
...@@ -221,32 +221,32 @@ d1 d2 d3 ...@@ -221,32 +221,32 @@ d1 d2 d3
d1 d2 d3 d1 d2 d3
1234.00 1234.12 1234.12 1234.00 1234.12 1234.12
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'i1' at row 1 Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value adjusted for column 'i2' at row 1 Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value adjusted for column 'i3' at row 1 Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value adjusted for column 'i4' at row 1 Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value adjusted for column 'i1' at row 1 Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value adjusted for column 'i2' at row 1 Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value adjusted for column 'i3' at row 1 Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value adjusted for column 'i4' at row 1 Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value adjusted for column 'u1' at row 1 Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value adjusted for column 'u2' at row 1 Warning 1264 Out of range value for column 'u2' at row 1
Warning 1264 Out of range value adjusted for column 'u3' at row 1 Warning 1264 Out of range value for column 'u3' at row 1
Warning 1264 Out of range value adjusted for column 'u4' at row 1 Warning 1264 Out of range value for column 'u4' at row 1
Warning 1264 Out of range value adjusted for column 'u1' at row 1 Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value adjusted for column 'u2' at row 1 Warning 1264 Out of range value for column 'u2' at row 1
Note 1265 Data truncated for column 'd3' at row 1 Note 1265 Data truncated for column 'd3' at row 1
Note 1265 Data truncated for column 'd3' at row 1 Note 1265 Data truncated for column 'd3' at row 1
SELECT sp_vars_check_ret1(); SELECT sp_vars_check_ret1();
sp_vars_check_ret1() sp_vars_check_ret1()
127 127
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret1()' at row 1 Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2(); SELECT sp_vars_check_ret2();
sp_vars_check_ret2() sp_vars_check_ret2()
127 127
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'sp_vars_check_ret2()' at row 1 Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3(); SELECT sp_vars_check_ret3();
sp_vars_check_ret3() sp_vars_check_ret3()
0 0
...@@ -352,13 +352,13 @@ Calling the routines, created in TRADITIONAL mode. ...@@ -352,13 +352,13 @@ Calling the routines, created in TRADITIONAL mode.
--------------------------------------------------------------- ---------------------------------------------------------------
CALL sp_vars_check_dflt(); CALL sp_vars_check_dflt();
ERROR 22003: Out of range value adjusted for column 'v1' at row 1 ERROR 22003: Out of range value for column 'v1' at row 1
CALL sp_vars_check_assignment(); CALL sp_vars_check_assignment();
ERROR 22003: Out of range value adjusted for column 'i1' at row 1 ERROR 22003: Out of range value for column 'i1' at row 1
SELECT sp_vars_check_ret1(); SELECT sp_vars_check_ret1();
ERROR 22003: Out of range value adjusted for column 'sp_vars_check_ret1()' at row 1 ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 1
SELECT sp_vars_check_ret2(); SELECT sp_vars_check_ret2();
ERROR 22003: Out of range value adjusted for column 'sp_vars_check_ret2()' at row 1 ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 1
SELECT sp_vars_check_ret3(); SELECT sp_vars_check_ret3();
ERROR HY000: Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1 ERROR HY000: Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
SELECT sp_vars_check_ret4(); SELECT sp_vars_check_ret4();
...@@ -428,11 +428,11 @@ FF ...@@ -428,11 +428,11 @@ FF
HEX(v10) HEX(v10)
FF FF
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'v8' at row 1 Warning 1264 Out of range value for column 'v8' at row 1
Warning 1264 Out of range value adjusted for column 'v9' at row 1 Warning 1264 Out of range value for column 'v9' at row 1
Warning 1264 Out of range value adjusted for column 'v10' at row 1 Warning 1264 Out of range value for column 'v10' at row 1
Warning 1264 Out of range value adjusted for column 'v1' at row 1 Warning 1264 Out of range value for column 'v1' at row 1
Warning 1264 Out of range value adjusted for column 'v5' at row 1 Warning 1264 Out of range value for column 'v5' at row 1
DROP PROCEDURE p1; DROP PROCEDURE p1;
--------------------------------------------------------------- ---------------------------------------------------------------
...@@ -675,7 +675,7 @@ t1 CREATE TABLE "t1" ( ...@@ -675,7 +675,7 @@ t1 CREATE TABLE "t1" (
"x" varbinary(19) default NULL "x" varbinary(19) default NULL
) )
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'x' at row 1 Warning 1264 Out of range value for column 'x' at row 1
DROP PROCEDURE p1; DROP PROCEDURE p1;
--------------------------------------------------------------- ---------------------------------------------------------------
...@@ -777,9 +777,9 @@ SET var := arg; ...@@ -777,9 +777,9 @@ SET var := arg;
SELECT arg, var; SELECT arg, var;
END| END|
CALL p1(); CALL p1();
ERROR 22003: Out of range value adjusted for column 'v' at row 1 ERROR 22003: Out of range value for column 'v' at row 1
CALL p2(); CALL p2();
ERROR 22003: Out of range value adjusted for column 'v' at row 1 ERROR 22003: Out of range value for column 'v' at row 1
CALL p3(); CALL p3();
ERROR 22001: Data too long for column 'v' at row 1 ERROR 22001: Data too long for column 'v' at row 1
CALL p4('aaa'); CALL p4('aaa');
...@@ -787,7 +787,7 @@ ERROR 22001: Data too long for column 'arg' at row 1 ...@@ -787,7 +787,7 @@ ERROR 22001: Data too long for column 'arg' at row 1
CALL p5('aa'); CALL p5('aa');
ERROR 22001: Data too long for column 'var' at row 1 ERROR 22001: Data too long for column 'var' at row 1
CALL p6(10); CALL p6(10);
ERROR 22003: Out of range value adjusted for column 'var' at row 1 ERROR 22003: Out of range value for column 'var' at row 1
SET @@sql_mode = 'ansi'; SET @@sql_mode = 'ansi';
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP PROCEDURE p2; DROP PROCEDURE p2;
...@@ -833,17 +833,17 @@ SELECT f1(-2500); ...@@ -833,17 +833,17 @@ SELECT f1(-2500);
f1(-2500) f1(-2500)
0 0
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'arg' at row 1 Warning 1264 Out of range value for column 'arg' at row 1
SET @@sql_mode = 'traditional'; SET @@sql_mode = 'traditional';
SELECT f1(-2500); SELECT f1(-2500);
ERROR 22003: Out of range value adjusted for column 'arg' at row 1 ERROR 22003: Out of range value for column 'arg' at row 1
DROP FUNCTION f1; DROP FUNCTION f1;
CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
BEGIN BEGIN
RETURN arg; RETURN arg;
END| END|
SELECT f1(-2500); SELECT f1(-2500);
ERROR 22003: Out of range value adjusted for column 'arg' at row 1 ERROR 22003: Out of range value for column 'arg' at row 1
SET @@sql_mode = 'ansi'; SET @@sql_mode = 'ansi';
DROP FUNCTION f1; DROP FUNCTION f1;
...@@ -860,17 +860,17 @@ SELECT f1(8388699); ...@@ -860,17 +860,17 @@ SELECT f1(8388699);
f1(8388699) f1(8388699)
8388607 8388607
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'arg' at row 1 Warning 1264 Out of range value for column 'arg' at row 1
SET @@sql_mode = 'traditional'; SET @@sql_mode = 'traditional';
SELECT f1(8388699); SELECT f1(8388699);
ERROR 22003: Out of range value adjusted for column 'arg' at row 1 ERROR 22003: Out of range value for column 'arg' at row 1
DROP FUNCTION f1; DROP FUNCTION f1;
CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT
BEGIN BEGIN
RETURN arg; RETURN arg;
END| END|
SELECT f1(8388699); SELECT f1(8388699);
ERROR 22003: Out of range value adjusted for column 'arg' at row 1 ERROR 22003: Out of range value for column 'arg' at row 1
SET @@sql_mode = 'ansi'; SET @@sql_mode = 'ansi';
DROP FUNCTION f1; DROP FUNCTION f1;
...@@ -896,7 +896,7 @@ sp_var ...@@ -896,7 +896,7 @@ sp_var
@user_var @user_var
0 0
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'sp_var' at row 1 Warning 1264 Out of range value for column 'sp_var' at row 1
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -3537,7 +3537,7 @@ tm1 CREATE TEMPORARY TABLE `tm1` ( ...@@ -3537,7 +3537,7 @@ tm1 CREATE TEMPORARY TABLE `tm1` (
`spv1` decimal(3,3) default NULL `spv1` decimal(3,3) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'spv1' at row 1 Warning 1264 Out of range value for column 'spv1' at row 1
Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1 Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1
call bug12589_2()| call bug12589_2()|
Table Create Table Table Create Table
......
drop procedure if exists sp1; drop procedure if exists sp1;
create procedure sp1 () begin CREATE PROCEDURE sp1()
declare v1, v2, v3, v4 decimal(16,12); declare v5 int; BEGIN
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; DECLARE v1, v2, v3, v4 DECIMAL(28,12);
while v5 < 100000 do DECLARE v3_2, v4_2 DECIMAL(28, 12);
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; DECLARE counter INT;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// SET v1 = 1;
SET v2 = 2;
SET v3 = 1000000000000;
SET v4 = 2000000000000;
SET counter = 0;
WHILE counter < 100000 DO
SET v1 = v1 + 0.000000000001;
SET v2 = v2 - 0.000000000001;
SET v3 = v3 + 1;
SET v4 = v4 - 1;
SET counter = counter + 1;
END WHILE;
SET v3_2 = v3 * 0.000000000001;
SET v4_2 = v4 * 0.000000000001;
SELECT v1, v2, v3, v3_2, v4, v4_2;
END//
call sp1()// call sp1()//
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001 v1 v2 v3 v3_2 v4 v4_2
1.000000100000 1.999999900000 1.000000100000 1.999999900000 1.000000100000 1.999999900000 1000000100000.000000000000 1.000000100000 1999999900000.000000000000 1.999999900000
drop procedure sp1; drop procedure sp1;
...@@ -12,12 +12,31 @@ drop procedure if exists sp1; ...@@ -12,12 +12,31 @@ drop procedure if exists sp1;
delimiter //; delimiter //;
# #
create procedure sp1 () begin CREATE PROCEDURE sp1()
declare v1, v2, v3, v4 decimal(16,12); declare v5 int; BEGIN
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; DECLARE v1, v2, v3, v4 DECIMAL(28,12);
while v5 < 100000 do DECLARE v3_2, v4_2 DECIMAL(28, 12);
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; DECLARE counter INT;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
SET v1 = 1;
SET v2 = 2;
SET v3 = 1000000000000;
SET v4 = 2000000000000;
SET counter = 0;
WHILE counter < 100000 DO
SET v1 = v1 + 0.000000000001;
SET v2 = v2 - 0.000000000001;
SET v3 = v3 + 1;
SET v4 = v4 - 1;
SET counter = counter + 1;
END WHILE;
SET v3_2 = v3 * 0.000000000001;
SET v4_2 = v4 * 0.000000000001;
SELECT v1, v2, v3, v3_2, v4, v4_2;
END//
# #
call sp1()// call sp1()//
#-- should return #-- should return
......
...@@ -680,6 +680,9 @@ sp_head::create_result_field(uint field_max_length, const char *field_name, ...@@ -680,6 +680,9 @@ sp_head::create_result_field(uint field_max_length, const char *field_name,
m_return_field_def.interval, m_return_field_def.interval,
field_name ? field_name : (const char *) m_name.str); field_name ? field_name : (const char *) m_name.str);
if (field)
field->init(table);
DBUG_RETURN(field); DBUG_RETURN(field);
} }
......
...@@ -8997,8 +8997,8 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list) ...@@ -8997,8 +8997,8 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
field++; field++;
} }
*field= NULL; /* mark the end of the list */ *field= NULL; /* mark the end of the list */
s->blob_field[blob_count]= 0; /* mark the end of the list */ share->blob_field[blob_count]= 0; /* mark the end of the list */
s->blob_fields= blob_count; share->blob_fields= blob_count;
null_pack_length= (null_count + 7)/8; null_pack_length= (null_count + 7)/8;
share->reclength= record_length + null_pack_length; share->reclength= record_length + null_pack_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment