summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
Commit message (Collapse)AuthorAgeFilesLines
* 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-03-041-30/+1
|\ \ \ | |/ /
| * | Merge branch '10.0' into 10.1Oleksandr Byelkin2019-03-011-30/+1
| |\ \
| | * \ Merge branch '5.5' into 10.0Oleksandr Byelkin2019-02-281-30/+1
| | |\ \ | | | |/
| | | * MDEV-17055: Server crashes in find_order_in_list upon 2nd (3rd) execution of ↵Oleksandr Byelkin2019-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SP with UPDATE 1. Always drop merged_for_insert flag on cleanup (there could be errors which prevent TABLE to be assigned) 2. Make more precise cleanup of select parts which was touched
| | | * A cleanup in derived table handling: removing duplicate code from ↵Alexander Barkov2019-02-281-30/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | st_select_lex::handle_derived() st_select_lex::handle_derived() and mysql_handle_list_of_derived() had exactly the same implementations. - Adding a new method LEX::handle_list_of_derived() instead - Removing public function mysql_handle_list_of_derived() - Reusing LEX::handle_list_of_derived() in st_select_lex::handle_derived()
* | | | MDEV-17024 Crash on large queryIgor Babaev2018-09-071-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This problem manifested itself when a join query used two or more materialized CTE such that each of them employed the same recursive CTE. The bug caused a crash. The crash happened because the cleanup() function was performed premature for recursive CTE. This clean up was induced by the cleanup of the first CTE referenced the recusrsive CTE. This cleanup destroyed the structures that would allow to read from the temporary table containing the rows of the recursive CTE and an attempt to read these rows for the second CTE referencing the recursive CTE triggered a crash. The clean up for a recursive CTE R should be performed after the cleanup of the last materialized CTE that uses R.
* | | | don't set derived->merged until derived is really irreversibly mergedSergei Golubchik2018-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | it was set before big if() that could decide not to merge and go with materialization. this fixes a crash in main.view test
* | | | Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-0/+20
|\ \ \ \ | |/ / /
| * | | Merge branch 'github/10.0' into 10.1Sergei Golubchik2018-02-021-0/+20
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch '5.5' into 10.0Vicențiu Ciorbaru2018-01-241-0/+20
| | |\ \ | | | |/
| | | * MDEV-14786: Server crashes in Item_cond::transform on 2nd execution of SP ↵Oleksandr Byelkin2018-01-231-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | querying from a view MDEV-14957: JOIN::prepare gets unusable "conds" as argument Do not touch merged derived (it is irreversible) Fix first argument of in_optimizer for calls possible before fix_fields()
* | | | Merge 10.1 into 10.2, with some MDEV-14799 fixupsmariadb-10.2.12Marko Mäkelä2018-01-031-6/+47
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trx_undo_page_report_modify(): For SPATIAL INDEX, keep logging updated off-page columns twice, so that the minimum bounding rectangle (MBR) will be logged. Avoiding the redundant logging would require larger changes to the undo log format. row_build_index_entry_low(): Handle SPATIAL_UNKNOWN more robustly, by refusing to purge the record from the spatial index. We can get this code when processing old undo log from 10.2.10 or 10.2.11 (the releases affected by MDEV-14799, which was a regression from MDEV-14051).
| * | | Merge 10.0 into 10.1Marko Mäkelä2018-01-021-5/+46
| |\ \ \ | | |/ /
| | * | Merge 5.5 into 10.0Marko Mäkelä2018-01-021-5/+46
| | |\ \ | | | |/
| | | * MDEV-10657: incorrect result returned with binary protocol (prepared statements)Oleksandr Byelkin2017-12-271-2/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If translation table present when we materialize the derived table then change it to point to the materialized table. Added debug info to see really what happens with what derived.
* | | | Merge remote-tracking branch 'origin/10.1' into 10.2Alexander Barkov2017-11-091-2/+4
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.0' into 10.1Alexander Barkov2017-11-091-2/+4
| |\ \ \ | | |/ /
| | * | MDEV-14164: Unknown column error when adding aggregate to function in oracle ↵Oleksandr Byelkin2017-11-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Merge branch '10.0' into 10.1Vicențiu Ciorbaru2017-09-191-2/+2
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-09-191-2/+2
| | |\ \ | | | |/
| | | * MDEV-11240: Server crashes in check_view_single_update or Assertion ↵Oleksandr Byelkin2017-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | `derived->table' failed in mysql_derived_merge_for_insert Before "merge" view shoud be inited to maintaing transitive attributes like "multitable".
* | | | MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.Vladislav Vaintroub2017-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix win64 pointer truncation warnings (usually coming from misusing 0x%lx and long cast in DBUG) - Also fix printf-format warnings Make the above mentioned warnings fatal. - fix pthread_join on Windows to set return value.
* | | | MDEV-11240: Server crashes in check_view_single_update or Assertion ↵mariadb-10.2.8Oleksandr Byelkin2017-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | `derived->table' failed in mysql_derived_merge_for_insert Before "merge" view shoud be inited to maintaing transitive attributes like "multitable".
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2017-08-171-0/+2
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2017-08-081-0/+2
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2017-07-251-0/+2
| | |\ \ | | | |/
| | | * MDEV-11240: Server crashes in check_view_single_update or Assertion ↵Oleksandr Byelkin2017-07-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | `derived->table' failed in mysql_derived_merge_for_insert Move table pointer for single table view (even if it is view over other view) to make the access universal.
* | | | MDEV-13439: Database permissions are not enough to run a subquery with GROUP ↵Oleksandr Byelkin2017-08-101-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | BY within a view The bug is result adding ability to have derived tables inside views. Fixed checks should be a switch between view/derived or select derived and information schema.
* | | | Fixed the bug mdev-12845.Igor Babaev2017-06-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Fixed the bug mdev-12563.Igor Babaev2017-04-281-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug happened when the specification of a recursive CTE had no recursive references at the top level of the specification. In this case the regular processing of derived table references of the select containing a non-recursive reference to this recursive CTE misses handling the specification unit. At the preparation stage any non-recursive reference to a recursive CTE must be handled after the preparation of the specification unit for this CTE. So we have to force this preparation when regular handling of derived tables does not do it.
* | | | Fixed the bug mdev-12373.Igor Babaev2017-04-241-0/+3
| | | | | | | | | | | | | | | | | | | | Condition pushdown into derived tables / views with side effects is not allowed.
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2017-03-301-0/+3
|\ \ \ \ | |/ / /
| * | | Merge 10.0 into 10.1Marko Mäkelä2017-03-091-0/+3
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, implement MDEV-11027 a little differently from 5.5 and 10.0: recv_apply_hashed_log_recs(): Change the return type back to void (DB_SUCCESS was always returned). Report progress also via systemd using sd_notifyf().
| | * | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-03-031-0/+3
| | |\ \ | | | |/
| | | * Fixed bug mdev-12099.Igor Babaev2017-02-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function mysql_derived_merge() erroneously did not mark newly formed AND formulas in ON conditions with the flag abort_on_null. As a result not_null_tables() calculated incorrectly for these conditions. This could prevent conversion of embedded outer joins into inner joins. Changed a test case from table_elim.test to preserve the former execution plan.
* | | | Fixed bug mdev-12368.Igor Babaev2017-03-261-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mutually recursive CTE could cause a crash of the server in the case when they were not Standard compliant. The crash happened in mysql_derived_prepare(), because the destructor the derived_result object created for a CTE that was mutually recursive with some others was called twice. Yet this destructor should not be called for resursive references.
* | | | Fixed bug mdev-11820.Igor Babaev2017-01-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fields st_select_lex::cond_pushed_into_where and st_select_lex::cond_pushed_into_having should be re-initialized for the unit specifying a derived table at every re-execution of the query that uses this derived table, because the result of condition pushdown may be different for different executions.
* | | | Such big blocks in query processing should be represented in the debugging ↵Oleksandr Byelkin2017-01-181-7/+8
| | | | | | | | | | | | | | | | trace.
* | | | Fixed bug mdev-11674.Igor Babaev2017-01-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The rows of a recursive CTE at some point may overflow the HEAP temporary table containing them. At this point the table is converted to a MyISAM temporary table and the new added rows are placed into this MyISAM table. A bug in the of select_union_recursive::send_data prevented the server from writing the row that caused the overflow into the temporary table used for the result of the iteration steps. This could lead, in particular,to a premature end of the iterations. 2. The method TABLE::insert_all_rows_into() that was used to copy all rows of one temporary table into another did not take into account that the destination temporary table must be converted to a MyISAM table at some point. This patch fixed this problem. It also renamed the method into TABLE::insert_all_rows_into_tmp_table() and added an extra parameter needed for the conversion.
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-12-291-0/+1
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2016-12-111-0/+1
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Sergei Golubchik2016-12-091-0/+2
| | |\ \ | | | |/
| | | * Fixed bug mdev-11161.Igor Babaev2016-11-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The flag TABLE_LIST::fill_me must be reset to false at the prepare phase for any materialized derived table used in the executed query. Otherwise if the optimizer decides to generate a key for such a table it is generated only for the first execution of the query.
* | | | Fixed bug mdev-11313.Igor Babaev2016-11-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | The fix for bug 11072 was not complete though it also fixed the bug mdev-10800. This patch resolves the problems of all three bugs.
* | | | Fixed bug mdev-11072.Igor Babaev2016-11-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a general case the conditions with outer fields cannot be pushed into materialized views / derived tables. However if the outer field in the condition refers to a single row table then the condition may be pushable. In this case a special care should be taken for outer fields when pushing the condition into a materialized view / derived table.
* | | | Fixed bug mdev-10884.mariadb-10.2.2Igor Babaev2016-09-251-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a materialized derived table / view is specified by a unit with SELECTs containing ORDER BY ... LIMIT then condition pushdown cannot be done for these SELECTs. If a materialized derived table / view is specified by a unit containing global ORDER BY ... LIMIT then condition pushdown cannot be done for this unit.
* | | | Another attempt to fix bug mdev-10785 + cleanup for the previous attempt.Igor Babaev2016-09-141-8/+1
| | | |