Commit graph

16409 commits

Author SHA1 Message Date
sergefp@mysql.com
399bc9861e Merge of BUG#26624 and BUG#26625 2007-03-29 10:35:28 +04:00
sergefp@mysql.com
9939b3b75e BUG#26624: high mem usage (crash) in range optimizer
- Post-review fixes
2007-03-29 10:27:58 +04:00
sergefp@mysql.com
264697e83b Merge mysql.com:/home/psergey/mysql-4.1-bug26625
into  mysql.com:/home/psergey/mysql-4.1-bug26624-r2
2007-03-28 20:31:13 +04:00
sergefp@mysql.com
a8d439728f BUG#26624: high mem usage (crash) in range optimizer
- Added PARAM::alloced_sel_args where we count the # of SEL_ARGs
  created by SEL_ARG tree cloning operations.
- Made the range analyzer to shortcut and not do any more cloning 
  if we've already created MAX_SEL_ARGS SEL_ARG objects in cloning.
- Added comments about space complexity of SEL_ARG-graph 
  representation.
2007-03-28 20:16:01 +04:00
sergefp@mysql.com
ce28ca336b Delete: sql/mysqld.cc.rej 2007-03-28 19:05:30 +04:00
sergefp@mysql.com
ce3f182604 BUG#26625: crash in range optimizer (out of mem)
- Define Sql_alloc::operator new() as thow() so that C++ compiler
  handles NULL return values
(there is no testcase as there is no portable way to set limit on the 
amount of memory that a process can allocate)
2007-03-28 18:38:42 +04:00
igor@olga.mysql.com
adc07255ee Fixed bug #27348.
If a set function with a outer reference s(outer_ref) cannot be aggregated 
the outer query against which the reference has been resolved then MySQL
interpretes s(outer_ref) in the same way as it would interpret s(const).
Hovever the standard requires throwing an error in this situation.
Added some code to support this requirement in ansi mode.
Corrected another minor bug in Item_sum::check_sum_func.
2007-03-27 09:48:10 -07:00
gkodinov/kgeorge@magare.gmz
ce9cc47a73 WL3527: 5.0 part:
enabled the optional FOR JOIN to all the three
clauses : USE, FORCE and IGNORE
2007-03-26 16:52:52 +03:00
gkodinov/kgeorge@magare.gmz
a65bc60d1a Merge magare.gmz:/home/kgeorge/mysql/work/B27164-4.1-opt
into  magare.gmz:/home/kgeorge/mysql/work/B27164-5.0-opt
2007-03-26 14:14:23 +03:00
gkodinov/kgeorge@magare.gmz[kgeorge]
e6d81ad338 Bug #27164: not reseting the data pointer
to 0 causes wrong (large) length to be read
 from the row in _mi_calc_blob_length() when 
 storing NULL values in (e.g) POINT columns.
 This large length is then used to allocate
 a block of memory that (on some OSes) causes
 trouble.
 Fixed by calling the base class's 
 Field_blob::reset() from Field_geom::reset()
 that is called when storing a NULL value into
 the column.
2007-03-26 13:17:40 +03:00
igor@olga.mysql.com
7773523f80 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug27229
2007-03-25 23:48:48 -07:00
igor@olga.mysql.com
18ea806864 This is a fix for the memory corruption occurred in one of test cases
from func_group.test after the patch for bug #27229 had been applied.
The memory corruption happened because in some rare cases the function
count_field_types underestimated the number of elements in
in the array param->items_to_copy.
2007-03-25 23:44:06 -07:00
gkodinov/kgeorge@magare.gmz
081f43cc51 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26186-5.0-opt
2007-03-23 10:11:09 +02:00
igor@olga.mysql.com
92d1d74037 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug27229
2007-03-22 14:51:20 -07:00
igor@olga.mysql.com
8f9178e857 Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Ensured correct setting of the depended_from field in references
generated for set functions aggregated in outer selects.
A wrong value of this field resulted in wrong maps returned by 
used_tables() for these references.
Made sure that a temporary table field is added for any set function
aggregated in outer context when creation of a temporary table is 
needed to execute the inner subquery.
2007-03-22 14:48:03 -07:00
evgen@moonbone.local
a2219567a1 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/26813-bug-5.0-opt-mysql
2007-03-22 23:15:30 +03:00
evgen@moonbone.local
38e023781a sql_view.cc:
Post-fix for bug#26813.
2007-03-22 23:13:40 +03:00
holyfoot/hf@mysql.com/hfmain.(none)
fc23f3356e Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-23 00:04:47 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
68f9ff123c Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 23:54:47 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
0102d38ef4 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 23:48:39 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
1d0efa1757 Merge bk@192.168.21.1:mysql-4.1
into  mysql.com:/home/hf/work/mrg/mysql-4.1-opt
2007-03-22 23:45:37 +04:00
evgen@moonbone.local
b1f852b901 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/26813-bug-5.0-opt-mysql
2007-03-22 22:15:21 +03:00
evgen@moonbone.local
1ac5987ae2 Bug#26813: The SUPER privilege is wrongly required to alter a view created by
another user.

