summaryrefslogtreecommitdiff
path: root/sql/item_func.h
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-21082: isnan/isinf compilation errors, isfinite warnings on MacOSVlad Lesin2019-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The fix consists of three commits backported from 10.3: 1) Cleanup isnan() portability checks (cherry picked from commit 7ffd7fe9627d1f750a3712aebb4503e5ae8aea8e) 2) Cleanup isinf() portability checks Original problem reported by Wlad: re-compilation of 10.3 on top of 10.2 build would cache undefined HAVE_ISINF from 10.2, whereas it is expected to be 1 in 10.3. std::isinf() seem to be available on all supported platforms. (cherry picked from commit bc469a0bdf85400f7a63834f5b7af1a513dcdec9) 3) Use std::isfinite in C++ code This is addition to parent revision fixing build failures. (cherry picked from commit 54999f4e75f42baca484ae436b382ca8817df1dd)
* MDEV-20517 Assertion `!is_expensive()' failed in ↵Alexander Barkov2019-09-071-6/+5
| | | | Item::value_depends_on_sql_mode_const_item
* MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in ↵Alexander Barkov2019-09-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.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-19139: pushdown condition with Item_func_set_user_varGalina Shalygina2019-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | | The bug occurs because Item_func_set_user var is allowed to be pushed into materialized derived table/view. To fix it excl_dep_on_table() as added to Item_func_set_user_var class to prevent pushdown.
* | | Merge 10.1 into 10.2Marko Mäkelä2019-04-251-4/+7
|\ \ \ | |/ /
| * | MDEV-14041 Server crashes in String::length on queries with functions and ROLLUPAlexander Barkov2019-04-221-4/+7
| | |
* | | Merge 10.1 into 10.2Marko Mäkelä2019-04-041-1/+0
|\ \ \ | |/ /
| * | Fix clang -Wunused-private-fieldMarko Mäkelä2019-04-031-1/+0
| | |
* | | Merge 10.1 into 10.2Marko Mäkelä2019-03-261-1/+0
|\ \ \ | |/ /
| * | MDEV-18968 Both (WHERE 0.1) and (WHERE NOT 0.1) return empty setAlexander Barkov2019-03-261-1/+0
| | |
* | | Backporting MDEV-15597 Add class Load_data_outvar and avoid using ↵Alexander Barkov2019-02-231-2/+31
| | | | | | | | | | | | | | | | | | Item::STRING_ITEM for Item_user_var_as_out_param detection This is a part of "MDEV-18045 Backporting the MDEV-15497 changes to 10.2 branch"
* | | Merge 10.1 into 10.2Marko Mäkelä2019-02-021-0/+4
|\ \ \ | |/ /
| * | MDEV-10963 Fragmented BINLOG queryAndrei Elkin2019-01-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was originally stated in http://bugs.mysql.com/bug.php?id=82212 The size of an base64-encoded Rows_log_event exceeds its vanilla byte representation in 4/3 times. When a binlogged event size is about 1GB mysqlbinlog generates a BINLOG query that can't be send out due to its size. It is fixed with fragmenting the BINLOG argument C-string into (approximate) halves when the base64 encoded event is over 1GB size. The mysqlbinlog in such case puts out SET @binlog_fragment_0='base64-encoded-fragment_0'; SET @binlog_fragment_1='base64-encoded-fragment_1'; BINLOG @binlog_fragment_0, @binlog_fragment_1; to represent a big BINLOG. For prompt memory release BINLOG handler is made to reset the BINLOG argument user variables in the middle of processing, as if @binlog_fragment_{0,1} = NULL is assigned. Notice the 2 fragments are enough, though the client and server still may need to tweak their @@max_allowed_packet to satisfy to the fragment size (which they would have to do anyway with greater number of fragments, should that be desired). On the lower level the following changes are made: Log_event::print_base64() remains to call encoder and store the encoded data into a cache but now *without* doing any formatting. The latter is left for time when the cache is copied to an output file (e.g mysqlbinlog output). No formatting behavior is also reflected by the change in the meaning of the last argument which specifies whether to cache the encoded data. Rows_log_event::print_helper() is made to invoke a specialized fragmented cache-to-file copying function which is copy_cache_to_file_wrapped() that takes care of fragmenting also optionally wraps encoded strings (fragments) into SQL stanzas. my_b_copy_to_file() is refactored to into my_b_copy_all_to_file(). The former function is generalized to accepts more a limit argument to constraint the copying and does not reinitialize anymore the cache into reading mode. The limit does not do any effect on the fully read cache.
* | | Merge branch '10.1' into 10.2Sergei Golubchik2018-09-241-2/+6
|\ \ \ | |/ /
| * | Merge branch '10.0' into 10.1Sergei Golubchik2018-09-231-2/+8
| |\ \
| | * \ Merge remote-tracking branch 'origin/5.5' into 10.0Alexander Barkov2018-09-211-2/+8
| | |\ \ | | | |/
| | | * MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong resultAlexander Barkov2018-09-201-2/+8
| | | |
* | | | MDEV-16614 signal 7 after calling stored procedure, that uses regexpAlexander Barkov2018-07-261-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed in ↵Oleksandr Byelkin2018-06-151-53/+65
| | | | | | | | | | | | | | | | | | | | | | | | Locked_tables_list::unlock_locked_table fix_length_and_dec now return result (error/OK)
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2018-05-101-0/+8
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2018-05-051-0/+8
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Sergei Golubchik2018-04-291-0/+7
| | |\ \ | | | |/
| | | * MDEV-15035 Wrong results when calling a stored procedureIgor Babaev2018-04-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multiple times with different arguments. If the ON expression of an outer join is an OR formula with one of the disjunct being a constant formula then the expression cannot be null-rejected if the constant formula is true. Otherwise it can be null-rejected and if so the outer join can be converted into inner join. This optimization was added in the patch for mdev-4817. Yet the code had a defect: if the query was used in a stored procedure with parameters and the constant item contained some of them then the value of this constant item depended on the values of the parameters. With some parameters it may be true, for others not. The validity of conversion to inner join is checked only once and it happens only for the first call of procedure. So if the parameters in the first call allowed the conversion it was done and next calls used the transformed query though there could be calls whose parameters made the conversion invalid. Fixed by cheking whether the constant disjunct in the ON expression originally contained an SP parameter. If so the expression is not considered as null-rejected. For this check a new item's attribute was intruduced: Item::with_param. It is calculated for each item by fix fields() functions. Also moved the call of optimize_constant_subqueries() in JOIN::optimize after the call of simplify_joins(). The reason for this is that after the optimization introduced by the patch for mdev-4817 simplify_joins() can use the results of execution of non-expensive constant subqueries and this is not valid.
* | | | Merge 10.1 into 10.2Marko Mäkelä2018-04-241-0/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.0 into 10.1Marko Mäkelä2018-04-241-0/+2
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Sergei Golubchik2018-04-201-0/+2
| | |\ \ | | | |/
| | | * MDEV-15624 Changing the default character set to utf8mb4 changes query ↵Alexander Barkov2018-04-041-0/+2
| | | | | | | | | | | | | | | | evaluation in a very surprising way
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2018-03-251-1/+2
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2018-03-231-1/+1
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Sergei Golubchik2018-03-231-1/+1
| | |\ \ | | | |/
| | | * MDEV-14779: using left join causes incorrect results with materialization ↵Varun Gupta2018-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | cleanup: make find_date_time_item() staticSergei Golubchik2018-03-141-1/+0
| | | |
* | | | Merge remote-tracking branch 'origin/10.1' into 10.2Alexander Barkov2017-11-091-1/+1
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.0' into 10.1Alexander Barkov2017-11-091-1/+1
| |\ \ \ | | |/ /
| | * | MDEV-14164: Unknown column error when adding aggregate to function in oracle ↵Oleksandr Byelkin2017-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | style procedure FOR loop Make differentiation between pullout for merge and pulout of outer field during exists2in transformation. In last case the field was outer and so we can safely start from name resolution context of the SELECT where it was pulled. Old behavior lead to inconsistence between list of tables and outer name resolution context (which skips one SELECT for merge purposes) which creates problem vor name resolution.
* | | | MDEV-10817 CAST(MAX(DATE'2001-01-01') AS TIME) returns a wrong resultAlexander Barkov2017-11-071-0/+7
| | | |
* | | | Merge 10.1 into 10.2Marko Mäkelä2017-10-021-6/+0
|\ \ \ \ | |/ / /
| * | | MDEV-13897 SELECT @a := MAX(col) FROM t requires full index scanmariadb-10.1.28Sergei Golubchik2017-09-271-6/+0
| | | | | | | | | | | | | | | | fix some old bad merge
* | | | MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.Alexey Botchkov2017-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | JSON_EXTRACT behaves specifically in the comparison, so we have to implement specific method for that in Arg_comparator.
* | | | Fixed the bug mdev-12845.Igor Babaev2017-06-221-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fills in a serious flaw in the code that supports condition pushdown into materialized views / derived tables. If a predicate happened to contain a reference to a mergeable view / derived table and it does not depended directly on the target materialized view / derived table then the predicate was not considered as a subject to pusdown to this view / derived table.
* | | | Merge 10.1 into 10.2Marko Mäkelä2017-06-081-4/+25
|\ \ \ \ | |/ / / | | | | | | | | Replace have_innodb_zip.inc with innodb_page_size_small.inc.
| * | | Merge 10.0 into 10.1Marko Mäkelä2017-06-061-4/+25
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | Rewrite the test encryption.innodb-checksum-algorithm not to require any restarts or re-bootstrapping, and to cover all innodb_page_size combinations. Test innodb.101_compatibility with all innodb_page_size combinations.
| | * | Merge 5.5 into 10.0Marko Mäkelä2017-05-291-4/+25
| | |\ \ | | | |/
| | | * MDEV-11958: LEFT JOIN with stored routine produces incorrect resultOleksandr Byelkin2017-05-231-4/+25
| | | | | | | | | | | | | | | | | | | | Added forgoten method of Item_func_sp to make it correctly work with LEFT/RIGHT JOIN. Fixed inconsistency with the null table caches.
* | | | Merge 10.1 into 10.2Marko Mäkelä2017-05-261-1/+1
|\ \ \ \ | |/ / /
| * | | MDEV-12844 numerous issues in MASTER_GTID_WAIT()Sergei Golubchik2017-05-241-1/+1
| | | |
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2017-05-091-6/+4
|\ \ \ \ | |/ / / | | | | | | | | | | | | Revert commit db0917f68f, because the fix for MDEV-12696 is coming from 5.5 and 10.1 in this merge.