Commit graph

258 commits

Author SHA1 Message Date
igor@rurik.mysql.com
34206c6f80 Fixed bug #21698: erroneously a field could be replaced by an
equal constant under any circumstances.
In fact this substitution can be allowed if the field is
not of a type string or if the field reference serves as 
an argument of a comparison predicate.
2006-09-07 11:06:37 -07:00
sergefp@mysql.com
9024ed81c7 Merge mysql.com:/home/psergey/mysql-4.1-opt
into  mysql.com:/home/psergey/mysql-5.0-opt
2006-07-21 23:45:34 +04:00
sergefp@mysql.com
bffd438de3 BUG#20975: Incorrect query result for NOT (subquery):
Add implementations of Item_func_{nop,not}_all::neg_transformer
2006-07-21 03:04:04 +04:00
gkodinov@mysql.com
96ceb6c234 gcc 4.1 linux warning fixes backported from 5.0. 2006-06-28 16:28:29 +03:00
evgen@moonbone.local
2877b5ef64 item_cmpfunc.h, cast.result:
Post fix for bug#16377
2006-06-15 16:39:18 +04:00
evgen@moonbone.local
a2261d57be Many files:
After merge fix
2006-06-15 01:48:41 +04:00
evgen@moonbone.local
e35a0ca4b7 Manually merged 2006-06-14 23:54:08 +04:00
evgen@moonbone.local
67de8c46a5 Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.

All date/time functions has the STRING result type thus their results are
compared as strings. The string date representation allows a user to skip 
some of leading zeros. This can lead to wrong comparison result if a date/time 
function result is compared to such a string constant.

The idea behind this bug fix is to compare results of date/time functions
and data/time constants as ints, because that date/time representation is 
more exact. To achieve this the agg_cmp_type() is changed to take in the
account that a date/time field or an date/time item should be compared 
as ints.

This bug fix is partially back ported from 5.0.

The agg_cmp_type() function now accepts THD as one of parameters. 
In addition, it now checks if a date/time field/function is present in the
list. If so, it tries to coerce all constants to INT to make date/time
comparison return correct result. The field for the constant coercion is
taken from the Item_field or constructed from the Item_func. In latter case
the constructed field will be freed after conversion of all constant items.
Otherwise the result is same as before - aggregated with help of the
item_cmp_type() function.

From the Item_func_between::fix_length_and_dec() function removed the part
which was converting date/time constants to int if possible. Now this is 
done by the agg_cmp_type() function.

The new function result_as_longlong() is added to the Item class. 
It indicates that the item is a date/time item and result of it can be
compared as int. Such items are date/time fields/functions.

Correct val_int() methods are implemented for classes Item_date_typecast, 
Item_func_makedate, Item_time_typecast, Item_datetime_typecast. All these
classes are derived from Item_str_func and Item_str_func::val_int() converts
its string value to int without regard to the date/time type of these items.

Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
functions are changed to substitute result type of an item with the INT_RESULT
if the item is a date/time item and another item is a constant. This is done
to get a correct result of comparisons like date_time_function() = string_constant.
2006-06-13 19:09:24 +04:00
sergefp@mysql.com
078ec307ae Fix compile failure on Win32 2006-04-26 01:21:33 +04:00
sergefp@mysql.com
1d4acfb668 BUG#15872: Don't run the range analyzer on "t1.keypart NOT IN (const1, ..., )", 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)
2006-04-25 23:33:31 +04:00
igor@rurik.mysql.com
788463869a Post review changes for the fix of bug #16504. 2006-04-03 21:02:40 -07:00
igor@rurik.mysql.com
af2d79a771 Fixed bug #16504.
Multiple equalities were not adjusted after reading constant tables.
It resulted in neglecting good index based methods that could be
used to access of other tables.
2006-03-31 21:26:17 -08:00
monty@mysql.com
54274976e7 Fixed compiler warnings from gcc 4.0.2:
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
2006-02-25 17:46:30 +02:00
konstantin@mysql.com
0a64381cee Merge mysql.com:/opt/local/work/mysql-4.1-12734
into  mysql.com:/opt/local/work/mysql-5.0-root
2006-01-14 19:12:07 +03:00
konstantin@mysql.com
48d48bc936 A fix and a test case for Bug#12734 " prepared statement may
return incorrect result set for a select SQL request"
2006-01-14 04:55:07 +03:00
evgen@moonbone.local
8dbedc9ffd Merge 2006-01-13 12:13:50 +03:00
evgen@moonbone.local
605f62fce8 Fixed bug #15633: Evaluation of Item_equal for non-const table caused wrong
select result

