mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
- Add unsigned flag to user_var_entry, used when 'type' is INT_RESULT - Propagate unsigned flag from the query executed by Item_single_row_subselect mysql-test/r/user_var.result: Update test results mysql-test/t/user_var.test: Add test case sql/item_func.cc: Add unsigned_flag to user_var_entry. Used when 'type' is INT_RESULT Pass unsigned_flag to 'update_hash' if type is INT_RESULT sql/item_func.h: Removed unused variable save_buff Add parameter unsigned_arg to 'update_hash' sql/item_subselect.cc: Propagate unsigned_flag to Item_singlerow_subselect from the items in the select to the cached items. sql/sql_class.h: Add unsigned_flag to user_var_entry. Used when 'type' is INT_RESULT
This commit is contained in:
@ -256,3 +256,39 @@ t1 CREATE TABLE `t1` (
|
||||
`@first_var` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
set @a=18446744071710965857;
|
||||
select @a;
|
||||
@a
|
||||
18446744071710965857
|
||||
CREATE TABLE `bigfailure` (
|
||||
`afield` BIGINT UNSIGNED NOT NULL
|
||||
);
|
||||
INSERT INTO `bigfailure` VALUES (18446744071710965857);
|
||||
SELECT * FROM bigfailure;
|
||||
afield
|
||||
18446744071710965857
|
||||
select * from (SELECT afield FROM bigfailure) as b;
|
||||
afield
|
||||
18446744071710965857
|
||||
select * from bigfailure where afield = (SELECT afield FROM bigfailure);
|
||||
afield
|
||||
18446744071710965857
|
||||
select * from bigfailure where afield = 18446744071710965857;
|
||||
afield
|
||||
18446744071710965857
|
||||
select * from bigfailure where afield = 18446744071710965856+1;
|
||||
afield
|
||||
18446744071710965857
|
||||
SET @a := (SELECT afield FROM bigfailure);
|
||||
SELECT @a;
|
||||
@a
|
||||
18446744071710965857
|
||||
SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
|
||||
SELECT @a;
|
||||
@a
|
||||
18446744071710965857
|
||||
SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
|
||||
SELECT @a;
|
||||
@a
|
||||
18446744071710965857
|
||||
drop table bigfailure;
|
||||
|
@ -171,3 +171,34 @@ set @first_var= cast(NULL as CHAR);
|
||||
create table t1 select @first_var;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
|
||||
#
|
||||
|
||||
# First part, set user var to large number and select it
|
||||
set @a=18446744071710965857;
|
||||
select @a;
|
||||
|
||||
# Second part, set user var from large number in table
|
||||
# then select it
|
||||
CREATE TABLE `bigfailure` (
|
||||
`afield` BIGINT UNSIGNED NOT NULL
|
||||
);
|
||||
INSERT INTO `bigfailure` VALUES (18446744071710965857);
|
||||
SELECT * FROM bigfailure;
|
||||
select * from (SELECT afield FROM bigfailure) as b;
|
||||
select * from bigfailure where afield = (SELECT afield FROM bigfailure);
|
||||
select * from bigfailure where afield = 18446744071710965857;
|
||||
# This is fixed in 5.0, to be uncommented there
|
||||
#select * from bigfailure where afield = '18446744071710965857';
|
||||
select * from bigfailure where afield = 18446744071710965856+1;
|
||||
|
||||
SET @a := (SELECT afield FROM bigfailure);
|
||||
SELECT @a;
|
||||
SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
|
||||
SELECT @a;
|
||||
SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
|
||||
SELECT @a;
|
||||
|
||||
drop table bigfailure;
|
||||
|
Reference in New Issue
Block a user