summaryrefslogtreecommitdiff
path: root/mysql-test/main/func_time.result
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/10.4' into 10.5Alexander Barkov2022-09-141-10/+10
|\
| * Merge 10.3 into 10.4Marko Mäkelä2022-09-131-10/+10
| |\
| | * MDEV-29446 Change SHOW CREATE TABLE to display default collationAlexander Barkov2022-09-121-9/+9
| | |
| | * MDEV-21445 Strange/inconsistent behavior of IN condition when mixing numbers ↵Alexander Barkov2022-07-061-1/+1
| | | | | | | | | | | | and strings
* | | Merge branch '10.4' into 10.5Sergei Golubchik2022-05-091-0/+6
|\ \ \ | |/ /
| * | Merge branch '10.3' into 10.4Sergei Golubchik2022-05-081-0/+6
| |\ \ | | |/
| | * Merge branch '10.2' into 10.3Oleksandr Byelkin2022-05-031-0/+6
| | |
* | | MDEV-20305 Data loss on DOUBLE and DECIMAL conversion to INTAlexander Barkov2020-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bit operators (~ ^ | & << >>) and the function BIT_COUNT() always called val_int() for their arguments. It worked correctly only for INT type arguments. In case of DECIMAL and DOUBLE arguments it did not work well: the argument values were truncated to the maximum SIGNED BIGINT value of 9223372036854775807. Fixing the code as follows: - If the argument if of an integer data type, it works using val_int() as before. - If the argument if of some other data type, it gets the argument value using val_decimal(), to avoid truncation, and then converts the result to ulonglong. Using Item_handled_func to switch between the two approaches easier. As an additional advantage, with Item_handled_func it will be easier to implement overloading in the future, so data type plugings will be able to define their own behavioir of bit operators and BIT_COUNT(). Moving the code from the former val_int() implementations as methods to Longlong_null, to avoid code duplication in the INT and DECIMAL branches.
* | | MDEV-18650: Options deprecated in previous versions - storage_engineVicențiu Ciorbaru2020-02-131-2/+2
| | | | | | | | | | | | | | | | | | | | | Remove usage of deprecated variable storage_engine. It was deprecated in 5.5 but it never issued a deprecation warning. Make it issue a warning in 10.5.1. Replaced with default_storage_engine.
* | | Merge 10.4 into 10.5Marko Mäkelä2019-12-271-1/+16
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2019-12-271-1/+16
| |\ \ | | |/
| | * Merge 10.2 into 10.3Marko Mäkelä2019-12-271-1/+16
| | |
* | | Merge 10.4 into 10.5Marko Mäkelä2019-09-251-1/+1
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2019-09-251-1/+1
| |\ \ | | |/
| | * Merge remote-tracking branch 'origin/10.2' into 10.3Alexander Barkov2019-09-241-1/+1
| | |
* | | Merge 10.4 into 10.5Marko Mäkelä2019-09-061-2/+2
|\ \ \ | |/ /
| * | MDEV-20397 Support TIMESTAMP, DATETIME, TIME in ROUND() and TRUNCATE()Alexander Barkov2019-08-221-2/+2
| | |
* | | MDEV-19923 Add type handlers for geometry sub-typesAlexander Barkov2019-07-031-3/+3
|/ /
* | MDEV-19774 Assertion `sec.se c() <= 0x7FFFFFFFL' failed in ↵Alexander Barkov2019-06-201-0/+6
| | | | | | | | Item_func_from_unixtime::get_date
* | MDEV-18402 Assertion `sec.sec() <= 59' failed in Item_func_maketime::get_dateAlexander Barkov2019-04-021-0/+9
| |
* | Merge 10.3 into 10.4Marko Mäkelä2019-03-201-0/+30
|\ \ | |/ | | | | | | | | | | | | | | | | The MDEV-17262 commit 26432e49d37a37d09b862bb49a021e44bdf4789c was skipped. In Galera 4, the implementation would seem to require changes to the streaming replication. In the tests archive.rnd_pos main.profiling, disable_ps_protocol for SHOW STATUS and SHOW PROFILE commands until MDEV-18974 has been fixed.
| * Merge branch '10.2' into 10.3Sergei Golubchik2019-03-171-0/+30
| |
* | Making the test for MDEV-17854 independent from the host time zoneAlexander Barkov2018-11-281-1/+3
| |
* | MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on ↵Alexander Barkov2018-11-281-0/+9
| | | | | | | | SELECT with NULLIF and FROM_UNIXTIME on incorrect time
* | Merge 10.3 into 10.4Marko Mäkelä2018-11-191-1/+57
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2018-11-191-1/+58
| |
* | MDEV-17740 Extend EXTRACT(x AS DAY*) to understand long time intervalsAlexander Barkov2018-11-171-6/+2
| |
* | MDEV-17563 Different results using table or view when comparing values of ↵Alexander Barkov2018-11-081-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | time type MDEV-17625 Different warnings when comparing a garbage to DATETIME vs TIME - Splitting processes of data type conversion (to TIME/DATE,DATETIME) and warning generation. Warning are now only get collected during conversion (in an "int" variable), and are pushed in the very end of conversion (not in parallel). Warnings generated by the low level routines str_to_xxx() and number_to_xxx() can now be changed at the end, when TIME_FUZZY_DATES is applied, from "Invalid value" to "Truncated invalid value". Now "Illegal value" is issued only when the low level routine returned an error and TIME_FUZZY_DATES was not set. Otherwise, if the low level routine returned "false" (success), or if NULL was converted to a zero datetime by TIME_FUZZY_DATES, then "Truncated illegal value" is issued. This gives better warnings. - Methods Type_handler::Item_get_date() and Type_handler::Item_func_hybrid_field_type_get_date() now only convert and collect warning information, but do not push warnings. - Changing the return data type for Type_handler::Item_get_date() and Type_handler::Item_func_hybrid_field_type_get_date() from "bool" to "void". The conversion result (success vs error) can be checked by testing ltime->time_type. MYSQL_TIME_{NONE|ERROR} mean mean error, other values mean success. - Adding new wrapper methods Type_handler::Item_get_date_with_warn() and Type_handler::Item_func_hybrid_field_type_get_date_with_warn() to do conversion followed by raising warnings, and changing the code to call new Type_handler::***_with_warn() methods. - Adding a helper class Temporal::Status, a wrapper for MYSQL_TIME_STATUS with automatic initialization. - Adding a helper class Temporal::Warn, to collect warnings but without actually raising them. Moving a part of ErrConv into a separate class ErrBuff, and deriving both Temporal::Warn and ErrConv from ErrBuff. The ErrBuff part of Temporal::Warn is used to collect textual representation of the input data. - Adding a helper class Temporal::Warn_push. It's used to collect warning information during conversion, and automatically pushes warnings to the diagnostics area on its destructor time (in case of non-zero warning). - Moving more code from various functions inside class Temporal. - Adding more Temporal_hybrid constructors and protected Temporal methods make_from_xxx(), which convert and only collect warning information, but do not actually raise warnings. - Now the low level functions str_to_datetime() and str_to_time() always set status->warning if the return value is "true" (error). - Now the low level functions number_to_time() and number_to_datetime() set the "*was_cut" argument if the return value is "true" (error). - Adding a few DBUG_ASSERTs to make sure that str_to_xxx() and number_to_xxx() always set warnings on error. - Adding new warning flags MYSQL_TIME_WARN_EDOM and MYSQL_TIME_WARN_ZERO_DATE for the code symmetry. Before this change there was a special code path for (rc==true && was_cut==0) which was treated by Field_temporal::store_invalid_with_warning as "zero date violation". Now was_cut==0 always means that there are no any error/warnings/notes to be raised, not matter what rc is. - Using new Temporal_hybrid constructors in combination with Temporal::Warn_push inside str_to_datetime_with_warn(), double_to_datetime_with_warn(), int_to_datetime_with_warn(), Field::get_date(), Item::get_date_from_string(), and a few other places. - Removing methods Dec_ptr::to_datetime_with_warn(), Year::to_time_with_warn(), my_decimal::to_datetime_with_warn(), Dec_ptr::to_datetime_with_warn(). Fixing Sec6::to_time() and Sec6::to_datetime() to convert and only collect warnings, without raising warnings. Now warning raising functionality resides in Temporal::Warn_push. - Adding classes Longlong_hybrid_null and Double_null, to return both value and the "IS NULL" flag. Adding methods Item::to_double_null(), to_longlong_hybrid_null(), Item_func_hybrid_field_type::to_longlong_hybrid_null_op(), Item_func_hybrid_field_type::to_double_null_op(). Removing separate classes VInt and VInt_op, as they have been replaced by a single class Longlong_hybrid_null. - Adding a helper method Temporal::type_name_by_timestamp_type(), moving a part of make_truncated_value_warning() into it, and reusing in Temporal::Warn::push_conversion_warnings(). - Removing Item::make_zero_date() and Item_func_hybrid_field_type::make_zero_mysql_time(). They provided duplicate functionality. Now this code resides in Temporal::make_fuzzy_date(). The latter is now called for all Item types when data type conversion (to DATE/TIME/DATETIME) is involved, including Item_field and Item_direct_view_ref. This fixes MDEV-17563: Item_direct_view_ref now correctly converts NULL to a zero date when TIME_FUZZY_DATES says so.
* | MDEV-17477 Wrong result for TIME('-2001-01-01 10:20:30') and numerous other ↵Alexander Barkov2018-10-201-0/+98
| | | | | | | | | | | | str-to-time conversion problems MDEV-17478 Wrong result for TIME('+100:20:30')
* | Fixing "mtr --ps func_time" failures in the tests added for MDEV-17351Alexander Barkov2018-10-181-18/+8
| | | | | | | | | | | | It seems mysqltest does not print warnings raised at mysql_prepare() time. Suppressing such --ps dependent warnings.
* | MDEV-17434 EXTRACT(DAY FROM negative_time) returns wrong resultAlexander Barkov2018-10-151-6/+48
| |
* | MDEV-17400 The result of TIME('42949672965959-01') depends on architectureAlexander Barkov2018-10-091-0/+15
| | | | | | | | | | | | | | | | - Fixing portabibily problems in sql-common/my_time.c (and additionally in sql/sql_time.cc) - Re-enabling func_time.test Now all new chunks added in MDEV-17351 work fine on all platforms.
* | MDEV-17351 Wrong results for GREATEST,TIMESTAMP,ADDTIME with an out-of-range ↵Alexander Barkov2018-10-081-1/+2321
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TIME-alike argument Problems: Functions LEAST() and GREATEST() in TIME context, as well as functions TIMESTAMP(a,b) and ADDTIME(a,b), returned confusing results when the input TIME-alike value in a number or in a string was out of the TIME supported range. In case of TIMESTAMP(a,b) and ADDTIME(a,b), the second argument value could get extra unexpected digits. For example, in: ADDTIME('2001-01-01 00:00:00', 10000000) or ADDTIME('2001-01-01 00:00:00', '1000:00:00') the second argument was converted to '838:59:59.999999' with six fractional digits, which contradicted "decimals" previously set to 0 in fix_length_and_dec(). These unexpected fractional digits led to confusing function results. Changes: 1. GREATEST(), LEAST() - fixing Item_func_min_max::get_time_native() to respect "decimals" set by fix_length_and_dec(). If a value of some numeric or string time-alike argument goes outside of the TIME range and gets limited to '838:59:59.999999', it's now right-truncated to the correct fractional precision. - fixing, Type_handler_temporal_result::Item_func_min_max_fix_attributes() to take into account arguments' time_precision() or datetime_precision(), rather than rely on "decimals" calculated by the generic implementation in Type_handler::Item_func_min_max_fix_attributes(). This makes GREATEST() and LEAST() return better data types, with the same fractional precision with what TIMESTAMP(a,b) and ADDTIME(a,b) return for the same arguments, and with DATE(a) and TIMESTAMP(a). 2. Item_func_add_time and Item_func_timestamp It was semantically wrong to apply the limit of the TIME data type to the argument "b", which plays the role of "INTERVAL DAY TO SECOND" here. Changing the code to fetch the argument "b" as INTERVAL rather than as TIME. The low level routine calc_time_diff() now gets the interval value without limiting to '838:59:59.999999', so in these examples: ADDTIME('2001-01-01 00:00:00', 10000000) ADDTIME('2001-01-01 00:00:00', '1000:00:00') calc_time_diff() gets '1000:00:00' as is. The SQL function result now gets limited to the supported result data type range (datetime or time) inside calc_time_diff(), which now calculates the return value using the real fractional digits that came directly from the arguments (without the effect of limiting to the TIME range), so the result does not have any unexpected fractional digits any more. Detailed changes in TIMESTAMP() and ADDTIME(): - Adding a new class Interval_DDhhmmssff. It's similar to Time, but: * does not try to parse datetime format, as it's not needed for functions TIMESTAMP() and ADDTIME(). * does not cut values to '838:59:59.999999' The maximum supported Interval_DDhhmmssff's hard limit is 'UINT_MAX32:59:59.999999'. The maximum used soft limit is: - '87649415:59:59.999999' (in 'hh:mm:ss.ff' format) - '3652058 23:59:59.999999' (in 'DD hh:mm:ss.ff' format) which is a difference between: - TIMESTAMP'0001-01-01 00:00:00' and - TIMESTAMP'9999-12-31 23:59:59.999999' (the minimum datetime that supports arithmetic, and the maximum possible datetime value). - Fixing get_date() methods in the classes related to functions ADDTIME(a,b) and TIMESTAMP(a,b) to use the new class Interval_DDhhmmssff for fetching data from the second argument, instead of get_date(). - Fixing fix_length_and_dec() methods in the classes related to functions ADDTIME(a,b) and TIMESTAMP(a,b) to use Interval_DDhhmmssff::fsp(item) instead of item->time_precision() to get the fractional precision of the second argument correctly. - Splitting the low level function str_to_time() into smaller pieces to reuse the code. Adding a new function str_to_DDhhmmssff(), to parse "INTERVAL DAY TO SECOND" values. After these changes, functions TIMESTAMP() and ADDTIME() return much more predictable results, in terms of fractional digits, and in terms of the overall result. The full ranges of DATETIME and TIME values are now covered by TIMESTAMP() and ADDTIME(), so the following can now be calculated: SELECT ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59.999999'); -> '9999-12-31 23:59:59.999999' SELECT TIMESTAMP(DATE'0001-01-01', '87649415:59:59.999999') -> '9999-12-31 23:59:59.999999' SELECT ADDTIME(TIME'-838:59:59.999999', '1677:59:59.999998'); -> '838:59:59.999999'
* | Merge 10.3 into 10.4Marko Mäkelä2018-10-051-0/+158
|\ \ | |/
| * Merge branch '10.2' into 10.3Sergei Golubchik2018-09-281-0/+158
| |
* | MDEV-15406 NO_ZERO_IN_DATE erroneously affects how CAST(AS DATE) warns about ↵Alexander Barkov2018-09-271-1/+1
| | | | | | | | fractional digit truncation
* | Merge 10.3 into 10.4Marko Mäkelä2018-09-111-0/+6
|\ \ | |/
| * Fixed func_time.test that was depending on current timeMonty2018-09-021-0/+1
| |
| * Merge 10.2 into 10.3Marko Mäkelä2018-08-281-0/+5
| |
* | Merge 10.3 into 10.4Marko Mäkelä2018-08-161-0/+32
|\ \ | |/
| * MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME)Alexander Barkov2018-08-031-0/+9
| | | | | | | | | | This problem was earlier fixed by the patch for MDEV-15340. Adding tests only.
| * MDEV-16878 Functions ADDTIME and SUBTIME get wrongly removed from WHERE by ↵Alexander Barkov2018-08-021-0/+22
| | | | | | | | the equal expression optimizer
* | MDEV-14032 SEC_TO_TIME executes side effect two timesAlexander Barkov2018-08-091-13/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adding a helper class Sec6 to store (neg,seconds,microseconds) - Adding a helper class VSec6 (Sec6 with a flag for "IS NULL") - Wrapping related functions as methods of Sec6; * number_to_datetime() * number_to_time() * my_decimal2seconds() * Item::get_seconds() * A big piece of code in Item_func_sec_to_time::get_date() - Using the new classes in places where second-to-temporal conversion takes place: * Field_timestamp::store(double) * Field_timestamp::store(longlong) * Field_timestamp_with_dec::store_decimal(my_decimal) * Field_temporal_with_date::store(double) * Field_temporal_with_date::store(longlong) * Field_time::store(double) * Field_time::store(longlong) * Field_time::store_decimal(my_decimal) * Field_temporal_with_date::store_decimal(my_decimal) * get_interval_value() * Item_func_sec_to_time::get_date() * Item_func_from_unixtime::get_date() * Item_func_maketime::get_date() This change simplifies these methods and functions a lot. - Warnings are now sent at VSec6 initialization time, when the source data is available in its original data type representation. If Sec6::to_time() or Sec6::to_datetime() truncate data again during conversion to MYSQL_TIME, they send warnings, but only if no warnings were sent during VSec6 initialization. This helps prevents double warnings. The call for val_str() in Item_func_sec_to_time::get_date() is not needed any more, so it's removed. This change actually fixes the problem. As a good effect, FROM_UNIXTIME() and MAKETIME() now also send warnings in case if the seconds arguments is out of range. Previously these functions returned NULL silently. - Splitting the code in the global function make_truncated_value_warning() into a number of methods THD::raise_warning_xxxx(). This was needed to reuse the logic that chooses between: * ER_TRUNCATED_WRONG_VALUE * ER_WRONG_VALUE * ER_TRUNCATED_WRONG_VALUE_FOR_FIELD for non-temporal data types (Sec6). - Removing: * Item::get_seconds() * number_to_time_with_warn() as this code now resides inside methods of Sec6. - Cleanup (changes that are not directly related to the fix): * Removing calls for field_name_or_null() and passing NULL instead in Item_func_hybrid_field_type::get_date_from_{int|real}_op, because Item_func_hybrid_field_type::field_name_or_null() always returns NULL * Replacing a number of calls for make_truncated_value_warning() to calls for THD::raise_warning_xxx(). In these places we know that the execution went through a certain branch of make_truncated_value_warning(), (e.g. the exact error code is known, or field name is always NULL, or field name is always not-NULL). So calls for the entire make_truncated_value_warning() after splitting are not necessary.
* | MDEV-16874 Implement class Item_handled_funcAlexander Barkov2018-08-011-1/+0
| |
* | MDEV-16852 Get rid of Item_temporal_hybrid_func::fix_temporal_type()Alexander Barkov2018-07-301-1/+1
| | | | | | | | | | | | - Implementing the task according to the MDEV description. - Adding a helper class Sec6_add to share the code in type-specific branches in Item_func_add_time::get_date().
* | MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operationsOleksandr Byelkin2018-07-041-0/+8
|/
* MDEV-13727 top-level query timestamp reset at stored func/trigger internal ↵Andrei Elkin2018-05-251-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | statements Being executed under slow_log is ON the test revealed a "side-effect" in MDEV-8305 implementation which inadvertently made the trigger or stored function statements to reset the top-level query's THD::start_time et al. (Details of the test failure analysis are footnoted). Unlike the SP case the SF and Trigger's internal statement should not do that. Fixed with revising the MDEV-8305 decision to backup/reset/restore the session timestamp inside sp_instr_stmt::execute(). The timestamp actually remains reset in the SP case by its caller per statement basis by ever existing logics. Timestamps related tests are extended to cover the trigger and stored function case. Note, commit 3395ab73244 is reverted as its struct QUERY_START_TIME_INFO declaration is not in use anymore after this patch. Footnote: -------- Specifically to the failing test, a query on the master was logged okay with a timestamp of the query's top-level statement but its post update trigger managed to compute one more (later) timestamp which got inserted into another table. The latter table master-vs-slave no fractional part timestamp discrepancy became evident thanks to different execution time of the trigger combined with the fact of the logged with micro-second fractional part master timestamp was truncated on the slave. On master when the fractional part was close to 1 the trigger execution added up its own latency to overflow to next second value. That's how the master timestamp surprisingly turned out to bigger than the slave's one.
* MDEV-16152 Expressions with INTERVAL return bad results in some casesAlexander Barkov2018-05-141-0/+27
|
* Create 'main' test directory and move 't' and 'r' thereMichael Widenius2018-03-291-0/+3486