summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | Merge with MariaDB 5.1Michael Widenius2011-05-031-3/+7
| |\ \ \ \ \ \ \ \ | | |/ / / / / / / | |/| | / / / / / | | | |/ / / / / | | |/| | | | |
| | * | | | | | Merge with MySQL 5.1.57/58Michael Widenius2011-05-021-3/+7
| | |\ \ \ \ \ \ | | | | |_|_|/ / | | | |/| | | | | | | | | | | | Moved some BSD string functions from Unireg
| * | | | | | | Merge with 5.1 to get in changes from MySQL 5.1.55Michael Widenius2011-02-281-1/+94
| |\ \ \ \ \ \ \ | | |/ / / / / /
| * | | | | | | merge with 5.1Michael Widenius2010-11-301-1/+0
| |\ \ \ \ \ \ \
* | \ \ \ \ \ \ \ 5.5-mergeSergei Golubchik2011-07-021-9/+134
|\ \ \ \ \ \ \ \ \ | | |_|_|_|_|_|_|/ | |/| | | | | | |
| * | | | | | | | mergeMattias Jonsson2011-06-131-0/+2
| |\ \ \ \ \ \ \ \
| | * | | | | | | | Bug#11746819:Mattias Jonsson2011-03-161-0/+2
| | | |_|_|_|_|/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#28928: UNIX_TIMESTAMP() should be considered unary monotonic by partition pruning Made UNIX_TIMESTAMP MONOTONIC_INCREASING when it have TIMESTAMP argument (only).
| * | | | | | | | 5.1 -> 5.5 mergeSergey Glukhov2011-03-301-2/+5
| |\ \ \ \ \ \ \ \ | | | |_|_|_|/ / / | | |/| | | | | |
| | * | | | | | | Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNINGSergey Glukhov2011-03-301-2/+5
| | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Valgrind warning happens because null values check happens too late in Item_func_month::val_str(after result string calculation).The fix is to check null value before result string calculation. mysql-test/r/func_time.result: test case mysql-test/t/func_time.test: test case sql/item_timefunc.h: check null value before result string calculation.
| * | | | | | | BUG#11766720 - setting storage engine to null segfaults mysqldSergey Vojtovich2011-02-181-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MONTHNAME(0) claims that it is about to return NOT NULL value, whereas it actually returns NULL. As a result storage_engine variable (which cannot be NULL) protection was bypassed and NULL value was accepted, causing server crash. Fixed MONTHNAME(0) to report valid NULL flag. mysql-test/r/func_time.result: A test case for BUG#11766720. mysql-test/t/func_time.test: A test case for BUG#11766720. sql/item_timefunc.cc: MONTHNAME(0) must report NULL, as opposed to base class MONTH(0) which is NOT NULL. Fixed Item_func_monthname to inherit from Item_str_func instead of Item_func_month. sql/item_timefunc.h: MONTHNAME(0) must report NULL, as opposed to base class MONTH(0) which is NOT NULL. Fixed Item_func_monthname to inherit from Item_str_func instead of Item_func_month.
| * | | | | | | Bug#31384 DATE_ADD() and DATE_SUB() return binary dataAlexander Barkov2011-02-101-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: DATE_ADD() is a hybrid function and can return DATE, DATETIME or VARCHAR data type depending on arguments. In case of VARCHAR data type, DATE_ADD() reported "binary" character set, which was wrong. Fix: make DATE_ADD() return @character_set_connection in VARCHAR context. @ mysql-test/include/ctype_numconv.inc Adding tests @ mysql-test/r/ctype_binary.result Adding tests @ mysql-test/r/ctype_cp1251.result Adding tests @ mysql-test/r/ctype_latin1.result Adding tests @ mysql-test/r/ctype_ucs.result Adding tests @ mysql-test/r/ctype_utf8.result Adding tests @ sql/item_strfunc.cc - Moving code from Item_str_ascii_func::val_str() to Item_str_func::val_str_from_val_str_ascii(), as this code needs to be shared by Item_date_add_interval. - Adding str2 parameter to be used as a buffer, instead of using private ascii_buf member. @ sql/item_strfunc.h - Moving code from Item_str_ascii_func::val_str() to Item_str_func::val_str_from_val_str_ascii() - Removing "String *val_str_convert_from_ascii(String *str, String *ascii_buf)" prototype as it was neither used nor declared. @ sql/item_timefunc.h - Overwriting parent's charset_for_protocol() method, becase we need to behave differenlty in VARCHAR and DATE/DATETYPE context. - Adding ascii_buf for conversion. - Adding val_str_ascii() prototype. - Adding val_str() which uses newly added Item_str_func::val_str_from_val_str_ascii(), passing ascii_buf as a conversion buffer.
| * | | | | | | mergeMattias Jonsson2011-01-281-1/+1
| |\ \ \ \ \ \ \ | | |/ / / / / /
| | * | | | | | minor fix of copyright headerMattias Jonsson2011-01-281-1/+1
| | | | | | | |
| * | | | | | | mergeMattias Jonsson2011-01-281-1/+1
| |\ \ \ \ \ \ \ | | |/ / / / / /
| | * | | | | | Update of copyright headers for files I changed this year.Mattias Jonsson2011-01-271-1/+1
| | | |_|/ / / | | |/| | | |
| * | | | | | Manual merge from 5.1Mattias Jonsson2011-01-101-1/+99
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Bug#54483: valgrind errors when making warnings forMattias Jonsson2010-12-221-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | Bug#54483: valgrind errors when making warnings for multiline inserts into ↵Mattias Jonsson2010-12-221-1/+93
| | | |_|/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). 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.
| * | | | | manual merge 5.1-bugteam --> 5.5-bugteam (bug 52160)Gleb Shchepa2010-11-011-0/+1
| |\ \ \ \ \ | | |/ / / /
| | * | | | Bug #52160: crash and inconsistent results when groupingGleb Shchepa2010-10-311-0/+1
| | | |/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by a function and column The bugreport reveals two different bugs about grouping on a function: 1) grouping by the TIME_TO_SEC function result caused a server crash or wrong results and 2) grouping by the function returning a blob caused an unexpected "Duplicate entry" error and wrong result. Details for the 1st bug: TIME_TO_SEC() returns NULL if its argument is invalid (empty string for example). Thus its nullability depends not only on the nullability of its arguments but also on their values. Fixed by (overoptimistically) setting TIME_TO_SEC() to be nullable despite the nullability of its arguments. Details for the 2nd bug: The server is unable to create indices on blobs without explicit blob key part length. However, this fact was ignored for blob function result fields of GROUP BY intermediate tables. Fixed by disabling GROUP BY index creation for blob function result fields like regular blob fields. mysql-test/r/func_time.result: Test case for bug #52160. mysql-test/r/type_blob.result: Test case for bug #52160. mysql-test/t/func_time.test: Test case for bug #52160. mysql-test/t/type_blob.test: Test case for bug #52160. sql/item_timefunc.h: Bug #52160: crash and inconsistent results when grouping by a function and column TIME_TO_SEC() returns NULL if its argument is invalid (empty string for example). Thus its nullability depends not only Fixed by (overoptimistically) setting TIME_TO_SEC() to be nullable despite the nullability of its arguments. sql/sql_select.cc: Bug #52160: crash and inconsistent results when grouping by a function and column The server is unable to create indices on blobs without explicit blob key part length. However, this fact was ignored for blob function result fields of GROUP BY intermediate tables. Fixed by disabling GROUP BY index creation for blob function result fields like regular blob fields.
| * | | | Auto-merged.Evgeny Potemkin2010-10-071-1/+0
| |\ \ \ \
| | * \ \ \ Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.Alexey Kopytov2010-10-021-1/+0
| | |\ \ \ \ | | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conflicts: conflict dbug/dbug.c conflict sql/sql_load.cc
| * | | | | Bug#57039: constant subtime expression returns incorrect result.Evgeny Potemkin2010-10-071-0/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The subtime function wasn't able to produce correct int representation of its result. For constant expressions the Item_datetime_cache is used to speedup evaluation and Item_datetime_cache expects underlying item to return correct int representation of DATETIME value. These two factors combined led to a wrong query result. Now the Item_func_add_time has function val_datetime which performs the calculation and saves result into given MYSQL_TIME struct, it also sets null_value to appropriate value. val_int and val_str member functions convert the result obtained from val_datetime to int or string respectively and returns it. mysql-test/r/func_time.result: Added a test case for the bug#57039. mysql-test/t/func_time.test: Added a test case for the bug#57039. sql/item_timefunc.cc: Bug#57039: constant subtime expression returns incorrect result. Now the Item_func_add_time has function val_datetime which performs the calculation and saves result into given MYSQL_TIME struct, it also sets null_value to appropriate value. val_int and val_str member functions convert the result obtained from val_datetime to int or string respectively and returns it. sql/item_timefunc.h: Bug#57039: constant subtime expression returns incorrect result.
* | | | | merge.Sergei Golubchik2010-11-251-0/+37
|\ \ \ \ \ | | |_|/ / | |/| | | | | | | | | | | | | | | | | | checkpoint. does not compile.
| * | | | merge with 5.1Sergei Golubchik2010-10-251-0/+2
| |\ \ \ \
| * \ \ \ \ mergedSergei Golubchik2010-03-151-0/+10
| |\ \ \ \ \
| * | | | | | The main commit of Andrey Zhakov's patch introducing vurtual(computed) columns.Igor Babaev2009-10-161-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The original patch has been ameliorated by Sanja and Igor.
* | | | | | | mysql-5.1 -> mysql-5.5 mergeSergei Golubchik2010-11-051-1/+0
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | / / | | |_|_|/ / | |/| | | |
| * | | | | Bug #56709: Memory leaks at running the 5.1 test suiteAlexey Kopytov2010-09-221-1/+0
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a number of memory leaks discovered by valgrind. dbug/dbug.c: This is actually an addendum to the fix for bug #52629: - there is no point in limiting the fix to just global variables, session ones are also affected. - zero all fields when allocating a new 'state' structure so that FreeState() does not deal with unitialized data later. - add a check for a NULL pointer in DBUGCloseFile() mysql-test/r/partition_error.result: Added a test case for bug #56709. mysql-test/r/variables_debug.result: Added a test case for bug #56709. mysql-test/t/partition_error.test: Added a test case for bug #56709. mysql-test/t/variables_debug.test: Added a test case for bug #56709. sql/item_timefunc.cc: There is no point in declaring 'value' as a member of Item_extract and dynamically allocating memory for it in Item_extract::fix_length_and_dec(), since this string is only used as a temporary storage in Item_extract::val_int(). sql/item_timefunc.h: Removed 'value' from the Item_extract class definition. sql/sql_load.cc: - we may need to deallocate 'buffer' even when 'error' is non-zero in some cases, since 'error' is public, and there is external code modifying it. - assign NULL to buffer when deallocating it so that we don't do it twice in the destructor - there is no point in changing 'error' in the destructor.
| * | | | Bug #55565: debug assertion when ordering by expressions with user Georgi Kodinov2010-08-131-0/+2
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | variable assignments The assert() that is firing is checking if expressions that can't be null return a NULL when evaluated. MAKEDATE() function can return NULL if the second argument is less then or equal to 0. Thus its nullability depends not only on the nullability of its arguments but also on their values. Fixed by (overoptimistically) setting MAKEDATE() to be nullable despite the nullability of its arguments. Test added. Had to update one test result to reflect the metadata change.
* | | | Bug#56271: Wrong comparison result with STR_TO_DATE functionEvgeny Potemkin2010-09-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Item_func_str_to_date class wasn't providing correct integer DATETIME representation as expected. This led to wrong comparison result and didn't allowed the STR_TO_DATE function to be used with indexes. Also, STR_TO_DATE function was inconsisted on throwing warnings/errors. Fixed now. val_int and result_as_longlong methods were added to the Item_func_str_to_date class. mysql-test/r/func_time.result: Test case result adjusted after fixing bug#56271. mysql-test/r/parser.result: Test case result adjusted after fixing bug#56271. mysql-test/r/select.result: A test case result adjusted after fixing bug#56271. mysql-test/r/strict.result: Test case result adjusted after fixing bug#56271. mysql-test/r/type_datetime.result: Added a test case for the bug#56271. mysql-test/t/strict.test: Test case adjusted after fixing bug#56271. mysql-test/t/type_datetime.test: Added a test case for the bug#56271. sql/item_timefunc.cc: Bug#56271: Wrong comparison result with STR_TO_DATE function val_int and result_as_longlong methods were added to the Item_func_str_to_date class. Item_func_str_to_date::get_date now throws the ER_WRONG_VALUE_FOR_TYPE warning on incorrect value. sql/item_timefunc.h: Bug#56271: Wrong comparison result with STR_TO_DATE function val_int and result_as_longlong methods were added to the Item_func_str_to_date class.
* | | | WL#5030: Split and remove mysql_priv.hMats Kindahl2010-03-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | WL#2649 Number-to-string conversionsAlexander Barkov2010-02-111-40/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | WL#4738 streamline/simplify @@variable creation processSergei Golubchik2009-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables Bug#20415 Output of mysqld --help --verbose is incomplete Bug#25430 variable not found in SELECT @@global.ft_max_word_len; Bug#32902 plugin variables don't know their names Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting! Bug#34829 No default value for variable and setting default does not raise error Bug#34834 ? Is accepted as a valid sql mode Bug#34878 Few variables have default value according to documentation but error occurs Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var. Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status Bug#40988 log_output_basic.test succeeded though syntactically false. Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails) Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled Bug#44797 plugins w/o command-line options have no disabling option in --help Bug#46314 string system variables don't support expressions Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken Bug#46586 When using the plugin interface the type "set" for options caused a crash. Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds Bug#49417 some complaints about mysqld --help --verbose output Bug#49540 DEFAULT value of binlog_format isn't the default value Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix) Bug#49644 init_connect and \0 Bug#49645 init_slave and multi-byte characters Bug#49646 mysql --show-warnings crashes when server dies CMakeLists.txt: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled client/mysql.cc: don't crash with --show-warnings when mysqld dies config/ac-macros/plugins.m4: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled include/my_getopt.h: comments include/my_pthread.h: fix double #define mysql-test/mysql-test-run.pl: run sys_vars suite by default properly recognize envirinment variables (e.g. MTR_MAX_SAVE_CORE) set to 0 escape gdb command line arguments mysql-test/suite/sys_vars/r/rpl_init_slave_func.result: init_slave+utf8 bug mysql-test/suite/sys_vars/t/rpl_init_slave_func.test: init_slave+utf8 bug mysys/my_getopt.c: Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting! Bug#46586 When using the plugin interface the type "set" for options caused a crash. Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix) mysys/typelib.c: support for flagset sql/ha_ndbcluster.cc: backport from telco tree sql/item_func.cc: Bug#49644 init_connect and \0 Bug#49645 init_slave and multi-byte characters sql/sql_builtin.cc.in: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled sql/sql_plugin.cc: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled Bug#32902 plugin variables don't know their names Bug#44797 plugins w/o command-line options have no disabling option in --help sql/sys_vars.cc: all server variables are defined here storage/myisam/ft_parser.c: remove unnecessary updates of param->quot storage/myisam/ha_myisam.cc: myisam_* variables belong here strings/my_vsnprintf.c: %o and %llx unittest/mysys/my_vsnprintf-t.c: %o and %llx tests vio/viosocket.c: bugfix: fix @@wait_timeout to work with socket timeouts (vs. alarm thread)
* | | | Auto-merge from mysql-next-mr.Alexander Nozdrin2009-12-191-0/+10
|\ \ \ \
| * \ \ \ Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.Alexey Kopytov2009-12-161-0/+10
| |\ \ \ \ | | |/ / /
| | * | | Bug #42849: innodb crash with varying time_zone on partitioned Alexey Kopytov2009-12-131-0/+10
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | BUG#49591, Fixed version string in SHOW CREATE TABLE to accomodate for ↵Mikael Ronstrom2009-12-171-0/+9
|/ / / | | | | | | | | | column list partitioning and new function to_seconds
* | | Merge to latest mysql-next-mrMikael Ronstrom2009-11-021-0/+6
|\ \ \
| * \ \ Automerge from mysql-next-mr.Alexander Nozdrin2009-10-271-0/+5
| |\ \ \
| * | | | Backport of fix to bug #33629 into mysql-next-mr-bugfixing.Gleb Shchepa2009-10-131-0/+6
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #33629: last_day function can return null, but has 'not null' flag set for result LAST_DAY and MAKEDATE functions are documented as returning NULL value, but actually they was implemented as returning NOT NULL typed values. That caused a confusing error "ERROR 1048 (23000): Column '...' cannot be null" on queries like: SELECT 1 FROM (SELECT LAST_DAY('0')) a; mysql-test/r/func_sapdb.result: Updated test case for bug #33629. mysql-test/r/func_time.result: Updated test case for bug #33629. mysql-test/r/type_date.result: Added test case for bug #33629. mysql-test/t/type_date.test: Added test case for bug #33629. sql/item_timefunc.h: Bug #33629: last_day function can return null, but has 'not null' flag set for result 1. The Item_func_makedate::fix_length_and_dec method has been modified to declare MAKEDATE() as a function returning nullable value. 2. The Item_func_last_day::fix_length_and_dec method has been overloaded for the same purpose.
* | | | Merged WL#3352 into mysql-next-mrMikael Ronstrom2009-10-281-0/+18
|\ \ \ \ | |_|/ / |/| | |
| * | | WL#3352, Introducing Column list partitioning, makes it possible to ↵Mikael Ronstrom2009-09-151-0/+18
| |/ / | | | | | | | | | partition on most data types, makes it possible to prune on multi-field partitioning
* | | WL#5016: Fix header file include guardsMats Kindahl2009-09-231-0/+5
|/ / | | | | | | | | Adding header include file guards to files that are missing such.
* | Auto-merge up from 5.0Timothy Smith2009-02-071-0/+1
|\ \ | |/
| * Bug#42525: TIMEDIFF functionTatiana A. Nurnberg2009-02-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 37553 we declared longlong results for class Item_str_timefunc as per comments/docs, but didn't add a method for that. And the default just wasn't good enough for some cases. Changeset adds dedicated val_int() to class. mysql-test/r/func_sapdb.result: More tests for casts of TIME() / TIMEDIFF() with negative results. mysql-test/t/func_sapdb.test: More tests for casts of TIME() / TIMEDIFF() with negative results. sql/item_timefunc.h: Since we claim to provide longlong results, we should have a suitable function to provide them (the default won't do). This one matches the val_real() variant.
* | 5.0-bugteam->5.1-bugteam mergeSergey Glukhov2008-12-231-14/+4
|\ \ | |/
| * Bug#37575 UCASE fails on monthnameSergey Glukhov2008-12-231-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MONTHNAME/DAYNAME functions returns binary string, so the LOWER/UPPER functions are not effective on the result of MONTHNAME/DAYNAME call. Character set of the MONTHNAME/DAYNAME function result has been changed to connection character set. include/m_ctype.h: added my_charset_repertoire function mysql-test/r/ctype_ucs.result: test result mysql-test/r/func_time.result: test result mysql-test/t/ctype_ucs.test: test case mysql-test/t/func_time.test: test case sql/item_timefunc.cc: Item_func_monthname::fix_length_and_dec and Item_func_dayname::fix_length_and_dec methods have been modified to use connection character set sql/item_timefunc.h: Item_func_monthname::fix_length_and_dec and Item_func_dayname::fix_length_and_dec methods have been modified to use connection character set sql/mysql_priv.h: added max_month_name_length, max_day_name_length fields into MY_LOCALE struct sql/mysqld.cc: The test_lc_time_sz function controls modifications of the locale database in debugging mode. sql/sql_locale.cc: initialization of max_month_name_length, max_day_name_length fields strings/ctype.c: added my_charset_repertoire function
* | auto-mergeTatiana A. Nurnberg2008-11-271-0/+1
|\ \ | |/
| * Bug#37553: MySql Error Compare TimeDiff & TimeTatiana A. Nurnberg2008-11-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We pretended that TIMEDIFF() would always return positive results; this gave strange results in comparisons of the TIMEDIFF(low,hi)<TIME(0) type that rendered a negative result, but still gave false in comparison. We also inadvertantly dropped the sign when converting times to decimal. CAST(time AS DECIMAL) handles signs of the times correctly. TIMEDIFF() marked up as signed. Time/date comparison code switched to signed for clarity. mysql-test/r/func_sapdb.result: show that time-related comparisons work with negative time values now. show that converting time to DECIMAL no longer drops sign. mysql-test/t/func_sapdb.test: show that time-related comparisons work with negative time values now. show that converting time to DECIMAL no longer drops sign. sql/item_cmpfunc.cc: signed returns sql/item_cmpfunc.h: signed now (time/date < > =) sql/item_func.cc: signed now sql/item_timefunc.h: Functions such as TIMEDIFF() return signed results! The file-comments pretended we were doing that all along, anyway... sql/my_decimal.cc: heed sign when converting time to my_decimal; times may actually be negative! Needed for SELECT CAST(time('-73:42:12') AS DECIMAL); sql/mysql_priv.h: using signed for dates and times now