summaryrefslogtreecommitdiff
path: root/sql/sql_time.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.2 into 10.3Marko Mäkelä2020-07-311-4/+7
|\
| * MDEV-18042 Server crashes upon adding a non-null date column under ↵Nikita Malyavin2020-07-311-3/+6
| | | | | | | | | | | | NO_ZERO_DATE with ALGORITHM=INPLACE accept table_name and db_name instead of table_share in make_truncated_value_warning
* | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
|\ \ | |/
| * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| |\
| | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | |\
| | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | * Update wrong zip-code
| | | * MDEV-10524 Assertion `arg1_int >= 0' failed in ↵Alexander Barkov2016-12-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_func_additive_op::result_precision() This change is a backport from 10.0 to 5.5 for: 1. The full patch for: MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD() 9adb6e991ec87b65d04929f115d9d0c899e4ab19 2. A small fragment of: MDEV-5298 Illegal mix of collations on timestamp 03f6778d61a74bdd7d09103a16473a2a5624cf66 which overrides Item_temporal_hybrid_func::cmp_type(), and adds a new line into cache_temporal_4265.result.
* | | | Merge 10.2 into 10.3Marko Mäkelä2018-12-181-7/+8
|\ \ \ \ | |/ / /
| * | | MDEV-14576 Include full name of object in message about incorrect value for ↵Alexey Botchkov2018-12-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | column. The error message modified. Then the TABLE_SHARE::error_table_name() implementation taken from 10.3, to be used as a name of the table in this message.
* | | | helper append_interval(String*)Sergei Golubchik2018-02-231-1/+3
| | | |
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-02-151-0/+4
|\ \ \ \
| * | | | MDEV-15310 Range optimizer does not work well for "WHERE temporal_column NOT ↵Alexander Barkov2018-02-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IN (const_list)" There were two problems related to the bug report: 1. Item_datetime::get_date() was not implemented. So execution went through val_int() followed by int-to-datetime or int-to-time conversion. This was the reason why the optimizer did not work well on data with fractional seconds. 2. Item_datetime::set() did not have a TIME specific code to mix months and days to hours after unpack_time(). This is why the optimizer did not work well with negative TIME values, as well as huge time values. Changes: 1. Overriding Item_datetime::get_date(), to return ltime. This fixes the problem N1. 2. Cleanup: Moving pack_time() and unpack_time() from sql-common/my_time.c and include/my_time.h to sql/sql_time.cc and sql/sql_time.h, as they are not needed on the client side. 3. Adding a new "enum_mysql_timestamp_type ts_type" parameter to unpack_time() and moving the TIME specific code to mix months and days with hours inside unpack_time(). Adding a new "ts_type" parameter to Item_datetime::set(), to pass it from the caller down to unpack_time(). So now the TIME specific code is automatically called from Item_datetime::set(). This fixes the problem N2. This change also helped to get rid of duplicate TIME specific code from other three places, where mixing month/days to hours was done immediately after unpack_time(). Moving the DATE specific code to zero hhmmssff from Item_func_min_max::get_date_native to inside unpack_time(), for symmetry. 4. Removing the virtual method in_vector::result_type(), adding in_vector::type_handler() instead. This helps to get result_type(), field_type(), mysql_timestamp_type() of an in_vector easier. Passing type_handler()->mysql_timestamp_type() as a new parameter to Item_datetime::set() inside in_temporal::value_to_item(). 5. Cleaup: Removing separate implementations of in_datetime::get_value() and in_time::get_value(). Adding a single implementation in_temporal::get_value() instead. Passing type_handler()->field_type() to get_value_internal().
* | | | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'size_t' to 'type', possible loss of data) Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
* | | | | System Versioning pre0.12Aleksey Midenkov2017-11-071-0/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
| * | | | | IB: 0.2 part IVAleksey Midenkov2017-05-051-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * BEGIN_TS(), COMMIT_TS() SQL functions; * VTQ instead of packed stores secs + usecs like my_timestamp_to_binary() does; * versioned SELECT to IB is translated with COMMIT_TS(); * SQL fixes: - FOR_SYSTEM_TIME_UNSPECIFIED condition compares to TIMESTAMP_MAX_VALUE; - segfault fix #36: multiple execute of prepared stmt; - different tables to same stored procedure fix (#39) * Fixes of previous parts: ON DUPLICATE KEY, other misc fixes.
| * | | | | IB: 0.2 part IIAleksey Midenkov2017-05-051-0/+10
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * moved vers_notify_vtq() to commit phase; * low_level insert (load test passed); * rest of SYS_VTQ columns filled: COMMIT_TS, CONCURR_TRX; * savepoints support; * I_S.INNODB_SYS_VTQ adjustments: - limit to I_S_SYS_VTQ_LIMIT(10000) of most recent records; - CONCURR_TRX limit to I_S_MAX_CONCURR_TRX(100) with '...' truncation marker; - TIMESTAMP fields show fractions of seconds.
* | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-1/+1
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-10-021-1/+1
| |\ \ \ \ | | | |/ / | | |/| |
| | * | | MDEV-13384 - misc Windows warnings fixedVladislav Vaintroub2017-09-281-1/+1
| | |/ /
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-09-251-1/+1
|\ \ \ \ | |/ / /
| * | | Fixing a few -Wconversion warningsAlexander Barkov2017-09-231-1/+1
| | | |
* | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | Merge branch '10.0' into 10.1Sergei Golubchik2016-02-231-1/+2
|\ \
| * \ Merge branch '5.5' into 10.0Sergei Golubchik2016-02-151-1/+2
| |\ \ | | |/
| | * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2016-02-091-1/+2
| | |\ | | | | | | | | | | | | | | | | reverted about half of commits as either not applicable or outright wrong
| | | * Bug #21564557: INCONSISTENT OUTPUT FROM 5.5 AND 5.6Sreeharsha Ramanavarapu2015-12-311-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%M" Issue: ----- When an invalid date is supplied to the UNIX_TIMESTAMP function from STR_TO_DATE, no check is performed before converting it to a timestamp value. SOLUTION: --------- Add the check_date function and only if it succeeds, proceed to the timestamp conversion. No warning will be returned for dates having zero in month/date, since partial dates are allowed. UNIX_TIMESTAMP will return only a zero for such values. The problem has been handled in 5.6+ with WL#946.
| | | * Updated/added copyright headersKent Boortz2011-06-301-1/+1
| | | |
| | | * WL#5030: Split and remove mysql_priv.hMats Kindahl2010-03-311-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND ↵Alexander Barkov2015-09-081-0/+61
| | | | | | | | | | | | time_column=TIMESTAMP'2001-01-01 10:20:31'
* | | MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME.Alexander Barkov2015-07-081-2/+13
|/ / | | | | | | | | | | In some cases NO_ZERO_DATE did not allow datetime values with zero date part and non-zero time part (e.g. '0000-00-00 10:20:30.123456'). Allowing values of this kind in all known pieces of the code.
* | MDEV-6065 MySQL Bug#13623473 "MISSING ROWS ON SELECT AND JOIN WITH ↵Sergei Golubchik2014-06-111-0/+1
| | | | | | | | | | | | TIME/DATETIME COMPARE" fix for ref like "indexed_time = datetime"
* | 5.5.38 mergeSergei Golubchik2014-06-061-1/+1
|\ \ | |/
| * Merge 5.3->5.5Alexander Barkov2014-06-041-1/+1
| |
* | 5.5 mergeSergei Golubchik2014-05-091-0/+3
|\ \ | |/
| * Merge from 5.3Alexander Barkov2014-04-181-0/+3
| |
* | MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with MySQL-5.6 (and ↵Alexander Barkov2014-03-071-2/+29
| | | | | | | | the SQL Standard)
* | 10.0-base mergeSergei Golubchik2014-02-031-0/+1
|\ \ | |/
| * Merge 5.3 -> 5.5Alexander Barkov2014-01-271-1/+2
| |
* | 10.0-base mergeSergei Golubchik2013-12-161-0/+1
|\ \ | |/
| * Merge 5.3->5.5Alexander Barkov2013-12-021-0/+1
| | | | | | | | | | | | pending merges: Alexander Barkov 2013-12-02 MDEV-4857 Wrong result of HOUR('1 00:00:00')
| * Merge from 5.3Alexander Barkov2013-06-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modified: mysql-test/r/type_date.result mysql-test/r/type_datetime.result mysql-test/r/type_time.result mysql-test/t/type_date.test mysql-test/t/type_datetime.test mysql-test/t/type_time.test sql/item_func.cc sql/item_timefunc.cc sql/sql_time.cc sql/sql_time.h pending merges: Alexander Barkov 2013-06-28 MDEV-4634 Crash in CONVERT_TZ
| * Merging MDEV-4635 from 5.3.Alexander Barkov2013-06-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, fixing a bug in STR_TO_DATE(). It erroneously returned error in strict mode for dates like '0000-01-01' (zero year, but non-zero month and day). According to the manual: - NO_ZERO_DATE disallows 0000-00-00 (all date parts are zeros) - NO_ZERO_IN_DATE disallows zero month (YYYY-00-DD) or day (YYYY-MM-00). 0000-01-01 is a valid date, even in strict mode. modified: mysql-test/r/func_time.result mysql-test/r/strict.result mysql-test/t/func_time.test mysql-test/t/strict.test sql/item_timefunc.cc sql/sql_time.h pending merges: Alexander Barkov 2013-06-17 MDEV-4635 Crash in UNIX_TIMESTAMP(STR_TO_DAT...
* | MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD()Alexander Barkov2013-08-221-0/+2
| |
* | 10.0-monty mergeSergei Golubchik2013-07-211-3/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | includes: * remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING" * introduce LOCK_share, now LOCK_ha_data is strictly for engines * rea_create_table() always creates .par file (even in "frm-only" mode) * fix a 5.6 bug, temp file leak on dummy ALTER TABLE
| * | Applied all changes from Igor and SanjaMichael Widenius2013-06-151-3/+4
| |/
* | Adding support for the SQL-standard temporal literals.Alexander Barkov2013-07-101-11/+25
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | added: mysql-test/r/temporal_literal.result mysql-test/t/temporal_literal.test modified: client/mysqlbinlog.cc include/my_time.h mysql-test/r/cast.result mysql-test/r/partition_innodb.result mysql-test/t/cast.test mysql-test/t/partition_innodb.test sql-common/my_time.c sql/field.cc sql/item.cc sql/item.h sql/item_cmpfunc.cc sql/item_create.cc sql/item_create.h sql/item_strfunc.cc sql/item_timefunc.cc sql/item_timefunc.h sql/sql_select.cc sql/sql_time.cc sql/sql_time.h sql/sql_yacc.yy storage/spider/spd_db_mysql.cc
* 5.3 mergeSergei Golubchik2012-08-311-1/+1
|
* mergeSergei Golubchik2011-11-031-7/+7
|\
| * compilation warnings on WindowsSergei Golubchik2011-11-021-7/+7
| |