An error occurred fetching the project authors.
  1. 02 May, 2006 1 commit
    • unknown's avatar
      SECURITY FIX · 3010890e
      unknown authored
      Bug#17667: An attacker has the opportunity to bypass query logging.
      
      This adds a new, local-only printf format specifier to our *printf functions
      that allows us to print known-size buffers that must not be interpreted as 
      NUL-terminated "strings."
      
      It uses this format-specifier to print to the log, thus fixing this 
      problem.
      
      
      include/my_sys.h:
        Add prototype for my_memmem() .
      mysys/Makefile.am:
        Add reference to new file, my_memmem.c
      mysys/mf_iocache2.c:
        Add a "%.1234b" and "%.*b" percent-code.  It takes a width, just like "%s", 
        but unlike the string-indicator, it requires the width and doesn't stop printing
        at NUL characters.
        
        Also, simplify the code a bit.
        
        TODO:  This code should be unified with the strings/my_vnsprintf.c code in 
        the future.
      sql/sql_parse.cc:
        The query is not a C-string, but is a sized buffer, containing any character 
        at all, which may include NUL characters.
      strings/my_vsnprintf.c:
        Add a "%.1234b" and "%.*b" percent-code.  It takes a width, just like "%s", 
        but unlike the string-indicator, it requires the width and doesn't stop printing
        at NUL characters.
      tests/Makefile.am:
        We may need some of our local functions.
      tests/mysql_client_test.c:
        Add a "%.1234b" and "%.*b" percent-code.  It takes a width, just like "%s", 
        but unlike the string-indicator, it requires the width and doesn't stop printing
        at NUL characters.
      mysql-test/t/mysql_client_test.opt:
        New BitKeeper file ``mysql-test/t/mysql_client_test.opt''
        
        Add '--log' server parameter.
      mysys/my_memmem.c:
        New BitKeeper file ``mysys/my_memmem.c''
        
        Implement memmem, a black-box work-alike of the GNU memmem(), which functions
        like strstr() but for arbitrary blocks of memory.
      3010890e
  2. 30 Mar, 2006 2 commits
  3. 04 Mar, 2006 2 commits
    • unknown's avatar
      Revert the changeset for Bug#16144 "mysql_stmt_attr_get type error": · 4391f938
      unknown authored
      it breaks binary compatibility. The patch will be left intact
      in 5.1.
      
      
      libmysql/libmysql.c:
        Revert the changeset for Bug#16144: it breaks binary compatibility.
      tests/mysql_client_test.c:
        Revert the changeset for Bug#16144: it breaks binary compatibility.
      4391f938
    • unknown's avatar
      Undo the patch for Bug#16144 "mysql_stmt_attr_get type error", · fb71f423
      unknown authored
      it breaks binary compatibility. The patch will be left intact
      in 5.1. Warning: this changeset should be null-merged into 5.1.
      A separate commit in order to push into the release clone of 
      5.0.19.
      
      
      libmysql/libmysql.c:
        Undo the patch for Bug#16144
      tests/mysql_client_test.c:
        Undo the patch for Bug#16144
      fb71f423
  4. 28 Feb, 2006 1 commit
    • unknown's avatar
      Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was · ddbf62ca
      unknown authored
      used
      
      In a simple queries a result of the GROUP_CONCAT() function was always of 
      varchar type.
      But if length of GROUP_CONCAT() result is greater than 512 chars and temporary
      table is used during select then the result is converted to blob, due to
      policy to not to store fields longer than 512 chars in tmp table as varchar
      fields.
      
      In order to provide consistent behaviour, result of GROUP_CONCAT() now
      will always be converted to blob if it is longer than 512 chars.
      Item_func_group_concat::field_type() is modified accordingly.
      
      
      sql/item_sum.h:
        Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was 
        used
        The Item_func_group_concat::field_type() now returns FIELD_TYPE_BLOB if the result is longer than 512 chars.
      tests/mysql_client_test.c:
        Added test case for bug#14169: type of group_concat() result changed to blob if tmp_table was used
      ddbf62ca
  5. 25 Feb, 2006 1 commit
  6. 15 Feb, 2006 1 commit
  7. 10 Feb, 2006 2 commits
    • unknown's avatar
      Bug#14013 mysql_stmt_store_result() bombs if a cursor is open · 101e618f
      unknown authored
       - Add code to 'mysql_stmt_store_result' to allow it to be called on 
         a prepared statement with open server side cursor.
       - Add tests to mysql_client_test that uses 'mysql_stmt_store_result'
      
      
      client/mysqltest.c:
        Enable cursor protocol(remove the ifdef BUG14013_FIXED)
        When running in cursor mode, the warnings from execute needs 
        to be extracted after mysql_stmt_execute, put them in a dynamic string 
        for later use.
        Untabify some tabs.
      libmysql/libmysql.c:
        Allow 'mysql_stmt_store_result' to be called on a statement with an open server side cursor.
        Detect that a server side cursor is open and send a "fetch" to ask for all rows to be sent to the client.
        Read all binary rows as normal store.
        Check that server said last row was sent after all binary rows has been sent.
      tests/mysql_client_test.c:
        Update 'fetch_n' function to take parameter indicating if 'mysql_stmt_store_result' should be used on the statement.
        Call fetch_n with parameter set to use 'mysql_stmt_store_result'
      101e618f
    • unknown's avatar
      fix test of bug 12744 on OSX · 2a098077
      unknown authored
      2a098077
  8. 02 Feb, 2006 1 commit
  9. 01 Feb, 2006 1 commit
    • unknown's avatar
      fix for bug #12744 (MYSQL_STMT operations cause seg fault after connection reset) · 1e686ae7
      unknown authored
      libmysql/libmysql.c:
        stmt->mysql could be 0x0 if the connection has failed between prepare and execute
        or any other operation. thus if the user decides to use mysql_stmt_reset()
        we should not segfault.
      tests/mysql_client_test.c:
        test for bug #12744 (MYSQL_STMT operations cause seg fault after connection reset)
      1e686ae7
  10. 26 Jan, 2006 1 commit
    • unknown's avatar
      Bug #15719 MYSQL_OPT_RECONNECT option is modified by mysql_real_connect · f220f892
      unknown authored
       - Move init of "reconnect" variable to mysql_init 
       - Add test case to mysql_client_test.
      
      
      sql-common/client.c:
        Move initialisation of reconnect variable to mysql_init instead of doing it in mysql_real_connect.
      tests/mysql_client_test.c:
        Add test to check that reconnect is not modified by a call to mysql_real_connect
      f220f892
  11. 18 Jan, 2006 1 commit
  12. 17 Jan, 2006 1 commit
  13. 06 Dec, 2005 1 commit
  14. 02 Dec, 2005 1 commit
    • unknown's avatar
      Bug#10932 - Building server with key limit of 128, makes test cases fail · 65d412db
      unknown authored
      Allow for configuration of the maximum number of indexes per table.
      Added and used a configure.in macro.
      Replaced fixed limits by the configurable limit.
      Limited MyISAM indexes to its hard limit.
      Fixed a bug in opt_range.cc for many indexes with InnoDB.
      
      Tested for 2, 63, 64, 65, 127, 128, 129, 255, 256, and 257 indexes.
      Testing this part of the bugfix requires rebuilding of the server 
      with different options. This cannot be done with our test suite. 
      Therefore I added the necessary test files to the bug report.
      If you repeat the tests, please note that the ps_* tests fail for
      everything but 64 indexes. This is because of differences in the 
      meta data, namely field lengths for index names etc.
      
      
      config/ac-macros/misc.m4:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Added a macro for the new build option.
      configure.in:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Added a call for the new macro.
      include/myisam.h:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Limit the number of keys for MyISAM to its hard limit.
      sql/mysql_priv.h:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Stick with the optimized Bitmap<64> if indexes are limited to 64
        or lower. Otherwise use a bigger bitmap. It must be defined as a
        multiple of 8.
      sql/opt_range.cc:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Initialize an object element to avoid a crash when using InnoDB
        with many indexes.
      sql/unireg.h:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Replace the fixed limit by the configurable limit.
      tests/mysql_client_test.c:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Replace the fixed limit by the configurable limit.
      65d412db
  15. 18 Nov, 2005 1 commit
  16. 17 Nov, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#13524 "lock timeout gives · 5b8a9654
      unknown authored
      incorrect warning on open cursor"
      
      
      sql/sql_prepare.cc:
        A fix for Bug#13524 "lock timeout gives incorrect 
        warning on open cursor": reset the connection for next
        command before performing a cursor fetch (add an omitted line).
      tests/mysql_client_test.c:
        A test case for Bug#13524 "lock timeout gives incorrect 
        warning on open cursor"
      5b8a9654
  17. 09 Nov, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#13488 "Left outer join query incorrectly · 75fab514
      unknown authored
      gives MYSQL_DATA_TRUNCATED"
      
      
      sql/sql_cursor.cc:
        A partial fix for Bug#13488 "Left outer join query incorrectly gives 
        MYSQL_DATA_TRUNCATED": send the correct metadata of the cursor
        result set at execute. The full fix would be to make sure that
        the metadata doesn't change between prepare and execute.
      tests/mysql_client_test.c:
        A test case for Bug#13488 "Left outer join query incorrectly gives 
        MYSQL_DATA_TRUNCATED"
      75fab514
  18. 03 Nov, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#14210 "Simple query with > operator on · 3fa0dd23
      unknown authored
      large table gives server crash": make sure that when a MyISAM temporary
      table is created for a cursor, it's created in its memory root,
      not the memory root of the current query.
      
      
      mysql-test/r/sp.result:
        Test results fixed: a test case for Bug#14210
      mysql-test/t/sp.test:
        A test case for Bug#14210 "Simple query with > operator on large table 
        gives server crash"
      sql/handler.cc:
        - rewrite get_new_handler to accept a memory root and use it for
      sql/handler.h:
        - get_new_handler declaration changed
      sql/opt_range.cc:
        - get_new_handler declaration changed
      sql/sql_base.cc:
        - get_new_handler declaration changed
      sql/sql_select.cc:
        - the actual fix for Bug#14210. In create_myisam_from_heap we should
        create the new table handler in TABLE::mem_root, not in THD::mem_root:
        the latter is freed shortly after cursor is open.
        - adjust create_tmp_table to explicitly supply &table->mem_root
        to get_new_handler when creating a handler for a new temporary table
      sql/sql_table.cc:
        - get_new_handler declaration changed
      sql/table.cc:
        - get_new_handler declaration changed
      sql/unireg.cc:
        - get_new_handler declaration changed
      tests/mysql_client_test.c:
        A test case for Bug#14210 "Simple query with > operator on large table
         gives server crash": a C API test case is worth adding because of different
        memory allocation/freeing patterns in handling of C API and SP cursors
      3fa0dd23
  19. 25 Oct, 2005 1 commit
  20. 13 Oct, 2005 2 commits
    • unknown's avatar
      Bug #12698 abnormal program termination running mysql_client_test · ab87b089
      unknown authored
       - Move test for bug#93 from mysql_client_test.c to show_check.test
       - No need for test written in c
      
      
      mysql-test/r/show_check.result:
        Add test case for bug#93, moved from mysql_client_test.c
      mysql-test/t/show_check.test:
        Add test case for bug#93, moved from mysql_client_test.c
      tests/mysql_client_test.c:
        Remove test for bug#95 to show_check.test
      ab87b089
    • unknown's avatar
      Bug #12698 abnormal program termination running mysql_client_test · 8009bdd2
      unknown authored
       - The testcase create a .frm file consisting of "junk". Unfortunately the "junk" wasn't
         written to the .frm file if mysql_client_test was run with -s option to make it run silent.
         This most likely caused the file never to be created on windows, and thus the 
          test case failed.
      
      
      tests/mysql_client_test.c:
        Always write "junk" to the test file.
      8009bdd2
  21. 21 Sep, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#6513 "Test Suite: Values inserted by using · 813fc410
      unknown authored
      cursor is interpreted latin1 character and Bug#9819 "Cursors: Mysql Server
      Crash while fetching from table with 5 million records."
      A fix for a possible memory leak when fetching into an SP cursor
      in a long loop.
      The patch uses a common implementation of cursors in the binary protocol and 
      in stored procedures and implements materialized cursors.
      For implementation details, see comments in sql_cursor.cc
      
      
      include/my_sys.h:
        - declaration for multi_alloc_root
      libmysqld/Makefile.am:
        - drop protocol_cursor.cc, add sql_cursor.cc (replaces the old
        implementation of cursors with a new one)
      mysql-test/r/ctype_ujis.result:
        - test results fixed (a test case for Bug#6513)
      mysql-test/r/sp-big.result:
        - test results fixed (a test case for Bug#9819)
      mysql-test/t/ctype_ujis.test:
        Add a test case for Bug#6513 "Test Suite: Values inserted by using cursor is
         interpreted latin1 character"
      mysql-test/t/sp-big.test:
        Add a restricted test case for Bug#9819 "Cursors: Mysql Server Crash
        while fetching from table with 5 million records."
      mysys/my_alloc.c:
        - an implementation of multi_alloc_root; this is largely a copy-paste
          from mulalloc.c, but the function is small and there is no easy way
          to reuse the existing C function.
      sql/Makefile.am:
        - add sql_cursor.h, sql_cursor.cc (a new implementation of stored procedure
        cursors) and drop protocol_cursor.cc (the old one)
      sql/handler.cc:
        - now TABLE object has its mem_root always initialized.
          Adjust the implementation handler::ha_open
      sql/item_subselect.cc:
        - adjust to the changed declaration of st_select_lex_unit::prepare
      sql/protocol.h:
        - drop Protocol_cursor
      sql/sp_head.cc:
        - move juggling with Query_arena::free_list and Item::next to
          sp_eval_func_item, as this is needed in 3 places already.
      sql/sp_head.h:
        - declare a no-op implementation for cleanup_stmt in sp_instr_cpush.
          This method is needed for non-materializing cursors, which are yet not 
          used in stored procedures.
        - declaration for sp_eval_func_item
      sql/sp_rcontext.cc:
        - reimplement sp_cursor using the new implementation of server side cursors.
        - use sp_eval_func_item to assign values of SP variables from the
          row fetched from a cursor. This should fix a possible memory leak in 
          the old implementation of sp_cursor::fetch
      sql/sp_rcontext.h:
        - reimplement sp_cursor using the new implementation of server side cursors.
      sql/sql_class.cc:
        - disable the functionality that closes transient cursors at commit/rollback;
          transient cursors are not used in 5.0, instead we use materialized ones.
          To be enabled in a later version.
      sql/sql_class.h:
        - adjust to the rename Cursor -> Server_side_cursor
        - additional declarations of select_union used in materialized cursors
      sql/sql_derived.cc:
        - reuse bits of tmp table code in UNION, derived tables, and materialized
          cursors
        - cleanup comments
      sql/sql_lex.h:
        - declarations of auxiliary methods used by materialized cursors
        - a cleanup in st_select_lex_unit interface
      sql/sql_list.h:
        - add an array operator new[] to class Sql_alloc
      sql/sql_prepare.cc:
        - split the tight coupling of cursors and prepared statements to reuse 
          the same implementation in stored procedures
        - cleanups of error processing in Prepared_statement::{prepare,execute}
      sql/sql_select.cc:
        - move the implementation of sensitive (non-materializing) cursors to 
          sql_cursor.cc
        - make temporary tables self-contained: the table, its record and fields
          are allocated in TABLE::mem_root. This implementation is not clean
          and resets thd->mem_root several times because of the way create_tmp_table 
          works (many additional things are done inside it).
        - adjust to the changed declaration of st_select_lex_unit::prepare
      sql/sql_select.h:
        - move the declaration of sensitive (non-materializing) cursors to 
          sql_cursor.cc
      sql/sql_union.cc:
        - move pieces of st_select_unit::prepare to select_union and st_table
          methods to be able to reuse code in the implementation of materialized
          cursors
      sql/sql_view.cc:
        - adjust to the changed signature of st_select_lex_unit::prepare
      sql/table.cc:
        - implement auxiliary st_table methods for use with temporary tables
      sql/table.h:
        - add declarations for auxiliary methods of st_table used to work with 
         temporary tables
      tests/mysql_client_test.c:
        - if cursors are materialized, a parallel update of the table used
          in the cursor may go through: update the test.
      sql/sql_cursor.cc:
        New BitKeeper file ``sql/sql_cursor.cc'' -- implementation of server side
        cursors
      sql/sql_cursor.h:
        New BitKeeper file ``sql/sql_cursor.h'' - declarations for
        server side cursors.
      813fc410
  22. 09 Sep, 2005 1 commit
    • unknown's avatar
      Bug#12817 SHOW STATUS now blob fields · acf8d0f4
      unknown authored
         This fix is cancellation of ChangeSet
         1.2329 05/07/12 08:35:30 reggie@linux.site +8 -0
         Bug 7142  Show Fields from fails using Borland's dbExpress interface
         The reason is we can't fix bug#7142 without
         breaking of existing applications/APIs that worked fine with earlier 4.1
         bug 7142 is fixed in 5.0
      
      
      
      
      mysql-test/r/ps_1general.result:
        Bug #12817 SHOW STATUS now blob fields
      mysql-test/r/ps_2myisam.result:
        Bug #12817 SHOW STATUS now blob fields
      mysql-test/r/ps_3innodb.result:
        Bug #12817 SHOW STATUS now blob fields
      mysql-test/r/ps_4heap.result:
        Bug #12817 SHOW STATUS now blob fields
      mysql-test/r/ps_5merge.result:
        Bug #12817 SHOW STATUS now blob fields
      sql/item.cc:
        Bug #12817 SHOW STATUS now blob fields
      sql/sql_show.cc:
        Bug #12817 SHOW STATUS now blob fields
      tests/mysql_client_test.c:
        Bug #12817 SHOW STATUS now blob fields
      acf8d0f4
  23. 30 Aug, 2005 1 commit
  24. 26 Aug, 2005 1 commit
    • unknown's avatar
      fix for bug #11904 (select statement, cursor, grouping wrong results) · 6d74f5b0
      unknown authored
      sql/sql_select.cc:
        reset the group functions and copy the values of the first row before exiting because of
        maximal number of rows has been read for this cursor fetch. the additional variable is needed
        to save code duplication.
      tests/mysql_client_test.c:
        test for bug #11904 (cursor grouping wrong result)
      6d74f5b0
  25. 23 Aug, 2005 1 commit
    • unknown's avatar
      WL#2486 - natural and using join according to SQL:2003 · fe24add7
      unknown authored
      * Provide backwards compatibility extension to name resolution of
        coalesced columns. The patch allows such columns to be qualified
        with a table (and db) name, as it is in 4.1.
        Based on a patch from Monty.
      
      * Adjusted tests accordingly to test both backwards compatible name
        resolution of qualified columns, and ANSI-style resolution of
        non-qualified columns.
        For this, each affected test has two versions - one with qualified
        columns, and one without. 
      
      
      mysql-test/include/ps_query.inc:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/bdb.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/innodb.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/join.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/join_nested.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/join_outer.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/null_key.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/order_by.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/ps_2myisam.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/ps_3innodb.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/ps_4heap.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/ps_5merge.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/ps_6bdb.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/ps_7ndb.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/select.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/subselect.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/r/type_ranges.result:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/bdb.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/innodb.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/join.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/join_nested.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/join_outer.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/null_key.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/order_by.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/select.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/subselect.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      mysql-test/t/type_ranges.test:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      sql/sql_base.cc:
        * Applied Monty's patch for backwards compatible name resolution
          of qualified columns. The idea is:
          - When a column is qualified, search for the column in all
            tables/views underlying each natural join. In this case
            natural joins are *not* considered leaves.
          - If a column is not qualified, then consider natural joins
            as leaves, thus directly search the result columns of
            natural joins.
        * Simplified 'find_field_in_tables()' - unified two similar
          loops into one.
      sql/table.cc:
        - Removed method & members not needed after Monty's patch.
      sql/table.h:
        - Removed method & members not needed after Monty's patch.
      tests/mysql_client_test.c:
        Put back old tests to test that coalesced columns of natural joins can be qualified.
      fe24add7
  26. 17 Aug, 2005 1 commit
    • unknown's avatar
      Fix bug #11718 query with function, join and order by returns wrong type. · e80aa010
      unknown authored
      create_tmp_field_from_item() was creating tmp field without regard to
      original field type of Item. This results in wrong type being reported to
      client.
      
      To create_tmp_field_from_item() added special handling for Items with 
      DATE/TIME field types to preserve their type.
      
      
      sql/sql_select.cc:
        Fix bug #11718 query with function, join and order by returns wrong type.
      tests/mysql_client_test.c:
        Test case for bug #11718: query with function, join and order by returns wrong type
      e80aa010
  27. 12 Aug, 2005 1 commit
    • unknown's avatar
      Implementation of WL#2486 - · 7517d7e1
      unknown authored
      "Process NATURAL and USING joins according to SQL:2003".
      
      * Some of the main problems fixed by the patch:
        - in "select *" queries the * expanded correctly according to
          ANSI for arbitrary natural/using joins
        - natural/using joins are correctly transformed into JOIN ... ON
          for any number/nesting of the joins.
        - column references are correctly resolved against natural joins
          of any nesting and combined with arbitrary other joins.
      
      * This patch also contains a fix for name resolution of items
        inside the ON condition of JOIN ... ON - in this case items must
        be resolved only against the JOIN operands. To support such
        'local' name resolution, the patch introduces a stack of
        name resolution contexts used at parse time.
      
      NOTICE:
      - This patch is not complete in the sense that
        - there are 2 test cases that still do not pass -
          one in join.test, one in select.test. Both are marked
          with a comment "TODO: WL#2486".
        - it does not include a new test specific for the task
      
      
      mysql-test/include/ps_query.inc:
        Adjusted according to standard NATURAL/USING join semantics.,
      mysql-test/r/bdb.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/derived.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/errors.result:
        The column as a whole cannot be resolved, so different error message.
      mysql-test/r/fulltext.result:
        Adjusted according to standard JOIN ... ON semantics =>
        the ON condition can refer only to the join operands.
      mysql-test/r/fulltext_order_by.result:
        More detailed error message.
      mysql-test/r/innodb.result:
        Adjusted according to standard NATURAL/USING join semantics.
        This test doesn't pass completetly yet!
      mysql-test/r/insert_select.result:
        More detailed error message.
      mysql-test/r/join.result:
        Adjusted according to standard NATURAL/USING join semantics.
        
        NOTICE: there is one test case that still fails, and it is
        commeted out and marked with WL#2486 in the test file.
      mysql-test/r/join_crash.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/join_nested.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/join_outer.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/multi_update.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/null_key.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/order_by.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/ps_2myisam.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/ps_3innodb.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/ps_4heap.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/ps_5merge.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/ps_6bdb.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/ps_7ndb.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/select.result:
        Adjusted according to standard NATURAL/USING join semantics.
        
        NOTICE: there is one failing test case which is commented with
        WL#2486 in the test file.
      mysql-test/r/subselect.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/type_ranges.result:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/r/union.result:
        More detailed error message.
      mysql-test/t/bdb.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/errors.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/fulltext.test:
        Adjusted according to standard JOIN ... ON semantics =>
        the ON condition can refer only to the join operands.
      mysql-test/t/fulltext_order_by.test:
        More detailed error message.
      mysql-test/t/innodb.test:
        Adjusted according to standard NATURAL/USING join semantics.
        This test doesn't pass completetly yet!
      mysql-test/t/insert_select.test:
        More detailed error message.
      mysql-test/t/join.test:
        Adjusted according to standard NATURAL/USING join semantics.
        
        NOTICE: there is one test case that still fails, and it is
        commeted out and marked with WL#2486 in the test file.
      mysql-test/t/join_crash.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/join_nested.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/join_outer.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/null_key.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/order_by.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/select.test:
        Adjusted according to standard NATURAL/USING join semantics.
        
        NOTICE: there is one test case that still fails, and it is
        commeted out and marked with WL#2486 in the test file.
      mysql-test/t/subselect.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/type_ranges.test:
        Adjusted according to standard NATURAL/USING join semantics.
      mysql-test/t/union.test:
        More detailed error message.
      sql/item.cc:
        - extra parameter to find_field_in_tables
        - find_field_in_real_table renamed to find_field_in_table
        - fixed comments/typos
      sql/item.h:
        - added [first | last]_name_resolution_table to class
          Name_resolution_context
        - commented old code
        - standardized formatting
      sql/mysql_priv.h:
        - refactored the find_field_in_XXX procedures,
        - added a new procedure for natural join table references,
        - renamed the find_field_in_XXX procedures to clearer names
      sql/sp.cc:
        - pass the top-most list of the FROM clause to setup_tables
        - extra parameter to find_field_in_tables
      sql/sql_acl.cc:
        - renamed find_field_in_table => find_field_in_table_ref
        - extra parameter to find_field_in_table_ref
        - commented old code
      sql/sql_base.cc:
        This file contains the core of the implementation of the processing
        of NATURAL/USING joins (WL#2486).
        - added many comments to old code
        - refactored the group of find_field_in_XXX procedures, and added a
          new procedure for natural joins. There is one find_field_in_XXX procedure
          per each type of table reference (stored table, merge view, or natural
          join); one meta-procedure that selects the correct one depeneding on the
          table reference; and one procedure that goes over a list of table
          referenes.
        - NATURAL/USING joins are processed through the procedures:
            mark_common_columns, store_natural_using_join_columns,
            store_top_level_join_columns, setup_natural_join_row_types.
          The entry point to processing NATURAL/USING joins is the
          procedure 'setup_natural_join_row_types'.
        - Replaced the specialized Field_iterator_XXX iterators with one
          generic iterator over the fields of a table reference.
        - Simplified 'insert_fields' and 'setup_conds' due to encapsulation of
          the processing of natural joins in a separate set of procedures.
      sql/sql_class.h:
        - Commented old code.
      sql/sql_delete.cc:
        - Pass the FROM clause to setup_tables.
      sql/sql_help.cc:
        - pass the end name resolution table to find_field_in_tables
        - adjust the list of tables for name resolution
      sql/sql_insert.cc:
        - Changed the code that saves and restores the current context to
          support the list of tables for name resolution -
          context->first_name_resolution_table, and
          table_list->next_name_resolution_table.
          Needed to support an ugly trick to resolve inserted columns only in
          the first table.
        - Added Name_resolution_context::[first | last]_name_resolution_table.
        - Commented old code
      sql/sql_lex.cc:
        - set select_lex.parent_lex correctly
        - set correct state of the current name resolution context
      sql/sql_lex.h:
        - Added a stack of name resolution contexts to support local
          contexts for JOIN ... ON conditions.
        - Commented old code.
      sql/sql_load.cc:
        - Pass the FROM clause to setup_tables.
      sql/sql_olap.cc:
        - Pass the FROM clause to setup_tables.
      sql/sql_parse.cc:
        - correctly set SELECT_LEX::parent_lex
        - set the first table of the current name resoltion context
        - added support for NATURAL/USING joins
        - commented old code
      sql/sql_select.cc:
        - Pass the FROM clause to setup_tables.
        - Pass the end table to find_field_in_tables
        - Improved comments
      sql/sql_show.cc:
        - Set SELECT_LEX::parent_lex.
      sql/sql_update.cc:
        - Pass the FROM clause to setup_tables.
      sql/sql_yacc.yy:
        - Added support for a stack of name resolution contexts needed to
          implement name resolution for JOIN ... ON. A context is pushed
          for each new JOIN ... ON, and popped afterwards.
        - Added support for NATURAL/USING joins.
      sql/table.cc:
        - Added new class Natural_join_column to hide the heterogeneous
          representation of column references for stored tables and for
          views.
        - Added a new list TABLE_LIST::next_name_resolution_table to
          support name resolution with NATURAL/USING joins. Also added
          other members to TABLE_LIST to support NATURAL/USING joins.
        - Added a generic iterator over the fields of table references
          of various types - class Field_iterator_table_ref
      sql/table.h:
        - Added new class Natural_join_column to hide the heterogeneous
          representation of column references for stored tables and for
          views.
        - Added a new list TABLE_LIST::next_name_resolution_table to
          support name resolution with NATURAL/USING joins. Also added
          other members to TABLE_LIST to support NATURAL/USING joins.
        - Added a generic iterator over the fields of table references
          of various types - class Field_iterator_table_ref
      tests/mysql_client_test.c:
        Adjusted according to standard NATURAL JOIN syntax.
      7517d7e1
  28. 10 Aug, 2005 3 commits
    • unknown's avatar
      A fix and a test case for Bug#12243 "MySQL Server crashes with 2 · 6861b1bf
      unknown authored
      cursors (+ commit)" and Bug#11832 "Server crash with InnoDB + Cursors"
      See comments to the changed files.
      
      
      innobase/include/read0read.h:
        - add cursor_view_t::n_mysql_tables_in_use
      innobase/read/read0read.c:
        - maintain cursor_view_t::n_mysql_tables_in_use. InnoDB
        maintains trx->n_mysql_tables_in_use to know when it can auto-commit
        a read-only statement. When this count drops to zero,
        MySQL has ended processing of such statement and InnoDB can commit.
        Cursors should not break this invariant, and should exclude the tables
        used in a cursor from the count of active tables.
        When a cursor is closed, the number of its tables is added back, 
        to ensure that close_thread_tables->unlock_external->
        ha_innobase::external_lock(F_UNLCK) won't drop the count in trx 
        below zero.
      innobase/row/row0sel.c:
        - remove the restoration of the global read view from 
        row_search_for_mysql: MySQL may call row_search_for_mysql
        more than once when fetching a row for a cursor (e.g. if there
        is a WHERE clause that filters out some rows).
      sql/ha_innodb.cc:
        - add more verbose printout for the case when we close an InnoDB
        connection without priorlly issuing a commit or rollback. The problem
        should be investigated.
      tests/mysql_client_test.c:
        - add a test case for Bug#12243 "MySQL Server crashes with 2 cursors 
        (+ commit)"
      6861b1bf
    • unknown's avatar
      Fix coding style. · ad729777
      unknown authored
      ad729777
    • unknown's avatar
      A fix for Bug#11901 "mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY join in · 8e9f6b19
      unknown authored
      subqry order by server crash": failing DBUG_ASSERT(curr_join == this)
      when opening a cursor.
      Ensure that for top-level join curr_join == join (always), 
      and thus fix the failing assert.
      curr_join is a hack to ensure that uncacheable subqueries can be
      re-evaluated safely, and should be never different from main join
      in case of top-level join.
      
      
      sql/sql_select.cc:
        - utilize tmp_join only if we evaluate an uncacheable subquery.
      sql/sql_select.h:
        - implement JOIN::is_top_level_join()
      tests/mysql_client_test.c:
        A test case for Bug#11901 "mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY
         join in subqry order by server crash"
      8e9f6b19
  29. 08 Aug, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#11909 "mysql_stmt_attr_set · 76a280f1
      unknown authored
      CURSOR_TYPE_READ_ONLY nested queries corrupt result"
      
      
      sql/sql_prepare.cc:
        If there is a cursor, use its protocol for fetch: 
        Protocol instances have a state and thd->protocol_prep can't
        be used for multiple cursors.
      sql/sql_select.cc:
        - init Cursor::protocol
      sql/sql_select.h:
        - add Cursor::protocol
      tests/mysql_client_test.c:
        A test case for Bug#11909 "mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY
         nested queries corrupt result"
      76a280f1
  30. 28 Jul, 2005 1 commit
    • unknown's avatar
      Fixed compiler warnings · d2810c56
      unknown authored
      client/mysqldump.c:
        Fixed wrong argument to printf()
      client/mysqltest.c:
        Fixed compiler warning
      myisam/ft_boolean_search.c:
        Fixed compiler warning
      myisammrg/myrg_static.c:
        Fixed compiler warning
      mysql-test/r/rpl_drop_temp.result:
        Drop used database
      mysql-test/t/rpl_drop_temp.test:
        Drop used database
      ndb/src/common/logger/LogHandler.cpp:
        Fixed compiler warning
      sql/field.cc:
        Fixed compiler warning
      sql/ha_ndbcluster.cc:
        Fixed compiler warning
      sql/sql_base.cc:
        Fixed compiler warning
      tests/mysql_client_test.c:
        Fixed compiler warning
      d2810c56
  31. 20 Jul, 2005 2 commits
    • unknown's avatar
      Implement MySQL framework to support consistent read views in · ec55fec9
      unknown authored
      cursors. This should fix Bug#11813 when InnoDB part is in 
      (tested with a draft patch).
      The idea of the patch is that if a storage engine supports
      consistent read views, we open one when open a cursor,
      set is as the active view when fetch from the cursor, and close
      together with cursor close.
      
      
      sql/examples/ha_archive.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/examples/ha_example.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/examples/ha_tina.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/ha_berkeley.cc:
        - extend handlerton with cursors methods
      sql/ha_blackhole.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/ha_federated.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/ha_heap.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/ha_innodb.cc:
        - extend handlerton with cursors methods
      sql/ha_myisam.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/ha_myisammrg.cc:
        - extend handlerton with cursors methods; fix coding style
      sql/ha_ndbcluster.cc:
        - extend handlerton with cursors methods
      sql/handler.h:
        - extend handlerton with cursors methods
      sql/sql_select.cc:
        - create a consistent read view when we open a cursor,
          set it for a fetch, and free when we closing the cursor.
      sql/sql_select.h:
        - add Cursor::ht_info to remember read views used in a cursor.
      tests/mysql_client_test.c:
        Disable an assert that will be no longer valid when consistent
        read views in InnoDB are used.
      ec55fec9
    • unknown's avatar
      cs fixes from last commit · 6147be6e
      unknown authored
      6147be6e
  32. 19 Jul, 2005 2 commits
    • unknown's avatar
      Cleanups after merge from 4.1. · ccc3052d
      unknown authored
      mysql-test/r/ps_1general.result:
        Update results
      mysql-test/r/ps_2myisam.result:
        Update results
      mysql-test/r/ps_3innodb.result:
        Update results
      mysql-test/r/ps_4heap.result:
        Update results
      mysql-test/r/ps_5merge.result:
        Update results
      mysql-test/r/ps_6bdb.result:
        Update results
      mysql-test/r/ps_7ndb.result:
        Update results
      mysql-test/r/select.result:
        Update results
      mysql-test/t/disabled.def:
        Disable ndb_condition_pushdown test
      mysql-test/t/select.test:
        Fix bad merge
      sql/field_conv.cc:
        Update name of warning message
      sql/mysqld.cc:
        Set proper thd->killed
      tests/mysql_client_test.c:
        Update test cases, change verify_prepared_field() help function
        so it is passed the filename and line from where it is called
        and includes that in the error message.
      ccc3052d
    • unknown's avatar
      A fix and a test case for Bug#10760 and complementary cleanups. · de6f5ae5
      unknown authored
      The idea of the patch
      is that every cursor gets its own lock id for table level locking.
      Thus cursors are protected from updates performed within the same 
      connection. Additionally a list of transient (must be closed at
      commit) cursors is maintained and all transient cursors are closed
      when necessary. Lastly, this patch adds support for deadlock
      timeouts to TLL locking when using cursors.
      + post-review fixes.
      
      
      include/thr_lock.h:
        - add a notion of lock owner to table level locking. When using
          cursors, lock owner can not be identified by a thread id any more, 
          as we must protect cursors from updates issued within the same 
          connection (thread). So, each cursor has its own lock identifier to 
          use with table level locking.
        - extend return values of thr_lock and thr_multi_lock with
          THR_LOCK_TIMEOUT and THR_LOCK_DEADLOCK, since these conditions
          are now possible (see comments to thr_lock.c)
      mysys/thr_lock.c:
        Better support for cursors:
        - use THR_LOCK_OWNER * as lock identifier, not pthread_t.
        - check and return an error for a trivial deadlock case, when an
          update statement is issued to a table locked by a cursor which has 
          been previously opened in the same connection.
        - add support for locking timeouts: with use of cursors, trivial 
          deadlocks can occur. For now the only remedy is the lock wait timeout,
          which is initialized from a new global variable 'table_lock_wait_timeout'
          Example of a deadlock (assuming the storage engine does not downgrade 
          locks):
          con1: open cursor for select * from t1;
          con2: open cursor for select * from t2;
          con1: update t2 set id=id*2;  -- blocked
          con2: update t1 set id=id*2;  -- deadlock
          Lock timeouts are active only if a connection is using cursors.
        - the check in the wait_for_lock loop has been changed from
          data->cond != cond to data->cond != 0. data->cond is zeroed
          in every place it's changed. 
        - added comments
      sql/examples/ha_archive.cc:
        - extend the handlerton with the info about cursor behaviour at commit.
      sql/examples/ha_archive.h:
        - ctor moved to .cc to make use of archive handlerton
      sql/examples/ha_example.cc:
        - add handlerton instance, init handler::ht with it
      sql/examples/ha_example.h:
        - ctor moved to .cc to make use of ha_example handlerton
      sql/examples/ha_tina.cc:
        - add handlerton instance, init handler::ht with it
      sql/examples/ha_tina.h:
        - ctor moved to .cc to make use of CSV handlerton
      sql/ha_berkeley.cc:
        - init handlerton::flags and handler::ht
      sql/ha_berkeley.h:
        - ctor moved to .cc to make use of BerkeleyDB handlerton
      sql/ha_blackhole.cc:
        - add handlerton instance, init handler::ht with it
      sql/ha_blackhole.h:
        - ctor moved to .cc to make use of blackhole handlerton
      sql/ha_federated.cc:
        - add handlerton instance, init handler::ht with it
      sql/ha_federated.h:
        - ctor moved to .cc to make use of federated handlerton
      sql/ha_heap.cc:
        - add handlerton instance, init handler::ht with it
      sql/ha_heap.h:
        - ctor moved to .cc to make use of ha_heap handlerton
      sql/ha_innodb.cc:
        - init handlerton::flags and handler::ht of innobase storage engine
      sql/ha_innodb.h:
        - ctor moved to .cc to make use of archive handlerton
      sql/ha_myisam.cc:
        - add handlerton instance, init handler::ht with it
      sql/ha_myisam.h:
        - ctor moved to .cc to make use of MyISAM handlerton
      sql/ha_myisammrg.cc:
        - init handler::ht in the ctor
      sql/ha_myisammrg.h:
        - ctor moved to .cc to make use of MyISAM MERGE handlerton
      sql/ha_ndbcluster.cc:
        - init handlerton::flags and handler::ht
      sql/handler.cc:
        - drop support for ISAM storage engine, which was removed from 5.0
        - close all "transient" cursors at COMMIT/ROLLBACK. A "transient"
          SQL level cursor is a cursor that uses tables that have a transaction-
          specific state.
      sql/handler.h:
        - extend struct handlerton with flags, add handlerton *ht to every
          handler instance.
      sql/lock.cc:
        - extend mysql_lock_tables to send error to the client if 
          thr_multi_lock returns a timeout or a deadlock error.
      sql/mysqld.cc:
        - add server option --table_lock_wait_timeout (in seconds)
      sql/set_var.cc:
        - add new global variable 'table_lock_wait_timeout' to specify
        a wait timeout for table-level locks of MySQL (in seconds). The default
        timeout is 50 seconds. The timeout is active only if the connection
        has open cursors.
      sql/sql_class.cc:
        - implement Statement_map::close_transient_cursors
        - safety suggests that we need an assert ensuring 
         llock_info->n_cursors is functioning properly, adjust destruction of
         the Statement_map to allow such assert in THD::~THD
      sql/sql_class.h:
        - add support for Cursors registry to Statement map.
      sql/sql_prepare.cc:
        - maintain a list of cursors that must be closed at commit/rollback.
      sql/sql_select.cc:
        - extend class Cursor to support specific at-COMMIT/ROLLBACK behavior.
        If a cursor uses tables of a storage engine that 
        invalidates all open tables at COMMIT/ROLLBACK, it must be closed
        before COMMIT/ROLLBACK is executed.
      sql/sql_select.h:
        - add an own lock_id and commit/rollback status flag to class Cursor
      tests/mysql_client_test.c:
        A test case for Bug#10760 and complementary issues: test a simple
        deadlock case too.
      mysql-test/var:
        New BitKeeper file ``mysql-test/var''
      de6f5ae5