Commit f8f1c016 authored by unknown's avatar unknown
Browse files

Added option --valgrind-mysqltest to mysql-test-run

Added flag to Field::store(longlong) to specify if value is unsigned.
This fixes bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0)
Fixed warning from valgrind in CREATE ... SELECT
Fixed double free of mysql.options if reconnect failed


mysql-test/mysql-test-run.sh:
  Added option --valgrind-mysqltest to allow one to run mysqltest with valgrind
mysql-test/r/bigint.result:
  Update results after fix for Field::store(longlong)
mysql-test/r/range.result:
  Update results after fix for Field::store(longlong)
mysql-test/r/strict.result:
  Update results after fix for Field::store(longlong)
  (This fixes some wrong results when storing things into bigint columns)
mysql-test/r/type_ranges.result:
  Update results after fix for Field::store(longlong)
mysql-test/t/bigint.test:
  Added testing for #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0)
mysql-test/t/innodb.test:
  Removed comments affected by this bug fix
mysql-test/t/mysqldump.test:
  Fixed result to not depend on existing config files
mysql-test/t/range.test:
  0xff numbers are now unsigned
mysql-test/t/strict.test:
  Added errors for things that previously (wrongly) succeeded
sql-common/client.c:
  Fixed double free of mysql.options if reconnect failed
sql/field.cc:
  Added flag to Field::store(longlong) to specify if value is unsigned
sql/field.h:
  Added flag to Field::store(longlong) to specify if value is unsigned
sql/field_conv.cc:
  Fixed calls to Field::store(longlong,flag)
sql/ha_ndbcluster.cc:
  Fixed calls to Field::store(longlong,flag)
sql/handler.cc:
  Fixed calls to Field::store(longlong,flag)
sql/item.cc:
  Fixed calls to Field::store(longlong,flag)
sql/item_sum.cc:
  Fixed calls to Field::store(longlong,flag)
sql/sp.cc:
  Fixed calls to Field::store(longlong,flag)
sql/sql_acl.cc:
  Fixed calls to Field::store(longlong,flag)
sql/sql_help.cc:
  Fixed calls to Field::store(longlong,flag)
sql/sql_show.cc:
  Fixed calls to Field::store(longlong,flag)
sql/sql_table.cc:
  Fixed varning from valgrind
sql/sql_udf.cc:
  Fixed calls to Field::store(longlong,flag)
sql/tztime.cc:
  Fixed calls to Field::store(longlong,flag)
sql/unireg.cc:
  Fixed calls to Field::store(longlong,flag)
parent b50eb4cd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@ DO_GDB=""
MANUAL_GDB=""
DO_DDD=""
DO_CLIENT_GDB=""
DO_VALGRIND_MYSQL_TEST=""
SLEEP_TIME_AFTER_RESTART=1
SLEEP_TIME_FOR_DELETE=10
SLEEP_TIME_FOR_FIRST_MASTER=400		# Enough time to create innodb tables
@@ -432,6 +433,9 @@ while test $# -gt 0; do
      TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
      VALGRIND="$VALGRIND $TMP"
      ;;
    --valgrind-mysqltest)
      DO_VALGRIND_MYSQL_TEST=1
      ;;
    --skip-ndbcluster | --skip-ndb)
      USE_NDBCLUSTER=""
      EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
@@ -666,7 +670,7 @@ else
     MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
   fi
 else
   MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
   MYSQL_TEST="$VALGRIND_MYSQLTEST $CLIENT_BINDIR/mysqltest"
   MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
 fi
fi
@@ -681,6 +685,10 @@ then
SLAVE_MYSQLD=$MYSQLD
fi

if [ x$DO_VALGRIND_MYSQL_TEST = x1 ] ; then
  MYSQL_TEST="$VALGRIND $MYSQL_TEST"
fi

# If we should run all tests cases, we will use a local server for that

