• unknown's avatar
    Bug #6172: RAND(a) should only accept constant values as arguments · d74a7b9d
    unknown authored
     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
    d74a7b9d
item_func.cc 129 KB