2005-12-07 15:01:17 +01:00
|
|
|
DROP PROCEDURE IF EXISTS sp_vars_check_dflt;
|
|
|
|
DROP PROCEDURE IF EXISTS sp_vars_check_assignment;
|
|
|
|
DROP FUNCTION IF EXISTS sp_vars_check_ret1;
|
|
|
|
DROP FUNCTION IF EXISTS sp_vars_check_ret2;
|
|
|
|
DROP FUNCTION IF EXISTS sp_vars_check_ret3;
|
|
|
|
DROP FUNCTION IF EXISTS sp_vars_check_ret4;
|
2006-10-19 20:39:51 +02:00
|
|
|
DROP FUNCTION IF EXISTS sp_vars_div_zero;
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'ansi';
|
|
|
|
CREATE PROCEDURE sp_vars_check_dflt()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v1 TINYINT DEFAULT 1e200;
|
|
|
|
DECLARE v1u TINYINT UNSIGNED DEFAULT 1e200;
|
|
|
|
DECLARE v2 TINYINT DEFAULT -1e200;
|
|
|
|
DECLARE v2u TINYINT UNSIGNED DEFAULT -1e200;
|
|
|
|
DECLARE v3 TINYINT DEFAULT 300;
|
|
|
|
DECLARE v3u TINYINT UNSIGNED DEFAULT 300;
|
|
|
|
DECLARE v4 TINYINT DEFAULT -300;
|
|
|
|
DECLARE v4u TINYINT UNSIGNED DEFAULT -300;
|
|
|
|
DECLARE v5 TINYINT DEFAULT 10 * 10 * 10;
|
|
|
|
DECLARE v5u TINYINT UNSIGNED DEFAULT 10 * 10 * 10;
|
|
|
|
DECLARE v6 TINYINT DEFAULT -10 * 10 * 10;
|
|
|
|
DECLARE v6u TINYINT UNSIGNED DEFAULT -10 * 10 * 10;
|
|
|
|
DECLARE v7 TINYINT DEFAULT '10';
|
|
|
|
DECLARE v8 TINYINT DEFAULT '10 ';
|
|
|
|
DECLARE v9 TINYINT DEFAULT ' 10 ';
|
|
|
|
DECLARE v10 TINYINT DEFAULT 'String 10 ';
|
|
|
|
DECLARE v11 TINYINT DEFAULT 'String10';
|
|
|
|
DECLARE v12 TINYINT DEFAULT '10 String';
|
|
|
|
DECLARE v13 TINYINT DEFAULT '10String';
|
|
|
|
DECLARE v14 TINYINT DEFAULT concat('10', ' ');
|
|
|
|
DECLARE v15 TINYINT DEFAULT concat(' ', '10');
|
|
|
|
DECLARE v16 TINYINT DEFAULT concat('Hello, ', 'world');
|
|
|
|
DECLARE v17 DECIMAL(64, 2) DEFAULT 12;
|
|
|
|
DECLARE v18 DECIMAL(64, 2) DEFAULT 12.123;
|
|
|
|
DECLARE v19 DECIMAL(64, 2) DEFAULT 11 + 1;
|
|
|
|
DECLARE v20 DECIMAL(64, 2) DEFAULT 12 + 0.123;
|
|
|
|
SELECT v1, v1u, v2, v2u, v3, v3u, v4, v4u;
|
|
|
|
SELECT v5, v5u, v6, v6u;
|
|
|
|
SELECT v7, v8, v9, v10, v11, v12, v13, v14, v15, v16;
|
|
|
|
SELECT v17, v18, v19, v20;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE sp_vars_check_assignment()
|
|
|
|
BEGIN
|
|
|
|
DECLARE i1, i2, i3, i4 TINYINT;
|
|
|
|
DECLARE u1, u2, u3, u4 TINYINT UNSIGNED;
|
|
|
|
DECLARE d1, d2, d3 DECIMAL(64, 2);
|
|
|
|
SET i1 = 1e200;
|
|
|
|
SET i2 = -1e200;
|
|
|
|
SET i3 = 300;
|
|
|
|
SET i4 = -300;
|
|
|
|
SELECT i1, i2, i3, i4;
|
|
|
|
SET i1 = 10 * 10 * 10;
|
|
|
|
SET i2 = -10 * 10 * 10;
|
|
|
|
SET i3 = sign(10 * 10) * 10 * 20;
|
|
|
|
SET i4 = sign(-10 * 10) * -10 * 20;
|
|
|
|
SELECT i1, i2, i3, i4;
|
|
|
|
SET u1 = 1e200;
|
|
|
|
SET u2 = -1e200;
|
|
|
|
SET u3 = 300;
|
|
|
|
SET u4 = -300;
|
|
|
|
SELECT u1, u2, u3, u4;
|
|
|
|
SET u1 = 10 * 10 * 10;
|
|
|
|
SET u2 = -10 * 10 * 10;
|
|
|
|
SET u3 = sign(10 * 10) * 10 * 20;
|
|
|
|
SET u4 = sign(-10 * 10) * -10 * 20;
|
|
|
|
SELECT u1, u2, u3, u4;
|
|
|
|
SET d1 = 1234;
|
|
|
|
SET d2 = 1234.12;
|
|
|
|
SET d3 = 1234.1234;
|
|
|
|
SELECT d1, d2, d3;
|
|
|
|
SET d1 = 12 * 100 + 34;
|
|
|
|
SET d2 = 12 * 100 + 34 + 0.12;
|
|
|
|
SET d3 = 12 * 100 + 34 + 0.1234;
|
|
|
|
SELECT d1, d2, d3;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret1() RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN 1e200;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret2() RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN 10 * 10 * 10;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret3() RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN 'Hello, world';
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2)
|
|
|
|
BEGIN
|
|
|
|
RETURN 12 * 10 + 34 + 0.1234;
|
|
|
|
END|
|
2006-10-19 20:39:51 +02:00
|
|
|
CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
|
|
|
|
BEGIN
|
|
|
|
DECLARE div_zero INTEGER;
|
|
|
|
SELECT 1/0 INTO div_zero;
|
|
|
|
RETURN div_zero;
|
|
|
|
END|
|
2005-12-07 15:01:17 +01:00
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
Calling the routines, created in ANSI mode.
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
CALL sp_vars_check_dflt();
|
|
|
|
v1 v1u v2 v2u v3 v3u v4 v4u
|
|
|
|
127 255 -128 0 127 255 -128 0
|
|
|
|
v5 v5u v6 v6u
|
|
|
|
127 255 -128 0
|
|
|
|
v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
|
|
|
|
10 10 10 0 0 10 10 10 10 0
|
|
|
|
v17 v18 v19 v20
|
|
|
|
12.00 12.12 12.00 12.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'v20' at row 1
|
|
|
|
CALL sp_vars_check_assignment();
|
|
|
|
i1 i2 i3 i4
|
|
|
|
127 -128 127 -128
|
|
|
|
i1 i2 i3 i4
|
|
|
|
127 -128 127 127
|
|
|
|
u1 u2 u3 u4
|
|
|
|
255 0 255 0
|
|
|
|
u1 u2 u3 u4
|
|
|
|
255 0 200 200
|
|
|
|
d1 d2 d3
|
|
|
|
1234.00 1234.12 1234.12
|
|
|
|
d1 d2 d3
|
|
|
|
1234.00 1234.12 1234.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'd3' at row 1
|
|
|
|
SELECT sp_vars_check_ret1();
|
|
|
|
sp_vars_check_ret1()
|
|
|
|
127
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret2();
|
|
|
|
sp_vars_check_ret2()
|
|
|
|
127
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret3();
|
|
|
|
sp_vars_check_ret3()
|
|
|
|
0
|
|
|
|
Warnings:
|
|
|
|
Warning 1366 Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
|
|
|
|
SELECT sp_vars_check_ret4();
|
|
|
|
sp_vars_check_ret4()
|
|
|
|
154.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
|
2006-10-19 20:39:51 +02:00
|
|
|
SELECT sp_vars_div_zero();
|
|
|
|
sp_vars_div_zero()
|
|
|
|
NULL
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'traditional';
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
Calling in TRADITIONAL mode the routines, created in ANSI mode.
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
CALL sp_vars_check_dflt();
|
|
|
|
v1 v1u v2 v2u v3 v3u v4 v4u
|
|
|
|
127 255 -128 0 127 255 -128 0
|
|
|
|
v5 v5u v6 v6u
|
|
|
|
127 255 -128 0
|
|
|
|
v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
|
|
|
|
10 10 10 0 0 10 10 10 10 0
|
|
|
|
v17 v18 v19 v20
|
|
|
|
12.00 12.12 12.00 12.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'v20' at row 1
|
|
|
|
CALL sp_vars_check_assignment();
|
|
|
|
i1 i2 i3 i4
|
|
|
|
127 -128 127 -128
|
|
|
|
i1 i2 i3 i4
|
|
|
|
127 -128 127 127
|
|
|
|
u1 u2 u3 u4
|
|
|
|
255 0 255 0
|
|
|
|
u1 u2 u3 u4
|
|
|
|
255 0 200 200
|
|
|
|
d1 d2 d3
|
|
|
|
1234.00 1234.12 1234.12
|
|
|
|
d1 d2 d3
|
|
|
|
1234.00 1234.12 1234.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'd3' at row 1
|
|
|
|
SELECT sp_vars_check_ret1();
|
|
|
|
sp_vars_check_ret1()
|
|
|
|
127
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret2();
|
|
|
|
sp_vars_check_ret2()
|
|
|
|
127
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret3();
|
|
|
|
sp_vars_check_ret3()
|
|
|
|
0
|
|
|
|
Warnings:
|
|
|
|
Warning 1366 Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
|
|
|
|
SELECT sp_vars_check_ret4();
|
|
|
|
sp_vars_check_ret4()
|
|
|
|
154.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
|
2006-10-19 20:39:51 +02:00
|
|
|
SELECT sp_vars_div_zero();
|
|
|
|
sp_vars_div_zero()
|
|
|
|
NULL
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP PROCEDURE sp_vars_check_dflt;
|
|
|
|
DROP PROCEDURE sp_vars_check_assignment;
|
|
|
|
DROP FUNCTION sp_vars_check_ret1;
|
|
|
|
DROP FUNCTION sp_vars_check_ret2;
|
|
|
|
DROP FUNCTION sp_vars_check_ret3;
|
|
|
|
DROP FUNCTION sp_vars_check_ret4;
|
2006-10-19 20:39:51 +02:00
|
|
|
DROP FUNCTION sp_vars_div_zero;
|
2005-12-07 15:01:17 +01:00
|
|
|
CREATE PROCEDURE sp_vars_check_dflt()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v1 TINYINT DEFAULT 1e200;
|
|
|
|
DECLARE v1u TINYINT UNSIGNED DEFAULT 1e200;
|
|
|
|
DECLARE v2 TINYINT DEFAULT -1e200;
|
|
|
|
DECLARE v2u TINYINT UNSIGNED DEFAULT -1e200;
|
|
|
|
DECLARE v3 TINYINT DEFAULT 300;
|
|
|
|
DECLARE v3u TINYINT UNSIGNED DEFAULT 300;
|
|
|
|
DECLARE v4 TINYINT DEFAULT -300;
|
|
|
|
DECLARE v4u TINYINT UNSIGNED DEFAULT -300;
|
|
|
|
DECLARE v5 TINYINT DEFAULT 10 * 10 * 10;
|
|
|
|
DECLARE v5u TINYINT UNSIGNED DEFAULT 10 * 10 * 10;
|
|
|
|
DECLARE v6 TINYINT DEFAULT -10 * 10 * 10;
|
|
|
|
DECLARE v6u TINYINT UNSIGNED DEFAULT -10 * 10 * 10;
|
|
|
|
DECLARE v7 TINYINT DEFAULT '10';
|
|
|
|
DECLARE v8 TINYINT DEFAULT '10 ';
|
|
|
|
DECLARE v9 TINYINT DEFAULT ' 10 ';
|
|
|
|
DECLARE v10 TINYINT DEFAULT 'String 10 ';
|
|
|
|
DECLARE v11 TINYINT DEFAULT 'String10';
|
|
|
|
DECLARE v12 TINYINT DEFAULT '10 String';
|
|
|
|
DECLARE v13 TINYINT DEFAULT '10String';
|
|
|
|
DECLARE v14 TINYINT DEFAULT concat('10', ' ');
|
|
|
|
DECLARE v15 TINYINT DEFAULT concat(' ', '10');
|
|
|
|
DECLARE v16 TINYINT DEFAULT concat('Hello, ', 'world');
|
|
|
|
DECLARE v17 DECIMAL(64, 2) DEFAULT 12;
|
|
|
|
DECLARE v18 DECIMAL(64, 2) DEFAULT 12.123;
|
|
|
|
DECLARE v19 DECIMAL(64, 2) DEFAULT 11 + 1;
|
|
|
|
DECLARE v20 DECIMAL(64, 2) DEFAULT 12 + 0.123;
|
|
|
|
SELECT v1, v1u, v2, v2u, v3, v3u, v4, v4u;
|
|
|
|
SELECT v5, v5u, v6, v6u;
|
|
|
|
SELECT v7, v8, v9, v10, v11, v12, v13, v14, v15, v16;
|
|
|
|
SELECT v17, v18, v19, v20;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE sp_vars_check_assignment()
|
|
|
|
BEGIN
|
|
|
|
DECLARE i1, i2, i3, i4 TINYINT;
|
|
|
|
DECLARE u1, u2, u3, u4 TINYINT UNSIGNED;
|
|
|
|
DECLARE d1, d2, d3 DECIMAL(64, 2);
|
|
|
|
SET i1 = 1e200;
|
|
|
|
SET i2 = -1e200;
|
|
|
|
SET i3 = 300;
|
|
|
|
SET i4 = -300;
|
|
|
|
SELECT i1, i2, i3, i4;
|
|
|
|
SET i1 = 10 * 10 * 10;
|
|
|
|
SET i2 = -10 * 10 * 10;
|
|
|
|
SET i3 = sign(10 * 10) * 10 * 20;
|
|
|
|
SET i4 = sign(-10 * 10) * -10 * 20;
|
|
|
|
SELECT i1, i2, i3, i4;
|
|
|
|
SET u1 = 1e200;
|
|
|
|
SET u2 = -1e200;
|
|
|
|
SET u3 = 300;
|
|
|
|
SET u4 = -300;
|
|
|
|
SELECT u1, u2, u3, u4;
|
|
|
|
SET u1 = 10 * 10 * 10;
|
|
|
|
SET u2 = -10 * 10 * 10;
|
|
|
|
SET u3 = sign(10 * 10) * 10 * 20;
|
|
|
|
SET u4 = sign(-10 * 10) * -10 * 20;
|
|
|
|
SELECT u1, u2, u3, u4;
|
|
|
|
SET d1 = 1234;
|
|
|
|
SET d2 = 1234.12;
|
|
|
|
SET d3 = 1234.1234;
|
|
|
|
SELECT d1, d2, d3;
|
|
|
|
SET d1 = 12 * 100 + 34;
|
|
|
|
SET d2 = 12 * 100 + 34 + 0.12;
|
|
|
|
SET d3 = 12 * 100 + 34 + 0.1234;
|
|
|
|
SELECT d1, d2, d3;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret1() RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN 1e200;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret2() RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN 10 * 10 * 10;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret3() RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN 'Hello, world';
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2)
|
|
|
|
BEGIN
|
|
|
|
RETURN 12 * 10 + 34 + 0.1234;
|
|
|
|
END|
|
2006-10-19 20:39:51 +02:00
|
|
|
CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
|
|
|
|
BEGIN
|
|
|
|
DECLARE div_zero INTEGER;
|
|
|
|
SELECT 1/0 INTO div_zero;
|
|
|
|
RETURN div_zero;
|
|
|
|
END|
|
2005-12-07 15:01:17 +01:00
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
Calling the routines, created in TRADITIONAL mode.
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
CALL sp_vars_check_dflt();
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'v1' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
CALL sp_vars_check_assignment();
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'i1' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret1();
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret2();
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret3();
|
Adding support for Dynamic columns (WL#34):
- COLUMN_CREATE(column_nr, value, [column_nr,value]...)
- COLUMN_ADD(blob,column_nr, value, column_nr,value]...)
- COLUMN_DELETE(blob, column_nr, column_nr...)
- COLUMN_EXISTS(blob, column_nr)
- COLUMN_LIST(blob, column_nr)
- COLUMN_GET(string, column_nr AS type)
Added cast(X as DOUBLE) and cast(x as INT)
Better warning and error messages for wrong cast's
Created some sub functions to simplify and reuse code.
Added a lot of conversation functions with error/warnings for what went wrong.
Fixed some issues when casting time to datetime.
Added functions to dynamic strings and Strings to allow one to move a string buffer from dynamic strings to String (to save malloc+ copy)
Added dynamic columns library to libmysqlclient
include/Makefile.am:
Added ma_dyncol.h
include/decimal.h:
Added 'const' to arguments for some functions.
include/my_sys.h:
Added dynstr_reassociate()
include/my_time.h:
Added TIME_SUBSECOND_RANGE
Added double_to_datetime()
Added flag argument to str_to_time()
libmysql/CMakeLists.txt:
Added mysys/ma_dyncol.c
libmysql/Makefile.shared:
Added ma_dyncol
libmysql/libmysql.c:
Added argument to str_to_time()
mysql-test/r/bigint.result:
Better error messages
mysql-test/r/cast.result:
Better warning and error messages
A lot of new cast() tests
mysql-test/r/func_math.result:
Better warning messages
mysql-test/r/func_str.result:
Better warning messages
mysql-test/r/func_time.result:
Better warning messages
mysql-test/r/sp-vars.result:
Better warning messages
mysql-test/r/strict.result:
Better warning messages
New test result
mysql-test/r/type_newdecimal.result:
Better warning messages
mysql-test/r/warnings.result:
Better warning messages
mysql-test/suite/funcs_1/r/innodb_func_view.result:
Updated results after better cast warnings
mysql-test/suite/funcs_1/r/memory_func_view.result:
Updated results after better cast warnings
mysql-test/suite/funcs_1/r/myisam_func_view.result:
Updated results after better cast warnings
mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test:
Added begin...commit to speed up test.
mysql-test/suite/parts/inc/part_supported_sql_funcs_delete.inc:
Added begin...commit to speed up test.
mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc:
Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
Added begin...commit to speed up test.
mysql-test/suite/parts/r/rpl_partition.result:
Added begin...commit to speed up test.
mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
Removed duplicated --big_test
mysql-test/suite/parts/t/rpl_partition.test:
Added begin...commit to speed up test.
mysql-test/suite/pbxt/r/cast.result:
Updated results after better cast warnings
mysql-test/suite/pbxt/r/func_str.result:
Updated results after better cast warnings
mysql-test/suite/pbxt/r/type_newdecimal.result:
Updated results after better cast warnings
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
Added begin...commit to speed up test.
mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
Added begin...commit to speed up test.
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result:
More warnings
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result:
More warnings
mysql-test/t/cast.test:
A lot of new cast() tests
mysql-test/t/strict.test:
Added new test
mysys/CMakeLists.txt:
Added ma_dyncol.c
mysys/Makefile.am:
Added ma_dyncol.c
mysys/string.c:
Added dynstr_reassociate() to move a buffer from dynamic_strings to some other allocator
sql-common/my_time.c:
Added 'fuzzydate' flag to str_to_time()
Added support for microseconds to my_time_to_str() and my_datetime_to_str()
Reset second_parts in number_to_datetime()
Added double_to_datetime()
sql/field.cc:
Added double_to_longlong() and truncate_double() to simplify and reuse code
sql/field.h:
New prototypes
sql/item.cc:
Changed Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) to be aware of type of argument.
(Needed to make it microsecond safe and get better warnings).
Updated call to str_to_time_with_warn()
sql/item.h:
Added struct st_dyncall_create_def used by dynamic columns
Added virtual bool dynamic_result() to tell if type of argument may change over calls.
sql/item_cmpfunc.cc:
Added Item_func_dyncol_exists()
sql/item_cmpfunc.h:
Added class Item_func_dyncol_exists
sql/item_create.cc:
Added get_length_and_scale() to simplify other functions
Simplified and extended create_func_cast()
Added support for cast(X as double(X,Y))
Added functions to create dynamic column functions.
sql/item_create.h:
Added prototypes
sql/item_func.cc:
Extended cast functions Item_func_signed() and Item_func_unsigned() to work with dynamic types
Added Item_double_typecast()
sql/item_func.h:
Added class Item_double_typecast()
sql/item_strfunc.cc:
Added functions for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_strfunc.h:
Added classes for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_timefunc.cc:
Added flag argument to str_to_time_with_warn()
Updated Item_char_typecast() to handle result type that may change between calls (for dynamic columns)
Added Item_time_typecast::get_date() to ensure that we cast a datetime to time properly.
sql/item_timefunc.h:
Added get_date() to Item_time_typecast() to allow proper results for casting time to datetime
sql/lex.h:
Added new SQL function names
sql/my_decimal.cc:
Added 'const' to some arguments.
Better error message in case of errors (we now print out the wrong value)
Added my_decimal2int()
sql/my_decimal.h:
Moved some constants to my_decimal_limits.h
Updated prototypes.
Made my_decimal2int() a function as it's rather long (no reason to have it inline)
Added decimal2my_decimal() function.
sql/mysql_priv.h:
Prototypes for new functions
sql/share/errmsg.txt:
New error messages for wrong casts and dynamic columns
sql/sql_acl.cc:
Fixed indentation
sql/sql_base.cc:
Added dynamic_column_error_message()
sql/sql_string.h:
Added reassociate() to move a buffer to be owned by String object.
sql/sql_yacc.yy:
Added syntax for COLUMN_ functions.
sql/time.cc:
Updated str_to_datetime_with_warn() flag argument to same type as other functions
Added conversion flag to str_to_time_with_warn() (Similar to all datetime functions)
Added conversion functions with warnings: double_to_datetime_with_warn() and decimal_to_datetime_with_warn()
strings/decimal.c:
Added 'const' to arguments for some functions.
unittest/mysys/Makefile.am:
Added test for dynamic columns code
2011-05-08 12:24:06 +02:00
|
|
|
ERROR 22007: Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SELECT sp_vars_check_ret4();
|
|
|
|
sp_vars_check_ret4()
|
|
|
|
154.12
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
|
2006-10-19 20:39:51 +02:00
|
|
|
SELECT sp_vars_div_zero();
|
|
|
|
ERROR 22012: Division by 0
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'ansi';
|
|
|
|
DROP PROCEDURE sp_vars_check_dflt;
|
|
|
|
DROP PROCEDURE sp_vars_check_assignment;
|
|
|
|
DROP FUNCTION sp_vars_check_ret1;
|
|
|
|
DROP FUNCTION sp_vars_check_ret2;
|
|
|
|
DROP FUNCTION sp_vars_check_ret3;
|
|
|
|
DROP FUNCTION sp_vars_check_ret4;
|
2006-10-19 20:39:51 +02:00
|
|
|
DROP FUNCTION sp_vars_div_zero;
|
2005-12-07 15:01:17 +01:00
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BIT data type tests
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
CREATE PROCEDURE p1()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v1 BIT;
|
|
|
|
DECLARE v2 BIT(1);
|
|
|
|
DECLARE v3 BIT(3) DEFAULT b'101';
|
|
|
|
DECLARE v4 BIT(64) DEFAULT 0x5555555555555555;
|
|
|
|
DECLARE v5 BIT(3);
|
|
|
|
DECLARE v6 BIT(64);
|
|
|
|
DECLARE v7 BIT(8) DEFAULT 128;
|
|
|
|
DECLARE v8 BIT(8) DEFAULT '128';
|
|
|
|
DECLARE v9 BIT(8) DEFAULT ' 128';
|
|
|
|
DECLARE v10 BIT(8) DEFAULT 'x 128';
|
|
|
|
SET v1 = v4;
|
|
|
|
SET v2 = 0;
|
|
|
|
SET v5 = v4; # check overflow
|
|
|
|
SET v6 = v3; # check padding
|
|
|
|
SELECT HEX(v1);
|
|
|
|
SELECT HEX(v2);
|
|
|
|
SELECT HEX(v3);
|
|
|
|
SELECT HEX(v4);
|
|
|
|
SELECT HEX(v5);
|
|
|
|
SELECT HEX(v6);
|
|
|
|
SELECT HEX(v7);
|
|
|
|
SELECT HEX(v8);
|
|
|
|
SELECT HEX(v9);
|
|
|
|
SELECT HEX(v10);
|
|
|
|
END|
|
|
|
|
CALL p1();
|
|
|
|
HEX(v1)
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
1
|
2005-12-07 15:01:17 +01:00
|
|
|
HEX(v2)
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
0
|
2005-12-07 15:01:17 +01:00
|
|
|
HEX(v3)
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
5
|
2005-12-07 15:01:17 +01:00
|
|
|
HEX(v4)
|
|
|
|
5555555555555555
|
|
|
|
HEX(v5)
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
7
|
2005-12-07 15:01:17 +01:00
|
|
|
HEX(v6)
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
5
|
2005-12-07 15:01:17 +01:00
|
|
|
HEX(v7)
|
|
|
|
80
|
|
|
|
HEX(v8)
|
|
|
|
FF
|
|
|
|
HEX(v9)
|
|
|
|
FF
|
|
|
|
HEX(v10)
|
|
|
|
FF
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'v5' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
CASE expression tests.
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
Warnings:
|
2010-02-23 19:43:26 +01:00
|
|
|
Note 1305 PROCEDURE test.p1 does not exist
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP PROCEDURE IF EXISTS p2;
|
|
|
|
Warnings:
|
2010-02-23 19:43:26 +01:00
|
|
|
Note 1305 PROCEDURE test.p2 does not exist
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
Warnings:
|
|
|
|
Note 1051 Unknown table 't1'
|
|
|
|
CREATE TABLE t1(log_msg VARCHAR(1024));
|
|
|
|
CREATE PROCEDURE p1(arg VARCHAR(255))
|
|
|
|
BEGIN
|
|
|
|
INSERT INTO t1 VALUES('p1: step1');
|
|
|
|
CASE arg * 10
|
|
|
|
WHEN 10 * 10 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: on 10');
|
|
|
|
WHEN 10 * 10 + 10 * 10 THEN
|
|
|
|
BEGIN
|
|
|
|
CASE arg / 10
|
|
|
|
WHEN 1 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case2: on 1');
|
|
|
|
WHEN 2 THEN
|
|
|
|
BEGIN
|
|
|
|
DECLARE i TINYINT DEFAULT 10;
|
|
|
|
WHILE i > 0 DO
|
|
|
|
INSERT INTO t1 VALUES(CONCAT('p1: case1: case2: loop: i: ', i));
|
|
|
|
CASE MOD(i, 2)
|
|
|
|
WHEN 0 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case2: loop: i is even');
|
|
|
|
WHEN 1 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case2: loop: i is odd');
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case2: loop: ERROR');
|
|
|
|
END CASE;
|
|
|
|
SET i = i - 1;
|
|
|
|
END WHILE;
|
|
|
|
END;
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case2: ERROR');
|
|
|
|
END CASE;
|
|
|
|
CASE arg
|
|
|
|
WHEN 10 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case3: on 10');
|
|
|
|
WHEN 20 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case3: on 20');
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: case3: ERROR');
|
|
|
|
END CASE;
|
|
|
|
END;
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case1: ERROR');
|
|
|
|
END CASE;
|
|
|
|
CASE arg * 10
|
|
|
|
WHEN 10 * 10 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: on 10');
|
|
|
|
WHEN 10 * 10 + 10 * 10 THEN
|
|
|
|
BEGIN
|
|
|
|
CASE arg / 10
|
|
|
|
WHEN 1 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case5: on 1');
|
|
|
|
WHEN 2 THEN
|
|
|
|
BEGIN
|
|
|
|
DECLARE i TINYINT DEFAULT 10;
|
|
|
|
WHILE i > 0 DO
|
|
|
|
INSERT INTO t1 VALUES(CONCAT('p1: case4: case5: loop: i: ', i));
|
|
|
|
CASE MOD(i, 2)
|
|
|
|
WHEN 0 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case5: loop: i is even');
|
|
|
|
WHEN 1 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case5: loop: i is odd');
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case5: loop: ERROR');
|
|
|
|
END CASE;
|
|
|
|
SET i = i - 1;
|
|
|
|
END WHILE;
|
|
|
|
END;
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case5: ERROR');
|
|
|
|
END CASE;
|
|
|
|
CASE arg
|
|
|
|
WHEN 10 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case6: on 10');
|
|
|
|
WHEN 20 THEN
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case6: on 20');
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: case6: ERROR');
|
|
|
|
END CASE;
|
|
|
|
END;
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p1: case4: ERROR');
|
|
|
|
END CASE;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p2()
|
|
|
|
BEGIN
|
|
|
|
DECLARE i TINYINT DEFAULT 3;
|
|
|
|
WHILE i > 0 DO
|
|
|
|
IF MOD(i, 2) = 0 THEN
|
|
|
|
SET @_test_session_var = 10;
|
|
|
|
ELSE
|
|
|
|
SET @_test_session_var = 'test';
|
|
|
|
END IF;
|
|
|
|
CASE @_test_session_var
|
|
|
|
WHEN 10 THEN
|
|
|
|
INSERT INTO t1 VALUES('p2: case: numerical type');
|
|
|
|
WHEN 'test' THEN
|
|
|
|
INSERT INTO t1 VALUES('p2: case: string type');
|
|
|
|
ELSE
|
|
|
|
INSERT INTO t1 VALUES('p2: case: ERROR');
|
|
|
|
END CASE;
|
|
|
|
SET i = i - 1;
|
|
|
|
END WHILE;
|
|
|
|
END|
|
|
|
|
CALL p1(10);
|
|
|
|
CALL p1(20);
|
|
|
|
CALL p2();
|
|
|
|
SELECT * FROM t1;
|
|
|
|
log_msg
|
|
|
|
p1: step1
|
|
|
|
p1: case1: on 10
|
|
|
|
p1: case4: on 10
|
|
|
|
p1: step1
|
|
|
|
p1: case1: case2: loop: i: 10
|
|
|
|
p1: case1: case2: loop: i is even
|
|
|
|
p1: case1: case2: loop: i: 9
|
|
|
|
p1: case1: case2: loop: i is odd
|
|
|
|
p1: case1: case2: loop: i: 8
|
|
|
|
p1: case1: case2: loop: i is even
|
|
|
|
p1: case1: case2: loop: i: 7
|
|
|
|
p1: case1: case2: loop: i is odd
|
|
|
|
p1: case1: case2: loop: i: 6
|
|
|
|
p1: case1: case2: loop: i is even
|
|
|
|
p1: case1: case2: loop: i: 5
|
|
|
|
p1: case1: case2: loop: i is odd
|
|
|
|
p1: case1: case2: loop: i: 4
|
|
|
|
p1: case1: case2: loop: i is even
|
|
|
|
p1: case1: case2: loop: i: 3
|
|
|
|
p1: case1: case2: loop: i is odd
|
|
|
|
p1: case1: case2: loop: i: 2
|
|
|
|
p1: case1: case2: loop: i is even
|
|
|
|
p1: case1: case2: loop: i: 1
|
|
|
|
p1: case1: case2: loop: i is odd
|
|
|
|
p1: case1: case3: on 20
|
|
|
|
p1: case4: case5: loop: i: 10
|
|
|
|
p1: case4: case5: loop: i is even
|
|
|
|
p1: case4: case5: loop: i: 9
|
|
|
|
p1: case4: case5: loop: i is odd
|
|
|
|
p1: case4: case5: loop: i: 8
|
|
|
|
p1: case4: case5: loop: i is even
|
|
|
|
p1: case4: case5: loop: i: 7
|
|
|
|
p1: case4: case5: loop: i is odd
|
|
|
|
p1: case4: case5: loop: i: 6
|
|
|
|
p1: case4: case5: loop: i is even
|
|
|
|
p1: case4: case5: loop: i: 5
|
|
|
|
p1: case4: case5: loop: i is odd
|
|
|
|
p1: case4: case5: loop: i: 4
|
|
|
|
p1: case4: case5: loop: i is even
|
|
|
|
p1: case4: case5: loop: i: 3
|
|
|
|
p1: case4: case5: loop: i is odd
|
|
|
|
p1: case4: case5: loop: i: 2
|
|
|
|
p1: case4: case5: loop: i is even
|
|
|
|
p1: case4: case5: loop: i: 1
|
|
|
|
p1: case4: case5: loop: i is odd
|
|
|
|
p1: case4: case6: on 20
|
|
|
|
p2: case: string type
|
|
|
|
p2: case: numerical type
|
|
|
|
p2: case: string type
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP PROCEDURE p2;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#14161
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
CREATE TABLE t1(col BIGINT UNSIGNED);
|
|
|
|
INSERT INTO t1 VALUE(18446744073709551614);
|
|
|
|
CREATE PROCEDURE p1(IN arg BIGINT UNSIGNED)
|
|
|
|
BEGIN
|
|
|
|
SELECT arg;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
SELECT * FROM t1 WHERE col = arg;
|
|
|
|
END|
|
|
|
|
CALL p1(18446744073709551614);
|
|
|
|
arg
|
|
|
|
18446744073709551614
|
|
|
|
col
|
|
|
|
18446744073709551614
|
|
|
|
col
|
|
|
|
18446744073709551614
|
|
|
|
DROP TABLE t1;
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#13705
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
CREATE PROCEDURE p1(x VARCHAR(10), y CHAR(3)) READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
SELECT x, y;
|
|
|
|
END|
|
|
|
|
CALL p1('alpha', 'abc');
|
|
|
|
x y
|
|
|
|
alpha abc
|
|
|
|
CALL p1('alpha', 'abcdef');
|
|
|
|
x y
|
|
|
|
alpha abc
|
|
|
|
Warnings:
|
|
|
|
Warning 1265 Data truncated for column 'y' at row 1
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#13675
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE PROCEDURE p1(x DATETIME)
|
|
|
|
BEGIN
|
|
|
|
CREATE TABLE t1 SELECT x;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
END|
|
|
|
|
CALL p1(NOW());
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE "t1" (
|
2007-05-07 14:33:28 +02:00
|
|
|
"x" datetime DEFAULT NULL
|
2005-12-07 15:01:17 +01:00
|
|
|
)
|
|
|
|
CALL p1('test');
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE "t1" (
|
2007-05-07 14:33:28 +02:00
|
|
|
"x" datetime DEFAULT NULL
|
2005-12-07 15:01:17 +01:00
|
|
|
)
|
|
|
|
Warnings:
|
wl#173 - temporal types with sub-second resolution
and collateral changes.
* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double
client/mysqlbinlog.cc:
remove unneded casts
include/my_sys.h:
introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
pack_time/unpack_time, etc.
convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
str_to_time() is gone. str_to_datetime() does it now.
my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
time is not equal to datetime anymore
mysql-test/r/distinct.result:
a test for an old MySQL bug
mysql-test/r/explain.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
invalid datetime is not compared with as a string
mysql-test/r/select.result:
NO_ZERO_IN_DATE, etc only affect storage - according to the manual
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
test for an old MySQL bug
mysql-test/t/func_time.test:
+- INTERVAL now works with TIME values
mysql-test/t/select.test:
typo
mysql-test/t/subselect.test:
only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
old timestamp(X) is no longer supported
mysys/my_getsystime.c:
functions to get the time with microsecond precision
mysys/my_init.c:
move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
no need to make these variables extern
mysys/my_static.h:
no need to make these variables extern
scripts/mysql_system_tables.sql:
old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
old timestamp(X) is no longer supported
sql-common/my_time.c:
* call str_to_time from str_to_datetime, as appropriate
* date/time to string conversions take precision as an argument
* number_to_time()
* TIME_to_double()
* pack_time() and unpack_time()
sql/event_data_objects.cc:
cast is not needed
my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
avoid dangerous downcast (because the pointer is
not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
avoid silly double-work for cond_wait
(having an endpoint of wait, subtract the current time to get the timeout,
and use set_timespec() macro to fill in struct timespec, by adding the current
time to the timeout)
sql/field.cc:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
* remove virtual Field::get_time(), everyone should use only Field::get_date()
* remove lots of #ifdef WORDS_BIGENDIAN
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
TIME_RESULT, cmp_time()
sql/item.cc:
* numbers aren't quoted in EXPLAIN EXTENDED
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_param::field_type() is set correctly
* Item_datetime, for a datetime constant
* time to anything is compared as a time
* Item_cache::print() prints the value is available
* bug fixed in Item_cache_int::val_str()
sql/item.h:
* Item::print_value(), to be used from Item_xxx::print() when needed
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* virtual Item::get_time() is gone
* Item_datetime, for a datetime constant
* better default for cast_to_int_type()
* Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
* get_year_value, get_time_value are gone. get_datetime_value does it all
* get_value_a_func, get_value_b_func are gone
* can_compare_as_dates() is gone too, TIME_RESULT is used instead
* cmp_type() instead or result_type() when doing a comparison
* compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
* Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
greatly simplified Arg_comparator
sql/item_create.cc:
* fix a bug in error messages in CAST
sql/item_func.cc:
Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
overwrite the default cmp_type() for Item_row,
as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
rewrite make_datetime to support precision argument
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
SEC_TO_TIME is real function, not integer.
many functions that returned temporal values had duplicate code in val_* methods,
some of them did not have get_date() which resulted in unnecessary date->str->date conversions.
Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
replication of NOW(6)
sql/log_event.h:
replication of NOW(6)
sql/mysql_priv.h:
Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
make_truncated_value_warning() that uses it.
sql/mysqld.cc:
datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
small cleanup
sql/set_var.cc:
SET TIMESTAMP=double
sql/set_var.h:
@@TIMESTAMP is a double
sql/share/errmsg.txt:
precision and scale are unsigned
sql/slave.cc:
replication of NOW(6)
sql/sp_head.cc:
cleanup
sql/sql_class.cc:
support for NOW(6)
sql/sql_class.h:
support for NOW(6)
sql/sql_insert.cc:
support for NOW(6)
sql/sql_select.cc:
use item->cmp_type().
move a comment where it belongs
sql/sql_show.cc:
new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
warnings
tests/mysql_client_test.c:
old timestamp(X) does not work anymore
datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
|
|
|
Warning 1265 Data truncated for column 'x' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#12976
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP PROCEDURE IF EXISTS p2;
|
|
|
|
CREATE TABLE t1(b BIT(1));
|
|
|
|
INSERT INTO t1(b) VALUES(b'0'), (b'1');
|
|
|
|
CREATE PROCEDURE p1()
|
|
|
|
BEGIN
|
|
|
|
SELECT HEX(b),
|
|
|
|
b = 0,
|
|
|
|
b = FALSE,
|
|
|
|
b IS FALSE,
|
|
|
|
b = 1,
|
|
|
|
b = TRUE,
|
|
|
|
b IS TRUE
|
|
|
|
FROM t1;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p2()
|
|
|
|
BEGIN
|
|
|
|
DECLARE vb BIT(1);
|
|
|
|
SELECT b INTO vb FROM t1 WHERE b = 0;
|
|
|
|
SELECT HEX(vb),
|
|
|
|
vb = 0,
|
|
|
|
vb = FALSE,
|
|
|
|
vb IS FALSE,
|
|
|
|
vb = 1,
|
|
|
|
vb = TRUE,
|
|
|
|
vb IS TRUE;
|
|
|
|
SELECT b INTO vb FROM t1 WHERE b = 1;
|
|
|
|
SELECT HEX(vb),
|
|
|
|
vb = 0,
|
|
|
|
vb = FALSE,
|
|
|
|
vb IS FALSE,
|
|
|
|
vb = 1,
|
|
|
|
vb = TRUE,
|
|
|
|
vb IS TRUE;
|
|
|
|
END|
|
|
|
|
call p1();
|
|
|
|
HEX(b) b = 0 b = FALSE b IS FALSE b = 1 b = TRUE b IS TRUE
|
|
|
|
|
|
|
|
0 1 1 1 0 0 0
|
|
|
|
1 0 0 0 1 1 1
|
|
|
|
call p2();
|
|
|
|
HEX(vb) vb = 0 vb = FALSE vb IS FALSE vb = 1 vb = TRUE vb IS TRUE
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
0 1 1 1 0 0 0
|
2005-12-07 15:01:17 +01:00
|
|
|
HEX(vb) vb = 0 vb = FALSE vb IS FALSE vb = 1 vb = TRUE vb IS TRUE
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
1 0 0 0 1 1 1
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP TABLE t1;
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP PROCEDURE p2;
|
Bug#12976 (stored procedures local variables of type bit)
Before this change, a local variables in stored procedures / stored functions
or triggers, when declared with a type of bit(N), would not evaluate their
value properly.
The problem was that the data was incorrectly typed as a string,
causing for example bit b'1', implemented as a byte 0x01, to be interpreted
as a string starting with the character 0x01. This later would cause
implicit conversions to integers or booleans to fail.
The root cause of this problem was an incorrect translation between field
types, like bit(N), and internal types used when representing values in Item
objects.
Also, before this change, the function HEX() would sometime print extra "0"
characters when invoked with bit(N) values.
With this fix, the type translation (sp_map_result_type, sp_map_item_type)
has been changed so that bit(N) fields are represented with integer values.
A consequence is that, for the function HEX(), when called with a stored
procedure local variable of type bit(N) as argument, HEX() is provided with an
integer instead of a string, and therefore does not print "0" padding.
A test case for Bug 12976 was present in the test suite, and has been updated.
mysql-test/r/sp-vars.result:
Local stored procedure variables of type bit(N) are integer values.
mysql-test/t/sp-vars.test:
Local stored procedure variables of type bit(N) are integer values.
sql/sp_head.cc:
Local stored procedure variables of type bit(N) are integer values.
2007-02-07 00:01:22 +01:00
|
|
|
DROP TABLE IF EXISTS table_12976_a;
|
|
|
|
DROP TABLE IF EXISTS table_12976_b;
|
|
|
|
DROP PROCEDURE IF EXISTS proc_12976_a;
|
|
|
|
DROP PROCEDURE IF EXISTS proc_12976_b;
|
|
|
|
CREATE TABLE table_12976_a (val bit(1));
|
|
|
|
CREATE TABLE table_12976_b(
|
|
|
|
appname varchar(15),
|
|
|
|
emailperm bit not null default 1,
|
|
|
|
phoneperm bit not null default 0);
|
|
|
|
insert into table_12976_b values ('A', b'1', b'1'), ('B', b'0', b'0');
|
|
|
|
CREATE PROCEDURE proc_12976_a()
|
|
|
|
BEGIN
|
|
|
|
declare localvar bit(1);
|
|
|
|
SELECT val INTO localvar FROM table_12976_a;
|
|
|
|
SELECT coalesce(localvar, 1)+1, coalesce(val, 1)+1 FROM table_12976_a;
|
|
|
|
END||
|
|
|
|
CREATE PROCEDURE proc_12976_b(
|
|
|
|
name varchar(15),
|
|
|
|
out ep bit,
|
|
|
|
out msg varchar(10))
|
|
|
|
BEGIN
|
|
|
|
SELECT emailperm into ep FROM table_12976_b where (appname = name);
|
|
|
|
IF ep is true THEN
|
|
|
|
SET msg = 'True';
|
|
|
|
ELSE
|
|
|
|
SET msg = 'False';
|
|
|
|
END IF;
|
|
|
|
END||
|
|
|
|
INSERT table_12976_a VALUES (0);
|
|
|
|
call proc_12976_a();
|
|
|
|
coalesce(localvar, 1)+1 coalesce(val, 1)+1
|
|
|
|
1 1
|
|
|
|
UPDATE table_12976_a set val=1;
|
|
|
|
call proc_12976_a();
|
|
|
|
coalesce(localvar, 1)+1 coalesce(val, 1)+1
|
|
|
|
2 2
|
|
|
|
call proc_12976_b('A', @ep, @msg);
|
|
|
|
select @ep, @msg;
|
|
|
|
@ep @msg
|
|
|
|
1 True
|
|
|
|
call proc_12976_b('B', @ep, @msg);
|
|
|
|
select @ep, @msg;
|
|
|
|
@ep @msg
|
|
|
|
0 False
|
|
|
|
DROP TABLE table_12976_a;
|
|
|
|
DROP TABLE table_12976_b;
|
|
|
|
DROP PROCEDURE proc_12976_a;
|
|
|
|
DROP PROCEDURE proc_12976_b;
|
2005-12-07 15:01:17 +01:00
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#9572
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP PROCEDURE IF EXISTS p2;
|
|
|
|
DROP PROCEDURE IF EXISTS p3;
|
|
|
|
DROP PROCEDURE IF EXISTS p4;
|
|
|
|
DROP PROCEDURE IF EXISTS p5;
|
|
|
|
DROP PROCEDURE IF EXISTS p6;
|
|
|
|
SET @@sql_mode = 'traditional';
|
|
|
|
CREATE PROCEDURE p1()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v TINYINT DEFAULT 1e200;
|
|
|
|
SELECT v;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p2()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v DECIMAL(5) DEFAULT 1e200;
|
|
|
|
SELECT v;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p3()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v CHAR(5) DEFAULT 'abcdef';
|
|
|
|
SELECT v LIKE 'abc___';
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p4(arg VARCHAR(2))
|
|
|
|
BEGIN
|
|
|
|
DECLARE var VARCHAR(1);
|
|
|
|
SET var := arg;
|
|
|
|
SELECT arg, var;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p5(arg CHAR(2))
|
|
|
|
BEGIN
|
|
|
|
DECLARE var CHAR(1);
|
|
|
|
SET var := arg;
|
|
|
|
SELECT arg, var;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p6(arg DECIMAL(2))
|
|
|
|
BEGIN
|
|
|
|
DECLARE var DECIMAL(1);
|
|
|
|
SET var := arg;
|
|
|
|
SELECT arg, var;
|
|
|
|
END|
|
|
|
|
CALL p1();
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'v' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
CALL p2();
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'v' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
CALL p3();
|
|
|
|
ERROR 22001: Data too long for column 'v' at row 1
|
|
|
|
CALL p4('aaa');
|
|
|
|
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);
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'var' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'ansi';
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP PROCEDURE p2;
|
|
|
|
DROP PROCEDURE p3;
|
|
|
|
DROP PROCEDURE p4;
|
|
|
|
DROP PROCEDURE p5;
|
|
|
|
DROP PROCEDURE p6;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#9078
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
CREATE PROCEDURE p1 (arg DECIMAL(64,2))
|
|
|
|
BEGIN
|
|
|
|
DECLARE var DECIMAL(64,2);
|
|
|
|
SET var = arg;
|
|
|
|
SELECT var;
|
|
|
|
END|
|
|
|
|
CALL p1(1929);
|
|
|
|
var
|
|
|
|
1929.00
|
|
|
|
CALL p1(1929.00);
|
|
|
|
var
|
|
|
|
1929.00
|
|
|
|
CALL p1(1929.003);
|
|
|
|
var
|
|
|
|
1929.00
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'arg' at row 1
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#8768
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS f1;
|
|
|
|
CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN arg;
|
|
|
|
END|
|
|
|
|
SELECT f1(-2500);
|
|
|
|
f1(-2500)
|
|
|
|
0
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'arg' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'traditional';
|
|
|
|
SELECT f1(-2500);
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'arg' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP FUNCTION f1;
|
|
|
|
CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
|
|
|
|
BEGIN
|
|
|
|
RETURN arg;
|
|
|
|
END|
|
|
|
|
SELECT f1(-2500);
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'arg' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'ansi';
|
|
|
|
DROP FUNCTION f1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#8769
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS f1;
|
|
|
|
CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT
|
|
|
|
BEGIN
|
|
|
|
RETURN arg;
|
|
|
|
END|
|
|
|
|
SELECT f1(8388699);
|
|
|
|
f1(8388699)
|
|
|
|
8388607
|
|
|
|
Warnings:
|
2005-12-12 11:29:48 +01:00
|
|
|
Warning 1264 Out of range value for column 'arg' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'traditional';
|
|
|
|
SELECT f1(8388699);
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'arg' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP FUNCTION f1;
|
|
|
|
CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT
|
|
|
|
BEGIN
|
|
|
|
RETURN arg;
|
|
|
|
END|
|
|
|
|
SELECT f1(8388699);
|
2005-12-12 11:29:48 +01:00
|
|
|
ERROR 22003: Out of range value for column 'arg' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
SET @@sql_mode = 'ansi';
|
|
|
|
DROP FUNCTION f1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#8702
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE TABLE t1(col VARCHAR(255));
|
|
|
|
INSERT INTO t1(col) VALUES('Hello, world!');
|
|
|
|
CREATE PROCEDURE p1()
|
|
|
|
BEGIN
|
|
|
|
DECLARE sp_var INTEGER;
|
|
|
|
SELECT col INTO sp_var FROM t1 LIMIT 1;
|
|
|
|
SET @user_var = sp_var;
|
|
|
|
SELECT sp_var;
|
|
|
|
SELECT @user_var;
|
|
|
|
END|
|
|
|
|
CALL p1();
|
|
|
|
sp_var
|
|
|
|
0
|
|
|
|
@user_var
|
|
|
|
0
|
|
|
|
Warnings:
|
2006-07-20 10:41:12 +02:00
|
|
|
Warning 1366 Incorrect integer value: 'Hello, world!' for column 'sp_var' at row 1
|
2005-12-07 15:01:17 +01:00
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#12903
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS f1;
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE TABLE t1(txt VARCHAR(255));
|
|
|
|
CREATE FUNCTION f1(arg VARCHAR(255)) RETURNS VARCHAR(255)
|
|
|
|
BEGIN
|
|
|
|
DECLARE v1 VARCHAR(255);
|
|
|
|
DECLARE v2 VARCHAR(255);
|
|
|
|
SET v1 = CONCAT(LOWER(arg), UPPER(arg));
|
|
|
|
SET v2 = CONCAT(LOWER(v1), UPPER(v1));
|
|
|
|
INSERT INTO t1 VALUES(v1), (v2);
|
|
|
|
RETURN CONCAT(LOWER(arg), UPPER(arg));
|
|
|
|
END|
|
|
|
|
SELECT f1('_aBcDe_');
|
|
|
|
f1('_aBcDe_')
|
|
|
|
_abcde__ABCDE_
|
|
|
|
SELECT * FROM t1;
|
|
|
|
txt
|
|
|
|
_abcde__ABCDE_
|
|
|
|
_abcde__abcde__ABCDE__ABCDE_
|
|
|
|
DROP FUNCTION f1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#13808
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP PROCEDURE IF EXISTS p2;
|
|
|
|
DROP FUNCTION IF EXISTS f1;
|
|
|
|
CREATE PROCEDURE p1(arg ENUM('a', 'b'))
|
|
|
|
BEGIN
|
|
|
|
SELECT arg;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p2(arg ENUM('a', 'b'))
|
|
|
|
BEGIN
|
|
|
|
DECLARE var ENUM('c', 'd') DEFAULT arg;
|
|
|
|
SELECT arg, var;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION f1(arg ENUM('a', 'b')) RETURNS ENUM('c', 'd')
|
|
|
|
BEGIN
|
|
|
|
RETURN arg;
|
|
|
|
END|
|
|
|
|
CALL p1('c');
|
|
|
|
arg
|
|
|
|
|
|
|
|
Warnings:
|
|
|
|
Warning 1265 Data truncated for column 'arg' at row 1
|
|
|
|
CALL p2('a');
|
|
|
|
arg var
|
|
|
|
a
|
|
|
|
Warnings:
|
|
|
|
Warning 1265 Data truncated for column 'var' at row 1
|
|
|
|
SELECT f1('a');
|
|
|
|
f1('a')
|
|
|
|
|
|
|
|
Warnings:
|
|
|
|
Warning 1265 Data truncated for column 'f1('a')' at row 1
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP PROCEDURE p2;
|
|
|
|
DROP FUNCTION f1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#13909
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP PROCEDURE IF EXISTS p2;
|
|
|
|
CREATE PROCEDURE p1(arg VARCHAR(255))
|
|
|
|
BEGIN
|
|
|
|
SELECT CHARSET(arg);
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p2(arg VARCHAR(255) CHARACTER SET UTF8)
|
|
|
|
BEGIN
|
|
|
|
SELECT CHARSET(arg);
|
|
|
|
END|
|
|
|
|
CALL p1('t');
|
|
|
|
CHARSET(arg)
|
|
|
|
latin1
|
|
|
|
CALL p1(_UTF8 't');
|
|
|
|
CHARSET(arg)
|
|
|
|
latin1
|
|
|
|
CALL p2('t');
|
|
|
|
CHARSET(arg)
|
|
|
|
utf8
|
|
|
|
CALL p2(_LATIN1 't');
|
|
|
|
CHARSET(arg)
|
|
|
|
utf8
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP PROCEDURE p2;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#14188
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
CREATE PROCEDURE p1(arg1 BINARY(2), arg2 VARBINARY(2))
|
|
|
|
BEGIN
|
|
|
|
DECLARE var1 BINARY(2) DEFAULT 0x41;
|
|
|
|
DECLARE var2 VARBINARY(2) DEFAULT 0x42;
|
|
|
|
SELECT HEX(arg1), HEX(arg2);
|
|
|
|
SELECT HEX(var1), HEX(var2);
|
|
|
|
END|
|
|
|
|
CALL p1(0x41, 0x42);
|
|
|
|
HEX(arg1) HEX(arg2)
|
|
|
|
4100 42
|
|
|
|
HEX(var1) HEX(var2)
|
|
|
|
4100 42
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#15148
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE TABLE t1(col1 TINYINT, col2 TINYINT);
|
|
|
|
INSERT INTO t1 VALUES(1, 2), (11, 12);
|
|
|
|
CREATE PROCEDURE p1(arg TINYINT)
|
|
|
|
BEGIN
|
|
|
|
SELECT arg;
|
|
|
|
END|
|
|
|
|
CALL p1((1, 2));
|
|
|
|
ERROR 21000: Operand should contain 1 column(s)
|
|
|
|
CALL p1((SELECT * FROM t1 LIMIT 1));
|
|
|
|
ERROR 21000: Operand should contain 1 column(s)
|
|
|
|
CALL p1((SELECT col1, col2 FROM t1 LIMIT 1));
|
|
|
|
ERROR 21000: Operand should contain 1 column(s)
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#13613
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
DROP FUNCTION IF EXISTS f1;
|
|
|
|
CREATE PROCEDURE p1(x VARCHAR(50))
|
|
|
|
BEGIN
|
|
|
|
SET x = SUBSTRING(x, 1, 3);
|
|
|
|
SELECT x;
|
|
|
|
END|
|
|
|
|
CREATE FUNCTION f1(x VARCHAR(50)) RETURNS VARCHAR(50)
|
|
|
|
BEGIN
|
|
|
|
RETURN SUBSTRING(x, 1, 3);
|
|
|
|
END|
|
|
|
|
CALL p1('abcdef');
|
|
|
|
x
|
|
|
|
abc
|
|
|
|
SELECT f1('ABCDEF');
|
|
|
|
f1('ABCDEF')
|
|
|
|
ABC
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
DROP FUNCTION f1;
|
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#13665
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
DROP FUNCTION IF EXISTS f1;
|
|
|
|
CREATE FUNCTION f1() RETURNS VARCHAR(20000)
|
|
|
|
BEGIN
|
|
|
|
DECLARE var VARCHAR(2000);
|
|
|
|
SET var = '';
|
|
|
|
SET var = CONCAT(var, 'abc');
|
|
|
|
SET var = CONCAT(var, '');
|
|
|
|
RETURN var;
|
|
|
|
END|
|
|
|
|
SELECT f1();
|
|
|
|
f1()
|
|
|
|
abc
|
|
|
|
DROP FUNCTION f1;
|
2006-06-30 16:14:22 +02:00
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
CREATE PROCEDURE p1()
|
|
|
|
BEGIN
|
|
|
|
DECLARE v_char VARCHAR(255);
|
|
|
|
DECLARE v_text TEXT DEFAULT '';
|
|
|
|
SET v_char = 'abc';
|
|
|
|
SET v_text = v_char;
|
|
|
|
SET v_char = 'def';
|
|
|
|
SET v_text = concat(v_text, '|', v_char);
|
|
|
|
SELECT v_text;
|
|
|
|
END|
|
|
|
|
CALL p1();
|
|
|
|
v_text
|
|
|
|
abc|def
|
|
|
|
DROP PROCEDURE p1;
|
2007-05-16 14:25:38 +02:00
|
|
|
DROP PROCEDURE IF EXISTS bug27415_text_test|
|
|
|
|
DROP PROCEDURE IF EXISTS bug27415_text_test2|
|
|
|
|
CREATE PROCEDURE bug27415_text_test(entity_id_str_in text)
|
|
|
|
BEGIN
|
|
|
|
DECLARE str_remainder text;
|
|
|
|
SET str_remainder = entity_id_str_in;
|
|
|
|
select 'before substr', str_remainder;
|
|
|
|
SET str_remainder = SUBSTRING(str_remainder, 3);
|
|
|
|
select 'after substr', str_remainder;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE bug27415_text_test2(entity_id_str_in text)
|
|
|
|
BEGIN
|
|
|
|
DECLARE str_remainder text;
|
|
|
|
DECLARE str_remainder2 text;
|
|
|
|
SET str_remainder2 = entity_id_str_in;
|
|
|
|
select 'before substr', str_remainder2;
|
|
|
|
SET str_remainder = SUBSTRING(str_remainder2, 3);
|
|
|
|
select 'after substr', str_remainder;
|
|
|
|
END|
|
|
|
|
CALL bug27415_text_test('a,b,c')|
|
|
|
|
before substr str_remainder
|
|
|
|
before substr a,b,c
|
|
|
|
after substr str_remainder
|
|
|
|
after substr b,c
|
|
|
|
CALL bug27415_text_test('a,b,c')|
|
|
|
|
before substr str_remainder
|
|
|
|
before substr a,b,c
|
|
|
|
after substr str_remainder
|
|
|
|
after substr b,c
|
|
|
|
CALL bug27415_text_test2('a,b,c')|
|
|
|
|
before substr str_remainder2
|
|
|
|
before substr a,b,c
|
|
|
|
after substr str_remainder
|
|
|
|
after substr b,c
|
|
|
|
CALL bug27415_text_test('a,b,c')|
|
|
|
|
before substr str_remainder
|
|
|
|
before substr a,b,c
|
|
|
|
after substr str_remainder
|
|
|
|
after substr b,c
|
|
|
|
DROP PROCEDURE bug27415_text_test|
|
|
|
|
DROP PROCEDURE bug27415_text_test2|
|
Bug#26277 User variable returns one type in SELECT @v and other for CREATE as SELECT @v
- Adding variable m_cached_result_type to keep the variable type consistent
during the execution of a statement.
- Before each result set is returned to the client the description of each
column is sent as meta data.
Previously the result type for a column could change if the hash variable
entry changed between statements. This caused the result set of the query
to alternate column types in certain cases which is not supported by MySQL
client-server protocol. Example:
Previously this sequence:
SET @a:=1;
SELECT @a:="text", @a;
would return "text", "text";
After the change the SELECT returns "text", 0
The reson for this is that previously the result set from 'SELECT @a;'
would always be of the type STRING, whereas now the type of the variable
is taken from the last SET statement. However, 'SELECT @a:="text"' will
return type of STRING since the right side of the assignment is used.
mysql-test/r/ps_2myisam.result:
Changed test result because SQL type of a user variable now
more accurately represents its Item type: since Item type of a variable
can be either STRING, INT, DECIMAL or DOUBLE, SQL type of the
result set metadata now can be either MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL or MYSQL_TYPE_DOUBLE.
Previously it was always MYSQL_TYPE_VARCHAR.
In particular, integer variables now have changed from
MYSQL_TYPE_VARCHAR to MYSQL_TYPE_LONGLONG.
mysql-test/r/ps_3innodb.result:
Changed test result because SQL type of a user variable now
more accurately represents its Item type: since Item type of a variable
can be either STRING, INT, DECIMAL or DOUBLE, SQL type of the
result set metadata now can be either MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL or MYSQL_TYPE_DOUBLE.
Previously it was always MYSQL_TYPE_VARCHAR.
In particular, integer variables now have changed from
MYSQL_TYPE_VARCHAR to MYSQL_TYPE_LONGLONG.
mysql-test/r/ps_4heap.result:
Changed test result because SQL type of a user variable now
more accurately represents its Item type: since Item type of a variable
can be either STRING, INT, DECIMAL or DOUBLE, SQL type of the
result set metadata now can be either MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL or MYSQL_TYPE_DOUBLE.
Previously it was always MYSQL_TYPE_VARCHAR.
In particular, integer variables now have changed from
MYSQL_TYPE_VARCHAR to MYSQL_TYPE_LONGLONG.
mysql-test/r/ps_5merge.result:
Changed test result because SQL type of a user variable now
more accurately represents its Item type: since Item type of a variable
can be either STRING, INT, DECIMAL or DOUBLE, SQL type of the
result set metadata now can be either MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL or MYSQL_TYPE_DOUBLE.
Previously it was always MYSQL_TYPE_VARCHAR.
In particular, integer variables now have changed from
MYSQL_TYPE_VARCHAR to MYSQL_TYPE_LONGLONG.
mysql-test/r/ps_7ndb.result:
Changed test result because SQL type of a user variable now
more accurately represents its Item type: since Item type of a variable
can be either STRING, INT, DECIMAL or DOUBLE, SQL type of the
result set metadata now can be either MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL or MYSQL_TYPE_DOUBLE.
Previously it was always MYSQL_TYPE_VARCHAR.
In particular, integer variables now have changed from
MYSQL_TYPE_VARCHAR to MYSQL_TYPE_LONGLONG.
mysql-test/r/sp-vars.result:
Added test case. Previously variables could change their variable type during
the execution of a statement.
Which variable type to use in the statement is specified in
any previous statement.
mysql-test/r/type_date.result:
This test case result is changed because it is no longer allowed for user
variables to change their variable type during the execution of a statement.
The determination of which variable type to use in the statement is specified in
any previous statement.
mysql-test/r/user_var.result:
This test case result is changed because it is no longer allowed for user
variables to change their variable type during the execution of a statement.
The determination of which variable type to use in the statement is specified in
any previous statement.
mysql-test/t/sp-vars.test:
Added test case. Previously variables could change their variable type during
the execution of a statement.
Which variable type to use in the statement is specified in
any previous statement.
mysql-test/t/type_date.test:
This test case result is changed because it is no longer allowed for user
variables to change their variable type during the execution of a statement.
The determination of which variable type to use in the statement is specified in
any previous statement.
sql/item_func.cc:
Adding variable m_cached_result_type to keep the variable type consistent
during the execution of a statement.
Previously the result type could change if the hash variable entry changed
between statements. This caused the result set of the query to alternate
column types in certain cases.
sql/item_func.h:
Adding variable m_cached_result_type to keep the variable type consistent
during the execution of a statement.
Previously the result type could change if the hash variable entry changed
between statements. This caused the result set of the query to alternate
column types in certain cases.
2007-05-18 12:44:03 +02:00
|
|
|
drop function if exists f1;
|
|
|
|
drop table if exists t1;
|
|
|
|
create function f1() returns int
|
|
|
|
begin
|
|
|
|
if @a=1 then set @b='abc';
|
|
|
|
else set @b=1;
|
|
|
|
end if;
|
|
|
|
set @a=1;
|
|
|
|
return 0;
|
|
|
|
end|
|
|
|
|
create table t1 (a int)|
|
|
|
|
insert into t1 (a) values (1), (2)|
|
|
|
|
set @b=1|
|
|
|
|
set @a=0|
|
|
|
|
select f1(), @b from t1|
|
|
|
|
f1() @b
|
|
|
|
0 1
|
|
|
|
0 0
|
|
|
|
set @b:='test'|
|
|
|
|
set @a=0|
|
|
|
|
select f1(), @b from t1|
|
|
|
|
f1() @b
|
|
|
|
0 1
|
|
|
|
0 abc
|
|
|
|
drop function f1;
|
|
|
|
drop table t1;
|
2009-10-09 15:34:07 +02:00
|
|
|
|
|
|
|
---------------------------------------------------------------
|
|
|
|
BUG#28299
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
|
|
|
CREATE PROCEDURE ctest()
|
|
|
|
BEGIN
|
|
|
|
DECLARE i CHAR(16);
|
|
|
|
DECLARE j INT;
|
|
|
|
SET i= 'string';
|
|
|
|
SET j= 1 + i;
|
|
|
|
END|
|
|
|
|
CALL ctest();
|
|
|
|
Warnings:
|
|
|
|
Warning 1292 Truncated incorrect DOUBLE value: 'string '
|
|
|
|
DROP PROCEDURE ctest;
|
|
|
|
CREATE PROCEDURE vctest()
|
|
|
|
BEGIN
|
|
|
|
DECLARE i VARCHAR(16);
|
|
|
|
DECLARE j INT;
|
|
|
|
SET i= 'string';
|
|
|
|
SET j= 1 + i;
|
|
|
|
END|
|
|
|
|
CALL vctest();
|
|
|
|
Warnings:
|
|
|
|
Warning 1292 Truncated incorrect DOUBLE value: 'string'
|
|
|
|
DROP PROCEDURE vctest;
|