if [ -z "$1" ]
+185 −7
Original line number Diff line number Diff line
@@ -46,6 +46,14 @@ a
drop table t1;
create table t1 ( a int not null default 1, big bigint );
insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615);
Warnings:
Warning	1264	Out of range value adjusted for column 'big' at row 4
select * from t1;
a	big
1	-1
1	12345678901234567
1	9223372036854775807
1	9223372036854775807
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-1	9223372036854775807	9223372036854775806
@@ -53,26 +61,51 @@ select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-1	9223372036854775807	9223372036854775806
alter table t1 modify big bigint unsigned not null;
Warnings:
Warning	1264	Out of range value adjusted for column 'big' at row 1
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
0	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
0	9223372036854775807	9223372036854775806
insert into t1 (big) values (18446744073709551615);
select * from t1;
a	big
1	0
1	12345678901234567
1	9223372036854775807
1	9223372036854775807
1	18446744073709551615
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
12345678901234567	18446744073709551615	18446744073709551614
0	18446744073709551615	18446744073709551614
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
12345678901234567	18446744073709551615	18446744073709551614
0	18446744073709551615	18446744073709551614
alter table t1 add key (big);
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
12345678901234567	18446744073709551615	18446744073709551614
0	18446744073709551615	18446744073709551614
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
12345678901234567	18446744073709551615	18446744073709551614
0	18446744073709551615	18446744073709551614
alter table t1 modify big bigint not null;
Warnings:
Warning	1264	Out of range value adjusted for column 'big' at row 5
select * from t1;
a	big
1	0
1	12345678901234567
1	9223372036854775807
1	9223372036854775807
1	9223372036854775807
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-1	9223372036854775807	9223372036854775806
0	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-1	9223372036854775807	9223372036854775806
0	9223372036854775807	9223372036854775806
drop table t1;
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
insert into t1 values (null,1);
@@ -89,7 +122,7 @@ insert into t1 values (10000000000000000000.0);
insert into t1 values ('10000000000000000000');
select * from t1;
quantity
-8446744073709551616
10000000000000000000
10000000000000000000
10000000000000000000
drop table t1;
@@ -154,3 +187,148 @@ select * from t1;
a
9223372036854775809
drop table t1;
DROP DATABASE IF EXISTS `scott`;
Warnings:
Note	1008	Can't drop database 'scott'; database doesn't exist
create table t1 (a char(100), b varchar(100), c text, d blob);
insert into t1 values(
18446744073709551615,18446744073709551615,
18446744073709551615, 18446744073709551615
);
insert into t1 values (-1 | 0,-1 | 0,-1 | 0 ,-1 | 0);
select * from t1;
a	b	c	d
18446744073709551615	18446744073709551615	18446744073709551615	18446744073709551615
18446744073709551615	18446744073709551615	18446744073709551615	18446744073709551615
drop table t1;
create table t1 ( quantity decimal(2) unsigned);
insert into t1 values (500), (-500), (~0), (-1);
Warnings:
Warning	1264	Out of range value adjusted for column 'quantity' at row 1
Warning	1264	Out of range value adjusted for column 'quantity' at row 2
Warning	1264	Out of range value adjusted for column 'quantity' at row 3
Warning	1264	Out of range value adjusted for column 'quantity' at row 4
select * from t1;
quantity
99
0
99
0
drop table t1;
CREATE TABLE t1 (
`col1` INT(1) NULL,
`col2` INT(2) NULL,
`col3` INT(3) NULL,
`col4` INT(4) NULL,
`col5` INT(5) NULL,
`col6` INT(6) NULL,
`col7` INT(7) NULL,
`col8` INT(8) NULL,
`col9` INT(9) NULL,
`col10` BIGINT(10) NULL,
`col11` BIGINT(11) NULL,
`col12` BIGINT(12) NULL,
`col13` BIGINT(13) NULL,
`col14` BIGINT(14) NULL,
`col15` BIGINT(15) NULL,
`col16` BIGINT(16) NULL,
`col17` BIGINT(17) NULL,
`col18` BIGINT(18) NULL,
`col19` DECIMAL(19, 0) NULL,
`col20` DECIMAL(20, 0) NULL,
`col21` DECIMAL(21, 0) NULL,
`col22` DECIMAL(22, 0) NULL,
`col23` DECIMAL(23, 0) NULL,
`col24` DECIMAL(24, 0) NULL,
`col25` DECIMAL(25, 0) NULL,
`col26` DECIMAL(26, 0) NULL,
`col27` DECIMAL(27, 0) NULL,
`col28` DECIMAL(28, 0) NULL,
`col29` DECIMAL(29, 0) NULL,
`col30` DECIMAL(30, 0) NULL,
`col31` DECIMAL(31, 0) NULL,
`col32` DECIMAL(32, 0) NULL,
`col33` DECIMAL(33, 0) NULL,
`col34` DECIMAL(34, 0) NULL,
`col35` DECIMAL(35, 0) NULL,
`col36` DECIMAL(36, 0) NULL,
`col37` DECIMAL(37, 0) NULL,
`col38` DECIMAL(38, 0) NULL,
`fix1` DECIMAL(38, 1) NULL,
`fix2` DECIMAL(38, 2) NULL,
`fix3` DECIMAL(38, 3) NULL,
`fix4` DECIMAL(38, 4) NULL,
`fix5` DECIMAL(38, 5) NULL,
`fix6` DECIMAL(38, 6) NULL,
`fix7` DECIMAL(38, 7) NULL,
`fix8` DECIMAL(38, 8) NULL,
`fix9` DECIMAL(38, 9) NULL,
`fix10` DECIMAL(38, 10) NULL,
`fix11` DECIMAL(38, 11) NULL,
`fix12` DECIMAL(38, 12) NULL,
`fix13` DECIMAL(38, 13) NULL,
`fix14` DECIMAL(38, 14) NULL,
`fix15` DECIMAL(38, 15) NULL,
`fix16` DECIMAL(38, 16) NULL,
`fix17` DECIMAL(38, 17) NULL,
`fix18` DECIMAL(38, 18) NULL,
`fix19` DECIMAL(38, 19) NULL,
`fix20` DECIMAL(38, 20) NULL,
`fix21` DECIMAL(38, 21) NULL,
`fix22` DECIMAL(38, 22) NULL,
`fix23` DECIMAL(38, 23) NULL,
`fix24` DECIMAL(38, 24) NULL,
`fix25` DECIMAL(38, 25) NULL,
`fix26` DECIMAL(38, 26) NULL,
`fix27` DECIMAL(38, 27) NULL,
`fix28` DECIMAL(38, 28) NULL,
`fix29` DECIMAL(38, 29) NULL,
`fix30` DECIMAL(38, 30) NULL
);
INSERT INTO t1(`col1`, `col2`, `col3`, `col4`, `col5`, `col6`, `col7`, `col8`, `col9`, `col10`, `col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`, `col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`, `col27`, `col28`, `col29`, `col30`, `col31`, `col32`, `col33`, `col34`, `col35`, `col36`, `col37`, `col38`, `fix1`, `fix2`, `fix3`, `fix4`, `fix5`, `fix6`, `fix7`, `fix8`, `fix9`, `fix10`, `fix11`, `fix12`, `fix13`, `fix14`, `fix15`, `fix16`, `fix17`, `fix18`, `fix19`, `fix20`, `fix21`, `fix22`, `fix23`, `fix24`, `fix25`, `fix26`, `fix27`, `fix28`, `fix29`, `fix30`)
VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
9999999999999999999, 99999999999999999999, 999999999999999999999,
9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
9999999999999999999999999, 99999999999999999999999999,
999999999999999999999999999, 9999999999999999999999999999,
99999999999999999999999999999, 999999999999999999999999999999,
9999999999999999999999999999999, 99999999999999999999999999999999,
999999999999999999999999999999999, 9999999999999999999999999999999999,
99999999999999999999999999999999999, 999999999999999999999999999999999999,
9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
9999999999999999999999999999999999999.9,
999999999999999999999999999999999999.99,
99999999999999999999999999999999999.999,
9999999999999999999999999999999999.9999,
999999999999999999999999999999999.99999,
99999999999999999999999999999999.999999,
9999999999999999999999999999999.9999999,
999999999999999999999999999999.99999999,
99999999999999999999999999999.999999999,
9999999999999999999999999999.9999999999,
999999999999999999999999999.99999999999,
99999999999999999999999999.999999999999,
9999999999999999999999999.9999999999999,
999999999999999999999999.99999999999999,
99999999999999999999999.999999999999999,
9999999999999999999999.9999999999999999,
999999999999999999999.99999999999999999,
99999999999999999999.999999999999999999,
9999999999999999999.9999999999999999999,
999999999999999999.99999999999999999999,
99999999999999999.999999999999999999999,
9999999999999999.9999999999999999999999,
999999999999999.99999999999999999999999,
99999999999999.999999999999999999999999,
9999999999999.9999999999999999999999999,
999999999999.99999999999999999999999999,
99999999999.999999999999999999999999999,
9999999999.9999999999999999999999999999,
999999999.99999999999999999999999999999,
99999999.999999999999999999999999999999);
SELECT * FROM t1;
col1	col2	col3	col4	col5	col6	col7	col8	col9	col10	col11	col12	col13	col14	col15	col16	col17	col18	col19	col20	col21	col22	col23	col24	col25	col26	col27	col28	col29	col30	col31	col32	col33	col34	col35	col36	col37	col38	fix1	fix2	fix3	fix4	fix5	fix6	fix7	fix8	fix9	fix10	fix11	fix12	fix13	fix14	fix15	fix16	fix17	fix18	fix19	fix20	fix21	fix22	fix23	fix24	fix25	fix26	fix27	fix28	fix29	fix30
9	99	999	9999	99999	999999	9999999	99999999	999999999	9999999999	99999999999	999999999999	9999999999999	99999999999999	999999999999999	9999999999999999	99999999999999999	999999999999999999	9999999999999999999	99999999999999999999	999999999999999999999	9999999999999999999999	99999999999999999999999	999999999999999999999999	9999999999999999999999999	99999999999999999999999999	999999999999999999999999999	9999999999999999999999999999	99999999999999999999999999999	999999999999999999999999999999	9999999999999999999999999999999	99999999999999999999999999999999	999999999999999999999999999999999	9999999999999999999999999999999999	99999999999999999999999999999999999	999999999999999999999999999999999999	9999999999999999999999999999999999999	99999999999999999999999999999999999999	9999999999999999999999999999999999999.9	999999999999999999999999999999999999.99	99999999999999999999999999999999999.999	9999999999999999999999999999999999.9999	999999999999999999999999999999999.99999	99999999999999999999999999999999.999999	9999999999999999999999999999999.9999999	999999999999999999999999999999.99999999	99999999999999999999999999999.999999999	9999999999999999999999999999.9999999999	999999999999999999999999999.99999999999	99999999999999999999999999.999999999999	9999999999999999999999999.9999999999999	999999999999999999999999.99999999999999	99999999999999999999999.999999999999999	9999999999999999999999.9999999999999999	999999999999999999999.99999999999999999	99999999999999999999.999999999999999999	9999999999999999999.9999999999999999999	999999999999999999.99999999999999999999	99999999999999999.999999999999999999999	9999999999999999.9999999999999999999999	999999999999999.99999999999999999999999	99999999999999.999999999999999999999999	9999999999999.9999999999999999999999999	999999999999.99999999999999999999999999	99999999999.999999999999999999999999999	9999999999.9999999999999999999999999999	999999999.99999999999999999999999999999	99999999.999999999999999999999999999999
DROP TABLE t1;
+2 −2
Original line number Diff line number Diff line
@@ -521,8 +521,8 @@ select count(*) from t1 where x = 18446744073709551601;
count(*)
1
create table t2 (x bigint not null);
insert into t2(x) values (0xfffffffffffffff0);
insert into t2(x) values (0xfffffffffffffff1);
insert into t2(x) values (cast(0xfffffffffffffff0+0 as signed));
insert into t2(x) values (cast(0xfffffffffffffff1+0 as signed));
select * from t2;
x
-16
+6 −4
Original line number Diff line number Diff line
@@ -667,7 +667,9 @@ INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(9223372036854775808);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(-1);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(18446744073709551616);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES('-9223372036854775809');
@@ -706,6 +708,8 @@ Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616);
Warnings:
Warning	1264	Out of range value adjusted for column 'col1' at row 1
Warning	1264	Out of range value adjusted for column 'col2' at row 1
Warning	1264	Out of range value adjusted for column 'col1' at row 2
Warning	1264	Out of range value adjusted for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES('-9223372036854775809','-1'),('9223372036854775808','18446744073709551616');
Warnings:
@@ -729,12 +733,10 @@ col1 col2
9223372036854775807	18446744073709551615
-9223372036854774000	0
9223372036854775700	1844674407370954000
-9223372036854775808	NULL
NULL	18446744073709551615
2	NULL
NULL	NULL
-9223372036854775808	18446744073709551615
-9223372036854775808	18446744073709551615
-9223372036854775808	0
9223372036854775807	18446744073709551615
-9223372036854775808	0
9223372036854775807	18446744073709551615
-9223372036854775808	0
+4 −2
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ Warning 1264 Out of range value adjusted for column 'utiny' at row 1
Warning	1264	Out of range value adjusted for column 'ushort' at row 1
Warning	1264	Out of range value adjusted for column 'umedium' at row 1
Warning	1264	Out of range value adjusted for column 'ulong' at row 1
Warning	1264	Out of range value adjusted for column 'ulonglong' at row 1
Warning	1265	Data truncated for column 'options' at row 1
Warning	1265	Data truncated for column 'flags' at row 1
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
@@ -108,6 +109,7 @@ Warning 1264 Out of range value adjusted for column 'utiny' at row 1
Warning	1264	Out of range value adjusted for column 'ushort' at row 1
Warning	1264	Out of range value adjusted for column 'umedium' at row 1
Warning	1264	Out of range value adjusted for column 'ulong' at row 1
Warning	1264	Out of range value adjusted for column 'ulonglong' at row 1
Warning	1265	Data truncated for column 'options' at row 1
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
Warnings:
@@ -125,8 +127,8 @@ auto string tiny short medium long_int longlong real_float real_double utiny ush
10	1	1	1	1	1	1	1.0	1.0000	1	00001	1	1	1	0	0000-00-00	00:00:00	0000-00-00 00:00:00	1	1	1	1
11	2	2	2	2	2	2	2.0	2.0000	2	00002	2	2	2	0	NULL	NULL	NULL	NULL	NULL	2	2
12	0.33333333	3	3	3	3	3	3.0	3.0000	3	00003	3	3	3	0	1997-03-03	10:10:10	1997-03-03 10:10:10				3
13	-1	-1	-1	-1	-1	-1	-1.0	-1.0000	0	00000	0	0	18446744073709551615	0	1997-08-07	08:07:06	1997-04-03 09:08:07	-1	-1	-1	-1
14	-429496729	-128	-32768	-8388608	-2147483648	-4294967295	-4294967296.0	-4294967295.0000	0	00000	0	0	18446744069414584321	0	0000-00-00	00:00:00	0000-00-00 00:00:00	-4294967295	-4294967295	-4294967295	-4294967295
13	-1	-1	-1	-1	-1	-1	-1.0	-1.0000	0	00000	0	0	0	0	1997-08-07	08:07:06	1997-04-03 09:08:07	-1	-1	-1	-1
14	-429496729	-128	-32768	-8388608	-2147483648	-4294967295	-4294967296.0	-4294967295.0000	0	00000	0	0	0	0	0000-00-00	00:00:00	0000-00-00 00:00:00	-4294967295	-4294967295	-4294967295	-4294967295
15	4294967295	127	32767	8388607	2147483647	4294967295	4294967296.0	4294967295.0000	255	65535	16777215	4294967295	4294967295	0	0000-00-00	00:00:00	0000-00-00 00:00:00	4294967295	4294967295	4294967295	4294967295
16	hello	1	1	0	0	0	0.0	NULL	0	00000	0	0	0	0	NULL	NULL	NULL	NULL	NULL		
ALTER TABLE t1
Loading