Commit graph

1460 commits

Author SHA1 Message Date
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
igor@rurik.mysql.com
ea2aaa4e2f Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2006-03-30 11:34:14 -08:00
evgen@sunlight.local
7e4535e285 item_sum.cc, sql_select.cc:
After merge fix for bug#15560
item_sum.h:
   After merge fix for bug#15560
2006-03-30 19:04:21 +04:00
evgen@sunlight.local
eb075f2255 Manual merge 2006-03-30 17:14:55 +04:00
igor@rurik.mysql.com
0f9ab67d41 Fixed bug #18279: crash in the cases when on conditions are moved
out of a nested join to the on conditions for the nest.
The bug happened due to:
1. The function simplify_joins could change on expressions for nested joins.
   Yet modified on expressions were not saved in prep_on_expr.
2. On expressions were not restored for nested joins in 
   reinit_stmt_before_use.
2006-03-29 16:45:29 -08:00
evgen@moonbone.local
1c13e54890 Fixed bug#15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries
The GROUP_CONCAT uses its own temporary table. When ROLLUP is present
it creates the second copy of Item_func_group_concat. This copy receives the
same list of arguments that original group_concat does. When the copy is
set up the result_fields of functions from the argument list are reset to the
temporary table of this copy.
As a result of this action data from functions flow directly to the ROLLUP copy
and the original group_concat functions shows wrong result.
Since queries with COUNT(DISTINCT ...) use temporary tables to store
the results the COUNT function they are also affected by this bug.

The idea of the fix is to copy content of the result_field for the function
under GROUP_CONCAT/COUNT from  the first temporary table to the second one,
rather than setting result_field to point to the second temporary table.
To achieve this goal force_copy_fields flag is added to Item_func_group_concat
and Item_sum_count_distinct classes. This flag is initialized to 0 and set to 1
into the make_unique() member function of both classes.
To the TMP_TABLE_PARAM structure is modified to include the similar flag as
well.
The create_tmp_table() function passes that flag to create_tmp_field().
When the flag is set the create_tmp_field() function will set result_field
as a source field and will not reset that result field to newly created 
field for Item_func_result_field and its descendants. Due to this there
will be created copy func to copy data from old result_field to newly 
created field.
2006-03-29 23:30:34 +04:00
pem@mysql.com
cc17bb3404 Removed forgotten comment line in sql_select.cc. 2006-03-28 16:05:06 +02:00
pem@mysql.com
1a1da0e3ef Merge mysql.com:/extern/mysql/bk/mysql-5.0-runtime
into  mysql.com:/extern/mysql/5.0/bug16474/mysql-5.0-runtime
2006-03-28 14:18:47 +02:00
pem@mysql.com
b310d4fb4d Post review fixes for BUG#16474: SP crashed MySQL. 2006-03-28 14:16:21 +02:00
evgen@sunlight.local
a152cac2e7 sql_select.cc:
Afterfix for bug#17366: Unchecked Item_int results in server crash
2006-03-14 18:49:37 +03:00
evgen@sunlight.local
af660df0ef Fixed bug#17366: Unchecked Item_int results in server crash
When there is conjunction of conds, the substitute_for_best_equal_field()
will call the eliminate_item_equal() function in loop to build final
expression. But if eliminate_item_equal() finds that some cond will always
evaluate to 0, then that cond will be substituted by Item_int with value ==
0. In this case on the next iteration eliminate_item_equal() will get that 
Item_int and treat it as Item_cond. This is leads to memory corruption and
server crash on cleanup phase.

To the eliminate_item_equal() function was added DBUG_ASSERT for checking
that all items treaten as Item_cond are really Item_cond.
The substitute_for_best_equal_field() now checks that if
eliminate_item_equal() returns Item_int and it's value is 0 then this 
value is returned as the result of whole conjunction.
2006-03-13 21:11:15 +03:00
pem@mysql.com
61f2dc713b Fixed BUG#16474: SP crashed MySQL
fix_fields() was not called for "order by" variables if the type was a
  "constant integer", and thus interpreted as a column index.
  However, a local variable is an expression and should not be interpreted
  as a column index. Instead it behaves just like when using a user variable
  for instance (i.e. it will not affect the ordering).
