An error occurred fetching the project authors.
  1. 30 Jan, 2007 1 commit
    • unknown's avatar
      Bug #25643: SEC_TO_TIME function problem · 3cb3a9a1
      unknown authored
       Checking for NULL before calling the val_xxx()
       methods only checks for such arguments that are 
       known to be NULLs at compile time. 
       The arguments that may or may not contain
       NULLs (e.g. function calls and possibly others)
       are not checked at all.
       Fixed by first calling the val_xxx() method and
       then checking for null in SEC_TO_TIME().
       In addition QUARTER() was not returning 0 (as all the 
       val_int() functions do when processing a NULL value).
      
      
      mysql-test/r/func_time.result:
        Bug #25643: SEC_TO_TIME function problem
         - test case
      mysql-test/t/func_time.test:
        Bug #25643: SEC_TO_TIME function problem
         - test case
      sql/item_timefunc.cc:
        Bug #25643: SEC_TO_TIME function problem
         - null handling fixed for QUARTER() and SEC_TO_TIME()
      3cb3a9a1
  2. 09 Nov, 2006 1 commit
    • unknown's avatar
      Fix for bug #23653: Crash if last_day('0000-00-00') · 69d8bfe2
      unknown authored
      As get_arg0_date() in the Item_func_last_day::get_date() returns 
      0000-00-00 date sometimes, we have to check ltime->month for 0 after the call.
      
      
      mysql-test/r/func_time.result:
        Fix for bug #23653: Crash if last_day('0000-00-00')
          - test result.
      mysql-test/t/func_time.test:
        Fix for bug #23653: Crash if last_day('0000-00-00')
          - test case.
      sql/item_timefunc.cc:
        Fix for bug #23653: Crash if last_day('0000-00-00')
          - return error if month is 0.
      69d8bfe2
  3. 01 Nov, 2006 1 commit
    • unknown's avatar
      Fix Bug #9191 "TIMESTAMP/from_unixtime() no longer accepts 2^31-1" · 8a7bc052
      unknown authored
      (4.1 version, with post-review fixes)
        
        The fix for another Bug (6439) limited FROM_UNIXTIME() to
        TIMESTAMP_MAX_VALUE which is 2145916799 or 2037-12-01 23:59:59 GMT,
        however unix timestamp in general is not considered to be limited 
        by this value. All dates up to power(2,31)-1 are valid.
        
        This patch extends allowed TIMESTAMP range so, that max
        TIMESTAMP value is power(2,31)-1. It also corrects
        FROM_UNIXTIME() and UNIX_TIMESTAMP() functions, so that
        max allowed UNIX_TIMESTAMP() is power(2,31)-1. FROM_UNIXTIME()
        is fixed accordingly to allow conversion of dates up to
        2038-01-19 03:14:07 UTC. The patch also fixes CONVERT_TZ()
        function to allow extended range of dates.
        
        The main problem solved in the patch is possible overflows
        of variables, used in broken-time representation to time_t
        conversion (required for UNIX_TIMESTAMP).
      
      
      acinclude.m4:
        Add new macro to check time_t range
      configure.in:
        Call the macro to check time_t range
      include/my_time.h:
        Move time-related defines to proper place.
        Add a function to perform a rough check if
        a TIMESTAMP value fits into the boundaries.
        Note: it is defined as "static inline", as
        otherwise libmysql won't compile (due to the
        way how gcc handles "inline" directive).
      mysql-test/r/func_time.result:
        Update test result
      mysql-test/r/timezone.result:
        Update test result
      mysql-test/r/timezone2.result:
        Update test result
      mysql-test/t/func_time.test:
        Add test for Bug#9191 and update test to be consistent
        with new TIMESTAMP boundaries
      mysql-test/t/timezone.test:
        Update old tests to be consistent
        with new TIMESTAMP boundaries
      mysql-test/t/timezone2.test:
        Update tests for convert_tz to be consistent with new
        TIMESTAMP boundaries
      sql/item_timefunc.cc:
        Fix convert_tz to allow dates from the new (extended)
        TIMESTAMP range
      sql/mysql_priv.h:
        Move time handling defaults to my_time.h
      sql-common/my_time.c:
        Because of increased TIMESTAMP_MAX_VALUE overflows in my_system_gmt_sec()
        became possible. Here we make it safe against the overflows by stepping
        back from the boundary dates which are likely to trigger them.
      sql/time.cc:
        Update TIME_to_timestamp to allow conversion of
        extended date range
      sql/tztime.cc:
        Fix new (4.1) implementation of broken-down time representation
        to time_t conversion routine to avoid overflows during conversion
        of boundary dates
      mysql-test/r/timezone4.result:
        New BitKeeper file ``mysql-test/r/timezone4.result''
      mysql-test/t/timezone4-master.opt:
        New BitKeeper file ``mysql-test/t/timezone4-master.opt''
      mysql-test/t/timezone4.test:
        New BitKeeper file ``mysql-test/t/timezone4.test''
      8a7bc052
  4. 17 Oct, 2006 1 commit
    • unknown's avatar
      Fix for bug #22229: Bug in DATE_ADD() · 4c02f402
      unknown authored
      From the manual:
      date arithmetic operations require complete dates and do not work with
      incomplete dates such as '2006-07-00' or badly malformed dates.
      
      
      mysql-test/r/func_time.result:
        Fix for bug #22229: Bug in DATE_ADD()
          - test result.
      mysql-test/t/func_time.test:
        Fix for bug #22229: Bug in DATE_ADD()
          - test case.
      sql/item_timefunc.cc:
        Fix for bug #22229: Bug in DATE_ADD()
          - Item_func_str_to_date::get_date() should return NULL if TIME_NO_ZERO_DATE 
            flag is set and year||month||day is 0.
      4c02f402
  5. 12 Oct, 2006 1 commit
  6. 04 Oct, 2006 1 commit
    • unknown's avatar
      Fixes a number of problems with time/datetime <-> string conversion functions: · 634d3ff2
      unknown authored
      - bug #11655 "Wrong time is returning from nested selects - maximum time exists
      - input and output TIME values were not validated properly in several conversion functions
      - bug #20927 "sec_to_time treats big unsigned as signed"
      - integer overflows were not checked in several functions. As a result, input values like 2^32 or 3600*2^32 were treated as 0
      - BIGINT UNSIGNED values were treated as SIGNED in several functions
      - in cases where both input string truncation and out-of-range TIME value occur, only 'truncated incorrect time value' warning was produced
      
      
      include/my_time.h:
        Added defines for the TIME limits
        Added defines for the warning flags set by str_to_time() and check_time_range()
        Added check_time_range() declaration
      mysql-test/r/func_sapdb.result:
        Fixed testcases which relied on incorrect TIMEDIFF() behaviour
      mysql-test/r/func_time.result:
        Fixed testcase which relied on incorrect behaviour
        Added testcases for out-of-range values in SEC_TO_TIME(), TIME_TO_SEC(), ADDTIME(), SUBTIME() and EXTRACT()
      mysql-test/t/func_time.test:
        Added testcases for out-of-range values in SEC_TO_TIME(), TIME_TO_SEC(), ADDTIME(), SUBTIME() and EXTRACT()
      sql-common/my_time.c:
        Added check_time_range() to be used from str_to_time() and item_timefunc.cc
        Added new out-of-range flag to str_to_time() warnings
        Use '%u' instead of '%d' in my_*_to_str() because the arguments are unsigned
      sql/field.cc:
        Replaced out-of-range checks with checks for flags returned by str_to_time()
      sql/item_timefunc.cc:
        Added wrappers over make_datetime() and make_time() which perform out-of-range checks on input values
        Moved common code in Item_func_sec_to_time::val_str() and Item_func_sec_to_time::val_int() into a separate function sec_to_time()
        Replaced calls to make_datetime() with make_datetime_with_warn() in Item_func_add_time and Item_func_timediff
        Checks for 'unsigned int' overflows in Item_func_maketime
        Use make_time_with_warn() instead of make_time() in Item_func_maketime
        Fixed incorrect sizeof() in Item_func_str_to_date::get_time()
      sql/time.cc:
        Check for return value of str_to_time() along with warning flags
      634d3ff2
  7. 02 Oct, 2006 1 commit
    • unknown's avatar
      Bug#21811 Odd casting with date + INTERVAL arithmetic · 5e71afcb
      unknown authored
      - Type casting was not consequent, thus when adding a DATE type with
        a WEEK interval the result type was DATETIME and not DATE as is the
        norm.
      - By changing the order of the date internal enumerations the deviant
        type casting is resolved (Item_date_add_interval::fix_length_and_dec()
        which determines result type for this operation assumes that addition
        of any interval with value <= INTERVAL_DAY to date value will result
        in date). There are two independant places to change:
        interval_names[] and interval_type.
      
      
      mysql-test/r/func_date_add.result:
        Updated result file for type casting test
      mysql-test/r/func_time.result:
        Updated result file for type casting test
      mysql-test/t/func_date_add.test:
        Added test for type casting when adding intervals to date.
      sql/item_timefunc.cc:
        Changed order of "week" key word to match the date interval enumeration.
      sql/item_timefunc.h:
        Changed the order of the enumeration to better follow interval sizes.
      5e71afcb
  8. 18 Sep, 2006 1 commit
  9. 14 Sep, 2006 1 commit
    • unknown's avatar
      type_date.result: · 0847bd9c
      unknown authored
        Added the test case for bug#21677: Wrong result when comparing a DATE and a DATETIME in BETWEEN
        Corrected a test case after removal of fix for bug#16377
      query_cache.result, func_time.test, view.result, view.test, func_time.result:
        Corrected a test case after removal of fix for bug#16377
      type_date.test:
        Added the test case for bug#21677: Wrong result when comparing a DATE and a DATETIME in BETWEEN
         Corrected a test case after removal of fix for bug#16377
      item_cmpfunc.cc:
        Removed changes to the Item_func_between::fix_length_and_dec() made in the fix for bug#16377
      
      
      mysql-test/t/view.test:
        Corrected a test case after removal of fix for bug#16377
      mysql-test/t/type_date.test:
        Added the test case for bug#21677: Wrong result when comparing a DATE and a DATETIME in BETWEEN
         Corrected a test case after removal of fix for bug#16377
      mysql-test/t/func_time.test:
        Corrected a test case after removal of fix for bug#16377
      mysql-test/r/view.result:
        Corrected a test case after removal of fix for bug#16377
      mysql-test/r/type_date.result:
        Added the test case for bug#21677: Wrong result when comparing a DATE and a DATETIME in BETWEEN
        Corrected a test case after removal of fix for bug#16377
      mysql-test/r/query_cache.result:
        Corrected a test case after removal of fix for bug#16377
      mysql-test/r/func_time.result:
        Corrected a test case after removal of fix for bug#16377
      sql/item_cmpfunc.cc:
        Removed changes to the Item_func_between::fix_length_and_dec() made in the fix for bug#16377
      0847bd9c
  10. 07 Sep, 2006 1 commit
    • unknown's avatar
      query_cache.result, func_time.test, type_date.result, func_time.result: · aa840645
      unknown authored
        Corrected test case after removal of fix for bug#16377         
      type_date.test:
        Corrected test case after removal of fix for bug#16377
      item_cmpfunc.cc:
        Removed changes to the agg_cmp_type() made in the for bug#16377
      
      
      mysql-test/t/type_date.test:
        Corrected test case after removal of fix for bug#16377
      mysql-test/t/func_time.test:
        Corrected test case after removal of fix for bug#16377
      mysql-test/r/type_date.result:
        Corrected test case after removal of fix for bug#16377
      mysql-test/r/query_cache.result:
        Corrected test case after removal of fix for bug#16377
      mysql-test/r/func_time.result:
        Corrected test case after removal of fix for bug#16377
      sql/item_cmpfunc.cc:
        Removed changes to the agg_cmp_type() made in the for bug#16377
      aa840645
  11. 04 Sep, 2006 2 commits
    • unknown's avatar
      Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver. · 52f3977e
      unknown authored
      Variable character_set_results can legally be NULL (for "no conversion.")
      This could result in a NULL deref that crashed the server.  Fixed.
      
      (Although ran some additional precursory tests to see whether I could break
      anything else, but no breakage so far.)
      
      
      mysql-test/r/func_time.result:
        Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
        
        Prove DATE_FORMAT() no longer crashes the server when character_set_results is
        NULL (which is a legal value and means, "no conversion").
      mysql-test/t/func_time.test:
        Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
        
        Prove DATE_FORMAT() no longer crashes the server when character_set_results is
        NULL (which is a legal value and means, "no conversion").
      sql/sql_string.cc:
        Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
        
        Avoid NULL deref in my_charset_same() -- if !to_cs, we won't need to compare
        because it is magic for, "no conversion."
      52f3977e
    • unknown's avatar
      Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver. · 61718995
      unknown authored
      Variable character_set_results can legally be NULL (for "no conversion.")
      This could result in a NULL deref that crashed the server.  Fixed.
      
      (Although ran some additional precursory tests to see whether I could break
      anything else, but no breakage so far.)
      
      
      mysql-test/r/func_time.result:
        Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
        
        Prove DATE_FORMAT() no longer crashes the server when character_set_results is
        NULL (which is a legal value and means, "no conversion").
      mysql-test/t/func_time.test:
        Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
        
        Prove DATE_FORMAT() no longer crashes the server when character_set_results is
        NULL (which is a legal value and means, "no conversion").
      sql/sql_string.cc:
        Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
        
        Avoid NULL deref in my_charset_same() -- if !to_cs, we won't need to compare
        because it is magic for, "no conversion."
      61718995
  12. 10 Aug, 2006 1 commit
    • unknown's avatar
      Bug#19844: time_format in Union truncates values · fa1641e1
      unknown authored
      time_format() claimed %H and %k would return at most two digits
      (hours 0-23), but this coincided neither with actual behaviour
      nor with docs.  this is not visible in simple queries; forcing
      a temp-table is probably the easiest way to see this.  adjusted
      the return-length appropriately; the alternative would be to
      adjust the docs to say that behaviour for > 99 hours is undefined.
      ---
      Bug#19844: time_format in Union truncates values
      
      time_format() claimed %H and %k would return at most two digits
      (hours 0-23), but this coincided neither with actual behaviour
      nor with docs.  this is not visible in simple queries; forcing
      a temp-table is probably the easiest way to see this.  adjusted
      the return-length appropriately; the alternative would be to
      adjust the docs to say that behaviour for > 99 hours is undefined.
      
      
      mysql-test/r/func_time.result:
        Bug#19844: time_format in Union truncates values
        
        show time_format() handles %H and %k correctly four > 99 hours
      mysql-test/t/func_time.test:
        Bug#19844: time_format in Union truncates values
        
        show time_format() handles %H and %k correctly four > 99 hours
      sql/item_timefunc.cc:
        Bug#19844: time_format in Union truncates values
        
        unbreak promises we make about field-length of %H and %k in
        time_format() so they coincide with the actual range rather
        than just 0..23. the docs say we must operate outside that
        range, so we'd better do it right.
        ---
        Bug#19844: time_format in Union truncates values
        
        unbreak promises we make about field-length of %H and %k in
        time_format() so they coincide with the actual range rather
        than just 0..23. the docs say we must operate outside that
        range, so we'd better do it right.
        One digit values are padded to two digits with %H, "longer"
        values are handled correctly up to seven digits including
        any sign.
        (clarified comments as per jimw's suggestion.)
      fa1641e1
  13. 07 Aug, 2006 1 commit
    • unknown's avatar
      Bug #20987: str_to_date doesn't accept user variable for specification · a7088b3c
      unknown authored
      str_to_date() would sometimes render NULL if %D was used as rule other than last.
      since this was due to two pointers getting mixed up in the server, this behaviour
      seemed somewhat non-deterministic at SQL level.
      
      
      mysql-test/r/func_time.result:
        Bug #20987: str_to_date doesn't accept user variable for specification
        
        show we can do the usual str_to_date() conversions without triggering the bug.
      mysql-test/t/func_time.test:
        Bug #20987: str_to_date doesn't accept user variable for specification
        
        show we can do the usual str_to_date() conversions without triggering the bug.
      sql/item_timefunc.cc:
        Bug #20987: str_to_date doesn't accept user variable for specification
        
        str_to_date() used a wrong pointer in %D conversions which could lead to the
        input being cut off after the token matching %D; if the rule required further
        tokens, the conversion would fail and render NULL.
      a7088b3c
  14. 29 Jul, 2006 1 commit
    • unknown's avatar
      Fix for bug #16226 (timestamp_diff truncation issue when requesting · 32fbc6da
      unknown authored
      difference between timestamp in values of months and quarters.)
      
      Problem:  when requesting timestamp diff in months or quarters, it
      would only examine the date (and not the time) for the comparison.
      
      Solution:  increased precision of comparison.
      
      
      mysql-test/r/func_time.result:
        Additional test results
      mysql-test/t/func_time.test:
        Additional tests
      sql/item_timefunc.cc:
        Fix for timestamp diff issue.  Added microsecond precision when
        comparing months or quarters; previously only examined date for
        these comparisons.
      32fbc6da
  15. 27 Jun, 2006 2 commits
    • unknown's avatar
      Bug#17203: "sql_no_cache sql_cache" in views created from prepared statement · 90cb4c03
      unknown authored
      The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT
      statement from internal structures based on value set later at runtime, not
      the original value set by the user.
      
      The solution is to remember that original value.
      
      
      mysql-test/r/auto_increment.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_compress.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_math.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_system.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_time.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/information_schema.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/query_cache.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/rpl_get_lock.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/rpl_master_pos_wait.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/show_check.result:
        Add result for bug#17203.
      mysql-test/r/subselect.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/type_blob.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/variables.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/view.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/t/show_check.test:
        Add test case for bug#17203.
      sql/sql_lex.cc:
        Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
      sql/sql_lex.h:
        Add SELECT_LEX::sql_cache field to store original user setting.
      sql/sql_select.cc:
        Output SQL_CACHE and SQL_NO_CACHE depending on stored original user setting.
      sql/sql_yacc.yy:
        Make effect of SQL_CACHE and SQL_NO_CACHE mutually exclusive.  Ignore
        SQL_CACHE if SQL_NO_CACHE was used.  Remember what was set by the user.
        Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
      90cb4c03
    • unknown's avatar
      Dec. 31st, 9999 is still a valid date, only starting with Jan 1st 10000 things... · 82d127b5
      unknown authored
      Dec. 31st, 9999 is still a valid date, only starting with Jan 1st 10000 things become invalid (Bug #12356)
      
      
      mysql-test/r/func_sapdb.result:
        test cases for date range edge cases added
      mysql-test/r/func_time.result:
        test cases for date range edge cases added
      mysql-test/t/func_sapdb.test:
        test cases for date range edge cases added
      mysql-test/t/func_time.test:
        test cases for date range edge cases added
      82d127b5
  16. 22 Jun, 2006 1 commit
    • unknown's avatar
      Bug#19408 Test 'func_time' fails on Windows x64 · e8beb72c
      unknown authored
      - The setting of "ENV{'TZ'}" doesn't affect the timezone
        used by MySQL Server on Windows.
      - Explicitly set timezone to "+03:00" in test case before
        doing the calculatiosn to check that there is three hours
        difference between utc and local time.
      (Magnus' fix)
      
      
      mysql-test/r/func_time.result:
        Update test results
      mysql-test/t/func_time.test:
        Set timezone to GMT-3, to make it possible to use "interval 3 hour"
      e8beb72c
  17. 20 Jun, 2006 1 commit
    • unknown's avatar
      func_time.result: · ac2c480f
      unknown authored
        After merge fix
      
      
      mysql-test/r/func_time.result:
        After merge fix
      ac2c480f
  18. 19 Jun, 2006 1 commit
    • unknown's avatar
      Fix for bug #20496: func_time.test failure · 95939476
      unknown authored
      mysql-test/r/func_time.result:
        Fix for bug #20496: func_time.test failure                                      
          - floating point calculations removed.
      mysql-test/t/func_time.test:
        Fix for bug #20496: func_time.test failure                                      
          - floating point calculations removed.
      95939476
  19. 14 Jun, 2006 1 commit
    • unknown's avatar
      Many files: · b2f30816
      unknown authored
        After merge fix
      
      
      mysql-test/r/func_time.result:
        After merge fix
      mysql-test/r/func_concat.result:
        After merge fix
      mysql-test/r/cast.result:
        After merge fix
      sql/item_cmpfunc.h:
        After merge fix
      sql/item_cmpfunc.cc:
        After merge fix
      sql/field.cc:
        After merge fix
      b2f30816
  20. 13 Jun, 2006 1 commit
    • unknown's avatar
      Fixed bug#16377: result of DATE/TIME functions were compared as strings which · 47311e8e
      unknown authored
      can lead to a wrong result.
      
      All date/time functions has the STRING result type thus their results are
      compared as strings. The string date representation allows a user to skip 
      some of leading zeros. This can lead to wrong comparison result if a date/time 
      function result is compared to such a string constant.
      
      The idea behind this bug fix is to compare results of date/time functions
      and data/time constants as ints, because that date/time representation is 
      more exact. To achieve this the agg_cmp_type() is changed to take in the
      account that a date/time field or an date/time item should be compared 
      as ints.
      
      This bug fix is partially back ported from 5.0.
      
      The agg_cmp_type() function now accepts THD as one of parameters. 
      In addition, it now checks if a date/time field/function is present in the
      list. If so, it tries to coerce all constants to INT to make date/time
      comparison return correct result. The field for the constant coercion is
      taken from the Item_field or constructed from the Item_func. In latter case
      the constructed field will be freed after conversion of all constant items.
      Otherwise the result is same as before - aggregated with help of the
      item_cmp_type() function.
      
      From the Item_func_between::fix_length_and_dec() function removed the part
      which was converting date/time constants to int if possible. Now this is 
      done by the agg_cmp_type() function.
      
      The new function result_as_longlong() is added to the Item class. 
      It indicates that the item is a date/time item and result of it can be
      compared as int. Such items are date/time fields/functions.
      
      Correct val_int() methods are implemented for classes Item_date_typecast, 
      Item_func_makedate, Item_time_typecast, Item_datetime_typecast. All these
      classes are derived from Item_str_func and Item_str_func::val_int() converts
      its string value to int without regard to the date/time type of these items.
      
      Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
      functions are changed to substitute result type of an item with the INT_RESULT
      if the item is a date/time item and another item is a constant. This is done
      to get a correct result of comparisons like date_time_function() = string_constant.
      
      
      mysql-test/r/cast.result:
        Fixed wrong test case result after bug fix#16377.
      sql/item_timefunc.h:
        Fixed bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.
        The result_as_longlong() function is set to return TRUE for these classes:
        Item_date, Item_date_func, Item_func_curtime, Item_func_sec_to_time,
        Item_date_typecast, Item_time_typecast, Item_datetime_typecast,
        Item_func_makedate.
      sql/item_timefunc.cc:
        Fixed bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.Correct val_int() methods are implemented for classes Item_date_typecast, 
        Item_func_makedate, Item_time_typecast, Item_datetime_typecast.
      sql/item_cmpfunc.h:
        Fixed bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.
        Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
        functions are changed to substitute result type of an item with the INT_RESULT
        if the item is a date/time item and another item is a constant.
      sql/field.cc:
        Fixed bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.
        Field::set_warning(), Field::set_datetime_warning() now use current_thd to get thd if table isn't set.
      sql/item_cmpfunc.cc:
        Fixed bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.
        The agg_cmp_type() function now accepts THD as one of parameters. 
        In addition, it now checks if a date/time field/function is present in the
        list. If so, it tries to coerce all constants to INT to make date/time
        comparison return correct result. The field for the constant coercion is
        taken from the Item_field or constructed from the Item_func. In latter case
        the constructed field will be freed after conversion of all constant items.
        Otherwise the result is same as before - aggregated with help of the
        item_cmp_type() function.
      sql/item.h:
        The new function result_as_longlong() is added to the Item class. 
        It indicates that the item is a date/time item and result of it can be
        compared as int. Such items are date/time fields/functions.
      mysql-test/t/func_time.test:
        Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.
      mysql-test/r/func_time.result:
        Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
        can lead to a wrong result.
      47311e8e
  21. 17 May, 2006 1 commit
    • unknown's avatar
      Fix for #16327: invalid TIMESTAMP values retrieved · 23006f9b
      unknown authored
      mysql-test/r/func_time.result:
        Fix for #16327: invalid TIMESTAMP values retrieved
          - test result
      mysql-test/t/func_time.test:
        Fix for #16327: invalid TIMESTAMP values retrieved
          - test case
      sql/field.cc:
        Fix for #16327: invalid TIMESTAMP values retrieved
          - let 1969 as well
      23006f9b
  22. 02 May, 2006 1 commit
    • unknown's avatar
      Fix for bug #16546: DATETIME+0 not always coerced the same way · 409fb489
      unknown authored
      mysql-test/r/func_time.result:
        Fix for bug #16546: DATETIME+0 not always coerced the same way
          - test case
      mysql-test/t/func_time.test:
        Fix for bug #16546: DATETIME+0 not always coerced the same way
          - test case
      sql/item_timefunc.cc:
        Fix for bug #16546: DATETIME+0 not always coerced the same way
          - set decimals to DATETIME_DEC
      sql/item_timefunc.h:
        Fix for bug #16546: DATETIME+0 not always coerced the same way
          - set decimals to DATETIME_DEC
      409fb489
  23. 25 Apr, 2006 1 commit
    • unknown's avatar
      Fix for bug #18501: Server crashes with monthname(). · 3ca1852c
      unknown authored
      mysql-test/r/func_time.result:
        Fix for bug #18501: Server crashes with monthname().
          - test case
      mysql-test/t/func_time.test:
        Fix for bug #18501: Server crashes with monthname().
          - test case
      sql/item_timefunc.cc:
        Fix for bug #18501: Server crashes with monthname().
          - check null_value as well.
      3ca1852c
  24. 11 Apr, 2006 1 commit
    • unknown's avatar
      Fixed bug #18618. · 981bbaef
      unknown authored
      If the second or the third argument of a BETWEEN predicate was
      a constant expression, like '2005.09.01' - INTERVAL 6 MONTH,
      while the other two arguments were fields then the predicate 
      was evaluated incorrectly and the query returned a wrong
      result set.
      The bug was introduced in 5.0.17 when in the fix for 12612.
      
      
      mysql-test/r/func_time.result:
        Added a test case for bug #18618.
      mysql-test/t/func_time.test:
        Added a test case for bug #18618.
      981bbaef
  25. 07 Apr, 2006 1 commit
    • unknown's avatar
      fix for wrong QUARTER calculation in EXTRACT() (Bug #18100) · f7b039cc
      unknown authored
      
      mysql-test/r/func_time.result:
        expected test results for bug #18100 added
      mysql-test/t/func_time.test:
        test case for bug #18100 added
      sql/item_timefunc.cc:
        wrong formula for EXTRACT QUARTER, now uses the same calculus as the QUARTER()
        function
      f7b039cc
  26. 13 Oct, 2005 1 commit
  27. 14 Sep, 2005 1 commit
    • unknown's avatar
      Fixed BUG#12963, BUG#13000: wrong VIEW creation with DAYNAME(), · b214671e
      unknown authored
       DAYOFWEEK(), and WEEKDAY().
      
      
      mysql-test/r/func_time.result:
        Fixed new results for testcases containing EXPLAIN EXTENDED SELECT ...
         WEEKDAY ... DAYNAME. The new results are correct and correspond to
         the changes in create_func_weekday() and create_func_dayname().
      mysql-test/r/view.result:
        Fixed some testcases results (bugs #12963, #13000).
      mysql-test/t/view.test:
        Added testcases for for bugs #12963, #13000.
      sql/item_create.cc:
        Fixed bugs #12963, #13000: wrong VIEW creation with DAYNAME(),
         DAYOFWEEK(), and WEEKDAY().
         Modified create_func_dayname(), create_func_dayofweek(), and
         create_func_weekday(). They don´t insert Item_func_to_days
         object now.
      sql/item_timefunc.cc:
        Fixed bugs #12963, #13000: wrong VIEW creation with DAYNAME(),
         DAYOFWEEK(), and WEEKDAY().
         Modified Item_func_weekday::val_int(). The argument of weekday should
         not be considered now to be Item_func_to_days object.
      sql/item_timefunc.h:
        Fixed bugs #12963, 13000: wrong VIEW creation with DAYNAME(),
         DAYOFWEEK(), and WEEKDAY.
         Modified Item_func_weekday::func_name(). It returns now different
         names depending on the odbc_type attribute value.
      b214671e
  28. 24 Aug, 2005 1 commit
    • unknown's avatar
      Make SYSDATE() behave as in Oracle: always the current datetime, not the · da13a76a
      unknown authored
      datetime of when the current statement began. This also makes SYSDATE()
      not safe in replication. (Bug #12562)
      
      
      mysql-test/r/func_time.result:
        Add new results
      mysql-test/t/func_time.test:
        Add tests for new SYSDATE() behavior
      sql/item_timefunc.cc:
        Add Item_func_sysdate_local implementation
      sql/item_timefunc.h:
        Add Item_func_sysdate_local, so SYSDATE() can behave differently
        than NOW().
      sql/lex.h:
        SYSDATE() is no longer an alias for NOW().
      sql/sql_yacc.yy:
        Handle SYSDATE()
      da13a76a
  29. 15 Aug, 2005 1 commit
    • unknown's avatar
      Clean up merge from 4.1 · c78623fa
      unknown authored
      mysql-test/r/func_date_add.result:
        Update results
      mysql-test/r/func_time.result:
        Update results
      server-tools/instance-manager/protocol.cc:
        Fix call to list_rest()
      sql/sp_head.cc:
        sp_change_db() removed, call mysql_change_db() instead.
      c78623fa
  30. 12 Aug, 2005 1 commit
    • unknown's avatar
      Fix bug #12298 Typo in timestampdiff() function name results in erroneous · d32c4314
      unknown authored
      view being created.
      
      Item_func_timestamp_diff::func_name() were returning function name as
      "timestamp_diff" thus when view was executed function parameters wasn't 
      properly recognized and error was raised.
      
      
      mysql-test/r/func_time.result:
        Fix test result after bugfix #12298
      sql/item_timefunc.h:
        Fix bug #12298 Typo in timestampdiff() function name results in wrong view being created.
      mysql-test/t/view.test:
        Test case for bug #12298 Typo in timestampdiff()  function name results in erroneous view being created.
      mysql-test/r/view.result:
        Test case for bug #12298 Typo in timestampdiff() function name results in erroneous view being created.
      d32c4314
  31. 24 Jun, 2005 1 commit
  32. 20 Jun, 2005 1 commit
    • unknown's avatar
      bug#10466: Datatype "timestamp" displays "YYYYMMDDHHMMSS" irrespective of display sizes. · d2b52d19
      unknown authored
       - Print warning that says display width is not supported for datatype TIMESTAMP, if user tries to create a TIMESTAMP column with display width.
       - Use display width for TIMESTAMP only in type_timestamp test to make sure warning is displayed correctly.
      
      
      mysql-test/include/ps_create.inc:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/alias.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/func_date_add.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/func_str.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/func_time.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/group_by.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/innodb.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_1general.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_2myisam.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_3innodb.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_4heap.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_5merge.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_6bdb.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/ps_7ndb.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/select.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/r/type_timestamp.result:
        When display width is used for a TIMESTAMP column a warning is printed that the display width will be ignored.
      mysql-test/r/update.result:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/alias.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/func_date_add.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/func_str.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/func_time.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/group_by.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/innodb.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/ps.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/ps_4heap.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/ps_5merge.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/select.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      mysql-test/t/update.test:
        Reove all uses of display width in for TIMESTAMP columns, except in the type_timestamp test.
      sql/share/errmsg.txt:
        Correct swedish error message
      sql/sql_parse.cc:
        Print warning if datatype is TIMESTAMP and display width is used.
      d2b52d19
  33. 01 Jun, 2005 1 commit
  34. 27 May, 2005 1 commit
    • unknown's avatar
      Fix '%h', '%I', and '%l' format specifiers in TIME_FORMAT() · af8cbbae
      unknown authored
      to handle large time values as documented. (Bug #10590)
      
      
      mysql-test/r/func_time.result:
        Add new results
      mysql-test/t/func_time.test:
        Add new regression test
      sql/item_timefunc.cc:
        Fix handling of '%h', '%I', and '%l' format specifiers
        for TIME_FORMAT() to handle large time values correctly.
      af8cbbae
  35. 04 Apr, 2005 1 commit
    • unknown's avatar
      Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly · ce169a54
      unknown authored
      Fix that mysql.proc works with new VARCHAR fields
      Give warnings for wrong zero dates
      
      
      configure.in:
        Don't use -lsupc++ with gcc 3.3 and below as this gives linking problems when linking staticly
      mysql-test/r/func_time.result:
        New warnings
      mysql-test/r/row.result:
        Moved code around to get things to work with --ps-protocol
        Note that one on warning disappered, but it should appear again when bug #9600 is fixed
      mysql-test/r/strict.result:
        enabled more tests
        Added more tests
      mysql-test/r/union.result:
        Test that UNION generates correct row format
      mysql-test/t/row.test:
        Moved test to get things to work with --ps-protocol
      mysql-test/t/strict.test:
        enabled more tests
        Added more tests
      mysql-test/t/union.test:
        Test that UNION generates correct row format
      sql/item.cc:
        Removed compiler warning
        Simple cleanup
      sql/sp.cc:
        Fix that mysql.proc works with new VARCHAR fields
      sql/time.cc:
        Give warnings for wrong zero dates
      tests/mysql_client_test.c:
        More startup information
      ce169a54
  36. 30 Dec, 2004 1 commit
    • unknown's avatar
      Fix for bug #7515 "from_unixtime(0) now returns NULL instead of · 1ffd688a
      unknown authored
      the Epoch". (With after review fixes).
      
      
      mysql-test/r/func_time.result:
        Added test for bug #7515 "from_unixtime(0) now returns NULL instead of
        the Epoch".
      mysql-test/t/func_time.test:
        Added test for bug #7515 "from_unixtime(0) now returns NULL instead of
        the Epoch".
      sql/item_timefunc.cc:
        Item_func_from_unixtime:
         from_unixtime(0) should return Epoch instead of NULL.
      sql/item_timefunc.h:
        Item_func_from_unixtime:
         - Removed unused method definition.
         - fix_length_and_dec() should set maybe_null to true since now
           from_unixtime() can return NULL even in case when none of its
           arguments is NULL.
      1ffd688a
  37. 10 Dec, 2004 1 commit
    • unknown's avatar
      Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges · c7d7c9ca
      unknown authored
      mysqldump skips information_schema db
      'use' now can use information_schema db
      changed value of column 'Null' to 'NO' if column is not nullable
      
      
      client/mysqldump.c:
        mysqldump skips information_schema db
      mysql-test/r/alter_table.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/create.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/ctype_collate.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/ctype_recoding.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/ctype_ujis.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/drop.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/func_sapdb.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/func_time.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/gis.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/information_schema.result:
        Added couple of tests
      mysql-test/r/information_schema_inno.result:
        Removed coulmn 'CONTRAINT_METOD' from TABLE_CONSTRAINTS
        Added column 'POSITION_IN_UNIQUE_CONSTRAINT' to KEY_COLUMN_USAGE
      mysql-test/r/innodb.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/ndb_autodiscover.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/ps_1general.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/rpl000009.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/rpl_create_database.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/schema.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/select.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/show_check.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/sp.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/type_enum.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/r/type_ranges.result:
        changed value of column 'Null' to 'NO' if column is not nullable
      mysql-test/t/information_schema.test:
        Added couple of tests
      sql/sql_acl.cc:
        Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges
      sql/sql_db.cc:
        'use' now can use information_schema db
      sql/sql_show.cc:
        code cleanup
        informaton_schema(IS) db now contains data about IS itself
      sql/sql_yacc.yy:
        A fix(wrong behavour of 'SHOW COLUMNS, SHOW KEYS' with 'where condition')
      c7d7c9ca
  38. 15 Nov, 2004 1 commit
    • unknown's avatar
      Proposed fix for bug #6439 "from_unixtime() function returns wrong datetime · e1509cf7
      unknown authored
      values for too big argument".
      
      Added range checking for from_unixtime() argument, cleaned up code 
      a bit.
      
      
      mysql-test/r/func_time.result:
        Test for bug #6439 "from_unixtime() function returns wrong datetime 
        values for too big argument".
      mysql-test/t/func_time.test:
        Test for bug #6439 "from_unixtime() function returns wrong datetime 
        values for too big argument".
      sql/item_timefunc.cc:
        Item_func_from_unixtime: 
          Added error range checking for function argument + small code clean up.
      e1509cf7