Skip to content

Commit f348f62

Browse files
author
monty@mishka.mysql.fi
committed
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
1 parent 8369e7d commit f348f62

26 files changed

+586
-184
lines changed

mysql-test/mysql-test-run.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ DO_GDB=""
235235
MANUAL_GDB=""
236236
DO_DDD=""
237237
DO_CLIENT_GDB=""
238+
DO_VALGRIND_MYSQL_TEST=""
238239
SLEEP_TIME_AFTER_RESTART=1
239240
SLEEP_TIME_FOR_DELETE=10
240241
SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
@@ -432,6 +433,9 @@ while test $# -gt 0; do
432433
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
433434
VALGRIND="$VALGRIND $TMP"
434435
;;
436+
--valgrind-mysqltest)
437+
DO_VALGRIND_MYSQL_TEST=1
438+
;;
435439
--skip-ndbcluster | --skip-ndb)
436440
USE_NDBCLUSTER=""
437441
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
@@ -666,7 +670,7 @@ else
666670
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
667671
fi
668672
else
669-
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
673+
MYSQL_TEST="$VALGRIND_MYSQLTEST $CLIENT_BINDIR/mysqltest"
670674
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
671675
fi
672676
fi
@@ -681,6 +685,10 @@ then
681685
SLAVE_MYSQLD=$MYSQLD
682686
fi
683687

688+
if [ x$DO_VALGRIND_MYSQL_TEST = x1 ] ; then
689+
MYSQL_TEST="$VALGRIND $MYSQL_TEST"
690+
fi
691+
684692
# If we should run all tests cases, we will use a local server for that
685693

686694
if [ -z "$1" ]

mysql-test/r/bigint.result

