An error occurred fetching the project authors.
  1. 02 Dec, 2006 1 commit
    • unknown's avatar
      Bug#24736: UDF functions parsed as Stored Functions · b92081cd
      unknown authored
      Before this fix, a call to a User Defined Function (UDF) could,
      under some circumstances, be interpreted as a call to a Stored function
      instead. This occurred if a native function was invoked in the parameters
      for the UDF, as in "select my_udf(abs(x))".
      
      The root cause of this defect is the introduction, by the fix for Bug 21809,
      of st_select_lex::udf_list, and it's usage in the parser in sql_yacc.yy
      in the rule function_call_generic (in 5.1).
      
      While the fix itself for Bug 21809 is correct in 5.0, the code change
      merged into the 5.1 release created the issue, because the calls in 5.1 to :
      - lex->current_select->udf_list.push_front(udf)
      - lex->current_select->udf_list.pop()
      are not balanced in case of native functions, causing the udf_list,
      which is really a stack, to be out of sync with the internal stack
      maintained by the bison parser.
      
      Instead of moving the call to udf_list.pop(), which would have fixed the
      symptom, this patch goes further and removes the need for udf_list.
      
      This is motivated by two reasons:
      
      a) Maintaining a stack in the MySQL code in sync with the stack maintained
      internally in sql_yacc.cc (not .yy) is extremely dependent of the
      implementation of yacc/bison, and extremely difficult to maintain.
      It's also totally dependent of the structure of the grammar, and has a risk
      to break with regression defects each time the grammar itself is changed.
      
      b) The previous code did report construct like "foo(expr AS name)" as
      syntax errors (ER_PARSER_ERROR), which is incorrect, and misleading.
      The syntax is perfectly valid, as this expression is valid when "foo" is
      a UDF. Whether this syntax is legal or not depends of the semantic of "foo".
      
      With this change:
      
      a) There is only one stack (in bison), and no List<udf_func> to maintain.
      
      b) "foo(expr AS name)", when used incorrectly, is reported as semantic error:
      - ER_WRONG_PARAMETERS_TO_NATIVE_FCT (for native functions)
      - ER_WRONG_PARAMETERS_TO_STORED_FCT (for stored functions)
      This is achieved by the changes implemented in item_create.cc
      
      
      mysql-test/r/parser.result:
        New tests
      mysql-test/r/udf.result:
        New tests
      mysql-test/t/parser.test:
        New tests
      mysql-test/t/udf.test:
        New tests
      sql/item_create.cc:
        Semantic checks for named parameters, as in "foo(expr AS name)".
      sql/share/errmsg.txt:
        New error message
      sql/sql_lex.cc:
        Remove usage of udf_list.
      sql/sql_lex.h:
        Remove usage of udf_list.
      sql/sql_yacc.yy:
        Remove usage of udf_list.
      b92081cd
  2. 20 Nov, 2006 1 commit
  3. 18 Nov, 2006 1 commit
    • unknown's avatar
      merging · 934a2318
      unknown authored
      mysql-test/t/disabled.def:
        meging bug
      934a2318
  4. 02 Nov, 2006 2 commits
    • unknown's avatar
      Bug#21114 (Foreign key creation fails to table with name format) · 384407aa
      unknown authored
      Due to the complexity of this change, everything is documented in WL#3565
      
      This patch is the third iteration, it takes into account the comments
      received to date.
      
      
      mysql-test/r/func_math.result:
        Improved test coverage
      mysql-test/r/view.result:
        Name collision, x() is a geometry native in function
      mysql-test/t/func_math.test:
        Improved test coverage
      mysql-test/t/view.test:
        Name collision, x() is a geometry native in function
      sql/item_create.cc:
        Revised the create_func implementation
      sql/item_create.h:
        Revised the create_func implementation
      sql/item_geofunc.h:
        Explicit Item allocation in the thread memory pool.
      sql/lex.h:
        Removed function parsing from the lexical parser
      sql/lex_symbol.h:
        Removed function parsing from the lexical parser
      sql/mysql_priv.h:
        Server initialization and shutdown
      sql/mysqld.cc:
        Server initialization and shutdown
      sql/share/errmsg.txt:
        New error messages
      sql/sql_yacc.yy:
        Removed function parsing from the lexical parser
      tests/mysql_client_test.c:
        Spaces are no longer significant for function calls
      mysql-test/include/parser_bug21114.inc:
        New tests
      mysql-test/r/parser.result:
        New tests
      mysql-test/r/parser_bug21114_innodb.result:
        New tests
      mysql-test/t/parser.test:
        New tests
      mysql-test/t/parser_bug21114_innodb.test:
        New tests
      384407aa
    • unknown's avatar
      Better fix for bug#22830 · 63030d76
      unknown authored
      Events: crash with procedure which alters events with function
      
      Post-review CS
      
      This fix also changes the handling of KILL command combined with
      subquery. It changes the error message given back to "not supported",
      from parse error. The error for CREATE|ALTER EVENT has also been changed
      to generate "not supported yet" instead of parse error.
      In case of a SP call, the error is "not supported yet". This change
      cleans the parser from code which should not belong to there. Still
      LEX::expr_allows_subselect is existant because it simplifies the handling
       of SQLCOM_HA_READ which forbids subselects.
      
      
      mysql-test/r/events_bugs.result:
        update resut
      mysql-test/r/events_grant.result:
        update result
      mysql-test/r/kill.result:
        the error message has been changed for KILL
      mysql-test/t/events_bugs.test:
        Update old tests with the new emitted error
        
        Add a test case for
        BUG#22830 Events: crash with procedure which alters events with function
      mysql-test/t/events_grant.test:
        add ORDER BY clause to keep the result deterministic.
      mysql-test/t/kill.test:
        use name of the error, and change the error
        from parse error, to not supported
      sql/sql_lex.cc:
        Add an auxiliary function that checks whether SP and/or
        tables are used in the statement. This function is helpful for
        statements that cannot handle subqueries ans SP calls. Adding out
        of the parser cleans the latter of handling of special cases and
        letting it do its job of parsing.
      sql/sql_lex.h:
        helper function to check whether a table or SP was used
      sql/sql_parse.cc:
        Use LEX::table_or_sp_used() for SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT
        and SQLCOM_KILL. SQLCOM_DROP event does not use `expr` rule and thus a check is
        not needed.
      sql/sql_yacc.yy:
        Remove usage of LEX::expr_allows_subselect for CREATE|ALTER EVENT
        and KILL. There is only one left occurence - SQLCOM_HAREAD, but it 
        adds one table to the list of tables
      63030d76
  5. 26 Oct, 2006 1 commit
    • unknown's avatar
      Bug#18888 Trying to overwrite sql/lex_hash.h during build · ed53c394
      unknown authored
       - As a sideeffect of the patch to generate lex_hash.h only once
      on the machine where the source dist was produced, a problem
      was found when compiling a mysqld without partition support - it 
      would crash when looking up the lex symbols due to mismatch between
      lex.h and the generated lex_hash.h
      
       - Remove the ifdef for partition in lex.h 
       - Fix minor problem with"EXPLAIN PARTITION" when not compiled with
         partition(existed also without the above patch)
       - Add test case that will be run when we don't have partition
         support compiled into mysqld
       - Return error ER_FEATURE_DISABLED if user tries to use PARTITION
         when there is no support for it.
      
      
      sql/lex.h:
        There should be no ifdefs of features in lex.h
      sql/sql_class.cc:
        In line with the comment in sql_yacc.yy that we want the same output
        from "EXPLAIN PARTITIONS.." regardless of wheter we have compiled in
        support for partition  or not, remove the ifdef so the extra field
        is added to output if the DESCRIBE_PARTITIONS bit it set. Without
        this patch we get a crash as the code in select_describe believes the
        field is there.
      sql/sql_select.cc:
        Use "const" for the variable as it's a ssigned once and never changes
      sql/sql_yacc.yy:
        Don't allow PARTITION syntax oif there is no suport for partitioning
      mysql-test/r/not_partition.require:
        New BitKeeper file ``mysql-test/r/not_partition.require''
      mysql-test/r/not_partition.result:
        New BitKeeper file ``mysql-test/r/not_partition.result''
      mysql-test/t/not_partition.test:
        New BitKeeper file ``mysql-test/t/not_partition.test''
      ed53c394
  6. 24 Oct, 2006 1 commit
    • unknown's avatar
      Bug #21809: Error 1356 while selecting from view with grouping though underlying · f51d0812
      unknown authored
                  select OK.
      The SQL parser was using Item::name to transfer user defined function attributes
      to the user defined function (udf). It was not distinguishing between user defined 
      function call arguments and stored procedure call arguments. Setting Item::name 
      was causing Item_ref::print() method to print the argument as quoted identifiers 
      and caused views that reference aggregate functions as udf call arguments (and 
      rely on Item::print() for the text of the view to store) to throw an undefined 
      identifier error.
      Overloaded Item_ref::print to print aggregate functions as such when printing
      the references to aggregate functions taken out of context by split_sum_func2()
      Fixed the parser to properly detect using AS clause in stored procedure arguments
      as an error.
      Fixed printing the arguments of udf call to print properly the udf attribute.
      
      
      mysql-test/r/udf.result:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - test cases
      mysql-test/t/udf.test:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - test cases
      sql/item.cc:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - Don't print the refs to SUM functions as refs.
      sql/item_func.cc:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - print the aliases in the udf calls
      sql/item_func.h:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - print the aliases in the udf calls
      sql/sql_lex.cc:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - disable aliases for arguments in stored routine calls
      sql/sql_lex.h:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - disable aliases for arguments in stored routine calls
      sql/sql_yacc.yy:
        Bug #21809: Error 1356 while selecting from view with grouping though underlying
                    select OK.
         - disable aliases for arguments in stored routine calls
         - fix bison duplicate symbol warnings
      f51d0812
  7. 19 Oct, 2006 1 commit
    • unknown's avatar
      Fix small glitch during parsing of ALTER EVENT xyz · 7debdee8
      unknown authored
      with only COMMENT clause. Strangely it has manifestated itself
      only on two platforms. This is a fix for bug#23423 
      "Syntax error for "ALTER EVENT ... COMMENT ..." on just two platforms"
      
      
      sql/sql_yacc.yy:
        if COMMENT is used mark it as used.
        There was a missing setting to 1 of $$. If COMMENT
        was used in combinations with other clauses then it
        was passing.
      7debdee8
  8. 16 Oct, 2006 1 commit
    • unknown's avatar
      Changed several char* to LEX_STRING*. · e94087c5
      unknown authored
      BUILD/SETUP.sh:
        Added check for CCACHE_DISABLE. If set, do not
        use ccache at all.
      BUILD/compile-pentium-gcov:
        Moved CCACHE_DISABLE up before going into SETUP.sh.
        
        Added debug_extra_flags to extra_flags.
      mysql-test/r/create.result:
        Added tests for incorrect database names.
      mysql-test/r/ctype_create.result:
        Added tests for incorrect alter database names.
      mysql-test/r/events.result:
        Added tests for incorrect database names.
      mysql-test/r/grant.result:
        Output changed to capital letters.
      mysql-test/t/alter_table.test:
        Removed extra empty line
      mysql-test/t/create.test:
        Added tests for incorrect database names.
      mysql-test/t/ctype_create.test:
        Added tests for incorrect name handling
      mysql-test/t/events.test:
        Added tests for incorrect database names.
      sql/item_timefunc.cc:
        Added dummy case to avoid compiler warning.
      sql/mysql_priv.h:
        Changed argument from char pointer to LEX_STRING pointer.
      sql/mysqld.cc:
        Added a missing component from struct.
      sql/sql_class.h:
        Added function LEX_STRING_make that sets the string and length.
      sql/sql_db.cc:
        Changed several char pointers to lex_strings.
      sql/sql_lex.cc:
        name is now LEX_STRING
      sql/sql_lex.h:
        Changed name to LEX_STRING.
      sql/sql_parse.cc:
        Changed several char pointers to lex_strings.
        
        db_length needed a trick, because in old client protocol there
        was an extra char zero added to the string.
        
        check_db_name() now takes LEX_STRING pointer as an argument.
        
        Changed remove_escape() to take LEX_STRING pointer as an argument.
        
        Removed COM_CREATE_DB and COM_DROP_DB. These are obsolete.
      sql/sql_table.cc:
        char* -> LEX_STRING*
      sql/sql_yacc.yy:
        Changed char* -> LEX_STRING*
      sql/table.cc:
        check_db_name() now takes LEX_STRING* as argument instead of char*.
        
        Optimized code a bit.
      tests/mysql_client_test.c:
        Added test for (short) status.
        
        After defining out (ifdef) COM_DROP_DB and COM_CREATE_DB
        in mysqld.cc mysql_client_test needed to be informed that
        failing in recognizing these commands is not fatal error
        anymore.
      e94087c5
  9. 12 Oct, 2006 2 commits
    • unknown's avatar
      BUG#20953: create proc with a create view that uses local vars/params · 6d1fdc73
      unknown authored
                 should fail to create
      
      The problem was that this type of errors was checked during view
      creation, which doesn't happen when CREATE VIEW is a statement of
      a created stored routine.
      
      The solution is to perform the checks at parse time.  The idea of the
      fix is that the parser checks if a construction just parsed is allowed
      in current circumstances by testing certain flags, and this flags are
      reset for VIEWs.
      
      The side effect of this change is that if the user already have
      such bogus routines, it will now get a error when trying to do
      
        SHOW CREATE PROCEDURE proc;
      
      (and some other) and when trying to execute such routine he will get
      
        ERROR 1457 (HY000): Failed to load routine test.p5. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
      
      However there should be very few such users (if any), and they may
      (and should) drop these bogus routines.
      
      
      mysql-test/r/sp-error.result:
        Add result for bug#20953: create proc with a create view that uses
        local vars/params should fail to create.
      mysql-test/r/view.result:
        Update results.
      mysql-test/t/sp-error.test:
        Add test case for bug#20953: create proc with a create view that uses
        local vars/params should fail to create.
      mysql-test/t/view.test:
        Add second test for variable in a view.
        Remove SP variable in a view test, as it tests wrong behaviour.
        Add test for derived table in a view.
      sql/sql_lex.cc:
        Remove LEX::variables_used.
      sql/sql_lex.h:
        Remove LEX::variables_used and add st_parsing_options structure and
        LEX::parsing_options member.
      sql/sql_view.cc:
        Move some error checking to sql/sql_yacc.yy.
      sql/sql_yacc.yy:
        Check for disallowed syntax in a CREATE VIEW at parse time to rise a
        error when it is used inside CREATE PROCEDURE and CREATE FUNCTION, as
        well as by itself.
      6d1fdc73
    • unknown's avatar
      Revert patch for bug #19764, which did not work with prepared statements. · e9b7cc09
      unknown authored
      BitKeeper/deleted/.del-show_check-master.opt:
        Delete: mysql-test/t/show_check-master.opt
      e9b7cc09
  10. 09 Oct, 2006 1 commit
    • unknown's avatar
      Bug#21462 (Stored procedures with no arguments require parenthesis) · e1e0f829
      unknown authored
      The syntax of the CALL statement, to invoke a stored procedure, has been
      changed to make the use of parenthesis optional in the argument list.
      With this change, "CALL p;" is equivalent to "CALL p();".
      
      While the SQL spec does not explicitely mandate this syntax, supporting it
      is needed for practical reasons, for integration with JDBC / ODBC connectors.
      
      Also, warnings in the sql/sql_yacc.yy file, which were not reported by Bison 2.1
      but are now reported by Bison 2.2, have been fixed.
      
      The warning found were:
      bison -y -p MYSQL  -d --debug --verbose sql_yacc.yy
      sql_yacc.yy:653.9-18: warning: symbol UNLOCK_SYM redeclared
      sql_yacc.yy:656.9-17: warning: symbol UNTIL_SYM redeclared
      sql_yacc.yy:658.9-18: warning: symbol UPDATE_SYM redeclared
      sql_yacc.yy:5169.11-5174.11: warning: unused value: $2
      sql_yacc.yy:5208.11-5220.11: warning: unused value: $5
      sql_yacc.yy:5221.11-5234.11: warning: unused value: $5
      conflicts: 249 shift/reduce
      
      "unused value: $2" correspond to the $$=$1 assignment in the 1st {} block
      in table_ref -> join_table {} {},
      which does not procude a result ($$) for the rule but an intermediate $2
      value for the action instead.
      "unused value: $5" are similar, with $$ assignments in {} actions blocks
      which are not for the final reduce.
      
      
      mysql-test/r/sp.result:
        New test case for Bug#21462
      mysql-test/t/sp.test:
        New test case for Bug#21462
      sql/sql_yacc.yy:
        "CALL p;" syntax for calling a stored procedure
        Fixed bison 2.2 warnings.
      e1e0f829
  11. 04 Oct, 2006 1 commit
    • unknown's avatar
      Bug #19764: SHOW commands end up in the slow log as table scans · 0d833887
      unknown authored
      Set a flag when a SHOW command is parsed, and check it in log_slow_statement().  SHOW commands are not counted as slow queries, even if they use table scans.
      
      
      mysql-test/t/show_check-master.opt:
        BitKeeper file /usr/home/tim/m/bk/b19764/50/mysql-test/t/show_check-master.opt
      mysql-test/r/show_check.result:
        Add test for bug #19764
      mysql-test/t/show_check.test:
        Add test for bug #19764
      sql/sql_lex.cc:
        Set lex->is_show_command= FALSE in lex_start
      sql/sql_lex.h:
        Add LEX->is_slow_command flag to prevent SHOW commands from being written to the slow queries log
      sql/sql_parse.cc:
        Don't log slow statement if it is a SHOW command
      sql/sql_yacc.yy:
        Set lex->is_show_command for all SHOW commands
      0d833887
  12. 03 Oct, 2006 1 commit
    • unknown's avatar
      sql_yacc.yy: · fd5ea175
      unknown authored
        After merge fix.
      field.cc:
        After merge fix
      
      
      sql/field.cc:
        After merge fix
      sql/sql_yacc.yy:
        After merge fix.
      fd5ea175
  13. 27 Sep, 2006 1 commit
  14. 26 Sep, 2006 1 commit
    • unknown's avatar
      Final step of Take 7 on review fixes of this · 288da1d7
      unknown authored
      fairly complex bug
      
      
      mysql-test/r/partition.result:
        Merge fix
      sql/partition_info.cc:
        Moved method from sql_partition.cc to the partition_info class
      sql/partition_info.h:
        Introduced a number of charset related arrays
        Removed some bools that could be checked by checking arrays instead
      sql/sql_partition.cc:
        Introduced a number of charset related arrays
        Removed some bools that could be checked by checking arrays instead
        Made method of common complex if-statement
        Made that method and check of partition function fields public methods
        to enable use from partition_info class.
        Moved method to partition_info class
        Optimised copy_to_part_field_buffers method to avoid as much as possible
        calculations in those. Also avoided double calls when both subpartitioning
        and partitioning
        Handled review comments
      sql/sql_partition.h:
        New methods public for use in partition_info class
      sql/sql_yacc.yy:
        Missed this in previous merge and review fixes
      288da1d7
  15. 25 Sep, 2006 1 commit
    • unknown's avatar
      Fixed bug #21646. · f0bd502a
      unknown authored
      Presence of a subquery in the ON expression of a join 
      should not block merging the view that contains this join.
      Before this patch the such views were converted into 
      into temporary table views.
      
      
      mysql-test/r/view.result:
        Added a test case for bug #21646.
      mysql-test/t/view.test:
        Added a test case for bug #21646.
      sql/mysql_priv.h:
        Fixed bug #21646.
        Added a new parsing state 'IN_ON', true when
        the parser is in an ON expression of a join.
      sql/sql_lex.cc:
        Fixed bug #21646.
        Presence of a subquery in the ON expression of a join 
        should not block merging the view that contains this join.
      sql/sql_yacc.yy:
        Fixed bug #21646.
        Added a new parsing state 'IN_ON', true when
        the parser is in an ON expression of a join.
      f0bd502a
  16. 21 Sep, 2006 1 commit
  17. 12 Sep, 2006 1 commit
    • unknown's avatar
      WL#3337 (Event scheduler new architecture) · 04a5f335
      unknown authored
      Remove SHOW SCHEDULER STATUS command and migrate the
      information output to `mysqladmin debug` (COM_DEBUG)
      
      SHOW SCHEDULER STATUS was introduced in 5.1.11, provided
      some debug information about event scheduler internals and
      was enabled only in debug builds.
      
      
      sql/event_queue.cc:
        Remove SHOW SCHEDULER STATUS. Reporting still will be
        there but through COM_DEBUG (mysqladmin debug)
      sql/event_queue.h:
        dump_internal_status cannot return an error, therefore it
        should be void.
      sql/event_scheduler.cc:
        Remove SHOW SCHEDULER STATUS. Reporting still will be
        there but through COM_DEBUG (mysqladmin debug)
      sql/event_scheduler.h:
        dump_internal_status cannot return an error, therefore it
        should be void.
      sql/events.cc:
        Change from outputting the internal data from
        the wire to the standard output. SHOW SCHEDULER STATUS was
        removed.
      sql/events.h:
        dump_internal_status() cannot return an error, therefore
        it should be void
      sql/lex.h:
        remove SCHEDULER as recognized word. This is part
        of removing SHOW SCHEDULER STATUS
      sql/sp_head.cc:
        SQLCOM_SHOW_SCHEDULER_STATUS has been removed
      sql/sql_lex.h:
        SQLCOM_SHOW_SCHEDULER_STATUS has been removed
      sql/sql_parse.cc:
        SQLCOM_SHOW_SCHEDULER_STATUS has been removed
      sql/sql_test.cc:
        Dump Events' internal information on COM_DEBUG
      sql/sql_yacc.yy:
        SQLCOM_SHOW_SCHEDULER_STATUS has been removed
      04a5f335
  18. 11 Sep, 2006 2 commits
  19. 08 Sep, 2006 2 commits
    • unknown's avatar
      after merge fix · 4ef211ee
      unknown authored
      sql/mysql_priv.h:
        after merge fix
        added charset parameter to check_string_length() function
      sql/slave.h:
        after merge fix
        USERNAME_LENGTH const is changed to USERNAME_BYTE_LENGTH
      sql/sql_parse.cc:
        after merge fix
        added charset parameter to check_string_length() function
      sql/sql_yacc.yy:
        after merge fix
        added charset parameter to check_string_length() function
      4ef211ee
    • unknown's avatar
      Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24 · 0eb5442f
      unknown authored
      Upgrade was a reserved word. Unreserve UPGRADE so it can be used in unquoted identifiers.
      
      
      mysql-test/r/create.result:
        Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
         - test case
      mysql-test/t/create.test:
        Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
         - test case
      sql/sql_yacc.yy:
        Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
         - unreserve UPGRADE.
      0eb5442f
  20. 04 Sep, 2006 1 commit
    • unknown's avatar
      Bug #21392: multi-table delete with alias table name fails with · 1431966d
      unknown authored
                  1003: Incorrect table name
      in multi-table DELETE the set of tables to delete from actually 
      references then tables in the other list, e.g:
      DELETE alias_of_t1 FROM t1 alias_of_t1 WHERE ....
      is a valid statement.
      So we must turn off table name syntactical validity check for alias_of_t1 
      because it's not a table name (even if it looks like one).
      In order to do that we add a special flag (TL_OPTION_ALIAS) to 
      disable the name checking for the aliases in multi-table DELETE.
      
      
      mysql-test/r/delete.result:
        Bug #21392: multi-table delete with alias table name fails with
                    1003: Incorrect table name
         - test case
      mysql-test/t/delete.test:
        Bug #21392: multi-table delete with alias table name fails with
                    1003: Incorrect table name
         - test case
      sql/mysql_priv.h:
        Bug #21392: multi-table delete with alias table name fails with
                    1003: Incorrect table name
         - add a special flag to disable the name checking for the aliases
           in multi-table DELETE
      sql/sql_parse.cc:
        Bug #21392: multi-table delete with alias table name fails with
                    1003: Incorrect table name
         - add a special flag to disable the name checking for the aliases
           in multi-table DELETE
      sql/sql_yacc.yy:
        Bug #21392: multi-table delete with alias table name fails with
                    1003: Incorrect table name
         - add a special flag to disable the name checking for the aliases
           in multi-table DELETE
      1431966d
  21. 01 Sep, 2006 1 commit
    • unknown's avatar
      BUG#21477 "memory overruns for certain kinds of subqueries": · dd6dc7ad
      unknown authored
      make st_select_lex::setup_ref_array() take into account that 
      Item_sum-descendant objects located within descendant SELECTs
      may be added into ref_pointer_array.
      
      
      sql/item_sum.cc:
        BUG#21477 "memory overruns for certain kinds of subqueries":
        Make SELECT_LEX::n_sum_items contain # of Item_sum-derived objects
        that exist within this SELECT.
      sql/sql_lex.h:
        BUG#21477 "memory overruns for certain kinds of subqueries":
        Add SELECT_LEX::n_sum_items and SELECT_LEXT::n_child_sum_items.
      sql/sql_yacc.yy:
        BUG#21477 "memory overruns for certain kinds of subqueries":
        Make SELECT_LEX::n_sum_items contain # of Item_sum-derived objects
        that exist within this SELECT.
      dd6dc7ad
  22. 31 Aug, 2006 1 commit
    • unknown's avatar
      Bug#14654 : Cannot select from the same table twice within a UNION statement · c9bba13a
      unknown authored
       Made the parser to support parenthesis around UNION branches.
       This is done by amending the rules of the parser so it generates the correct
       structure.
       Currently it supports arbitrary subquery/join/parenthesis operations in the 
       EXISTS clause. 
       In the IN/scalar subquery case it will allow adding nested parenthesis only 
       if there is an UNION clause after the parenthesis. Otherwise it will just  
       treat the multiple nested parenthesis as a scalar expression.
       It adds extra lex level for ((SELECT ...) UNION ...) to accommodate for the
       UNION clause.
      
      
      mysql-test/r/subselect.result:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - test cases
      mysql-test/t/subselect.test:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - test cases
      sql/sql_yacc.yy:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - shuffle around the rules for the parenthesis in subselect
      c9bba13a
  23. 30 Aug, 2006 1 commit
  24. 25 Aug, 2006 1 commit
    • unknown's avatar
      Fix for bug#21795: SP: sp_head::is_not_allowed_in_function() contains · 133d2aa5
      unknown authored
      erroneous check
      
      Problem: Actually there were two problems in the server code. The check
      for SQLCOM_FLUSH in SF/Triggers were not according to the existing
      architecture which uses sp_get_flags_for_command() from sp_head.cc .
      This function was also missing a check for SQLCOM_FLUSH which has a
      problem combined with prelocking. This changeset fixes both of these
      deficiencies as well as the erroneous check in
      sp_head::is_not_allowed_in_function() which was a copy&paste error.
      
      
      mysql-test/r/sp-error.result:
        update result
      mysql-test/r/trigger.result:
        update result
      mysql-test/t/sp-error.test:
        FLUSH can create a problem with prelocking, hence it's disabled.
        There is a better way to check this than a check in the parser.
        Now we use sp_get_flags_for_command() and the error returned is
        different.
      mysql-test/t/trigger.test:
        FLUSH can create a problem with prelocking, hence it's disabled.
        There is a better way to check this than a check in the parser.
        Now we use sp_get_flags_for_command() and the error returned is
        different.
      sql/sp_head.cc:
        FLUSH and RESET are not allowed inside a SF/Trigger.
        Because they don't imply a COMMIT sp_head::HAS_COMMIT_OR_ROLLBACK
        cannot be used. Two new flags were introduced for that reason.
      sql/sp_head.h:
        Don't check m_type as this check is erroneous. This is probably
        a copy and paste error when moving code from somewhere else. Another
        fact which supports this was prefixing the enum value with the name
        of class sp_head.
        
        Adding two new flags HAS_SQLCOM_RESET and HAS_SQLCOM_FLUSH. The values
        are 2048 and 4096 because in the 5.1 branch there are already new flags
        which are with values up-to 1024.
      sql/sql_parse.cc:
        FLUSH can cause a problem with prelocking in SF/Trigger and
        therefore is already disabled. RESET is also disabled because
        is handled by the same code as FLUSH. We won't allow RESET inside
        SF/Trigger at that stage without thorough analysis. The check for
        them is already done in the parser by calling
        is_not_allowed_in_function()
      sql/sql_yacc.yy:
        By listing SQLCOM_FLUSH as command which implies COMMIT
        in sp_get_flags_for_command() the check in sql_yacc.yy is
        obsolete.
      133d2aa5
  25. 24 Aug, 2006 1 commit
    • unknown's avatar
      Fix for BUG#16899: Possible buffer overflow in handling of DEFINER-clause · 21e6836b
      unknown authored
          
      User name (host name) has limit on length. The server code relies on these
      limits when storing the names. The problem was that sometimes these limits
      were not checked properly, so that could lead to buffer overflow.
        
      The fix is to check length of user/host name in parser and if string is too
      long, throw an error.
      
      
      mysql-test/r/grant.result:
        Updated result file.
      mysql-test/r/sp.result:
        Updated result file.
      mysql-test/r/trigger.result:
        Updated result file.
      mysql-test/r/view.result:
        Updated result file.
      mysql-test/t/grant.test:
        Added test for BUG#16899.
      mysql-test/t/sp.test:
        Added test for BUG#16899.
      mysql-test/t/trigger.test:
        Added test for BUG#16899.
      mysql-test/t/view.test:
        Added test for BUG#16899.
      sql/mysql_priv.h:
        Added prototype for new function.
      sql/sql_acl.cc:
        Remove outdated checks.
      sql/sql_parse.cc:
        Add a new function for checking string length.
      sql/share/errmsg.txt:
        Added new resources.
      sql/sql_yacc.yy:
        Check length of user/host name.
      21e6836b
  26. 23 Aug, 2006 2 commits
    • unknown's avatar
      Fix for BUG#16899: Possible buffer overflow in handling of DEFINER-clause · f96ee72f
      unknown authored
        
      User name (host name) has limit on length. The server code relies on these
      limits when storing the names. The problem was that sometimes these limits
      were not checked properly, so that could lead to buffer overflow.
      
      The fix is to check length of user/host name in parser and if string is too
      long, throw an error.
      
      
      mysql-test/r/grant.result:
        Updated result file.
      mysql-test/r/sp.result:
        Updated result file.
      mysql-test/r/trigger.result:
        Updated result file.
      mysql-test/r/view.result:
        Updated result file.
      mysql-test/t/grant.test:
        Added test for BUG#16899.
      mysql-test/t/sp.test:
        Added test for BUG#16899.
      mysql-test/t/trigger.test:
        Added test for BUG#16899.
      mysql-test/t/view.test:
        Added test for BUG#16899.
      sql/mysql_priv.h:
        Added prototype for new function.
      sql/share/errmsg.txt:
        Added new resources.
      sql/sql_acl.cc:
        Remove outdated checks.
      sql/sql_parse.cc:
        Add a new function for checking string length.
      sql/sql_yacc.yy:
        Check length of user/host name.
      f96ee72f
    • unknown's avatar
      Cleanup patch for handling of subselects in commands which cannot · 2e1bfbd2
      unknown authored
      handle them.
      
      Problem:
      CREATE|ALTER EVENT, HANDLER READ, KILL, Partitioning uses `expr` from the
      parser. This rule comes with all the rings and bells including subqueries.
      However, these commands are not subquery safe. For this reason there are two
      fuse checks in the parser. They were checking by command id. CREATE EVENT
      should forbid subquery is the fix for
      bug#16394 Events: Crash if schedule contains SELECT
      The fix has been incorporated as part of the patch for WL#3337 (Event scheduler
      new architecture).
      
      Solution:
      A new flag was added to LEX command_forbids_subselect. The fuse checks were
      changed. The commands are responsible to set the value to true whenever
      they can't handle subselects.
      
      
      sql/sql_lex.cc:
        initialize the variable
      sql/sql_lex.h:
        Add a new flag whether the parser should allow a subselect when
        parsing. This is temporarily turned off by commands like CREATE|ALTER EVENT,
        HA_READ, KILL. Could be used by other parts which reuse `expr` rule of the
        grammar and should not allow subqueries as part of it.
      sql/sql_yacc.yy:
        Forbid subselects in some commands in a better way.
        CREATE|ALTER EVENT, HANDLER READ, KILL, are not subselect
        safe for parameters and therefore they should be forbidden already in
        the parser.
        This patch makes it easier for the developer to add new commands in that
        sense similar to the mentioned above.
      2e1bfbd2
  27. 19 Aug, 2006 1 commit
    • unknown's avatar
      WL#3432 (Compile the Parser with a --debug --verbose option) · cd2c9eec
      unknown authored
      Corrected build issues : the build can not be conditional.
      to keep a unique source .tar.gz distribution.
      
      
      configure.in:
        Rolling back previous change
      sql/Makefile.am:
        Partially rolling back previous change.
        The build has to be unconditional, for the source .tar.gz distribution
      sql/mysql_priv.h:
        WL#3432 (Compile the Parser with a --debug --verbose option)
      sql/sql_parse.cc:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        Moved turn_parser_debug_on to sql_yacc.yy
      sql/sql_yacc.yy:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        Moved turn_parser_debug_on to sql_yacc.yy
      cd2c9eec
  28. 17 Aug, 2006 1 commit
    • unknown's avatar
      WL#3337 (Event scheduler new architecture) · 99adbd13
      unknown authored
      Post-review fixes. Mostly whitespace, int-to-bool return value, fixed comments
      
      
      sql/Makefile.am:
        compile all submodules of Events before compiling the facade
      sql/event_data_objects.cc:
        - Use initialization list
        - Clean whitespaces
        - Shorten comments
        - Fix comments
      sql/event_data_objects.h:
        - Fix whitespace
      sql/event_db_repository.cc:
        - Change return type from int to bool where only one error code is
          returned.
        - Don't use macros but get the maximal number of characters in a column
          from the column
        - Fix  comments
        - Make functions which has return value but it's not used - void.
      sql/event_db_repository.h:
        - Methods with only one error code int -> bool return value
        - Remove declaration of fill_schema_events, a function that does not exist
      sql/event_queue.cc:
        - Use initialization lists
        - Let find_n_remove_event delete the object thus making the code more robust.
          The caller could forget to destruct the object. In addition, find_n_remove_element()
          does not return a value.
        - Move check_system_tables() to class Events
        - Fix comments
      sql/event_queue.h:
        - Whitespace changes
        - init_queue() should allow passing of THD
        - check_system_tables moved to class Events
        - find_n_remove_event() is now void
      sql/event_scheduler.cc:
        - Initialize res before use
        - Remove end stop from message
      sql/event_scheduler.h:
        Add uninitialized state. The scheduler is in it before init_scheduler()
        is called. The rationale is that otherwise state has no value before
        the call. If the system tables were damaged the scheduler won't be initialized
        but in Events::deinit() Event_scheduler::stop() will be called and this will
        touch state, generating valgrind warning at minimum.
      sql/events.cc:
        - Whitespace changes
        - Fix comments
        - Make methods which have only one error code be bool instead of int
        - Create temporarily a THD to be used for the initialization of Event_queue
        - Event_queue::check_system_tables() moved to Events::check_system_tables
        - is_started() is renamed to is_execution_of_events_started()
      sql/events.h:
        - Whitespace changes
        - When a method returns only one error code it should be bool, not int
        - is_started() renamed to is_execution_of_events_started()
      sql/set_var.cc:
        is_started() is renamed to is_execution_of_events_started()
      sql/sql_db.cc:
        The return code is not used, thus don't return anything and drop_schema_events()
        is now void.
      sql/sql_yacc.yy:
        - Fix comments
        - Remove unneeded initialization which is performed in lex_init()
      sql/share/errmsg.txt:
        New error message
      sql/table.cc:
        - Fix comments
        - make table_check_intact() accespt const *table_def
      sql/table.h:
        Make table_check_intact() accespt const *table_def
      99adbd13
  29. 15 Aug, 2006 1 commit
    • unknown's avatar
      Fix for bug #20695: Charset introducer overrides charset definition for column. · fe3dee06
      unknown authored
        - if there are two character set definitions in the column declaration,
          we replace the first one with the second one as we store both in the LEX->charset
          slot. Add a separate slot to the LEX structure to store underscore charset.
        - convert default values to the column charset of STRING, VARSTRING fields 
          if necessary as well.
      
      
      mysql-test/r/ctype_recoding.result:
        Fix for bug #20695: Charset introducer overrides charset definition for column.
          - test result.
      mysql-test/t/ctype_recoding.test:
        Fix for bug #20695: Charset introducer overrides charset definition for column.
          - test case.
      sql/sql_lex.cc:
        Fix for bug #20695: Charset introducer overrides charset definition for column.
          - LEX->underscore_charset introduced to store UNDERSCORE_CHARSET
      sql/sql_lex.h:
        Fix for bug #20695: Charset introducer overrides charset definition for column.
          - LEX->underscore_charset introduced to store UNDERSCORE_CHARSET
      sql/sql_table.cc:
        Fix for bug #20695: Charset introducer overrides charset definition for column.
          - convert default values to the column charset of VARSTRING, STRING, ENUM, 
            SET fields if necessary.
      sql/sql_yacc.yy:
        Fix for bug #20695: Charset introducer overrides charset definition for column.
          - LEX->underscore_charset introduced to store UNDERSCORE_CHARSET
      fe3dee06
  30. 14 Aug, 2006 2 commits
    • unknown's avatar
      post-merge and testing fixes · e5a2cb50
      unknown authored
      mysql-test/r/events_bugs.result:
        update results after merge
      mysql-test/t/events.test:
        num to name
      mysql-test/t/events_bugs.test:
        num to name
      sql/sql_yacc.yy:
        post-merge fixes regarding init_sp_name
        put back code which I unintentionally removed during merg
      sql/share/errmsg.txt:
        add the message back
      e5a2cb50
    • unknown's avatar
      Manual merge 5.0->5.1. Post-merge fixes. · 21e75cb0
      unknown authored
      client/mysqldump.c:
        A post-merge fix - 'sock' was renamed to 'mysql'
      mysql-test/r/events_bugs.result:
        A post merge fix: now we strip rear comments from the query before
        it gets into the log.
      mysql-test/r/func_group.result:
        A post merge fix: default clause is now printed uppercase.
      mysql-test/r/im_life_cycle.result:
        Fix my mistake in manual resolve.
      mysql-test/r/mysqlcheck.result:
        use test; - after we drop client_test_db there is no current database.
        This cleanup is present in 5.1 only, but the test that was added in 
        5.0 assumes there is a current database, test.
      mysql-test/r/mysqldump.result:
        Ignore results of execution of mysqldump: we can't rely on 
        MASTER_LOG_POS in test results, it's different for statement
        and row level logging.
      mysql-test/r/mysqlshow.result:
        A post-merge fix: information schema contains a few more tables
        in 5.1
      mysql-test/r/mysqltest.result:
        A post merge fix: add 5.1 test end separator.
      mysql-test/r/ndb_basic.result:
        A post-merge fix: add test end separators.
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        A post merge fix: length of varbinary column is now 3 times less.
        Assuming a side effect of some other change. Length of any
        field is not relevant in this test.
      mysql-test/r/rpl_view.result:
        Add an end of test marker.
      mysql-test/r/show_check.result:
        Remove duplicate results. Add results from a merged test case.
      mysql-test/r/sp-error.result:
        Add test end separators.
      mysql-test/r/sp-security.result:
        Post-merge fix: use test after the current database is dropped.
      mysql-test/r/sp.result:
        Remove a duplicate result (bad merge that left a copy of
        the test case for Bug#19862 in the test suite).
      mysql-test/r/strict.result:
        An after-merge fix for a new test case: in 5.1 we issue a more accurate
        error message: "Incorrect value" instead of "Truncated value". I reason
        it so that in case of an error nothing is truncated, really.
        Also found similar changes in other test cases.
      mysql-test/r/type_datetime.result:
        Fix the text of an error.
      mysql-test/r/union.result:
        A post-merge fix: CHARACTER SET is now uppercase.
      mysql-test/t/mysqlcheck.test:
        A post-merge fix: use test, after current database is dropped, there
        is no current database.
      mysql-test/t/mysqldump.test:
        Disable result log: it's dependent on binlog position.
      mysql-test/t/sp-security.test:
        use test
      sql/item_sum.cc:
        Adjust the call to the constructor after the merge.
      sql/sp_head.cc:
        Add a missing DBUG_VOID_RETURN, move security checks out of
        execute_trigger to Table_triggers_list: in 5.1 we check for
        TRIGGER privilege, not SUPER privilege to execute triggers, so these
        checks lack table context inside execute_trigger and have to be
        performed when we have table object on hand.
      sql/sql_db.cc:
        A post-merge fix: adjust load_db_opt_by_name and check_db_dir_existence
        (new functions added in 5.0) to be tablename-to-filename encoding 
        friendly.
      sql/sql_lex.cc:
        A post-merge fix: make skip_rear_comments operate on const uchar *s.
      sql/sql_lex.h:
        A post-merge fix.
      sql/sql_show.cc:
        A post-merge fix: fix a bad merge, rename orig_sql_command -> sql_command.
      sql/sql_trigger.cc:
        A post-merge fix: move security checks to process_triggers
        from execute_trigger.
      sql/sql_view.cc:
        Adjust to the new signature of skip_rear_comments.
      sql/sql_yacc.yy:
        Adjust to the new signature of init_strings.
      21e75cb0
  31. 10 Aug, 2006 1 commit
    • unknown's avatar
      This is the second patch for bdb removeal. This takes care of all options and... · 04d2b020
      unknown authored
      This is the second patch for bdb removeal. This takes care of all options and variables that rely on bdb. 
      
      
      BitKeeper/deleted/.del-ha_berkeley.cc:
        Delete: sql/ha_berkeley.cc
      BitKeeper/deleted/.del-ha_berkeley.h:
        Delete: sql/ha_berkeley.h
      mysql-test/install_test_db.sh:
        Removed skip option
      mysql-test/mysql-test-run.pl:
        Remove bdb option
      mysql-test/mysql-test-run.sh:
        Remove bdb option
      sql/Makefile.am:
        Remove bdb option
      sql/handler.cc:
        Remove references to bdb
      sql/lex.h:
        Removed lex for bdb
      sql/mysql_priv.h:
        Removed bdb privs
      sql/mysqld.cc:
        Removed all options for bdb
      sql/set_var.cc:
        Removed variables for bdb
      sql/sql_yacc.yy:
        Removed yacc for bdb
      04d2b020
  32. 09 Aug, 2006 1 commit
    • unknown's avatar
      Fix for bug#20701 BINARY keyword should be forbidden in stored routines · 0231ca09
      unknown authored
          
      create function func() returns char(10) binary ...
      is no more possible. This will be reenabled when 
      bug 2676 "DECLARE can't have COLLATE clause in stored procedure"
      is fixed.
      
      Fix after 2nd review
      
      
      mysql-test/r/sp-error.result:
        update result
      mysql-test/r/sp.result:
        update result
      mysql-test/t/sp-error.test:
        add a test case for bug#20701 BINARY keyword should be forbidden in stored procedures
      mysql-test/t/sp.test:
        Fix test case which uses binary for the return value of a function.
        It's no more possible after fix for bug#20701 
        BINARY keyword should be forbidden in SP
        
        Fix few glitches where ; is used instead of | . The delimiter is |
      sql/sql_yacc.yy:
        Fix for bug#20701 BINARY keyword should be forbidden in stored routines
        
        create function func() returns char(10) binary ...
        is no more possible. This will be reenabled when 
        bug 2676 "DECLARE can't have COLLATE clause in stored procedure"
        is fixed
      0231ca09
  33. 08 Aug, 2006 1 commit
    • unknown's avatar
      Bug#16172 DECIMAL data type processed incorrectly · 9672ef61
      unknown authored
      issue an error in case of DECIMAL(M,N) if N > M
      
      
      mysql-test/r/type_newdecimal.result:
        Bug#16172 DECIMAL data type processed incorrectly
        result fix & test case
      mysql-test/t/type_newdecimal.test:
        Bug#16172 DECIMAL data type processed incorrectly
        test fix
      9672ef61
  34. 07 Aug, 2006 1 commit