• Georgi Kodinov's avatar
    Bug #32124: crash if prepared statements refer to variables in the where clause · 489ad44a
    Georgi Kodinov authored
                      
    The code to get read the value of a system variable was extracting its value 
    on PREPARE stage and was substituting the value (as a constant) into the parse tree.
    Note that this must be a reversible transformation, i.e. it must be reversed before
    each re-execution.
    Unfortunately this cannot be reliably done using the current code, because there are
    other non-reversible source tree transformations that can interfere with this
    reversible transformation.
    Fixed by not resolving the value at PREPARE, but at EXECUTE (as the rest of the 
    functions operate). Added a cache of the value (so that it's constant throughout
    the execution of the query). Note that the cache also caches NULL values.
    Updated an obsolete related test suite (variables-big) and the code to test the 
    result type of system variables (as per bug 74).
    489ad44a
item.cc 198 KB