summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
Commit message (Collapse)AuthorAgeFilesLines
* Updated/added copyright headersKent Boortz2011-06-301-1/+1
|
* - Added/updated copyright headersKent Boortz2010-12-281-1/+1
| | | | | | | | | | | - Removed files specific to compiling on OS/2 - Removed files specific to SCO Unix packaging - Removed "libmysqld/copyright", text is included in documentation - Removed LaTeX headers for NDB Doxygen documentation - Removed obsolete NDB files - Removed "mkisofs" binaries - Removed the "cvs2cl.pl" script - Changed a few GPL texts to use "program" instead of "library"
* Bug#53933 crash when using uncacheable subquery in the having clause of ↵Sergey Glukhov2010-06-081-2/+2
| | | | | | | | outer query The problem is in the Item_func_isnull::update_used_tables() function, bracket is at the wrong place. Because of that isnull item erroneously is treated as const item. The fix is to set brackets in the right place.
* Fix for bug#49199: Optimizer handles incorrectly: Ramil Kalimullin2009-12-041-0/+4
| | | | | | | | | | | | | | | field='const1' AND field='const2' in some cases Building multiple equality predicates containing a constant which is compared as a datetime (with a field) we should take this fact into account and compare the constant with another possible constatns as datetimes as well. E.g. for the SELECT ... WHERE a='2001-01-01' AND a='2001-01-01 00:00:00' we should compare '2001-01-01' with '2001-01-01 00:00:00' as datetimes but not as strings.
* Bug#37553: MySql Error Compare TimeDiff & TimeTatiana A. Nurnberg2008-11-261-3/+3
| | | | | | | | | | | We pretended that TIMEDIFF() would always return positive results; this gave strange results in comparisons of the TIMEDIFF(low,hi)<TIME(0) type that rendered a negative result, but still gave false in comparison. We also inadvertantly dropped the sign when converting times to decimal. CAST(time AS DECIMAL) handles signs of the times correctly. TIMEDIFF() marked up as signed. Time/date comparison code switched to signed for clarity.
* Fix for bug #39021: SELECT REGEXP BINARY NULL never returnsRamil Kalimullin2008-09-051-1/+1
| | | | | | Problem: SELECT ... REGEXP BINARY NULL may lead to server crash/hang. Fix: properly handle NULL regular expressions.
* Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0tsmith@ramayana.hindu.god2007-12-041-1/+11
|\ | | | | | | into ramayana.hindu.god:/home/tsmith/m/bk/maint/50
| * Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0bar@bar.myoffice.izhnet.ru2007-10-301-0/+4
| |\ | | | | | | | | | into mysql.com:/home/bar/mysql-work/mysql-5.0-rpl-merge
| | * Bug#31081 server crash in regexp functionbar@mysql.com/bar.myoffice.izhnet.ru2007-10-051-0/+4
| | | | | | | | | | | | | | | | | | | | | Problem: The "regex" library written by Henry Spencer does not support tricky character sets like UCS2. Fix: convert tricky character sets to UTF8 before calling regex functions.
| * | Bug#27216: functions with parameters of different date types may return wrongevgen@sunlight.local2007-09-221-1/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type of the result. There are several functions that accept parameters of different types. The result field type of such functions was determined based on the aggregated result type of its arguments. As the DATE and the DATETIME types are represented by the STRING type, the result field type of the affected functions was always STRING for DATE/DATETIME arguments. The affected functions are COALESCE, IF, IFNULL, CASE, LEAST/GREATEST, CASE. Now the affected functions aggregate the field types of their arguments rather than their result types and return the result of aggregation as their result field type. The cached_field_type member variable is added to the number of classes to hold the aggregated result field type. The str_to_date() function's result field type now defaults to the MYSQL_TYPE_DATETIME. The agg_field_type() function is added. It aggregates field types with help of the Field::field_type_merge() function. The create_table_from_items() function now uses the item->tmp_table_field_from_field_type() function to get the proper field when the item is a function with a STRING result type.
* | Merge mysql.com:/home/ram/work/mysql-5.0-maintramil/ram@ramil.myoffice.izhnet.ru2007-10-291-0/+2
|\ \ | | | | | | | | | into mysql.com:/home/ram/work/b30782/b30782.5.0
| * | Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, ramil/ram@mysql.com/ramil.myoffice.izhnet.ru2007-10-291-0/+2
| |/ | | | | | | | | | | | | | | | | | | JOIN, and ORDER BY Problem: improper maximum length calculation of the CASE function leads to decimal value truncation (storing/retrieving decimal field values). Fix: accurately calculate maximum length/unsigned flag/decimals parameters of the CASE function.
* | Fix for bug #31207: Test "join_nested" shows different strategy on IA64kaa@polly.(none)2007-10-171-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | CPUs / Intel's ICC compile The bug is a combination of two problems: 1. IA64/ICC MySQL binaries use glibc's qsort(), not the one in mysys. 2. The order relation implemented by join_tab_cmp() is not transitive, i.e. it is possible to choose such a, b and c that (a < b) && (b < c) but (c < a). This implies that result of a sort using the relation implemented by join_tab_cmp() depends on the order in which elements are compared, i.e. the result is implementation-specific. Since choose_plan() uses qsort() to pre-sort the join tables using join_tab_cmp() as a compare function, the results of the sorting may vary depending on qsort() implementation. It is neither possible nor important to implement a better ordering algorithm in join_tab_cmp(). Therefore the only way to fix it is to force our own qsort() to be used by renaming it to my_qsort(), so we don't depend on linker to decide that. This patch also "fixes" bug #20530: qsort redefinition violates the standard.
* Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-basemalff/marcsql@weblab.(none)2007-08-301-0/+18
|\ | | | | | | into weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
| * Bug#30237 (Performance regression in boolean expressions)malff/marcsql@weblab.(none)2007-08-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a performance bug, related to the parsing or 'OR' and 'AND' boolean expressions. Let N be the number of expressions involved in a OR (respectively AND). When N=1 For example, "select 1" involve only 1 term: there is no OR operator. In 4.0 and 4.1, parsing expressions not involving OR had no overhead. In 5.0, parsing adds some overhead, with Select->expr_list. With this patch, the overhead introduced in 5.0 has been removed, so that performances for N=1 should be identical to the 4.0 performances, which are optimal (there is no code executed at all) The overhead in 5.0 was in fact affecting significantly some operations. For example, loading 1 Million rows into a table with INSERTs, for a table that has 100 columns, leads to parsing 100 Millions of expressions, which means that the overhead related to Select->expr_list is executed 100 Million times ... Considering that N=1 is by far the most probable expression, this case should be optimal. When N=2 For example, "select a OR b" involves 2 terms in the OR operator. In 4.0 and 4.1, parsing expressions involving 2 terms created 1 Item_cond_or node, which is the expected result. In 5.0, parsing these expression also produced 1 node, but with some extra overhead related to Select->expr_list : creating 1 list in Select->expr_list and another in Item_cond::list is inefficient. With this patch, the overhead introduced in 5.0 has been removed so that performances for N=2 should be identical to the 4.0 performances. Note that the memory allocation uses the new (thd->mem_root) syntax directly. The cost of "is_cond_or" is estimated to be neglectable: the real problem of the performance degradation comes from unneeded memory allocations. When N>=3 For example, "select a OR b OR c ...", which involves 3 or more terms. In 4.0 and 4.1, the parser had no significant cost overhead, but produced an Item tree which is difficult to evaluate / optimize during runtime. In 5.0, the parser produces a better Item tree, using the Item_cond constructor that accepts a list of children directly, but at an extra cost related to Select->expr_list. With this patch, the code is implemented to take the best of the two implementations: - there is no overhead with Select->expr_list - the Item tree generated is optimized and flattened. This is achieved by adding children nodes into the Item tree directly, with Item_cond::add(), which avoids the need for temporary lists and memory allocation Note that this patch also provide an extra optimization, that the previous code in 5.0 did not provide: expressions are flattened in the Item tree, based on what the expression already parsed is, and not based on the order in which rules are reduced. For example : "(a OR b) OR c", "a OR (b OR c)" would both be represented with 2 Item_cond_or nodes before this patch, and with 1 node only with this patch. The logic used is based on the mathematical properties of the OR operator (it's associative), and produces a simpler tree.
* | Fixed bug #30396.igor@olga.mysql.com2007-08-151-1/+0
|/ | | | | | | | | | | | | The bug caused memory corruption for some queries with top OR level in the WHERE condition if they contained equality predicates and other sargable predicates in disjunctive parts of the condition. The corruption happened because the upper bound of the memory allocated for KEY_FIELD and SARGABLE_PARAM internal structures containing info about potential lookup keys was calculated incorrectly in some cases. In particular it was calculated incorrectly when the WHERE condition was an OR formula with disjuncts being AND formulas including equalities and other sargable predicates.
* Extended fix for the bug#29555.evgen@moonbone.local2007-07-151-0/+2
| | | | | | | | | | | The get_time_value function is added. It is used to obtain TIME values both from items the can return time as an integer and from items that can return time only as a string. The Arg_comparator::compare_datetime function now uses pointer to a getter function to obtain values to compare. Now this function is also used for comparison of TIME values. The get_value_func variable is added to the Arg_comparator class. It points to a getter function for the DATE/DATETIME/TIME comparator.
* Bug#28133: Wrong DATE/DATETIME comparison in IN() function.evgen@moonbone.local2007-05-071-25/+77
| | | | | | | | | | | | | | | | | | | The IN function was comparing DATE/DATETIME values either as ints or as strings. Both methods have their disadvantages and may lead to a wrong result. Now IN function checks whether all of its arguments has the STRING result types and at least one of them is a DATE/DATETIME item. If so it uses either an object of the in_datetime class or an object of the cmp_item_datetime class to perform its work. If the IN() function arguments are rows then row columns are checked whether the DATE/DATETIME comparator should be used to compare them. The in_datetime class is used to find occurence of the item to be checked in the vector of the constant DATE/DATETIME values. The cmp_item_datetime class is used to compare items one by one in the DATE/DATETIME context. Both classes obtain values from items with help of the get_datetime_value() function and cache the left item if it is a constant one.
* Bug#16377: Wrong DATE/DATETIME comparison in BETWEEN function.evgen@moonbone.local2007-04-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | The BETWEEN function was comparing DATE/DATETIME values either as ints or as strings. Both methods have their disadvantages and may lead to a wrong result. Now BETWEEN function checks whether all of its arguments has the STRING result types and at least one of them is a DATE/DATETIME item. If so it sets up two Arg_comparator obects to compare with the compare_datetime() comparator and uses them to compare such items. Added two Arg_comparator object members and one flag to the Item_func_between class for the correct DATE/DATETIME comparison. The Item_func_between::fix_length_and_dec() function now detects whether it's used for DATE/DATETIME comparison and sets up newly added Arg_comparator objects to do this. The Item_func_between::val_int() now uses Arg_comparator objects to perform correct DATE/DATETIME comparison. The owner variable of the Arg_comparator class now can be set to NULL if the caller wants to handle NULL values by itself. Now the Item_date_add_interval::get_date() function ajusts cached_field type according to the detected type.
* Merge moonbone.local:/mnt/gentoo64/work/27590-bug-5.0-opt-mysqlevgen@moonbone.local2007-04-271-10/+17
|\ | | | | | | into moonbone.local:/mnt/gentoo64/work/16377-bug-5.0-opt-mysql
| * Bug#27590: Wrong DATE/DATETIME comparison.evgen@moonbone.local2007-04-271-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DATE and DATETIME can be compared either as strings or as int. Both methods have their disadvantages. Strings can contain valid DATETIME value but have insignificant zeros omitted thus became non-comparable with other DATETIME strings. The comparison as int usually will require conversion from the string representation and the automatic conversion in most cases is carried out in a wrong way thus producing wrong comparison result. Another problem occurs when one tries to compare DATE field with a DATETIME constant. The constant is converted to DATE losing its precision i.e. losing time part. This fix addresses the problems described above by adding a special DATE/DATETIME comparator. The comparator correctly converts DATE/DATETIME string values to int when it's necessary, adds zero time part (00:00:00) to DATE values to compare them correctly to DATETIME values. Due to correct conversion malformed DATETIME string values are correctly compared to other DATE/DATETIME values. As of this patch a DATE value equals to DATETIME value with zero time part. For example '2001-01-01' equals to '2001-01-01 00:00:00'. The compare_datetime() function is added to the Arg_comparator class. It implements the correct comparator for DATE/DATETIME values. Two supplementary functions called get_date_from_str() and get_datetime_value() are added. The first one extracts DATE/DATETIME value from a string and the second one retrieves the correct DATE/DATETIME value from an item. The new Arg_comparator::can_compare_as_dates() function is added and used to check whether two given items can be compared by the compare_datetime() comparator. Two caching variables were added to the Arg_comparator class to speedup the DATE/DATETIME comparison. One more store() method was added to the Item_cache_int class to cache int values. The new is_datetime() function was added to the Item class. It indicates whether the item returns a DATE/DATETIME value.
* | Merge gshchepa.loc:/home/uchum/work/bk-trees/mysql-4.1-opt-27704gshchepa/uchum@gshchepa.loc2007-04-201-1/+1
|\ \ | |/ |/| | | into gshchepa.loc:/home/uchum/work/bk-trees/mysql-5.0-opt-27704
| * Bug#27704: incorrect comparison of rows with NULL componentsgshchepa/uchum@gshchepa.loc2007-04-201-1/+3
| | | | | | | | | | | | Support for NULL components was incomplete for row comparison, fixed. Added support for abort_on_null at compare_row() like in 5.x
* | Merge olga.mysql.com:/home/igor/mysql-4.1-optigor@olga.mysql.com2007-04-031-0/+1
|\ \ | |/ | | | | into olga.mysql.com:/home/igor/mysql-5.0-opt
| * Fixed bug #27532: wrong results with ORDER/GROUP BY queries containingigor@olga.mysql.com2007-04-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | IN/BETWEEN predicates in sorting expressions. Wrong results may occur when the select list contains an expression with IN/BETWEEN predicate that differs from a sorting expression by an additional NOT only. Added the method Item_func_opt_neg::eq to compare correctly expressions containing [NOT] IN/BETWEEN. The eq method inherited from the Item_func returns TRUE when comparing 'a IN (1,2)' with 'a NOT IN (1,2)' that is not, of course, correct.
| * Merge bk-internal.mysql.com:/home/bk/mysql-4.1cmiller@zippy.cornsilk.net2007-02-131-0/+3
| |\ | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
| * | Fixed bug #24653.igor@olga.mysql.com2007-01-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug report has demonstrated the following two problems. 1. If an ORDER/GROUP BY list includes a constant expression being optimized away and, at the same time, containing single-row subselects that return more that one row, no error is reported. Strictly speaking the standard allows to ignore error in this case. Yet, now a corresponding fatal error is reported in this case. 2. If a query requires sorting by expressions containing single-row subselects that, however, return more than one row, then the execution of the query may cause a server crash. To fix this some code has been added that blocks execution of a subselect item in case of a fatal error in the method Item_subselect::exec.
* | | Merge bk@192.168.21.1:mysql-5.0holyfoot/hf@mysql.com/hfmain.(none)2007-03-081-2/+15
|\ \ \ | | | | | | | | | | | | into mysql.com:/home/hf/work/mrg/mysql-5.0-opt
| * | | fixed win32 warningsgkodinov/kgeorge@magare.gmz2007-03-021-1/+1
| | | |
| * | | Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-optgkodinov/kgeorge@magare.gmz2007-03-021-2/+15
| |\ \ \ | | | | | | | | | | | | | | | into magare.gmz:/home/kgeorge/mysql/autopush/B19342-5.0-opt
| | * | | Bug #19342:gkodinov/kgeorge@macbook.gmz2007-03-021-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-basemalff/marcsql@weblab.(none)2007-03-011-0/+86
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | into weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge
| * | | | Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-basemalff/marcsql@weblab.(none)2007-02-161-0/+86
| |\ \ \ \ | | | | | | | | | | | | | | | | | | into weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge
| | * | | | Bug#24532 (The return data type of IS TRUE is different from similarmalff/marcsql@weblab.(none)2007-02-121-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | operations) Before this change, the boolean predicates: - X IS TRUE, - X IS NOT TRUE, - X IS FALSE, - X IS NOT FALSE were implemented by expanding the Item tree in the parser, by using a construct like: Item_func_if(Item_func_ifnull(X, <value>), <value>, <value>) Each <value> was a constant integer, either 0 or 1. A bug in the implementation of the function IF(a, b, c), in Item_func_if::fix_length_and_dec(), would cause the following : When the arguments b and c are both unsigned, the result type of the function was signed, instead of unsigned. When the result of the if function is signed, space for the sign could be counted twice (in the max() expression for a signed argument, and in the total), causing the member max_length to be too high. An effect of this is that the final type of IF(x, int(1), int(1)) would be int(2) instead of int(1). With this fix, the problems found in Item_func_if::fix_length_and_dec() have been fixed. While it's semantically correct to represent 'X IS TRUE' with Item_func_if(Item_func_ifnull(X, <value>), <value>, <value>), there are however more problems with this construct. a) Building the parse tree involves : - creating 5 Item instances (3 ints, 1 ifnull, 1 if), - creating each Item calls my_pthread_getspecific_ptr() once in the operator new(size), and a second time in the Item::Item() constructor, resulting in a total of 10 calls to get the current thread. Evaluating the expression involves evaluating up to 4 nodes at runtime. This representation could be greatly simplified and improved. b) Transforming the parse tree internally with if(ifnull(...)) is fine as long as this transformation is internal to the server implementation. With views however, the result of the parse tree is later exposed by the ::print() functions, and stored as part of the view definition. Doing this has long term consequences: 1) The original semantic 'X IS TRUE' is lost, and replaced by the if(ifnull(...)) expression. As a result, SHOW CREATE VIEW does not restore the original code. 2) Should a future version of MySQL implement the SQL BOOLEAN data type for example, views created today using 'X IS NULL' can be exported using mysqldump, and imported again. Such views would be converted correctly and automatically to use a BOOLEAN column in the future version. With 'X IS TRUE' and the current implementations, views using these "boolean" predicates would not be converted during the export/import, and would use integer columns instead. The difference traces back to how SHOW CREATE VIEW preserves 'X IS NULL' but does not preserve the 'X IS TRUE' semantic. With this fix, internal representation of 'X IS TRUE' booleans predicates has changed, so that: - dedicated Item classes are created for each predicate, - only 1 Item is created to represent 1 predicate - my_pthread_getspecific_ptr() is invoked 1 time instead of 10 - SHOW CREATE VIEW preserves the original semantic, and prints 'X IS TRUE'. Note that, because of the fix in Item_func_if, views created before this fix will: - correctly use a int(1) type instead of int(2) for boolean predicates, - incorrectly print the if(ifnull(...), ...) expression in SHOW CREATE VIEW, since the original semantic (X IS TRUE) has been lost. - except for the syntax used in SHOW CREATE VIEW, these views will operate properly, no action is needed. Views created after this fix will operate correctly, and will preserve the original code semantic in SHOW CREATE VIEW.
* | | | | | Merge bk-internal.mysql.com:/home/bk/mysql-5.0monty@mysql.com/narttu.mysql.fi2007-02-211-14/+14
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | into mysql.com:/home/my/mysql-5.0
| * | | | | Merge bk-internal.mysql.com:/home/bk/mysql-5.0monty@mysql.com/narttu.mysql.fi2007-01-221-14/+14
| |\ \ \ \ \ | | |/ / / / | |/| | | | | | | | | | into mysql.com:/home/my/mysql-5.0
| | * | | | Fixed compiler warnings detected by option -Wshadow and -Wunused:monty@mysql.com/narttu.mysql.fi2006-12-151-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Removed not used variables and functions - Added #ifdef around code that is not used - Renamed variables and functions to avoid conflicts - Removed some not used arguments Fixed some class/struct warnings in ndb Added define IS_LONGDATA() to simplify code in libmysql.c I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
* | | | | | Merge bk-internal.mysql.com:/data0/bk/mysql-5.0ibabaev@bk-internal.mysql.com2007-02-131-1/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | into bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
| * | | | | | Fixed bug #26017.igor@olga.mysql.com2007-02-091-1/+0
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Objects of the class Item_equal contain an auxiliary member eval_item of the type cmp_item that is used only for direct evaluation of multiple equalities. Currently a multiple equality is evaluated directly only in the cases when the equality holds at most for one row in the result set. The compare collation of eval_item was determined incorectly. It could lead to returning incorrect results for some queries.
* | | | | | Merge bk-internal.mysql.com:/home/bk/mysql-5.0cmiller@zippy.cornsilk.net2007-01-311-1/+7
|\ \ \ \ \ \ | |/ / / / / | | | | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
| * | | | | Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-optsergefp@mysql.com2007-01-241-0/+1
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/psergey/mysql-5.0-bug8804-r12
| | * | | | | BUG#24127: (a,b) IN (SELECT c,d ...) can produce wrong results if a and/or b ↵sergefp@mysql.com2007-01-121-0/+1
| | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are NULLs: - Make the code produce correct result: use an array of triggers to turn on/off equalities for each compared column. Also turn on/off optimizations based on those equalities. - Make EXPLAIN output show "Full scan on NULL key" for tables for which we switch between ref/unique_subquery/index_subquery and ALL access. - index_subquery engine now has HAVING clause when it is needed, and it is displayed in EXPLAIN EXTENDED - Fix incorrect presense of "Using index" for index/unique-based subqueries (BUG#22930) // bk trigger note: this commit refers to BUG#24127
| * | | | | Fixed bug #25580: incorrect stored representations of views in casesigor@olga.mysql.com2007-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when they contain the '!' operator. Added an implementation for the method Item_func_not::print. The method encloses any NOT expression into extra parentheses to avoid incorrect stored representations of views that use the '!' operators. Without this change when a view was created that contained the expression !0*5 its stored representation contained not this expression but rather the expression not(0)*5 . The operator '!' is of a higher precedence than '*', while NOT is of a lower precedence than '*'. That's why the expression !0*5 is interpreted as not(0)*5, while the expression not(0)*5 is interpreted as not((0)*5) unless sql_mode is set to HIGH_NOT_PRECEDENCE. Now we translate !0*5 into (not(0))*5.
| * | | | | Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-optgkodinov/kgeorge@rakia.gmz2007-01-151-1/+5
| |\ \ \ \ \ | | |/ / / / | |/| | | | | | | | | | into rakia.gmz:/home/kgeorge/mysql/autopush/B20420-5.0-opt
| | * | | | BUG#20420: optimizer reports wrong keys on left join with INgkodinov/kgeorge@macbook.gmz2007-01-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | Merge mysql.com:/home/ram/work/b19690/b19690.4.1ramil/ram@mysql.com/ramil.myoffice.izhnet.ru2007-01-311-0/+3
|\ \ \ \ \ \ | |/ / / / / |/| | | | / | | |_|_|/ | |/| | | into mysql.com:/home/ram/work/b19690/b19690.5.0
| * | | | fix for bug #19690: ORDER BY eliminates rows from the resultramil/ram@mysql.com/ramil.myoffice.izhnet.ru2007-01-311-0/+3
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the queries we use different data processing methods and can lose some data in case of double (and decimal in 4.1) fields. The fix consists of two parts: 1. double comparison changed, now double a is equal to double b if (a-b) is less than 5*0.1^(1 + max(a->decimals, b->decimals)). For example, if a->decimals==1, b->decimals==2, a==b if (a-b)<0.005 2. if we use a temporary table, store double values there as is to avoid any data conversion (rounding).
* | | | Merge olga.mysql.com:/home/igor/mysql-5.0-optigor@olga.mysql.com2007-01-091-1/+2
|\ \ \ \ | |_|/ / |/| | | | | | | into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug25027
| * | | Fixed bug #25027.igor@olga.mysql.com2006-12-131-1/+2
| | |/ | |/| | | | | | | | | | | | | Blocked evaluation of constant objects of the classes Item_func_is_null and Item_is_not_null_test at the prepare phase in the cases when the objects used subqueries.
* | | Many files:kent@mysql.com/kent-amd64.(none)2006-12-231-2/+1
|/ / | | | | | | Changed header to GPL version 2 only