func_compress.result 4.8 KB
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
select length(@test_compress_string);
length(@test_compress_string)
117
select uncompress(compress(@test_compress_string));
uncompress(compress(@test_compress_string))
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
10
explain extended select uncompress(compress(@test_compress_string));
11 12
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
13
Warnings:
14
Note	1003	select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
unknown's avatar
unknown committed
15 16 17
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
18
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
19 20
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
21
Warnings:
22
Note	1003	select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
unknown's avatar
unknown committed
23 24 25 26 27 28
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
select length(compress(@test_compress_string))<length(@test_compress_string);
length(compress(@test_compress_string))<length(@test_compress_string)
1
unknown's avatar
unknown committed
29
create table t1 (a text, b char(255), c char(4)) engine=myisam;
unknown's avatar
unknown committed
30 31 32 33 34 35 36 37 38 39 40
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
select uncompress(a) from t1;
uncompress(a)
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
select uncompress(b) from t1;
uncompress(b)
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
select concat('|',c,'|') from t1;
concat('|',c,'|')
|d|
drop table t1;
41 42 43 44 45 46 47 48 49 50 51 52
select compress("");
compress("")

select uncompress("");
uncompress("")

select uncompress(compress(""));
uncompress(compress(""))

select uncompressed_length("");
uncompressed_length("")
0
53 54 55 56
create table t1 (a text);
insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
select length(a) from t1;
length(a)
57
NULL
58 59 60 61 62
12
76
50000
select length(uncompress(a)) from t1;
length(uncompress(a))
63
NULL
64 65 66 67
NULL
50000
NULL
Warnings:
Marc Alff's avatar
Marc Alff committed
68 69
Warning	1259	ZLIB: Input data corrupted
Warning	1256	Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
70
drop table t1;
71
set @@global.max_allowed_packet=1048576*100;
72 73
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
74
0
75
set @@global.max_allowed_packet=default;
76 77 78 79 80 81 82
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));
select uncompress(a), uncompressed_length(a) from t1;
uncompress(a)	uncompressed_length(a)
NULL	NULL
a	1
drop table t1;
83 84 85 86 87 88 89 90 91 92
create table t1(a blob);
insert into t1 values ('0'), (NULL), ('0');
select compress(a), compress(a) from t1;
select compress(a) is null from t1;
compress(a) is null
0
1
0
drop table t1;
End of 4.1 tests
93 94 95 96 97 98
create table t1 (a varchar(32) not null);
insert into t1 values ('foo');
explain select * from t1 where uncompress(a) is null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
Warnings:
Marc Alff's avatar
Marc Alff committed
99
Warning	1259	ZLIB: Input data corrupted
100 101 102 103
select * from t1 where uncompress(a) is null;
a
foo
Warnings:
Marc Alff's avatar
Marc Alff committed
104
Warning	1259	ZLIB: Input data corrupted
105 106 107 108 109 110 111
explain select *, uncompress(a) from t1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
select *, uncompress(a) from t1;
a	uncompress(a)
foo	NULL
Warnings:
Marc Alff's avatar
Marc Alff committed
112
Warning	1259	ZLIB: Input data corrupted
113 114 115 116
select *, uncompress(a), uncompress(a) is null from t1;
a	uncompress(a)	uncompress(a) is null
foo	NULL	1
Warnings:
Marc Alff's avatar
Marc Alff committed
117 118
Warning	1259	ZLIB: Input data corrupted
Warning	1259	ZLIB: Input data corrupted
119
drop table t1;
120 121 122 123 124 125 126 127 128
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1), (1111), (11111);
SELECT UNCOMPRESS(c1), UNCOMPRESSED_LENGTH(c1) FROM t1;
UNCOMPRESS(c1)	UNCOMPRESSED_LENGTH(c1)
NULL	NULL
NULL	NULL
NULL	825307441
EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s;
DROP TABLE t1;
129
End of 5.0 tests