An error occurred fetching the project authors.
  1. 23 Dec, 2012 1 commit
  2. 15 Jun, 2012 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #1002157. · 1d74ae6b
      Igor Babaev authored
      The class Item_func missed an implementation of the virtual 
      function update_null_value.
      Back-ported the fix for bug 62125 from mysql 5.6 code line.
      The test case was also back-ported. 
      1d74ae6b
  3. 08 Jun, 2012 1 commit
    • Michael Widenius's avatar
      Changed last_insert_id() to be unsigned. · 438e9eca
      Michael Widenius authored
      Fixed MDEV-331: last_insert_id() returns a signed number
      
      mysql-test/r/auto_increment.result:
        Added test case
      mysql-test/t/auto_increment.test:
        Added test case
      sql/item_func.h:
        Changed last_insert_id() to be unsigned.
      438e9eca
  4. 13 Apr, 2012 1 commit
  5. 19 Dec, 2011 2 commits
  6. 02 Nov, 2011 1 commit
  7. 11 Jul, 2011 1 commit
    • Sergey Petrunya's avatar
      Port of code for: (part of testcase is in mysql-test/t/subquery*.test and will... · 2c28412e
      Sergey Petrunya authored
      Port of code for: (part of testcase is in mysql-test/t/subquery*.test and will be ported separately)
      
      Bug#11766642: crash in Item_field::register_field_in_read_map 
                    with view
      
      (Former 59793)
      
      Prior to the refactoring in this patch, Item_cond_xor behaved 
      partially as an Item_cond and partially as an Item_func. The
      reasoning behind this was that XOR is currently not optimized
      (thus should be Item_func instead of Item_cond), but it was 
      planned optimize it in the future (thus, made Item_cond anyway 
      to ease optimization later). 
      
      Even though Item_cond inherits from Item_func, there are 
      differences between these two. One difference is that the 
      arguments are stored differently. Item_cond stores them in a 
      list while Item_func store them in an args[]. 
      
      BUG no 45221 was caused by Item_cond_xor storing arguments in 
      the list while users of the objects would look for them in 
      args[]. The fix back then was to store the arguments in both 
      locations.
      
      In this bug, Item_cond_xor initially gets two Item_field 
      arguments. These are stored in the list inherited from 
      Item_cond and in args[] inherited from Item_func. During
      resolution, find_field_in_view() replaces the Item_fields 
      stored in the list with Item_direct_view_refs, but args[] 
      still points to the unresolved Item_fields. This shows that 
      the fix for 45221 was incorrect.
      
      The refactoring performed in this patch removes the confusion
      by making the XOR item an Item_func period. A neg_transformer() 
      is also implemented for Item_func_xor to improve performance 
      when negating XOR expressions. An XOR is negated by negating 
      one of the operands.
      2c28412e
  8. 30 Jun, 2011 1 commit
  9. 22 May, 2011 1 commit
  10. 20 May, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #777745. · 016a09cb
      Igor Babaev authored
      Fields belonging to views in general cannot be substituted for 
      equal items, in particular for constants, because all references
      to a view field refer to the same Item_field object while they 
      could be used in different OR parts of the where condition and
      belong to different equivalence classes (to different Item_equals).
      That's why substitution for equal items in any context is allowed
      only in place of Item_direct_view_ref objects, but not in place of
      Item_fields these objects refer to.
      Due to some erroneous code in the patch for bug 717577 substitution
      for view fields were allowed in some context.This could lead
      to wrong results returned by queries using views.
      
      The fix prohibits substitution of view fields for equal items 
      in any context.
      
      The patch also changes slightly the compile method for the Item_func
      class. Now if the analyze method returns NULL in his parameter the
      compile method is not called for the arguments of the function
      at all. A similar change was made for the Item_ref class.     
      016a09cb
  11. 08 May, 2011 1 commit
    • Michael Widenius's avatar
      Adding support for Dynamic columns (WL#34): · 5ab92b1f
      Michael Widenius authored
      - COLUMN_CREATE(column_nr, value, [column_nr,value]...)
      - COLUMN_ADD(blob,column_nr, value, column_nr,value]...)
      - COLUMN_DELETE(blob, column_nr, column_nr...)
      - COLUMN_EXISTS(blob, column_nr)
      - COLUMN_LIST(blob, column_nr)
      - COLUMN_GET(string, column_nr AS type)
      
      Added cast(X as DOUBLE) and cast(x as INT)
      Better warning and error messages for wrong cast's
      Created some sub functions to simplify and reuse code.
      Added a lot of conversation functions with error/warnings for what went wrong.
      Fixed some issues when casting time to datetime.
      Added functions to dynamic strings and Strings to allow one to move a string buffer from dynamic strings to String (to save malloc+ copy)
      Added dynamic columns library to libmysqlclient
      
      
      include/Makefile.am:
        Added ma_dyncol.h
      include/decimal.h:
        Added 'const' to arguments for some functions.
      include/my_sys.h:
        Added dynstr_reassociate()
      include/my_time.h:
        Added TIME_SUBSECOND_RANGE
        Added double_to_datetime()
        Added flag argument to str_to_time()
      libmysql/CMakeLists.txt:
        Added mysys/ma_dyncol.c
      libmysql/Makefile.shared:
        Added ma_dyncol
      libmysql/libmysql.c:
        Added argument to str_to_time()
      mysql-test/r/bigint.result:
        Better error messages
      mysql-test/r/cast.result:
        Better warning and error messages
        A lot of new cast() tests
      mysql-test/r/func_math.result:
        Better warning messages
      mysql-test/r/func_str.result:
        Better warning messages
      mysql-test/r/func_time.result:
        Better warning messages
      mysql-test/r/sp-vars.result:
        Better warning messages
      mysql-test/r/strict.result:
        Better warning messages
        New test result
      mysql-test/r/type_newdecimal.result:
        Better warning messages
      mysql-test/r/warnings.result:
        Better warning messages
      mysql-test/suite/funcs_1/r/innodb_func_view.result:
        Updated results after better cast warnings
      mysql-test/suite/funcs_1/r/memory_func_view.result:
        Updated results after better cast warnings
      mysql-test/suite/funcs_1/r/myisam_func_view.result:
        Updated results after better cast warnings
      mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/inc/part_supported_sql_funcs_delete.inc:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/r/rpl_partition.result:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
        Removed duplicated --big_test
      mysql-test/suite/parts/t/rpl_partition.test:
        Added begin...commit to speed up test.
      mysql-test/suite/pbxt/r/cast.result:
        Updated results after better cast warnings
      mysql-test/suite/pbxt/r/func_str.result:
        Updated results after better cast warnings
      mysql-test/suite/pbxt/r/type_newdecimal.result:
        Updated results after better cast warnings
      mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
        Added begin...commit to speed up test.
      mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
        Added begin...commit to speed up test.
      mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result:
        More warnings
      mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result:
        More warnings
      mysql-test/t/cast.test:
        A lot of new cast() tests
      mysql-test/t/strict.test:
        Added new test
      mysys/CMakeLists.txt:
        Added ma_dyncol.c
      mysys/Makefile.am:
        Added ma_dyncol.c
      mysys/string.c:
        Added dynstr_reassociate() to move a buffer from dynamic_strings to some other allocator
      sql-common/my_time.c:
        Added 'fuzzydate' flag to str_to_time()
        Added support for microseconds to my_time_to_str() and my_datetime_to_str()
        Reset second_parts in number_to_datetime()
        Added double_to_datetime()
      sql/field.cc:
        Added double_to_longlong() and truncate_double() to simplify and reuse code
      sql/field.h:
        New prototypes
      sql/item.cc:
        Changed Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) to be aware of type of argument.
        (Needed to make it microsecond safe and get better warnings).
        Updated call to str_to_time_with_warn()
      sql/item.h:
        Added struct st_dyncall_create_def used by dynamic columns
        Added virtual bool dynamic_result() to tell if type of argument may change over calls.
      sql/item_cmpfunc.cc:
        Added Item_func_dyncol_exists()
      sql/item_cmpfunc.h:
        Added class Item_func_dyncol_exists
      sql/item_create.cc:
        Added get_length_and_scale() to simplify other functions
        Simplified and extended create_func_cast()
        Added support for cast(X as double(X,Y))
        Added functions to create dynamic column functions.
      sql/item_create.h:
        Added prototypes
      sql/item_func.cc:
        Extended cast functions Item_func_signed() and Item_func_unsigned() to work with dynamic types
        Added Item_double_typecast()
      sql/item_func.h:
        Added class Item_double_typecast()
      sql/item_strfunc.cc:
        Added functions for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
      sql/item_strfunc.h:
        Added classes for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
      sql/item_timefunc.cc:
        Added flag argument to str_to_time_with_warn()
        Updated Item_char_typecast() to handle result type that may change between calls (for dynamic columns)
        Added Item_time_typecast::get_date() to ensure that we cast a datetime to time properly.
      sql/item_timefunc.h:
        Added get_date() to Item_time_typecast() to allow proper results for casting time to datetime
      sql/lex.h:
        Added new SQL function names
      sql/my_decimal.cc:
        Added 'const' to some arguments.
        Better error message in case of errors (we now print out the wrong value)
        Added my_decimal2int()
      sql/my_decimal.h:
        Moved some constants to my_decimal_limits.h
        Updated prototypes.
        Made my_decimal2int() a function as it's rather long (no reason to have it inline)
        Added decimal2my_decimal() function.
      sql/mysql_priv.h:
        Prototypes for new functions
      sql/share/errmsg.txt:
        New error messages for wrong casts and dynamic columns
      sql/sql_acl.cc:
        Fixed indentation
      sql/sql_base.cc:
        Added dynamic_column_error_message()
      sql/sql_string.h:
        Added reassociate() to move a buffer to be owned by String object.
      sql/sql_yacc.yy:
        Added syntax for COLUMN_ functions.
      sql/time.cc:
        Updated str_to_datetime_with_warn() flag argument to same type as other functions
        Added conversion flag to str_to_time_with_warn() (Similar to all datetime functions)
        Added conversion functions with warnings: double_to_datetime_with_warn() and decimal_to_datetime_with_warn()
      strings/decimal.c:
        Added 'const' to arguments for some functions.
      unittest/mysys/Makefile.am:
        Added test for dynamic columns code
      5ab92b1f
  12. 08 Apr, 2011 1 commit
    • Alexander Barkov's avatar
      Bug#11926811 / Bug#60625 Illegal mix of collations · a1c762b9
      Alexander Barkov authored
      Problem: comparison of a DATETIME sp variable and NOW()
      led to Illegal mix of collations error when 
      character_set_connection=utf8.
      Introduced by "WL#2649 Number-to-string conversions".
      
      Error happened in Arg_comparator::set_compare_func(),
      because the first argument was errouneously converted to utf8,
      while the second argument was not.
      
      Fix: separate agg_arg_charsets_for_comparison() into two functions:
      
      - agg_arg_charsets_for_comparison() - for pure comparison,
        when we don't need to return any string result and therefore
        don't need to convert arguments to @@character_set_connection:
          SELECT a = b;
      
      - agg_arg_charsets_for_string_results_with_comparison() - when
        we need to return a string result, but we also need to do
        comparison internally: SELECT REPLACE(a,b,c)
        If all arguments are numbers:
          SELECT REPLACE(123,2,3) -> 133
        we convert arguments to @@character_set_connection.
      
      
        @ mysql-test/include/ctype_numconv.inc
        @ mysql-test/r/ctype_binary.result
        @ mysql-test/r/ctype_cp1251.result
        @ mysql-test/r/ctype_latin1.result
        @ mysql-test/r/ctype_ucs.result
        @ mysql-test/r/ctype_utf8.result
        Adding tests
      
        @ sql/item.cc
        @ sql/item.h
        @ sql/item_func.cc
        @ sql/item_func.h
        @ sql/item_strfunc.cc
      
        Introducing and using new function
         agg_item_charsets_for_string_result_with_comparison() and
        its Item_func wrapper agg_arg_charsets_for_string_result_with_comparison().
      a1c762b9
  13. 24 Mar, 2011 1 commit
    • unknown's avatar
      Fix LP BUG#715738 · ec239491
      unknown authored
      Analysis:
      A query with implicit grouping is one with aggregate functions and
      no GROUP BY clause. MariaDB inherits from MySQL an SQL extenstion
      that allows mixing aggregate functions with non-aggregate fields.
      If a query with such mixed select clause produces an empty result
      set, the meaning of aggregate functions is well defined - either
      NULL (MIN, MAX, etc.), or 0 (count(*)). However the non-aggregated
      fields must also have some value, and the only reasonable value in
      the case of empty result is NULL.
      
      The cause of the many wrong results was that if a field is declared
      as non-nullable (e.g. because it is a PK or NOT NULL), the semantic
      analysis and the optimization phases treat this field as non-nullable,
      and generate all related query plan elements based on this assumption.
      
      Later during execution, these incorrectly configured/generated query
      plan elements result in a wrong result because the selected fields
      are not null due to the not-null assumption during optimization.
      
      Solution:
      Detect before the context analysys phase that a query uses implicit
      grouping with mixed aggregates/non-aggregates, and set all fields
      as nullable. The parser already walks the SELECT clause, and
      already sets Item::with_sum_func for Items that reference aggreagate
      functions. The patch adds a symmetric Item::with_field so that all
      Items that reference an Item_field are marked during their
      construction at parse time in the same way as with aggregate function
      use.
      ec239491
  14. 18 Mar, 2011 1 commit
  15. 01 Mar, 2011 1 commit
    • Sergei Golubchik's avatar
      wl#173 - temporal types with sub-second resolution · a8a757c6
      Sergei Golubchik authored
               and collateral changes.
      
      * introduce my_hrtime_t, my_timediff_t, and conversion macros
      * inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
        never from Item::result_type()
      * pack_time/unpack_time function for "packed" representation of
        MYSQL_TIME in a longlong that can be compared
      * ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
      * numbers aren't quoted in EXPLAIN EXTENDED
      * new column I_S.COLUMNS.DATETIME_PRECISION
      * date/time values are compares to anything as date/time, not as strings or numbers.
      * old timestamp(X) is no longer supported
      * MYSQL_TIME to string conversion functions take precision as an argument
      * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
      * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
      * Field_temporal
      * Lazy_string class to pass a value (string, number, time) polymorphically down the stack
      * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
      * removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
      * introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
      * in many cases date/time types are treated like other types, not as special cases
      * greatly simplified Arg_comparator (regarding date/time/year code)
      * SEC_TO_TIME is real function, not integer.
      * microsecond precision in NOW, CURTIME, etc
      * Item_temporal. All items derived from it only provide get_date, but no val* methods
      * replication of NOW(6)
      * Protocol::store(time) now takes the precision as an argument
      * @@TIMESTAMP is a double
      
      client/mysqlbinlog.cc:
        remove unneded casts
      include/my_sys.h:
        introduce my_hrtime_t, my_timediff_t, and conversion macros
      include/my_time.h:
        pack_time/unpack_time, etc.
        convenience functions to work with MYSQL_TIME::second_part
      libmysql/libmysql.c:
        str_to_time() is gone. str_to_datetime() does it now.
        my_TIME_to_str() takes the precision as an argument
      mysql-test/include/ps_conv.inc:
        time is not equal to datetime anymore
      mysql-test/r/distinct.result:
        a test for an old MySQL bug
      mysql-test/r/explain.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/func_default.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/func_sapdb.result:
        when decimals=NOT_FIXED_DEC it means "not fixed" indeed
      mysql-test/r/func_test.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/func_time.result:
        ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
      mysql-test/r/having.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/information_schema.result:
        new column I_S.COLUMNS.DATETIME_PRECISION
      mysql-test/r/join_outer.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/metadata.result:
        TIMESTAMP no longer has zerofill flag
      mysql-test/r/range.result:
        invalid datetime is not compared with as a string
      mysql-test/r/select.result:
        NO_ZERO_IN_DATE, etc only affect storage - according to the manual
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/subselect.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/sysdate_is_now.result:
        when decimals=NOT_FIXED_DEC it means "not fixed" indeed
      mysql-test/r/type_blob.result:
        TIMESTAMP(N) is not deprecated
      mysql-test/r/type_timestamp.result:
        old TIMESTAMP(X) semantics is not supported anymore
      mysql-test/r/union.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/r/varbinary.result:
        numbers aren't quoted in EXPLAIN EXTENDED
      mysql-test/t/distinct.test:
        test for an old MySQL bug
      mysql-test/t/func_time.test:
        +- INTERVAL now works with TIME values
      mysql-test/t/select.test:
        typo
      mysql-test/t/subselect.test:
        only one error per statement, please
      mysql-test/t/system_mysql_db_fix40123.test:
        old timestamp(X) is no longer supported
      mysql-test/t/system_mysql_db_fix50030.test:
        old timestamp(X) is no longer supported
      mysql-test/t/system_mysql_db_fix50117.test:
        old timestamp(X) is no longer supported
      mysql-test/t/type_blob.test:
        old timestamp(X) is no longer supported
      mysql-test/t/type_timestamp.test:
        old timestamp(X) is no longer supported
      mysys/my_getsystime.c:
        functions to get the time with microsecond precision
      mysys/my_init.c:
        move the my_getsystime.c initialization code to my_getsystime.c
      mysys/my_static.c:
        no need to make these variables extern
      mysys/my_static.h:
        no need to make these variables extern
      scripts/mysql_system_tables.sql:
        old timestamp(X) is no longer supported
      scripts/mysql_system_tables_fix.sql:
        old timestamp(X) is no longer supported
      scripts/mysqlhotcopy.sh:
        old timestamp(X) is no longer supported
      sql-common/my_time.c:
        * call str_to_time from str_to_datetime, as appropriate
        * date/time to string conversions take precision as an argument
        * number_to_time()
        * TIME_to_double()
        * pack_time() and unpack_time()
      sql/event_data_objects.cc:
        cast is not needed
        my_datetime_to_str() takes precision as an argument
      sql/event_db_repository.cc:
        avoid dangerous downcast (because the pointer is
        not always Field_timestamp, see events_1.test)
      sql/event_queue.cc:
        avoid silly double-work for cond_wait
        (having an endpoint of wait, subtract the current time to get the timeout,
        and use set_timespec() macro to fill in struct timespec, by adding the current
        time to the timeout)
      sql/field.cc:
        * remove virtual Field::get_time(), everyone should use only Field::get_date()
        * remove lots of #ifdef WORDS_BIGENDIAN
        * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
        * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
        * Field_temporal
        * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
      sql/field.h:
        * remove virtual Field::get_time(), everyone should use only Field::get_date()
        * remove lots of #ifdef WORDS_BIGENDIAN
        * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
        * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
        * Field_temporal
        * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
        * removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
      sql/filesort.cc:
        TIME_RESULT, cmp_time()
      sql/item.cc:
        * numbers aren't quoted in EXPLAIN EXTENDED
        * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
        * virtual Item::get_time() is gone
        * Item_param::field_type() is set correctly
        * Item_datetime, for a datetime constant
        * time to anything is compared as a time
        * Item_cache::print() prints the value is available
        * bug fixed in Item_cache_int::val_str()
      sql/item.h:
        * Item::print_value(), to be used from Item_xxx::print() when needed
        * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
        * virtual Item::get_time() is gone
        * Item_datetime, for a datetime constant
        * better default for cast_to_int_type()
        * Item_cache objects now *always* have the field_type() set
      sql/item_cmpfunc.cc:
        * get_year_value, get_time_value are gone. get_datetime_value does it all
        * get_value_a_func, get_value_b_func are gone
        * can_compare_as_dates() is gone too, TIME_RESULT is used instead
        * cmp_type() instead or result_type() when doing a comparison
        * compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
        * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
      sql/item_cmpfunc.h:
        greatly simplified Arg_comparator
      sql/item_create.cc:
        * fix a bug in error messages in CAST
      sql/item_func.cc:
        Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
        mention all possibitiles in switch over Item_result values, or use default:
      sql/item_row.h:
        overwrite the default cmp_type() for Item_row,
        as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
      sql/item_timefunc.cc:
        rewrite make_datetime to support precision argument
        SEC_TO_TIME is real function, not integer.
        many functions that returned temporal values had duplicate code in val_* methods,
        some of them did not have get_date() which resulted in unnecessary date->str->date conversions. 
        Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
        many fixes to set decimals (datetime precision) correctly.
      sql/item_timefunc.h:
        SEC_TO_TIME is real function, not integer.
        many functions that returned temporal values had duplicate code in val_* methods,
        some of them did not have get_date() which resulted in unnecessary date->str->date conversions. 
        Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
        many fixes to set decimals (datetime precision) correctly.
      sql/log_event.cc:
        replication of NOW(6)
      sql/log_event.h:
        replication of NOW(6)
      sql/mysql_priv.h:
        Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
        make_truncated_value_warning() that uses it.
      sql/mysqld.cc:
        datetime in Arg_comparator::comparator_matrix
      sql/opt_range.cc:
        cleanup: don't disable warnings before calling save_in_field_no_warnings()
      sql/protocol.cc:
        Protocol::store(time) now takes the precision as an argument
      sql/protocol.h:
        Protocol::store(time) now takes the precision as an argument
      sql/rpl_rli.cc:
        small cleanup
      sql/set_var.cc:
        SET TIMESTAMP=double
      sql/set_var.h:
        @@TIMESTAMP is a double
      sql/share/errmsg.txt:
        precision and scale are unsigned
      sql/slave.cc:
        replication of NOW(6)
      sql/sp_head.cc:
        cleanup
      sql/sql_class.cc:
        support for NOW(6)
      sql/sql_class.h:
        support for NOW(6)
      sql/sql_insert.cc:
        support for NOW(6)
      sql/sql_select.cc:
        use item->cmp_type().
        move a comment where it belongs
      sql/sql_show.cc:
        new column I_S.COLUMNS.DATETIME_PRECISION
      sql/sql_yacc.yy:
        TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
      sql/time.cc:
        fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
      storage/myisam/ha_myisam.cc:
        TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
      strings/my_vsnprintf.c:
        warnings
      tests/mysql_client_test.c:
        old timestamp(X) does not work anymore
        datetime is no longer equal to time
      a8a757c6
  16. 09 Feb, 2011 2 commits
    • MySQL Build Team's avatar
      Backport into build-201102032246-5.1.52sp1 · d19c8ec9
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3527.3.2
      > revision-id: mattias.jonsson@oracle.com-20101222144517-cbv3l5jlbd0mq5s8
      > parent: mattias.jonsson@oracle.com-20101222095036-2lpx0gqu4i45jtkz
      > committer: Mattias Jonsson <mattias.jonsson@oracle.com>
      > branch nick: b54483-51-bt_2
      > timestamp: Wed 2010-12-22 15:45:17 +0100
      > message:
      >   Bug#54483: valgrind errors when making warnings for
      >   multiline inserts into partition
      >   Bug#57071: EXTRACT(WEEK from date_col) cannot be
      >   allowed as partitioning function
      >   
      >   Renamed function according to reviewers comments.
      d19c8ec9
    • MySQL Build Team's avatar
      Backport into build-201102032246-5.1.52sp1 · e4f23ff5
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3527.3.1
      > revision-id: mattias.jonsson@oracle.com-20101222095036-2lpx0gqu4i45jtkz
      > parent: sven.sandberg@oracle.com-20101220090735-psae11j9nwuj8vzl
      > committer: Mattias Jonsson <mattias.jonsson@oracle.com>
      > branch nick: b54483-51-bt_2
      > timestamp: Wed 2010-12-22 10:50:36 +0100
      > message:
      >   Bug#54483: valgrind errors when making warnings for multiline inserts into partition
      >   Bug#57071: EXTRACT(WEEK from date_col) cannot be allowed as partitioning function
      >   
      >   There were functions allowed as partitioning functions
      >   that implicit allowed cast. That could result in unacceptable
      >   behaviour.
      >   
      >   Solution was to check that the arguments of date and time functions
      >   have allowed types (field and date/datetime/time depending on function).
      e4f23ff5
  17. 27 Jan, 2011 1 commit
  18. 28 Dec, 2010 1 commit
    • Kent Boortz's avatar
      - Added/updated copyright headers · 85323eda
      Kent Boortz authored
      - Removed files specific to compiling on OS/2
      - Removed files specific to SCO Unix packaging
      - Removed "libmysqld/copyright", text is included in documentation
      - Removed LaTeX headers for NDB Doxygen documentation
      - Removed obsolete NDB files
      - Removed "mkisofs" binaries
      - Removed the "cvs2cl.pl" script
      - Changed a few GPL texts to use "program" instead of "library"
      85323eda
  19. 24 Dec, 2010 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #639935 (bug #58727). · efbb3c6c
      Igor Babaev authored
      When the optimizer creates items out of other items it does
      not have to call the fix_fields method. Usually in these
      cases it calls quick_fix_field() that just marks the 
      created item as fixed. If the created item is an Item_func
      object then calling quick_fix_field() works fine if the
      arguments of the created functional item are already fixed.
      Otherwise some unfixed nodes remain in the item tree and
      it triggers an assertion failure whenever the item is 
      evaluated.
      
      Fixed the problem by making the method quick_fix_field
      virtual and providing an implementation for the class
      Item_func objects that recursively calls the method
      for unfixed arguments of any functional item.
      efbb3c6c
  20. 22 Dec, 2010 2 commits
    • Mattias Jonsson's avatar
      Bug#54483: valgrind errors when making warnings for · 87155038
      Mattias Jonsson authored
      multiline inserts into partition
      Bug#57071: EXTRACT(WEEK from date_col) cannot be
      allowed as partitioning function
      
      Renamed function according to reviewers comments.
      
      sql/item.h:
        better name of processor function
      sql/item_func.h:
        better name of processor function
      sql/item_timefunc.h:
        better name of processor function
      sql/sql_partition.cc:
        better name of processor function
        Updated comment.
      87155038
    • Mattias Jonsson's avatar
      Bug#54483: valgrind errors when making warnings for multiline inserts into partition · 1615419d
      Mattias Jonsson authored
      Bug#57071: EXTRACT(WEEK from date_col) cannot be allowed as partitioning function
      
      There were functions allowed as partitioning functions
      that implicit allowed cast. That could result in unacceptable
      behaviour.
      
      Solution was to check that the arguments of date and time functions
      have allowed types (field and date/datetime/time depending on function).
      
      mysql-test/r/partition.result:
        Updated result
      mysql-test/r/partition_error.result:
        Updated result
      mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc:
        disabled test with not allowed arguments.
      mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
        Updated result
      mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
        Updated result
      mysql-test/t/partition.test:
        Fixed typo in bug number and removed non allowed function (bad argument)
      mysql-test/t/partition_error.test:
        Added tests to verify correct type of argument.
      sql/item.h:
        Renamed processor since it is no longer only for timezone
      sql/item_func.h:
        Added help functions for checking date/time/datetime arguments.
      sql/item_timefunc.h:
        Added processors for argument correctness
      sql/sql_partition.cc:
        renamed the processor for checking arguments.
      1615419d
  21. 03 Dec, 2010 1 commit
  22. 18 Oct, 2010 1 commit
    • Sergey Glukhov's avatar
      Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine · 127c721c
      Sergey Glukhov authored
      Subquery executes twice, at top level JOIN::optimize and ::execute stages.
      At first execution create_sort_index() function is called and
      FT_SELECT object is created and destroyed. HANDLER::ft_handler is cleaned up
      in the object destructor and at second execution FT_SELECT::get_next() method
      returns error.
      The fix is to reinit HANDLER::ft_handler field before re-execution of subquery.
      
      
      mysql-test/r/fulltext.result:
        test case
      mysql-test/t/fulltext.test:
        test case
      sql/item_func.cc:
        reinit ft_handler before re-execution of subquery
      sql/item_func.h:
        Fixed method name
      sql/sql_select.cc:
        reinit ft_handler before re-execution of subquery
      127c721c
  23. 23 Sep, 2010 1 commit
    • Michael Widenius's avatar
      Change some my_bool in C++ classes and a few functions to bool to detect wrong... · bdba1d11
      Michael Widenius authored
      Change some my_bool in C++ classes and a few functions to bool to detect wrong usage of bool/my_bool.
      Fix some bugs where we stored values other than 0 or 1 in my_bool
      Fixed some compiler warnings
      
      
      client/mysql.cc:
        Changed interrupted_query from my_bool to int, as we stored 2 in it.
      client/mysqladmin.cc:
        Changed return variable type to same type as function value type
      client/mysqltest.cc:
        Changed 'found' to int as we store other values than 0 or 1 into it
        Changed type for parameter of set_reconnect() to match usage.
      extra/libevent/evbuffer.c:
        Added __attribute__((unused))
      extra/libevent/event.c:
        Added __attribute__((unused))
      extra/libevent/signal.c:
        Added __attribute__((unused))
      sql/event_data_objects.h:
        my_bool -> bool
      sql/event_db_repository.cc:
        my_bool -> bool
      sql/event_db_repository.h:
        my_bool -> bool
      sql/event_parse_data.h:
        my_bool -> bool
      sql/events.cc:
        my_bool -> bool
      sql/events.h:
        my_bool -> bool
      sql/field.cc:
        my_bool -> bool
      sql/field.h:
        my_bool -> bool
      sql/hash_filo.h:
        my_bool -> bool
      sql/item.cc:
        my_bool -> bool
      sql/item.h:
        my_bool -> bool
      sql/item_cmpfunc.h:
        my_bool -> bool
        Changed result_for_null_param from my_bool to int as we stored -1 in it.
      sql/item_func.cc:
        my_bool -> bool
        Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s)
      sql/item_func.h:
        my_bool -> bool
      sql/item_subselect.h:
        my_bool -> bool
      sql/item_sum.cc:
        Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s)
      sql/parse_file.h:
        my_bool -> bool
      sql/rpl_mi.h:
        my_bool -> bool
      sql/sp_rcontext.h:
        my_bool -> bool
      sql/sql_analyse.h:
        my_bool -> bool
      sql/sql_base.cc:
        Change some assignments so that we don't initialize bool variables with int's.
      sql/sql_bitmap.h:
        my_bool -> bool
      sql/sql_cache.cc:
        my_bool -> bool
      sql/sql_cache.h:
        my_bool -> bool
      sql/sql_class.h:
        my_bool -> bool
      sql/sql_insert.cc:
        Change some assignments so that we don't initialize bool variables with int's.
      sql/sql_prepare.cc:
        my_bool -> bool
      sql/table.h:
        my_bool -> bool
      storage/maria/ma_check.c:
        Removed duplicate assignment
      strings/decimal.c:
        Fixed wrong variable usage.
        Don't do complex arithmetic on bool when simple works.
      bdba1d11
  24. 23 Aug, 2010 1 commit
    • Michael Widenius's avatar
      Fix for LP#612894 Some aggregate functions (such as MIN MAX) work incorrectly... · b6fe4713
      Michael Widenius authored
      Fix for LP#612894 Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value
      
      
      mysql-test/r/group_by.result:
        Added test that showed problems that no_rows_in_results() didn't work for expressions
      mysql-test/r/subselect4.result:
        Test case for LP#612894
      mysql-test/t/group_by.test:
        Added test that showed problems that no_rows_in_results() didn't work for expressions
      mysql-test/t/subselect4.test:
        Test case for LP#612894
      sql/item.h:
        Added restore_to_before_no_rows_in_result()
        Added function processor for no_rows_in_results() and restore_to_before_no_rows_in_results() to ensure it works with functions
        Fix that above functions are handled by Item_ref()
      sql/item_func.h:
        Ensure that no_rows_in_results() and restore_to_before_no_rows_in_result() are called for all function arguments
      sql/item_sum.cc:
        Added restore_to_before_no_rows_in_result() to restore settings after Item_sum_hybrid::no_rows_in_result() was called.
        This is needed to handle the case where we have made 'make_const()' on the item in opt_sum(), but the item will be reused again in a sub query.
        Ignore multiple calls to no_rows_in_result() as Item_ref is calling it twice.
      sql/item_sum.h:
        Added restore_to_before_no_rows_in_result();
      sql/sql_select.cc:
        Added reset of no_rows_in_result() for JOIN::reinit()
      sql/sql_select.h:
        Added marker if no_rows_in_result() is called.
      b6fe4713
  25. 13 Aug, 2010 2 commits
    • Georgi Kodinov's avatar
      merge · 53e0b31e
      Georgi Kodinov authored
      53e0b31e
    • Georgi Kodinov's avatar
      Bug #55615 and bug #55564 · 4bf81165
      Georgi Kodinov authored
      An user assignment variable expression that's 
      evaluated in a logical expression context 
      (Item::val_bool()) can be pre-calculated in a 
      temporary table for GROUP BY.
      However when the expression value is used after the
      temp table creation it was re-evaluated instead of
      being read from the temp table due to a missing 
      val_bool_result() method.
      Fixed by implementing the method.
      4bf81165
  26. 26 May, 2010 1 commit
  27. 05 May, 2010 1 commit
    • Alexander Barkov's avatar
      Bug#51571 load xml infile causes server crash · 3c93a784
      Alexander Barkov authored
        
        Problem:
        item->name was NULL for Item_user_var_as_out_param
        which made strcmp(something, item->name) crash in the LOAD XML code.
        
        Fix:
        - item_func.h: Adding set_name() in constuctor for Item_user_var_as_out_param
        - sql_load.cc: Changing the condition in write_execute_load_query_log_event() which
        distiguished between Item_user_var_as_out_param and Item_field
        from
          if (item->name == NULL)
        to
          if (item->type() == Item::FIELD_ITEM)
        - loadxml.result, loadxml.test: adding tests
      3c93a784
  28. 31 Mar, 2010 1 commit
    • Mats Kindahl's avatar
      WL#5030: Split and remove mysql_priv.h · 23d8586d
      Mats Kindahl authored
      This patch:
      
      - Moves all definitions from the mysql_priv.h file into
        header files for the component where the variable is
        defined
      - Creates header files if the component lacks one
      - Eliminates all include directives from mysql_priv.h
      - Eliminates all circular include cycles
      - Rename time.cc to sql_time.cc
      - Rename mysql_priv.h to sql_priv.h
      23d8586d
  29. 18 Mar, 2010 1 commit
    • Alexey Kopytov's avatar
      Bug #8433: Overflow must be an error · 2acfdc50
      Alexey Kopytov authored
       
      All numeric operators and functions on integer, floating point 
      and DECIMAL values now throw an 'out of range' error rather 
      than returning an incorrect value or NULL,  when the result is 
      out of supported range for the corresponding data type. 
       
      Some test cases in the test suite had to be updated 
      accordingly either because the test case itself relied on a 
      value returned in case of a numeric overflow, or because a 
      numeric overflow was the root cause of the corresponding bugs. 
      The latter tests are no longer relevant, since the expressions 
      used to trigger the corresponding bugs are not valid anymore. 
      However, such test cases have been adjusted and kept "for the 
      record". 
      
      mysql-test/r/func_math.result:
        Added test cases for bug #8433. 
        Updated results of the test case for bug #31236.
      mysql-test/r/func_misc.result:
        Streamlined test cases.
      mysql-test/r/func_test.result:
        Streamlined test cases.
      mysql-test/r/select.result:
        Streamlined test cases.
      mysql-test/r/sp.result:
        Streamlined test cases.
      mysql-test/r/strict.result:
        Streamlined test cases.
      mysql-test/r/type_newdecimal.result:
        Streamlined test cases.
      mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result:
        Streamlined test cases.
      mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test:
        Streamlined test cases.
      mysql-test/t/func_math.test:
        Added test cases for bug #8433. 
        Updated results of the test case for bug #31236.
      mysql-test/t/func_misc.test:
        Streamlined test cases.
      mysql-test/t/func_test.test:
        Streamlined test cases.
      mysql-test/t/select.test:
        Streamlined test cases.
      mysql-test/t/sp.test:
        Streamlined test cases.
      mysql-test/t/strict.test:
        Streamlined test cases.
      mysql-test/t/type_newdecimal.test:
        Streamlined test cases.
      sql/item_create.cc:
        Changed Item_func_cot() to be defined as a standalone Item
        rather than a combination of "1 / TAN(x)".
      sql/item_func.cc:
        Throw an 'out of range' error rather than returning an  
        incorrect value or NULL,  when the result of a numeric 
        operator or a function is out of supported range for  
        the corresponding data type.
      sql/item_func.h:
        Added validation helpers as inline methods of Item_func.
      sql/share/errmsg-utf8.txt:
        New ER_DATA_OUT_OF_RANGE error.
      2acfdc50
  30. 11 Feb, 2010 1 commit
    • Alexander Barkov's avatar
      WL#2649 Number-to-string conversions · 702166bc
      Alexander Barkov authored
      added:
        include/ctype_numconv.inc
        mysql-test/include/ctype_numconv.inc
        mysql-test/r/ctype_binary.result
        mysql-test/t/ctype_binary.test
        Adding tests
      
      modified:
      
        mysql-test/r/bigint.result
        mysql-test/r/case.result
        mysql-test/r/create.result
        mysql-test/r/ctype_cp1251.result
        mysql-test/r/ctype_latin1.result
        mysql-test/r/ctype_ucs.result
        mysql-test/r/func_gconcat.result
        mysql-test/r/func_str.result
        mysql-test/r/metadata.result
        mysql-test/r/ps_1general.result
        mysql-test/r/ps_2myisam.result
        mysql-test/r/ps_3innodb.result
        mysql-test/r/ps_4heap.result
        mysql-test/r/ps_5merge.result
        mysql-test/r/show_check.result
        mysql-test/r/type_datetime.result
        mysql-test/r/type_ranges.result
        mysql-test/r/union.result
        mysql-test/suite/ndb/r/ps_7ndb.result
        mysql-test/t/ctype_cp1251.test
        mysql-test/t/ctype_latin1.test
        mysql-test/t/ctype_ucs.test
        mysql-test/t/func_str.test
          Fixing tests
      
      
        @ sql/field.cc
           - Return str result using my_charset_numeric.
           - Using real multi-byte aware str_to_XXX functions
             to handle tricky charset values propely (e.g. UCS2)
        @ sql/field.h
           - Changing derivation of non-string field types to DERIVATION_NUMERIC.
           - Changing binary() for numeric/datetime fields to always
           return TRUE even if charset is not my_charset_bin. We need
           this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
           - Adding BINARY_FLAG into some fields, because it's not
           being set automatically anymore with
           "my_charset_bin to my_charset_numeric" change.
          - Changing derivation for numeric/datetime datatypes to a weaker
            value, to make "SELECT concat('string', field)" use character
            set of the string literal for the result of the function.
        @ sql/item.cc
           - Implementing generic val_str_ascii().
           - Using max_char_length() instead of direct read of max_length
             to make "tricky" charsets like UCS2 work.
             NOTE: in the future we'll possibly remove all direct reads of max_length
           - Fixing Item_num::safe_charset_converter().
             Previously it alligned binary string to
             character string (for example by adding leading 0x00
             when doing binary->UCS2 conversion). Now it just
             converts from my_charset_numbner to "tocs".
           - Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
           - Other misc changes
        @ sql/item.h
           - Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
             bit operations instead of hard-coded bit masks.
           - Addding new method DTCollation.set_numeric().
           - Adding new methods to Item.
           - Adding helper functions to make code look nicer:
             agg_item_charsets_for_string_result()
             agg_item_charsets_for_comparison()
           - Changing charset for Item_num-derived items
             from my_charset_bin to my_charset_numeric
             (which is an alias for latin1).
        @ sql/item_cmpfunc.cc
           - Using new helper functions
           - Other misc changes
        @ sql/item_cmpfunc.h
           - Fixing strcmp() to return max_length=2.
             Previously it returned 1, which was wrong,
             because it did not fit '-1'.
        @ sql/item_func.cc
           - Using new helper functions
           - Other minor changes
        @ sql/item_func.h
           - Removing unused functions
           - Adding helper functions
             agg_arg_charsets_for_string_result()
             agg_arg_charsets_for_comparison()
           - Adding set_numeric() into constructors of numeric items.
           - Using fix_length_and_charset() and fix_char_length()
             instead of direct write to max_length.
        @ sql/item_geofunc.cc
           - Changing class for Item_func_geometry_type and
             Item_func_as_wkt from Item_str_func to
             Item_str_ascii_func, to make them return UCS2 result
             properly (when character_set_connection=ucs2).
        @ sql/item_geofunc.h
           - Changing class for Item_func_geometry_type and
             Item_func_as_wkt from Item_str_func to
             Item_str_ascii_func, to make them return UCS2 result
             properly (when @@character_set_connection=ucs2).
        @ sql/item_strfunc.cc
           - Implementing Item_str_func::val_str().
           - Renaming val_str to val_str_ascii for some items,
             to make them work with UCS2 properly.
           - Using new helper functions
           - All single-argument functions that expect string
             result now call this method:
             agg_arg_charsets_for_string_result(collation, args, 1);
             This enables character set conversion to @@character_set_connection
             in case of pure numeric input.
        @ sql/item_strfunc.h
           - Introducing Item_str_ascii_func - for functions
             which return pure ASCII data, for performance purposes,
             as well as for the cases when the old implementation
             of val_str() was heavily 8-bit oriented and implementing
             a UCS2-aware version is tricky.
        @ sql/item_sum.cc
           - Using new helper functions.
        @ sql/item_timefunc.cc
           - Using my_charset_numeric instead of my_charset_bin.
           - Using fix_char_length(), fix_length_and_charset()
             and fix_length_and_charset_datetime()
             instead of direct write to max_length.
           - Using tricky-charset aware function str_to_time_with_warn()
        @ sql/item_timefunc.h
           - Using new helper functions for charset and length initialization.
           - Changing base class for Item_func_get_format() to make
             it return UCS2 properly (when character_set_connection=ucs2).
        @ sql/item_xmlfunc.cc
           - Using new helper function
        @ sql/my_decimal.cc
           - Adding a new DECIMAL to CHAR converter
             with real multibyte support (e.g. UCS2)
      
        @ sql/mysql_priv.h
           - Introducing a new derivation level for numeric/datetime data types.
           - Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
           - Adding prototypes for str_set_decimal()
           - Adding prototypes for character-set aware str_to_xxx() functions.
        @ sql/protocol.cc
           - Changing charsetnr to "binary" client-side metadata for
             numeric/datetime data types.
        @ sql/time.cc
           - Adding to_ascii() helper function, to convert a string
             in any character set to ascii representation. In the
             future can be extended to understand digits written
             in various non-Latin word scripts.
           - Adding real multy-byte character set aware versions for str_to_XXXX,
             to make these these type of queries work correct:
               INSERT INTO t1 SET datetime_column=ucs2_expression;
         @  strings/ctype-ucs2.c
           - endptr was not calculated correctly. INSERTing of UCS2
             values into numeric columns returned warnings about
             truncated wrong data.
      702166bc
  31. 28 Jan, 2010 1 commit
  32. 17 Jan, 2010 1 commit
  33. 01 Jan, 2010 1 commit
  34. 22 Dec, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY <any non-const-function> · 2d8869d2
      Georgi Kodinov authored
      Several problems fixed : 
      1. Non constant expressions in UNION ... ORDER BY were not correctly cleaned up
      in st_select_lex_unit::cleanup() causing crashes in EXPLAIN EXTENDED because of
      fields quoted by these expressions pointing to the already freed temporary table
      used to calculate the UNION.
      Fixed by correctly cleaning up expressions of any depth.
      
      2. Subqueries in the order by part of UNION ... ORDER BY ... caused a crash in 
      EXPLAIN EXTENDED because of a transformation attempt made during EXPLAIN EXTENDED
      execution. Fixed by not doing the transformation when in EXPLAIN.
      
      3. Fulltext functions caused crash when in the ORDER BY part of an un-parenthesized
      UNION that gets "promoted" to be valid for the whole union, e.g. 
      SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY MATCHES (a) AGAINST ('abc' IN BOOLEAN MODE).
      This is a case that demonstrates a more general problem of parts of the query being
      moved to another level. When doing such transformation late in the optimization run
      when most of the flags about the contents of the query are already aggregated it's possible 
      to "split" the flags so that they correctly reflect the new queries after the transformation.
      In specific the ST_SELECT_LEX::ftfunc_list is holding all the free text function for all the 
      parts of the second SELECT in the UNION and we don't know what part of that is in the ORDER BY
      that we're to move to the UNION level and what part is about the other parts of the second SELECT.
      Fixed by throwing and error when such statements are about to be processed by adding a check 
      for the presence of MATCH() inside the ORDER BY clause that's going to get promoted to UNION.
      To workaround this new limitation one must parenthesize the UNION SELECTs and provide a real 
      global ORDER BY for the UNION outside of the parenthesis.
      2d8869d2
  35. 13 Dec, 2009 1 commit
    • Alexey Kopytov's avatar
      Bug #42849: innodb crash with varying time_zone on partitioned · c08e6c88
      Alexey Kopytov authored
                  timestamp primary key 
       
      Since TIMESTAMP values are adjusted by the current time zone  
      settings in both numeric and string contexts, using any 
      expressions involving TIMESTAMP values as a  
      (sub)partitioning function leads to undeterministic behavior of  
      partitioned tables. The effect may vary depending on a storage  
      engine, it can be either incorrect data being retrieved or  
      stored, or an assertion failure. The root cause of this is the  
      fact that the calculated partition ID may differ from a  
      previously calculated ID for the same data due to timezone  
      adjustments of the partitioning expression value. 
       
      Fixed by disabling any expressions involving TIMESTAMP values  
      to be used in partitioning functions with the follwing two 
      exceptions: 
       
      1. Creating or altering into a partitioned table that violates 
      the above rule is not allowed, but opening existing such tables 
      results in a warning rather than an error so that such tables 
      could be fixed. 
       
      2. UNIX_TIMESTAMP() is the only way to get a 
      timezone-independent value from a TIMESTAMP column, because it 
      returns the internal representation (a time_t value) of a 
      TIMESTAMP argument verbatim. So UNIX_TIMESTAMP(timestamp_column)
      is allowed and should be used to fix existing tables if one 
      wants to use TIMESTAMP columns with partitioning.
      
      mysql-test/r/partition_bug18198.result:
        Corrected the error.
      mysql-test/r/partition_error.result:
        Corrected error texts.
        Added test cases for bug #42849.
      mysql-test/t/partition_bug18198.test:
        Corrected error code.
      mysql-test/t/partition_error.test:
        Corrected error codes.
        Added test cases for bug #42849.
      sql/item.h:
        Added is_timezone_dependent_processor() to Item.
      sql/item_func.h:
        Added has_timestamp_args() and the implementation of
        is_timezone_dependent_processor() for Item_func.
      sql/item_timefunc.h:
        Added is_timezone_dependent_processor() to 
        Item_func_unix_timestamp.
      sql/share/errmsg.txt:
        Renamed ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR to
        ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR to better reflect the
        meaning. Adjusted the error message.
      sql/sql_partition.cc:
        Modified fix_fields_part_func() to walk through partitioning
        expression tree with is_timezone_dependent_processor() and issue
        a warning/error if it depends on the timezone settings.
        
        Changed fix_fields_part_func() to a static function since it is
        not used anywhere except sql_partition.cc
      sql/sql_partition.h:
        Removed the unneeded declaration of fix_fields_part_func()
        since it is now a static function.
      sql/sql_yacc.yy:
        ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR ->
        ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR.
      c08e6c88
  36. 25 Nov, 2009 1 commit
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · ffea9806
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3148.8.5
      > revision-id: davi.arnaut@sun.com-20091102112139-pztthzy6qj8jzomn
      > parent: svoj@sun.com-20091103091902-vwszwwpfi1f4zrpn
      > committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
      > branch nick: 48370-5.1
      > timestamp: Mon 2009-11-02 09:21:39 -0200
      > message:
      >   Bug#48370: Absolutely wrong calculations with GROUP BY and decimal fields when using IF
      >   Bug#45261: Crash, stored procedure + decimal
      >   
      >   Revert fix for Bug#45261 due to unforeseen bugs.
      ffea9806