summaryrefslogtreecommitdiff
path: root/mysql-test/main
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-17518: Range optimization doesn't use ON expressions from nested outer ↵Sergei Petrunia2018-11-053-0/+47
| | | | | | | joins Part#2: take into account that join nest that we are marking as constant might already have constant tables in it. Don't count these tables twice.
* MDEV-17518: Range optimization doesn't use ON expressions from nested outer ↵Sergei Petrunia2018-11-051-0/+32
| | | | | | joins Update .result files after the previous patch
* MDEV-17518: Range optimization doesn't use ON expressions from nested outer ↵Sergei Petrunia2018-11-052-0/+55
| | | | | | | joins Continuation of the fix: Make condition selectivity estimate use the right estimate, too.
* MDEV-17493: Partition pruning doesn't work for nested outer joinsSergei Petrunia2018-11-052-0/+64
| | | | Reuse the fix for MDEV-17518 here, too.
* MDEV-17518: Range optimization doesn't use ON expressions from nested outer ↵Sergei Petrunia2018-11-054-1/+63
| | | | joins
* MDEV-17359 Concatenation operator || in like expressionhalfspawn2018-10-182-0/+167
|
* Merge 10.2 into 10.3Marko Mäkelä2018-10-176-0/+241
|
* MDEV-17419 Subquery with group by returns wrong resultsIgor Babaev2018-10-172-0/+81
| | | | Added only test case because the bug was fixed by the patch for mdev-17382.
* MDEV-17137: Syntax errors with VIEW using MEDIANVarun Gupta2018-10-162-0/+30
| | | | | | | The syntax error happened because we had not implemented a different print for percentile functions. The syntax is a bit different when we use percentile functions as window functions in comparision to normal window functions. Implemented a seperate print function for percentile functions
* MDEV-17222 Reproducible server crash in String_list::append_str orIgor Babaev2018-10-142-19/+88
| | | | | | | | | | | | | | | in Field_iterator_table::create_item When IN predicate is converted to IN subquery we have to ensure that any item from the select list of the subquery has some name and this name is unique across the select list. This was not guaranteed by the code before the patch for MDEV-17222. If the name of an item of the select list was not set, and this happened for binary constants, then the server crashed. If the first row in the IN list contained the same constant in two different positions then the server returned an error message. This was fixed by providing all constants in the first row of the IN list with generated names.
* Adjusting old tests and adding new tests for "MDEV-8765: mysqldump -use ↵Alexander Barkov2018-10-128-46/+188
| | | | utf8mb4 by default"
* MDEV-17411 Wrong WHERE optimization with simple CASE and searched CASEAlexander Barkov2018-10-112-0/+49
|
* MDEV-17381 Wrong query result with LATERAL DERIVED optimizationIgor Babaev2018-10-082-0/+82
| | | | | | and join_cache_level=6 This bug was fixed by the patch for mdev-17382 applied to 5.5.
* MDEV-17382 Hash join algorithm should not be used to join materializedIgor Babaev2018-10-083-2/+81
| | | | | | | | | | | | | | | | | | | derived table / view by equality Now rows of a materialized derived table are always put into a temporary table before join operation. If BNLH is used to join this table with the result of a partial join then both operands of the join are actually put into main memory. In most cases this is not efficient. We could avoid this by sending the rows of the derived table directly to the join operation. However this kind of data flow is not supported yet. Fixed by not allowing usage of hash join algorithm to join a materialized derived table if it's joined by an equality predicate of the form f=e where f is a field of the derived table. Change for the test case in 10.3: splitting must be turned off to preserve the explain.
* MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0 uponmariadb-10.3.10Sergey Vojtovich2018-10-022-0/+50
| | | | | | | | | | truncating a temporary table TRUNCATE expects only one TABLE instance (which is used by TRUNCATE itself) to be open. However this requirement wasn't enforced after "MDEV-5535: Cannot reopen temporary table". Fixed by closing unused table instances before performing TRUNCATE.
* Merge branch '10.2' into 10.3Sergei Golubchik2018-09-2838-155/+1343
|
* MDEV-16429: Assertion `!table || (!table->read_set || ↵Nikita Malyavin2018-09-212-0/+27
| | | | | | | | | | | | | | | bitmap_is_set(table->read_set, field_index))' fails upon attempt to update virtual column on partitioned versioned table When using buffered sort in `UPDATE`, keyread is used. In this case, `TABLE::update_virtual_field` should be aborted, but it actually isn't, because it is called not with a top-level handler, but with the one that is actually going to access the disk. Here the problemm is issued with partitioning, so the solution is to recursively mark for keyread all the underlying partition handlers. * ha_partition: update keyread state for child partitions Closes #800
* MDEV-17211 Server crash on queryIgor Babaev2018-09-172-0/+63
| | | | | | | The function JOIN_TAB::choose_best_splitting() did not take into account that for some tables whose fields were used in the GROUP BY list of the specification of a splittable materialized derived there might exist no elements in the array ext_keyuses_for_splitting.
* MDEV-16917 Index affects query resultsIgor Babaev2018-09-152-0/+52
| | | | | | | | | | | | The optimizer erroneously allowed to use join cache when joining a splittable materialized table together with splitting optimization. As a consequence in some rare cases the server returned wrong result sets for queries with materialized derived. This patch allows to use either join cache without usage of splitting technique for materialization of a splittable derived table or splitting without usage of join cache when joining such table. The costs the these alternatives are compared and the best variant is chosen.
* Fixed func_time.test that was depending on current timeMonty2018-09-022-0/+2
|
* EV-16992 Assertion `table_ref->table || table_ref->view' failed inIgor Babaev2018-08-302-0/+89
| | | | | | | | | | | | | Field_iterator_table_ref::set_field_iterator Several functions that processed different prepare statements missed the DT_INIT flag in last parameter of the open_normal_and_derived_tables() calls. It made context analysis of derived tables dependent on the order in which the derived tables were processed by mysql_handle_derived(). This order was induced by the order of SELECTs in all_select_list. In 10.4 the order of SELECTs in all_select_list became different and lack of the DT_INIT flags in some open_normal_and_derived_tables() call became critical as some derived tables were not identified as such.
* Merge 10.2 into 10.3Marko Mäkelä2018-08-2824-17/+798
|
* Adjust a result for MDEV-14474Marko Mäkelä2018-08-281-0/+2
|
* MDEV-17017 Explain for query using derived table specified withIgor Babaev2018-08-271-2/+0
| | | | | | | | | | | | | a table value constructor shows wrong number of rows This is another attempt to fix this bug. The previous patch did not take into account that a transformation for ALL/ANY subqueries could be applied to the materialized table that wrapped the table value constructor used as a specification of the subselect used an ALL/ANY subquery. In this case the result of the derived table used a sink of the class select_subselect rather than of the class select_unit. Thus the previous fix could cause memory overwrites when running EXPLAIN for queries with table value constructors in ALL/ANY subselects.
* MDEV-14474 information_schema.check_constraintsAnel Husakovic2018-08-252-1/+9
| | | | | | Implement according to standard SQL specification 2008. The check_constraints table is used for fetching metadata about the constraints defined for tables in all databases.
* Corrected test results after the last change in range.testIgor Babaev2018-08-231-24/+0
|
* Move the testcase for BUG#21282 to a file that includes have_debug.incSergei Petrunia2018-08-234-52/+54
| | | | | The testcase needs to set in_predicate_conversion_threshold which is only available in debug builds (this is subject to further discussion).
* MDEV-16930 Crash when VALUES in derived table contains expressionsIgor Babaev2018-08-212-0/+56
| | | | | | | | | | | | This patch always provides columns of the temporary table used for materialization of a table value constructor with some names. Before this patch these names were always borrowed from the items of the first row of the table value constructor. When this row contained expressions and expressions were not named then it could cause different kinds of problems. In particular if the TVC is used as the specification of a derived table this could cause a crash. The names given to the expressions used in a TVC are the same as those given to the columns of the result set from the corresponding SELECT.
* MDEV-17017 Explain for query using derived table specified with a tableIgor Babaev2018-08-217-23/+111
| | | | | | | | | | value constructor shows wrong number of rows If the specification of a derived table contained a table value constructor then the optimizer incorrectly estimated the number of rows in the derived table. This happened because the optimizer did not take into account the number of rows in the constructor. The wrong estimate could lead to choosing inefficient execution plans.
* Merge branch '10.2' into 10.3Sergei Golubchik2018-08-122-0/+42
|
* Update C/C to v3.0.6Sergei Golubchik2018-08-121-0/+6
|
* MDEV-15127 AddressSanitizer: stack-buffer-overflow in base_list::push_back ..Sachin2018-08-072-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem:- If we try to run this query with -WITH_ASAN=ON compiled server CREATE TABLE t1 (i INT); SET debug_dbug="+d,test_completely_invisible,test_invisible_index"; CREATE TABLE t2 LIKE t1; This will generate a stack buffer overflow error. ==8922==ERROR: AddressSanitizer: stack-buffer-overflow on address #ADDR Analyze:- Error is generated on this line if (((*last)=new list_node(info, &end_of_list))) So info is our Key*, &end_of_list is global variable and last == #ADDR So last is suspicious variable. And last is the variable present in alter_info ->key_list. Now the question is how this key_list->last gets wrong/ different stack variable. In the backtrace, we can see that key_list is generated in mysql_create_table_like_table by calling mysql_preapre_alter_table_function and dummy key_list is created by mysql_create_like_table. In the end on mysql_prepare_alter_table we call alter_info->key_list.swap(new_key_list); So there is two options either key_list is empty or not empty , IF it is not empty then there is no issues last ptr is replaced by thd->mem_root (allocated ptr) So problem arises when key_list is empty. It swaps the dummy last ptr by mysql_prepare_alter_table declared ptr. which is wrong. Solution:- We wont swap variable if list does not have any element.
* MDEV-16801 seg_fault on a queryIgor Babaev2018-08-032-0/+87
| | | | | | | | | The bug was in the in the code of JOIN::check_for_splittable_materialized() where the structures describing the fields of a materialized derived table that potentially could be used in split optimization were build. As a result of this bug some fields that were not usable for splitting were detected as usable. This could trigger crashes further in st_join_table::choose_best_splitting().
* Merge 10.2 into 10.3Marko Mäkelä2018-08-0354-6/+1667
|
* MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME)Alexander Barkov2018-08-032-0/+19
| | | | | This problem was earlier fixed by the patch for MDEV-15340. Adding tests only.
* MDEV-16878 Functions ADDTIME and SUBTIME get wrongly removed from WHERE by ↵Alexander Barkov2018-08-023-6/+42
| | | | the equal expression optimizer
* Merge 10.2 into 10.3Marko Mäkelä2018-07-267-0/+111
|
* Merge remote-tracking branch 'origin/10.2' into 10.3Alexander Barkov2018-07-242-1/+24
|
* MDEV-16729 VARCHAR COMPRESSED is created with a wrong length for multi-byte ↵Alexander Barkov2018-07-242-0/+25
| | | | | | | character sets Field_varstring::sql_type() did not calculate character length correctly. Using char_length() instead of the bad code.
* Merge 10.2 into 10.3Marko Mäkelä2018-07-234-0/+73
|
* Merge 10.2 into 10.3Marko Mäkelä2018-07-062-52/+0
|
* Merge 10.2 into 10.3Marko Mäkelä2018-07-052-0/+130
|
* MDEV-16675 Unnecessary explicit lock acquisition during UPDATE or DELETEMarko Mäkelä2018-07-032-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In InnoDB, an INSERT will not create an explicit lock object. Instead, the inserted record is initially implicitly locked by the transaction that wrote its trx_t::id to the hidden system column DB_TRX_ID. (Other transactions would check if DB_TRX_ID is referring to a transaction that has not been committed.) If a record was inserted in the current transaction, it would be implicitly locked by that transaction. Only if some other transaction is requesting access to the record, the implicit lock should be converted to an explicit one, so that the waits-for graph can be constructed for detecting deadlocks and lock wait timeouts. Before this fix, InnoDB would convert implicit locks to explicit ones, even if no conflict exists. lock_rec_convert_impl_to_expl(): Return whether caller_trx already holds an explicit lock that covers the record. row_vers_impl_x_locked_low(): Avoid a lookup if the record matches caller_trx->id. lock_trx_has_expl_x_lock(): Renamed from lock_trx_has_rec_x_lock(). row_upd_clust_step(): In a debug assertion, check for implicit lock before invoking lock_trx_has_expl_x_lock(). rw_trx_hash_t::find(): Make do_ref_count a mandatory parameter. Assert that trx_id is not 0 (the caller should check it). trx_sys_t::is_registered(): Only invoke find() if id != 0. trx_sys_t::find(): Add the optional parameter do_ref_count. lock_rec_queue_validate(): Avoid lookup for trx_id == 0.
* Merge 10.2 into 10.3Marko Mäkelä2018-07-034-8/+61
|
* Merge branch '10.2' into 10.3Sergei Golubchik2018-06-3059-95/+1422
|
* MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned tableAleksey Midenkov2018-06-301-2/+2
| | | | | | | | | | | * ignore CHECK constraint for historical rows; * FOREIGN KEY test case. TODO: MDEV-16301 IB: use real table name for error messages on ALTER Closes tempesta-tech/mariadb#491 Closes #748
* MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressivelyAlexander Barkov2018-06-282-0/+93
| | | | | | | | | | | | | | | | | | Problem: push_handler() created sp_handler_entry instances on THD::main_mem_root, which is freed only after the SP instructions execution. So in case of a CONTINUE HANDLER inside a loop (e.g. WHILE) this approach leaked thread memory on every loop iteration. Changes: - Removing sp_handler_entry declaration, it's not really needed. - Fixing the data type of sp_rcontext::m_handlers from Dynamic_array<sp_handler_entry*> to Dynamic_array<sp_instr_hpush_jump*> - Fixing sp_rcontext::push_handler() to push the pointer to an sp_instr_hpush_jump instance to the handler stack. This instance contains everything we need. There is no a need to allocate anything else.
* MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressivelyAlexander Barkov2018-06-272-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: push_cursor() created sp_cursor instances on THD::main_mem_root, which is freed only after the SP instructions loop. Changes: - Moving sp_cursor declaration from sp_rcontext.h to sql_class.h - Deriving sp_instr_cpush from sp_cursor. So now sp_cursor is created only once (at the SP parse time) and then reused on all loop iterations - Adding a new method reset() into sp_cursor (and its parent classes) to reset an sp_cursor instance before reuse. - Moving former sp_cursor members m_fetch_count, m_row_count, m_found into a separate class sp_cursor_statistics. This helps to reuse the code in sp_cursor constructors, and in sp_cursor::reset() - Adding a helper method sp_rcontext::pop_cursor(). - Adding "THD*" parameter to so_rcontext::pop_cursors() and pop_all_cursors() - Removing "new" and "delete" from sp_rcontext::push_cursor() and sp_rconext::pop_cursor(). - Fixing sp_cursor not to derive from Sql_alloc, as it's now allocated only as a part of sp_instr_cpush (and not allocated separately). - Moving lex_keeper->disable_query_cache() from sp_cursor::sp_cursor() to sp_instr_cpush::execute(). - Adding tests
* MDEV-16365 Setting a column NOT NULL fails to return error forThirunarayanan Balathandayuthapani2018-06-252-0/+11
| | | | | | | | | | NULL values when there is no DEFAULT Copy and inplace algorithm works similarly for NULL to NOT NULL conversion for the following cases: (1) strict sql mode - Should give error. (2) non-strict sql mode - Should give warnings alone (3) alter ignore table command. - Should give warnings alone.
* MDEV-8049 name_const() is not consistent about its signessAlexander Barkov2018-06-222-0/+35
|