summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* 5.3->5.5 mergeSergei Golubchik2011-11-2272-965/+1985
|\
| * Fix bug lp:869036unknown2011-11-172-20/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apart from the fix, the patch also adds few more unrelated test cases for partial matching, and fixes few typos. Analysis: This bug uncovered that partial matching via rowid intersection didn't handle the case when: - the left IN argument has some NULLs, - there are no non-null value matches, and there is no non-null column, - the subquery columns that are not covered with the NULLs in the left IN argument contain at least one row, such that it has NULL values in all columns where the left IN operand has no NULLs. In this case there is a partial match. In addition the analysis of the related code uncovered incorrect handling of few other related cases. Solution: The solution for the bug is to check if there exists a row with NULLs in all columns other than the ones having NULL in the let IN operand. The check is implemented via checking whether the bitmaps that store NULL information in class Ordered_key have a non-empty intersection for the relevant columns. The intersection itself is implemented via the function bitmap_exists_intersection() in my_bitmap.c.
| * Fixed LP bug #887479.Igor Babaev2011-11-161-1/+1
| | | | | | | | | | | | | | The function setup_semijoin_dups_elimination erroneously assumed that if join_cache_level is set to 3 or 4 then the type of the access to a table cannot be JT_REF or JT_EQ_REF. This could lead to wrong query result sets.
| * Merge.Igor Babaev2011-11-152-1/+8
| |\
| | * Fixed LP bug #889750.Igor Babaev2011-11-152-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the optimizer switch 'semijoin_with_cache' is set to 'off' then join cache cannot be used to join inner tables of a semijoin. Also fixed a bug in the function check_join_cache_usage() that led to wrong output of the EXPLAIN commands for some test cases.
| * | Fix bug lp:889744unknown2011-11-141-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MariaDB 5.5 merges changes from MySQL 5.5 where all constant expressions are wrapped into an Item_cache. As a result, constant single-row subqueries were also wrapped in an Item_cache. When analyzing the where clause for constant expressions that can be evaluated during optimization, subqueries wrapped into an Item_cache did not appear as expensive, and were therefore evaluated during optimization. Such evaluation is against the current architecture of MariaDB 5.3 where subquries are executed during the execute phase. The patch adds the is_expensive() predicate to Item_cache. This makes Item_cache consistent with other wrapping Item classes that need to look at the properties of the wrapped object.
| * | Fix for LP BUG#824425: Prohibiting subqueries in rows for left part of ↵unknown2011-11-134-1/+12
| | | | | | | | | | | | | | | | | | IN/ALL/ANY Fix for walk() method of subqueries: always call the method on the subquery.
| * | 5.2->5.3 mergeSergei Golubchik2011-11-122-1/+3
| |\ \ | | |/ | |/|
| | * 5.1 mergeSergei Golubchik2011-11-121-1/+1
| | |\
| | | * typos fixedSergei Golubchik2011-11-081-1/+1
| | | | | | | | | | | | | | | | (thanks viva64.com)
| | * | Merge of gcc 4.6 fixesunknown2011-11-043-4/+6
| | |\ \
| | | * | Fix gcc 4.6 warning after merge with 5.1unknown2011-10-272-3/+3
| | | | |
| | | * | 5.1->5.2 merge (gcc 4.6 warnings and apple hwaddress fixes).unknown2011-10-271-1/+3
| | | |\ \ | | | | |/
| | | | * Fix gcc 4.6 warnings about assigned but not used variables.unknown2011-10-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fixed my_gethwaddr.c to allow compilation on Mac OS X.
| | * | | BUG#884184: Wrong result with RIGHT JOIN + derived_mergeSergey Petrunya2011-11-011-0/+2
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make eliminate_tables_for_list() take into account that it is not possible to eliminate a table if it is used in the upper-side ON expressions. Example: xxx JOIN (t1 LEFT JOIN t2 ON cond ) ON func(t2.columns) Here it would eliminate t2 which is not possible because of use of t2.columns.
| * | | Merge.Igor Babaev2011-11-121-12/+16
| |\ \ \
| | * | | Fixed LP bug #823301.Igor Babaev2011-11-121-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bug in the code of the function key_or could lead to a situation when performing of an OR operation for one index changes the result the operation for another index. This bug is fixed with this patch. Also corrected the specification and the code of the function or_sel_tree_with_checks.
| * | | | Fix MySQL BUG#12329653unknown2011-11-126-66/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MariaDB, when running in ONLY_FULL_GROUP_BY mode, the server produced in incorrect error message that there is an aggregate function without GROUP BY, for artificially created MIN/MAX functions during subquery MIN/MAX optimization. The fix introduces a way to distinguish between artifially created MIN/MAX functions as a result of a rewrite, and normal ones present in the query. The test for ONLY_FULL_GROUP_BY violation now tests in addition if a MIN/MAX function was part of a MIN/MAX subquery rewrite. In order to be able to distinguish these MIN/MAX functions, the patch introduces an additional flag in Item_in_subselect::in_strategy - SUBS_STRATEGY_CHOSEN. This flag is set when the optimizer makes its final choice of a subuqery strategy. In order to make the choice consistent, access to Item_in_subselect::in_strategy is provided via new class methods. ****** Fix MySQL BUG#12329653 In MariaDB, when running in ONLY_FULL_GROUP_BY mode, the server produced in incorrect error message that there is an aggregate function without GROUP BY, for artificially created MIN/MAX functions during subquery MIN/MAX optimization. The fix introduces a way to distinguish between artifially created MIN/MAX functions as a result of a rewrite, and normal ones present in the query. The test for ONLY_FULL_GROUP_BY violation now tests in addition if a MIN/MAX function was part of a MIN/MAX subquery rewrite. In order to be able to distinguish these MIN/MAX functions, the patch introduces an additional flag in Item_in_subselect::in_strategy - SUBS_STRATEGY_CHOSEN. This flag is set when the optimizer makes its final choice of a subuqery strategy. In order to make the choice consistent, access to Item_in_subselect::in_strategy is provided via new class methods.
| * | | | Fixed LP bug #879871. Igor Babaev2011-11-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function add_ref_to_table_cond missed updating the value of join_tab->pre_idx_push_select_cond after having updated the value of join_tab->select->pre_idx_push_select_cond.
| * | | | BUG#887026: Wrong result with ICP, outer join, subquery in maria-5.3-icpSergey Petrunya2011-11-072-16/+26
| | | | | | | | | | | | | | | | | | | | - Do not push index condition if we're using a triggered ref access.
| * | | | Merge.Igor Babaev2011-11-0612-41/+61
| |\ \ \ \
| | * | | | Fixed that test doesn't abort if 'var' points to a deleted directory (common ↵Michael Widenius2011-11-041-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | case when using --mem) Better error message if --log-bin is used without --log-bin-index mysql-test/lib/v1/mysql-test-run.pl: Fixed that test doesn't abort if 'var' points to a deleted directory (common case when using --mem) sql/mysqld.cc: Better error message if --log-bin is used without --log-bin-index
| | * | | | rename binlog_dbug_fsync_sleep -> debug_binlog_fsync_sleepSergei Golubchik2011-11-034-20/+12
| | | | | |
| | * | | | MergeSergey Petrunya2011-11-021-4/+9
| | |\ \ \ \
| | | * | | | BUG#878753: Assertion '0' failed in replace_where_subcondition with ↵Sergey Petrunya2011-11-021-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | derived_merge - Remove the assert in replace_where_subcondition (the patch has explanation why)
| | * | | | | MergeSergey Petrunya2011-11-022-4/+7
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Change the default @@optimizer_switch settings:Sergey Petrunya2011-11-022-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - semijoin=on - firstmatch=on - loosescan=on
| | * | | | | Merge of LP BUG#872775 fixunknown2011-11-027-4/+22
| | |\ \ \ \ \ | | | |/ / / / | | |/| | | |
| | | * | | | Fix of LP BUG#872775.unknown2011-11-017-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that merged views has its own nest_level numbering => when we compare nest levels we should take into considiration basis (i.e. 0 level), if it is different then nest levels are not comparable.
| * | | | | | Fixed LP bug #886145.Igor Babaev2011-11-062-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug happened because in some cases the function JOIN::exec did not save the value of TABLE::pre_idx_push_select_cond in TABLE::select->pre_idx_push_select_cond for the sort table. Noticed and fixed a bug in the function make_cond_remainder that builds the remainder condition after extraction of an index pushdown condition from the where condition. The code erroneously assumed that the function make_cond_for_table left the value of ICP_COND_USES_INDEX_ONLY in sub-condition markers. Adjusted many result files from the regression test suite after this fix .
| * | | | | | Fixed LP bug #885168.Igor Babaev2011-11-042-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The call of the virtual function cancel_pushed_idx_cond in the code of the function test_if_skip_sort_order was misplaced when backporting the fix for bug 58816.
| * | | | | | Merge.Igor Babaev2011-11-025-4/+11
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Fix bug lp:833702unknown2011-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Analysis: Equality propagation propagated the constant '7' into args[0] of the Item_in_optimizer that stands for the "< ANY" predicate. At the same the min/max subquery rewrite swapped the order of the left and right operands of the "<" predicate, but used Item_in_subselect::left_expr. As a result, when the <ANY predicate is executed early in the execution phase as a contant condition, instead of a constant right (swapped) argument of the < predicate, there was a field (t3.a). This field had no data, since the whole predicate is considered constant, and it is evaluated before any tables are read. Having junk in the field row buffer produced wrong result Solution: Fix create_swap to pick the correct Item_in_optimizer left argument.
| | * | | | | Fix of typo.unknown2011-11-011-1/+1
| | | | | | |
| | * | | | | BUG#884631: Table elimination works 5.3 release builds even if turned offSergey Petrunya2011-11-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make table elimination to actually switch itself on/off in release builds.
| | * | | | | BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keysSergey Petrunya2011-10-312-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The bug was caused by the following scenario: = a quick select is created with get_quick_select_for_ref. The quick select refers to temporary (derived) table. It saves table->file, which refers to a ha_heap object. = When temp table is populated, ha_heap reaches max. size and is converted to a ha_myisam. However, quick->file remains pointing to where ha_heap was. = Attempt to use the quick select causes crash. - Fixed by introducing QUICK_SELECT_I::replace_handler(). Note that it will not work for index_merge quick selects. Which is fine, because these quick selects are never created for derived tables.
| * | | | | | Backported the fix and the test case for bug 12822678 from the mysql-5.6 ↵Igor Babaev2011-11-012-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | code line. Fixed a bug in select_describe. Adjusted results for affected test cases.
| * | | | | | Backported the fix and the test case for bug #58816 from mysql-5.6 code line.Igor Babaev2011-10-293-0/+14
| | | | | | |
| * | | | | | Merge.Igor Babaev2011-10-281-1/+1
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | - Let t/myisam_icp.test run include/icp_tests.inc with MRR/ICP turned ON ↵Sergey Petrunya2011-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (not OFF) - Fix the compile-time-default value of optimizer_switch printed by mysqld --help --defaults
| * | | | | | Merge.Igor Babaev2011-10-283-33/+45
| |\ \ \ \ \ \ | | |/ / / / / | |/| | | | |
| | * | | | | Applied the patch for bug 58837 (for the mysql-5.6 code line).Igor Babaev2011-06-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixed the crash in innodb_bug59307.
| | * | | | | Merge.Igor Babaev2011-06-012-33/+43
| | |\ \ \ \ \
| | | * | | | | Backported the test case for bug 43617 fixed by the patch for bug 42580.Igor Babaev2011-05-271-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backported the test case for bug 49906 fixed by the patch for LP bug 625841. Slightly optimized the code of the fix for LP bug 625841.
| | | * | | | | Downported InnoDB support of Index Condition Pushdown from MySQL-5.6 code line.Igor Babaev2011-05-251-27/+38
| | | | | | | |
| * | | | | | | Merge.Igor Babaev2011-10-271-1/+5
| |\ \ \ \ \ \ \
| | * | | | | | | Fixed LP bug #874035.Igor Babaev2011-10-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function Item_direct_view_ref::fix_fields erroneously did not correct the value of the flag maybe_null when the view for which the item was being fixed happened to be an inner table of an outer join.
| * | | | | | | | BUG#882472: subselect4.test fails in current 5.3Sergey Petrunya2011-10-274-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The problem was that the value of READ_RECORD::file was not updated when the underlying table was temporary and was converted from heap to myisam. Resolved by eliminating READ_RECORD::file, always use READ_RECORD::table->file
| * | | | | | | | Fixed lp:879939 "assertion in ha_maria::enable_indexes with ↵Michael Widenius2011-10-264-3/+27
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | derived_with_keys=on" Honor unique/not unique when creating keys for internal tempory tables. Added new variables to be used to limit how keys are created for internal temporary tables. include/maria.h: Added maria_max_key_length() and maria_max_key_segments() include/myisam.h: Added myisam_max_key_length() and myisam_max_key_segments() mysql-test/r/mysql.result: Drop all used tables mysql-test/r/subselect4.result: Added test case for lp:879939 mysql-test/t/mysql.test: Drop all used tables mysql-test/t/subselect4.test: Added test case for lp:879939 sql/mysql_priv.h: Added internal_tmp_table_max_key_length and internal_tmp_table_max_key_segments to be used to limit how keys for derived tables are created. sql/mysqld.cc: Added internal_tmp_table_max_key_length and internal_tmp_table_max_key_segments to be used to limit how keys for derived tables are created. sql/share/errmsg.txt: Added new error message for internal errors sql/sql_select.cc: Give error if we try to create a wrong key (this error should never happen) Honor unique/not unique when creating keys for internal tempory tables. storage/maria/ha_maria.cc: Added change_table_ptr() to ensure that external_ref points always to the correct table. (Not having this caused an assert in the included test) storage/maria/ha_maria.h: Added change_table_ptr() to ensure that external_ref points always to the correct table. storage/maria/ma_check.c: Fixed bug in Duplicate key error printing (now row position is printed correctly) storage/maria/ma_create.c: maria_max_key_length() -> _ma_max_key_length() storage/maria/ma_info.c: Added extern function maria_max_key_length() to calculate the max key length based on current block size. storage/maria/ma_open.c: maria_max_key_length() -> _ma_max_key_length() storage/maria/maria_def.h: maria_max_key_length() -> _ma_max_key_length() storage/myisam/ha_myisam.cc: Added change_table_ptr() to ensure that external_ref points always to the correct table. (Not having this caused an assert in the included test) storage/myisam/ha_myisam.h: Added change_table_ptr() to ensure that external_ref points always to the correct table.
| * | | | | | | Fixed LP bug #881449.Igor Babaev2011-10-261-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function SELECT_LEX::update_used_tables first must clean up all bitmaps to be recalculated for all tables that require it and only after this walk through on conditions attached to the tables to update these bitmaps.