1. 27 Mar, 2008 1 commit
    • unknown's avatar
      Bug#27219: Aggregate functions in ORDER BY. · 9e65582b
      unknown authored
      Mixing aggregate functions and non-grouping columns is not allowed in the
      ONLY_FULL_GROUP_BY mode. However in some cases the error wasn't thrown because
      of insufficient check.
      
      In order to check more thoroughly the new algorithm employs a list of outer
      fields used in a sum function and a SELECT_LEX::full_group_by_flag.
      Each non-outer field checked to find out whether it's aggregated or not and
      the current select is marked accordingly.
      All outer fields that are used under an aggregate function are added to the
      Item_sum::outer_fields list and later checked by the Item_sum::check_sum_func
      function.
      
      
      mysql-test/t/group_by.test:
        Added a test case for the bug#27219: Aggregate functions in ORDER BY.
      mysql-test/r/group_by.result:
        Added a test case for the bug#27219: Aggregate functions in ORDER BY.
      sql/sql_select.cc:
        Bug#27219: Aggregate functions in ORDER BY.
        Implementation of new check for mixing non aggregated fields and aggregation
        function in the ONLY_FULL_GROUP_BY mode.
      sql/sql_lex.cc:
        Bug#27219: Aggregate functions in ORDER BY.
        Initialization of the full_group_by_flag bitmap.
        SELECT_LEX::test_limit function doesn't reset ORDER BY
        clause anymore.
      sql/sql_lex.h:
        Bug#27219: Aggregate functions in ORDER BY.
        The full_group_by_flag is added to the SELECT_LEX class.
      sql/item_sum.h:
        Bug#27219: Aggregate functions in ORDER BY.
        The outer_fields list is added to the Item_sum class.
      sql/mysql_priv.h:
        Bug#27219: Aggregate functions in ORDER BY.
        Defined a set of constants used in the new check for mixing non aggregated
        fields and sum functions in the ONLY_FULL_GROUP_BY_MODE.
      sql/item_subselect.cc:
        Bug#27219: Aggregate functions in ORDER BY.
        The Item_in_subselect::select_in_like_transformer function now drops
        ORDER BY clause in all selects in a subquery.
      sql/item_sum.cc:
        Bug#27219: Aggregate functions in ORDER BY.
        Now the Item_sum::check_sum_func function now checks whether fields in the
        outer_fields list are aggregated or not and marks selects accordingly.
      sql/item.cc:
        Bug#27219: Aggregate functions in ORDER BY.
        Now the Item_field::fix_fields function checks whether the field is aggregated
        or not and marks its select_lex accordingly.
      9e65582b
  2. 10 Mar, 2008 2 commits
  3. 08 Mar, 2008 1 commit
  4. 07 Mar, 2008 2 commits
    • unknown's avatar
      Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 44704088
      unknown authored
      into  magare.gmz:/home/kgeorge/mysql/autopush/B34909-5.0-opt
      
      44704088
    • unknown's avatar
      Bug #34909: mysqldump returns a 0 status on error when using · 159c34bf
      unknown authored
        --master-data
      
      No error code was returned by mysqldump if it detects that binary
      logging is not enabled on the server.
      Fixed by returning error code.
      
      
      client/mysqldump.c:
        Bug #34909: add error code
      mysql-test/r/mysqldump-no-binlog.result:
        Bug #34909: test case
      mysql-test/t/mysqldump-no-binlog-master.opt:
        Bug #34909: test case
      mysql-test/t/mysqldump-no-binlog.test:
        Bug #34909: test case
      159c34bf
  5. 06 Mar, 2008 1 commit
  6. 05 Mar, 2008 1 commit
    • unknown's avatar
      Fix for bug #34889: mysql_client_test::test_mysql_insert_id test fails · 5c94cde7
      unknown authored
                          sporadically
      
      Under some circumstances, the mysql_insert_id() value after SELECT ...
      INSERT could return a wrong value. This could happen when the last
      SELECT ... INSERT did not involve an AUTO_INCREMENT column, but the
      value of mysql_insert_id() was changed by some previous statements.
      
      Fixed by checking the value of thd->insert_id_used in
      select_insert::send_eof() and returning 0 for mysql_insert_id() if it
      is not set.
      
      
      sql/sql_insert.cc:
        Do not return thd->last_insert_id unconditionally in
        select_insert::send_eof(). First check if thd->insert_id_used is
        non-zero, and return 0 otherwise.
      tests/mysql_client_test.c:
        Added a test case for bug #34889.
      5c94cde7
  7. 03 Mar, 2008 4 commits
    • unknown's avatar
      BUG#34945: "ref_or_null queries that are null_rejecting and have a null value crash mysql" · 2caf10ee
      unknown authored
      - Apply Eric Bergen's patch: in join_read_always_key(), move ha_index_init() call
        to before the late NULLs filtering code.
      - Backport function comments from 6.0.
      
      
      mysql-test/r/null_key.result:
        BUG#34945: "ref_or_null queries that are null_rejecting and have a null value crash mysql"
        - Testcase
      mysql-test/t/null_key.test:
        BUG#34945: "ref_or_null queries that are null_rejecting and have a null value crash mysql"
        - Testcase
      sql/sql_select.cc:
        BUG#34945: "ref_or_null queries that are null_rejecting and have a null value crash mysql"
        - Apply Eric Bergen's patch: in join_read_always_key(), move ha_index_init() call
          to before the late NULLs filtering code.
        - Backport function comments from 6.0
      2caf10ee
    • unknown's avatar
      Merge kaamos.(none):/data/src/opt/bug31781/my50 · bcf0b119
      unknown authored
      into  kaamos.(none):/data/src/opt/mysql-5.0-opt
      
      bcf0b119
    • unknown's avatar
      Fix for bug #31781: multi-table UPDATE with temp-pool enabled fails · 810c40ab
      unknown authored
                          with errno 17
      
      my_create() did not perform any checks for the case when a file is
      successfully created by a call to open(), but the call to
      my_register_filename() later fails because the number of open files
      has exceeded the my_open_files limit. This can happen on platforms 
      which do not have getrlimit(), and hence we do not know the real limit
      for open files. In such a case an error was returned to a caller
      although the file has actually been created. Since callers assume
      my_create() to return an error only when it failed to create a file,
      they did not perform any cleanups, leaving an 'orphaned' file on the
      file system.
      
      Fixed by adding a check for the above case to my_create() and ensuring
      the newly created file is deleted before returning an error.
      
      Creating a deterministic test case in the test suite is impossible,
      because the exact steps required to reproduce the above situation
      depend on the platform and/or environment (OS per-user limits, queries
      executed by previous tests, startup parameters). The patch was
      manually tested on Windows using examples posted in the bug report.
      
      
      mysys/my_create.c:
        Ensure that, if the call to my_register_filename() in my_create()
        failed, but the previous open() called succeeded, the newly created
        file is deleted before returning an error.
      810c40ab
    • unknown's avatar
      test case fix · c024555a
      unknown authored
      c024555a
  8. 01 Mar, 2008 1 commit
  9. 29 Feb, 2008 7 commits
    • unknown's avatar
      wrong merge fix · 88790657
      unknown authored
      88790657
    • unknown's avatar
      Merge mysql.com:/home/gluh/MySQL/Merge/4.1-opt · a1003a6c
      unknown authored
      into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
      
      
      mysql-test/t/symlink.test:
        Auto merged
      mysql-test/r/symlink.result:
        after merge fix
      a1003a6c
    • unknown's avatar
      test fix · cdcbcc5a
      unknown authored
      
      mysql-test/r/symlink.result:
        result fix
      cdcbcc5a
    • unknown's avatar
      Fixed bug #34830: mixed table and field names in Item_ref · fe65567e
      unknown authored
                        and Item_direct_ref constructor calls.
      
      Order of ref->field_name and ref->table_name arguments
      is of Item_ref and Item_direct_ref in the fix_inner_refs
      function is inverted.
      
      
      sql/sql_select.cc:
        Fixed bug #34830: mixed table and field names in Item_ref
                          and Item_direct_ref constructor calls.
        
        Order of ref->field_name and ref->table_name arguments
        is of Item_ref and Item_direct_ref in the fix_inner_refs
        function is inverted. See definitions:
        
          Item_ref(Name_resolution_context *context_arg, Item **item,
                   const char *table_name_arg, const char *field_name_arg,
                   bool alias_name_used_arg= FALSE)
          and
        
          Item_direct_ref(Name_resolution_context *context_arg, Item **item,
                          const char *table_name_arg,
                          const char *field_name_arg,
                          bool alias_name_used_arg= FALSE)
      fe65567e
    • unknown's avatar
      after merge fix · c2b51c23
      unknown authored
      c2b51c23
    • unknown's avatar
      Merge mysql.com:/home/gluh/MySQL/Merge/4.1-opt · 88cee26e
      unknown authored
      into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
      
      
      sql/mysql_priv.h:
        Auto merged
      mysql-test/r/symlink.result:
        manual merge
      mysql-test/t/symlink.test:
        manual merge
      sql/mysqld.cc:
        manual merge
      sql/sql_parse.cc:
        manual merge
      88cee26e
    • unknown's avatar
      Bug#32167 another privilege bypass with DATA/INDEX DIRECORY(ver 4.1,5.0) · 69289dbf
      unknown authored
      added new function test_if_data_home_dir() which checks that
      path does not contain mysql data home directory.
      Using of mysql data home directory in
      DATA DIRECTORY & INDEX DIRECTORY is disallowed.
      
      
      mysql-test/r/symlink.result:
        test result
      mysql-test/t/symlink.test:
        test case
      sql/mysql_priv.h:
        new variable mysql_unpacked_real_data_home
      sql/mysqld.cc:
        new variable mysql_unpacked_real_data_home
      sql/sql_parse.cc:
        added new function test_if_data_home_dir() which checks that
        path does not contain mysql data home directory.
        Using of mysql data home directory in
        DATA DIRECTORY & INDEX DIRECTORY is disallowed.
      69289dbf
  10. 28 Feb, 2008 5 commits
    • unknown's avatar
      Merge host.loc:/home/uchum/work/PP/5.0-opt-34620 · e427a847
      unknown authored
      into  host.loc:/home/uchum/work/5.0-opt
      
      e427a847
    • unknown's avatar
      Fixed bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*): · d05c8d38
      unknown authored
                        Assertion `0' failed
      
      If ROW item is a part of an expression that also has
      aggregate function calls (COUNT/SUM/AVG...), a
      "splitting" with an Item::split_sum_func2 function
      is applied to that ROW item.
      Current implementation of Item::split_sum_func2
      replaces this Item_row with a newly created
      Item_aggregate_ref reference to it.
      Then the row cache tries to work with the
      Item_aggregate_ref object as with the Item_row object:
      row cache calls row-emulation methods such as cols and
      element_index. Item_aggregate_ref (like it's parent
      Item_ref) inherits dummy implementations of those
      methods from the hierarchy root Item, and call to
      them leads to failed assertions and wrong data
      output.
      
      Row-emulation virtual functions (cols, element_index, addr,
      check_cols, null_inside and bring_value) of Item_ref have
      been overloaded to forward calls to an underlying item
      reference.
      
      
      
      
      mysql-test/r/row.result:
        Added test case for bug #34620.
      mysql-test/t/row.test:
        Added test case for bug #34620.
      sql/item.h:
        Fixed bug #34620.
        Row-emulation virtual functions (cols, element_index, addr,
        check_cols, null_inside and bring_value) of Item_ref have
        been overloaded to forward calls to an underlying item
        reference.
      d05c8d38
    • unknown's avatar
      Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 1168dca6
      unknown authored
      into  magare.gmz:/home/kgeorge/mysql/autopush/B34747-5.0-opt
      
      1168dca6
    • unknown's avatar
      Bug#34749: Server crash when using NAME_CONST() with an aggregate function · 4715b478
      unknown authored
      NAME_CONST('whatever', -1) * MAX(whatever) bombed since -1 was
      not seen as constant, but as FUNCTION_UNARY_MINUS(constant)
      while we are at the same time pretending it was a basic const
      item. This confused the aggregate handlers in exciting ways.
      We now make NAME_CONST() behave more consistently.
      
      
      mysql-test/r/func_misc.result:
        show that a combination of NAME_CONST('x', -y) and an aggregate
        no longer crashes the server.
      mysql-test/t/func_misc.test:
        show that a combination of NAME_CONST('x', -y) and an aggregate
        no longer crashes the server.
      sql/ha_ndbcluster_cond.cc:
        tell cluster about "new" function type NEG_FUNC.
        (this was previous identified as UNKNOWN_FUNC,
        so we just handle it the same way, that's all.)
      sql/ha_ndbcluster_cond.h:
        tell cluster about "new" function type NEG_FUNC.
        (this was previous identified as UNKNOWN_FUNC,
        so we just handle it the same way, that's all.)
      sql/item.cc:
        make NAME_CONST() transparent in that type() of
        -constant is that of constant, not that of unary
        minus (id est, FUNC_ITEM).
      sql/item.h:
        Move constructor to item.cc
      sql/item_func.h:
        Revert Bug#30832; we can apply the magic more narrowly
        (just for NAME_CONST() rather than all Item_func_neg).
        
        Introduce new function type "NEG_FUNC."
      4715b478
    • unknown's avatar
      Bug #34747: crash in debug assertion check after derived table · 623437f7
      unknown authored
      Was a double-free of the Unique member of Item_func_group_concat.
      This was not causing a crash because the Unique is a descendent of
      Sql_alloc.
      Fixed to free the Unique only if it was allocated for the instance 
      of Item_func_group_concat it was referenced from
      
      
      mysql-test/r/func_gconcat.result:
        Bug #34747: test case
      mysql-test/t/func_gconcat.test:
        Bug #34747: test case
      sql/item_sum.cc:
        Bug #34747: free the Unique only if it was allocated
        for this instance of Item_func_group_concat
      623437f7
  11. 27 Feb, 2008 4 commits
    • unknown's avatar
      Merge kaamos.(none):/data/src/opt/bug33834/my50-bug33834 · c68c2f0d
      unknown authored
      into  kaamos.(none):/data/src/opt/mysql-5.0-opt
      
      c68c2f0d
    • unknown's avatar
      Fixed test suite failures with --ps-protocol introduced in PB by · dad47218
      unknown authored
      the patch for bug #33834.
      
      dad47218
    • unknown's avatar
      Merge bk@192.168.21.1:mysql-5.0-opt · de47861e
      unknown authored
      into  mysql.com:/home/hf/work/25097/my50-25097
      
      
      libmysql/libmysql.c:
        Auto merged
      libmysqld/lib_sql.cc:
        Auto merged
      sql/log.cc:
        Auto merged
      de47861e
    • unknown's avatar
      Bug #25097 mysql_server_init fails silently if no errmsg.sys is present. · 86260744
      unknown authored
      There was no way to return an error from the client library
      if no MYSQL connections was established.
      So here i added variables to store that king of errors and
      made functions like mysql_error(NULL) to return these.
      
      
      client/mysql.cc:
        Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
        
        Show the error message on std_error
      include/sql_common.h:
        Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
        
        cant_connect_sqlstate constant declared
      libmysql/libmysql.c:
        Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
        
        mysql_sqlstate(NULL) returns 'unknown_sqlstate'
      libmysqld/lib_sql.cc:
        Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
        
        EMBEDDED_SERVER version of the vprint_msg_to_log() implemented
      sql-common/client.c:
        Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
        
        mysql_server_last_errno and mysql_server_last_error introduced
        to store errors not related to particular connections.
        
        mysql_error(NULL) and mysql_errno(NULL) now returns these
        mysql_server_last_error and errno respectively
      sql/log.cc:
        Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
        
        EMBEDDED_LIBRARY implementation of the vprint_msg_to_log() moved
        to lib_sql.cc
      86260744
  12. 26 Feb, 2008 1 commit
  13. 25 Feb, 2008 2 commits
    • unknown's avatar
      Fix for bug #33834: FRAC_SECOND: Applicability not clear in · fe0eafa5
      unknown authored
                          documentation
      
      While the manual mentions FRAC_SECOND only for the TIMESTAMPADD()
      function, it was also possible to use FRAC_SECOND with DATE_ADD(),
      DATE_SUB() and +/- INTERVAL.
      
      Fixed the parser to match the manual, i.e. using FRAC_SECOND for 
      anything other than TIMESTAMPADD()/TIMESTAMPDIFF() now produces a 
      syntax error.
      
      Additionally, the patch allows MICROSECOND to be used in TIMESTAMPADD/
      TIMESTAMPDIFF and marks FRAC_SECOND as deprecated.
      
      
      mysql-test/r/func_time.result:
        Added a test case for bug #33834.
      mysql-test/t/func_time.test:
        Added a test case for bug #33834.
      sql/sql_yacc.yy:
        Reject FRAC_SECOND for anything other than TIMESTAMPADD() or
        TIMESTAMPDIFF().
        Allow MICROSECOND to be used with TIMESTAMPADD()/TIMESTAMPDIFF().
        Warn about FRAC_SECOND being a deprecated unit.
      fe0eafa5
    • unknown's avatar
      Bug#29645: Link failure when using the embedded server · a81f117c
      unknown authored
      mysql_config --cflags gave a flag that forced the HP/UX
      C++ compiler into C-mode; as a result, C++ sources could
      not be compiled correctly.
      
      We now filter out the offending flag (like we do for Sun)
      so that --cflags will work for both C and C++.
      
      
      scripts/mysql_config.sh:
        Add -AC99 (for HP/UX) to the list of flags we need to remove
        from "mysql_config --cflags" so they work for C and C++ both.
      a81f117c
  14. 22 Feb, 2008 5 commits
  15. 20 Feb, 2008 2 commits
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 5c6738db
      unknown authored
      into  moonbone.local:/work/33266-bug-5.0-opt-mysql
      
      5c6738db
    • unknown's avatar
      Bug#33266: Incorrect test case for the bug#31048 failing on some platforms. · f950ec6a
      unknown authored
      The test case for the bug#31048 checks that there is no crash on stack
      overrun. But due to different stack sizes on different platforms it failed
      on some of them.
      
      The new test case check that a query with at least 4 level subquery nesting
      works without the stack overrun nesting and other levels of nesting doesn't
      cause a crash.
      
      
      mysql-test/t/subselect.test:
        Corrected test case for the bug#31048.
      mysql-test/r/subselect.result:
        Corrected test case for the bug#31048.
      f950ec6a
  16. 19 Feb, 2008 1 commit
    • unknown's avatar
      Bug #30604: different flagging of time_zone_used in normal · e719a221
      unknown authored
        and ps-protocol
      Finding a routine should be a transparent operation as 
      far as the binary log is concerned.
      But it was influencing the binary log because of the TIMESTAMP
      column in the proc table.
      
      Fixed by preserving and restoring the time_zone usage flag when
      searching for a stored routine in the proc table.
      
      
      mysql-test/r/binlog_innodb.result:
        Bug #30604: test case
      mysql-test/r/ctype_cp932_binlog.result:
        Bug #30604: updated test results (a procedure call before that)
      mysql-test/t/binlog_innodb.test:
        Bug #30604: test case
      sql/sp.cc:
        Bug #30604: finding a routine should be a transparent operation as 
        far as the binary log is concerned.
        Fixed by preserving and restoring the time_zone usage flag.
      e719a221