Item equal objects are employed only at the optimize phase. Usually they are not
supposed to be evaluated.  Yet in some cases we call the method val_int() for
them. Here we have to take care of restricting the predicate such an object
represents f1=f2= ...=fn to the projection of known fields fi1=...=fik.

Added a check for field's table being const in Item_equal::val_int().
If the field's table is not const val_int() just skips that field when
evaluating Item_equal.
2006-01-11 22:49:43 +03:00
evgen@moonbone.local
2790489cd6 Fix bug #15268 Unchecked null value caused server crash
cmp_item_sort_string::cmp() wasn't checking values_res variable for null.
Later called function was dereferenced it and crashed server.

Added null check to cmp_item_sort_string::cmp().
2005-12-09 23:01:52 +03:00
andrey@lmy004.
991b6f1440 fix for bug #12595 (ESCAPE must be exactly 1 character long)
ESCAPE has length of 1 if specified and sql_mode is NO_BACKSLASH_ESCAPES
or has length of 0 or 1 in every other situation.
(approved patch applied on a up-to-date tree re-commit)
2005-10-21 04:01:52 +03:00
kent@mysql.com
656b0cc15a Merge 2005-09-29 03:20:31 +02:00
kent@mysql.com
844d964f2d Many files:
Prefix regex functions/types with "my_" as our
  library is not compatible with normal regex lib.
my_regex.h:
  Rename: regex/regex.h -> regex/my_regex.h
2005-09-29 02:08:24 +02:00
sergefp@mysql.com
3d6759d190 Merge 4.1->5.0 2005-09-09 10:54:59 +04:00
serg@serg.mylan
7e9646f05d Merge serg@bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
2005-09-08 23:11:15 +02:00
serg@serg.mylan
a7f2179c29 BUG#12695: Item_func_isnull::update_used_tables did not update const_item_cache 2005-09-08 22:57:27 +02:00
aivanov@mysql.com
d6398c1aae Merge mysql.com:/home/alexi/mysql-5.0
into  mysql.com:/home/alexi/dev/mysql-5.0-0
2005-09-07 18:58:58 +04:00
aivanov@mysql.com
6ff3befd32 Merge mysql.com:/home/alexi/mysql-4.1
into  mysql.com:/home/alexi/dev/mysql-4.1-0
2005-09-07 18:55:33 +04:00
bar@mysql.com
d261e1f5c5 Merge mysql.com:/usr/home/bar/mysql-4.1.b12611
into  mysql.com:/usr/home/bar/mysql-5.0
2005-09-07 16:32:15 +05:00
aivanov@mysql.com
2165167200 Merge mysql.com:/home/alexi/dev/mysql-4.1-0
into  mysql.com:/home/alexi/dev/mysql-5.0-0
2005-09-06 23:49:54 +04:00
aivanov@mysql.com
fa51afedeb item_cmpfunc.h:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   The classes Item_func_between, Item_func_if, Item_func_in are modified.
   Item_func_between/in objects can represent now [NOT]BETWEEN/IN expressions.
   The class Item_func_opt_neg is added to factor out the functionality
   common for the modified classes Item_func_between and Item_func_in.
item_cmpfunc.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   Added Item_func_between::fix_fields(), Item_func_if::fix_fields(),
   Item_func_in::fix_fields(). They correct generic calculation of
   the not_null_tables attribute when it is needed.
   Modified Item_func_between::val_int(), Item_func_in::val_int().
opt_range.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   The function get_mm_tree() is modified. There cannot be NOT before
   BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
   now [NOT]BETWEEN/IN expressions.
