summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
Commit message (Collapse)AuthorAgeFilesLines
* Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | * Update wrong zip-code
* 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-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()
* 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.
* 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-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.
* 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-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.
* MDEV-8018: main.multi_update fails with --ps-protocolOleksandr Byelkin2015-04-221-1/+3
| | | | | | save_prep_leaf_tables() made recursive to work with underlying view Arena restoiring fixed in case of EOM.
* MDEV-7260: Crash in get_best_combination when executing multi-table UPDATE ↵unknown2015-02-111-0/+3
| | | | | | | | with nested views Do not use merge_for_insert for commands which use SELECT because optimizer can't work with such tables. Fixes which makes multi-delete working with normally merged views.
* MDEV-6441: memory leakunknown2014-07-311-5/+1
| | | | | | mysql_derived_prepare() was executed on the statement memory. Now it is executed on the runtime memory. All bugs induced by this were fixed.
* 5.3 mergeSergei Golubchik2014-06-021-6/+11
|\
| * MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized with MERGE ↵unknown2014-06-021-6/+11
| | | | | | | | | | | | view) mysql_derived_merge() made correctly working with views.
| * 5.2 mergeSergei Golubchik2014-03-161-1/+1
| |\
| | * mysql-5.1.73 mergeSergei Golubchik2014-03-151-1/+1
| | |\
| | | * Updated/added copyright headers.Murthy Narkedimilli2013-02-251-1/+1
| | | |
* | | | 5.3-mergeSergei Golubchik2014-03-161-20/+30
|\ \ \ \ | |/ / /
| * | | MDEV-5740: Assertion ↵unknown2014-03-071-20/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test' failed on 2nd execution of PS with derived_merge Do not check tables of executed units. Debug info about stages of derived tables execution added.
* | | | merge of MDEV-5369 (5.3->5.5)unknown2014-01-291-1/+1
|\ \ \ \ | |/ / /
| * | | MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of PS with LEFT ↵unknown2014-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | JOIN, TEMPTABLE view Set of JOIN_TYPE_OUTER made only once to avoid interference with optimization joins which made only once per query.
* | | | merge 5.3->5.5unknown2014-01-261-5/+2
|\ \ \ \ | |/ / /
| * | | merge of MDEV-5356 5.1->5.3 (with more fixes and test suite).unknown2014-01-231-5/+2
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario: 1) func1 saves current arena and activates copy1 of statement arena 2) func2 saves copy1 of statement arena setup by func1 and activates copy2 3) some changes made for copy 2 4) func2 stores changed copy2 back to statenet arena and activates copy1 5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
| | * | Fixed valgrind problem: reference on deleted memory of temporary table name.unknown2011-12-111-2/+0
| | | | | | | | | | | | | | | | Removed previous patch of this problem.
* | | | Fix for MDEV-5531: double call procedure in one session - hard shutdown the ↵Michael Widenius2014-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | server Main fix was to not cache derivied tables as they may be temporary tables that are deleted before the next query. This was a bit tricky as Item_field::fix_fields depended on cached_tables to be set to resolve some columns. mysql-test/r/sp-bugs.result: Added test case mysql-test/t/sp-bugs.test: Added test case sql/item.cc: Fixed fix_outer_field to handle case where found field did not have in cached_table Idea is that if cached_table is not avaliable, use from_field->table->pos_in_table_list instead sql/records.cc: Also accept INTERNAL_TMP_TABLE for memmap sql/sql_base.cc: More DBUG_PRINT Fixed that setup_natural_join_row_types() is not run twice. Original code modified context->first_name_resolution_table also for second executions. This was wrong as this could give wrong results if some joins had been optimized away between calls. sql/sql_derived.cc: Mark derived tables as internal temporary tables (INTERNAL_TMP_TABLE), not as NON_TRANSACTIONAL_TMP_TABLE. This is more correct as the tables are not visible by the end user. sql/sql_insert.cc: Reset pos_in_table_list before calling fix_fields. One of the consequences of the change of not caching all generated tables in Item_ident is that pos_in_table_list needs to be correct in calls to fix_fields. sql/sql_lex.cc: More DBUG_PRINT sql/sql_parse.cc: Don't cache derivied tables as they may be temporary tables that are deleted before the next query sql/sql_select.cc: Reset table_vector. This was required as some code checked the vector to see if temporary tables had already been created. sql/table.cc: Mark tables with field translations as cacheable (as these will not disapper between stmt executions.
* | | | Merge 5.3->5.5unknown2014-01-151-0/+8
|\ \ \ \ | |/ / /
| * | | MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQLunknown2013-12-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Materialization forced in case if rand() used in view or derived table to avoud several calls of rand for gting value of a field. Fixed set variable uncachable flag from - it shouldbe a side effect not a random value.
* | | | Merge 5.3->5.5unknown2013-10-291-1/+2
|\ \ \ \ | |/ / /
| * | | MDEV-5143: update of a joined table with a nested subquery with a syntax ↵unknown2013-10-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | error crashes mysqld with signal 11 Added check of SELECT_LEX::handle_derived() result.
* | | | Merge 5.3-5.5Igor Babaev2013-10-131-2/+0
|\ \ \ \ | |/ / /
| * | | Fixed bug mdev-5105.Igor Babaev2013-10-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug caused a memory overwrite in the function update_ref_and_keys() It happened due to a wrong value of SELECT_LEX::cond_count. This value historically was calculated by the fix_fields method. Now the logic of calling this method became too complicated and, as a result, this value is calculated not always correctly. The patch changes the way how and when the values of SELECT_LEX::cond_count and of SELECT_LEX::between_count are calculated. The new code does it just at the beginning of update_ref_and_keys().
* | | | merge 5.3 -> 5.5unknown2013-09-251-0/+13
|\ \ \ \ | |/ / /
| * | | MDEV-5039: incorrect Item_func_regex::update_used_tables()unknown2013-09-251-0/+13
| | | | | | | | | | | | | | | | | | | | Other fix of maybe_null problem and revert of revno: 3608 "MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery from a MERGE view."
* | | | 5.3 -> 5.5 Mergeunknown2013-06-171-1/+10
|\ \ \ \ | |/ / /
| * | | MDEV-4593: p_s: crash in simplify_joins with delete using subselect from viewunknown2013-06-061-1/+10
| | | | | | | | | | | | | | | | mysql_derived_merge_for_insert() should not be called for views or derived tables which are not put (directly or via other views) in main SELECT_LEX "join list".
* | | | -Run test suite with smaller aria keybuffer size (to make it possible to run ↵Michael Widenius2013-06-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | more tests in parallel) -Added test and extra code to ensure we don't leave keyread on for a handler table. -Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G. mysql-test/include/default_mysqld.cnf: Run test suite with smaller aria keybuffer size mysql-test/suite/maria/maria3.result: Run test suite with smaller aria keybuffer size mysql-test/suite/sys_vars/r/aria_pagecache_buffer_size_basic.result: Run test suite with smaller aria keybuffer size sql/handler.cc: Disable key read (extra safety if something went wrong) sql/multi_range_read.cc: Ensure we have don't leave keyread on for secondary_file sql/opt_range.cc: Simplify code with mark_columns_used_by_index_no_reset() Ensure that read_keys_and_merge() disableds keyread if it enables it sql/opt_subselect.cc: Remove not anymore used argument for create_internal_tmp_table() sql/sql_derived.cc: Remove not anymore used argument for create_internal_tmp_table() sql/sql_select.cc: Use 'enable_keyread()' instead of calling HA_EXTRA_RESET. (Makes debugging easier) Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G. Remove not anymore used argument for create_internal_tmp_table() More DBUG sql/sql_select.h: Remove not anymore used argument for create_internal_tmp_table()
* | | | Merge 5.3->5.5Igor Babaev2012-03-171-0/+1
|\ \ \ \ | |/ / /
| * | | Fixed LP bug #953649.Igor Babaev2012-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not call, directly or indirectly, SQL_SELECT::test_quick_select() for derived materialized tables / views when optimizing joins referring to these tables / views to get cost estimates of materialization. The current code does not create B-tree indexes for materialized derived tables / views. So now it's not possible to get any estimates for ranges conditions over the results of the materialization. The function mysql_derived_create() must take into account the fact that array of the KEY structures specifying the keys over a derived table / view may be moved after the optimization phase if the derived table / view is materialized.
* | | | 5.3.4 mergeSergei Golubchik2012-02-151-1/+1
|\ \ \ \ | |/ / /
| * | | Moving LP BUG#794005 to 5.3 + fixing INSERT of multi-table view.unknown2012-02-031-1/+1
| | | |
| * | | Fixed LP bug #917990.Igor Babaev2012-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the expression for a derived table of a query contained a LIMIT clause the estimate of the number of rows in this derived table returned by the EXPLAIN command could be badly off since the optimizer ignored the limit number from the LIMIT clause when getting the estimate. The call of the method SELECT_LEX_UNIT->set_limit added in the code of mysql_derived_optimize() will be needed also in maria-5.5 where parameters in the LIMIT clause are supported.
* | | | Fix set_limit to be uniform with all calls.unknown2012-02-101-2/+2
| | | | | | | | | | | | | | | | Fix of set_limit in case of an error (actually impossible case but better it will be right)
* | | | Fixed the failure of sp.test reported in the issue MDEV-86.Igor Babaev2012-01-171-0/+1
| | | |
* | | | 5.3 mergeSergei Golubchik2012-01-131-1/+2
|\ \ \ \ | |/ / /
| * | | Merge with 5.2.Michael Widenius2011-12-111-2/+4
| |\ \ \ | | |/ / | | | | | | | | no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
| | * | Initail merge with MySQL 5.1 (XtraDB still needs to be merged)Michael Widenius2011-11-211-2/+4
| | |\ \ | | | |/ | | | | | | | | Fixed up copyright messages.
* | | | mysql-5.5.18 mergeSergei Golubchik2011-11-031-2/+2
|\ \ \ \
| * \ \ \ Updated/added copyright headersKent Boortz2011-06-301-2/+2
| |\ \ \ \ | | | |_|/ | | |/| |
| | * | | Updated/added copyright headersKent Boortz2011-06-301-2/+4
| | |\ \ \ | | | |_|/ | | |/| |
| | | * | Updated/added copyright headersKent Boortz2011-06-301-2/+3
| | | | |