• MySQL Build Team's avatar
    Backport into build-201003230706-5.1.43sp1 · 8df65c85
    MySQL Build Team authored
    > ------------------------------------------------------------
    > revno: 3324
    > revision-id: joro@sun.com-20091223151122-ada73up1yydh0emt
    > parent: joro@sun.com-20100119124841-38vva51cuq3if7dc
    > committer: Georgi Kodinov <joro@sun.com>
    > branch nick: B49512-5.1-bugteam
    > timestamp: Wed 2009-12-23 17:11:22 +0200
    > message:
    >   Bug #49512 : subquery with aggregate function crash
    >     subselect_single_select_engine::exec()
    >   
    >   When a subquery doesn't need to be evaluated because
    >   it returns only aggregate functions and these aggregates
    >   can be calculated from the metadata about the table it
    >   was not updating all the relevant members of the JOIN 
    >   structure to reflect that this is a constant query.
    >   This caused problems to the enclosing subquery 
    >   ('<> SOME' in the test case above) trying to read some
    >   data about the tables.
    >   
    >   Fixed by setting const_tables to the number of tables 
    >   when the SELECT is optimized away.
    8df65c85
subselect.test 126 KB