Skip to content

Commit a20c121

Browse files
author
Alexander Barkov
committed
MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
1 parent 4c2c5ec commit a20c121

File tree

3 files changed

+82
-2
lines changed

3 files changed

+82
-2
lines changed

mysql-test/r/ps.result

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3388,7 +3388,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
33883388
SHOW CREATE TABLE tmp1;
33893389
Table Create Table
33903390
tmp1 CREATE TEMPORARY TABLE `tmp1` (
3391-
`c1` bigint(20) DEFAULT NULL
3391+
`c1` bigint(20) unsigned DEFAULT NULL
33923392
) ENGINE=MyISAM DEFAULT CHARSET=latin1
33933393
SELECT @a, @a = b'10100100101';
33943394
@a @a = b'10100100101'
@@ -3478,7 +3478,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
34783478
SHOW CREATE TABLE tmp1;
34793479
Table Create Table
34803480
tmp1 CREATE TEMPORARY TABLE `tmp1` (
3481-
`c1` bigint(20) DEFAULT NULL
3481+
`c1` bigint(20) unsigned DEFAULT NULL
34823482
) ENGINE=MyISAM DEFAULT CHARSET=latin1
34833483
SELECT @a, @a = 2010;
34843484
@a @a = 2010
@@ -5029,3 +5029,48 @@ COERCIBILITY(?)
50295029
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
50305030
COERCIBILITY(?)
50315031
5
5032+
#
5033+
# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
5034+
#
5035+
CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
5036+
CALL p1(@a);
5037+
PREPARE stmt FROM 'CALL p1(?)';
5038+
EXECUTE stmt USING @b;
5039+
DEALLOCATE PREPARE stmt;
5040+
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
5041+
SHOW CREATE TABLE t1;
5042+
Table Create Table
5043+
t1 CREATE TABLE `t1` (
5044+
`a` bigint(20) unsigned DEFAULT NULL,
5045+
`b` bigint(20) unsigned DEFAULT NULL
5046+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
5047+
DROP TABLE t1;
5048+
DROP PROCEDURE p1;
5049+
CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
5050+
CALL p1(@a);
5051+
PREPARE stmt FROM 'CALL p1(?)';
5052+
EXECUTE stmt USING @b;
5053+
DEALLOCATE PREPARE stmt;
5054+
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
5055+
SHOW CREATE TABLE t1;
5056+
Table Create Table
5057+
t1 CREATE TABLE `t1` (
5058+
`a` bigint(20) unsigned DEFAULT NULL,
5059+
`b` bigint(20) unsigned DEFAULT NULL
5060+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
5061+
DROP TABLE t1;
5062+
DROP PROCEDURE p1;
5063+
CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
5064+
CALL p1(@a);
5065+
PREPARE stmt FROM 'CALL p1(?)';
5066+
EXECUTE stmt USING @b;
5067+
DEALLOCATE PREPARE stmt;
5068+
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
5069+
SHOW CREATE TABLE t1;
5070+
Table Create Table
5071+
t1 CREATE TABLE `t1` (
5072+
`a` bigint(20) unsigned DEFAULT NULL,
5073+
`b` bigint(20) unsigned DEFAULT NULL
5074+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
5075+
DROP TABLE t1;
5076+
DROP PROCEDURE p1;

mysql-test/t/ps.test

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4495,3 +4495,37 @@ EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
44954495
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
44964496
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
44974497
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
4498+
4499+
--echo #
4500+
--echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
4501+
--echo #
4502+
4503+
CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
4504+
CALL p1(@a);
4505+
PREPARE stmt FROM 'CALL p1(?)';
4506+
EXECUTE stmt USING @b;
4507+
DEALLOCATE PREPARE stmt;
4508+
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
4509+
SHOW CREATE TABLE t1;
4510+
DROP TABLE t1;
4511+
DROP PROCEDURE p1;
4512+
4513+
CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
4514+
CALL p1(@a);
4515+
PREPARE stmt FROM 'CALL p1(?)';
4516+
EXECUTE stmt USING @b;
4517+
DEALLOCATE PREPARE stmt;
4518+
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
4519+
SHOW CREATE TABLE t1;
4520+
DROP TABLE t1;
4521+
DROP PROCEDURE p1;
4522+
4523+
CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
4524+
CALL p1(@a);
4525+
PREPARE stmt FROM 'CALL p1(?)';
4526+
EXECUTE stmt USING @b;
4527+
DEALLOCATE PREPARE stmt;
4528+
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
4529+
SHOW CREATE TABLE t1;
4530+
DROP TABLE t1;
4531+
DROP PROCEDURE p1;

sql/item.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,6 +4247,7 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
42474247
}
42484248

42494249
null_value= FALSE;
4250+
unsigned_flag= arg->unsigned_flag;
42504251

42514252
switch (arg->result_type()) {
42524253
case STRING_RESULT:

0 commit comments

Comments
 (0)