summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_in.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.0' into 10.1Sergei Golubchik2016-06-281-0/+22
|\
| * MDEV-10020 InnoDB NOT IN Query Crash When One Item Is NULLAlexander Barkov2016-06-201-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the loop in get_func_mm_tree() accessed improperly initialized instances of String, which resided in the bzero'ed part of the in_vector::base array. Strings in in_vector::base are originally initialized in Item_func_in::fix_length_and_dec(), in in_vector::in_vector() using sql_calloc, rather than using a String constructor, so their str_charset members are originally equal to NULL. Strings in in_vector::base are later initialized to good values in Item_func_in::fix_length_and_dec(), using array->set(), in this code: uint j=0; for (uint i=1 ; i < arg_count ; i++) { array->set(j,args[i]); if (!args[i]->null_value) // Skip NULL values j++; else have_null= 1; } if ((array->used_count= j)) array->sort(); NULLs are not taken into account, so at the end array->used_count can be smaller than array->count. This patch fixes the loop in opt_range.cc, in get_func_mm_tree(), to access only properly initialized elements in in_vector::base, preventing access to its bzero'ed non-initialized tail.
* | MDEV-8755 Equal field propagation is not performed any longer for the IN ↵Alexander Barkov2015-09-111-0/+13
|/ | | | list when multiple comparison types
* Add back testcase for lp:817966 (was lost in the merge)Sergey Petrunya2012-06-231-0/+18
|
* Merge 5.3 -> 5.5Sergey Petrunya2012-06-201-0/+11
|\
| * Merge 5.2->5.3Sergey Petrunya2012-06-181-1/+11
| |\
| | * Fix of LP bug#992380 + revise fix_fields about missing with_subselect collectionunknown2012-05-221-0/+11
| | | | | | | | | | | | The problem is that some fix_fields do not call Item_func::fix_fields and do not collect with subselect_information.
| * | 5.2 mergeSergei Golubchik2012-05-201-0/+13
| |\ \ | | |/
* | | mysql 5.5.23 mergeSergei Golubchik2012-04-101-0/+13
|\ \ \ | | |/ | |/|
| * | Bug#13012483:EXPLAIN EXTENDED, PREPARED STATEMENT, CRASH INChaithra Gopalareddy2012-02-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CHECK_SIMPLE_EQUALITY PROBLEM: Crash in "check_simple_equality" when using a subquery with "IN" and "ALL" in prepare. ANALYSIS: Crash can be reproduced using a simplified query like this one: prepare s from "select 1 from g1 where 1 < all ( select @:=(1 in (select 1 from g1)) from g1)"; This bug is currently present only on 5.5.and 5.1. Its fixed as part of work log(#1110) in 5.6. We are taking one change to fix this in 5.5 and 5.1. Problem seems to be present because we are trying to evaluate "is_null" on an argument which is part of a subquery (In Item_is_not_null_test::update_used_tables()). But the condition to evaluate is only when we do not have a sub query present, which means to say that "with_subselect" is not set. With respect to the above query, we create an object of type "Item_in_optimizer" which by definition is always associated with a subquery. While in 5.6 we set "with_subselect" to true for "Item_in_optimizer" object, we do not do the same in 5.5. This results in the evaluation for "is_null" resulting in a coredump. So, we are now setting "with_subselect" to true for "Item_in_optimizer" in 5.1 and 5.5. mysql-test/r/func_in.result: Result file changes for the test case added mysql-test/t/func_in.test: Test case added for Bug#13012483 sql/item_cmpfunc.h: Changed Item_in_optimizer::Item_in_optimizer( ) to set "with_subselect" to true
* | | merge with mysql-5.5.21Sergei Golubchik2012-03-091-19/+0
|\ \ \ | |/ / | | / | |/ |/|
* | lp:817966 int_column IN (string_constant)Sergei Golubchik2011-10-131-0/+20
|/ | | | restore the status quo from before the microsecond patch
* Bug#11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGSSergey Glukhov2011-04-121-0/+6
| | | | | | | | | | | | | | | | | | Valgrind warning happens due to early null values check in Item_func_in::fix_length_and_dec(before item evaluation). As result null value items with uninitialized values are placed into array and it leads to valgrind warnings during value array sorting. The fix is to check null value after item evaluation, item is evaluated in in_array::set() method. mysql-test/r/func_in.result: test case mysql-test/t/func_in.test: test case sql/item_cmpfunc.cc: The fix is to check null value after item evaluation.
* Bug#54477: Crash on IN / CASE with NULL argumentsAlexey Kopytov2010-06-221-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Incorrect handling of NULL arguments could lead to a crash on the IN or CASE operations when either NULL arguments were passed explicitly as arguments (IN) or implicitly generated by the WITH ROLLUP modifier (both IN and CASE). Item_func_case::find_item() assumed all necessary comparators to be instantiated in fix_length_and_dec(). However, in the presence of WITH ROLLUP modifier, arguments could be substituted with an Item_null leading to an "unexpected" STRING_RESULT comparator being invoked. In addition to the problem identical to the above, Item_func_in::val_int() could crash even with explicitly passed NULL arguments due to an optimization in fix_length_and_dec() leading to NULL arguments being ignored during comparators creation. mysql-test/r/func_in.result: Test cases for bug#54477. mysql-test/t/func_in.test: Test cases for bug#54477. sql/item_cmpfunc.cc: Added additional checks for Item_nulls in Item_func_case::find_item() and Item_func_in::val_int().
* Bug #44139: Table scan when NULL appears in IN clauseGleb Shchepa2009-10-051-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SELECT ... WHERE ... IN (NULL, ...) does full table scan, even if the same query without the NULL uses efficient range scan. The bugfix for the bug 18360 introduced an optimization: if 1) all right-hand arguments of the IN function are constants 2) result types of all right argument items are compatible enough to use the same single comparison function to compare all of them to the left argument, then we can convert the right-hand list of constant items to an array of equally-typed constant values for the further QUICK index access etc. (see Item_func_in::fix_length_and_dec()). The Item_null constant item objects have STRING_RESULT result types, so, as far as Item_func_in::fix_length_and_dec() is aware of NULLs in the right list, this improvement efficiently optimizes IN function calls with a mixed right list of NULLs and string constants. However, the optimization doesn't affect mixed lists of NULLs and integers, floats etc., because there is no unique common comparator. New optimization has been added to ignore the result type of NULL constants in the static analysis of mixed right-hand lists. This is safe, because at the execution phase we care about presence of NULLs anyway. 1. The collect_cmp_types() function has been modified to optionally ignore NULL constants in the item list. 2. NULL-skipping code of the Item_func_in::fix_length_and_dec() function has been modified to work not only with in_string vectors but with in_vectors of other types. mysql-test/r/func_in.result: Added test case for the bug #44139. mysql-test/t/func_in.test: Added test case for the bug #44139. sql/item_cmpfunc.cc: Bug #44139: Table scan when NULL appears in IN clause 1. The collect_cmp_types() function has been modified to optionally ignore NULL constants in the item list. 2. NULL-skipping code of the Item_func_in::fix_length_and_dec() function has been modified to work not only with in_string vectors but with in_vectors of other types.
* Bug #44399 : crash with statement using TEXT columns, aggregates, GROUP BY, andGeorgi Kodinov2009-05-251-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HAVING When calculating GROUP BY the server caches some expressions. It does that by allocating a string slot (Item_copy_string) and assigning the value of the expression to it. This effectively means that the result type of the expression can be changed from whatever it was to a string. As this substitution takes place after the compile-time result type calculation for IN but before the run-time type calculations, it causes the type calculations in the IN function done at run time to get unexpected results different from what was prepared at compile time. In the CASE ... WHEN ... THEN ... statement there was a similar problem and it was solved by artificially adding a STRING argument to the set of types of the IN/CASE arguments at compile time, so if any of the arguments of the CASE function changes its type to a string it will still be covered by the information prepared at compile time. mysql-test/include/mix1.inc: Bug #44399: extended the test to cover the different types mysql-test/r/func_in.result: Bug #44399: test case mysql-test/r/innodb_mysql.result: Bug #44399: extended the test to cover the different types mysql-test/t/func_in.test: Bug #44399: test case sql/item.cc: Bug #44399: Implement typed caching for GROUP BY sql/item.h: Bug #44399: Implement typed caching for GROUP BY sql/item_cmpfunc.cc: Bug #44399: remove the special case sql/sql_select.cc: Bug #44399: Implement typed caching for GROUP BY
* Revert of the fix for bug #44399 (joro@sun.com-20090512135917-kal1dvtqpqgnj3yc).Georgi Kodinov2009-05-201-10/+0
|
* Bug #44399: crash with statement using TEXT columns, aggregates, GROUP BY, Georgi Kodinov2009-05-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and HAVING When calculating GROUP BY the server caches some expressions. It does that by allocating a string slot (Item_copy_string) and assigning the value of the expression to it. This effectively means that the result type of the expression can be changed from whatever it was to a string. As this substitution takes place after the compile-time result type calculation for IN but before the run-time type calculations, it causes the type calculations in the IN function done at run time to get unexpected results different from what was prepared at compile time. In the CASE ... WHEN ... THEN ... statement there was a similar problem and it was solved by artificially adding a STRING argument to the matrix at compile time, so if any of the arguments of the CASE function changes its type to a string it will still be covered by the information prepared at compile time. Extended the CASE fix for cover the IN case. An alternative way of fixing this problem is by caching the result type of the arguments at compile time and using the cached information at run time instead of re-calculating the result types. Preferred the CASE approach for uniformity and fix localization. mysql-test/r/func_in.result: Bug #44399: test case mysql-test/t/func_in.test: Bug #44399: test case sql/item_cmpfunc.cc: Bug #44399: assume at compile time there's an extra string argument in the IN function (similar to CASE) to cater for possible string conversions in the process of calculating the GROUP BY/aggregates.
* Bug #41363: crash of mysqld on windows with aggregate in caseGleb Shchepa2008-12-311-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Execution of queries containing the CASE function of aggregate function like in "SELECT ... CASE ARGV(...) WHEN ..." crashed the server. The CASE function caches pointers to concrete comparison functions for an each pair of types of CASE-WHERE clause parameters, i.e. for the "CASE INT_RESULT WHERE REAL_RESULT THEN ... WHERE DECIMAL_RESULT ... END" function call it caches comparisons for INT_RESULT with REAL_RESULT and for INT_RESULT with DECIMAL_RESULT. Usually a result type is known after a call to the fix_fields function, however, the setup_copy_fields function call may wrap aggregate items with Item_copy_string that has STRING_RESULT result type, so setup_copy_fields may change argument result types of the CASE function after call to Item_func_case::fix_fields/fix_length_and_dec. Then the Item_func_case::find_item function tries to use comparison function for unexpected pair of the STRING_RESULT and some other type - that caused an assertion failure of server crash. The Item_func_case::fix_length_and_dec function has been modified to take into account possible STRING_RESULT result type in the presence of aggregate arguments of the CASE function. mysql-test/r/func_in.result: Added test case for bug #41363. mysql-test/t/func_in.test: Added test case for bug #41363. sql/item_cmpfunc.cc: Bug #41363: crash of mysqld on windows with aggregate in case The Item_func_case::fix_length_and_dec function has been modified to take into account possible STRING_RESULT result type in the presence of aggregate arguments of the CASE function.
* Bug #37761: IN handles NULL differently for table-subquery Gleb Shchepa2008-07-141-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and value-list The server returns unexpected results if a right side of the NOT IN clause consists of NULL value and some constants of the same type, for example: SELECT * FROM t WHERE NOT t.id IN (NULL, 1, 2) may return 3, 4, 5 etc if a table contains these values. The Item_func_in::val_int method has been modified: unnecessary resets of an Item_func_case::has_null field value has been moved outside of an argument comparison loop. (Also unnecessary re-initialization of the null_value field has been moved). mysql-test/r/func_in.result: Added test case for bug #37761. mysql-test/t/func_in.test: Added test case for bug #37761. sql/item_cmpfunc.cc: Bug #37761: IN handles NULL differently for table-subquery and value-list The Item_func_in::val_int method has been modified: unnecessary resets of an Item_func_case::has_null field value has been moved outside of an argument comparison loop. (Also unnecessary re-initialization of the null_value field has been moved).
* Fixed bug #31075.unknown2007-09-261-0/+8
| | | | | | | | | | | | | | | | | | | | The `SELECT col FROM t WHERE col NOT IN (col, ...) GROUP BY col' crashed in the range optimizer. The get_func_mm_tree function has been modified to check the Item_func_in::array field for the NULL value before using of that value. sql/opt_range.cc: Fixed bug #31075. The get_func_mm_tree function has been modified to check the Item_func_in::array field for the NULL value before using of that value. mysql-test/t/func_in.test: Added test case for bug #31075. mysql-test/r/func_in.result: Added test case for bug #31075.
* Merge mysql.com:/home/ram/work/b28748/b28748.5.0unknown2007-06-131-11/+20
|\ | | | | | | | | | | | | | | | | | | into mysql.com:/home/ram/work/b28748/b28748.5.1 mysql-test/r/func_in.result: Auto merged mysql-test/t/func_in.test: Auto merged
| * Fix for bug #28748: "Select" returning one value too fewunknown2007-06-091-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: we may get unexpected results comparing [u]longlong values as doubles. Fix: adjust the test to use integer comparators. Note: it's not a real fix, we have to implement some new comparators to completely solve the original problem (see my comment in the bug report). mysql-test/r/func_in.result: Fix for bug #28748: "Select" returning one value too few - result adjusted. mysql-test/t/func_in.test: Fix for bug #28748: "Select" returning one value too few - test adjusted to use integer comparisons.
* | Merge mysql.com:/home/hf/work/mrg/mysql-5.0-optunknown2007-03-221-0/+11
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/hf/work/mrg/mysql-5.1-opt mysql-test/r/func_in.result: Auto merged mysql-test/t/func_in.test: Auto merged sql/item_cmpfunc.cc: Auto merged
| * Fixed bug #27362: crash at evaluation of IN predicate when oneunknown2007-03-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | of its argument happened to be a decimal expression returning the NULL value. The crash was due to the fact the function in_decimal::set did not take into account that val_decimal() could return 0 if the decimal expression had been evaluated to NULL. mysql-test/r/func_in.result: Added a test case for bug #27362. mysql-test/t/func_in.test: Added a test case for bug #27362.
* | Merge mysql.com:/home/hf/work/mrg/mysql-5.0-optunknown2007-03-081-0/+62
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/hf/work/mrg/mysql-5.1-opt BUILD/check-cpu: Auto merged mysql-test/r/explain.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/func_test.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/update.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/explain.test: Auto merged mysql-test/t/func_str.test: Auto merged mysql-test/t/sp.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_update.cc: Auto merged mysql-test/r/func_in.result: SCCS merged mysql-test/r/order_by.result: SCCS merged mysql-test/r/sp.result: merging mysql-test/t/func_in.test: SCCS merged mysql-test/t/order_by.test: SCCS merged mysql-test/t/view.test: merging sql/item_cmpfunc.h: merging sql/mysql_priv.h: merging sql/sql_select.cc: SCCS merged
| * Bug#19342: additional test case for code coverageunknown2007-03-061-1/+5
| |
| * Bug #19342:unknown2007-03-021-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several problems here : 1. The conversion to double of an hex string const item was not taking into account the unsigned flag. 2. IN was not behaving in the same was way as comparisons when performed over an INT/DATE/DATETIME/TIMESTAMP column and a constant. The ordinary comparisons in that case convert the constant to an INTEGER value and do int comparisons. Fixed the IN to do the same. 3. IN is not taking into account the unsigned flag when calculating <expr> IN (<int_const1>, <int_const2>, ...). Extended the implementation of IN to store and process the unsigned flag for its arguments. mysql-test/r/func_in.result: Bug #19342: test case mysql-test/t/func_in.test: Bug #19342: test case sql/item.h: Bug #19342: correct handling of sign in conersion to real. sql/item_cmpfunc.cc: Bug #19342: exteneded the IN values list to support unsigned longlong values. Correct comparison of integers in IN with regard of signedness. Compare DATE/DATETIME/TIMESTAMP values as integers in IN. sql/item_cmpfunc.h: Bug #19342: exteneded the IN values list to support unsigned longlong values. Correct comparison of integers in IN with regard of signedness.
| * Merge mysql.com:/home/gluh/MySQL/Merge/5.0unknown2007-01-231-0/+36
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/gluh/MySQL/Merge/5.0-opt mysql-test/r/func_in.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/sp-code.result: Auto merged mysql-test/t/func_in.test: Auto merged mysql-test/t/range.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/view.test: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged mysql-test/r/select.result: manual merge mysql-test/r/view.result: manual merge mysql-test/t/select.test: manual merge
| * \ Merge polly.local:/tmp/maint/bug24261/my50-bug24261unknown2006-12-081-0/+7
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into polly.local:/home/kaa/src/maint/mysql-5.0-maint mysql-test/r/func_in.result: Auto merged mysql-test/t/func_in.test: Auto merged sql/opt_range.cc: Auto merged
* | \ \ Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-optunknown2007-02-161-36/+35
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into rakia.gmz:/home/kgeorge/mysql/autopush/B20420-5.1-opt mysql-test/r/func_in.result: Auto merged mysql-test/t/func_in.test: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/opt_range.cc: Auto merged
| * | | | BUG#20420: optimizer reports wrong keys on left join with INunknown2007-02-161-36/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When checking if an IN predicate can be evaluated using a key the optimizer makes sure that all the arguments of IN are of the same result type. To assure that it check whether Item_func_in::array is filled in. However Item_func_in::array is set if the types are the same AND all the arguments are compile time constants. Fixed by introducing Item_func_in::arg_types_compatible flag to allow correct checking of the desired condition. mysql-test/r/func_in.result: BUG#20420: optimizer reports wrong keys on left join with IN - reenabled the test case mysql-test/t/func_in.test: BUG#20420: optimizer reports wrong keys on left join with IN - reenabled the test case sql/item_cmpfunc.cc: BUG#20420: optimizer reports wrong keys on left join with IN Check the IN argument types in a correct way sql/item_cmpfunc.h: BUG#20420: optimizer reports wrong keys on left join with IN Check the IN argument types in a correct way sql/opt_range.cc: BUG#20420: optimizer reports wrong keys on left join with IN Check the IN argument types in a correct way
* | | | | Merge mysql.com:/home/gluh/MySQL/Merge/5.1unknown2007-01-241-0/+38
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/gluh/MySQL/Merge/5.1-opt BitKeeper/etc/ignore: auto-union mysql-test/r/func_in.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/sp-code.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/t/func_in.test: Auto merged mysql-test/t/range.test: Auto merged mysql-test/t/trigger.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged mysql-test/r/select.result: manual merge mysql-test/r/view.result: manual merge mysql-test/t/select.test: manual merge mysql-test/t/view.test: manual merge
| * | | | merge of 5.0-opt -> 5.1-optunknown2007-01-241-34/+36
| | | | |
| * | | | Merge macbook.gmz:/Users/kgeorge/mysql/work/mysql-5.0-optunknown2007-01-231-0/+36
| |\ \ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt mysql-test/r/func_in.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/sp-code.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/func_in.test: Auto merged mysql-test/t/func_str.test: Auto merged mysql-test/t/range.test: Auto merged mysql-test/t/select.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/udf.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_update.cc: Auto merged mysql-test/r/func_str.result: merge 5.0-opt -> 5.1-opt mysql-test/r/group_by.result: merge 5.0-opt -> 5.1-opt mysql-test/r/insert.result: merge 5.0-opt -> 5.1-opt mysql-test/r/subselect.result: merge 5.0-opt -> 5.1-opt mysql-test/t/group_by.test: merge 5.0-opt -> 5.1-opt mysql-test/t/insert.test: merge 5.0-opt -> 5.1-opt mysql-test/t/subselect.test: merge 5.0-opt -> 5.1-opt mysql-test/t/view.test: merge 5.0-opt -> 5.1-opt sql/item_cmpfunc.h: merge 5.0-opt -> 5.1-opt sql/item_strfunc.h: merge 5.0-opt -> 5.1-opt
| | * | | BUG#20420: optimizer reports wrong keys on left join with INunknown2007-01-151-0/+36
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The optimizer needs to evaluate whether predicates are better evaluated using an index. IN is one such predicate. To qualify an IN predicate must involve a field of the index on the left and constant arguments on the right. However whether an expression is a constant can be determined only by knowing the preceding tables in the join order. Assuming that only IN predicates with expressions on the right that are constant for the whole query qualify limits the scope of possible optimizations of the IN predicate (more specifically it doesn't allow the "Range checked for each record" optimization for such an IN predicate. Fixed by not pre-determining the optimizability of the IN predicate in the case when all right IN operands are not SQL constant expressions mysql-test/r/func_in.result: BUG#20420: optimizer reports wrong keys on left join with IN - test case mysql-test/t/func_in.test: BUG#20420: optimizer reports wrong keys on left join with IN - test case sql/item_cmpfunc.h: BUG#20420: optimizer reports wrong keys on left join with IN - cannot decide on the optimizability of a function without knowing the tables before it in the join order
* | | | Merge polly.local:/tmp/maint/bug24261/my51-bug24261unknown2006-12-081-0/+7
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into polly.local:/home/kaa/src/maint/mysql-5.1-maint mysql-test/r/func_in.result: Auto merged mysql-test/t/func_in.test: Auto merged sql/opt_range.cc: Auto merged
| * | | Merge polly.local:/tmp/maint/bug24261/my50-bug24261unknown2006-12-081-0/+7
| |\ \ \ | | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into polly.local:/tmp/maint/bug24261/my51-bug24261 mysql-test/r/func_in.result: Auto merged mysql-test/t/func_in.test: Auto merged sql/opt_range.cc: Auto merged
| | * | Fix for bug #24261 "crash when WHERE contains NOT IN ('<negative value>') ↵unknown2006-11-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for unsigned column type" When calculating a SEL_TREE for the "c_{i-1} < X < c_i" interval, check if the tree returned for the "-inf < X < c_0" interval is NULL mysql-test/r/func_in.result: Added testcase for bug #24261 "crash when WHERE contains NOT IN ('<negative value>') for unsigned column type" mysql-test/t/func_in.test: Added testcase for bug #24261 "crash when WHERE contains NOT IN ('<negative value>') for unsigned column type" sql/opt_range.cc: When calculating a SEL_TREE for the "c_{i-1} < X < c_i" interval, check if the tree returned for the "-inf < X < c_0" interval is NULL
* | | | Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug17047unknown2006-11-161-1/+29
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-bug17047 sql/item_cmpfunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged mysql-test/r/func_in.result: Manual merge. Add "End of <version> tests" marker. mysql-test/r/func_str.result: Manual merge. Add "End of <version> tests" marker. mysql-test/t/func_in.test: Manual merge. Add "End of <version> tests" marker. mysql-test/t/func_str.test: Manual merge. Add "End of <version> tests" marker.
| * | Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1-bug17047unknown2006-11-161-1/+25
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug17047 sql/item_cmpfunc.cc: Auto merged mysql-test/r/func_in.result: Manual merge. Add "End of 5.0 tests". mysql-test/t/func_in.test: Manual merge. Add "End of 5.0 tests".
| | * BUG#17047: CHAR() and IN() can return NULL without signaling NULL resultunknown2006-11-161-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that some functions (namely IN() starting with 4.1, and CHAR() starting with 5.0) were returning NULL in certain conditions, while they didn't set their maybe_null flag. Because of that there could be some problems with 'IS NULL' check, and statements that depend on the function value domain, like CREATE TABLE t1 SELECT 1 IN (2, NULL);. The fix is to set maybe_null correctly. mysql-test/r/func_in.result: Add result for bug#17047: CHAR() and IN() can return NULL without signaling NULL result. mysql-test/t/func_in.test: Add test case for bug#17047: CHAR() and IN() can return NULL without signaling NULL result. sql/item_cmpfunc.cc: Remove assignment to maybe_null, as it was already set in fix_fields() based on all arguments, not only on the first.
| * | Mergeunknown2006-06-201-12/+0
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | mysql-test/t/func_in.test: Auto merged sql/item_cmpfunc.cc: Auto merged mysql-test/r/func_in.result: SCCS merged
| | * item_cmpfunc.cc, func_in.result, func_in.test:unknown2006-06-201-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverted fix for bug#18360 mysql-test/t/func_in.test: Reverted fix for bug#18360 mysql-test/r/func_in.result: Reverted fix for bug#18360 sql/item_cmpfunc.cc: Reverted fix for bug#18360
| * | Manually mergedunknown2006-05-301-0/+12
| |\ \ | | |/ | | | | | | | | | mysql-test/t/func_in.test: Auto merged
| | * Fixed bug#18360: Incorrect type coercion in IN() results in false comparisonunknown2006-05-301-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IN() function uses agg_cmp_type() to aggregate all types of its arguments to find out some common type for comparisons. In this particular case the char() and the int was aggregated to double because char() can contain values like '1.5'. But all strings which do not start from a digit are converted to 0. thus 'a' and 'z' become equal. This behaviour is reasonable when all function arguments are constants. But when there is a field or an expression this can lead to false comparisons. In this case it makes more sense to coerce constants to the type of the field argument. The agg_cmp_type() function now aggregates types of constant and non-constant items separately. If some non-constant items will be found then their aggregated type will be returned. Thus after the aggregation constants will be coerced to the aggregated type. mysql-test/t/func_in.test: Added test case for bug#18360: Incorrect type coercion in IN() results in false comparison. mysql-test/r/func_in.result: Added test case for bug#18360: Incorrect type coercion in IN() results in false comparison. sql/item_cmpfunc.cc: Fixed bug#18360: Incorrect type coercion in IN() results in false comparison. The agg_cmp_type() function now aggregates types of constant and non-constant items separately. If some non-constant items will be found then their aggregated type will be returned. Thus after the aggregation constants will be coerced to the aggregated type.
* | | Fixed bug #18360: Type aggregation for IN and CASE may lead to a wrongunknown2006-09-261-0/+24
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | result The IN function aggregates result types of all expressions. It uses that type in comparison of left expression and expressions in right part. This approach works in most cases. But let's consider the case when the right part contains both strings and integers. In that case this approach may cause wrong results because all strings which do not start with a digit are evaluated as 0. CASE uses the same approach when a CASE expression is given thus it's also affected. The idea behind this fix is to make IN function to compare expressions with different result types differently. For example a string in the left part will be compared as string with strings specified in right part and will be converted to real for comparison to int or real items in the right part. A new function called collect_cmp_types() is added. It collects different result types for comparison of first item in the provided list with each other item in the list. The Item_func_in class now can refer up to 5 cmp_item objects: 1 for each result type for comparison purposes. cmp_item objects are allocated according to found result types. The comparison of the left expression with any right part expression is now based only on result types of these expressions. The Item_func_case class is modified in the similar way when a CASE expression is specified. Now it can allocate up to 5 cmp_item objects to compare CASE expression with WHEN expressions of different types. The comparison of the CASE expression with any WHEN expression now based only on result types of these expressions. sql/item.cc: Cleaned up an outdated comment. sql/item_cmpfunc.cc: Fixed bug #18360: Type aggregation for IN and CASE may lead to a wrong result A new function called collect_cmp_types() is added. It collects different result types for comparison of first item in the provided list with each other item in the list. The Item_func_in class now can refer up to 5 cmp_item objects: 1 for each result type for comparison purposes. cmp_item objects are allocated according to found result types. The comparison of the left expression with any right part expression is now based only on result types of these expressions. The Item_func_case class is modified in the similar way when a CASE expression is specified. Now it can allocate up to 5 cmp_item objects to compare CASE expression with WHEN expressions of different types. The comparison of the CASE expression with any WHEN expression now based only on result types of these expressions. sql/item_cmpfunc.h: Fixed bug#18360: Type aggregation for IN and CASE may lead to a wrong result The Item_func_in class now can refer up to 5 cmp_item objects. The Item_func_case class is modified in the similar way. sql/opt_range.cc: Fixed bug #18360: Type aggregation for IN and CASE may lead to a wrong resultSmall code changes due to changes in Item_func_in class. mysql-test/t/view.test: Added a test comment mysql-test/t/func_in.test: Added a test case for bug#18360: Type aggregation for IN and CASE may lead to a wrong result mysql-test/r/func_in.result: Added a test case for bug#18360: Type aggregation for IN and CASE may lead to a wrong result
* | BUG#19618: Crash for unsigned_col NOT IN (-1, ... ) unknown2006-05-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | - When manually constructing a SEL_TREE for "t.key NOT IN(...)", take into account that get_mm_parts may return a tree with type SEL_TREE::IMPOSSIBLE - Added missing OOM checks - Added comments mysql-test/r/func_in.result: Testcase for BUG#19618 mysql-test/t/func_in.test: Testcase for BUG#19618
* | BUG#15872: Don't run the range analyzer on "t1.keypart NOT IN (const1, ..., ↵unknown2006-04-251-1/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | )", as that consumes too much memory. Instead, either create the equvalent SEL_TREE manually, or create only two ranges that strictly include the area to scan (Note: just to re-iterate: increasing NOT_IN_IGNORE_THRESHOLD will make optimization run slower for big IN-lists, but the server will not run out of memory. O(N^2) memory use has been eliminated) mysql-test/r/func_in.result: Testcase for BUG#15872 mysql-test/t/func_in.test: Testcase for BUG#15872 sql/item.cc: BUG#15872: Added Item_decimal::set_decimal_value() sql/item.h: UG#15872: Added Item_decimal::set_decimal_value() sql/item_cmpfunc.h: BUG#15872: Added in_vector::create_item(), in_vector::value_to_item() and their implementations in concrete classes. sql/opt_range.cc: BUG#15872: Don't run the range analyzer on "t1.keypart NOT IN (const1, ..., )", as that consumes too much memory. Instead, either A) create the equivalent SEL_TREE manually, making use of the fact that item_not_in->array has an ordered IN-list, or B) create only two ranges: (-inf|NULL) < X < min_value_from_in_list, max_value_from_in_list < X (Choose #B if the IN-list has > 10K elements)
* | type_binary.result, type_binary.test:unknown2005-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new file mysql_fix_privilege_tables.sql, mysql_create_system_tables.sh: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding. Many files: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. Adding true BINARY/VARBINARY: new pad_char structure member. ctype-bin.c: Adding true BINARY/VARBINARY: new pad_char structure member. New strnxfrm, with two trailing length bytes. field.cc: Adding true BINARY/VARBINARY. sql/field.cc: Adding true BINARY/VARBINARY. strings/ctype-big5.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-bin.c: Adding true BINARY/VARBINARY: new pad_char structure member. New strnxfrm, with two trailing length bytes. strings/ctype-cp932.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-czech.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-euc_kr.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-eucjpms.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-extra.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-gb2312.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-gbk.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-latin1.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-simple.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-sjis.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-tis620.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-uca.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-ucs2.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-ujis.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-utf8.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-win1250ch.c: Adding true BINARY/VARBINARY: new pad_char structure member. include/m_ctype.h: Adding true BINARY/VARBINARY: new pad_char structure member. mysql-test/t/alter_table.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/binary.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/cast.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ctype_cp1251.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ctype_many.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/federated.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/func_in.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ndb_condition_pushdown.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ndb_types.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/sp.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/type_blob.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/alter_table.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/binary.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/cast.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ctype_cp1251.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ctype_many.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/federated.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/func_in.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ndb_condition_pushdown.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ndb_types.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/sp.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/system_mysql_db.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/type_blob.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. scripts/mysql_create_system_tables.sh: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding. scripts/mysql_fix_privilege_tables.sql: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.