1. 12 May, 2010 3 commits
    • Ramil Kalimullin's avatar
      Fix for bug#52051: Aggregate functions incorrectly returns · feb03a82
      Ramil Kalimullin authored
            NULL from outer join query
            
            Problem: optimising MIN/MAX() queries without GROUP BY clause
            by replacing the aggregate expression with a constant, we may set it
            to NULL disregarding the fact that there may be outer joins involved.
            
            Fix: don't replace MIN/MAX() with NULL if there're outer joins.
            
            Note: the fix itself is just
            - if (!count)
            + if (!count && !outer_tables)
                set to NULL
            
            The rest of the patch eliminates repeated code to improve speed
            and for easy maintenance of the code.
      
      
      mysql-test/r/group_by.result:
                Fix for bug#52051: Aggregate functions incorrectly returns
                NULL from outer join query
                  - test result.
      mysql-test/t/group_by.test:
                Fix for bug#52051: Aggregate functions incorrectly returns
                NULL from outer join query
                  - test case.
      sql/opt_sum.cc:
                Fix for bug#52051: Aggregate functions incorrectly returns
                NULL from outer join query
                  - optimising MIN/MAX() queries without GROUP BY clause by
                replacing them with a constant, take into account that
                there're may be outer joins involved.
                  - repeated code for MIN/MAX optimization in the opt_sum_query()
                eliminated by introducing new functions that read MIN/MAX values
                using index and combining MIN/MAX cases to one.
      feb03a82
    • Staale Smedseng's avatar
      Bug #49756 Rows_examined is always 0 in the slow query log for · 330864fc
      Staale Smedseng authored
      update statements
            
      Only SELECT statements report any examined rows in the slow
      log. Slow UPDATE, DELETE and INSERT statements report 0 rows
      examined, unless the statement has a condition including a
      SELECT substatement.
            
      This patch adds counting of examined rows for the UPDATE and
      DELETE statements. An INSERT ... VALUES statement will still 
      not report any rows as examined.
      
      
      
      sql/sql_class.h:
        Added more docs for THD::examined_row_count.
      sql/sql_delete.cc:
        Add incrementing thd->examined_row_count.
      sql/sql_update.cc:
        Add incrementing thd->examined_row_count.
      330864fc
    • Sven Sandberg's avatar
      BUG#50410: rpl_ndb tests should run with binlog_format=row · 29c8c152
      Sven Sandberg authored
      Problem: The rpl_ndb did not set binlog_format explicitly. Since
      the default is binlog_format=statement, it means that the suite
      ran with that. ndb does not support binlog_format=statement,
      and many tests were skipped because they sourced
      include/have_binlog_format_row_or_mixed.inc
      Fix: set binlog_format=row explicitly in the configuration file
      for the rpl_ndb suite.
      
      
      Makefile.am:
        Removed duplicate run of rpl_ndb suite with binlog_format=row.
        Now that rpl_ndb is run with binlog_format=row by default, this
        run that explicitly changes to binlog_format=row is not needed,
        because it is covered by the following run.
      mysql-test/suite/rpl_ndb/my.cnf:
        cluster only supports binlog_format=row.
      mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result:
        updated result file
      mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test:
        This test is supposed to use binlog_format=STATEMENT on
        master. It uses innodb on master, so statement format is
        supported.
      29c8c152
  2. 11 May, 2010 2 commits
    • Martin Hansson's avatar
      00cd994d
    • Martin Hansson's avatar
      Bug#48157: crash in Item_field::used_tables · 79e60f0a
      Martin Hansson authored
            
      MySQL handles the join syntax "JOIN ... USING( field1,
      ... )" and natural joins by building the same parse tree as
      a corresponding join with an "ON t1.field1 = t2.field1 ..."
      expression would produce. This parse tree was not cleaned up
      properly in the following scenario. If a thread tries to
      lock some tables and finds that the tables were dropped and
      re-created while waiting for the lock, it cleans up column
      references in the statement by means a per-statement free
      list. But if the statement was part of a stored procedure,
      column references on the stored procedure's free list
      weren't cleaned up and thus contained pointers to freed
      objects.
            
      Fixed by adding a call to clean up the current prepared
      statement's free list.
      
      This is a backport from MySQL 5.1
      79e60f0a
  3. 10 May, 2010 3 commits
    • Mattias Jonsson's avatar
      merge · 6fa04cad
      Mattias Jonsson authored
      6fa04cad
    • Martin Hansson's avatar
      Bug#50939: Loose Index Scan unduly relies on engine to · 6d0425b1
      Martin Hansson authored
      remember range endpoints
      
      The Loose Index Scan optimization keeps track of a sequence
      of intervals. For the current interval it maintains the
      current interval's endpoints. But the maximum endpoint was
      not stored in the SQL layer; rather, it relied on the
      storage engine to retain this value in-between reads. By
      coincidence this holds for MyISAM and InnoDB. Not for the
      partitioning engine, however.
      
      Fixed by making the key values iterator 
      (QUICK_RANGE_SELECT) keep track of the current maximum endpoint.
      This is also more efficient as we save a call through the
      handler API in case of open-ended intervals.
      
      The code to calculate endpoints was extracted into 
      separate methods in QUICK_RANGE_SELECT, and it was possible to
      get rid of some code duplication as part of fix.
      6d0425b1
    • Jim Winstead's avatar
      Using an initial command with mysql_options(..., MYSQL_INIT_COMMAND, ...) · 6170e64f
      Jim Winstead authored
      that generated multiple result sets (such as a stored procedure or a
      multi-statement command) would leave the connection unusable. (Bug #42373)
      
      A side-effect of this bug fix is to make MYSQL_INIT_COMMAND settings ignored
      when connecting from within the server, but none of the existing mechanisms
      for connecting from within the server use or need to set the initial command.
      6170e64f
  4. 09 May, 2010 1 commit
  5. 08 May, 2010 1 commit
    • He Zhenxing's avatar
      Bug#53189 Table map version unused and can be removed · df0b6707
      He Zhenxing authored
      MYSQL_BIN_LOG m_table_map_version member and it's associated 
      functions were not used in the logic of binlogging and replication,
      this patch removed all related code.
      
      sql/log.cc:
        removed unused m_table_map_version variable and functions
      sql/log.h:
        removed unused m_table_map_version variable and functions
      sql/log_event.h:
        Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
      sql/sql_class.cc:
        Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
      sql/sql_load.cc:
        Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
      sql/table.cc:
        removed unused table_map_version variable
      sql/table.h:
        removed unused table_map_version variable
      df0b6707
  6. 07 May, 2010 2 commits
  7. 06 May, 2010 3 commits
    • Gleb Shchepa's avatar
      Bug #53088: mysqldump with -T & --default-character-set set · bd2a517b
      Gleb Shchepa authored
                  truncates text/blob to 766 chars
      
      mysqldump and SELECT ... INTO OUTFILE truncated long BLOB/TEXT
      values to size of 766 bytes (MAX_FIELD_WIDTH or 255 * 3 + 1).
      
      The select_export::send_data method has been modified to
      reallocate a conversion buffer for long field data.
      
      
      mysql-test/r/mysqldump.result:
        Test case for bug #53088.
      mysql-test/r/outfile_loaddata.result:
        Test case for bug #53088.
      mysql-test/t/mysqldump.test:
        Test case for bug #53088.
      mysql-test/t/outfile_loaddata.test:
        Test case for bug #53088.
      sql/sql_class.cc:
        Bug #53088: mysqldump with -T & --default-character-set set
                    truncates text/blob to 766 chars
        
        The select_export::send_data method has been modified to
        reallocate a conversion buffer for long field data.
      bd2a517b
    • Martin Hansson's avatar
      Merge of fix for Bug#52357 · 0c82d3f3
      Martin Hansson authored
      0c82d3f3
    • Martin Hansson's avatar
      Bug#52357: Assertion failed: join->best_read in · 1eada910
      Martin Hansson authored
      greedy_search optimizer_search_depth=0
      
      The algorithm inside restore_prev_nj_state failed to
      properly update the counters within the NESTED_JOIN
      tree. The counter was decremented each time a table in the
      node was removed from the QEP, the correct thing to do being
      only to decrement it when the last table in the child node
      was removed from the plan. This lead to node counters
      getting negative values and the plan thus appeared
      impossible. An assertion caught this.
      
      Fixed by not recursing up the tree unless the last table in
      the join nest node is removed from the plan
      1eada910
  8. 05 May, 2010 1 commit
    • Georgi Kodinov's avatar
      On behalf of Kristofer : · addd0a3e
      Georgi Kodinov authored
      Bug#53417 my_getwd() makes assumptions on the buffer sizes which not always hold true
            
      The mysys library contains many functions for rewriting file paths. Most of these
      functions makes implicit assumptions on the buffer sizes they write to. If a path is put
      in my_realpath() it will propagate to my_getwd() which assumes that the buffer holding
      the path name is greater than 2. This is not true in cases.
            
      In the special case where a VARBIN_ITEM is passed as argument to the LOAD_FILE function
      this can lead to a crash.
            
      This patch fixes the issue by introduce more safe guards agaist buffer overruns.
      addd0a3e
  9. 04 May, 2010 6 commits
  10. 03 May, 2010 3 commits
    • Kristofer Pettersson's avatar
      Automerge · 95e712b0
      Kristofer Pettersson authored
      95e712b0
    • Kristofer Pettersson's avatar
      Bug#50373 --secure-file-priv="" · 5dd5d705
      Kristofer Pettersson authored
      Iterative patch improvement. Previously committed patch
      caused wrong result on Windows. The previous patch also
      broke secure_file_priv for symlinks since not all file
      paths which must be compared against this variable are
      normalized using the same norm.
      
      The server variable opt_secure_file_priv wasn't
      normalized properly and caused the operations
      LOAD DATA INFILE .. INTO TABLE ..
      and
      SELECT load_file(..)
      to do different interpretations of the 
      --secure-file-priv option.
           
      The patch moves code to the server initialization
      routines so that the path always is normalized
      once and only once.
            
      It was also intended that setting the option
      to an empty string should be equal to 
      lifting all previously set restrictions. This
      is also fixed by this patch.
      
      
      mysql-test/r/loaddata.result:
        * Removed test code which will currently break the much used --mem feature of mtr.
      mysql-test/t/loaddata.test:
        * Removed test code which will currently break the much used --mem feature of mtr.
      sql/item_strfunc.cc:
        * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
      sql/mysql_priv.h:
        * Added signature for is_secure_file_path()
      sql/mysqld.cc:
        * New function for checking if a path compatible with the secure path restriction.
        * Added initialization of the opt_secure_file_priv variable.
      sql/sql_class.cc:
        * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
      sql/sql_load.cc:
        * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
      5dd5d705
    • Georgi Kodinov's avatar
      Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants. · f63608ea
      Georgi Kodinov authored
      The server was not checking the supplied to COM_FIELD_LIST table name
      for validity and compliance to acceptable table names standards.
      Fixed by checking the table name for compliance similar to how it's 
      normally checked by the parser and returning an error message if 
      it's not compliant.
      f63608ea
  11. 01 May, 2010 1 commit
  12. 30 Apr, 2010 3 commits
    • Alexey Kopytov's avatar
      Automerge. · 26570994
      Alexey Kopytov authored
      26570994
    • Alexey Kopytov's avatar
      Bug #48419: another explain crash.. · 97374a11
      Alexey Kopytov authored
      WHERE predicates containing references to empty tables in a
      subquery were handled incorrectly by the optimizer when
      executing EXPLAIN. As a result, the optimizer could try to
      evaluate such predicates rather than just stop with
      "Impossible WHERE noticed after reading const tables" as 
      it would do in a non-subquery case. This led to valgrind 
      errors and crashes.
      
      Fixed the code checking the above condition so that subqueries
      are not excluded and hence are handled in the same way as top
      level SELECTs.
      
      mysql-test/r/explain.result:
        Added a test case for bug #48419.
      mysql-test/r/ps.result:
        Updated test results to take the new (and more correct)
        "Extra" comments in execution plans.
      mysql-test/t/explain.test:
        Added a test case for bug #48419.
      sql/sql_select.cc:
        There is no point in excluding subqueries from checking
        for identically false WHERE conditions.
      97374a11
    • Vasil Dimov's avatar
      Disable innodb.innodb, main.ps_3innodb and main.partition_innodb_plugin · 3bffc40a
      Vasil Dimov authored
      mysql-tests because those emit (spurious?) valgrind warnings.
      3bffc40a
  13. 29 Apr, 2010 7 commits
  14. 28 Apr, 2010 4 commits