An error occurred fetching the project authors.
  1. 05 Mar, 2011 1 commit
    • Sergey Petrunya's avatar
      BUG#727667 Wrong result with OR + NOT NULL in maria-5.3 · 6aae42a3
      Sergey Petrunya authored
      - put the code that sets HA_NULL_PART bit back
      - Fix test_if_ref/part_of_refkey() so that 
        = NULL-ability of lookup columns does not prevent the equality 
          from being removed (we now have early/late NULLs filtering which 
          will filter out NULL values)
        = equality is not removed if it is ref_or_null access, and the value 
          of the lookup column can alternate between the lookup value and NULL.
      6aae42a3
  2. 13 Jan, 2011 1 commit
    • Sergey Petrunya's avatar
      Backport of (see below) + temporary measures to make SJ-Materialization work with join buffering. · ed2e3dae
      Sergey Petrunya authored
      Date: Mon, 01 Nov 2010 15:15:25 -0000
      3272 Roy Lyseng        2010-11-01
      Bug#52068: Optimizer generates invalid semijoin materialization plan
      
      When MaterializeScan semijoin strategy was used and there were one
      or more outer dependent tables before the semijoin tables, the scan
      over the materialized table was not properly reset for each row of
      the prefix outer tables.
      
      Example: suppose we have a join order:
      
        ot1 SJ-Mat-Scan(it2 it3)  ot4
      
      Notice that this is called a MaterializeScan, even though there is an
      outer table ahead of the materialized tables. Usually a MaterializeScan
      has the outer tables after the materialized table, but this is
      a special (but legal) case with outer dependent tables both before and
      after the materialized table.
      
      For each qualifying row from ot1, a new scan over the materialized
      table must be set up. The code failed to do that, so all scans after
      the first one returned zero rows from the materialized table.
      ed2e3dae
  3. 03 Nov, 2010 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #664594 and other bugs leading to invalid execution · 3d8c7a2c
      Igor Babaev authored
      plans or wrong results due to the fact that JOIN_CACHE functions
      ignored the possibility of interleaving materialized semijoin 
      tables with tables whose records were stored in join buffers.
      This fixes would become mostly unnecessary if the new code of
      mwl 90 was merged into 5.3 right now.
      Yet the fix the code of optimize_wo_join_buffering was needed
      in any case.
      
      3d8c7a2c
  4. 18 Oct, 2010 2 commits
  5. 12 Oct, 2010 1 commit
  6. 28 Sep, 2010 1 commit
    • Igor Babaev's avatar
      Fixed bug #52636. · ad4271d0
      Igor Babaev authored
      Applied the fix for bug #47217 from the mysql-6.0 codebase.
      The patch adds not null predicates generated for the left parts
      of the equality predicates used for ref accesses. This is done
      for such predicates both in where conditions and on conditions.
      For the where conditions the not null predicates were generated
      but in 5.0/5.1 they actually never were used due to some lame
      merge from 4.1 to 5.0. The fix for bug #47217 made these 
      predicates to be used in the condition pushed to the tables.
      Yet only this patch generates not null predicates for equality
      predicated from on conditions of outer joins.
      This patch introduces a performance regression that can be
      observed on a test case from null_key.test. The regression
      will disappear after the fix for bug #57024 from mariadb-5.1
      is pulled into mariadb-5.3.
      The patch contains many changes in the outputs of the EXPLAIN 
      commands since generated not null predicates are considered as
      parts of the conditions pushed to join tables and may add
      'Usingwhere' in some rows of EXPLAINs where there used
      to be no such comments.
      ad4271d0
  7. 06 Sep, 2010 1 commit
    • unknown's avatar
      Fixed LP BUG#615760: Check on double cache assignment added into the transformation methods. · db43b21c
      unknown authored
      Cache parameters print added in EXPLAIN EXTENDED output.
      
      mysql-test/r/compare.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/group_by.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect3.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect3_jcl6.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect4.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_cache.result:
        Added test suite for LP BUG#615760
      mysql-test/r/subselect_mat.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_mat.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_opts.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_semijoin.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj_jcl6.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/suite/pbxt/r/subselect.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/t/subselect_cache.test:
        Cache parameters print added in EXPLAIN EXTENDED output.
      sql/item.cc:
        Item::set_expr_cache result fixed according to its description.
        
        Cache parameters print added in EXPLAIN EXTENDED output.
      sql/item.h:
        Cache parameters print added in EXPLAIN EXTENDED output.
      sql/item_cmpfunc.cc:
        Check on double cache assignment added into the transformation methods.
      sql/item_cmpfunc.h:
        Check on double cache assignment added into the transformation methods.
      sql/item_subselect.cc:
        Check on double cache assignment added into the transformation methods.
      sql/item_subselect.h:
        Check on double cache assignment added into the transformation methods.
      sql/sql_expression_cache.cc:
        Cache parameters print added.
      sql/sql_expression_cache.h:
        Cache parameters print added.
      sql/sql_select.cc:
        Removed unused method (now it is impossible to make double transformation with the cache).
      sql/sql_select.h:
        Removed unused method.
      db43b21c
  8. 31 Aug, 2010 1 commit
    • unknown's avatar
      LP BUG#615752 fix. Expression cache added to EXPLAIN EXTENDED output. · 422f834f
      unknown authored
      mysql-test/r/compare.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/explain.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/group_by.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect3.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect3_jcl6.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect4.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_mat.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_mat.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_opts.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_semijoin.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj_jcl6.result:
        Expression cache added to EXPLAIN EXTENDED output.
      sql/item.h:
        Expression cache added to EXPLAIN EXTENDED output.
      422f834f
  9. 16 Jul, 2010 1 commit
    • Sergey Petrunya's avatar
      Fix @@optimizer_switch support · aed88ae2
      Sergey Petrunya authored
      - Let "mysqld  --help --verbose" list all optimizer options
      - Make it possible to add new @@optimizer_switch flags w/o causing .result 
        changes all over the testsuite:
        = Remove "select @@optimizer_switch" from tests that do not need all switches
        = Move @@optimizer_switch-specific tests to t/optimizer_switch.test
      aed88ae2
  10. 10 Jul, 2010 1 commit
    • unknown's avatar
      Subquery cache (MWL#66) added. · ea1b32a3
      unknown authored
      libmysqld/Makefile.am:
        The new file added.
      mysql-test/r/index_merge_myisam.result:
        subquery_cache optimization option added.
      mysql-test/r/myisam_mrr.result:
        subquery_cache optimization option added.
      mysql-test/r/subquery_cache.result:
        The subquery cache tests added.
      mysql-test/r/subselect3.result:
        Subquery cache switched off to avoid changing read statistics.
      mysql-test/r/subselect3_jcl6.result:
        Subquery cache switched off to avoid changing read statistics.
      mysql-test/r/subselect_no_mat.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_no_opts.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_no_semijoin.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_sj.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_sj_jcl6.result:
        subquery_cache optimization option added.
      mysql-test/t/subquery_cache.test:
        The subquery cache tests added.
      mysql-test/t/subselect3.test:
        Subquery cache switched off to avoid changing read statistics.
      sql/CMakeLists.txt:
        The new file added.
      sql/Makefile.am:
        The new files added.
      sql/item.cc:
        Expression cache item (Item_cache_wrapper) added.
        Item_ref and Item_field fixed for correct usage of result field and fast resolwing in SP.
      sql/item.h:
        Expression cache item (Item_cache_wrapper) added.
        Item_ref and Item_field fixed for correct usage of result field and fast resolwing in SP.
      sql/item_cmpfunc.cc:
        Subquery cache added.
      sql/item_cmpfunc.h:
        Subquery cache added.
      sql/item_subselect.cc:
        Subquery cache added.
      sql/item_subselect.h:
        Subquery cache added.
      sql/item_sum.cc:
        Registration of subquery parameters added.
      sql/mysql_priv.h:
        subquery_cache optimization option added.
      sql/mysqld.cc:
        subquery_cache optimization option added.
      sql/opt_range.cc:
        Fix due to subquery cache.
      sql/opt_subselect.cc:
        Parameters of the function cahnged.
      sql/procedure.h:
        .h file guard added.
      sql/sql_base.cc:
        Registration of subquery parameters added.
      sql/sql_class.cc:
        Option to allow add indeces to temporary table.
      sql/sql_class.h:
        Item iterators added.
        Option to allow add indeces to temporary table.
      sql/sql_expression_cache.cc:
        Expression cache for caching subqueries added.
      sql/sql_expression_cache.h:
        Expression cache for caching subqueries added.
      sql/sql_lex.cc:
        Registration of subquery parameters added.
      sql/sql_lex.h:
        Registration of subqueries and subquery parameters added.
      sql/sql_select.cc:
        Subquery cache added.
      sql/sql_select.h:
        Subquery cache added.
      sql/sql_union.cc:
        A new parameter to the function added.
      sql/sql_update.cc:
        A new parameter to the function added.
      sql/table.cc:
        Procedures to manage temporarty tables index added.
      sql/table.h:
        Procedures to manage temporarty tables index added.
      storage/maria/ha_maria.cc:
        Fix of handler to allow destoy a table in case of error during the table creation.
      storage/maria/ha_maria.h:
        .h file guard added.
      storage/myisam/ha_myisam.cc:
        Fix of handler to allow destoy a table in case of error during the table creation.
      ea1b32a3
  11. 26 Jun, 2010 1 commit
  12. 11 Mar, 2010 1 commit
    • unknown's avatar
      MWL#68 Subquery optimization: Efficient NOT IN execution with NULLs · be4b955f
      unknown authored
      This patch does three things:
      - It adds the possibility to force the execution of top-level [NOT] IN
        subquery predicates via the IN=>EXISTS transformation. This is done by
        setting both optimizer switches partial_match_rowid_merge and
        partial_match_table_scan to "off".
      - It adjusts all test cases where the complete optimizer_switch is
        selected because now we have two more switches.
      - For those test cases where the plan changes because of the new available
        strategies, we switch off both partial match strategies in order to
        force the "old" IN=>EXISTS strategy. This is done because most of these
        test cases specifically test bugs in this strategy.
      
      sql/opt_subselect.cc:
        Adds the possibility to force the execution of top-level [NOT] IN
        subquery predicates via the IN=>EXISTS transformation. This is done by
        setting both optimizer switches partial_match_rowid_merge and
        partial_match_table_scan to "off".
      be4b955f
  13. 21 Feb, 2010 1 commit
  14. 17 Feb, 2010 2 commits
  15. 17 Jan, 2010 2 commits
  16. 23 Dec, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #49512 : subquery with aggregate function crash · ff8f4517
      Georgi Kodinov authored
        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.
      ff8f4517
  17. 19 Jan, 2010 1 commit
  18. 18 Jan, 2010 1 commit
  19. 02 Feb, 2010 1 commit
  20. 15 Dec, 2009 3 commits
    • Georgi Kodinov's avatar
      Bug #48709: Assertion failed in sql_select.cc:11782: · 4a41e5b1
      Georgi Kodinov authored
       int join_read_key(JOIN_TAB*)
      
      The eq_ref access method TABLE_REF (accessed through 
      JOIN_TAB) to save state and to track if this is the 
      first row it finds or not.
      This state was not reset on subquery re-execution
      causing an assert.
      
      Fixed by resetting the state before the subquery 
      re-execution.
      4a41e5b1
    • Georgi Kodinov's avatar
      Bug #48709: Assertion failed in sql_select.cc:11782: · c94fdc7e
      Georgi Kodinov authored
       int join_read_key(JOIN_TAB*)
      
      The eq_ref access method TABLE_REF (accessed through 
      JOIN_TAB) to save state and to track if this is the 
      first row it finds or not.
      This state was not reset on subquery re-execution
      causing an assert.
      
      Fixed by resetting the state before the subquery 
      re-execution.
      c94fdc7e
    • Sergey Petrunya's avatar
      Backport into MariaDB-5.2 the following: · 3bb037aa
      Sergey Petrunya authored
      WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
      WL#2475 "Batched range read functions for MyISAM/InnoDb"
              "Index condition pushdown for MyISAM/InnoDB"
      Igor's fix from sp1r-igor@olga.mysql.com-20080330055902-07614:
        There could be observed the following problems:
        1. EXPLAIN did not mention pushdown conditions from on expressions in the 
        'extra' column.  As a result if a query had no where conditions pushed 
        down to a table, but had on conditions pushed to this table the 'extra' 
        column in the EXPLAIN for the table missed 'using where'.
        2. Conditions for ref access were not eliminated from on expressions 
        though such conditions were eliminated from the where condition.
      3bb037aa
  21. 25 Nov, 2009 2 commits
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · 107549a3
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3181
      > revision-id: alexey.kopytov@sun.com-20091016201951-fsht0wm8xn8vkzsx
      > parent: joerg@mysql.com-20091016164025-kb4sbrggq5o7zufc
      > committer: Alexey Kopytov <Alexey.Kopytov@Sun.com>
      > branch nick: mysql-5.1-bugteam
      > timestamp: Sat 2009-10-17 00:19:51 +0400
      > message:
      >   Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN 
      >    
      >   The problem was in incorrect handling of predicates involving 
      >   NULL as a constant value by the range optimizer. 
      >    
      >   For example, when creating a SEL_ARG node from a condition of 
      >   the form "field < const" (which would normally result in the 
      >   "NULL < field < const" SEL_ARG),  the special case when "const" 
      >   is NULL was not taken into account, so "NULL < field < NULL" 
      >   was produced for the "field < NULL" condition. 
      >    
      >   As a result, SEL_ARG structures of this form could not be 
      >   further optimized which in turn could lead to incorrectly 
      >   constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
      >   structures to always form a sequence of ordered disjoint 
      >   intervals could enter an infinite loop under some 
      >   circumstances. 
      >    
      >   Fixed by changing get_mm_leaf() so that for any sargable 
      >   predicate except "<=>" involving NULL as a constant, "empty" 
      >   SEL_ARG is returned, since such a predicate is always false. 
      107549a3
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · c14bf1ca
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 1810.3961.6
      > revision-id: joro@sun.com-20091030094044-quadg0bwjy7cwqzw
      > parent: joro@sun.com-20091029152429-ks55fhrp4lhknyij
      > committer: Georgi Kodinov <joro@sun.com>
      > branch nick: B48293-5.0-bugteam
      > timestamp: Fri 2009-10-30 11:40:44 +0200
      > message:
      >   Bug #48293: crash with procedure analyse, view with > 10 columns,
      >   having clause...
      >   
      >   The fix for bug 46184 was not very complete. It was not covering
      >   views using temporary tables and multiple tables in a FROM clause.
      >   Fixed by reverting the fix for 46184 and making a more general
      >   check that is checking at the right execution stage and for all
      >   of the non-supported cases.
      >   Now PROCEDURE ANALYZE on non-top level SELECT is also forbidden.
      >   Updated the analyse.test and subselect.test accordingly.
      c14bf1ca
  22. 03 Nov, 2009 1 commit
  23. 30 Oct, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #48293: crash with procedure analyse, view with > 10 columns, · fc80944c
      Georgi Kodinov authored
      having clause...
      
      The fix for bug 46184 was not very complete. It was not covering
      views using temporary tables and multiple tables in a FROM clause.
      Fixed by reverting the fix for 46184 and making a more general
      check that is checking at the right execution stage and for all
      of the non-supported cases.
      Now PROCEDURE ANALYZE on non-top level SELECT is also forbidden.
      Updated the analyse.test and subselect.test accordingly.
      fc80944c
  24. 16 Oct, 2009 1 commit
    • Alexey Kopytov's avatar
      Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN · 62007189
      Alexey Kopytov authored
       
      The problem was in incorrect handling of predicates involving 
      NULL as a constant value by the range optimizer. 
       
      For example, when creating a SEL_ARG node from a condition of 
      the form "field < const" (which would normally result in the 
      "NULL < field < const" SEL_ARG),  the special case when "const" 
      is NULL was not taken into account, so "NULL < field < NULL" 
      was produced for the "field < NULL" condition. 
       
      As a result, SEL_ARG structures of this form could not be 
      further optimized which in turn could lead to incorrectly 
      constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
      structures to always form a sequence of ordered disjoint 
      intervals could enter an infinite loop under some 
      circumstances. 
       
      Fixed by changing get_mm_leaf() so that for any sargable 
      predicate except "<=>" involving NULL as a constant, "empty" 
      SEL_ARG is returned, since such a predicate is always false. 
      
      mysql-test/r/partition_pruning.result:
        Fixed a broken test case.
      mysql-test/r/range.result:
        Added a test case for bug #47123.
      mysql-test/r/subselect.result:
        Fixed a broken test cases.
      mysql-test/t/range.test:
        Added a test case for bug #47123.
      sql/opt_range.cc:
        Fixed get_mm_leaf() so that for any sargable
        predicate except "<=>" involving NULL as a constant, "empty"
        SEL_ARG is returned, since such a predicate is always false.
      62007189
  25. 30 Sep, 2009 2 commits
    • MySQL Build Team's avatar
      Backport into build-200909301147-5.0.84sp1 · 51d041e6
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 2796
      > revision-id: sergey.glukhov@sun.com-20090827102219-sgjz0v5t1rfccs14
      > parent: joro@sun.com-20090824122803-1d5jlaysjc7a7j6q
      > committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
      > branch nick: mysql-5.0-bugteam
      > timestamp: Thu 2009-08-27 15:22:19 +0500
      > message:
      >   Bug#46184 Crash, SELECT ... FROM derived table procedure analyze
      >   The crash happens because select_union object is used as result set
      >   for queries which have derived tables.
      >   select_union use temporary table as data storage and if
      >   fields count exceeds 10(count of values for procedure ANALYSE())
      >   then we get a crash on fill_record() function.
      51d041e6
    • MySQL Build Team's avatar
      Backport into build-200909301147-5.0.84sp1 · eb488ba6
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 2791.2.3
      > revision-id: joro@sun.com-20090827114042-h55n7qp9990bl6ge
      > parent: anurag.shekhar@sun.com-20090831073231-e55y1hsck6n08ux8
      > committer: Georgi Kodinov <joro@sun.com>
      > branch nick: B46749-5.0-bugteam
      > timestamp: Thu 2009-08-27 14:40:42 +0300
      > message:
      >   Bug #46749: Segfault in add_key_fields() with outer subquery level 
      >     field references
      >   
      >   This error requires a combination of factors : 
      >   1. An "impossible where" in the outermost SELECT
      >   2. An aggregate in the outermost SELECT
      >   3. A correlated subquery with a WHERE clause that includes an outer 
      >   field reference as a top level WHERE sargable predicate
      >   
      >   When JOIN::optimize detects an "impossible WHERE" it will bail out
      >   without doing the rest of the work and initializations. It will not
      >   call make_join_statistics() as well.  And make_join_statistics fills 
      >   in various structures for each table referenced.
      >   When processing the result of the "impossible WHERE" the query must
      >   send a single row of data if there are aggregate functions in it.
      >   In this case the server marks all the aggregates as having received 
      >   no rows and calls the relevant Item::val_xxx() method on the SELECT
      >   list. However if this SELECT list happens to contain a correlated 
      >   subquery this subquery is evaluated in a normal evaluation mode.
      >   And if this correlated subquery has a reference to a field from the 
      >   outermost "impossible where" SELECT the add_key_fields will mistakenly
      >   consider the outer field reference as a "local" field reference when 
      >   looking for sargable predicates.
      >   But since the SELECT where the outer field reference refers to is not
      >   completely initialized due to the "impossible WHERE" in this level
      >   we'll get a NULL pointer reference.
      >   Fixed by making a better condition for discovering if a field is "local"
      >   to the SELECT level being processed. 
      >   It's not enough to look for OUTER_REF_TABLE_BIT in this case since 
      >   for outer references to constant tables the Item_field::used_tables() 
      >   will return 0 regardless of whether the field reference is from the 
      >   local SELECT or not.
      eb488ba6
  26. 22 Sep, 2009 2 commits
    • MySQL Build Team's avatar
      Backport into build-200909221805-5.1.37sp1 · 460c6c97
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3092.1.2 [merge]
      > revision-id: joro@sun.com-20090831134035-wndnw04gy8kzogpm
      > parent: anurag.shekhar@sun.com-20090831075609-tkpqu41hxtupdeip
      > parent: joro@sun.com-20090827114042-h55n7qp9990bl6ge
      > committer: Georgi Kodinov <joro@sun.com>
      > branch nick: B46749-5.1-bugteam
      > timestamp: Mon 2009-08-31 16:40:35 +0300
      > message:
      >   automerge
      > ------------------------------------------------------------
      > Use --include-merges or -n0 to see merged revisions.
      460c6c97
    • MySQL Build Team's avatar
      Backport into build-200909221805-5.1.37sp1 · 0cee7a12
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3085 [merge]
      > revision-id: sergey.glukhov@sun.com-20090827105925-j56pdghdzb8nlw3p
      > parent: alfranio.correia@sun.com-20090827093227-9exafl3k6362bvq7
      > parent: sergey.glukhov@sun.com-20090827102219-sgjz0v5t1rfccs14
      > committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
      > branch nick: mysql-5.1-bugteam
      > timestamp: Thu 2009-08-27 15:59:25 +0500
      > message:
      >   5.0-bugteam->5.1-bugteam merge
      > ------------------------------------------------------------
      > Use --include-merges or -n0 to see merged revisions.
      0cee7a12
  27. 27 Aug, 2009 2 commits
    • Georgi Kodinov's avatar
      Bug #46749: Segfault in add_key_fields() with outer subquery level · c15848c4
      Georgi Kodinov authored
        field references
      
      This error requires a combination of factors : 
      1. An "impossible where" in the outermost SELECT
      2. An aggregate in the outermost SELECT
      3. A correlated subquery with a WHERE clause that includes an outer 
      field reference as a top level WHERE sargable predicate
      
      When JOIN::optimize detects an "impossible WHERE" it will bail out
      without doing the rest of the work and initializations. It will not
      call make_join_statistics() as well.  And make_join_statistics fills 
      in various structures for each table referenced.
      When processing the result of the "impossible WHERE" the query must
      send a single row of data if there are aggregate functions in it.
      In this case the server marks all the aggregates as having received 
      no rows and calls the relevant Item::val_xxx() method on the SELECT
      list. However if this SELECT list happens to contain a correlated 
      subquery this subquery is evaluated in a normal evaluation mode.
      And if this correlated subquery has a reference to a field from the 
      outermost "impossible where" SELECT the add_key_fields will mistakenly
      consider the outer field reference as a "local" field reference when 
      looking for sargable predicates.
      But since the SELECT where the outer field reference refers to is not
      completely initialized due to the "impossible WHERE" in this level
      we'll get a NULL pointer reference.
      Fixed by making a better condition for discovering if a field is "local"
      to the SELECT level being processed. 
      It's not enough to look for OUTER_REF_TABLE_BIT in this case since 
      for outer references to constant tables the Item_field::used_tables() 
      will return 0 regardless of whether the field reference is from the 
      local SELECT or not.
      c15848c4
    • Sergey Glukhov's avatar
      Bug#46184 Crash, SELECT ... FROM derived table procedure analyze · c5ecd1d2
      Sergey Glukhov authored
      The crash happens because select_union object is used as result set
      for queries which have derived tables.
      select_union use temporary table as data storage and if
      fields count exceeds 10(count of values for procedure ANALYSE())
      then we get a crash on fill_record() function.
      
      
      mysql-test/r/analyse.result:
        test result
      mysql-test/r/subselect.result:
        result fix
      mysql-test/t/analyse.test:
        test case
      mysql-test/t/subselect.test:
        test fix
      sql/sql_yacc.yy:
        The crash happens because select_union object is used as result set
        for queries which have derived tables.
        select_union use temporary table as data storage and if
        fields count exceeds 10(count of values for procedure ANALYSE())
        then we get a crash on fill_record() function.
      c5ecd1d2
  28. 18 Jul, 2009 1 commit
    • Evgeny Potemkin's avatar
      Bug#46051: Incorrectly market field caused wrong result. · 486d9303
      Evgeny Potemkin authored
      When during the optimization an item is moved to the upper select
      the item's context left unchanged. This caused wrong result in the 
      PS/SP mode.
      The Item_ident::remove_dependence_processor now sets the context
      of the select to which the item is moved to.
      
      mysql-test/r/subselect.result:
        The test case for the bug#46051 is adjusted.
      mysql-test/t/subselect.test:
        The test case for the bug#46051 is adjusted.
      sql/item.cc:
        Bug#46051: Incorrectly market field caused wrong result.
        The Item_ident::remove_dependence_processor now sets the context
        of the select to which the item is moved to.
      486d9303
  29. 16 Jul, 2009 1 commit
    • Evgeny Potemkin's avatar
      Bug#46051: Incorrectly market field caused wrong result. · c288559c
      Evgeny Potemkin authored
      In a subselect all fields from outer selects are marked as dependent on
      selects they are belong to. In some cases optimizer substitutes it for an
      equivalent expression. For example "a_field IN (SELECT outer_field)" is
      substituted with "a_field = outer_field". As we moved the outer_field to the
      upper select it's not really outer anymore. But it was left marked as outer.
      If exists an index over a_field optimizer choose wrong execution plan and thus
      return wrong result.
      
      Now the Item_in_subselect::single_value_transformer function removes dependent
      marking from fields when a subselect is optimized away.
      
      mysql-test/r/subselect.result:
        Added a test case for the bug#46051.
      mysql-test/t/subselect.test:
        Added a test case for the bug#46051.
      sql/item_subselect.cc:
        Bug#46051: Incorrectly market field caused wrong result.
        Now the Item_in_subselect::single_value_transformer function removes dependent
        marking from fields when a subselect is optimized away.
      c288559c
  30. 09 Jun, 2009 1 commit
    • Sergey Petrunia's avatar
      MWL#17: Table elimination · a875eb20
      Sergey Petrunia authored
      - Make elimination work with aggregate functions. The problem was that aggregate functions 
        reported all table bits in used_tables(), and that prevented table elimination. Fixed by 
        making aggregate functions return more correct value from used_tables(). 
      
      mysql-test/r/ps_11bugs.result:
        MWL#17: Table elimination
        - Update test results. The difference is because of Item_ref change: outer references to constants
          are now recognized as constants, too.
      mysql-test/r/subselect.result:
        - Update test results. The difference is because of Item_ref change: outer references to constants
          are now recognized as constants, too.
      mysql-test/r/table_elim.result:
        MWL#17: Table elimination
        - Check that elimination works in presense of aggreagate functions
      mysql-test/t/table_elim.test:
        MWL#17: Table elimination
        - Check that elimination works in presense of aggreagate functions
      sql/item.h:
        MWL#17: Table elimination
        - Add Item_ref::const_item() which calls (*ref)->const_item(). Before this diff Item_ref used the 
          default implementation of const_item(){ return used_tables()==0; }. This is no longer true, as 
          COUNT(*) now has used_tables()==0 but const_item()==FALSE.
      sql/item_sum.cc:
        MWL#17: Table elimination
        - Make Item_sum() and it descendants not to return all bits in used_tables(). This is needed 
          because otherwise table elimination can't work in presense of aggregate functions
        - COUNT(*) now has used_tables()==0 and const_item()==FALSE. Had to change 
          Item_ref::const_item() to account for this.
      sql/item_sum.h:
        MWL#17: Table elimination
        - Add comments
      a875eb20
  31. 09 Feb, 2009 1 commit
    • Matthias Leich's avatar
      This belongs to the fix for · 4c07b1e7
      Matthias Leich authored
      Bug#42003 tests missing the disconnect of connections <> default
      second slice
      Content:
      1. wait_until_count_sessions.inc
         - One PB run of a test using this routine failed because
           5 seconds timeout were exceeded. Although I have some doubts
           if the assigned timeout was really too small, I increase the
           value to 10. We waste the additional 5 seconds only if the
           tests fails anyway.
         - Print the content of the PROCESSLIST if the poll routine fails
      2. minor improvements of formatting
      3. query_cache_notembedded:
         Activate the wait_until_count_sessions.inc routine which was
         unfortunately forgotten in the changeset before.
      4c07b1e7