Commit f224238f authored by unknown's avatar unknown

Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime

into  weblab.(none):/home/marcsql/TREE/mysql-5.1-22684


sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
parents 9d4d6ffe 2975d65c
...@@ -813,11 +813,231 @@ drop table t7; ...@@ -813,11 +813,231 @@ drop table t7;
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2); select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
1abcd;2abcd 3abcd;4abcd 1abcd;2abcd 3abcd;4abcd
explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty"); explain extended select md5('hello');
id select_type table type possible_keys key key_len ref rows filtered Extra 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 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")` Note 1003 select md5(_latin1'hello') AS `md5('hello')`
explain extended select sha('abc');
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
Warnings:
Note 1003 select sha(_latin1'abc') AS `sha('abc')`
explain extended select sha1('abc');
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
Warnings:
Note 1003 select sha(_latin1'abc') AS `sha1('abc')`
explain extended select soundex('');
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
Warnings:
Note 1003 select soundex(_latin1'') AS `soundex('')`
explain extended select 'mood' sounds like 'mud';
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
Warnings:
Note 1003 select (soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`
explain extended select aes_decrypt(aes_encrypt('abc','1'),'1');
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
Warnings:
Note 1003 select aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`
explain extended select concat('*',space(5),'*');
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
Warnings:
Note 1003 select concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`
explain extended select reverse('abc');
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
Warnings:
Note 1003 select reverse(_latin1'abc') AS `reverse('abc')`
explain extended select rpad('a',4,'1');
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
Warnings:
Note 1003 select rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`
explain extended select lpad('a',4,'1');
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
Warnings:
Note 1003 select lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`
explain extended select concat_ws(',','',NULL,'a');
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
Warnings:
Note 1003 select concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`
explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c');
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
Warnings:
Note 1003 select make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a', _latin2'b', _latin2'c')`
explain extended select elt(2,1);
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
Warnings:
Note 1003 select elt(2,1) AS `elt(2,1)`
explain extended select locate("a","b",2);
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
Warnings:
Note 1003 select locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`
explain extended select format(130,10);
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
Warnings:
Note 1003 select format(130,10) AS `format(130,10)`
explain extended select char(0);
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
Warnings:
Note 1003 select char(0) AS `char(0)`
explain extended select conv(130,16,10);
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
Warnings:
Note 1003 select conv(130,16,10) AS `conv(130,16,10)`
explain extended select hex(130);
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
Warnings:
Note 1003 select hex(130) AS `hex(130)`
explain extended select binary 'HE';
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
Warnings:
Note 1003 select cast(_latin1'HE' as char charset binary) AS `binary 'HE'`
explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' ');
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
Warnings:
Note 1003 select export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y', _latin2'n', _latin2' ')`
explain extended select FIELD('b' COLLATE latin1_bin,'A','B');
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
Warnings:
Note 1003 select field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`
explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d');
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
Warnings:
Note 1003 select find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B', _latin1'a,b,c,d')`
explain extended select collation(conv(130,16,10));
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
Warnings:
Note 1003 select collation(conv(130,16,10)) AS `collation(conv(130,16,10))`
explain extended select coercibility(conv(130,16,10));
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
Warnings:
Note 1003 select coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`
explain extended select length('\n\t\r\b\0\_\%\\');
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
Warnings:
Note 1003 select length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`
explain extended select bit_length('\n\t\r\b\0\_\%\\');
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
Warnings:
Note 1003 select bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`
explain extended select bit_length('\n\t\r\b\0\_\%\\');
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
Warnings:
Note 1003 select bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`
explain extended select concat('monty',' was here ','again');
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
Warnings:
Note 1003 select concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`
explain extended select length('hello');
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
Warnings:
Note 1003 select length(_latin1'hello') AS `length('hello')`
explain extended select char(ascii('h'));
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
Warnings:
Note 1003 select char(ascii(_latin1'h')) AS `char(ascii('h'))`
explain extended select ord('h');
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
Warnings:
Note 1003 select ord(_latin1'h') AS `ord('h')`
explain extended select quote(1/0);
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
Warnings:
Note 1003 select quote((1 / 0)) AS `quote(1/0)`
explain extended select crc32("123");
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
Warnings:
Note 1003 select crc32(_latin1'123') AS `crc32("123")`
explain extended select replace('aaaa','a','b');
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
Warnings:
Note 1003 select replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`
explain extended select insert('txs',2,1,'hi');
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
Warnings:
Note 1003 select insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`
explain extended select left(_latin2'a',1);
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
Warnings:
Note 1003 select left(_latin2'a',1) AS `left(_latin2'a',1)`
explain extended select right(_latin2'a',1);
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
Warnings:
Note 1003 select right(_latin2'a',1) AS `right(_latin2'a',1)`
explain extended select lcase(_latin2'a');
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
Warnings:
Note 1003 select lcase(_latin2'a') AS `lcase(_latin2'a')`
explain extended select ucase(_latin2'a');
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
Warnings:
Note 1003 select ucase(_latin2'a') AS `ucase(_latin2'a')`
explain extended select SUBSTR('abcdefg',3,2);
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
Warnings:
Note 1003 select substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`
explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2);
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
Warnings:
Note 1003 select substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`
explain extended select trim(_latin2' a ');
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
Warnings:
Note 1003 select trim(_latin2' a ') AS `trim(_latin2' a ')`
explain extended select ltrim(_latin2' a ');
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
Warnings:
Note 1003 select ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`
explain extended select rtrim(_latin2' a ');
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
Warnings:
Note 1003 select rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`
explain extended select decode(encode(repeat("a",100000),"monty"),"monty");
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
Warnings:
Note 1003 select decode(encode(repeat(_latin1'a',100000),_latin1'monty'),_latin1'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#"); SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#") lpad(12345, 5, "#")
12345 12345
...@@ -1148,772 +1368,117 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1148,772 +1368,117 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5)) Note 1003 select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
DROP TABLE t1,t2; DROP TABLE t1,t2;
select locate('he','hello',-2); select encode(NULL, NULL);
locate('he','hello',-2) encode(NULL, NULL)
0
select locate('lo','hello',-4294967295);
locate('lo','hello',-4294967295)
0
select locate('lo','hello',4294967295);
locate('lo','hello',4294967295)
0
select locate('lo','hello',-4294967296);
locate('lo','hello',-4294967296)
0
select locate('lo','hello',4294967296);
locate('lo','hello',4294967296)
0
select locate('lo','hello',-4294967297);
locate('lo','hello',-4294967297)
0
select locate('lo','hello',4294967297);
locate('lo','hello',4294967297)
0
select locate('lo','hello',-18446744073709551615);
locate('lo','hello',-18446744073709551615)
0
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select locate('lo','hello',18446744073709551615);
locate('lo','hello',18446744073709551615)
0
select locate('lo','hello',-18446744073709551616);
locate('lo','hello',-18446744073709551616)
0
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select locate('lo','hello',18446744073709551616);
locate('lo','hello',18446744073709551616)
0
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select locate('lo','hello',-18446744073709551617);
locate('lo','hello',-18446744073709551617)
0
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select locate('lo','hello',18446744073709551617);
locate('lo','hello',18446744073709551617)
0
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select left('hello', 10);
left('hello', 10)
hello
select left('hello', 0);
left('hello', 0)
select left('hello', -1);
left('hello', -1)
select left('hello', -4294967295);
left('hello', -4294967295)
select left('hello', 4294967295);
left('hello', 4294967295)
hello
select left('hello', -4294967296);
left('hello', -4294967296)
select left('hello', 4294967296);
left('hello', 4294967296)
hello
select left('hello', -4294967297);
left('hello', -4294967297)
select left('hello', 4294967297);
left('hello', 4294967297)
hello
select left('hello', -18446744073709551615);
left('hello', -18446744073709551615)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select left('hello', 18446744073709551615);
left('hello', 18446744073709551615)
hello
select left('hello', -18446744073709551616);
left('hello', -18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select left('hello', 18446744073709551616);
left('hello', 18446744073709551616)
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select left('hello', -18446744073709551617);
left('hello', -18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select left('hello', 18446744073709551617);
left('hello', 18446744073709551617)
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select right('hello', 10);
right('hello', 10)
hello
select right('hello', 0);
right('hello', 0)
select right('hello', -1);
right('hello', -1)
select right('hello', -4294967295);
right('hello', -4294967295)
select right('hello', 4294967295);
right('hello', 4294967295)
hello
select right('hello', -4294967296);
right('hello', -4294967296)
select right('hello', 4294967296);
right('hello', 4294967296)
hello
select right('hello', -4294967297);
right('hello', -4294967297)
select right('hello', 4294967297);
right('hello', 4294967297)
hello
select right('hello', -18446744073709551615);
right('hello', -18446744073709551615)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select right('hello', 18446744073709551615);
right('hello', 18446744073709551615)
hello
select right('hello', -18446744073709551616);
right('hello', -18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select right('hello', 18446744073709551616);
right('hello', 18446744073709551616)
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select right('hello', -18446744073709551617);
right('hello', -18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select right('hello', 18446744073709551617);
right('hello', 18446744073709551617)
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 2, -1);
substring('hello', 2, -1)
select substring('hello', -1, 1);
substring('hello', -1, 1)
o
select substring('hello', -2, 1);
substring('hello', -2, 1)
l
select substring('hello', -4294967295, 1);
substring('hello', -4294967295, 1)
select substring('hello', 4294967295, 1);
substring('hello', 4294967295, 1)
select substring('hello', -4294967296, 1);
substring('hello', -4294967296, 1)
select substring('hello', 4294967296, 1);
substring('hello', 4294967296, 1)
select substring('hello', -4294967297, 1);
substring('hello', -4294967297, 1)
select substring('hello', 4294967297, 1);
substring('hello', 4294967297, 1)
select substring('hello', -18446744073709551615, 1);
substring('hello', -18446744073709551615, 1)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551615, 1);
substring('hello', 18446744073709551615, 1)
select substring('hello', -18446744073709551616, 1);
substring('hello', -18446744073709551616, 1)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551616, 1);
substring('hello', 18446744073709551616, 1)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', -18446744073709551617, 1);
substring('hello', -18446744073709551617, 1)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551617, 1);
substring('hello', 18446744073709551617, 1)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 1, -1);
substring('hello', 1, -1)
select substring('hello', 1, -4294967295);
substring('hello', 1, -4294967295)
select substring('hello', 1, 4294967295);
substring('hello', 1, 4294967295)
hello
select substring('hello', 1, -4294967296);
substring('hello', 1, -4294967296)
select substring('hello', 1, 4294967296);
substring('hello', 1, 4294967296)
hello
select substring('hello', 1, -4294967297);
substring('hello', 1, -4294967297)
select substring('hello', 1, 4294967297);
substring('hello', 1, 4294967297)
hello
select substring('hello', 1, -18446744073709551615);
substring('hello', 1, -18446744073709551615)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 1, 18446744073709551615);
substring('hello', 1, 18446744073709551615)
hello
select substring('hello', 1, -18446744073709551616);
substring('hello', 1, -18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 1, 18446744073709551616);
substring('hello', 1, 18446744073709551616)
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 1, -18446744073709551617);
substring('hello', 1, -18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 1, 18446744073709551617);
substring('hello', 1, 18446744073709551617)
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', -1, -1);
substring('hello', -1, -1)
select substring('hello', -4294967295, -4294967295);
substring('hello', -4294967295, -4294967295)
select substring('hello', 4294967295, 4294967295);
substring('hello', 4294967295, 4294967295)
select substring('hello', -4294967296, -4294967296);
substring('hello', -4294967296, -4294967296)
select substring('hello', 4294967296, 4294967296);
substring('hello', 4294967296, 4294967296)
select substring('hello', -4294967297, -4294967297);
substring('hello', -4294967297, -4294967297)
select substring('hello', 4294967297, 4294967297);
substring('hello', 4294967297, 4294967297)
select substring('hello', -18446744073709551615, -18446744073709551615);
substring('hello', -18446744073709551615, -18446744073709551615)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551615, 18446744073709551615);
substring('hello', 18446744073709551615, 18446744073709551615)
select substring('hello', -18446744073709551616, -18446744073709551616);
substring('hello', -18446744073709551616, -18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551616, 18446744073709551616);
substring('hello', 18446744073709551616, 18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', -18446744073709551617, -18446744073709551617);
substring('hello', -18446744073709551617, -18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551617, 18446744073709551617);
substring('hello', 18446744073709551617, 18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', -1, 1, 'hi');
insert('hello', -1, 1, 'hi')
hello
select insert('hello', -4294967295, 1, 'hi');
insert('hello', -4294967295, 1, 'hi')
hello
select insert('hello', 4294967295, 1, 'hi');
insert('hello', 4294967295, 1, 'hi')
hello
select insert('hello', -4294967296, 1, 'hi');
insert('hello', -4294967296, 1, 'hi')
hello
select insert('hello', 4294967296, 1, 'hi');
insert('hello', 4294967296, 1, 'hi')
hello
select insert('hello', -4294967297, 1, 'hi');
insert('hello', -4294967297, 1, 'hi')
hello
select insert('hello', 4294967297, 1, 'hi');
insert('hello', 4294967297, 1, 'hi')
hello
select insert('hello', -18446744073709551615, 1, 'hi');
insert('hello', -18446744073709551615, 1, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551615, 1, 'hi');
insert('hello', 18446744073709551615, 1, 'hi')
hello
select insert('hello', -18446744073709551616, 1, 'hi');
insert('hello', -18446744073709551616, 1, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551616, 1, 'hi');
insert('hello', 18446744073709551616, 1, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', -18446744073709551617, 1, 'hi');
insert('hello', -18446744073709551617, 1, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551617, 1, 'hi');
insert('hello', 18446744073709551617, 1, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 1, -1, 'hi');
insert('hello', 1, -1, 'hi')
hi
select insert('hello', 1, -4294967295, 'hi');
insert('hello', 1, -4294967295, 'hi')
hi
select insert('hello', 1, 4294967295, 'hi');
insert('hello', 1, 4294967295, 'hi')
hi
select insert('hello', 1, -4294967296, 'hi');
insert('hello', 1, -4294967296, 'hi')
hi
select insert('hello', 1, 4294967296, 'hi');
insert('hello', 1, 4294967296, 'hi')
hi
select insert('hello', 1, -4294967297, 'hi');
insert('hello', 1, -4294967297, 'hi')
hi
select insert('hello', 1, 4294967297, 'hi');
insert('hello', 1, 4294967297, 'hi')
hi
select insert('hello', 1, -18446744073709551615, 'hi');
insert('hello', 1, -18446744073709551615, 'hi')
hi
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 1, 18446744073709551615, 'hi');
insert('hello', 1, 18446744073709551615, 'hi')
hi
select insert('hello', 1, -18446744073709551616, 'hi');
insert('hello', 1, -18446744073709551616, 'hi')
hi
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 1, 18446744073709551616, 'hi');
insert('hello', 1, 18446744073709551616, 'hi')
hi
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 1, -18446744073709551617, 'hi');
insert('hello', 1, -18446744073709551617, 'hi')
hi
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 1, 18446744073709551617, 'hi');
insert('hello', 1, 18446744073709551617, 'hi')
hi
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', -1, -1, 'hi');
insert('hello', -1, -1, 'hi')
hello
select insert('hello', -4294967295, -4294967295, 'hi');
insert('hello', -4294967295, -4294967295, 'hi')
hello
select insert('hello', 4294967295, 4294967295, 'hi');
insert('hello', 4294967295, 4294967295, 'hi')
hello
select insert('hello', -4294967296, -4294967296, 'hi');
insert('hello', -4294967296, -4294967296, 'hi')
hello
select insert('hello', 4294967296, 4294967296, 'hi');
insert('hello', 4294967296, 4294967296, 'hi')
hello
select insert('hello', -4294967297, -4294967297, 'hi');
insert('hello', -4294967297, -4294967297, 'hi')
hello
select insert('hello', 4294967297, 4294967297, 'hi');
insert('hello', 4294967297, 4294967297, 'hi')
hello
select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
insert('hello', -18446744073709551615, -18446744073709551615, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
insert('hello', 18446744073709551615, 18446744073709551615, 'hi')
hello
select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
insert('hello', -18446744073709551616, -18446744073709551616, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
insert('hello', 18446744073709551616, 18446744073709551616, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
insert('hello', -18446744073709551617, -18446744073709551617, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
insert('hello', 18446744073709551617, 18446744073709551617, 'hi')
hello
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select repeat('hello', -1);
repeat('hello', -1)
select repeat('hello', -4294967295);
repeat('hello', -4294967295)
select repeat('hello', 4294967295);
repeat('hello', 4294967295)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -4294967296);
repeat('hello', -4294967296)
select repeat('hello', 4294967296);
repeat('hello', 4294967296)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -4294967297);
repeat('hello', -4294967297)
select repeat('hello', 4294967297);
repeat('hello', 4294967297)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551615);
repeat('hello', -18446744073709551615)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select repeat('hello', 18446744073709551615);
repeat('hello', 18446744073709551615)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551616);
repeat('hello', -18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select repeat('hello', 18446744073709551616);
repeat('hello', 18446744073709551616)
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551617);
repeat('hello', -18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select repeat('hello', 18446744073709551617);
repeat('hello', 18446744073709551617)
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-1);
space(-1)
select space(-4294967295);
space(-4294967295)
select space(4294967295);
space(4294967295)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-4294967296);
space(-4294967296)
select space(4294967296);
space(4294967296)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-4294967297);
space(-4294967297)
select space(4294967297);
space(4294967297)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551615);
space(-18446744073709551615)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select space(18446744073709551615);
space(18446744073709551615)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551616);
space(-18446744073709551616)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select space(18446744073709551616);
space(18446744073709551616)
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551617);
space(-18446744073709551617)
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select space(18446744073709551617);
space(18446744073709551617)
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -1, '1');
rpad('hello', -1, '1')
NULL
select rpad('hello', -4294967295, '1');
rpad('hello', -4294967295, '1')
NULL
select rpad('hello', 4294967295, '1');
rpad('hello', 4294967295, '1')
NULL
Warnings:
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -4294967296, '1');
rpad('hello', -4294967296, '1')
NULL
select rpad('hello', 4294967296, '1');
rpad('hello', 4294967296, '1')
NULL
Warnings:
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -4294967297, '1');
rpad('hello', -4294967297, '1')
NULL
select rpad('hello', 4294967297, '1');
rpad('hello', 4294967297, '1')
NULL
Warnings:
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551615, '1');
rpad('hello', -18446744073709551615, '1')
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select rpad('hello', 18446744073709551615, '1');
rpad('hello', 18446744073709551615, '1')
NULL
Warnings:
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551616, '1');
rpad('hello', -18446744073709551616, '1')
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select rpad('hello', 18446744073709551616, '1');
rpad('hello', 18446744073709551616, '1')
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551617, '1');
rpad('hello', -18446744073709551617, '1')
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
select rpad('hello', 18446744073709551617, '1');
rpad('hello', 18446744073709551617, '1')
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -1, '1');
lpad('hello', -1, '1')
NULL
select lpad('hello', -4294967295, '1');
lpad('hello', -4294967295, '1')
NULL
select lpad('hello', 4294967295, '1');
lpad('hello', 4294967295, '1')
NULL
Warnings:
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -4294967296, '1');
lpad('hello', -4294967296, '1')
NULL NULL
select lpad('hello', 4294967296, '1'); select encode("data", NULL);
lpad('hello', 4294967296, '1') encode("data", NULL)
NULL NULL
Warnings: select encode(NULL, "password");
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated encode(NULL, "password")
select lpad('hello', -4294967297, '1');
lpad('hello', -4294967297, '1')
NULL NULL
select lpad('hello', 4294967297, '1'); select decode(NULL, NULL);
lpad('hello', 4294967297, '1') decode(NULL, NULL)
NULL NULL
Warnings: select decode("data", NULL);
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated decode("data", NULL)
select lpad('hello', -18446744073709551615, '1');
lpad('hello', -18446744073709551615, '1')
NULL NULL
Warnings: select decode(NULL, "password");
Error 1292 Truncated incorrect DECIMAL value: '' decode(NULL, "password")
Error 1292 Truncated incorrect DECIMAL value: ''
select lpad('hello', 18446744073709551615, '1');
lpad('hello', 18446744073709551615, '1')
NULL NULL
Warnings: select format(NULL, NULL);
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated format(NULL, NULL)
select lpad('hello', -18446744073709551616, '1');
lpad('hello', -18446744073709551616, '1')
NULL NULL
Warnings: select format(pi(), NULL);
Error 1292 Truncated incorrect DECIMAL value: '' format(pi(), NULL)
Error 1292 Truncated incorrect DECIMAL value: ''
select lpad('hello', 18446744073709551616, '1');
lpad('hello', 18446744073709551616, '1')
NULL NULL
Warnings: select format(NULL, 2);
Error 1292 Truncated incorrect DECIMAL value: '' format(NULL, 2)
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -18446744073709551617, '1');
lpad('hello', -18446744073709551617, '1')
NULL NULL
Warnings: select benchmark(NULL, NULL);
Error 1292 Truncated incorrect DECIMAL value: '' benchmark(NULL, NULL)
Error 1292 Truncated incorrect DECIMAL value: ''
select lpad('hello', 18446744073709551617, '1');
lpad('hello', 18446744073709551617, '1')
NULL NULL
Warnings: select benchmark(0, NULL);
Error 1292 Truncated incorrect DECIMAL value: '' benchmark(0, NULL)
Error 1292 Truncated incorrect DECIMAL value: '' 0
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated select benchmark(100, NULL);
SET @orig_sql_mode = @@SQL_MODE; benchmark(100, NULL)
SET SQL_MODE=traditional; 0
SELECT CHAR(0xff,0x8f USING utf8); select benchmark(NULL, 1+1);
CHAR(0xff,0x8f USING utf8) benchmark(NULL, 1+1)
NULL NULL
Warnings: set @password="password";
Error 1300 Invalid utf8 character string: 'FF8F' set @my_data="clear text to encode";
SELECT CHAR(0xff,0x8f USING utf8) IS NULL; select md5(encode(@my_data, "password"));
CHAR(0xff,0x8f USING utf8) IS NULL md5(encode(@my_data, "password"))
1 44320fd2b4a0ec92faa2da2122def917
Warnings: select md5(encode(@my_data, _utf8 "password"));
Error 1300 Invalid utf8 character string: 'FF8F' md5(encode(@my_data, _utf8 "password"))
SET SQL_MODE=@orig_sql_mode; 44320fd2b4a0ec92faa2da2122def917
select md5(encode(@my_data, binary "password"));
md5(encode(@my_data, binary "password"))
44320fd2b4a0ec92faa2da2122def917
select md5(encode(@my_data, _latin1 "password"));
md5(encode(@my_data, _latin1 "password"))
44320fd2b4a0ec92faa2da2122def917
select md5(encode(@my_data, _koi8r "password"));
md5(encode(@my_data, _koi8r "password"))
44320fd2b4a0ec92faa2da2122def917
select md5(encode(@my_data, (select "password" from dual)));
md5(encode(@my_data, (select "password" from dual)))
44320fd2b4a0ec92faa2da2122def917
select md5(encode(@my_data, concat("pass", "word")));
md5(encode(@my_data, concat("pass", "word")))
44320fd2b4a0ec92faa2da2122def917
select md5(encode(@my_data, @password));
md5(encode(@my_data, @password))
44320fd2b4a0ec92faa2da2122def917
set @my_data="binary encoded data";
select md5(decode(@my_data, "password"));
md5(decode(@my_data, "password"))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, _utf8 "password"));
md5(decode(@my_data, _utf8 "password"))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, binary "password"));
md5(decode(@my_data, binary "password"))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, _latin1 "password"));
md5(decode(@my_data, _latin1 "password"))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, _koi8r "password"));
md5(decode(@my_data, _koi8r "password"))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, (select "password" from dual)));
md5(decode(@my_data, (select "password" from dual)))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, concat("pass", "word")));
md5(decode(@my_data, concat("pass", "word")))
5bea8c394368dbc03b76684483b7756b
select md5(decode(@my_data, @password));
md5(decode(@my_data, @password))
5bea8c394368dbc03b76684483b7756b
set @dec=5;
select format(pi(), (1+1));
format(pi(), (1+1))
3.14
select format(pi(), (select 3 from dual));
format(pi(), (select 3 from dual))
3.142
select format(pi(), @dec);
format(pi(), @dec)
3.14159
set @bench_count=10;
select benchmark(10, pi());
benchmark(10, pi())
0
select benchmark(5+5, pi());
benchmark(5+5, pi())
0
select benchmark((select 10 from dual), pi());
benchmark((select 10 from dual), pi())
0
select benchmark(@bench_count, pi());
benchmark(@bench_count, pi())
0
End of 5.0 tests End of 5.0 tests
...@@ -296,11 +296,6 @@ select atan(); ...@@ -296,11 +296,6 @@ select atan();
ERROR 42000: Incorrect parameter count in the call to native function 'atan' ERROR 42000: Incorrect parameter count in the call to native function 'atan'
select atan2(1, 2, 3); select atan2(1, 2, 3);
ERROR 42000: Incorrect parameter count in the call to native function 'atan2' ERROR 42000: Incorrect parameter count in the call to native function 'atan2'
select benchmark(10, 1+1);
benchmark(10, 1+1)
0
select benchmark(5+5, 2);
ERROR 42000: Incorrect parameters in the call to native function 'BENCHMARK'
select concat(); select concat();
ERROR 42000: Incorrect parameter count in the call to native function 'concat' ERROR 42000: Incorrect parameter count in the call to native function 'concat'
select concat("foo"); select concat("foo");
...@@ -310,11 +305,6 @@ select concat_ws(); ...@@ -310,11 +305,6 @@ select concat_ws();
ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws' ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws'
select concat_ws("foo"); select concat_ws("foo");
ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws' ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws'
set @pwd="my password";
select encode("secret", @pwd);
ERROR 42000: Incorrect parameters in the call to native function 'ENCODE'
select decode("encoded-secret", @pwd);
ERROR 42000: Incorrect parameters in the call to native function 'DECODE'
select encrypt(); select encrypt();
ERROR 42000: Incorrect parameter count in the call to native function 'encrypt' ERROR 42000: Incorrect parameter count in the call to native function 'encrypt'
select encrypt(1, 2, 3); select encrypt(1, 2, 3);
...@@ -339,9 +329,6 @@ select field(); ...@@ -339,9 +329,6 @@ select field();
ERROR 42000: Incorrect parameter count in the call to native function 'field' ERROR 42000: Incorrect parameter count in the call to native function 'field'
select field("p1"); select field("p1");
ERROR 42000: Incorrect parameter count in the call to native function 'field' ERROR 42000: Incorrect parameter count in the call to native function 'field'
set @dec=2;
select format(pi(), @dec);
ERROR 42000: Incorrect parameters in the call to native function 'FORMAT'
select from_unixtime(); select from_unixtime();
ERROR 42000: Incorrect parameter count in the call to native function 'from_unixtime' ERROR 42000: Incorrect parameter count in the call to native function 'from_unixtime'
select from_unixtime(1, 2, 3); select from_unixtime(1, 2, 3);
......
...@@ -2391,3 +2391,49 @@ Level Code Message ...@@ -2391,3 +2391,49 @@ Level Code Message
Note 1051 Unknown table 't1' Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2' Note 1051 Unknown table 't2'
deallocate prepare abc; deallocate prepare abc;
set @my_password="password";
set @my_data="clear text to encode";
prepare stmt1 from 'select decode(encode(?, ?), ?)';
execute stmt1 using @my_data, @my_password, @my_password;
decode(encode(?, ?), ?)
clear text to encode
set @my_data="more text to encode";
execute stmt1 using @my_data, @my_password, @my_password;
decode(encode(?, ?), ?)
more text to encode
set @my_password="new password";
execute stmt1 using @my_data, @my_password, @my_password;
decode(encode(?, ?), ?)
more text to encode
deallocate prepare stmt1;
set @to_format="123456789.123456789";
set @dec=0;
prepare stmt2 from 'select format(?, ?)';
execute stmt2 using @to_format, @dec;
format(?, ?)
123,456,789
set @dec=4;
execute stmt2 using @to_format, @dec;
format(?, ?)
123,456,789.1235
set @dec=6;
execute stmt2 using @to_format, @dec;
format(?, ?)
123,456,789.123457
set @dec=2;
execute stmt2 using @to_format, @dec;
format(?, ?)
123,456,789.12
set @to_format="100";
execute stmt2 using @to_format, @dec;
format(?, ?)
100.00
set @to_format="1000000";
execute stmt2 using @to_format, @dec;
format(?, ?)
1,000,000.00
set @to_format="10000";
execute stmt2 using @to_format, @dec;
format(?, ?)
10,000.00
deallocate prepare stmt2;
...@@ -460,7 +460,51 @@ drop table t7; ...@@ -460,7 +460,51 @@ drop table t7;
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2); select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty"); explain extended select md5('hello');
explain extended select sha('abc');
explain extended select sha1('abc');
explain extended select soundex('');
explain extended select 'mood' sounds like 'mud';
explain extended select aes_decrypt(aes_encrypt('abc','1'),'1');
explain extended select concat('*',space(5),'*');
explain extended select reverse('abc');
explain extended select rpad('a',4,'1');
explain extended select lpad('a',4,'1');
explain extended select concat_ws(',','',NULL,'a');
explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c');
explain extended select elt(2,1);
explain extended select locate("a","b",2);
explain extended select format(130,10);
explain extended select char(0);
explain extended select conv(130,16,10);
explain extended select hex(130);
explain extended select binary 'HE';
explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' ');
explain extended select FIELD('b' COLLATE latin1_bin,'A','B');
explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d');
explain extended select collation(conv(130,16,10));
explain extended select coercibility(conv(130,16,10));
explain extended select length('\n\t\r\b\0\_\%\\');
explain extended select bit_length('\n\t\r\b\0\_\%\\');
explain extended select bit_length('\n\t\r\b\0\_\%\\');
explain extended select concat('monty',' was here ','again');
explain extended select length('hello');
explain extended select char(ascii('h'));
explain extended select ord('h');
explain extended select quote(1/0);
explain extended select crc32("123");
explain extended select replace('aaaa','a','b');
explain extended select insert('txs',2,1,'hi');
explain extended select left(_latin2'a',1);
explain extended select right(_latin2'a',1);
explain extended select lcase(_latin2'a');
explain extended select ucase(_latin2'a');
explain extended select SUBSTR('abcdefg',3,2);
explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2);
explain extended select trim(_latin2' a ');
explain extended select ltrim(_latin2' a ');
explain extended select rtrim(_latin2' a ');
explain extended select decode(encode(repeat("a",100000),"monty"),"monty");
# #
# lpad returns incorrect result (Bug #2182) # lpad returns incorrect result (Bug #2182)
...@@ -780,208 +824,67 @@ SELECT * FROM t1 INNER JOIN t2 ON code=id ...@@ -780,208 +824,67 @@ SELECT * FROM t1 INNER JOIN t2 ON code=id
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #10963 # Bug#22684: The Functions ENCODE, DECODE and FORMAT are not real functions
# 4294967296 18446744073709551616 #
select locate('he','hello',-2); select encode(NULL, NULL);
select locate('lo','hello',-4294967295); select encode("data", NULL);
select locate('lo','hello',4294967295); select encode(NULL, "password");
select locate('lo','hello',-4294967296);
select locate('lo','hello',4294967296); select decode(NULL, NULL);
select locate('lo','hello',-4294967297); select decode("data", NULL);
select locate('lo','hello',4294967297); select decode(NULL, "password");
select locate('lo','hello',-18446744073709551615);
select locate('lo','hello',18446744073709551615); select format(NULL, NULL);
select locate('lo','hello',-18446744073709551616); select format(pi(), NULL);
select locate('lo','hello',18446744073709551616); select format(NULL, 2);
select locate('lo','hello',-18446744073709551617);
select locate('lo','hello',18446744073709551617); select benchmark(NULL, NULL);
select benchmark(0, NULL);
select left('hello', 10); select benchmark(100, NULL);
select left('hello', 0); select benchmark(NULL, 1+1);
select left('hello', -1);
select left('hello', -4294967295); #
select left('hello', 4294967295); # Please note:
select left('hello', -4294967296); # 1) The collation of the password is irrelevant, the encryption uses
select left('hello', 4294967296); # the binary representation of the string without charset/collation.
select left('hello', -4294967297); # 2) These tests can not print the encoded text directly, because it's binary,
select left('hello', 4294967297); # and doing this would cause problems with source control.
select left('hello', -18446744073709551615); # Instead, an md5() checksum is used, to verify the result indirectly.
select left('hello', 18446744073709551615); # 3) Each md5() result must be identical.
select left('hello', -18446744073709551616); # 4) The md5() result must never change, and must be stable across releases.
select left('hello', 18446744073709551616); #
select left('hello', -18446744073709551617); set @password="password";
select left('hello', 18446744073709551617); set @my_data="clear text to encode";
select md5(encode(@my_data, "password"));
select right('hello', 10); select md5(encode(@my_data, _utf8 "password"));
select right('hello', 0); select md5(encode(@my_data, binary "password"));
select right('hello', -1); select md5(encode(@my_data, _latin1 "password"));
select right('hello', -4294967295); select md5(encode(@my_data, _koi8r "password"));
select right('hello', 4294967295); select md5(encode(@my_data, (select "password" from dual)));
select right('hello', -4294967296); select md5(encode(@my_data, concat("pass", "word")));
select right('hello', 4294967296); select md5(encode(@my_data, @password));
select right('hello', -4294967297);
select right('hello', 4294967297); set @my_data="binary encoded data";
select right('hello', -18446744073709551615); select md5(decode(@my_data, "password"));
select right('hello', 18446744073709551615); select md5(decode(@my_data, _utf8 "password"));
select right('hello', -18446744073709551616); select md5(decode(@my_data, binary "password"));
select right('hello', 18446744073709551616); select md5(decode(@my_data, _latin1 "password"));
select right('hello', -18446744073709551617); select md5(decode(@my_data, _koi8r "password"));
select right('hello', 18446744073709551617); select md5(decode(@my_data, (select "password" from dual)));
select md5(decode(@my_data, concat("pass", "word")));
select substring('hello', 2, -1); select md5(decode(@my_data, @password));
select substring('hello', -1, 1); set @dec=5;
select substring('hello', -2, 1); select format(pi(), (1+1));
select substring('hello', -4294967295, 1); select format(pi(), (select 3 from dual));
select substring('hello', 4294967295, 1); select format(pi(), @dec);
select substring('hello', -4294967296, 1);
select substring('hello', 4294967296, 1); set @bench_count=10;
select substring('hello', -4294967297, 1); select benchmark(10, pi());
select substring('hello', 4294967297, 1); select benchmark(5+5, pi());
select substring('hello', -18446744073709551615, 1); select benchmark((select 10 from dual), pi());
select substring('hello', 18446744073709551615, 1); select benchmark(@bench_count, pi());
select substring('hello', -18446744073709551616, 1);
select substring('hello', 18446744073709551616, 1);
select substring('hello', -18446744073709551617, 1);
select substring('hello', 18446744073709551617, 1);
select substring('hello', 1, -1);
select substring('hello', 1, -4294967295);
select substring('hello', 1, 4294967295);
select substring('hello', 1, -4294967296);
select substring('hello', 1, 4294967296);
select substring('hello', 1, -4294967297);
select substring('hello', 1, 4294967297);
select substring('hello', 1, -18446744073709551615);
select substring('hello', 1, 18446744073709551615);
select substring('hello', 1, -18446744073709551616);
select substring('hello', 1, 18446744073709551616);
select substring('hello', 1, -18446744073709551617);
select substring('hello', 1, 18446744073709551617);
select substring('hello', -1, -1);
select substring('hello', -4294967295, -4294967295);
select substring('hello', 4294967295, 4294967295);
select substring('hello', -4294967296, -4294967296);
select substring('hello', 4294967296, 4294967296);
select substring('hello', -4294967297, -4294967297);
select substring('hello', 4294967297, 4294967297);
select substring('hello', -18446744073709551615, -18446744073709551615);
select substring('hello', 18446744073709551615, 18446744073709551615);
select substring('hello', -18446744073709551616, -18446744073709551616);
select substring('hello', 18446744073709551616, 18446744073709551616);
select substring('hello', -18446744073709551617, -18446744073709551617);
select substring('hello', 18446744073709551617, 18446744073709551617);
select insert('hello', -1, 1, 'hi');
select insert('hello', -4294967295, 1, 'hi');
select insert('hello', 4294967295, 1, 'hi');
select insert('hello', -4294967296, 1, 'hi');
select insert('hello', 4294967296, 1, 'hi');
select insert('hello', -4294967297, 1, 'hi');
select insert('hello', 4294967297, 1, 'hi');
select insert('hello', -18446744073709551615, 1, 'hi');
select insert('hello', 18446744073709551615, 1, 'hi');
select insert('hello', -18446744073709551616, 1, 'hi');
select insert('hello', 18446744073709551616, 1, 'hi');
select insert('hello', -18446744073709551617, 1, 'hi');
select insert('hello', 18446744073709551617, 1, 'hi');
select insert('hello', 1, -1, 'hi');
select insert('hello', 1, -4294967295, 'hi');
select insert('hello', 1, 4294967295, 'hi');
select insert('hello', 1, -4294967296, 'hi');
select insert('hello', 1, 4294967296, 'hi');
select insert('hello', 1, -4294967297, 'hi');
select insert('hello', 1, 4294967297, 'hi');
select insert('hello', 1, -18446744073709551615, 'hi');
select insert('hello', 1, 18446744073709551615, 'hi');
select insert('hello', 1, -18446744073709551616, 'hi');
select insert('hello', 1, 18446744073709551616, 'hi');
select insert('hello', 1, -18446744073709551617, 'hi');
select insert('hello', 1, 18446744073709551617, 'hi');
select insert('hello', -1, -1, 'hi');
select insert('hello', -4294967295, -4294967295, 'hi');
select insert('hello', 4294967295, 4294967295, 'hi');
select insert('hello', -4294967296, -4294967296, 'hi');
select insert('hello', 4294967296, 4294967296, 'hi');
select insert('hello', -4294967297, -4294967297, 'hi');
select insert('hello', 4294967297, 4294967297, 'hi');
select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
select repeat('hello', -1);
select repeat('hello', -4294967295);
select repeat('hello', 4294967295);
select repeat('hello', -4294967296);
select repeat('hello', 4294967296);
select repeat('hello', -4294967297);
select repeat('hello', 4294967297);
select repeat('hello', -18446744073709551615);
select repeat('hello', 18446744073709551615);
select repeat('hello', -18446744073709551616);
select repeat('hello', 18446744073709551616);
select repeat('hello', -18446744073709551617);
select repeat('hello', 18446744073709551617);
select space(-1);
select space(-4294967295);
select space(4294967295);
select space(-4294967296);
select space(4294967296);
select space(-4294967297);
select space(4294967297);
select space(-18446744073709551615);
select space(18446744073709551615);
select space(-18446744073709551616);
select space(18446744073709551616);
select space(-18446744073709551617);
select space(18446744073709551617);
select rpad('hello', -1, '1');
select rpad('hello', -4294967295, '1');
select rpad('hello', 4294967295, '1');
select rpad('hello', -4294967296, '1');
select rpad('hello', 4294967296, '1');
select rpad('hello', -4294967297, '1');
select rpad('hello', 4294967297, '1');
select rpad('hello', -18446744073709551615, '1');
select rpad('hello', 18446744073709551615, '1');
select rpad('hello', -18446744073709551616, '1');
select rpad('hello', 18446744073709551616, '1');
select rpad('hello', -18446744073709551617, '1');
select rpad('hello', 18446744073709551617, '1');
select lpad('hello', -1, '1');
select lpad('hello', -4294967295, '1');
select lpad('hello', 4294967295, '1');
select lpad('hello', -4294967296, '1');
select lpad('hello', 4294967296, '1');
select lpad('hello', -4294967297, '1');
select lpad('hello', 4294967297, '1');
select lpad('hello', -18446744073709551615, '1');
select lpad('hello', 18446744073709551615, '1');
select lpad('hello', -18446744073709551616, '1');
select lpad('hello', 18446744073709551616, '1');
select lpad('hello', -18446744073709551617, '1');
select lpad('hello', 18446744073709551617, '1');
#
# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
# result
#
SET @orig_sql_mode = @@SQL_MODE;
SET SQL_MODE=traditional;
SELECT CHAR(0xff,0x8f USING utf8);
SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
SET SQL_MODE=@orig_sql_mode;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -399,11 +399,6 @@ select atan(); ...@@ -399,11 +399,6 @@ select atan();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select atan2(1, 2, 3); select atan2(1, 2, 3);
select benchmark(10, 1+1);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select benchmark(5+5, 2);
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select concat(); select concat();
select concat("foo"); select concat("foo");
...@@ -413,12 +408,6 @@ select concat_ws(); ...@@ -413,12 +408,6 @@ select concat_ws();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select concat_ws("foo"); select concat_ws("foo");
set @pwd="my password";
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select encode("secret", @pwd);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select decode("encoded-secret", @pwd);
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select encrypt(); select encrypt();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
...@@ -448,10 +437,6 @@ select field(); ...@@ -448,10 +437,6 @@ select field();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select field("p1"); select field("p1");
set @dec=2;
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select format(pi(), @dec);
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select from_unixtime(); select from_unixtime();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
......
...@@ -2414,3 +2414,38 @@ execute abc; ...@@ -2414,3 +2414,38 @@ execute abc;
drop table if exists t1, t2; drop table if exists t1, t2;
execute abc; execute abc;
deallocate prepare abc; deallocate prepare abc;
#
# Bug#22684: The Functions ENCODE, DECODE and FORMAT are not real functions
#
set @my_password="password";
set @my_data="clear text to encode";
prepare stmt1 from 'select decode(encode(?, ?), ?)';
execute stmt1 using @my_data, @my_password, @my_password;
set @my_data="more text to encode";
execute stmt1 using @my_data, @my_password, @my_password;
set @my_password="new password";
execute stmt1 using @my_data, @my_password, @my_password;
deallocate prepare stmt1;
set @to_format="123456789.123456789";
set @dec=0;
prepare stmt2 from 'select format(?, ?)';
execute stmt2 using @to_format, @dec;
set @dec=4;
execute stmt2 using @to_format, @dec;
set @dec=6;
execute stmt2 using @to_format, @dec;
set @dec=2;
execute stmt2 using @to_format, @dec;
set @to_format="100";
execute stmt2 using @to_format, @dec;
set @to_format="1000000";
execute stmt2 using @to_format, @dec;
set @to_format="10000";
execute stmt2 using @to_format, @dec;
deallocate prepare stmt2;
...@@ -2612,15 +2612,8 @@ Create_func_benchmark Create_func_benchmark::s_singleton; ...@@ -2612,15 +2612,8 @@ Create_func_benchmark Create_func_benchmark::s_singleton;
Item* Item*
Create_func_benchmark::create(THD *thd, Item *arg1, Item *arg2) Create_func_benchmark::create(THD *thd, Item *arg1, Item *arg2)
{ {
/* TODO: Known limitation, see Bug#22684 */
if ((arg1->type() != Item::INT_ITEM) || ! arg1->basic_const_item())
{
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), "BENCHMARK");
return NULL;
}
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new (thd->mem_root) Item_func_benchmark(arg1->val_int(), arg2); return new (thd->mem_root) Item_func_benchmark(arg1, arg2);
} }
...@@ -2887,17 +2880,7 @@ Create_func_decode Create_func_decode::s_singleton; ...@@ -2887,17 +2880,7 @@ Create_func_decode Create_func_decode::s_singleton;
Item* Item*
Create_func_decode::create(THD *thd, Item *arg1, Item *arg2) Create_func_decode::create(THD *thd, Item *arg1, Item *arg2)
{ {
/* TODO: Known limitation, see Bug#22684 */ return new (thd->mem_root) Item_func_decode(arg1, arg2);
if ((arg2->type() != Item::STRING_ITEM) || ! arg2->basic_const_item())
{
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), "DECODE");
return NULL;
}
String dummy;
String *val = arg2->val_str(& dummy);
DBUG_ASSERT(val);
return new (thd->mem_root) Item_func_decode(arg1, val->c_ptr());
} }
...@@ -3033,17 +3016,7 @@ Create_func_encode Create_func_encode::s_singleton; ...@@ -3033,17 +3016,7 @@ Create_func_encode Create_func_encode::s_singleton;
Item* Item*
Create_func_encode::create(THD *thd, Item *arg1, Item *arg2) Create_func_encode::create(THD *thd, Item *arg1, Item *arg2)
{ {
/* TODO: Known limitation, see Bug#22684 */ return new (thd->mem_root) Item_func_encode(arg1, arg2);
if ((arg2->type() != Item::STRING_ITEM) || ! arg2->basic_const_item())
{
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), "ENCODE");
return NULL;
}
String dummy;
String *val = arg2->val_str(& dummy);
DBUG_ASSERT(val);
return new (thd->mem_root) Item_func_encode(arg1, val->c_ptr());
} }
...@@ -3235,14 +3208,7 @@ Create_func_format Create_func_format::s_singleton; ...@@ -3235,14 +3208,7 @@ Create_func_format Create_func_format::s_singleton;
Item* Item*
Create_func_format::create(THD *thd, Item *arg1, Item *arg2) Create_func_format::create(THD *thd, Item *arg1, Item *arg2)
{ {
/* TODO: Known limitation, see Bug#22684 */ return new (thd->mem_root) Item_func_format(arg1, arg2);
if ((arg2->type() != Item::INT_ITEM) || ! arg2->basic_const_item())
{
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), "FORMAT");
return NULL;
}
return new (thd->mem_root) Item_func_format(arg1, arg2->val_int());
} }
......
...@@ -3403,18 +3403,28 @@ longlong Item_func_benchmark::val_int() ...@@ -3403,18 +3403,28 @@ longlong Item_func_benchmark::val_int()
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), &my_charset_bin); String tmp(buff,sizeof(buff), &my_charset_bin);
THD *thd=current_thd; THD *thd=current_thd;
ulong loop_count;
loop_count= args[0]->val_int();
if (args[0]->null_value)
{
null_value= 1;
return 0;
}
null_value=0;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
{ {
switch (args[0]->result_type()) { switch (args[1]->result_type()) {
case REAL_RESULT: case REAL_RESULT:
(void) args[0]->val_real(); (void) args[1]->val_real();
break; break;
case INT_RESULT: case INT_RESULT:
(void) args[0]->val_int(); (void) args[1]->val_int();
break; break;
case STRING_RESULT: case STRING_RESULT:
(void) args[0]->val_str(&tmp); (void) args[1]->val_str(&tmp);
break; break;
case ROW_RESULT: case ROW_RESULT:
default: default:
...@@ -3430,13 +3440,9 @@ longlong Item_func_benchmark::val_int() ...@@ -3430,13 +3440,9 @@ longlong Item_func_benchmark::val_int()
void Item_func_benchmark::print(String *str) void Item_func_benchmark::print(String *str)
{ {
str->append(STRING_WITH_LEN("benchmark(")); str->append(STRING_WITH_LEN("benchmark("));
char buffer[20];
// my_charset_bin is good enough for numbers
String st(buffer, sizeof(buffer), &my_charset_bin);
st.set((ulonglong)loop_count, &my_charset_bin);
str->append(st);
str->append(',');
args[0]->print(str); args[0]->print(str);
str->append(',');
args[1]->print(str);
str->append(')'); str->append(')');
} }
......
...@@ -925,10 +925,9 @@ class Item_func_last_insert_id :public Item_int_func ...@@ -925,10 +925,9 @@ class Item_func_last_insert_id :public Item_int_func
class Item_func_benchmark :public Item_int_func class Item_func_benchmark :public Item_int_func
{ {
ulong loop_count;
public: public:
Item_func_benchmark(ulong loop_count_arg,Item *expr) Item_func_benchmark(Item *count_expr, Item *expr)
:Item_int_func(expr), loop_count(loop_count_arg) :Item_int_func(count_expr, expr)
{} {}
longlong val_int(); longlong val_int();
const char *func_name() const { return "benchmark"; } const char *func_name() const { return "benchmark"; }
......
...@@ -1673,21 +1673,33 @@ String *Item_func_encrypt::val_str(String *str) ...@@ -1673,21 +1673,33 @@ String *Item_func_encrypt::val_str(String *str)
void Item_func_encode::fix_length_and_dec() void Item_func_encode::fix_length_and_dec()
{ {
max_length=args[0]->max_length; max_length=args[0]->max_length;
maybe_null=args[0]->maybe_null; maybe_null=args[0]->maybe_null || args[1]->maybe_null;
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
} }
String *Item_func_encode::val_str(String *str) String *Item_func_encode::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1);
String *res; String *res;
char pw_buff[80];
String tmp_pw_value(pw_buff, sizeof(pw_buff), system_charset_info);
String *password;
DBUG_ASSERT(fixed == 1);
if (!(res=args[0]->val_str(str))) if (!(res=args[0]->val_str(str)))
{ {
null_value=1; /* purecov: inspected */ null_value=1; /* purecov: inspected */
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
} }
if (!(password=args[1]->val_str(& tmp_pw_value)))
{
null_value=1;
return 0;
}
null_value=0; null_value=0;
res=copy_if_not_alloced(str,res,res->length()); res=copy_if_not_alloced(str,res,res->length());
SQL_CRYPT sql_crypt(password->ptr());
sql_crypt.init(); sql_crypt.init();
sql_crypt.encode((char*) res->ptr(),res->length()); sql_crypt.encode((char*) res->ptr(),res->length());
res->set_charset(&my_charset_bin); res->set_charset(&my_charset_bin);
...@@ -1696,15 +1708,27 @@ String *Item_func_encode::val_str(String *str) ...@@ -1696,15 +1708,27 @@ String *Item_func_encode::val_str(String *str)
String *Item_func_decode::val_str(String *str) String *Item_func_decode::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1);
String *res; String *res;
char pw_buff[80];
String tmp_pw_value(pw_buff, sizeof(pw_buff), system_charset_info);
String *password;
DBUG_ASSERT(fixed == 1);
if (!(res=args[0]->val_str(str))) if (!(res=args[0]->val_str(str)))
{ {
null_value=1; /* purecov: inspected */ null_value=1; /* purecov: inspected */
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
} }
if (!(password=args[1]->val_str(& tmp_pw_value)))
{
null_value=1;
return 0;
}
null_value=0; null_value=0;
res=copy_if_not_alloced(str,res,res->length()); res=copy_if_not_alloced(str,res,res->length());
SQL_CRYPT sql_crypt(password->ptr());
sql_crypt.init(); sql_crypt.init();
sql_crypt.decode((char*) res->ptr(),res->length()); sql_crypt.decode((char*) res->ptr(),res->length());
return res; return res;
...@@ -1874,9 +1898,19 @@ String *Item_func_soundex::val_str(String *str) ...@@ -1874,9 +1898,19 @@ String *Item_func_soundex::val_str(String *str)
** This should be 'internationalized' sometimes. ** This should be 'internationalized' sometimes.
*/ */
Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org) const int FORMAT_MAX_DECIMALS= 30;
Item_func_format::Item_func_format(Item *org, Item *dec)
: Item_str_func(org, dec)
{
}
void Item_func_format::fix_length_and_dec()
{ {
decimals=(uint) set_zone(dec,0,30); collation.set(default_charset());
uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
max_length= ((char_length + (char_length-args[0]->decimals)/3) *
collation.collation->mbmaxlen);
} }
...@@ -1887,10 +1921,25 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org) ...@@ -1887,10 +1921,25 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org)
String *Item_func_format::val_str(String *str) String *Item_func_format::val_str(String *str)
{ {
uint32 length, str_length ,dec; uint32 length;
uint32 str_length;
/* Number of decimal digits */
int dec;
/* Number of characters used to represent the decimals, including '.' */
uint32 dec_length;
int diff; int diff;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
dec= decimals ? decimals+1 : 0;
dec= args[1]->val_int();
if (args[1]->null_value)
{
null_value=1;
return NULL;
}
dec= set_zone(dec, 0, FORMAT_MAX_DECIMALS);
dec_length= dec ? dec+1 : 0;
null_value=0;
if (args[0]->result_type() == DECIMAL_RESULT || if (args[0]->result_type() == DECIMAL_RESULT ||
args[0]->result_type() == INT_RESULT) args[0]->result_type() == INT_RESULT)
...@@ -1899,7 +1948,7 @@ String *Item_func_format::val_str(String *str) ...@@ -1899,7 +1948,7 @@ String *Item_func_format::val_str(String *str)
res= args[0]->val_decimal(&dec_val); res= args[0]->val_decimal(&dec_val);
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
my_decimal_round(E_DEC_FATAL_ERROR, res, decimals, false, &rnd_dec); my_decimal_round(E_DEC_FATAL_ERROR, res, dec, false, &rnd_dec);
my_decimal2string(E_DEC_FATAL_ERROR, &rnd_dec, 0, 0, 0, str); my_decimal2string(E_DEC_FATAL_ERROR, &rnd_dec, 0, 0, 0, str);
str_length= str->length(); str_length= str->length();
if (rnd_dec.sign()) if (rnd_dec.sign())
...@@ -1910,9 +1959,9 @@ String *Item_func_format::val_str(String *str) ...@@ -1910,9 +1959,9 @@ String *Item_func_format::val_str(String *str)
double nr= args[0]->val_real(); double nr= args[0]->val_real();
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
nr= my_double_round(nr, decimals, FALSE); nr= my_double_round(nr, dec, FALSE);
/* Here default_charset() is right as this is not an automatic conversion */ /* Here default_charset() is right as this is not an automatic conversion */
str->set_real(nr,decimals, default_charset()); str->set_real(nr, dec, default_charset());
if (isnan(nr)) if (isnan(nr))
return str; return str;
str_length=str->length(); str_length=str->length();
...@@ -1920,13 +1969,13 @@ String *Item_func_format::val_str(String *str) ...@@ -1920,13 +1969,13 @@ String *Item_func_format::val_str(String *str)
str_length--; // Don't count sign str_length--; // Don't count sign
} }
/* We need this test to handle 'nan' values */ /* We need this test to handle 'nan' values */
if (str_length >= dec+4) if (str_length >= dec_length+4)
{ {
char *tmp,*pos; char *tmp,*pos;
length= str->length()+(diff=((int)(str_length- dec-1))/3); length= str->length()+(diff=((int)(str_length- dec_length-1))/3);
str= copy_if_not_alloced(&tmp_str,str,length); str= copy_if_not_alloced(&tmp_str,str,length);
str->length(length); str->length(length);
tmp= (char*) str->ptr()+length - dec-1; tmp= (char*) str->ptr()+length - dec_length-1;
for (pos= (char*) str->ptr()+length-1; pos != tmp; pos--) for (pos= (char*) str->ptr()+length-1; pos != tmp; pos--)
pos[0]= pos[-diff]; pos[0]= pos[-diff];
while (diff) while (diff)
...@@ -1951,11 +2000,7 @@ void Item_func_format::print(String *str) ...@@ -1951,11 +2000,7 @@ void Item_func_format::print(String *str)
str->append(STRING_WITH_LEN("format(")); str->append(STRING_WITH_LEN("format("));
args[0]->print(str); args[0]->print(str);
str->append(','); str->append(',');
// my_charset_bin is good enough for numbers args[1]->print(str);
char buffer[20];
String st(buffer, sizeof(buffer), &my_charset_bin);
st.set((ulonglong)decimals, &my_charset_bin);
str->append(st);
str->append(')'); str->append(')');
} }
......
...@@ -361,11 +361,9 @@ class Item_func_encrypt :public Item_str_func ...@@ -361,11 +361,9 @@ class Item_func_encrypt :public Item_str_func
class Item_func_encode :public Item_str_func class Item_func_encode :public Item_str_func
{ {
protected:
SQL_CRYPT sql_crypt;
public: public:
Item_func_encode(Item *a, char *seed): Item_func_encode(Item *a, Item *seed):
Item_str_func(a),sql_crypt(seed) {} Item_str_func(a, seed) {}
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "encode"; } const char *func_name() const { return "encode"; }
...@@ -375,7 +373,7 @@ class Item_func_encode :public Item_str_func ...@@ -375,7 +373,7 @@ class Item_func_encode :public Item_str_func
class Item_func_decode :public Item_func_encode class Item_func_decode :public Item_func_encode
{ {
public: public:
Item_func_decode(Item *a, char *seed): Item_func_encode(a,seed) {} Item_func_decode(Item *a, Item *seed): Item_func_encode(a, seed) {}
String *val_str(String *); String *val_str(String *);
const char *func_name() const { return "decode"; } const char *func_name() const { return "decode"; }
}; };
...@@ -508,15 +506,9 @@ class Item_func_format :public Item_str_func ...@@ -508,15 +506,9 @@ class Item_func_format :public Item_str_func
{ {
String tmp_str; String tmp_str;
public: public:
Item_func_format(Item *org,int dec); Item_func_format(Item *org, Item *dec);
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() void fix_length_and_dec();
{
collation.set(default_charset());
uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
max_length= ((char_length + (char_length-args[0]->decimals)/3) *
collation.collation->mbmaxlen);
}
const char *func_name() const { return "format"; } const char *func_name() const { return "format"; }
void print(String *); void print(String *);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment