1. 30 Jun, 2010 2 commits
    • Sergey Glukhov's avatar
      Bug#51431 Wrong sort order after import of dump file · a6220d82
      Sergey Glukhov authored
      The problem is that QUICK_SELECT_DESC behaviour depends
      on used_key_parts value which can be bigger than selected
      best_key_parts value if an engine supports clustered key.
      But used_key_parts is overwritten with best_key_parts
      value that prevents from correct selection of index
      access method. The fix is to preserve used_key_parts
      value for further use in QUICK_SELECT_DESC.
      a6220d82
    • Staale Smedseng's avatar
      Bug #53899 Wrong mysql_stmt_errno() after connection loss with · 3b3983a4
      Staale Smedseng authored
      automatic reconnect
      
      A client with automatic reconnect enabled will see the error
      message "Lost connection to MySQL server during query" if the
      connection is lost between mysql_stmt_prepare() and
      mysql_stmt_execute(). The mysql_stmt_errno() number, however,
      is 0 -- not the corresponding value 2013.
      
      This patch checks for the case where the prepared statement
      has been pruned due to a connection loss (i.e., stmt->mysql
      has been set to NULL) during a call to cli_advanced_command(),
      and avoids changing the last_errno to the result of the last
      reconnect attempt.
      3b3983a4
  2. 29 Jun, 2010 1 commit
  3. 28 Jun, 2010 5 commits
  4. 27 Jun, 2010 2 commits
    • Alfranio Correia's avatar
      353e1107
    • 's avatar
      The following statements support the CURRENT_USER() where a user is needed. · 899a1d69
      authored
      DROP USER 
      RENAME USER CURRENT_USER() ...
      GRANT ... TO CURRENT_USER()
      REVOKE ... FROM CURRENT_USER()
      ALTER DEFINER = CURRENT_USER() EVENTbut, When these statements are binlogged, CURRENT_USER() just is binlogged
      as 'CURRENT_USER()', it is not expanded to the real user name. When slave 
      executes the log event, 'CURRENT_USER()' is expand to the user of slave 
      SQL thread, but SQL thread's user name always NULL. This breaks the replication.
      
      After this patch, session's user will be written into query log events 
      if these statements call CURREN_USER() or 'ALTER EVENT' does not assign a definer.
      899a1d69
  5. 26 Jun, 2010 1 commit
    • Jon Olav Hauglid's avatar
      Bug #54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER · 9fa66b64
      Jon Olav Hauglid authored
      This deadlock happened if DROP DATABASE was blocked due to an open
      HANDLER table from a different connection. While DROP DATABASE
      is blocked, it holds the LOCK_mysql_create_db mutex. This results
      in a deadlock if the connection with the open HANDLER table tries
      to execute a CREATE/ALTER/DROP DATABASE statement as they all
      try to acquire LOCK_mysql_create_db.
      
      This patch makes this deadlock scenario very unlikely by closing and
      marking for re-open all HANDLER tables for which there are pending
      conflicing locks, before LOCK_mysql_create_db is acquired.
      However, there is still a very slight possibility that a connection
      could access one of these HANDLER tables between closing/marking for
      re-open and the acquisition of LOCK_mysql_create_db.
      
      This patch is for 5.1 only, a separate and complete fix will be
      made for 5.5+.
      
      Test case added to schema.test.
      9fa66b64
  6. 25 Jun, 2010 2 commits
    • Georgi Kodinov's avatar
      merge · 2b2e0908
      Georgi Kodinov authored
      2b2e0908
    • Sergey Glukhov's avatar
      Bug#54422 query with = 'variables' · 700f8add
      Sergey Glukhov authored
      During creation of the table list of
      processed tables hidden I_S table 'VARIABLES'
      is erroneously added into the table list.
      it leads to ER_UNKNOWN_TABLE error in
      TABLE_LIST::add_table_to_list() function.
      The fix is to skip addition of hidden I_S
      tables into the table list.
      700f8add
  7. 24 Jun, 2010 5 commits
  8. 22 Jun, 2010 1 commit
    • Alexey Kopytov's avatar
      Bug#54477: Crash on IN / CASE with NULL arguments · 07e95b39
      Alexey Kopytov authored
      Incorrect handling of NULL arguments could lead to a crash on
      the IN or CASE operations when either NULL arguments were
      passed explicitly as arguments (IN) or implicitly generated by
      the WITH ROLLUP modifier (both IN and CASE).
      
      Item_func_case::find_item() assumed all necessary comparators
      to be instantiated in fix_length_and_dec(). However, in the
      presence of WITH ROLLUP modifier, arguments could be
      substituted with an Item_null leading to an "unexpected"
      STRING_RESULT comparator being invoked.
      
      In addition to the problem identical to the above,
      Item_func_in::val_int() could crash even with explicitly passed
      NULL arguments due to an optimization in fix_length_and_dec()
      leading to NULL arguments being ignored during comparators
      creation.
      07e95b39
  9. 21 Jun, 2010 1 commit
    • Sergey Glukhov's avatar
      Bug#50389 Using intersect does not return all rows · f4830634
      Sergey Glukhov authored
      In process of record search it is not taken into account
      that inital quick->file->ref value could be inapplicable
      to range interval. After proper row is found this value is
      stored into the record buffer and later the record is
      filtered out at condition evaluation stage.
      The fix is store a refernce of found row to the handler ref field.
      f4830634
  10. 19 Jun, 2010 1 commit
  11. 18 Jun, 2010 1 commit
  12. 17 Jun, 2010 4 commits
  13. 15 Jun, 2010 4 commits
  14. 14 Jun, 2010 2 commits
  15. 12 Jun, 2010 1 commit
  16. 11 Jun, 2010 4 commits
    • Alexey Kopytov's avatar
      Automerge. · 08f3b0ab
      Alexey Kopytov authored
      08f3b0ab
    • Ramil Kalimullin's avatar
      Automerge. · d4746b8e
      Ramil Kalimullin authored
      d4746b8e
    • Alexey Kopytov's avatar
      Manual merge from the bugfix tree. · 162e4262
      Alexey Kopytov authored
      conflicts:
         conflict      sql/sql_parse.cc
      162e4262
    • Martin Hansson's avatar
      Bug#53859: Valgrind: opt_sum_query(TABLE_LIST*, List<Item>&, · 5bace3f0
      Martin Hansson authored
      Item*) at opt_sum.cc:305
            
      Queries applying MIN/MAX functions to indexed columns are
      optimized to read directly from the index if all key parts
      of the index preceding the aggregated key part are bound to
      constants by the WHERE clause. A prefix length is also
      produced, equal to the total length of the bound key
      parts. If the aggregated column itself is bound to a
      constant, however, it is also included in the prefix.
      
      Such full search keys are read as closed intervals for
      reasons beyond the scope of this bug. However, the procedure
      missed one case where a key part meant for use as range
      endpoint was being overwritten with a NULL value destined
      for equality checking. In this case the key part was
      overwritten but the range flag remained, causing open
      interval reading to be performed.
      
      Bug was fixed by adding more stringent checking to the
      search key building procedure (matching_cond) and never
      allow overwrites of range predicates with non-range
      predicates.
      
      An assertion was added to make sure open intervals are never
      used with full search keys.
      5bace3f0
  17. 10 Jun, 2010 3 commits
    • Davi Arnaut's avatar
      Bug#42733: Type-punning warnings when compiling MySQL -- · 53b88296
      Davi Arnaut authored
                  strict aliasing violations.
      
      One somewhat major source of strict-aliasing violations and
      related warnings is the SQL_LIST structure. For example,
      consider its member function `link_in_list` which takes
      a pointer to pointer of type T (any type) as a pointer to
      pointer to unsigned char. Dereferencing this pointer, which
      is done to reset the next field, violates strict-aliasing
      rules and might cause problems for surrounding code that
      uses the next field of the object being added to the list.
      
      The solution is to use templates to parametrize the SQL_LIST
      structure in order to deference the pointers with compatible
      types. As a side bonus, it becomes possible to remove quite
      a few casts related to acessing data members of SQL_LIST.
      53b88296
    • Davi Arnaut's avatar
      Bug#42733: Type-punning warnings when compiling MySQL -- · bb036c93
      Davi Arnaut authored
                 strict aliasing violations.
      
      Essentially, the problem is that large parts of the server were
      developed in simpler times (last decades, pre C99 standard) when
      strict aliasing and compilers supporting such optimizations were
      rare to non-existent. Thus, when compiling the server with a modern
      compiler that uses strict aliasing rules to perform optimizations,
      there are several places in the code that might trigger undefined
      behavior.
      
      As evinced by some recent bugs, GCC does a somewhat good of job
      misoptimizing such code, but on the other hand also gives warnings
      about suspicious code. One problem is that the warnings aren't
      always accurate, yet we can't afford to just shut them off as we
      might miss real cases. False-positive cases are aggravated mostly
      by casts that are likely to trigger undefined behavior.
      
      The solution is to start a cleanup process focused on fixing and
      reducing the amount of strict-aliasing related warnings produced
      by GCC and others compilers. A good deal of noise reduction can
      be achieved by just removing useless casts that are product of
      historical cruft and are likely to trigger undefined behavior if
      dereferenced.
      bb036c93
    • Tor Didriksen's avatar
      Backport of Bug#53303 mytap tests should always have a plan() · e3b4d331
      Tor Didriksen authored
      The bug was caused by buffered output. Flushing resolved it.
      We still recommend to allways call plan().
        
      Also fix some compile warnings (formal parameter different from declaration)
      e3b4d331