When the DEFINER clause isn't specified in the ALTER statement then it's loaded
from the view definition. If the definer differs from the current user then
the error is thrown because only a super-user can set other users as a definers.

Now if the DEFINER clause is omitted in the ALTER VIEW statement then the
definer from the original view is used without check.
2007-03-22 22:05:19 +03:00
gkodinov/kgeorge@magare.gmz
d2b7e76a1c Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26186-5.0-opt
2007-03-22 18:55:52 +02:00
gkodinov/kgeorge@magare.gmz
70d91d43ae Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26207-5.0-opt
2007-03-22 18:49:47 +02:00
gkodinov/kgeorge@magare.gmz
ef1bb48af9 Bug #26207: When making the key image to use
in index search MySQL was not explicitly
 suppressing warnings. And if the context 
 happens to enable warnings (e.g. INSERT ..
 SELECT) the warnings resulting from converting 
 the data the key is compared to are 
 reported to the client.
 Fixed by suppressing warnings when converting
 the data to the same type as the key parts.
2007-03-22 18:44:16 +02:00
mhansson/martin@linux-st28.site
cdf80a269b Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/5.0o-bug24791
2007-03-22 13:37:27 +01:00
mhansson/martin@linux-st28.site
749976ee5e Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/5.0o-bug24791
2007-03-22 10:58:16 +01:00
mhansson/martin@linux-st28.site
50077b6db9 Bug #24791: Union with AVG-groups generates wrong results
The problem in this bug is when we create temporary tables. When
temporary tables are created for unions, there is some 
inferrence being carried out regarding the type of the column.
Whenever this column type is inferred to be REAL (i.e. FLOAT or
DOUBLE), MySQL will always try to maintain exact precision, and
if that is not possible (there are hardware limits, since FLOAT
and DOUBLE are stored as approximate values) will switch to
using approximate values. The problem here is that at this point
the information about number of significant digits is not 
available. Furthermore, the number of significant digits should
be increased for the AVG function, however, this was not properly 
handled. There are 4 parts to the problem:

#1: DOUBLE and FLOAT fields don't display their proper display 
lengths in max_display_length(). This is hard-coded as 53 for 
DOUBLE and 24 for FLOAT. Now changed to instead return the 
field_length.

#2: Type holders for temporary tables do not preserve the 
max_length of the Item's from which they are created, and is 
instead reverted to the 53 and 24 from above. This causes 
*all* fields to get non-fixed significant digits.

#3: AVG function does not update max_length (display length)
when updating number of decimals.

#4: The function that switches to non-fixed number of 
significant digits should use DBL_DIG + 2 or FLT_DIG + 2 as 
cut-off values (Since fixed precision does not use the 'e' 
notation)

Of these points, #1 is the controversial one, but this 
change is preferred and has been cleared with Monty. The 
function causes quite a few unit tests to blow up and they had
to b changed, but each one is annotated and motivated. We 
frequently see the magical 53 and 24 give way to more relevant
numbers.
2007-03-22 10:56:47 +01:00
tomas@whalegate.ndb.mysql.com
8b964c2b12 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
2007-03-22 10:34:46 +01:00
holyfoot/hf@mysql.com/hfmain.(none)
a016f71c45 bug #16546 (DATETIME+0 not always coerced the same way)
fix for cast( AS DATETIME)+0 in 5.0 and above versions.
  val_real now works using val_decimal for DATETIME Items
  Superfluous val_real() methods deleted
2007-03-22 12:44:38 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
da5769fe6a Merge mysql.com:/home/hf/work/mrg/mysql-4.1-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 12:26:32 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
e0f0507f99 bug #16546 (DATETIME + 0 not always coerced in the same way)
fix for cast( AS DATETIME) + 0 operation.
  I just implemented Item_datetime_typecast::val() method
  as it is usually done in other classes.
  Should be fixed more radically in 5.0
