Skip to content
  • Karthik Kamath's avatar
    e21b2414
    BUG#23221336: STORED ROUTINES - USER VARIABLE WOES WITH · e21b2414
    Karthik Kamath authored
                  CURSOR + SELECT INTO ..
    
    ANALYSIS:
    =========
    While executing a stored program, a debug assert is
    triggered for a SELECT query if the derived table resolving
    failed for the previous sub-statement of the stored
    program.
    In non-debug build, execution of the statement in such a
    scenario will yield unexpected result.
    
    TABLE has a bitmap read_set. A bit in this bitmap is set
    for a field of a table used in the query. But this bitmap
    is not set (for outer-most query block) while resolving
    derived tables. A flag THD::derived_tables_processing is
    used to indicate the derived table processing.
    
    In case of a stored program, if the derived table resolving
    fails then the flag THD::derived_tables_processing is not
    reset for the stored program statement. Due to this,
    read_set of TABLE is not set during the execution of next
    stored program statement. Hence an assert condition that
    checks for the state of read_set fails.
    
    In non-debug builds, the second SELECT query execution
    completes but returns wrong result set.
    
    FIX:
    ====
    THD::derived_tables_processing flag is now reset before
    execution of each sub-statement in the stored program.
    
    Change-Id: I84bc5d8b509d341ca7c58d12241992672135b6bf
    e21b2414
    BUG#23221336: STORED ROUTINES - USER VARIABLE WOES WITH
    Karthik Kamath authored
                  CURSOR + SELECT INTO ..
    
    ANALYSIS:
    =========
    While executing a stored program, a debug assert is
    triggered for a SELECT query if the derived table resolving
    failed for the previous sub-statement of the stored
    program.
    In non-debug build, execution of the statement in such a
    scenario will yield unexpected result.
    
    TABLE has a bitmap read_set. A bit in this bitmap is set
    for a field of a table used in the query. But this bitmap
    is not set (for outer-most query block) while resolving
    derived tables. A flag THD::derived_tables_processing is
    used to indicate the derived table processing.
    
    In case of a stored program, if the derived table resolving
    fails then the flag THD::derived_tables_processing is not
    reset for the stored program statement. Due to this,
    read_set of TABLE is not set during the execution of next
    stored program statement. Hence an assert condition that
    checks for the state of read_set fails.
    
    In non-debug builds, the second SELECT query execution
    completes but returns wrong result set.
    
    FIX:
    ====
    THD::derived_tables_processing flag is now reset before
    execution of each sub-statement in the stored program.
    
    Change-Id: I84bc5d8b509d341ca7c58d12241992672135b6bf
Loading