1 -- source include/have_compress.inc
3 # Test for compress and uncompress functions:
5 # Note that this test gives error in the gzip library when running under
6 # valgrind, but these warnings can be ignored
8 select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
9 select length(@test_compress_string);
11 select uncompress(compress(@test_compress_string));
12 explain extended select uncompress(compress(@test_compress_string));
13 select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
14 explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
15 select uncompressed_length(compress(@test_compress_string));
16 select length(compress(@test_compress_string))<length(@test_compress_string);
18 create table t1 (a text, b char(255), c char(4)) engine=myisam;
19 insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
20 select uncompress(a) from t1;
21 select uncompress(b) from t1;
22 select concat('|',c,'|') from t1;
26 select uncompress("");
27 select uncompress(compress(""));
28 select uncompressed_length("");
34 create table t1 (a text);
35 insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
36 select length(a) from t1;
37 select length(uncompress(a)) from t1;
42 # Bug #5497: a problem with large strings
43 # note that when LOW_MEMORY is set the "test" below is meaningless
46 set @@global.max_allowed_packet=1048576*100;
47 --replace_result "''" XXX "'1'" XXX
49 # reconnect to make the new max packet size take effect
50 --connect (newconn, localhost, root,,)
51 eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
53 --source include/wait_until_disconnected.inc
55 set @@global.max_allowed_packet=default;
58 # Bug #18643: problem with null values
61 create table t1(a blob);
62 insert into t1 values(NULL), (compress('a'));
63 select uncompress(a), uncompressed_length(a) from t1;
67 # Bug #23254: problem with compress(NULL)
70 create table t1(a blob);
71 insert into t1 values ('0'), (NULL), ('0');
73 select compress(a), compress(a) from t1;
75 select compress(a) is null from t1;
78 --echo End of 4.1 tests
81 # Bug #18539: uncompress(d) is null: impossible?
83 create table t1 (a varchar(32) not null);
84 insert into t1 values ('foo');
85 explain select * from t1 where uncompress(a) is null;
86 select * from t1 where uncompress(a) is null;
87 explain select *, uncompress(a) from t1;
88 select *, uncompress(a) from t1;
89 select *, uncompress(a), uncompress(a) is null from t1;
93 # Bug #44796: valgrind: too many my_longlong10_to_str_8bit warnings after
97 CREATE TABLE t1 (c1 INT);
98 INSERT INTO t1 VALUES (1), (1111), (11111);
100 # Disable warnings to avoid dependency on max_allowed_packet value
102 SELECT UNCOMPRESS(c1), UNCOMPRESSED_LENGTH(c1) FROM t1;
105 # We do not need the results, just make sure there are no valgrind errors
107 EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s;
112 --echo End of 5.0 tests