summaryrefslogtreecommitdiff
path: root/sql/item.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.3' into 10.4Sergei Golubchik2019-09-061-0/+35
|\
| * Merge 10.2 (up to commit ef00ac4c86daf3294c46a45358da636763fb0049) into 10.3Alexander Barkov2019-09-041-0/+35
| |\
| | * MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in ↵Alexander Barkov2019-09-031-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 branch '10.3' into 10.4Oleksandr Byelkin2019-09-021-1/+1
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-09-021-1/+1
| |\ \ | | |/
| | * Merge remote-tracking branch 'connect/10.2' into 10.2Oleksandr Byelkin2019-08-301-1/+1
| | |\
* | | \ Merge 10.3 into 10.4Marko Mäkelä2019-08-311-0/+4
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-08-291-0/+4
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-08-281-0/+4
| | |\ \
| | | * | MDEV-19699 Server crashes in Item_null_result::field_type upon SELECT with ↵Alexander Barkov2019-08-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ROLLUP on constant table Also fixes: MDEV-20431 GREATEST(int_col,date_col) returns wrong results in a view
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-08-161-2/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2019-08-151-2/+1
| |\ \ \ \ | | |/ / /
| | * | | MDEV-19740: Fix C++11 violations caught by GCC 9.2.1Marko Mäkelä2019-08-151-2/+1
| | | | |
* | | | | Fixes based on warnings from gcc/clang and valgrindMonty2019-08-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Initialize variables that could be used uninitialized - Added extra end space to DbugStringItemTypeValue to get rid of warnings from c_ptr() - Session_sysvars_tracker::update() accessed unitialized memory if called with NULL value. - get_schema_stat_record() accessed unitialized memory if HA_KEY_LONG_HASH was used - parse_vcol_defs() accessed random memory for tables without keys.
* | | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-07-281-0/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-07-261-0/+1
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2019-07-261-0/+1
| | |\ \ \ | | | |/ /
| | | * | Merge branch '5.5' into 10.1Oleksandr Byelkin2019-07-251-0/+1
| | | |\ \
| | | | * | MDEV-19778 Wrong Result on Left Outer Join with Subquery right on trueIgor Babaev2019-06-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and WHERE filter afterwards This patch complements the patch fixing the bug MDEV-6892. The latter properly handled queries that used mergeable views returning constant columns as inner tables of outer joins and whose where clause contained predicates referring to these columns if the predicates of happened not to be equality predicates. Otherwise the server still could return wrong result sets for such queries. Besides the fix for MDEV-6892 prevented some possible conversions of outer joins to inner joins for such queries. This patch corrected the function check_simple_equality() to handle properly conjunctive equalities of the where clause that refer to the constant columns of mergeable views used as inner tables of an outer join. The patch also changed the code of Item_direct_view_ref::not_null_tables(). This change allowed to take into account predicates containing references to constant columns of mergeable views when converting outer joins into inner joins.
* | | | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-6/+29
|\ \ \ \ \ \ | |/ / / / /
| * | | | | MDEV-19468 Hybrid type expressions return wrong format for FLOATAlexander Barkov2019-05-151-5/+28
| | | | | |
| * | | | | 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
| | * | | | Merge 10.1 into 10.2Marko Mäkelä2019-04-251-0/+49
| | |\ \ \ \ | | | |/ / /
| | | * | | MDEV-14041 Server crashes in String::length on queries with functions and ROLLUPAlexander Barkov2019-04-221-0/+39
| | | | | |
| | | * | | MDEV-17830 Server crashes in Item_null_result::field_type upon SELECT with ↵Alexander Barkov2019-04-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | CHARSET(date) and ROLLUP
* | | | | | MDEV-8919 Wrong result for CAST(9999999999999999999.0)Alexander Barkov2019-05-171-0/+2
| | | | | |
* | | | | | Merge 10.3 into 10.4Marko Mäkelä2019-05-051-0/+7
|\ \ \ \ \ \ | |/ / / / /
| * | | | | MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warningAlexander Barkov2019-04-301-0/+7
| | | | | |
* | | | | | MDEV-19377 Replace Virtual_column_info::field_type to Type_handlerAlexander Barkov2019-05-011-1/+1
| | | | | |
* | | | | | MDEV-19245: Impossible WHERE should be noticed earlier after HAVING pushdownbb-10.4-galinaGalina Shalygina2019-04-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug appears because not all conditions are found to be knowingly true or false in WHERE after HAVING pushdown optimization. Impossible WHERE can be found much earlier compared with how it is done now. To fix it and_new_conditions_to_optimized_cond() is changed.
* | | | | | MDEV-19164 Assertion `fixed' failed in Item_func_inet_aton::val_intIgor Babaev2019-04-171-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When pushing a condition from HAVING into WHERE the function st_select_lex::pushdown_from_having_into_where() transforms column references in the pushed condition then performs cleanup of items of the condition and finally calls fix_fields() for the condition items. The cleanup is performed by a call of the method walk() with cleanup_processor as the first parameter. Unfortunately this sequence of calls does not work if the condition contains cached items, because fix_fields() cannot go through Item_cache items and this leaves underlying items unfixed. The solution of this problem used in this patch is just does not allow to process Item_cache objects when performing cleanup of the pushed condition. In order to let the traversal procedure walk() not to process Item_cache objects the third parameter of the used call of walk() is set to a fictitious pointer (void *) 1. And Item_cache::walk() is changed to prevent any action when it gets such value as the third parameter.
* | | | | | MDEV-19186: Assertion `field->table == table' failed in create_tmp_tableGalina Shalygina2019-04-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Temporary table is defined with the view field in HAVING. Item_direct_view_ref for this field is dropped and that causes error. To fix it Item_direct_view_ref::remove_item_direct_ref() is added.
* | | | | | MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_intGalina Shalygina2019-04-041-46/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug is caused by pushdown from HAVING into WHERE. It appears because condition that is pushed wasn't fixed. It is also discovered that condition pushdown from HAVING into WHERE is done wrong. There is no need to build clones for some conditions that can be pushed. They can be simply moved from HAVING into WHERE without cloning. build_pushable_cond_for_having_pushdown(), remove_pushed_top_conjuncts_for_having() methods are changed. It is found that there is no transformation made for fields of pushed condition. field_transformer_for_having_pushdown transformer is added. New tests are added. Some comments are changed.
* | | | | | MDEV-19125 Change Send_field::type from enum_field_types to Type_handler*Alexander Barkov2019-04-021-1/+1
| | | | | |
* | | | | | Merge 10.3 into 10.4Marko Mäkelä2019-04-021-1/+1
|\ \ \ \ \ \ | |/ / / / /
| * | | | | post-merge: -Werror fixes in 10.3Sergei Golubchik2019-03-291-1/+1
| | | | | |
* | | | | | MDEV-18240 Assertion `0' failed in Item_cache_timestamp::val_datetime_packedAlexander Barkov2019-04-021-2/+1
| | | | | |
* | | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-261-0/+7
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.2 into 10.3Marko Mäkelä2019-03-261-0/+7
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.1 into 10.2Marko Mäkelä2019-03-261-0/+7
| | |\ \ \ \ | | | |/ / /
| | | * | | MDEV-18968 Both (WHERE 0.1) and (WHERE NOT 0.1) return empty setAlexander Barkov2019-03-261-0/+7
| | | | | |
| | * | | | Backporting MDEV-15597 Add class Load_data_outvar and avoid using ↵Alexander Barkov2019-02-231-1/+44
| | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | 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.3 into 10.4Marko Mäkelä2019-03-221-0/+10
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-19008 Slow EXPLAIN SELECT ... WHERE col IN (const1,const2,(subquery))Alexander Barkov2019-03-221-0/+10
| | | | |
* | | | | MDEV-18876 Assertion `is_valid_time_slow()' failed in ↵Alexander Barkov2019-03-131-6/+1
| | | | | | | | | | | | | | | | | | | | Time::valid_MYSQL_TIME_to_valid_value
* | | | | MDEV-18408 Assertion `0' failed in Item::val_native_result / ↵Alexander Barkov2019-02-251-40/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon mysqld_list_fields after crash recovery The problem happened because Item_ident_for_show did not implement val_native(). Solution: - Removing class Item_ident_for_show - Implementing a new method Protocol::send_list_fields() instead, which accepts a List<Field> instead of List<Item> as input. Now no any Item creation is done during mysqld_list_fields(). Adding helper methods, to reuse the code easier: - Moved a part of Protocol::send_result_set_metadata(), responsible for sending an individual field metadata, into a new method Protocol_text::store_field_metadata(). Reusing it in both send_list_fields() and send_result_set_metadata(). - Adding Protocol_text::store_field_metadata() - Adding Protocol_text::store_field_metadata_for_list_fields() Note, this patch also automatically fixed another bug: MDEV-18685 mysql_list_fields() returns DEFAULT 0 instead of DEFAULT NULL for view columns The reason for this bug was that Item_ident_for_show::val_xxx() and get_date() did not check field->is_null() before calling field->val_xxx()/get_date(). Now the default value is correctly sent by Protocol_text::store(Field*).
* | | | | MDEV-7486: Condition pushdown from HAVING into WHEREIgor Babaev2019-02-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimized the code that removed multiple equalities pushed from HAVING into WHERE. Now this removal is postponed until all multiple equalities are eliminated in substitute_for_best_equal_field().