1. 12 Jan, 2011 9 commits
    • Evgeny Potemkin's avatar
      Auto-merge. · b0be97db
      Evgeny Potemkin authored
      b0be97db
    • Alexey Botchkov's avatar
      merging. · 75c2a822
      Alexey Botchkov authored
      75c2a822
    • Dmitry Lenev's avatar
      Merged fix for bug #58499 "DEFINER-security view selecting from · 7aa99960
      Dmitry Lenev authored
      INVOKER-security view access check wrong" into mysql-5.5 tree.
      7aa99960
    • Dmitry Lenev's avatar
      Fix for bug #58499 "DEFINER-security view selecting from · 599457ae
      Dmitry Lenev authored
      INVOKER-security view access check wrong".
      
      When privilege checks were done for tables used from an 
      INVOKER-security view which in its turn was used from 
      a DEFINER-security view connection's active security
      context was incorrectly used instead of security context
      with privileges of the second view's creator.
      
      This meant that users which had enough rights to access
      the DEFINER-security view and as result were supposed to 
      be able successfully access it were unable to do so in 
      cases when they didn't have privileges on underlying tables 
      of the INVOKER-security view.
      
      This problem was caused by the fact that for INVOKER-security
      views TABLE_LIST::security_ctx member for underlying tables
      were set to 0 even in cases when particular view was used from 
      another DEFINER-security view. This meant that when checks of
      privileges on these underlying tables was done in
      setup_tables_and_check_access() active connection security 
      context was used instead of context corresponding to the 
      creator of caller view.
      
      This fix addresses the problem by ensuring that underlying
      tables of an INVOKER-security view inherit security context
      from the view and thus correct security context is used for
      privilege checks on underlying tables in cases when such view 
      is used from another view with DEFINER-security.
      
      mysql-test/r/view_grant.result:
        Added coverage for various combinations of DEFINER and
        INVOKER-security views, including test for bug #58499
        "DEFINER-security view selecting from INVOKER-security
        view access check wrong".
      mysql-test/t/view_grant.test:
        Added coverage for various combinations of DEFINER and
        INVOKER-security views, including test for bug #58499
        "DEFINER-security view selecting from INVOKER-security
        view access check wrong".
      sql/sql_view.cc:
        When opening a non-suid view ensure that its underlying 
        tables will get the same security context as use for
        checking privileges on the view, i.e. security context
        of view invoker. This context can be different from the
        security context which is currently active for connection 
        in cases when this non-suid view is used from a view with
        suid security. Inheriting security context in such situation
        allows correctly apply privileges of creator of suid view
        in checks for tables of non-suid view (since in this 
        situation creator/definer of suid view serves as invoker
        for non-suid view).
      599457ae
    • Alexey Botchkov's avatar
      Bug #57321 crashes and valgrind errors from spatial types · 33c78e32
      Alexey Botchkov authored
              Item_func_spatial_collection::fix_length_and_dec didn't call parent's method, so
              the maybe_null was set to '0' after it. But in this case the result was
              just NULL, that caused wrong behaviour.
      
      per-file comments:
        mysql-test/r/gis.result
      Bug #57321 crashes and valgrind errors from spatial types 
              test result updated.
      
        mysql-test/t/gis.test
      Bug #57321 crashes and valgrind errors from spatial types 
              test case added.
        sql/item_geofunc.h
      Bug #57321 crashes and valgrind errors from spatial types 
              Item_func_geometry::fix_length_and_dec() called in
              Item_func_spatial_collection::fix_length_and_dec().
      33c78e32
    • Evgeny Potemkin's avatar
      Bug#59330: Incorrect result when comparing an aggregate function with · 0a80d5bd
      Evgeny Potemkin authored
      TIMESTAMP.
      
      Item_cache::get_cache wasn't treating TIMESTAMP as a DATETIME value thus
      returning string cache for items with TIMESTAMP type. This led to incorrect
      TIMESTAMP -> INT conversion and to a wrong query result.
      
      Fixed by using Item::is_datetime function to check for DATETIME type group.
      
      
      mysql-test/r/type_timestamp.result:
        Added a test case for the bug#59330.
      mysql-test/t/type_timestamp.test:
        Added a test case for the bug#59330.
      sql/item.cc:
        Bug#59330: Incorrect result when comparing an aggregate function with
        TIMESTAMP.
        Item_cache::get_cache now uses is_datetime member function to detect DATETIME
        type group.
      0a80d5bd
    • Ole John Aske's avatar
      Fix for bug#58818: Incorrect result for IN/ANY subquery · bbf40ba3
      Ole John Aske authored
      If the ::single_value_transformer() find an existing HAVING condition it used
      to do the transformation:
                  
        1) HAVING cond -> (HAVING Cond) AND (cond_guard (Item_ref_null_helper(...))
            
      As the AND condition in 1) is Mc'Carty evaluated, the
      right side of the AND cond should be executed only if the 
      original 'HAVING evaluated' to true.
            
      However, as we failed to set 'top_level' for the tranformed HAVING condition,
      'abort_on_null' was FALSE after transformation. An
      UNKNOWN having condition will then not terminate evaluation of the
      transformed having condition, and we incorrectly continued
      into the Item_ref_null_helper() part.
      bbf40ba3
    • Martin Hansson's avatar
      Merge of fix for Bug#58207. · 2fbee31f
      Martin Hansson authored
      2fbee31f
    • Martin Hansson's avatar
      Bug#58207: invalid memory reads when using default column value and · 3c5662c1
      Martin Hansson authored
      tmptable needed
      
      The function DEFAULT() works by modifying the the data buffer pointers (often
      referred to as 'record' or 'table record') of its argument. This modification
      is done during name resolution (fix_fields().) Unfortunately, the same
      modification is done when creating a temporary table, because default values
      need to propagate to the new table.
      
      Fixed by skipping the pointer modification for fields that are arguments to
      the DEFAULT function.
      3c5662c1
  2. 11 Jan, 2011 8 commits
  3. 10 Jan, 2011 10 commits
    • Mattias Jonsson's avatar
      merge · fde31114
      Mattias Jonsson authored
      fde31114
    • Mattias Jonsson's avatar
      merge · 0df98f62
      Mattias Jonsson authored
      0df98f62
    • Matthias Leich's avatar
      The fix for Bug#58414 affecting the test show_check is pushed. · 32d3cc25
      Matthias Leich authored
      Remove the test from defaults.experimental.
      32d3cc25
    • Magne Mahre's avatar
      Bug#51631 general-log flag doesn't accept "on" as a value in · 296d494e
      Magne Mahre authored
                the my.cnf, works as command
            
      Different parsing mechanisms are used for command line/my.cnf 
      options  and the SQL commands.  The former only accepted
      numeric arguments, and regarded all numbers different from 0 
      as 'true'.  Any other argument was parsed as 'false' .
            
      This patch adds the words 'true' and 'on' as valid truth
      values for boolean option arguments.
            
      A test case is not provided, as the fix is simple and
      does not warrant a separate test file (no existing
      suitable test file was found)
      
      (backported from mysql-trunk)
      296d494e
    • Mattias Jonsson's avatar
      Manual merge from 5.1 · b56308e6
      Mattias Jonsson authored
      b56308e6
    • Jon Olav Hauglid's avatar
      Bug #58933 Assertion `thd- >is_error()' fails on shutdown with ongoing · 6bbfe7c6
      Jon Olav Hauglid authored
                 OPTIMIZE TABLE
      
      OPTIMIZE TABLE for InnoDB tables is handled as recreate + analyze.
      The triggered assert checked that an error had been reported if either
      recreate or analyze failed. However the assert failed to take into
      account that they could have failed because OPTIMIZE TABLE had been
      victim of KILL QUERY, KILL CONNECTION or server shutdown.
      
      This patch adjusts the assert to take this possibility into account.
      The problem was only noticeable on debug versions of the server.
      
      Test case added to innodb_mysql_sync.test.
      6bbfe7c6
    • Magne Mahre's avatar
      Bug#58970 Problem Subquery (without referencing a table) · 90650edf
      Magne Mahre authored
                and Order By
            
      When having a UNION statement in a subquery, with no
      referenced tables (or only a reference to the virtual
      table 'dual'), the UNION did not allow an ORDER BY clause.
            
            i.e:
                SELECT(SELECT 1 AS a UNION 
                       SELECT 0 AS a 
                       ORDER BY a) AS b  or
                SELECT(SELECT 1 AS a FROM dual UNION 
                       SELECT 0 as a 
                       ORDER BY a) AS b
            
            
      In addition, an ORDER BY / LIMIT clause was not accepted
      in subqueries even for single SELECT statements with no 
      referenced tables (or with 'dual' as table reference)
            
         i.e: 
            SELECT(SELECT 1 AS a ORDER BY a) AS b  or
            SELECT(SELECT 1 AS a FROM dual ORDER BY a) AS b
            
      The fix was to allow an optional ORDER BY/LIMIT clause to
      the grammar for these cases.
            
      See also: Bug#57986
      90650edf
    • Magne Mahre's avatar
      Bug#57986 ORDER BY clause is not used after a UNION, · 1b645167
      Magne Mahre authored
                if embedded in a SELECT
                  
      An ORDER BY clause was bound to the incorrect
      (sub-)statement when used in a UNION context.
                  
      In a query like:
      SELECT * FROM a UNION SELECT * FROM b ORDER BY c
      the result of SELECT * FROM b is sorted, and then
      combined with a.  The correct behaviour is that
      the ORDER BY clause should be applied on the
      final set.   Similar behaviour was seen on LIMIT
      clauses as well.
                  
      In a UNION statement, there will be a select_lex
      object for each of the two selects, and a 
      select_lex_unit object that describes the UNION
      itself.  Similarly, the same behaviour was also
      seen on derived tables.
                  
      The bug was caused by using a grammar rule for
      ORDER BY and LIMIT that bound these elements
      to thd->lex->current_select, which points to the
      last of the two selects, instead of to the 
      fake_select_lex member of the master select_lex_unit
      object.
      
      
      sql/sql_yacc.yy:
        Need to use (opt_)union_order_or_limit to
        bind to the correct select_lex object.
      1b645167
    • Mattias Jonsson's avatar
      merge · 2f474166
      Mattias Jonsson authored
      2f474166
    • Mattias Jonsson's avatar
      merge · 770c3f3a
      Mattias Jonsson authored
      770c3f3a
  4. 08 Jan, 2011 5 commits
  5. 07 Jan, 2011 8 commits
    • Davi Arnaut's avatar
      Bug#58765: Warning in item.h on Windows · d00b9f10
      Davi Arnaut authored
      Truncate the maximum result length (64-bit wide type) to fit into
      the item maximum length (32-bit wide type). This is possible as
      this specific branch is only used if the maximum result length
      is less than 0x1000000 (MAX_BLOB_WIDTH), which fits comfortably
      in a 32-bit wide type.
      d00b9f10
    • Davi Arnaut's avatar
      Merge of mysql-5.1 into mysql-5.5. · d4ffbd3e
      Davi Arnaut authored
      d4ffbd3e
    • Davi Arnaut's avatar
      Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files · 844d6ed4
      Davi Arnaut authored
      WIN32 compilation fixes: define ETIMEDOUT only if not available and
      fix typos and add a missing parameter.
      844d6ed4
    • Davi Arnaut's avatar
      Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files · 998065c3
      Davi Arnaut authored
      From a user perspective, the problem is that a FLUSH LOGS or SIGHUP
      signal could end up associating the stdout and stderr to random
      files. In the case of this bug report, the streams would end up
      associated to InnoDB ibd files.
      
      The freopen(3) function is not thread-safe on FreeBSD. What this
      means is that if another thread calls open(2) during freopen()
      is executing that another thread's fd returned by open(2) may get
      re-associated with the file being passed to freopen(3). See FreeBSD
      PR number 79887 for reference:
      
        http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
      
      This problem is worked around by substituting a internal hook within
      the FILE structure. This avoids the loss of atomicity by not having
      the original fd closed before its duplicated.
      
      Patch based on the original work by Vasil Dimov.
      
      include/my_sys.h:
        Export my_freopen.
      mysys/my_fopen.c:
        Add a my_freopen abstraction to workaround bugs in specific OSes.
        Add a prototype for getosreldate() as older FreeBSD versions did
        not define one.
      sql/log.cc:
        Move freopen abstraction code over to mysys.
        The streams are now only reopened for writing.
      998065c3
    • Vasil Dimov's avatar
      Null merge mysql-5.1-innodb -> mysql-5.5-innodb · 39668b4e
      Vasil Dimov authored
      This change is relevant only for 5.1.
      39668b4e
    • Vasil Dimov's avatar
      Followup to vasil.dimov@oracle.com-20110107091222-q23qpb5skev0j9gc · 8a49f0b1
      Vasil Dimov authored
      Do not use nested AC_CHECK_FUNC() because they result in:
      
      ./configure: line 52688: syntax error: unexpected end of file
      
      (which happens only on some platforms and does not happen on others,
      I have no idea what is the reason for this)
      8a49f0b1
    • Matthias Leich's avatar
      Fix for Bug#58414 Race condition in show_check.test · b342d3e7
      Matthias Leich authored
         Basically take care that disconnects are finished.
      b342d3e7
    • Matthias Leich's avatar
      Fix for Bug#47745 innodb.innodb-timeout fails sporadically · bc37d5c2
      Matthias Leich authored
      - Second scenario checked:
        Ensure via wait routines that the commit comes after the
        processing of the statement which should get finally
        the ER_LOCK_WAIT_TIMEOUT
        --> This should prevent the current bug.
      - First scenario checked:
        Ensure via wait routines that the statement is already waiting
        for getting the lock before the commit is given.
        --> No effect on the current bug, but ensure that the right
            scenario is reached.
      - Take care that disconnects are finished before the test ends.
        --> Reduce the potential to harm succeeding tests.
      - "Mangle" the printout of the current default innodb_lock_wait_timeout value
        --> No need to adjust the test in case the default gets changed in future.
      bc37d5c2