summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* fix the build and compiler warnings (few of which were real bugs)Sergei Golubchik2011-10-294-11/+7
| | | | for "cmake ." builds
* fixes for sys_vars and pbxt suitesSergei Golubchik2011-10-282-2/+2
|
* Post-merge fixes: Fix problems in table_elim.test and enable it.Sergey Petrunya2011-10-272-7/+21
|
* Post-merge fixes:Sergey Petrunya2011-10-242-3/+9
| | | | | | - Fix derived_view.test to work, and enable it - Let subselect*.test do "DROP TABLE IF EXISTS" before they attempt to create the table.
* Sergey Petrunya fixes for subselect* tests,Sergei Golubchik2011-10-221-3/+7
| | | | and other misc test fixes
* fixes for windowsSergei Golubchik2011-10-213-2/+3
|
* bugfix: query cache was using incorrect wait flagSergei Golubchik2011-10-191-2/+2
|
* bugfix: progress reporting and sub-statementsSergei Golubchik2011-10-192-5/+13
| | | | | (a stored function or TRIGGER, that runs LOAD DATA, which, itself, invokes another trigger, that also does LOAD DATA, etc).
* don't forget to call ha_index_end before destroying the handlerSergei Golubchik2011-10-191-1/+2
|
* with introduction of progress reporting, max error number is 65534Sergei Golubchik2011-10-191-3/+4
|
* bugfix: delay_key_write=ALL cannot be turned offSergei Golubchik2011-10-191-0/+2
|
* cleanupsSergei Golubchik2011-10-196-13/+7
|
* safe_mutex deadlock detector post-merge fixesSergei Golubchik2011-10-193-10/+11
|
* Id column in EXPLAIN can be null.Sergei Golubchik2011-10-191-1/+2
|
* merge with 5.3Sergei Golubchik2011-10-19169-14853/+35286
|\ | | | | | | | | | | | | | | | | | | | | | | | | sql/sql_insert.cc: CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. ****** CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. sql/sql_table.cc: small cleanup ****** small cleanup
| * lp:822760 Wrong result with view + invalid datesSergei Golubchik2011-08-221-1/+1
| | | | | | | | | | sql/sql_select.cc: items' cmp_type()'s must match, not result_type()'s
| * Fixed LP bug #826279.Igor Babaev2011-08-191-2/+12
| | | | | | | | | | | | | | | | | | When the WHERE/HAVING condition of a subquery has been transformed by the optimizer the pointer stored the 'where'/'having' field of the SELECT_LEX structure used for the subquery must be updated accordingly. Otherwise the pointer may refer to an invalid item. This can lead to the reported assertion failure for some queries with correlated subqueries
| * Fix bug lp:813473unknown2011-08-173-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug is a duplicate of MySQL's Bug#11764086, however MySQL's fix is incomplete for MariaDB, so this fix is slightly different. In addition, this patch renames Item_func_not_all::top_level() to is_top_level_item() to make it in line with the analogous methods of Item_in_optimizer, and Item_subselect. Analysis: It is possible to determine whether a predicate is NULL-rejecting only if it is a top-level one. However, this was not taken into account for Item_in_optimizer. As a result, a NOT IN predicate was erroneously considered as NULL-rejecting, and the NULL-complemented rows generated by the outer join were rejected before being checked by the NOT IN predicate. Solution: Change Item_in_optimizer to be considered as NULL-rejecting only if it a top-level predicate.
| * field_conv.cc: added commentsSergey Petrunya2011-08-172-1/+15
| | | | | | | | | | | | opt_range.cc: modified print_key() so that it doesn't do memory re-allocs when printing multipart keys over varchar columns. When it did, key printout in debug trace was interrupted with my_malloc/free printouts.
| * MergeSergey Petrunya2011-08-171-1/+6
| |\
| | * BUG#826935 Assertion `!table || (!table->read_set || ↵Sergey Petrunya2011-08-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap_is_set(table->read_set, field_index))' failed - add_ref_to_table_cond() should not just overwrite pre_idx_push_select_cond with the contents tab->select_cond. pre_idx_push_select_cond exists precisely for the reason that it may contain a condition that is a strict superset of what is in tab->select_cond. The fix is to inject generated equality into pre_idx_push_select_cond.
| * | Fixed LP bug #825035.Igor Babaev2011-08-165-0/+10
| | | | | | | | | | | | | | | | | | The value of maybe_null flag should be saved for the second execution of a prepared statement from SELECT that uses an outer join.
| * | MergeSergey Petrunya2011-08-161-0/+12
| |\ \ | | |/
| | * BUG#818280: crash in do_copy_not_null() in maria-5.3 with semijoinSergey Petrunya2011-08-161-0/+12
| | | | | | | | | | | | | | | - Make simplify_joins() set maybe_null=FALSE for tables that were on the inner sides of inner joins and then were moved to the inner sides of semi-joins.
| * | Automatic merge with 5.2Michael Widenius2011-08-165-11/+26
| |\ \ | | |/ | |/|
| | * Fixed build failure in embedded library regarding that ↵Michael Widenius2011-08-162-1/+3
| | | | | | | | | | | | decrease_user_connections() was not declared
| | * Fixed bug that MAX_USER_CONNECTIONS was not working properly in all ↵Michael Widenius2011-08-164-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | situations (which could cause aborted connects) thd->user_connect is now handled in thd->clenup() which will ensure that it works in all context (including slaves). I added also some DBUG_ASSERT() to ensure that things are working correctly. sql/sql_acl.cc: Reset thd->user_connect on failed check_for_max_user_connections() to ensure we don't decrement value twice. Removed not needed call to decrease_user_connections() as thd->cleanup() will now do it. sql/sql_class.cc: Call decrease_user_connections() in thd->cleanup() sql/sql_connect.cc: Ensure we don't allocate thd->user_connect twice. Simplify check_for_max_user_connections(). sql/sql_parse.cc: Ensure that thd->user_connect is handled properly in for 'change_user' command.
| * | Early check of subquery cache hit rate added to limit its performance impact ↵unknown2011-08-122-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the worst case. sql/sql_expression_cache.cc: Early check of subquery cache hit rate added to limit its performance impact in the worst case. Disabling cache moved to method. sql/sql_expression_cache.h: Disabling cache moved to method.
| * | Protect statistic variables of subquery cache.unknown2011-08-121-2/+5
| | |
| * | Fixed LP bug #823189.Igor Babaev2011-08-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The method Item_ref::not_null_tables() returned incorrect bitmap for outer references to view columns. This could cause an invalid conversion of an outer join into an inner join that could lead to a wrong result set for a query with a correlated subquery over an outer join whose where condition had an outer reference to a view.
| * | Fixed LP bug #823826.Igor Babaev2011-08-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The method Item_func_isnull::update_used_tables() erroneously did not update cached values stored in the fields used_tables_cache and const_item_cache of the Item_func_isnull objects. As a result the Item_func_isnull::used_tables() returned wrong bitmaps and, as a consequence, push-down predicates could be attached to wrong tables.
| * | Fix bug lp:817384unknown2011-08-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug is a special case of lp:813447. Analysis: Constant optimization finds that the condition t2.a = 1 can be used to access the primary key of table 't2'. As a result both outer table t1,t2 are considered as constant when we reach the execution phase. At the same time, during constant optimization, the IN predicate is not evaluated because it is expensive. When execution of the outer query reaches do_select(), control flow enter the branch: if (join->table_count == join->const_tables) { ... } This branch checks only the WHERE and HAVING clauses, but doesn't check the ON clauses of the query. Since the IN predicate was not evaluated during optimization, it is not evaluated at all, thus execution doesn't detect that the ON clause is FALSE. Solution: Similar to the patch for bug lp:813447, exclude system tables from constant substitution based on unique key lookups if there is an expensive ON condition on the inner table.
| * | Fixed LP bug #819716.Igor Babaev2011-08-081-1/+1
| | | | | | | | | | | | Do not optimize derived table for the second time ever.
| * | Merge fix for BUG#822134Sergey Petrunya2011-08-091-7/+36
| |\ \
| | * | BUG#822134: Invalid plan and wrong result set for Q20 from DBT3 benchmark setSergey Petrunya2011-08-091-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - create_ref_for_key() has the code that walks KEYUSE array and tries to use maximum number of keyparts for ref (and eq_ref and ref_or_null) access. When one constructs ref access for table that is inside a SJ-Materialization nest, it is not possible to use tables that are ouside the nest (because materialization is performed before they have any "current value"). The bug was caused by this function not taking this into account.
| * | | MergeSergey Petrunya2011-08-051-161/+459
| |\ \ \ | | |/ /
| | * | Backport of:Sergey Petrunya2011-08-051-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | revno: 2876.47.174 revision-id: jorgen.loland@oracle.com-20110519120355-qn7eprkad9jqwu5j parent: mayank.prasad@oracle.com-20110518143645-bdxv4udzrmqsjmhq committer: Jorgen Loland <jorgen.loland@oracle.com> branch nick: mysql-trunk-11765831 timestamp: Thu 2011-05-19 14:03:55 +0200 message: BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER AWAY QUALIFYING ROWS The problem was that the ranges created when OR'ing two conditions could be incorrect. Without the bugfix, "I <> 6 OR (I <> 8 AND J = 5)" would create these ranges: "NULL < I < 6", "6 <= I <= 6 AND 5 <= J <= 5", "6 < I < 8", "8 <= I <= 8 AND 5 <= J <= 5", "8 < I" While the correct ranges is "NULL < I < 6", "6 <= I <= 6 AND 5 <= J <= 5", "6 < I" The problem occurs when key_or() ORs (1) "NULL < I < 6, 6 <= I <= 6 AND 5 <= J <= 5, 6 < I" with (2) "8 < I AND 5 <= J <= 5" The reason for the bug is that in key_or(), SEL_ARG *tmp is used to point to the range in (1) above that is merged with (2) while key1 points to the root of the red-black tree of (1). When merging (1) and (2), tmp refers to the "6 < I" part whereas the root is the "6 <= ... AND 5 <= J <= 5" part. key_or() decides that the tmp range needs to be split into "6 < I < 8, 8 <= I <= 8, 8 < I", in which next_key_part of the second range should be that of tmp. However, next_key_part is set to key1->next_key_part ("5 <= J <= 5") instead of tmp->next_key_part (empty). Fixing this gives the correct but not optimal ranges: "NULL < I < 6", "6 <= I <= 6 AND 5 <= J <= 5", "6 < I < 8", "8 <= I <= 8", "8 < I" A second problem can be seen above: key_or() may create adjacent ranges that could be replaced with a single range. Fixes for this is also included in the patch so that the range above becomes correct AND optimal: "NULL < I < 6", "6 <= I <= 6 AND 5 <= J <= 5", "6 < I" Merging adjacent ranges like this gives a slightly lower cost estimate for the range access.
| | * | Backport of:Sergey Petrunya2011-08-041-160/+407
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | revno: 3363.3.16 revision-id: jorgen.loland@oracle.com-20110506132631-5wickj6dvrh1dpj6 parent: alexander.nozdrin@oracle.com-20110506132138-46459va9vcbd4nz0 committer: Jorgen Loland <jorgen.loland@oracle.com> branch nick: mysql-trunk-11765831 timestamp: Fri 2011-05-06 15:26:31 +0200 message: BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER AWAY QUALIFYING ROWS Preparation patch (does not include fix for the bug): * Extensively document key_or() * Remove tab indentations from key_or() * Minor code changes like using existing utility functions in key_or()
| * | | Limit query length in error log to 64K, to avoid output of full blobsVladislav Vaintroub2011-08-031-1/+1
| | | |
| * | | Enhance crash reporting. Fix Vladislav Vaintroub2011-08-031-1/+2
| |/ / | | | | | | | | | | | | LPBug#819711 : optimizer_switch must be reported on segfault LPBug#820169: Full query text must be reported on crash
| * | Fixed LP bug #817360.Igor Babaev2011-07-291-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This problem could be observed for queries with nested outer joins for which the not_exist optimization were applicable. The problem was caused by the code of the patch for bug #49322 that erroneously forced the return to the previous nested loop level when the join algorithm successfully builds a partial record for an embedded outer to which the not_exist optimization could be applied. Actually the immediate return to the previous nested loops level is correct only if this partial record is rejected by a predicate pushed down to one of the inner tables of this outer join. Otherwise attempts to find extensions of this record must be made.
| * | Subquery cache going on disk management fix: Do not go on disk if hit rate ↵unknown2011-07-282-6/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is not good. sql/sql_expression_cache.cc: Do not go on disk if hit rate is not good. Local hit/miss counters added. sql/sql_expression_cache.h: Local hit/miss counters added.
| * | Fixed a crash with pbxt.subselect when 'derived_merge' is set off inIgor Babaev2011-07-221-1/+1
| | | | | | | | | | | | | | | the optimizer switch.
| * | Merge.Igor Babaev2011-07-212-4/+2
| |\ \
| | * | Made the optimizer switches 'derived_merge' and 'derived_with_keys'Igor Babaev2011-07-212-4/+2
| | | | | | | | | | | | | | | | | | | | off by default.
| * | | Fix for LP BUG#806071unknown2011-07-212-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of two views with subqueries it is dificult to decide about order of injected ORDER BY clauses. A simple solution is just prohibit ORDER BY injection if there is other order by. mysql-test/r/view.result: New test added, old test changed. mysql-test/t/view.test: New test aded. sql/share/errmsg.txt: new warning added. sql/sql_view.cc: Inject ORDER BY only if there is no other one. Warning about ignoring ORDER BY in this case for EXPLAIN EXTENDED.
| * | | BUG#803457: Wrong result with semijoin + view + outer join in ↵Sergey Petrunya2011-07-211-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | maria-5.3-subqueries-mwl90 - Correct handling of outer joins + DuplicateWeedout (docs pending)
| * | | Merge from 5.2unknown2011-07-217-36/+40
| |\ \ \ | | | |/ | | |/|
| | * | Merge 5.1->5.2unknown2011-07-215-15/+27
| | |\ \
| | | * | Removed incorrect fix and its test suite (the test suit is duplicate).unknown2011-07-212-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed explains of previous patch. mysql-test/r/explain.result: Fixed explains of previous patch. mysql-test/r/join_outer.result: Fixed explains of previous patch. mysql-test/r/negation_elimination.result: Fixed explains of previous patch. mysql-test/r/view.result: Fixed explains of previous patch. mysql-test/suite/innodb/r/innodb_mysql.result: Removed duplicate test suite. mysql-test/suite/innodb/t/innodb_mysql.test: Removed duplicate test suite. mysql-test/suite/innodb_plugin/r/innodb_mysql.result: Removed duplicate test suite. mysql-test/suite/innodb_plugin/t/innodb_mysql.test: Removed duplicate test suite. sql/opt_range.h: Removed incorrect fix. sql/records.cc: Removed incorrect fix.