diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2007-01-23 19:45:58 +0200 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2007-01-23 19:45:58 +0200 |
commit | 12b1f460f85661dfab7aa4c32e177e68168c5757 (patch) | |
tree | 9b9ca4040693883a9177bf4489f327106dd22c98 /sql/item_func.h | |
parent | 362ad4da5b4aabe4f0d2e6ba5ad19850e814f5c7 (diff) | |
download | mariadb-git-12b1f460f85661dfab7aa4c32e177e68168c5757.tar.gz |
Bug #6172: RAND(a) should only accept constant values as arguments
RAND() must accept scalar expressions regardless of their kind.
That includes both constant expressions and expressions that
depend on column values.
When the expression is constant the random seed can be initialized
at compile time.
However when the expression is not constant the random seed must be
initialized at each invocation (while it still can be allocated at
compile time).
Implemented the above rules by extending Item_func_rand::val_real()
to initialize the random seed at the correct place.
mysql-test/r/func_math.result:
Bug #6172: RAND(a) should only accept constant values as arguments
- extened the test case
mysql-test/t/func_math.test:
Bug #6172: RAND(a) should only accept constant values as arguments
- extened the test case
sql/item_func.cc:
Bug #6172: RAND(a) should only accept constant values as arguments
- allow specifying non-const expressions as RAND() arguments
sql/item_func.h:
Bug #6172: RAND(a) should only accept constant values as arguments
- allow specifying non-const expressions as RAND() arguments
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 7810c0ce9a9..3306b059097 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -679,6 +679,8 @@ public: bool const_item() const { return 0; } void update_used_tables(); bool fix_fields(THD *thd, Item **ref); +private: + void seed_random (Item * val); }; |