summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-09-06 20:51:15 +0300
committerunknown <bell@sanja.is.com.ua>2005-09-06 20:51:15 +0300
commit5618d0217ec3fce5793bb3891bf4ce2ede8b3a10 (patch)
tree198b1f598b6fe14dd90b06b1ba4fa81f66ea2aea /mysql-test
parent9e7a1bb2b019a1a8048bc9ef8cdf00fcc255d812 (diff)
parent9d14671fc9c484f8fbcd11d509335eaf9e7d089e (diff)
downloadmariadb-git-5618d0217ec3fce5793bb3891bf4ce2ede8b3a10.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-mrg-5.0 configure.in: Auto merged mysql-test/r/func_math.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/t/func_math.test: Auto merged mysql-test/t/ps.test: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_cache.h: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_math.result5
-rw-r--r--mysql-test/r/ps.result44
-rw-r--r--mysql-test/t/func_math.test9
-rw-r--r--mysql-test/t/ps.test4
4 files changed, 36 insertions, 26 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 0149911e36b..5b6c29f87fb 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -165,3 +165,8 @@ drop table t1;
select abs(-2) * -2;
abs(-2) * -2
-4
+create table t1 (i int);
+insert into t1 values (1);
+select rand(i) from t1;
+ERROR HY000: Incorrect arguments to RAND
+drop table t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 0050dfc0841..dc78f8d04ea 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -335,39 +335,37 @@ create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4);
set @precision=10000000000;
select rand(),
-cast(rand(10)*@precision as unsigned integer),
-cast(rand(a)*@precision as unsigned integer) from t1;
-rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer)
-- 6570515219 -
-- 1282061302 -
-- 6698761160 -
-- 9647622201 -
+cast(rand(10)*@precision as unsigned integer) from t1;
+rand() cast(rand(10)*@precision as unsigned integer)
+- 6570515219
+- 1282061302
+- 6698761160
+- 9647622201
prepare stmt from
"select rand(),
cast(rand(10)*@precision as unsigned integer),
- cast(rand(a)*@precision as unsigned integer),
cast(rand(?)*@precision as unsigned integer) from t1";
set @var=1;
execute stmt using @var;
-rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
-- 6570515219 - 4054035371
-- 1282061302 - 8716141803
-- 6698761160 - 1418603212
-- 9647622201 - 944590960
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 -
+- 1282061302 -
+- 6698761160 -
+- 9647622201 -
set @var=2;
execute stmt using @var;
-rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
-- 6570515219 1559528654 6555866465
-- 1282061302 6238114970 1223466192
-- 6698761160 6511989195 6449731873
-- 9647622201 3845601374 8578261098
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 6555866465
+- 1282061302 1223466192
+- 6698761160 6449731873
+- 9647622201 8578261098
set @var=3;
execute stmt using @var;
-rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
-- 6570515219 1559528654 9057697559
-- 1282061302 6238114970 3730790581
-- 6698761160 6511989195 1480860534
-- 9647622201 3845601374 6211931236
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 9057697559
+- 1282061302 3730790581
+- 6698761160 1480860534
+- 9647622201 6211931236
drop table t1;
deallocate prepare stmt;
create database mysqltest1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index bf692325a6a..633e36f51ab 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -107,4 +107,13 @@ drop table t1;
#
select abs(-2) * -2;
+#
+# Bug #6172 RAND(a) should only accept constant values as arguments
+#
+create table t1 (i int);
+insert into t1 values (1);
+--error 1210
+select rand(i) from t1;
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index b4c04e4432a..94596fbbc0e 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -371,12 +371,10 @@ insert into t1 (a) values (1), (2), (3), (4);
set @precision=10000000000;
--replace_column 1 - 3 -
select rand(),
- cast(rand(10)*@precision as unsigned integer),
- cast(rand(a)*@precision as unsigned integer) from t1;
+ cast(rand(10)*@precision as unsigned integer) from t1;
prepare stmt from
"select rand(),
cast(rand(10)*@precision as unsigned integer),
- cast(rand(a)*@precision as unsigned integer),
cast(rand(?)*@precision as unsigned integer) from t1";
set @var=1;
--replace_column 1 - 3 -