summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_sj.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.1 into 10.2Marko Mäkelä2019-10-251-0/+26
|\
| * Merge branch 'github/5.5' into 10.1Sergei Golubchik2019-10-231-0/+26
| |\
| | * MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)bb-5.5-MDEV-13172Oleksandr Byelkin2019-10-151-0/+26
| | | | | | | | | | | | | | | | | | IS NULL or <=> with unique field does not mean unique row, because several NULL possible, so we can not convert to normal join in this case.
* | | Updated mtr files to support different compiled in optionsMonty2019-09-011-21/+22
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows one to run the test suite even if any of the following options are changed: - character-set-server - collation-server - join-cache-level - log-basename - max-allowed-packet - optimizer-switch - query-cache-size and query-cache-type - skip-name-resolve - table-definition-cache - table-open-cache - Some innodb options etc Changes: - Don't print out the value of system variables as one can't depend on them to being constants. - Don't set global variables to 'default' as the default may not be the same as the test was started with if there was an additional option file. Instead save original value and reset it at end of test. - Test that depends on the latin1 character set should include default_charset.inc or set the character set to latin1 - Test that depends on the original optimizer switch, should include default_optimizer_switch.inc - Test that depends on the value of a specific system variable should set it in the test (like optimizer_use_condition_selectivity) - Split subselect3.test into subselect3.test and subselect3.inc to make it easier to set and reset system variables. - Added .opt files for test that required specfic options that could be changed by external configuration files. - Fixed result files in rockdsb & tokudb that had not been updated for a while.
* | Merge 5.5 into 10.1Marko Mäkelä2019-05-281-0/+2
|\ \ | |/
| * MDEV-18896 Crash in convert_join_subqueries_to_semijoins : CorrectionIgor Babaev2019-05-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch complements the original patch for MDEV-18896 that prevents conversions to semi-joins in tableless selects used in INSERT statements in post-5.5 versions of the server. The test case was corrected as well to ensure that potential conversion to jtbm semi-joins is also checked (the problem was that one of the preceeding testcases in subselect_sj.test did not restore the state of the optimizer switch leaving the 'materialization' in the state 'off' and so blocking this check). Noticed an inconsistency in the state of select_lex::table_list used in INSERT statements and left a comment about this.
* | Merge 10.0 into 10.1Marko Mäkelä2019-03-211-0/+10
|\ \
| * \ Merge 5.5 into 10.0Marko Mäkelä2019-03-211-0/+10
| |\ \ | | |/
| | * MDEV-18896 Crash in convert_join_subqueries_to_semijoinsIgor Babaev2019-03-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an IN-subquery is used in a table-less select the current code should never consider it as candidate for semi-join optimizations. Yet the function check_and_do_in_subquery_rewrites() improperly checked the property "to be a table-less select". As a result such select in IN subquery was used in INSERT .. SELECT then the IN subquery by mistake was registered as a semi-join subquery and convert_subq_to_sj() was called for it. However the code of this function does not assume that the parent select of the subquery could be a table-less select.
* | | Merge branch '10.0' into 10.1Sergei Golubchik2018-05-051-0/+30
|\ \ \ | |/ /
| * | Merge branch '5.5' into 10.0Sergei Golubchik2018-04-291-0/+30
| |\ \ | | |/
| | * MDEV-13699: Assertion `!new_field->field_name.str || ↵Oleksandr Byelkin2018-04-251-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | strlen(new_field->field_name.str) == new_field->field_name.length' failed in create_tmp_table on 2nd execution of PS with semijoin The problem was that SJ (semi-join) used secondary list (array) of subquery select list. The items there was prepared once then cleaned up (but not really freed from memory because it was made in statement memory). Original list was not prepared after first execution because select was removed by conversion to SJ. The solution is to use original list but prepare it first.
* | | Merge 10.0 into 10.1Marko Mäkelä2017-05-231-0/+40
|\ \ \ | |/ /
| * | Merge branch '5.5' into 10.0mariadb-10.0.31Sergei Golubchik2017-05-201-0/+40
| |\ \ | | |/
| | * Fixed the bug mdev-12817/mdev-12820.Igor Babaev2017-05-171-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a correction of the patch for bug mdev-12670. With the current code handling semi-joins the following must be taken into account. Conversion of an IN subquery predicate into semi-join has to be blocked if the predicate occurs: (a) in the ON expression of an outer join (b) in the ON expression of an inner join embedded directly or indirectly in the inner nest of an outer join. The patch for mdev-12670 blocked conversion to semi-joins only in the case (a), but not in the case (b). This patch blocks the conversion in both cases.
* | | Merge 10.0 into 10.1Marko Mäkelä2017-05-201-0/+32
|\ \ \ | |/ / | | | | | | | | | | | | Significantly reduce the amount of InnoDB, XtraDB and Mariabackup code changes by defining pfs_os_file_t as something that is transparently compatible with os_file_t.
| * | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2017-05-171-0/+32
| |\ \ | | |/
| | * Fixed the bugs mdev-12670 and mdev-12675.Igor Babaev2017-05-091-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | The code that blocked conversion of a IN subselect pedicate to a semi-join if it occurred in the ON expression of an outer join did not do it correctly. As a result, the conversion was blocked for IN subselect predicates encountered in ON expressions of INNER joins or in WHERE conditions of mergeable views / derived tables. This patch fixes this problem.
* | | Merge branch '10.0' into 10.1Sergei Golubchik2016-02-231-0/+69
|\ \ \ | |/ /
| * | Merge branch '5.5' into 10.0Sergei Golubchik2016-02-151-0/+69
| |\ \ | | |/
| | * MDEV-6859: scalar subqueries in a comparison produced unexpected resultSergei Petrunia2016-02-091-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When one evaluates row-based comparison like (X, Y) = (A,B), one should first call bring_value() for the Item that returns row value. If you don't do that and just attempt to read values of X and Y, you get stale values. Semi-join/Materialization can take a row-based comparison apart and make ref access from it. In that case, we need to call bring_value() to get the index lookup components.
| | * MDEV-7823: Server crashes in next_depth_first_tab on nested IN clauses with ↵Sergei Petrunia2016-02-091-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SQ inside Consider a query with subquery in form t.key=(select ...). Suppose, the parent query uses this equality for ref access. It will attempt to evaluate the subquery in get_best_combination(), right before the join->join_tab[...] array is filled. The problem was that subquery optimization will attempt to look at parent's join->join_tab to check how many times subquery will be executed (and crash). Fixed by not doing that when the subquery is constant (non-constant subqueries are only be evaluated during join execution, so they are not affected)
* | | MDEV-6066: Merge new defaults from 5.6 and 5.7 (defaults changed, QC can be ↵Oleksandr Byelkin2015-09-041-1/+1
|/ / | | | | | | stopped with no-zero size)
* | Merge branch '5.5' into 10.0Sergei Golubchik2015-05-041-0/+11
|\ \ | |/
| * MDEV-7911: crash in Item_cond::eval_not_null_tablesSergei Petrunia2015-04-211-0/+11
| | | | | | | | | | | | convert_subq_to_sj() must check the results of in_equality->fix_fields() call. It can fail in a meaningful way when e.g. we're trying to compare columns with incompatible collations.
* | Fixed bug mdev-6071.Igor Babaev2014-06-101-0/+4
| | | | | | | | | | | | | | | | The method JOIN_CACHE::init may fail (return 1) if some conditions on the used join buffer is not satisfied. For example it fails if join_buffer_size is greater than join_buffer_space_limit. The conditions should be checked when running the EXPLAIN command for the query. That's why the method JOIN_CACHE::init has to be called for EXPLAIN commands as well.
* | MDEV-6153 Trivial Lintian errors in MariaDB sources: spelling errors and ↵Sergei Golubchik2014-05-131-2/+2
|/ | | | wrong executable bits
* 5.3 mergeSergei Golubchik2014-02-221-0/+18
|\
| * MDEV-5581: Server crashes in in JOIN::prepare on 2nd execution of PS with ↵Sergey Petrunya2014-02-151-0/+19
| | | | | | | | | | | | | | | | | | | | | | materialization+semijoin - The problem was that JOIN::prepare() tried to set TABLE::maybe_null for a table in join. Non-merged semi-join tables 1) are present as join's base tables on second EXECUTE, but 2) do not yet have a TABLE object. Worked around the problem by putting mixed_implicit_grouping into JOIN object, and then passing it to JTBM tables in setup_jtbm_semi_joins().
* | MDEV-5349: Test main.subselect_sj_jcl6 fails sporadically due to ↵Sergey Petrunya2013-12-301-0/+1
| | | | | | | | | | | | insufficient ordering - Add --sorted_result to the query
* | MDEV-5059: Wrong result (missing row) wih semijoin, join_cache_level > 2, ↵Sergey Petrunya2013-11-211-2/+29
| | | | | | | | | | | | LEFT JOIN, ORDER BY - Added testcase
* | MDEV-5161: Wrong result (missing rows) with semijoin, LEFT JOIN, ORDER BY, ↵Sergey Petrunya2013-11-211-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | constant table - Don't pull out a table out of a semi-join if it is on the inner side of an outer join. - Make join->sort_by_table= get_sort_by_table(...) call after const table detection is done. That way, the value of join->sort_by_table will match the actual execution. Which will allow the code in setup_semijoin_dups_elimination() (search for "Make sure that possible sorting of rows from the head table is not to be employed." to see that "Using filesort" is going to be used together with Duplicate Elimination ( and change it to Using temporary + Using filesort)
* | mdev-4173: Wrong result (extra row) with semijoin=on, joins in outer query, ↵Sergey Petrunya2013-07-161-0/+38
| | | | | | | | | | | | | | | | | | | | LEFT JOIN in the subquery Apply the patch from Patryk Pomykalski: - create_internal_tmp_table_from_heap() will now return information whether the last row that we tried to write was a duplicate row. (mysql-5.6 also has this change)
* | MDEV-4071: Valgrind warnings 'Invalid read' in ↵Sergey Petrunya2013-05-041-0/+17
| | | | | | | | | | | | | | | | | | subselect_engine::calc_const_tables with ... - Call tmp_having->update_used_tables() *before* we have call JOIN::cleanup(). Making the call after join::cleanup() is not allowed, because subquery predicate items walk parent join's JOIN_TAB structures. Which can be invalidated by JOIN::cleanup().
* | MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4 ...Sergey Petrunya2013-05-041-0/+27
| | | | | | | | - Added testcase
* | Merge 5.3 -> 5.5Sergey Petrunya2013-04-031-0/+9
|\ \ | |/
| * MDEV-4335: Unexpected results when selecting on information_schemaSergey Petrunya2013-03-291-0/+7
| | | | | | | | | | - When converting a subquery to a semi-join, propagate OPTION_SCHEMA_TABLE.
* | 5.3 mergeSergei Golubchik2013-01-281-0/+19
|\ \ | |/
| * The problem was that expression with field after transformation (on the ↵unknown2013-01-251-0/+20
| | | | | | | | | | | | | | | | | | | | first execution) reached by fix_fields() (via reference) before row which it belongs to (on the second execution) and fix_field for row did not follow usual protocol for Items with argument (first check that the item fixed then call fix_fields). Item_row::fix_field fixed.
* | backport a test case for a 5.5 bug fix from the 5.6 treeSergei Golubchik2013-01-151-0/+50
|/
* BUG#1002630: Valgrind warnings 'Invalid read' in ↵Sergey Petrunya2012-05-251-0/+17
| | | | | | | | subselect_engine::calc_const_tables with SELECT - In JOIN::exec(), make the having->update_used_tables() call before we've made the JOIN::cleanup(full=true) call. The latter frees SJ-Materialization structures, which correlated subquery predicate items attempt to walk afterwards.
* BUG#998236: Assertion failure or valgrind errors at best_access_path ...Sergey Petrunya2012-05-131-0/+46
| | | | | | | | | - Let fix_semijoin_strategies_for_picked_join_order() set POSITION::prefix_record_count for POSITION records that it copies from SJ_MATERIALIZATION_INFO::tables. (These records do not have prefix_record_count set, because they are optimized as joins-inside-semijoin-nests, without full advance_sj_state() processing).
* BUG#978479: Wrong result (extra rows) with ↵Sergey Petrunya2012-04-191-0/+3
| | | | | | | | derived_with_keys+loosescan+semijoin=ON, materialization=OFF - Part#2: Don't try to construct a LooseScan access on indexes that do not guarantee index-ordered reads.
* BUG#978479: Wrong result (extra rows) with ↵Sergey Petrunya2012-04-191-0/+30
| | | | | | | | derived_with_keys+loosescan+semijoin=ON, materialization=OFF Part#1: make EXPLAIN's plan match the one by actual execution: Item_subselect::used_tables() should return the same value irrespectively of whether we're running an EXPLAIN or a SELECT.
* Merge BUG#952372Sergey Petrunya2012-03-211-0/+21
|\
| * BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables ↵Sergey Petrunya2012-03-181-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with semijoin+materialization - The problem was that convert_subq_to_jtbm() attached the semi-join TABLE_LIST object into the wrong list: they used to attach it to the end of parent_lex->leaf_tables.head()->next_local->...->next_local. This was apparently inccorect, as one can construct an example where JTBM nest is attached to a table that is inside some mergeable VIEW, which breaks (causes crash) for name resolution on the subsequent statement re-execution. - Solution: Attach to the "right" list. The "wording" was copied from st_select_lex::handle_derived.
* | BUG#952583: Server crashes in Item_field::fix_after_pullout on INSERT .. SELECTSergey Petrunya2012-03-191-0/+14
|/ | | | - Take into account that there may exist Item_field objects with context==NULL.
* BUG#923246: Loosescan reports different result than other semijoin methodsSergey Petrunya2012-01-301-0/+22
| | | | | - If LooseScan is used with quick select, require that quick select produces data in key order (this disables use of MRR, which can return data in arbitrary order).
* Merge.Igor Babaev2012-01-271-0/+39
|\
| * Back-ported test cases for bug #59919 of mysql-5.6 code line. The bug couldIgor Babaev2012-01-271-0/+39
| | | | | | | | | | | | | | | | | | | | not be reproduced in the latest release of mariadb-5.3 as it was was fixed by Sergey Petrunia when working on the problems concerning outer joins within in subqueries converted to semi-joins.