Skip to content

Commit

Permalink
MDEV-14435 Different UNSIGNED flag of out user variable for YEAR para…
Browse files Browse the repository at this point in the history
…meter for direct vs prepared CALL
  • Loading branch information
Alexander Barkov committed Nov 18, 2017
1 parent 4c2c5ec commit a20c121
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
49 changes: 47 additions & 2 deletions mysql-test/r/ps.result
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
`c1` bigint(20) DEFAULT NULL
`c1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = b'10100100101';
@a @a = b'10100100101'
Expand Down Expand Up @@ -3478,7 +3478,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
`c1` bigint(20) DEFAULT NULL
`c1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 2010;
@a @a = 2010
Expand Down Expand Up @@ -5029,3 +5029,48 @@ COERCIBILITY(?)
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
COERCIBILITY(?)
5
#
# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
#
CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
CALL p1(@a);
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING @b;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL,
`b` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
CALL p1(@a);
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING @b;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL,
`b` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
CALL p1(@a);
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING @b;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL,
`b` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
34 changes: 34 additions & 0 deletions mysql-test/t/ps.test
Original file line number Diff line number Diff line change
Expand Up @@ -4495,3 +4495,37 @@ EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';

--echo #
--echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
--echo #

CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
CALL p1(@a);
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING @b;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP PROCEDURE p1;

CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
CALL p1(@a);
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING @b;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP PROCEDURE p1;

CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
CALL p1(@a);
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING @b;
DEALLOCATE PREPARE stmt;
CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP PROCEDURE p1;
1 change: 1 addition & 0 deletions sql/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4247,6 +4247,7 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
}

null_value= FALSE;
unsigned_flag= arg->unsigned_flag;

switch (arg->result_type()) {
case STRING_RESULT:
Expand Down

0 comments on commit a20c121

Please sign in to comment.