From 0caa6bf14e56ffe5da41c5cc41f461ddef8dcc1c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 27 Jul 2022 17:46:49 +0200 Subject: [PATCH] MDEV-25704 more tests --- mysql-test/main/func_str.result | 57 +++++++++++++++++++++++++++++++++ mysql-test/main/func_str.test | 23 +++++++++++++ 2 files changed, 80 insertions(+) diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 2ac38f4f4da..a9077eb2e00 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -5320,6 +5320,63 @@ 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 # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index e27e042d3dc..1d051045637 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -2229,6 +2229,29 @@ SELECT random_bytes(1025); SELECT random_bytes(11111); SELECT random_bytes(2056); +SELECT length(random_bytes(10.0)); +SELECT length(random_bytes(10.1)); +SELECT length(random_bytes(+1e1)); +SELECT length(random_bytes(time("00:01"))); +SELECT length(random_bytes("10.0")); +SELECT length(random_bytes("10.1")); +SELECT length(random_bytes("+1e1")); +SELECT length(random_bytes("10.0bunnies")); +SELECT length(random_bytes("10.1chickens")); +SELECT length(random_bytes("+1e1rabbits")); + +--delimiter | +create procedure p1() +begin + declare r ROW (c1 INT); + set r.c1= 10; + select random_bytes(r); +end| +--delimiter ; +--error 1241 +call p1(); +drop procedure p1; + --echo # --echo # Test For invalid argument return NULL --echo #