+185-7
Original file line numberDiff line numberDiff line change
@@ -46,33 +46,66 @@ a
4646
drop table t1;
4747
create table t1 ( a int not null default 1, big bigint );
4848
insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615);
49+
Warnings:
50+
Warning 1264 Out of range value adjusted for column 'big' at row 4
51+
select * from t1;
52+
a big
53+
1 -1
54+
1 12345678901234567
55+
1 9223372036854775807
56+
1 9223372036854775807
4957
select min(big),max(big),max(big)-1 from t1;
5058
min(big) max(big) max(big)-1
5159
-1 9223372036854775807 9223372036854775806
5260
select min(big),max(big),max(big)-1 from t1 group by a;
5361
min(big) max(big) max(big)-1
5462
-1 9223372036854775807 9223372036854775806
5563
alter table t1 modify big bigint unsigned not null;
64+
Warnings:
65+
Warning 1264 Out of range value adjusted for column 'big' at row 1
66+
select min(big),max(big),max(big)-1 from t1;
67+
min(big) max(big) max(big)-1
68+
0 9223372036854775807 9223372036854775806
69+
select min(big),max(big),max(big)-1 from t1 group by a;
70+
min(big) max(big) max(big)-1
71+
0 9223372036854775807 9223372036854775806
72+
insert into t1 (big) values (18446744073709551615);
73+
select * from t1;
74+
a big
75+
1 0
76+
1 12345678901234567
77+
1 9223372036854775807
78+
1 9223372036854775807
79+
1 18446744073709551615
5680
select min(big),max(big),max(big)-1 from t1;
5781
min(big) max(big) max(big)-1
58-
12345678901234567 18446744073709551615 18446744073709551614
82+
0 18446744073709551615 18446744073709551614
5983
select min(big),max(big),max(big)-1 from t1 group by a;
6084
min(big) max(big) max(big)-1
61-
12345678901234567 18446744073709551615 18446744073709551614
85+
0 18446744073709551615 18446744073709551614
6286
alter table t1 add key (big);
6387
select min(big),max(big),max(big)-1 from t1;
6488
min(big) max(big) max(big)-1
65-
12345678901234567 18446744073709551615 18446744073709551614
89+
0 18446744073709551615 18446744073709551614
6690
select min(big),max(big),max(big)-1 from t1 group by a;
6791
min(big) max(big) max(big)-1
68-
12345678901234567 18446744073709551615 18446744073709551614
92+
0 18446744073709551615 18446744073709551614
6993
alter table t1 modify big bigint not null;
94+
Warnings:
95+
Warning 1264 Out of range value adjusted for column 'big' at row 5
96+
select * from t1;
97+
a big
98+
1 0
99+
1 12345678901234567
100+
1 9223372036854775807
101+
1 9223372036854775807
102+
1 9223372036854775807
70103
select min(big),max(big),max(big)-1 from t1;
71104
min(big) max(big) max(big)-1
72-
-1 9223372036854775807 9223372036854775806
105+
0 9223372036854775807 9223372036854775806
73106
select min(big),max(big),max(big)-1 from t1 group by a;
74107
min(big) max(big) max(big)-1
75-
-1 9223372036854775807 9223372036854775806
108+
0 9223372036854775807 9223372036854775806
76109
drop table t1;
77110
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
78111
insert into t1 values (null,1);
@@ -89,7 +122,7 @@ insert into t1 values (10000000000000000000.0);
89122
insert into t1 values ('10000000000000000000');
90123
select * from t1;
91124
quantity
92-
-8446744073709551616
125+
10000000000000000000
93126
10000000000000000000
94127
10000000000000000000
95128
drop table t1;
@@ -154,3 +187,148 @@ select * from t1;
154187
a
155188
9223372036854775809
156189
drop table t1;
190+
DROP DATABASE IF EXISTS `scott`;
191+
Warnings:
192+
Note 1008 Can't drop database 'scott'; database doesn't exist
193+
create table t1 (a char(100), b varchar(100), c text, d blob);
194+
insert into t1 values(
195+
18446744073709551615,18446744073709551615,
196+
18446744073709551615, 18446744073709551615
197+
);
198+
insert into t1 values (-1 | 0,-1 | 0,-1 | 0 ,-1 | 0);
199+
select * from t1;
200+
a b c d
201+
18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
202+
18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
203+
drop table t1;
204+
create table t1 ( quantity decimal(2) unsigned);
205+
insert into t1 values (500), (-500), (~0), (-1);
206+
Warnings:
207+
Warning 1264 Out of range value adjusted for column 'quantity' at row 1
208+
Warning 1264 Out of range value adjusted for column 'quantity' at row 2
209+
Warning 1264 Out of range value adjusted for column 'quantity' at row 3
210+
Warning 1264 Out of range value adjusted for column 'quantity' at row 4
211+
select * from t1;
212+
quantity
213+
99
214+
0
215+
99
216+
0
217+
drop table t1;
218+
CREATE TABLE t1 (
219+
`col1` INT(1) NULL,
220+
`col2` INT(2) NULL,
221+
`col3` INT(3) NULL,
222+
`col4` INT(4) NULL,
223+
`col5` INT(5) NULL,
224+
`col6` INT(6) NULL,
225+
`col7` INT(7) NULL,
226+
`col8` INT(8) NULL,
227+
`col9` INT(9) NULL,
228+
`col10` BIGINT(10) NULL,
229+
`col11` BIGINT(11) NULL,
230+
`col12` BIGINT(12) NULL,
231+
`col13` BIGINT(13) NULL,
232+
`col14` BIGINT(14) NULL,
233+
`col15` BIGINT(15) NULL,
234+
`col16` BIGINT(16) NULL,
235+
`col17` BIGINT(17) NULL,
236+
`col18` BIGINT(18) NULL,
237+
`col19` DECIMAL(19, 0) NULL,
238+
`col20` DECIMAL(20, 0) NULL,
239+
`col21` DECIMAL(21, 0) NULL,
240+
`col22` DECIMAL(22, 0) NULL,
241+
`col23` DECIMAL(23, 0) NULL,
242+
`col24` DECIMAL(24, 0) NULL,
243+
`col25` DECIMAL(25, 0) NULL,
244+
`col26` DECIMAL(26, 0) NULL,
245+
`col27` DECIMAL(27, 0) NULL,
246+
`col28` DECIMAL(28, 0) NULL,
247+
`col29` DECIMAL(29, 0) NULL,
248+
`col30` DECIMAL(30, 0) NULL,
249+
`col31` DECIMAL(31, 0) NULL,
250+
`col32` DECIMAL(32, 0) NULL,
251+
`col33` DECIMAL(33, 0) NULL,
252+
`col34` DECIMAL(34, 0) NULL,
253+
`col35` DECIMAL(35, 0) NULL,
254+
`col36` DECIMAL(36, 0) NULL,
255+
`col37` DECIMAL(37, 0) NULL,
256+
`col38` DECIMAL(38, 0) NULL,
257+
`fix1` DECIMAL(38, 1) NULL,
258+
`fix2` DECIMAL(38, 2) NULL,
259+
`fix3` DECIMAL(38, 3) NULL,
260+
`fix4` DECIMAL(38, 4) NULL,
261+
`fix5` DECIMAL(38, 5) NULL,
262+
`fix6` DECIMAL(38, 6) NULL,
263+
`fix7` DECIMAL(38, 7) NULL,
264+
`fix8` DECIMAL(38, 8) NULL,
265+
`fix9` DECIMAL(38, 9) NULL,
266+
`fix10` DECIMAL(38, 10) NULL,
267+
`fix11` DECIMAL(38, 11) NULL,
268+
`fix12` DECIMAL(38, 12) NULL,
269+
`fix13` DECIMAL(38, 13) NULL,
270+
`fix14` DECIMAL(38, 14) NULL,
271+
`fix15` DECIMAL(38, 15) NULL,
272+
`fix16` DECIMAL(38, 16) NULL,
273+
`fix17` DECIMAL(38, 17) NULL,
274+
`fix18` DECIMAL(38, 18) NULL,
275+
`fix19` DECIMAL(38, 19) NULL,
276+
`fix20` DECIMAL(38, 20) NULL,
277+
`fix21` DECIMAL(38, 21) NULL,
278+
`fix22` DECIMAL(38, 22) NULL,
279+
`fix23` DECIMAL(38, 23) NULL,
280+
`fix24` DECIMAL(38, 24) NULL,
281+
`fix25` DECIMAL(38, 25) NULL,
282+
`fix26` DECIMAL(38, 26) NULL,
283+
`fix27` DECIMAL(38, 27) NULL,
284+
`fix28` DECIMAL(38, 28) NULL,
285+
`fix29` DECIMAL(38, 29) NULL,
286+
`fix30` DECIMAL(38, 30) NULL
287+
);
288+
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`)
289+
VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
290+
9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
291+
999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
292+
9999999999999999999, 99999999999999999999, 999999999999999999999,
293+
9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
294+
9999999999999999999999999, 99999999999999999999999999,
295+
999999999999999999999999999, 9999999999999999999999999999,
296+
99999999999999999999999999999, 999999999999999999999999999999,
297+
9999999999999999999999999999999, 99999999999999999999999999999999,
298+
999999999999999999999999999999999, 9999999999999999999999999999999999,
299+
99999999999999999999999999999999999, 999999999999999999999999999999999999,
300+
9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
301+
9999999999999999999999999999999999999.9,
302+
999999999999999999999999999999999999.99,
303+
99999999999999999999999999999999999.999,
304+
9999999999999999999999999999999999.9999,
305+
999999999999999999999999999999999.99999,
306+
99999999999999999999999999999999.999999,
307+
9999999999999999999999999999999.9999999,
308+
999999999999999999999999999999.99999999,
309+
99999999999999999999999999999.999999999,
310+
9999999999999999999999999999.9999999999,
311+
999999999999999999999999999.99999999999,
312+
99999999999999999999999999.999999999999,
313+
9999999999999999999999999.9999999999999,
314+
999999999999999999999999.99999999999999,
315+
99999999999999999999999.999999999999999,
316+
9999999999999999999999.9999999999999999,
317+
999999999999999999999.99999999999999999,
318+
99999999999999999999.999999999999999999,
319+
9999999999999999999.9999999999999999999,
320+
999999999999999999.99999999999999999999,
321+
99999999999999999.999999999999999999999,
322+
9999999999999999.9999999999999999999999,
323+
999999999999999.99999999999999999999999,
324+
99999999999999.999999999999999999999999,
325+
9999999999999.9999999999999999999999999,
326+
999999999999.99999999999999999999999999,
327+
99999999999.999999999999999999999999999,
328+
9999999999.9999999999999999999999999999,
329+
999999999.99999999999999999999999999999,
330+
99999999.999999999999999999999999999999);
331+
SELECT * FROM t1;
332+
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
333+
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
334+
DROP TABLE t1;

mysql-test/r/range.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ select count(*) from t1 where x = 18446744073709551601;
521521
count(*)
522522
1
523523
create table t2 (x bigint not null);
524-
insert into t2(x) values (0xfffffffffffffff0);
525-
insert into t2(x) values (0xfffffffffffffff1);
524+
insert into t2(x) values (cast(0xfffffffffffffff0+0 as signed));
525+
insert into t2(x) values (cast(0xfffffffffffffff1+0 as signed));
526526
select * from t2;
527527
x
528528
-16

mysql-test/r/strict.result

+6-4
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674
667667
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
668668
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
669669
INSERT INTO t1 (col1) VALUES(9223372036854775808);
670+
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
670671
INSERT INTO t1 (col2) VALUES(-1);
672+
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
671673
INSERT INTO t1 (col2) VALUES(18446744073709551616);
672674
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
673675
INSERT INTO t1 (col1) VALUES('-9223372036854775809');
@@ -706,6 +708,8 @@ Error 1365 Division by 0
706708
INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616);
707709
Warnings:
708710
Warning 1264 Out of range value adjusted for column 'col1' at row 1
711+
Warning 1264 Out of range value adjusted for column 'col2' at row 1
712+
Warning 1264 Out of range value adjusted for column 'col1' at row 2
709713
Warning 1264 Out of range value adjusted for column 'col2' at row 2
710714
INSERT IGNORE INTO t1 VALUES('-9223372036854775809','-1'),('9223372036854775808','18446744073709551616');
711715
Warnings:
@@ -729,12 +733,10 @@ col1 col2
729733
9223372036854775807 18446744073709551615
730734
-9223372036854774000 0
731735
9223372036854775700 1844674407370954000
732-
-9223372036854775808 NULL
733-
NULL 18446744073709551615
734736
2 NULL
735737
NULL NULL
736-
-9223372036854775808 18446744073709551615
737-
-9223372036854775808 18446744073709551615
738+
-9223372036854775808 0
739+
9223372036854775807 18446744073709551615
738740
-9223372036854775808 0
739741
9223372036854775807 18446744073709551615
740742
-9223372036854775808 0

mysql-test/r/type_ranges.result

+4-2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Warning 1264 Out of range value adjusted for column 'utiny' at row 1
9595
Warning 1264 Out of range value adjusted for column 'ushort' at row 1
9696
Warning 1264 Out of range value adjusted for column 'umedium' at row 1
9797
Warning 1264 Out of range value adjusted for column 'ulong' at row 1
98+
Warning 1264 Out of range value adjusted for column 'ulonglong' at row 1
9899
Warning 1265 Data truncated for column 'options' at row 1
99100
Warning 1265 Data truncated for column 'flags' at row 1
100101
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
108109
Warning 1264 Out of range value adjusted for column 'ushort' at row 1
109110
Warning 1264 Out of range value adjusted for column 'umedium' at row 1
110111
Warning 1264 Out of range value adjusted for column 'ulong' at row 1
112+
Warning 1264 Out of range value adjusted for column 'ulonglong' at row 1
111113
Warning 1265 Data truncated for column 'options' at row 1
112114
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);
113115
Warnings:
@@ -125,8 +127,8 @@ auto string tiny short medium long_int longlong real_float real_double utiny ush
125127
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
126128
11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2
127129
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
128-
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
129-
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
130+
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
131+
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
130132
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
131133
16 hello 1 1 0 0 0 0.0 NULL 0 00000 0 0 0 0 NULL NULL NULL NULL NULL
132134
ALTER TABLE t1

0 commit comments

Comments
 (0)