summaryrefslogtreecommitdiff
path: root/mysql-test/main/func_str.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/func_str.result')
-rw-r--r--mysql-test/main/func_str.result176
1 files changed, 175 insertions, 1 deletions
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index 8de7cbf679f..b912cfa7cd3 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -1,4 +1,3 @@
-drop table if exists t1,t2;
set @save_max_allowed_packet=@@global.max_allowed_packet;
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
@@ -5265,3 +5264,178 @@ f
#
# End of 10.4 tests
#
+#
+# MDEV-25704 Function random_bytes
+#
+create table t1 as select random_bytes(100);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `random_bytes(100)` varbinary(100) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+drop table t1;
+# The sequence starts at 17 so that the probability of test failure is small enough (about 2^(-136))
+select count(*) from seq_17_to_1024 where random_bytes(seq) <=> random_bytes(seq);
+count(*)
+0
+select count(*) from seq_1_to_1024 where length(random_bytes(seq)) = seq;
+count(*)
+1024
+select random_bytes(`0`),`1` from (values (0,1),(null,2),(0,3)) t1;
+random_bytes(`0`) 1
+ 1
+NULL 2
+ 3
+#
+# Test NULL output for NULL input
+#
+SELECT random_bytes(NULL);
+random_bytes(NULL)
+NULL
+#
+# Test For values outside range from 1 to 1024 return NULL
+#
+SELECT random_bytes(0);
+random_bytes(0)
+
+SELECT random_bytes(-1);
+random_bytes(-1)
+NULL
+SELECT random_bytes(-100);
+random_bytes(-100)
+NULL
+SELECT random_bytes(-26);
+random_bytes(-26)
+NULL
+SELECT random_bytes(-132);
+random_bytes(-132)
+NULL
+SELECT random_bytes(1025);
+random_bytes(1025)
+NULL
+SELECT random_bytes(11111);
+random_bytes(11111)
+NULL
+SELECT random_bytes(2056);
+random_bytes(2056)
+NULL
+SELECT length(random_bytes(10.0));
+length(random_bytes(10.0))
+10
+SELECT length(random_bytes(10.1));
+length(random_bytes(10.1))
+10
+SELECT length(random_bytes(+1e1));
+length(random_bytes(+1e1))
+10
+SELECT length(random_bytes(time("00:01")));
+length(random_bytes(time("00:01")))
+100
+SELECT length(random_bytes("10.0"));
+length(random_bytes("10.0"))
+10
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10.0'
+Warning 1292 Truncated incorrect INTEGER value: '10.0'
+SELECT length(random_bytes("10.1"));
+length(random_bytes("10.1"))
+10
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10.1'
+Warning 1292 Truncated incorrect INTEGER value: '10.1'
+SELECT length(random_bytes("+1e1"));
+length(random_bytes("+1e1"))
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '+1e1'
+Warning 1292 Truncated incorrect INTEGER value: '+1e1'
+SELECT length(random_bytes("10.0bunnies"));
+length(random_bytes("10.0bunnies"))
+10
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10.0bunnies'
+Warning 1292 Truncated incorrect INTEGER value: '10.0bunnies'
+SELECT length(random_bytes("10.1chickens"));
+length(random_bytes("10.1chickens"))
+10
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '10.1chickens'
+Warning 1292 Truncated incorrect INTEGER value: '10.1chickens'
+SELECT length(random_bytes("+1e1rabbits"));
+length(random_bytes("+1e1rabbits"))
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '+1e1rabbits'
+Warning 1292 Truncated incorrect INTEGER value: '+1e1rabbits'
+create procedure p1()
+begin
+declare r ROW (c1 INT);
+set r.c1= 10;
+select random_bytes(r);
+end|
+call p1();
+ERROR 21000: Operand should contain 1 column(s)
+drop procedure p1;
+#
+# Test For invalid argument return NULL
+#
+SELECT random_bytes('s');
+random_bytes('s')
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 's'
+Warning 1292 Truncated incorrect INTEGER value: 's'
+SELECT random_bytes('r');
+random_bytes('r')
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+SELECT random_bytes('res');
+random_bytes('res')
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'res'
+Warning 1292 Truncated incorrect INTEGER value: 'res'
+SELECT random_bytes('test');
+random_bytes('test')
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'test'
+Warning 1292 Truncated incorrect INTEGER value: 'test'
+#
+# MDEV-29108 RANDOM_BYTES - assertion in Create_tmp_table::finalize
+#
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (1),(2);
+SELECT RANDOM_BYTES(-10) f1, IFNULL(a,1) f2 FROM t GROUP BY f1, f2;
+f1 f2
+NULL 1
+NULL 2
+DROP TABLE t;
+#
+# MDEV-29154 Excessive warnings upon a call to RANDOM_BYTES
+#
+select length(random_bytes(cast('x' as unsigned)+1));
+length(random_bytes(cast('x' as unsigned)+1))
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+select repeat('.', cast('x' as unsigned)+1);
+repeat('.', cast('x' as unsigned)+1)
+.
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+#
+# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
+#
+select "a" in ("abc", (convert(random_bytes(8) ,binary(2))));
+"a" in ("abc", (convert(random_bytes(8) ,binary(2))))
+0
+Warnings:
+Warning 1292 Truncated incorrect BINARY(2) value: '...random bytes...'
+#
+# End of 10.10 tests
+#