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