summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.4 into 10.5Marko Mäkelä2021-04-141-5/+1
|\
| * MDEV-23634: Select query hanged the server and leads to OOM ...bb-10.4-mdev23634Sergei Petrunia2021-04-081-5/+1
| | | | | | | | | | | | | | | | | | | | Handle "col<>const" in the same way that MDEV-21958 did for "col NOT IN(const-list)": do not use the condition for range/index_merge accesses if there is a unique UNIQUE KEY(col). The testcase is in main/range.test. The rest of test updates are due to widespread use of 'pk<>1' in the testsuite. Changed the test to use different but equivalent forms of the conditions.
* | Merge commit '10.4' into 10.5Oleksandr Byelkin2021-01-061-0/+7
|\ \ | |/
| * Merge branch '10.3' into 10.4bb-10.4-MDEV-23468Oleksandr Byelkin2020-12-251-0/+7
| |\
| | * Merge branch '10.2' into 10.3Oleksandr Byelkin2020-12-231-0/+7
| | |\
| | | * Item_func_like::walk() was ignoring escape_itemSergei Golubchik2020-12-191-0/+7
| | | | | | | | | | | | | | | | | | | | in particular, it caused escape_item->is_expensive() property to be lost instead of being properly propagated up.
* | | | MDEV-24346 valgrind error in main.precedenceSergei Golubchik2020-12-211-20/+17
| | | | | | | | | | | | | | | | | | | | Reverts 10.5 commit 6033cc85876 The fix a587ded283d will be merged from 10.2
* | | | Fixed usage of not initialized memory in LIKE ... ESCAPEMonty2020-12-031-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was noticed wben running "mtr --valgrind main.precedence" The problem was that Item_func_like::escape could be left unitialized when used with views combined with UNIONS like in: create or replace view v1 as select 2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1); The above query causes in fix_escape_item() escape_item->const_during_execution() to be true and escape_item->const_item() to be false in which case 'escape' is never calculated. The fix is to make the main logic of fix_escape_item() out to a separate function and call that function once in Item. Other things: - Reorganized fields in Item_func_like class to make it more compact
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-10-301-9/+10
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-10-291-9/+10
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-10-281-9/+10
| | |\ \ | | | |/
| | | * precedence bugfixingSergei Golubchik2020-10-231-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix printing precedence for BETWEEN, LIKE/ESCAPE, REGEXP, IN don't use precedence for printing CASE/WHEN/THEN/ELSE/END fix parsing precedence of BETWEEN, LIKE/ESCAPE, REGEXP, IN support predicate arguments for IN, BETWEEN, SOUNDS LIKE, LIKE/ESCAPE, REGEXP use %nonassoc for unary operators fix parsing of IS TRUE/FALSE/UNKNOWN/NULL remove parser_precedence test as superseded by the precedence test
| | | * cleanup: remove redundant BANG_PRECEDENCESergei Golubchik2020-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | prefix unary operators don't need to have different precedence, the syntax unambiguously specifies in what order they apply
* | | | MDEV-23054 Assertion `!item->null_value' failed in ↵Alexander Barkov2020-08-111-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Type_handler_inet6::make_sort_key_part (#2) IFNULL(inet6_not_null_expr, 'foo') erroneously set its nullability to NOT NULL. Fix: - Moving the line "maybe_null= args[1]->maybe_null" before the call of fix_length_and_dec2(), so the call of Type_handler method Item_hybrid_func_fix_attributes() can reset it when desired. - Fixing Type_handler_inet6::Item_hybrid_func_fix_attributes() to ignore args[0] when detecting nullability of IFNULL().
* | | | Added 'final' to some classes to improve generated codeMichael Widenius2020-08-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Final added to: - All reasonable classes inhereted from Field - All classes inhereted from Protocol - Almost all Handler classes - Some important Item classes The stripped size of mariadbd is just 4K smaller, but several object files showed notable improvements in common execution paths. - Checked field.o and item_sum.o Other things: - Added 'override' to a few class functions touched by this patch. - Removed 'virtual' from a new class functions that had/got 'override' - Changed Protocol_discard to inherit from Protocol instad of Protocol_text
* | | | Merge branch '10.4' into 10.5Oleksandr Byelkin2020-08-041-1/+1
|\ \ \ \ | |/ / /
| * | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-08-031-1/+1
| |\ \ \ | | |/ /
| | * | 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
| | | | |
* | | | | fix clang compilationEugene Kosov2020-07-061-35/+39
| | | | |
* | | | | MDEV-23071 remove potentially dangerouws casting to Item_in_subselectOleksandr Byelkin2020-07-061-3/+3
| | | | | | | | | | | | | | | | | | | | Remove types casting with a help of virtual functions.
* | | | | when printing Item_in_optimizer, use precedence of wrapped Itembb-10.5-pr1588Sidney Cammeresi2020-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when Item::print() is called with the QT_PARSABLE flag, WHERE i NOT IN (SELECT ...) gets printed as WHERE !i IN (SELECT ...) instead of WHERE !(i in (SELECT ...)) because Item_in_optimizer returns DEFAULT_PRECEDENCE. it should return the precedence of the inner operation.
* | | | | MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRYAlexander Barkov2020-03-101-0/+1
| | | | |
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-01-201-1/+2
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-21184 Assertion `used_tables_cache == 0' failed in Item_func::fix_fieldsIgor Babaev2020-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with condition_pushdown_from_having This bug could manifest itself for queries with GROUP BY and HAVING clauses when the HAVING clause was a conjunctive condition that depended exclusively on grouping fields and at least one conjunct contained an equality of the form fld=sq where fld is a grouping field and sq is a constant subquery. In this case the optimizer tries to perform a pushdown of the HAVING condition into WHERE. To construct the pushable condition the optimizer first transforms all multiple equalities in HAVING into simple equalities. This has to be done for a proper processing of the pushed conditions in WHERE. The multiple equalities at all AND/OR levels must be converted to simple equalities because any multiple equality may refer to a multiple equality at the upper level. Before this patch the conversion was performed like this: multiple_equality(x,f1,...,fn) => x=f1 and ... and x=fn. When an equality item for x=fi was constructed both the items for x and fi were cloned. If x happened to be a constant subquery that could not be cloned the conversion failed. If the conversions of multiple equalities previously performed had succeeded then the whole condition became in an inconsistent state that could cause different failures. The solution provided by the patch is: 1. to use a different conversion rule if x is a constant multiple_equality(x,f1,...,fn) => f1=x and f2=f1 and ... and fn=f1 2. not to clone x if it's a constant. Such conversions cannot fail and besides the result of the conversion preserves the equivalence of f1,...,fn that can be used for other optimizations. This patch also made sure that expensive predicates are not pushed from HAVING to WHERE.
* | | | | dependencies for VSSergei Golubchik2019-12-211-23/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | item_cmpfunc.h includes pcre2.h, so with the bundled pcre2 it has to be built before anything that includes pcre2.h . And item_cmpfunc.h is indirectly included everywhere, also in many plugins. Somehow Ninja and Makefiles generators can still deduce the correct build dependencies, but Visual Studio generator cannot. Two changes: * move pcre2.h from item_cmpfunc.h to item_cmpfunc.cc * create an explicit dependency on pcre2 for the server
* | | | | MDEV-14024 PCRE2.Alexey Botchkov2019-12-211-21/+19
| | | | | | | | | | | | | | | | | | | | Related changes in the server code.
* | | | | Merge 10.4 into 10.5Marko Mäkelä2019-12-161-0/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.3 into 10.4Marko Mäkelä2019-12-131-0/+1
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | We disable the MDEV-21189 test galera.galera_partition because it times out.
| | * | | 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.4 into 10.5Marko Mäkelä2019-09-061-0/+2
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.3' into 10.4Sergei Golubchik2019-09-061-0/+2
| |\ \ \ \ | | |/ / /
| | * | | 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.
* | | | | Merge 10.4 into 10.5Marko Mäkelä2019-09-061-0/+3
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-19961 MIN(timestamp_column) returns a wrong result in a GROUP BY queryAlexander Barkov2019-08-191-0/+3
| | | | |
* | | | | MDEV-15777 Use inferred IS NOT NULL predicates in the range optimizerIgor Babaev2019-08-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces the optimization that allows range optimizer to consider index range scans that are built employing NOT NULL predicates inferred from WHERE conditions and ON expressions. The patch adds a new optimizer switch not_null_range_scan.
* | | | | MDEV-20353 Add separate type handlers for unsigned integer data typesAlexander Barkov2019-08-151-1/+1
| | | | |
* | | | | Revert "MDEV-20342 Turn Field::flags from a member to a method"Alexander Barkov2019-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e86010f909fb6b8c4ffd9d6df92991ac079e67e7. Reverting on Monty's request, as this change makes merging things from 10.5 to 10.2 much harder.
* | | | | MDEV-20342 Turn Field::flags from a member to a methodAlexander Barkov2019-08-141-1/+1
| | | | |
* | | | | Merge remote-tracking branch 'origin/10.4' into 10.5Alexander Barkov2019-08-131-2/+2
|\ \ \ \ \ | |/ / / /
| * | | | Merge commit '43882e764d6867c6855b1ff057758a3f08b25c55' into 10.4Alexander Barkov2019-08-131-2/+2
| |\ \ \ \ | | |/ / /
| | * | | MDEV-20273 Add class Item_sum_min_maxAlexander Barkov2019-08-071-2/+2
| | | | |
* | | | | Merge 10.4 into 10.5Marko Mäkelä2019-08-131-0/+2
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.3 into 10.4Marko Mäkelä2019-07-021-0/+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
| | | |\ \ | | | | |/