summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge 5.5 into 10.0Marko Mäkelä2018-01-111-0/+28
|\
| * MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_inOleksandr Byelkin2018-01-101-0/+28
| | | | | | | | Roll back to most general duplicate removing strategi in case of different stratagies for one position.
* | Update subselect test results to pass on 10.0Vicențiu Ciorbaru2017-07-291-1/+8
| | | | | | | | | | | | One query was removed due to inconsistent behaviour with subquery cache enabled vs disabled. MDEV-13399 has been created to track this change and fix.
* | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2017-07-251-0/+10
|\ \ | |/
| * MDEV-7828 Assertion `key_read == 0' failed in TABLE::enable_keyread with ↵Sergei Golubchik2017-07-121-0/+10
| | | | | | | | | | | | | | SELECT SQ and WHERE SQ already fixed by a7ed4644a6f. just add a test case,
* | after-merge fix for a7ed4644a6fSergei Golubchik2017-07-061-0/+6
| | | | | | | | | | | | (10.0+ changes, as specified in the MDEV) and remove unused variable (compiler warning)
* | Merge branch '5.5' into 10.0Sergei Golubchik2017-07-061-0/+25
|\ \ | |/
| * MDEV-10146: Wrong result (or questionable result and behavior) with ↵Oleksandr Byelkin2017-07-051-0/+25
| | | | | | | | | | | | aggregate function in uncorrelated SELECT subquery When outer reference resolved in a VIEW it still should mark aggregate function resolving border.
* | Merge remote-tracking branch 'origin/5.5' into 10.0vicentiu2017-01-061-0/+10
|\ \ | |/
| * MDEV-10386 Assertion `fixed == 1' failed in virtual String* ↵Alexander Barkov2016-12-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | Item_func_conv_charset::val_str(String*) The patch b96c196f1cd5d77e524cbf952539bdd33c65ffc1 added a new call for safe_charset_converter() without a corresponding fix_fields(). In case of a sub-query the created Item remained in non-fixed state. The problem did not show up with literal derived expressions, only subselects were affected. This patch adds a corresponding fix_fields() to the previously added safe_charset_converter().
* | Merge branch '5.5' into 10.0Sergei Golubchik2016-12-091-0/+13
|\ \ | |/
| * MDEV-10776: Server crash on queryOleksandr Byelkin2016-12-061-0/+14
| | | | | | | | | | Exclude untouched in prepare phese subqueries from the select/unit tree because they became unreachable by execution.
* | Merge branch '5.5' into 10.0Sergei Golubchik2016-02-151-0/+11
|\ \ | |/
| * MDEV-7122: Assertion `0' failed in subselect_hash_sj_engine::initVicențiu Ciorbaru2016-02-091-0/+10
| | | | | | | | | | | | | | | | | | The select mentioned in the bug attempted to create a temporary table using the maria storage engine. The table needs to have primary keys such that duplicates can be removed. Unfortunately this use case has a longer than allowed key and the tmp table got created without a temporary key. We must not allow materialization for the subquery if the total key length and key parts is greater than what the storage engine supports.
* | MDEV-7930 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type ↵Oleksandr Byelkin2015-10-281-0/+23
|/ | | | | | | != 2' failed in handler::ha_index_read_map In optimizing aggregate function do not try to touch tables from outer query.
* Merge remote-tracking branch 'mysql/5.5' into 5.5Sergei Golubchik2015-10-081-1/+1
|\
| * Merge branch 'mysql-5.1' into mysql-5.5Mithun C Y2015-08-171-1/+1
| |\
| | * Bug #21350175: SUBQUERIES IN PROCEDURE CLAUSE OF SELECT STATEMENT CAUSES ↵Mithun C Y2015-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SERVER FAILURES. Analysis : ========== During JOIN::prepare of sub-query which creates the derived tables we call setup_procedure. Here we call fix_fields for parameters of procedure clause. Calling setup_procedure at this point may cause issue. If sub-query is one of parameter being fixed it might lead to complicated dependencies on derived tables being prepared. SOLUTION : ========== In 5.6 with WL#6242, we have made procedure clause parameters can only be NUM, so sub-queries are not allowed as parameters. So in 5.5 we can block sub-queries in procedure clause parameters. This eliminates above conflicting dependencies.
| * | merge mysql-5.5->mysql-5.5-securityGeorgi Kodinov2012-04-101-0/+55
| |\ \
| | * \ merge 5.1 => 5.5Tor Didriksen2012-03-271-0/+55
| | |\ \ | | | |/
| | | * Backport of fix for Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMERTor Didriksen2012-03-271-0/+55
| | | |
| | | * weave merge of mysql-5.1->mysql-5.1-securityGeorgi Kodinov2011-05-101-0/+22
| | | |\
| * | | | Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERYTor Didriksen2012-03-141-0/+10
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The table contains one time value: '00:00:32' This value is converted to timestamp by a subquery. In convert_constant_item we call (*item)->is_null() which triggers execution of the Item_singlerow_subselect subquery, and the string "0000-00-00 00:00:32" is cached by Item_cache_datetime. We continue execution and call update_null_value, which calls val_int() on the cached item, which converts the time value to ((longlong) 32) Then we continue to do (*item)->save_in_field() which ends up in Item_cache_datetime::val_str() which fails, since (32 < 101) in number_to_datetime, and val_str() returns NULL. Item_singlerow_subselect::val_str isnt prepared for this: if exec() succeeds, and return !null_value, then val_str() *must* succeed. Solution: refuse to cache strings like "0000-00-00 00:00:32" in Item_cache_datetime::cache_value, and return NULL instead. This is similar to the solution for Bug#11766860 - 60085: CRASH IN ITEM::SAVE_IN_FIELD() WITH TIME DATA TYPE This patch is for 5.5 only. The issue is not present after WL#946, since a time value will be converted to a proper timestamp, with the current date rather than "0000-00-00"
| * | | weave merge of mysql-5.5->mysql-5.5-securityGeorgi Kodinov2011-05-101-0/+22
| |\ \ \
| | * \ \ Merge fix for Bug#11765713 from 5.1Tor Didriksen2011-04-151-0/+22
| | |\ \ \ | | | | |/ | | | |/|
| | | * | Bug#11765713 58705: OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES ↵Tor Didriksen2011-04-141-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CREATED BY OPT_SUM_QU Valgrind warnings were caused by comparing index values to an un-initialized field.
| * | | | merge 5.1 => 5.5 : Bug#12329653Tor Didriksen2011-05-051-0/+33
| |\ \ \ \ | | |/ / / | |/| | / | | | |/ | | |/|
| | * | merge 5.0 => 5.1 : Bug#12329653Tor Didriksen2011-05-041-0/+33
| | |\ \ | | | |/ | | |/|
| | | * Bug#12329653 - EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BYTor Didriksen2011-05-041-0/+34
| | | | | | | | | | | | | | | | | | | | The query was re-written *after* we had tagged it with NON_AGG_FIELD_USED. Remove the flag before continuing.
| | | * Bug#52711 Segfault when doing EXPLAIN SELECT with union...order by ↵Sergey Glukhov2010-11-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | (select... where...) backport from 5.1
| | | * Bug #48709: Assertion failed in sql_select.cc:11782:Georgi Kodinov2009-12-151-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int join_read_key(JOIN_TAB*) The eq_ref access method TABLE_REF (accessed through JOIN_TAB) to save state and to track if this is the first row it finds or not. This state was not reset on subquery re-execution causing an assert. Fixed by resetting the state before the subquery re-execution.
| * | | Fix for bug#58818: Incorrect result for IN/ANY subqueryOle John Aske2011-01-121-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the ::single_value_transformer() find an existing HAVING condition it used to do the transformation: 1) HAVING cond -> (HAVING Cond) AND (cond_guard (Item_ref_null_helper(...)) As the AND condition in 1) is Mc'Carty evaluated, the right side of the AND cond should be executed only if the original 'HAVING evaluated' to true. However, as we failed to set 'top_level' for the tranformed HAVING condition, 'abort_on_null' was FALSE after transformation. An UNKNOWN having condition will then not terminate evaluation of the transformed having condition, and we incorrectly continued into the Item_ref_null_helper() part.
| * | | Bug#57704 Cleanup code dies with void TABLE::set_keyread(bool): Assertion ↵Oystein Grovlen2010-11-101-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `file' failed. This bug was introduced in this revision: kostja@sun.com-20100727102553-b4n2ojcyfj79l2x7 ("A pre-requisite patch for the fix for Bug#52044.") It happens because close_thread_tables() is now called in open_and_lock_tables upon failure. Hence, table is no longer open when optimizer tries to do cleanup. Fix: Make sure to do cleanup in st_select_lex_unit::prepare() upon failure. This way, cleanup() is called before tables are released.
| * | | mergeGeorgi Kodinov2010-06-251-0/+25
| |\ \ \ | | |/ /
| | * | Bug #52711: Segfault when doing EXPLAIN SELECT withGeorgi Kodinov2010-04-151-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | union...order by (select... where...) The problem is mysql is trying to materialize and cache the scalar sub-queries at JOIN::optimize even for EXPLAIN where the number of columns is totally different from what's expected. Fixed by not executing the scalar subqueries for EXPLAIN.
| * | | Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.Alexey Kopytov2010-04-031-0/+83
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | Conflicts: Text conflict in storage/myisam/mi_delete_table.c
| | * | Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN Anurag Shekhar2010-04-021-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on index 'my_decimal' class has two members which can be used to access the value. The member variable buf (inherited from parent class decimal_t) is set to member variable buffer so that both are pointing to same value. Item_copy_decimal::copy() uses memcpy to clone 'my_decimal'. The member buffer is declared as an array and memcpy results in copying the values of the array, but the inherited member buf, which should be pointing at the begining of the array 'buffer' starts pointing to the begining of buffer in original object (which is being cloned). Further updates on 'my_decimal' updates only the inherited member 'buf' but leaves buffer unchanged. Later when the new object (which now holds a inconsistent value) is cloned again using proper cloning function 'my_decimal2decimal' the buf pointer is fixed resulting in loss of the current value. Using my_decimal2decimal instead of memcpy in Item_copy_decimal::copy() fixed this problem.
| * | | Manual merge from mysql-trunk-merge.Alexander Nozdrin2010-02-241-0/+17
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: - client/mysql.cc - client/mysqldump.c - configure.in - mysql-test/r/csv.result - mysql-test/r/func_time.result - mysql-test/r/show_check.result - mysql-test/r/sp-error.result - mysql-test/r/sp.result - mysql-test/r/sp_trans.result - mysql-test/r/type_blob.result - mysql-test/r/type_timestamp.result - mysql-test/r/warnings.result - mysql-test/suite/rpl/r/rpl_sp.result - sql/mysql_priv.h - sql/mysqld.cc - sql/sp.cc - sql/sql_base.cc - sql/sql_table.cc - sql/sql_trigger.cc - sql/sql_view.cc - sql/table.h - sql/share/errmsg.txt - mysql-test/suite/sys_vars/r/log_bin_trust_routine_creators_basic.result
| | * | Bug #45989 take 2 : memory leak after explain encounters anGeorgi Kodinov2010-02-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | error in the query. Fixes a leak after materializing a GROUP BY subquery to a temp table when the subquery has a blob column in the SELECT list. Fixed by correctly destructing temporary buffers for re-usable queries
| * | | Auto-merge from mysql-trunk-merge.Alexander Nozdrin2010-01-281-0/+15
| |\ \ \ | | |/ /
| | * | Bug #49512 : subquery with aggregate function crashGeorgi Kodinov2009-12-231-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subselect_single_select_engine::exec() When a subquery doesn't need to be evaluated because it returns only aggregate functions and these aggregates can be calculated from the metadata about the table it was not updating all the relevant members of the JOIN structure to reflect that this is a constant query. This caused problems to the enclosing subquery ('<> SOME' in the test case above) trying to read some data about the tables. Fixed by setting const_tables to the number of tables when the SELECT is optimized away.
| | * | revert of the fix for bug #45989: pushed by mistake.Georgi Kodinov2010-01-191-17/+0
| | | |
| | * | Bug #45989 take 2 : memory leak after explain encounters anGeorgi Kodinov2010-01-181-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | error in the query. Fixes a leak after materializing a GROUP BY subquery to a temp table when the subquery has a blob column in the SELECT list. Fixed by correctly destructing temporary buffers after doing the conversion.
| * | | Manual merge from mysql-trunk-merge.Alexander Nozdrin2009-12-161-0/+26
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: - include/my_no_pthread.h - mysql-test/r/sp-ucs2.result - sql/log.cc - sql/sql_acl.cc - sql/sql_yacc.yy
| | * | Bug #48709: Assertion failed in sql_select.cc:11782:Georgi Kodinov2009-12-151-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int join_read_key(JOIN_TAB*) The eq_ref access method TABLE_REF (accessed through JOIN_TAB) to save state and to track if this is the first row it finds or not. This state was not reset on subquery re-execution causing an assert. Fixed by resetting the state before the subquery re-execution.
| | * | automergeKristofer Pettersson2009-11-031-1/+1
| | |\ \
| * | \ \ merge of Bug#33204 (backport)Martin Hansson2009-11-201-1/+15
| |\ \ \ \
| | * \ \ \ Manual merge from mysql-5.1.Alexander Nozdrin2009-11-051-1/+1
| | |\ \ \ \ | | | |/ / / | | |/| / / | | | |/ /
| | | * | mergeGeorgi Kodinov2009-10-301-1/+1
| | | |\ \ | | | | |/
| | | | * Bug #48293: crash with procedure analyse, view with > 10 columns,Georgi Kodinov2009-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | having clause... The fix for bug 46184 was not very complete. It was not covering views using temporary tables and multiple tables in a FROM clause. Fixed by reverting the fix for 46184 and making a more general check that is checking at the right execution stage and for all of the non-supported cases. Now PROCEDURE ANALYZE on non-top level SELECT is also forbidden. Updated the analyse.test and subselect.test accordingly.