summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-1/+1
|\
| * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-1/+1
| |\
| | * Code comment spellfixesIan Gilfillan2020-07-221-1/+1
| | |
* | | MDEV-20900: IN predicate to IN subquery conversion causes performance regressionVarun Gupta2019-12-101-0/+1
| | | | | | | | | | | | | | | Disable the IN predicate to IN subquery conversion when the types on the left and right hand side of the IN predicate are not of comparable type.
* | | Merge remote-tracking branch 10.2 into 10.3Jan Lindström2019-12-021-1/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | Conflicts: mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt mysql-test/suite/innodb/r/innodb-mdev-7513.result mysql-test/suite/innodb/t/innodb-mdev-7513.test mysql-test/suite/wsrep/disabled.def storage/innobase/ibuf/ibuf0ibuf.cc
| * | MDEV-17508 Fix bug for spider when using "not like"willhan2019-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix bug for spider where using "not like" (#890) test case: t1 is a spider engine table; CREATE TABLE `t1` ( `id` int(11) NOT NULL DEFAULT '0', `name` char(64) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=SPIDER query: "select * from t1 where name not like 'x%' " would dispatch "select xxx name name like 'x%' " to remote mysqld, is wrong
* | | Merge 10.2 (up to commit ef00ac4c86daf3294c46a45358da636763fb0049) into 10.3Alexander Barkov2019-09-041-0/+2
|\ \ \ | |/ /
| * | MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in ↵Alexander Barkov2019-09-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH This change takes into account a column's GENERATED ALWAYS AS expression dependcy on sql_mode's PAD_CHAR_TO_FULL_LENGTH and NO_UNSIGNED_SUBTRACTION flags. Indexed virtual columns as well as persistent generated columns are now not allowed to have such dependencies to avoid inconsistent data or index files on sql_mode changes. So an error is now returned in cases like this: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT -- CHAR->VARCHAR or CHAR->TEXT = ERROR ); Functions RPAD() and RTRIM() can now remove dependency on PAD_CHAR_TO_FULL_LENGTH. So this can be used instead: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT ); Note, unlike CHAR->VARCHAR and CHAR->TEXT this still works, not RPAD(a) is needed: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v CHAR(5) AS (a) PERSISTENT -- CHAR->CHAR is OK ); More sql_mode flags may affect values of generated columns. They will be addressed separately. See comments in sql_mode.h for implementation details.
* | | MDEV-20273 Add class Item_sum_min_maxAlexander Barkov2019-08-071-2/+2
| | |
* | | Merge 10.2 into 10.3Marko Mäkelä2019-07-021-0/+2
|\ \ \ | |/ /
| * | Merge 10.1 into 10.2Eugene Kosov2019-06-231-0/+4
| |\ \ | | |/
| | * Merge 5.5 into 10.1Eugene Kosov2019-06-201-0/+4
| | |\
| | | * MDEV-19790 Wrong result for query with outer join and IS NOT TRUE predicateIgor Babaev2019-06-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in where clause The classes Item_func_isnottrue and Item_func_isnotfalse inherited the implementation of the eval_not_null_tables method from the Item_func class. As a result the not_null_tables_cache was set incorrectly for the objects of these classes. It led to improper conversion of outer joins to inner joins when the where clause of the processed query contained IS NOT TRUE or IS NOT FALSE predicates. The coverted query in many cases produced a wrong result set.
* | | | 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-19008 Slow EXPLAIN SELECT ... WHERE col IN (const1,const2,(subquery))Alexander Barkov2019-03-221-1/+1
| | | |
* | | | Merge 10.2 into 10.3Marko Mäkelä2019-03-081-0/+1
|\ \ \ \ | |/ / /
| * | | MDEV-18383: Missing rows with pushdown condition defined with IF-functionGalina Shalygina2019-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | using Item_cond This bug is similar to the bug MDEV-16765. It appears because of the wrong pushdown into HAVING clause while this pushdown shouldn't be made at all. This happens because function that checks if Item_cond can be pushed always returns that it can be pushed. To fix it new method Item_cond::excl_dep_on_table() was added.
| * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2018-11-151-0/+5
| |\ \ \ | | |/ /
| | * | Merge branch '10.0' into 10.1Oleksandr Byelkin2018-11-151-0/+5
| | |\ \
| | | * \ Merge branch '5.5' into 10.0Oleksandr Byelkin2018-11-151-0/+5
| | | |\ \ | | | | |/
| | | | * Backport for "MDEV-17698 MEMORY engine performance regression"Alexander Barkov2018-11-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, backporting a part of: MDEV-11485 Split Item_func_between::val_int() into virtual methods in Type_handler for easier merge to 10.3.
| | * | | Merge branch '10.0' into 10.1Oleksandr Byelkin2018-08-211-0/+1
| | |\ \ \ | | | |/ /
| | | * | Merge branch '5.5' into 10.0Oleksandr Byelkin2018-08-151-0/+1
| | | |\ \ | | | | |/
| | | | * MDEV-15475: Assertion `!table || (!table->read_set || ↵Oleksandr Byelkin2018-08-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap_is_set(table->read_set, field_index))' failed on EXPLAIN EXTENDED with constant table and view Print constant ISNULL value independent. Fix of printing of view FRM and CREATE VIEW output
* | | | | MDEV-17411 Wrong WHERE optimization with simple CASE and searched CASEAlexander Barkov2018-10-111-0/+2
| | | | |
* | | | | Merge 10.2 into 10.3Marko Mäkelä2018-08-281-0/+1
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-16765: Missing rows with pushdown condition defined with CASE using ↵Galina Shalygina2018-08-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_cond The bug appears because of the wrong pushdown into the WHERE clause of the materialized derived table/view work. For the excl_dep_on_grouping_fields() method that checks if the condition can be pushed into the WHERE clause the case when Item_cond is used is missing. For Item_cond elements this method always returns positive result (that condition can be pushed). So this condition is pushed even if is shouldn't be pushed. To fix it new Item_cond::excl_dep_on_grouping_fields() method is added.
* | | | | Merge 10.2 into 10.3Marko Mäkelä2018-08-031-12/+2
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-16614 signal 7 after calling stored procedure, that uses regexpAlexander Barkov2018-07-261-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem happened in the derived condition pushdown code: - When Item_func_regex::build_clone() was called, it created a copy of the original Item_func_regex, and this copy got registered in free_list. Class specific additional dynamic members (such as "re") made a shallow copy, rather than a deep copy, in the cloned Item_func_regex. As a result, the Regexp_processor_pcre::m_pcre of the cloned Item_func_regex and of the original Item_func_regex pointed to the same compiled regular expression. - On cleanup_items(), both original and cloned copies of Item_func_regex called re.cleanup(), which called pcre_free(m_pcre). So the same compiled regular expression was freed two times, which was noticed by ASAN. The same problem was repeatable for Item_func_regexp_instr. A similar problem happened for Item_func_sp, for the sp_result_field member. Both original and cloned copies of Item_func_sp pointed the same Field instance and both deleted it on cleanup(). A possible solution would be to fix build_clone() to create deep (instead of shallow) copies for the dynamic members of the affected classes (Item_func_regex, Item_func_regexp_instr, Item_func sp). However, this would be too complex. As agreed with Galina and Igor, this patch disallows using using these affected classes in derived condition pushdown by overriding get_clone() to return NULL.
* | | | | Merge commit '6b8802e8dd5467556a024d807a1df23940b00895' into bb-10.3-fix_len_decbb-10.3-fix_len_decOleksandr Byelkin2018-06-191-34/+48
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed in ↵Oleksandr Byelkin2018-06-151-25/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Locked_tables_list::unlock_locked_table fix_length_and_dec now return result (error/OK)
| * | | | MDEV-16090: Server crash in in Item_func_in::val_int or assertion `in_item'Galina Shalygina2018-05-121-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | failure upon SELECT with impossible condition The problem appears because of a wrong implementation of the Item_func_in::build_clone() method. It didn't clone 'array' and 'cmp_fields' fields for the cloned IN predicate and this could cause crashes. The Item_func_in::fix_length_and_dec() method was refactored and a new method named Item_func_in::create_array() was created. It allowed to create 'array' for cloned IN predicates in a proper way.
* | | | | cleanup: remove get_datetime_value()Sergei Golubchik2018-03-301-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is a 10.3 version of 27d94b7e032 It disables caching of the first argument of IN, if it's of a temporal type. Because other types are not cached in this context.
* | | | | cleanup: Item_func_caseSergei Golubchik2018-03-301-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reorder items in args[] array. Instead of when1,then1,when2,then2,...[,case][,else] sort them as [case,]when1,when2,...,then1,then2,...[,else] in this case all items used for comparison take a continuous part of the array and can be aggregated directly. and all items that can be returned take a continuous part of the array and can be aggregated directly. Old code had to copy them to a temporary array before aggreation, and then copy back (thd->change_item_tree) everything that was changed. this is a 10.3 version of bf1ca14ff3f
* | | | | Merge branch '10.2' into 10.3Sergei Golubchik2018-03-281-14/+18
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.1' into 10.2Sergei Golubchik2018-03-251-0/+3
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.0' into 10.1Sergei Golubchik2018-03-231-0/+5
| | |\ \ \ | | | |/ /
| | | * | Merge branch '5.5' into 10.0Sergei Golubchik2018-03-231-0/+5
| | | |\ \ | | | | |/
| | | | * MDEV-14779: using left join causes incorrect results with materialization ↵Varun Gupta2018-03-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and derived tables Conversion of a subquery to a semi-join is blocked when we have an IN subquery predicate in the on_expr of an outer join. Currently this scenario is handled but the cases when an IN subquery predicate is wrapped inside a Item_in_optimizer item then this blocking is not done.
| * | | | Merge 10.1 into 10.2Marko Mäkelä2018-03-221-0/+5
| |\ \ \ \ | | |/ / /
| | * | | MDEV-15633 Memory leak after MDEV-15005Alexander Barkov2018-03-221-0/+5
| | | | |
| * | | | Merge branch '10.1' into 10.2Vicențiu Ciorbaru2018-03-211-0/+7
| |\ \ \ \ | | |/ / /
| | * | | MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simpleAlexander Barkov2018-03-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cmp_item_sort_string::store_value() did not cache the string returned from item->val_str(), whose result can point to various private members such as Item_char_typecast::tmp_value. - cmp_item_sort_string::store_value() remembered the pointer returned from item->val_str() poiting to tmp_value into cmp_item_string::value_res. - Later, cmp_item_real::store_value() was called, which called Item_str_func::val_real(), which called Item_char_typecast::val_str(&tmp) using a local stack variable "String tmp". Item_char_typecast::tmp_value was overwritten and become a link to "tmp": tmp_value.Ptr freed its own buffer and set to point to the buffer owned by "tmp". - On return from Item_str_func::val_real(), "String tmp" was destructed, but "tmp_value" still pointed to the buffer owned by "tmp", So tmp_value.Ptr became invalid. - Then cmp_item_sort_string() passed cmp_item_string::value_res to sortcmp(). At this point, value_res still pointed to an invalid value of Item_char_typecast::tmp_value. Fix: changing cmp_item_sort_string::store_value() to force copying to cmp_item_string::value if item->val_str(&value) returned a different pointer (instead of &value).
| * | | | cleanup: remove get_datetime_value()Sergei Golubchik2018-03-141-6/+0
| | | | |
| * | | | MDEV-11839 move value caching from get_datetime_value to fix_fields timeSergei Golubchik2018-03-141-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor get_datetime_value() not to create Item_cache_temporal(), but do it always in ::fix_fields() or ::fix_length_and_dec(). Creating items at the execution time doesn't work very well with virtual columns and check constraints that are fixed and executed in different THDs.
| * | | | cleanup: Arg_comparator::cache_converted_constant()Sergei Golubchik2018-03-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a generic function, not using anything from Arg_comparator. Make it a static function, not a class method, to be able to use it later without Arg_comparator
| * | | | cleanup: typos, comments, whitespaceSergei Golubchik2018-03-141-3/+2
| | | | |