• Gleb Shchepa's avatar
    Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws · 228c913e
    Gleb Shchepa authored
                an error
    
    Even after the fix for bug 28701 visible behaviors of
    SELECT FROM a view and SELECT FROM a regular table are
    little bit different:
    
    1. "SELECT FROM regular table USE/FORCE/IGNORE(non
       existent index)" fails with a "ERROR 1176 (HY000):
       Key '...' doesn't exist in table '...'"
    
    2. "SELECT FROM view USING/FORCE/IGNORE(any index)" fails
       with a "ERROR 1221 (HY000): Incorrect usage of
       USE/IGNORE INDEX and VIEW".  OTOH "SHOW INDEX FROM
       view" always returns empty result set, so from the point
       of same behaviour view we trying to use/ignore non
       existent index.
    
    To harmonize the behaviour of USE/FORCE/IGNORE(index)
    clauses in SELECT from a view and from a regular table the
    "ERROR 1221 (HY000): Incorrect usage of USE/IGNORE INDEX
    and VIEW" message has been replaced with the "ERROR 1176
    (HY000): Key '...' doesn't exist in table '...'" message
    like for tables and non existent keys.
    228c913e
view.result 108 KB