2007-03-22 12:24:56 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
1f9fd51c6d Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 12:21:06 +04:00
igor@olga.mysql.com
03ae298ec3 Fixed bug #27362: crash at evaluation of IN predicate when one
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.
2007-03-22 00:05:36 -07:00
tomas@whalegate.ndb.mysql.com
6bab2f13b7 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
2007-03-22 05:44:39 +01:00
tsmith@quadxeon.mysql.com
4981d45997 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50
2007-03-21 23:58:02 +01:00
kostja@bodhi.local
c011a25f66 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-21 23:57:12 +03:00
evgen@moonbone.local
e2c9c9cc20 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/23345-bug-5.0-opt-mysql
2007-03-21 22:10:33 +03:00
evgen@moonbone.local
72bf9b4847 Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
INTO clause can be specified only for the last select of a UNION and it
receives the result of the whole query. But it was wrongly allowed in
non-last selects of a UNION which leads to a confusing query result.

Now INTO allowed only in the last select of a UNION.
2007-03-21 21:54:38 +03:00
tomas@whalegate.ndb.mysql.com
37b8c96197 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-telco-gca
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
2007-03-21 09:00:38 +01:00
tomas@whalegate.ndb.mysql.com
5682efdfcf Bug #26825 MySQL Server Crashes in high load
- initialize to NULL, to avoid call of free on uninitialized variable
2007-03-21 08:40:24 +01:00
tsmith@quadxeon.mysql.com
cc4ea8bba8 Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/mar20/maint/41
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/mar20/maint/50
2007-03-20 21:35:11 +01:00
tsmith@quadxeon.mysql.com
2670f149d0 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/mar20/maint/50
2007-03-20 20:59:41 +01:00
igor@olga.mysql.com
facd57e5fd Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug27257
2007-03-20 12:20:18 -07:00
igor@olga.mysql.com
19da4d3972 Fixed bug #27257: queries containing subqueries with COUNT(*)
aggregated in outer context returned wrong results.
This happened only if the subquery did not contain any references
to outer fields.
As there were no references to outer fields the subquery erroneously
was taken for non-correlated one.
Now any set function aggregated in outer context makes the subquery
correlated.
2007-03-20 11:51:09 -07:00
kent@mysql.com/kent-amd64.(none)
0e84886d61 Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/kent/bk/tmp/mysql-5.0-build
2007-03-20 19:23:20 +01:00
tsmith@quadxeon.mysql.com
21ed11cda2 Bug #27231: Server crash when dumping into outfile with long FIELDS ENCLOSED BY option
- Problem: data separators were copied to a fixed-size buffer
  on the stack; memcpy was used, without bounds checking; a
  server crash could result if long FIELDS ENCLOSED BY, etc.,
  was given
- Fix: write the separators directly, instead of copying to
  a buffer first (in select_export::send_data())
2007-03-20 19:09:28 +01:00
gkodinov/kgeorge@magare.gmz
354c364ad4 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B24484-5.0
2007-03-20 19:49:38 +02:00
gkodinov/kgeorge@macbook.local
28962a76a3 Bug #24484:
To correctly decide which predicates can be evaluated with a given table
the optimizer must know the exact set of tables that a predicate depends 
on. If that mask is too wide (refer to non-existing tables) the optimizer
can erroneously skip a predicate.
One such case of wrong table usage mask were the aggregate functions.
The have a all-1 mask (meaning depend on all tables, including non-existent
ones).
Fixed by making a real used_tables mask for the aggregates. The mask is
constructed in the following way :
1. OR the table dependency masks of all the arguments of the aggregate.
2. If all the arguments of the function are from the local name resolution 
  context and it is evaluated in the same name resolution
  context where it is referenced all the tables from that name resolution 
  context are OR-ed to the dependency mask. This is to denote that an
  aggregate function depends on the number of rows it processes.
3. Handle correctly the case of an aggregate function optimization (such that
  the aggregate function can be pre-calculated and made a constant).

Made sure that an aggregate function is never a constant (unless subject of a 
specific optimization and pre-calculation).  

One other flaw was revealed and fixed in the process : references were 
not calling the recalculation method for used_tables of their targets.
2007-03-20 19:46:02 +02:00