sql_yacc.yy:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   Item_func_between/in objects can represent now [NOT]BETWEEN/IN expresions.
join_outer.result:
  Fixed some testcases results (bugs #12101, #12102)
join_outer.test:
  Added testcases for bugs #12101, #12102
2005-09-06 18:03:08 +04:00
bar@mysql.com
cdf89955d9 item_cmpfunc.h:
Bug 12611 : ESCAPE + LIKE do not work when the escape char is a multibyte one
  Forgot to commit this file in the previous changeset,
  together with other files.
2005-09-06 14:48:18 +05:00
evgen@moonbone.local
dc53ac6d1f Fix bug #12489 wrongly printed strcmp() function results in creation of broken
view.

For Item_func_strcmp print() was not defined and for this class was called
print_op of it's parent class. Because of this strcmp() was printed wrongly
and this results int creation of broken view.

Added function Item_func_strcmp::print() which correctly prints strcmp()
function.
2005-08-31 00:54:41 +04:00
bell@sanja.is.com.ua
fc070c2bcb stop on NULL comparison only if it is allowed (BUG#12509) 2005-08-18 12:07:14 +03:00
sanja@hasky.mysql.fi
16d279bb12 Merge abelkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into  hasky.mysql.fi:/home/sanja/work-merge-5.0
2005-08-13 08:19:34 +03:00
bell@50.0.168.192.in-addr.arpa
1e248ceaf1 fixed convertion and handling IN subqueries with rows (BUG#11867) 2005-08-13 07:45:14 +03:00
monty@mysql.com
5b8683db74 After merge fixes 2005-07-04 16:01:04 +03:00
monty@mysql.com
fe30ec9032 manual merge 2005-07-04 03:50:04 +03:00
monty@mysql.com
ec420bfb43 Fixes during review of new code
- Mostly indentation fixes
- Added missing test
- Ensure that Item_func_case() checks for stack overruns
- Use real_item() instead of (Item_ref*) item
- Fixed wrong error handling
2005-07-04 03:42:33 +03:00
monty@mysql.com
86d7b02199 Merge with 4.1 2005-07-03 14:17:52 +03:00
bell@sanja.is.com.ua
d3905f3d0e Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
bell@sanja.is.com.ua
9283e3e3e8 fixed not_null_tables() for IN() (BUG#9393)
(IN() remove NULL rows only for tables from first argument (value which we looking for in IN() list) but not for tables from IN() list)
Also it will be better change Item::not_null_tables() to prohibit this optimisation by default for new created items in 5.0 or 5.1.
2005-06-28 22:20:25 +03:00
igor@igor-inspiron.creware.com
186e8c5891 item_func.h:
Fixed bug #9939: a wrong conversion of arguments
  for functions COALESCE and IFNULL.
  The str_op virtual method was added into Item_func_numhybrid.
item_func.cc:
  Fixed bug #9939: a wrong conversion of arguments
  for functions COALESCE and IFNULL.
  The str_op virtual method was added into Item_func_numhybrid.
item_cmpfunc.h, item_cmpfunc.cc:
  Fixed bug #9939: a wrong conversion of arguments
  for functions COALESCE and IFNULL.
  Item_func_coalesce and Item_func_ifnull now
  inherit from a modified Item_func_numhybrid.
case.test, case.result:
  Added test cases for bug #9939.
2005-06-02 07:27:02 -07:00
msvensson@neptunus.(none)
34cec09efb Merge neptunus.(none):/home/msvensson/mysql/bug10241
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
2005-05-09 11:26:48 +02:00
monty@mishka.local
015cd1cd21 merge 2005-05-06 13:51:58 +03:00
monty@mishka.local
a9f6aab4c9 Fixes while reviewing new code
Added option --count to mysqlshow (to show number of rows)
Fixed possible core dump in information schema
2005-05-06 11:39:30 +03:00
holyfoot@hf-ibm.(none)
2c8e9df232 A lot of fixes to Precision math
Mostly about precision/decimals of the results of the operations
2005-05-05 20:06:49 +05:00
msvensson@neptunus.(none)
5b5565c30a BUG#10241 cygwin port: invalid pragma interface directives
- Introduce ifdefs so we can control when to use #pragma interface on cygwin
2005-05-04 15:05:56 +02:00
serg@serg.mylan
f04bef8faf merged 2005-03-14 18:46:30 +01:00
serg@serg.mylan
dba1e0889a Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
2005-03-14 14:47:51 +01:00
serg@serg.mylan
ada959edf8 anotehr fix for Item_func_isnotnull::not_null_tables() 2005-03-14 11:04:42 +01:00
serg@serg.mylan
9248f0d714 Item_func_isnotnull::not_null_tables - return 0 if not top-level item 2005-03-13 23:56:25 +01:00