2006-03-10 14:04:56 +01:00
igor@rurik.mysql.com
a3093f7e1e Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2006-02-19 17:26:06 -08:00
evgen@moonbone.local
84a775ca3c Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/16752-bug-5.0-mysql
2006-02-14 11:33:46 +03:00
igor@rurik.mysql.com
75b6930d54 Fixed bug #16603.
A subquery transformation changes the HAVING clause of the embedding query if the subquery contains
a GROUP BY clause. Yet the split_sum_func2 function was not applied to the modified HAVING clause.
This could result in wrong answers.
2006-02-13 18:50:06 -08:00
evgen@moonbone.local
3a3f8379cb Fixed bug#16752 Binary table files created in mysqld v4.1 caused buffer overrun
and possibly server crash in mysqld v5.0.

Reported MyISAM table was created in mysqld 4.1 and contains varchar field.
When binary files of that table was moved to 5.0, mysqld treats that varchar 
field as a string field. 
In order to make grouping server calculates group buffer, and because
that field is string server assumes it has fixed length and doesn't add
space for length, but later that field is converted to varchar field. 
Due to this, when field values were actually copied, additional space for
length bytes is taken and buffer overrun occurs, which may lead to server crash.

The calc_group_buffer() function now reserves additional space for length
bytes for VAR_STRING fields, like for VARCHAR fields.
2006-02-08 15:12:48 +03:00
igor@rurik.mysql.com
7b58b91fe4 Fixes after manual merge 2006-02-02 23:56:08 -08:00
igor@rurik.mysql.com
f61517d60b Merge rurik.mysql.com:/home/igor/dev/mysql-4.1-0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2006-02-02 21:23:36 -08:00
igor@rurik.mysql.com
4abab51c24 Post-review fix for bug #14927. 2006-02-02 20:37:58 -08:00
igor@rurik.mysql.com
b32ce5ac79 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2006-02-02 13:47:21 -08:00
konstantin@mysql.com
98091b152a Merge mysql.com:/opt/local/work/mysql-4.1-root
into  mysql.com:/opt/local/work/mysql-5.0-root
2006-02-02 18:17:18 +03:00
igor@rurik.mysql.com
86606615ab Fixed bug #16382.
When an ambiguous field name is used in a group by clause a warning is issued
in the find_order_in_list function by a call to push_warning_printf.
An expression that was not always valid was passed to this call as the field
name parameter.
2006-02-01 20:43:43 -08:00
igor@rurik.mysql.com
d6370b48a7 FIxed bug #14927.
A query with a group by and having clauses could return a wrong
result set if the having condition contained a constant conjunct 
evaluated to FALSE.
It happened because the pushdown condition for table with
grouping columns lost its constant conjuncts.
Pushdown conditions are always built by the function make_cond_for_table
that ignores constant conjuncts. This is apparently not correct when
constant false conjuncts are present.
2006-01-31 21:48:32 -08:00
igor@rurik.mysql.com
eb8507208e Fixed bug #16260.
The problem has manifested itself in the cases when we have a nested outer join
for which it can be inferred that one of the inner tables is a single row table.
2006-01-27 21:20:28 -08:00
gluh@eagle.intranet.mysql.r18.ru
b4f7c9bbd5 Fix for bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema(2nd ver)
Fill schema tables with data before filesort if it's necessary
2006-01-24 16:48:19 +04:00
anozdrin@mysql.com
145fd62bc1 Fix for BUG#15588: String overrun during sp-vars.test
The bug appears after implementation of WL#2984
(Make stored routine variables work according to the standard).
2006-01-20 15:59:22 +03:00
bell@sanja.is.com.ua
e87d5e9a83 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into  sanja.is.com.ua:/home/bell/mysql/bk/work-bug8-4.1
2006-01-18 13:49:37 +02:00
bell@sanja.is.com.ua
4e931d3c45 Excluded posibility of tmp_table_param.copy_field double deletion (BUG#14851). 2006-01-18 13:48:57 +02:00
msvensson@devsrv-b.mysql.com
df2fefd1e9 Merge msvensson@msvensson.mysql.internal:/home/msvensson/mysql/bug14634/my41-bug14634
into  devsrv-b.mysql.com:/space/magnus/my41-bug14634
2006-01-17 19:40:40 +01:00
msvensson@neptunus.(none)
c4ddf67710 Bug #14634 Running out of diskspace on tmpdir returns an inappropriate error 2006-01-17 16:48:26 +01:00
sergefp@mysql.com
86daf2d493 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug16393-r2
2006-01-14 01:28:42 +03:00
sergefp@mysql.com
dc14d007db BUG#16393: post-review fixes: fix comments. 2006-01-14 01:26:42 +03:00
sergefp@mysql.com
e58314d482 BUG#16393: Let the 'ref' optimizer use ON condition of nested join to construct
'ref' accesses to all tables that are direct children of the nested join and are 
not inner wrt their siblings.
2006-01-13 23:55:30 +03:00
evgen@moonbone.local
cea01c7387 Merge 2006-01-13 16:27:38 +03:00
jani@ua141d10.elisa.omakaista.fi
617585eb33 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
2006-01-12 20:28:23 +02:00
sergefp@mysql.com
aa00d65ead Fix typo bug in previous cset 2006-01-12 11:11:16 +03:00
sergefp@mysql.com
e40759e370 BUG#16166, "Can't use index_merge with FORCE INDEX": adjust the heurstics check to take into
account that "FORCE INDEX" disables full table scans, and not range/index_merge scans.
(with post-review fixes)
2006-01-12 10:48:27 +03:00
evgen@moonbone.local
3e23d458f9 Fixed bug #15347: Wrong result of subselect when records cache and set
functions are involved.

When subselect is a join with set functions and no record have been found in
it, end_send_group() sets null_row for all tables in order aggregate functions 
to calculate their values correctly. Normally this null_row flag is cleared for 
each table in sub_select(), but flush_cached_records() doesn't do so.
Due to this all fields from the table processed by flush_cached_records() are 
always evaluated as nulls and whole select produces wrong result.

flush_cached_records() now clears null_row flag at the very beginning.
2006-01-11 23:16:21 +03:00
monty@mysql.com
3143daf8ac Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/home/my/mysql-4.1
2006-01-10 18:03:54 +02:00
igor@rurik.mysql.com
a3a2f065fb Ajustement after merge 2006-01-09 21:44:42 -08:00
monty@mysql.com
c44d6124ed Merge mysql.com:/home/my/mysql-4.0
into  mysql.com:/home/my/mysql-4.1
2006-01-08 19:07:49 +02:00
igor@rurik.mysql.com
bf78fd5438 Merge rurik.mysql.com:/home/igor/dev/mysql-4.1-0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2006-01-07 23:10:08 -08:00
igor@rurik.mysql.com
05947d9916 Fixed bug #14274: a query with a having clause containing only set function returned a wrong result set. 2006-01-07 23:00:06 -08:00
monty@mysql.com
fd4a040325 Fixes during review of new pushed code:
Remove wrong fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Safety fix for bug #13855 "select distinct with group by caused server crash"
2006-01-06 21:42:17 +02:00
monty@mysql.com
b0a5ea01ef Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-01-06 01:08:48 +02:00
monty@mysql.com
6e22e29de6 Review fixes of new pushed code
- Fixed tests
- Optimized new code
- Fixed some unlikely core dumps
- Better bug fixes for:
  - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
  - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null
2006-01-06 00:47:49 +02:00
gluh@eagle.intranet.mysql.r18.ru
f4b052844f Fix for bug#14861 aliased column names are not preserved.
Create tmp table filed using original item name when it's necessary
2005-12-19 15:36:03 +04:00
igor@rurik.mysql.com
ad53d72033 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-12-10 23:31:03 -08:00
anozdrin@mysql.com
0ff8f60b45 Patch for WL#2894: Make stored routine variables work
according to the standard.

The idea is to use Field-classes to implement stored routines
variables. Also, we should provide facade to Item-hierarchy
by Item_field class (it is necessary, since SRVs take part
in expressions).

The patch fixes the following bugs:
  - BUG#8702: Stored Procedures: No Error/Warning shown for inappropriate data 
    type matching; 
 
  - BUG#8768: Functions: For any unsigned data type, -ve values can be passed 
    and returned; 
 
  - BUG#8769: Functions: For Int datatypes, out of range values can be passed 
    and returned; 
 
  - BUG#9078: STORED PROCDURE: Decimal digits are not displayed when we use 
    DECIMAL datatype; 
 
  - BUG#9572: Stored procedures: variable type declarations ignored; 
 
  - BUG#12903: upper function does not work inside a function; 
 
  - BUG#13705: parameters to stored procedures are not verified; 
 
  - BUG#13808: ENUM type stored procedure parameter accepts non-enumerated
    data; 
 
  - BUG#13909: Varchar Stored Procedure Parameter always BINARY string (ignores 
    CHARACTER SET); 
 
  - BUG#14161: Stored procedure cannot retrieve bigint unsigned;

  - BUG#14188: BINARY variables have no 0x00 padding;

  - BUG#15148: Stored procedure variables accept non-scalar values;
2005-12-07 17:01:17 +03:00