• unknown's avatar
    Fix for bug#15153 "CONVERT_TZ() is not allowed in all places in VIEWs". · fed9d199
    unknown authored
    Error was emitted when one tried to select information from view which used
    merge algorithm and which also had CONVERT_TZ() function in its select list.
    
    This bug was caused by wrong assumption that global table list for view
    which is handled using merge algorithm begins from tables belonging to
    the main select of this view. Nowadays the above assumption is not true only
    when one uses convert_tz() function in view's select list, but in future
    other cases may be added (for example we may support merging of views
    with subqueries in select list one day). Relying on this false assumption
    led to the usage of wrong table list for field lookups and therefor errors. 
    
    With this fix we explicitly use pointer to the beginning of main select's
    table list.
    
    
    mysql-test/r/timezone_grant.result:
      Added additional test case for bug#15153 "CONVERT_TZ() is not allowed in
      all places in VIEWs" that checks that usage of CONVERT_TZ() function in view
      does not require additional privileges.
    mysql-test/r/view.result:
      Added test case for bug#15153 "CONVERT_TZ() is not allowed in all places in 
      VIEWs".
    mysql-test/t/timezone_grant.test:
      Added additional test case for bug#15153 "CONVERT_TZ() is not allowed in
      all places in VIEWs" that checks that usage of CONVERT_TZ() function in view
      does not require additional privileges.
    mysql-test/t/view.test:
      Added test case for bug#15153 "CONVERT_TZ() is not allowed in all places in 
      VIEWs".
    sql/sql_view.cc:
      mysql_make_view():
        We should not assume that global table list for view which is handled using
        merge algorithm begins from tables belonging to the main select of this
        view. Nowadays the above assumption is not true only when one uses
        convert_tz() function in view's select list, but in future other cases
        may be added (for example we may support merging of views with subqueries
        in select list one day). So let us instead explicitly use pointer to the
        beginning of main select's table list.
    fed9d199
sql_view.cc 47.8 KB