1. 29 May, 2007 6 commits
  2. 28 May, 2007 6 commits
    • unknown's avatar
      Merge kpettersson@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 8edb0f26
      unknown authored
      into  adventure.(none):/home/thek/Development/cpp/mysql-5.1-runtime
      
      
      mysql-test/t/disabled.def:
        Auto merged
      8edb0f26
    • unknown's avatar
      66f22d80
    • unknown's avatar
      Fix a compile-time warning. · f1ac577d
      unknown authored
      f1ac577d
    • unknown's avatar
      Bug#24988 FLUSH PRIVILEGES causes brief unavailability · feb560c4
      unknown authored
      - A race condition caused brief unavailablility when trying to acccess
        a table.
      - The unprotected variable 'grant_option' wasn't intended to alternate
        during normal execution. Variable initialization moved to grant_init
        a lines responsible for the alternation are removed. 
      
      
      sql/mysqld.cc:
        - Added documentation to describe grant_option flag.
      sql/sql_acl.cc:
        - This patch removes lines which causes grant_option to alternate and moves
          variable initialization to the grant_init()-function.
      feb560c4
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 3fb3e57f
      unknown authored
      into  vajra.(none):/opt/local/work/mysql-5.1-4968-clean
      
      3fb3e57f
    • unknown's avatar
      5.1 version of a fix and test cases for bugs: · e1e991b1
      unknown authored
      Bug#4968 ""Stored procedure crash if cursor opened on altered table"
      Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
      Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
      stored procedure."
      Bug#19733 "Repeated alter, or repeated create/drop, fails"
      Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
      Bug#24879 "Prepared Statements: CREATE TABLE (UTF8 KEY) produces a 
      growing key length" (this bug is not fixed in 5.0)
      
      Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
      statements in stored routines or as prepared statements caused
      incorrect results (and crashes in versions prior to 5.0.25).
      
      In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
      SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).
        
      The problem of bugs 4968, 19733, 19282 and 6895 was that functions
      mysql_prepare_table, mysql_create_table and mysql_alter_table are not
      re-execution friendly: during their operation they modify contents
      of LEX (members create_info, alter_info, key_list, create_list),
      thus making the LEX unusable for the next execution.
      In particular, these functions removed processed columns and keys from
      create_list, key_list and drop_list. Search the code in sql_table.cc 
      for drop_it.remove() and similar patterns to find evidence.
        
      The fix is to supply to these functions a usable copy of each of the
      above structures at every re-execution of an SQL statement. 
        
      To simplify memory management, LEX::key_list and LEX::create_list
      were added to LEX::alter_info, a fresh copy of which is created for
      every execution.
        
      The problem of crashing bug 22060 stemmed from the fact that the above 
      metnioned functions were not only modifying HA_CREATE_INFO structure 
      in LEX, but also were changing it to point to areas in volatile memory
      of the execution memory root.
         
      The patch solves this problem by creating and using an on-stack
      copy of HA_CREATE_INFO in mysql_execute_command.
      
      Additionally, this patch splits the part of mysql_alter_table
      that analizes and rewrites information from the parser into
      a separate function - mysql_prepare_alter_table, in analogy with
      mysql_prepare_table, which is renamed to mysql_prepare_create_table.
      
      
      mysql-test/r/ps.result:
        Update test results (Bug#19182, Bug#22060, Bug#4968, Bug#6895)
      mysql-test/r/sp.result:
        Update results (Bug#19733)
      mysql-test/t/ps.test:
        Add test cases for Bug#19182, Bug#22060, Bug#4968, Bug#6895
      mysql-test/t/sp.test:
        Add a test case for Bug#19733
      sql/field.h:
        Implement a deep copy constructor for create_field
      sql/mysql_priv.h:
        LEX::key_list and LEX::create_list were moved to LEX::alter_info.
        Update declarations to use LEX::alter_info instead of these two
        members.
        Remove declarations of mysql_add_index, mysql_drop_index.
      sql/sql_class.cc:
        Implement deep copy constructors.
      sql/sql_class.h:
        Implement (almost) deep copy constructors for key_part_spec, 
        Alter_drop, Alter_column, Key, foreign_key.
        Replace pair<columns, keys> with an instance of Alter_info in
        select_create constructor. We create a new copy of Alter_info
        each time we re-execute SELECT .. CREATE prepared statement.
      sql/sql_insert.cc:
        Adjust to a new signature of create_table_from_items.
      sql/sql_lex.cc:
        Implement Alter_info::Alter_info that would make a "deep" copy
        of all definition lists (keys, columns).
        Move is_partition_management() from sql_partition.cc (feature-based
        file division is evil).
      sql/sql_lex.h:
        Move key_list and create_list to class Alter_info. Implement
        Alter_info::Alter_info that can be used with PS and SP.
        Get rid of Alter_info::clear() which was an attempt to save on
        matches and always use Alter_info::reset().
        Implement an auxiliary Alter_info::init_for_create_from_alter()
        which is used in mysql_alter_table.
      sql/sql_list.cc:
          Implement a copy constructor of class List that makes a deep copy
          of all list nodes.
      sql/sql_list.h:
        Implement a way to make a deep copy of all list nodes.
      sql/sql_parse.cc:
        Adjust to new signatures of mysql_create_table, mysql_alter_table,
        select_create. Functions mysql_create_index and mysql_drop_index has
        become identical after initialization of alter_info was moved to the 
        parser, and were merged. Flag enable_slow_log was not updated for 
        SQLCOM_DROP_INDEX, which was a bug.
        Just like CREATE INDEX, DROP INDEX is currently done via complete 
        table rebuild and is rightfully a slow administrative statement.
      sql/sql_partition.cc:
        Move is_partition_management() to sql_lex.cc
        Adjust code to the new Alter_info.
      sql/sql_table.cc:
        Adjust mysql_alter_table, mysql_recreate_table, mysql_create_table,
        mysql_prepare_table to new signatures.
        Rename mysql_prepare_table to mysql_prepare_create_table. Make
        sure it follows the convention and returns FALSE for success and
        TRUE for error.
        Move parts of mysql_alter_table to mysql_prepare_alter_table.
        Move the first invokation of mysql_prepare_table from mysql_alter_table
        to compare_tables, as it was needed only for the purpose
        of correct comparison.
        Since now Alter_info itself is created in the runtime mem root,
        adjust mysql_prepare_table to always allocate memory in the
        runtime memory root.
        Remove dead code.
      sql/sql_yacc.yy:
        LEX::key_list and LEX::create_list moved to class Alter_info
      e1e991b1
  3. 26 May, 2007 1 commit
    • unknown's avatar
      Fix for · 4de5ee42
      unknown authored
      bug#26338 events_bugs.test fail on Debian
      and
      bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      
      
      mysql-test/r/events_bugs.result:
        uppercase
      mysql-test/t/events.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_bugs.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_grant.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_logs_tests.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_scheduling.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_stress.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_time_zone.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_trans.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      mysql-test/t/events_trans_notembedded.test:
        wait at the end of the script for event which haven't
        finished their execution. This should solve
        bug#26338 events_bugs.test fail on Debian
        and
        bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
      4de5ee42
  4. 25 May, 2007 5 commits
    • unknown's avatar
      Code review comments · 4c6e754d
      unknown authored
      
      sql/sql_lex.cc:
        Fixed parenthese typo, found during code review
      4c6e754d
    • unknown's avatar
      Bug#27876 (SF with cyrillic variable name fails during execution (regression)) · a200ec51
      unknown authored
      The root cause of this bug is related to the function skip_rear_comments,
      in sql_lex.cc
      
      Recent code changes in skip_rear_comments changed the prototype from
      "const uchar*" to "const char*", which had an unforseen impact on this test:
        (endp[-1] < ' ')
      With unsigned characters, this code filters bytes of value [0x00 - 0x20]
      With *signed* characters, this also filters bytes of value [0x80 - 0xFF].
      
      This caused the regression reported, considering cyrillic characters in the
      parameter name to be whitespace, and truncated.
      Note that the regression is present both in 5.0 and 5.1.
      
      With this fix:
      - [0x80 - 0xFF] bytes are no longer considered whitespace.
      This alone fixes the regression.
      
      In addition, filtering [0x00 - 0x20] was found bogus and abusive,
      so that the code now filters uses my_isspace when looking for whitespace.
      
      Note that this fix is only addressing the regression affecting UTF-8
      in general, but does not address a more fundamental problem with
      skip_rear_comments: parsing a string *backwards*, starting at end[-1],
      is not safe with multi-bytes characters, so that end[-1] can confuse the
      last byte of a multi-byte characters with a characters to filter out.
      
      The only known impact of this remaining issue affects objects that have to
      meet all the conditions below:
      
      - the object is a FUNCTION / PROCEDURE / TRIGGER / EVENT / VIEW
      - the body consist of only *1* instruction, and does *not* contain a
        BEGIN-END block
      - the instruction ends, lexically, with <ident> <whitespace>* ';'?
        For example, "select <ident>;" or "return <ident>;"
      - The last character of <ident> is a multi-byte character
      - the last byte of this character is ';' '*', '/' or whitespace
      
      In this case, the body of the object will be truncated after parsing,
      and stored in an invalid format.
      
      This last issue has not been fixed in this patch, since the real fix
      will be implemented by Bug 25411 (trigger code truncated), which is caused
      by the very same code.
      The real problem is that the function skip_rear_comments is only a
      work-around, and should be removed entirely: see the proposed patch for
      bug 25411 for details.
      
      
      sql/sp_head.cc:
        In skip_rear_comments,
        Filter out only whitespace, not other (non ascii or control) valid characters
      sql/sql_lex.cc:
        In skip_rear_comments,
        Filter out only whitespace, not other (non ascii or control) valid characters
      sql/sql_lex.h:
        In skip_rear_comments,
        Filter out only whitespace, not other (non ascii or control) valid characters
      sql/sql_view.cc:
        In skip_rear_comments,
        Filter out only whitespace, not other (non ascii or control) valid characters
      tests/mysql_client_test.c:
        Bug#27876 (SF with cyrillic variable name fails during execution (regression))
      a200ec51
    • unknown's avatar
      Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 329f5d12
      unknown authored
      into  whirlpool.mysql.com:/work/mysql-5.1-runtime
      
      329f5d12
    • unknown's avatar
      Fix for bug#28666 CREATE EVENT ... EVERY 0 SECOND let server crash · 6dc3c042
      unknown authored
      A missing check for zero value of interval was added.
      
      
      mysql-test/r/events_bugs.result:
        update result file
      mysql-test/t/events_bugs.test:
        add test case for bug#28666 CREATE EVENT ... EVERY 0 SECOND let server crash
      sql/event_data_objects.cc:
        add a missing check about zero value for interval
      6dc3c042
    • unknown's avatar
      Merge four.local.lan:/WORK/mysql-5.1-runtime/src-clean · 55c09f97
      unknown authored
      into  four.local.lan:/WORK/mysql-5.1-runtime/src-1
      
      55c09f97
  5. 24 May, 2007 17 commits
    • unknown's avatar
      Fix warnings. · 813f9cb5
      unknown authored
      
      sql/item_func.h:
        Resolve a warning (wrong initialization order).
      sql/sql_lex.cc:
        Make -ansi mode compile.
      813f9cb5
    • unknown's avatar
      This changeset belongs to the fix of Bug#735 Prepared Statements: there is no... · 2fcf0db3
      unknown authored
      This changeset belongs to the fix of Bug#735 Prepared Statements: there is no support for Query Cache
        
      - Create "--ps-protocol" and no "--<whatever>-protocol" variants of the former tests
        t/grant_cache.test and t/query_cache_sql_prepare.test.
      - Some additional subtest and fixes of bugs
      - Minor improvements 
      
      
      mysql-test/include/grant_cache.inc:
        - Rename mysql-test/t/grant_cache.test to include/grant_cache.inc
        - Toplevel scripts running variants of this test are
             t/grant_cache_ps_prot.test (runs only with "--ps-protocol")
             t/grant_cache_no_prot.test (skipped if any protocol is assigned)
        - Modifications to include/grant_cache.inc:
          - Minor improvements like replace --error <number> by --error <name>
          - enable that some subtests are run with "--ps-protocol"
      mysql-test/include/query_cache_sql_prepare.inc:
        - Rename t/query_cache_sql_prepare.test to include/query_cache_sql_prepare.inc
        - Toplevel scripts running variants of this test are
             query_cache_ps_ps_prot.test (skipped if other protocol than --ps-protocol is used.)
             query_cache_ps_no_prot.test (skipped if --<whatever>-protocol is used)   
        - Modifications to include/query_cache_sql_prepare.inc:
        - Minor improvements like add drop table
        - Add tests checking that 
          - another connection gets the same amount of QC hits
          - statements running via ps-protocol do not hit QC results of preceding sql EXECUTEs
      mysql-test/r/grant_cache_no_prot.result:
        Updated result
      mysql-test/r/query_cache_ps_no_prot.result:
        Updated result
      tests/mysql_client_test.c:
        - correct wrong sized "for" loop
        - add some missing tests of query cache hit numbers
      mysql-test/r/grant_cache_ps_prot.result:
        New BitKeeper file ``mysql-test/r/grant_cache_ps_prot.result''
      mysql-test/r/query_cache_ps_ps_prot.result:
        New BitKeeper file ``mysql-test/r/query_cache_ps_ps_prot.result''
      mysql-test/t/grant_cache_no_prot.test:
        Variant of the test grant_cache to be run without any "--<whatever>-protocol"
      mysql-test/t/grant_cache_ps_prot.test:
        Variant of the test grant_cache to be run with "--ps-protocol" only
      mysql-test/t/query_cache_ps_no_prot.test:
        Variant of the test query_cache_sql_prepare to be run without any "--<whatever>-protocol"
      mysql-test/t/query_cache_ps_ps_prot.test:
        Variant of the test query_cache_sql_prepare to be run with "--ps-protocol" only
      2fcf0db3
    • unknown's avatar
      Merge vajra.(none):/opt/local/work/mysql-5.0-runtime · 8f09c969
      unknown authored
      into  vajra.(none):/opt/local/work/mysql-5.1-runtime
      
      
      sql/mysql_priv.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      8f09c969
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1 · dafe92cb
      unknown authored
      into  vajra.(none):/opt/local/work/mysql-5.1-runtime
      
      
      include/my_global.h:
        Auto merged
      mysql-test/include/mix1.inc:
        Auto merged
      mysql-test/r/innodb_mysql.result:
        Auto merged
      mysql-test/r/ps_2myisam.result:
        Auto merged
      mysql-test/r/ps_3innodb.result:
        Auto merged
      mysql-test/r/ps_4heap.result:
        Auto merged
      mysql-test/r/ps_5merge.result:
        Auto merged
      mysql-test/r/ps_7ndb.result:
        Auto merged
      mysql-test/r/type_date.result:
        Auto merged
      mysql-test/t/disabled.def:
        Auto merged
      mysql-test/t/type_date.test:
        Auto merged
      sql/filesort.cc:
        Auto merged
      sql/handler.cc:
        Auto merged
      sql/item_func.cc:
        Auto merged
      sql/item_func.h:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      dafe92cb
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · de6ebb7d
      unknown authored
      into  vajra.(none):/opt/local/work/mysql-5.0-runtime
      
      
      sql/mysql_priv.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      de6ebb7d
    • unknown's avatar
      Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.1-build · 59ba51f9
      unknown authored
      into  trift2.:/MySQL/M51/push-5.1
      
      59ba51f9
    • unknown's avatar
      Makefile.am : Add "embedded" tests to the "test-bt" target. · 6279ade7
      unknown authored
      
      Makefile.am:
        The "test-bt" target was lacking "embedded" tests -
        add them, dependent on the build of the test binary needed for them.
      6279ade7
    • unknown's avatar
      Merge kpettersson@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · b85200ba
      unknown authored
      into  adventure.(none):/home/thek/Development/cpp/mysql-5.1-runtime
      
      b85200ba
    • unknown's avatar
      Merge adventure.(none):/home/thek/Development/cpp/bug28644/my50-bug28644 · 1274e47b
      unknown authored
      into  adventure.(none):/home/thek/Development/cpp/bug28644/my51-bug28644
      
      
      mysql-test/lib/mtr_report.pl:
        Auto merged
      sql/sql_test.cc:
        Auto merged
      1274e47b
    • unknown's avatar
      Merge adventure.(none):/home/thek/Development/cpp/bug28644/my41-bug28644 · b0544266
      unknown authored
      into  adventure.(none):/home/thek/Development/cpp/bug28644/my50-bug28644
      
      
      mysql-test/lib/mtr_report.pl:
        Auto merged
      sql/sql_test.cc:
        Auto merged
      b0544266
    • unknown's avatar
      Bug#28644 Memory status report confused with memory leak · 5c398486
      unknown authored
      This patch removes a false memory leak error report from the test suite.
      There is a test case that puposely provokes a SAFEMALLOC leak report,
      even though there is no actual leak.
      
      
      mysql-test/lib/mtr_report.pl:
        There is a test case that purposely provokes a SAFEMALLOC leak report,
        even though there is no actual leak. We need to detect this, and ignore the
        warning in that case.
      sql/sql_test.cc:
        Added tags to surround memory dump status report to help the test
        suite to determine that this isn't a memory leak
      5c398486
    • unknown's avatar
      Merge dfischer@bk-internal.mysql.com:/home/bk/mysql-5.1-build · 70cc58b2
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
      
      70cc58b2
    • unknown's avatar
      Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build · 0f322a14
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
      
      
      configure.in:
        Auto merged
      include/my_global.h:
        Auto merged
      sql/item_func.cc:
        Auto merged
      strings/strtod.c:
        Auto merged
      0f322a14
    • unknown's avatar
      Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build-work · 0c13c399
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build
      
      0c13c399
    • unknown's avatar
      Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1 · 17221bd0
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
      
      
      configure.in:
        Auto merged
      include/my_global.h:
        Auto merged
      sql/item_func.cc:
        Auto merged
      strings/strtod.c:
        Auto merged
      17221bd0
    • unknown's avatar
      Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0 · 9610f72d
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build
      
      
      configure.in:
        Auto merged
      include/my_global.h:
        Auto merged
      sql/item_func.cc:
        Auto merged
      strings/strtod.c:
        Auto merged
      9610f72d
    • unknown's avatar
      Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build · 1c0389d7
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build-work
      
      1c0389d7
  6. 23 May, 2007 5 commits
    • unknown's avatar
      Merge mockturtle.local:/home/dlenev/src/mysql-5.0-like · 9ac9acd4
      unknown authored
      into  mockturtle.local:/home/dlenev/src/mysql-5.1-like-2
      
      
      sql/handler.h:
        Auto merged
      sql/mysql_priv.h:
        5.1 version of mysql_priv.h already contains all necessary changes.
      sql/sql_parse.cc:
        5.1 version of sql_parse.cc already contains all necessary changes.
      sql/sql_table.cc:
        5.1 version of sql_table.cc already contains all necessary changes.
      sql/sql_yacc.yy:
        SCCS merged
      mysql-test/r/grant2.result:
        Manual merge.
      mysql-test/t/grant2.test:
        Manual merge.
      9ac9acd4
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · aab53c0d
      unknown authored
      into  mockturtle.local:/home/dlenev/src/mysql-5.1-like-2
      
      
      sql/sql_parse.cc:
        Auto merged
      aab53c0d
    • unknown's avatar
      5.1 version of fix for: · 5698a6a8
      unknown authored
        Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
                    by other connections"
        Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
      As well as:
        Bug #25578 "CREATE TABLE LIKE does not require any privileges
                    on source table".
      
      The first and the second bugs resulted in various errors and wrong
      binary log order when one tried to execute concurrently CREATE TABLE LIKE
      statement and DDL statements on source table or DML/DDL statements on its
      target table.
      
      The problem was caused by incomplete protection/table-locking against
      concurrent statements implemented in mysql_create_like_table() routine.
      We solve it by simply implementing such protection in proper way.
      Most of actual work for 5.1 was already done by fix for bug 20662 and
      preliminary patch changing locking in ALTER TABLE.
      
      The third bug allowed user who didn't have any privileges on table create
      its copy and therefore circumvent privilege check for SHOW CREATE TABLE.
      
      This patch solves this problem by adding privilege check, which was missing.
      
      Finally it also removes some duplicated code from mysql_create_like_table()
      and thus fixes bug #26869 "TABLE_LIST::table_name_length inconsistent with
      TABLE_LIST::table_name".
      
      
      mysql-test/r/create-big.result:
        Added test coverage for concurrency-related issues with CREATE TABLE LIKE.
      mysql-test/r/create.result:
        Adjusted error-code in the test case after refactoring code that
        implements CREATE TABLE ... LIKE.
      mysql-test/r/grant2.result:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      mysql-test/t/create-big.test:
        Added test coverage for concurrency-related issues with CREATE TABLE LIKE.
      mysql-test/t/create.test:
        Adjusted error-code in the test case after refactoring code that
        implements CREATE TABLE ... LIKE.
      mysql-test/t/disabled.def:
        Recent code changes ensured that CREATE TABLE LIKE statement is properly
        isolated against other statements, so synchronization.test should no
        longer fail (see fix for bug 20662 and preliminary patch for bug 23667
        changing ALTER TABLE locking).
      mysql-test/t/grant2.test:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      sql/handler.h:
        Introduced new flag for HA_CREATE_INFO::options in order to be able to
        distinguish CREATE TABLE ... LIKE from other types of CREATE TABLE.
      sql/mysql_priv.h:
        mysql_create_like_table() now takes source table name not as a
        Table_ident object but as regular table list element.
      sql/sql_lex.h:
        Removed LEX::like_name member. Now we use special flag in
        LEX::create_info::options for distinguishing CREATE TABLE ... LIKE
        from other types of CREATE TABLE and store name of source table as
        regular element in statement's table list.
      sql/sql_parse.cc:
        CREATE TABLE ... LIKE implementation now uses statement's table list
        for storing information about the source table. We also use flag
        in LEX::create_info.options for distinguishing it from other types
        of CREATE TABLE.
        Finally CREATE TABLE ... LIKE now requires the same privileges on
        the source tables as SHOW CREATE TABLE. Moved this privilege check
        to check_show_create_table_access() function.
      sql/sql_partition.cc:
        Now we use special flag in LEX::create_info::options for distinguishing
        CREATE TABLE ... LIKE from other types of CREATE TABLE and store name
        of source table as regular element in statement's table list.
      sql/sql_table.cc:
        mysql_create_like_table():  
         - Commented and cleaned-up a bit code which is responsible for achieving
           isolation from concurrent statements. Most of actual work was done by
           fix for bug 20662 and preliminary patch changing locking locking in
           ALTER TABLE, so here we do minor things like relaxing locking on
           source table (we don't need lock on it, to have it open is enough) and
           adjusting code to make it more friendly against code implementing I_S.
         - Get rid of duplicated code related to source database/table name
           handling. All these operations are already done in
           st_select_lex::add_table_to_list(), so we achieve the same effect
           by including source table into the statement's table list.
      sql/sql_yacc.yy:
        Now we use special flag in LEX::create_info::options for distinguishing
        CREATE TABLE ... LIKE from other types of CREATE TABLE and store name
        of source table as regular element in statement's table list.
      5698a6a8
    • unknown's avatar
      5.0 version of fix for: · e8c35f16
      unknown authored
       Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
                   by other connections"
       Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
      As well as:
       Bug #25578 "CREATE TABLE LIKE does not require any privileges
                   on source table".
      
      The first and the second bugs resulted in various errors and wrong
      binary log order when one tried to execute concurrently CREATE TABLE LIKE
      statement and DDL statements on source table or DML/DDL statements on its
      target table.
      
      The problem was caused by incomplete protection/table-locking against
      concurrent statements implemented in mysql_create_like_table() routine.
      We solve it by simply implementing such protection in proper way (see
      comment for sql_table.cc for details).
      
      The third bug allowed user who didn't have any privileges on table create
      its copy and therefore circumvent privilege check for SHOW CREATE TABLE.
      
      This patch solves this problem by adding privilege check, which was missing.
      
      Finally it also removes some duplicated code from mysql_create_like_table().
      
      Note that, altough tests covering concurrency-related aspects of CREATE TABLE
      LIKE behaviour will only be introduced in 5.1, they were run manually for
      this patch as well.
      
      
      mysql-test/r/grant2.result:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      mysql-test/t/grant2.test:
        Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges
        on source table".
      sql/handler.h:
        Introduced new flag for HA_CREATE_INFO::options in order to be able to
        distinguish CREATE TABLE ... LIKE from other types of CREATE TABLE.
      sql/mysql_priv.h:
        mysql_create_like_table() now takes source table name not as a
        Table_ident object but as regular table list element.
      sql/sql_parse.cc:
        CREATE TABLE ... LIKE implementation now uses statement's table list
        for storing information about the source table. We also use flag
        in LEX::create_info.options for distinguishing it from other types
        of CREATE TABLE.
        Finally CREATE TABLE ... LIKE now requires the same privileges on
        the source tables as SHOW CREATE TABLE. Moved this privilege check
        to check_show_create_table_access() function.
      sql/sql_table.cc:
        mysql_create_like_table():
         - Provided proper protection from concurrent statements.
           This is achieved by keeping name-lock on the source table and holding
           LOCK_open mutex during whole operation. This gives protection against
           concurrent DDL on source table. Also holding this mutex makes copying
           of .frm file, call to ha_create_table() and binlogging atomic against
           concurrent DML and DDL operations on target table.
         - Get rid of duplicated code related to source database/table name
           handling. All these operations are already done in
           st_select_lex::add_table_to_list(), so we achieve the same effect
           by including source table into the statement's table list.
      sql/sql_yacc.yy:
        Now we use special flag in LEX::create_info::options for distinguishing
        CREATE TABLE ... LIKE from other types of CREATE TABLE and store name
        of source table as regular element in statement's table list.
      e8c35f16
    • unknown's avatar
      - Corrected type misstake in debug statement. · 0175d73c
      unknown authored
      0175d73c