Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2349 05/07/20 16:48:29 gluh@stripped +5 -0
Bug #6172 RAND(a) should only accept constant values as arguments
Argument of RAND function can be constant value only
sql/item_func.cc
1.256 05/07/20 16:47:49 gluh@stripped +7 -0
Bug #6172 RAND(a) should only accept constant values as arguments
Argument of RAND function can be constant value only
mysql-test/t/ps.test
1.42 05/07/20 16:47:49 gluh@stripped +1 -3
Bug #6172 RAND(a) should only accept constant values as arguments
Argument of RAND function can be constant value only
mysql-test/t/func_math.test
1.15 05/07/20 16:47:49 gluh@stripped +9 -0
Bug #6172 RAND(a) should only accept constant values as arguments
Argument of RAND function can be constant value only
mysql-test/r/ps.result
1.42 05/07/20 16:47:49 gluh@stripped +21 -23
Bug #6172 RAND(a) should only accept constant values as arguments
Argument of RAND function can be constant value only
mysql-test/r/func_math.result
1.23 05/07/20 16:47:49 gluh@stripped +5 -0
Bug #6172 RAND(a) should only accept constant values as arguments
Argument of RAND function can be constant value only
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gluh
# Host: eagle.intranet.mysql.r18.ru
# Root: /home/gluh/MySQL/Bugs/4.1.6172
--- 1.255/sql/item_func.cc Tue Jul 19 21:24:59 2005
+++ 1.256/sql/item_func.cc Wed Jul 20 16:47:49 2005
@@ -1203,6 +1203,13 @@
used_tables_cache|= RAND_TABLE_BIT;
if (arg_count)
{ // Only use argument once in query
+ if (!args[0]->const_item() && args[0]->type() != PARAM_ITEM)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "Argument of RAND function can be constant value only",
+ MYF(0));
+ return TRUE;
+ }
/*
Allocate rand structure once: we must use thd->current_arena
to create rand in proper mem_root if it's a prepared statement or
--- 1.22/mysql-test/r/func_math.result Tue Apr 19 14:44:50 2005
+++ 1.23/mysql-test/r/func_math.result Wed Jul 20 16:47:49 2005
@@ -137,3 +137,8 @@
round(1, 6)
1.000000
drop table t1;
+create table t1 (i int, j int);
+insert into t1 values (1,1);
+select rand(i) from t1;
+ERROR HY000: Argument of RAND function can be constant value only
+drop table t1;
--- 1.14/mysql-test/t/func_math.test Tue Apr 19 14:44:50 2005
+++ 1.15/mysql-test/t/func_math.test Wed Jul 20 16:47:49 2005
@@ -71,3 +71,12 @@
show create table t1;
select * from t1;
drop table t1;
+
+#
+# Bug #6172 RAND(a) should only accept constant values as arguments
+#
+create table t1 (i int, j int);
+insert into t1 values (1,1);
+--error 1105
+select rand(i) from t1;
+drop table t1;
--- 1.41/mysql-test/r/ps.result Sat Jul 16 00:43:48 2005
+++ 1.42/mysql-test/r/ps.result Wed Jul 20 16:47:49 2005
@@ -334,39 +334,37 @@
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;
--- 1.41/mysql-test/t/ps.test Sat Jul 16 00:43:48 2005
+++ 1.42/mysql-test/t/ps.test Wed Jul 20 16:47:49 2005
@@ -368,12 +368,10 @@
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 -
| Thread |
|---|
| • bk commit into 4.1 tree (gluh:1.2349) BUG#6172 | gluh | 20 Jul |