into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
mysql-test/r/query_cache.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/type_date.result:
Auto merged
mysql-test/t/func_time.test:
Auto merged
mysql-test/t/insert_update.test:
Auto merged
sql/item.h:
Auto merged
sql/log.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/item.h:
SCCS merged
VALUES() was considered a constant. This caused replacing
(or pre-calculating) it using uninitialized values before the actual
execution takes place.
Mark it as a non-constant (still not dependent of tables) to prevent
the pre-calculation.
mysql-test/r/insert_update.result:
Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
- test case.
- EXPLAIN output changed due to VALUES() not being considered a constant
anymore
mysql-test/t/insert_update.test:
Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
- test case.
sql/item.h:
Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
- mark Item_insert_value as non-constant to prevent early calculation.
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.
mysql-test/r/func_str.result:
Added test cases for bug #21698.
mysql-test/r/heap_hash.result:
Adjusted results after the fix for bug #21198.
mysql-test/t/func_str.test:
Added test cases for bug #21698.
sql/item.cc:
Fixed bug #21198.
Added a method to check whether a field reference can be
substituted for a constant equal to the field.
This substitution is allowed if the field is not of a type string
or if the field reference serves as an argument of a comparison
predicate.
sql/item.h:
Fixed bug #21698.
Added a new virtual transformation method for a item 'compile'
with two callback function parameters.
Added a new virtual method 'subst_argument_checker' to be used
as an amnalyzer method.
This method is supposed to set its in/out argument to NULL for
the nodes where substitution of a string field for a constant
is not valid.
sql/item_cmpfunc.cc:
Fixed bug #21698.
Added an implementation of the compile method for class Item_cond.
First it processes the Item_cond node with a callback function and if
the latter returns TRUE it proceeds with a transformation performed by
another callback function.
sql/item_cmpfunc.h:
Fixed bug #21698.
Added the implementations of 'subst_argument_checker'
for the Item_func and Item_cond classes.
This method is supposed to set its in/out argument to NULL for
the nodes where substitution of a string field for a constant
is not valid.
Added the declaration of an implementation of the compile method for
class Item_cond.
First it processes the Item_cond node with a callback function and if
the latter returns TRUE it proceeds with a transformation performed by
another callback function.
sql/item_func.cc:
Fixed bug #21698.
Added an implementation of the compile method for class Item_func.
First it processes the Item_func node with a callback function and if
the latter returns TRUE it proceeds with a transformation performed by
another callback function.
sql/item_func.h:
Fixed bug #21698.
Added the declaration of the implementation of the compile method for
class Item_func.
First it processes the Item_func node with a callback function and if
the latter returns TRUE it proceeds with a transformation performed by
another callback function.
sql/sql_select.cc:
Fixed bug #21698.
Limited the conditions at which a field can be substituted
a for an equal constant in a formula.
This substitution is allowed if the field is not of a type string
or if the field reference serves as an argument of a comparison
predicate.
into bodhi.local:/opt/local/work/mysql-5.0-14897
configure.in:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/im_life_cycle.result:
Auto merged
mysql-test/t/im_life_cycle.imtest:
Auto merged
sql/field.cc:
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/item_strfunc.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/share/errmsg.txt:
Auto merged
mysql-test/r/grant.result:
Manual merge.
mysql-test/r/view.result:
Manual merge.
mysql-test/t/grant.test:
Manual merge.
mysql-test/t/view.test:
Manual merge.
Changes in an item tree done by optimizer weren't properly
registered and went unnoticed, which resulted in preliminary freeing
of used memory.
mysql-test/r/ps.result:
Add result for bug#21166: Prepared statement causes signal 11
on second execution.
mysql-test/t/ps.test:
Add test case for bug#21166: Prepared statement causes signal 11
on second execution.
sql/item.cc:
Move Item::transform() and Item_default_value::transform() from
item.h here and use THD::change_item_tree() instead of plain
assignment.
Change Item_field::set_no_const_sub() to be used with Item::walk()
instead of Item::transform().
sql/item.h:
Move definition of Item::transform() and Item_default_value::transform()
to item.cc.
Change Item::set_no_const_sub() to be used with Item::walk()
instead of Item::transform().
sql/item_cmpfunc.cc:
Use Item::walk() to execute Item::set_no_const_sub().
Use THD::change_item_tree() instead of plain assignment.
sql/item_func.cc:
Add assert and comment to Item_func::traverse_cond().
sql/item_row.cc:
Use THD::change_item_tree() instead of plain assignment.
sql/item_strfunc.cc:
Move Item_func_make_set::transform() from item_strfunc.h here and use
THD::change_item_tree() instead of plain assignment.
sql/item_strfunc.h:
Move definition of Item_func_make_set::transform() to item_strfunc.cc.
A date can be represented as an int (like 20060101) and as a string (like
"2006.01.01"). When a DATE/TIME field is compared in one SELECT against both
representations the constant propagation mechanism leads to comparison
of DATE as a string and DATE as an int. In this example it compares 2006 and
20060101 integers. Obviously it fails comparison although they represents the
same date.
Now the Item_bool_func2::fix_length_and_dec() function sets the comparison
context for items being compared. I.e. if items compared as strings the
comparison context is STRING.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The context check is done in the
Item_field::equal_fields_propagator() and in the change_cond_ref_to_const()
functions.
Also the better fix for bug 21159 is introduced.
mysql-test/t/type_datetime.test:
Added a test case for bug#21475: Wrongly applied constant propagation leads to a false comparison.
mysql-test/r/type_datetime.result:
Added a test case for bug#21475: Wrongly applied constant propagation leads to a false comparison.
sql/sql_select.cc:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The check is done in the change_cond_ref_to_const() function.
sql/item_cmpfunc.cc:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
Now the Item_bool_func2::fix_length_and_dec() function sets the comparison
context for items being compared.
sql/item.h:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
To the Item class a new field called cmp_context is added.
It represents the comparison context of an item.
sql/item.cc:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The context check is done in the
Item_field::equal_fields_propagator() function.
Post review changes for bug#19862.
sql/sql_select.cc:
Post review changes for bug#19862.
sql/item_func.h:
Post review changes for bug#19862.
sql/item_func.cc:
Post review changes for bug#19862.
sql/item.h:
Post review changes for bug#19862.
When there is no index defined filesort is used to sort the result of a
query. If there is a function in the select list and the result set should be
ordered by it's value then this function will be evaluated twice. First time to
get the value of the sort key and second time to send its value to a user.
This happens because filesort when sorts a table remembers only values of its
fields but not values of functions.
All functions are affected. But taking into account that SP and UDF functions
can be both expensive and non-deterministic a temporary table should be used
to store their results and then sort it to avoid twice SP evaluation and to
get a correct result.
If an expression referenced in an ORDER clause contains a SP or UDF
function, force the use of a temporary table.
A new Item_processor function called func_type_checker_processor is added
to check whether the expression contains a function of a particular type.
mysql-test/t/udf.test:
Added test case for bug#19862: Sort with filesort by function evaluates function twice
mysql-test/t/sp.test:
Added test case for bug#19862: Sort with filesort by function evaluates function twice
mysql-test/r/sp.result:
Added test case for bug#19862: Sort with filesort by function evaluates function twice
mysql-test/r/udf.result:
Added test case for bug#19862: Sort with filesort by function evaluates function twice
sql/sql_select.cc:
Fixed bug#19862: Sort with filesort by function evaluates function twice
If an expression referenced in an ORDER clause contains a SP or UDF
function, force the use of a temporary table.
sql/item_func.h:
Fixed bug#19862: Sort with filesort by function evaluates function twice
A new Item_processor function called func_type_checker_processor is added
to check whether the expression contains a function of a particular type.
sql/item.h:
Fixed bug#19862: Sort with filesort by function evaluates function twice
A new Item_processor function called func_type_checker_processor is added
to check whether the expression contains a function of a particular type.
sql/item_func.cc:
Fixed bug#19862: Sort with filesort by function evaluates function twice
A new Item_processor function called func_type_checker_processor is added
to check whether the expression contains a function of a particular type.
into olga.mysql.com:/home/igor/mysql-5.0-opt
mysql-test/r/func_str.result:
Auto merged
mysql-test/t/func_str.test:
Auto merged
sql/item.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_strfunc.h:
Auto merged
into mysql.com:/home/gluh/MySQL/Merge/5.0-kt
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
into mysql.com:/opt/local/work/mysql-5.0-runtime
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
mysql-test/t/func_time.test:
Auto merged
sql/item.h:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
In some functions dealing with strings and character sets, the wrong
pointers were saved for restoration in THD::rollback_item_tree_changes().
This could potentially cause random corruption or crashes.
Fixed by passing the original Item ** locations, not local stack copies.
Also remove unnecessary use of default arguments.
sql/item.cc:
Function agg_item_charsets() now handles non-consequtive Item *'s.
sql/item.h:
Remove use of default argument.
sql/item_cmpfunc.cc:
Remove use of default argument.
sql/item_func.cc:
Remove use of default argument.
sql/item_func.h:
Function agg_item_charsets() now handles non-consequtive Item *'s.
sql/item_strfunc.cc:
Pass original Item **'s to agg_arg_charsets(), not local copies, to ensure
proper restoration in THD::rollback_item_tree_changes().
sql/item_sum.cc:
Remove use of default argument.
After view onening real view db name and table name are placed
into table_list->view_db & table_list->view_name.
Item_field class does not handle these names properly during
intialization of Send_field.
The fix is to use new class 'Item_ident_for_show'
which sets correct view db name and table name for Send_field.
sql/item.cc:
Bug#19671 mysql_list_fields returns incorrect table name for VIEWs
new Item_ident_for_show class which correctly sets view db and table names
for Send_field.
sql/item.h:
Bug#19671 mysql_list_fields returns incorrect table name for VIEWs
new Item_ident_for_show class which correctly sets view db and table names
for Send_field.
sql/sql_show.cc:
Bug#19671 mysql_list_fields returns incorrect table name for VIEWs
new Item_ident_for_show is used for views
tests/mysql_client_test.c:
Bug#19671 mysql_list_fields returns incorrect table name for VIEWs
test case
mysql-test/r/cast.result:
Auto merged
mysql-test/t/func_time.test:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/structs.h:
Auto merged
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.
mysql-test/r/cast.result:
Fixed wrong test case result after bug fix#16377.
sql/item_timefunc.h:
Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.
The result_as_longlong() function is set to return TRUE for these classes:
Item_date, Item_date_func, Item_func_curtime, Item_func_sec_to_time,
Item_date_typecast, Item_time_typecast, Item_datetime_typecast,
Item_func_makedate.
sql/item_timefunc.cc:
Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.Correct val_int() methods are implemented for classes Item_date_typecast,
Item_func_makedate, Item_time_typecast, Item_datetime_typecast.
sql/item_cmpfunc.h:
Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.
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.
sql/field.cc:
Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.
Field::set_warning(), Field::set_datetime_warning() now use current_thd to get thd if table isn't set.
sql/item_cmpfunc.cc:
Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.
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.
sql/item.h:
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.
mysql-test/t/func_time.test:
Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.
mysql-test/r/func_time.result:
Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.
The unsigned flag in Item was not propagated through the single value subqueries.
This caused the result to be treated as signed.
mysql-test/r/subselect.result:
Added testcases for bug #19700
mysql-test/t/subselect.test:
Added testcases for bug #19700
sql/item.h:
Preserved the unsigned flag in Item_subselect
sql/item_subselect.cc:
Preserved the unsigned flag in Item_subselect
Fixed compiler warnings
Fixed valgrind warning in Item_date_add_intervall::eq. (Recoding of bugfix #19490)
sql/field.cc:
remove dflt_field from field structure (not needed)
Simple cleanup of code that been copied elsewhere
sql/field.h:
remove dflt_field from field structure (not needed)
sql/item.h:
Removed compiler warnings
sql/item_timefunc.cc:
Fixed Item_date_add_intervall::eq
The problem was that when we call 'eq' 'this' is not fixed, which means we can't call const_item() or a value function.
I fixed this so that we check eq for all arguments and that the sign and type are identical.
(The original code gave a 'accessing uninitialized data' in valgrind.
sql/mysql_priv.h:
Added default fields to create_tmp_field
sql/sql_insert.cc:
New default_field parameter to create_tmp_field()
sql/sql_select.cc:
New default_field parameter to create_tmp_field()
Use this in create_tmp_table() to set right default value for a field
The convert_constant_item() function converts constant items to ints on
prepare phase to optimize execution speed. In this case it tries to evaluate
subselect which contains a derived table and is contained in a derived table.
All derived tables are filled only after all derived tables are prepared.
So evaluation of subselect with derived table at the prepare phase will
return a wrong result.
A new flag with_subselect is added to the Item class. It indicates that
expression which this item represents is a subselect or contains a subselect.
It is set to 0 by default. It is set to 1 in the Item_subselect constructor
for subselects.
For Item_func and Item_cond derived classes it is set after fixing any argument
in Item_func::fix_fields() and Item_cond::fix_fields accordingly.
The convert_constant_item() function now doesn't convert a constant item
if the with_subselect flag set in it.
mysql-test/t/view.test:
Added test case for bug#19077: A nested materialized derived table is used before being populated.
mysql-test/t/subselect.test:
Added test case for bug#19077: A nested materialized derived table is used before being populated.
mysql-test/r/view.result:
Added test case for bug#19077: A nested materialized derived table is used before being populated.
mysql-test/r/subselect.result:
Added test case for bug#19077: A nested materialized derived table is used before being populated.
sql/item_subselect.cc:
Fixed bug#19077: A nested materialized derived table is used before being populated.
The Item_subselect class constructor sets new with_subselect flag to 1.
sql/item_func.cc:
Fixed bug#19077: A nested materialized derived table is used before being populated.
The Item_func::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments.
sql/item_cmpfunc.cc:
Fixed bug#19077: A nested materialized derived table is used before being populated.
The convert_constant_item() function now doesn't convert a constant item
with the with_subselect flag set.
The Item_cond::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments.
sql/item.cc:
Fixed bug#19077: A nested materialized derived table is used before being populated.
Set new with_subselect flag to default value - 0 in the Item constructor.
sql/item.h:
Fixed bug#19077: A nested materialized derived table is used before being populated.
A new flag with_subselect is added to the Item class. It indicates that
expression which this item represents is a subselect or contains a subselect.
It is set to 0 by default.
from within triggers
Add support for passing NEW.x as INOUT and OUT parameters to stored
procedures. Passing NEW.x as INOUT parameter requires SELECT and
UPDATE privileges on that column, and passing it as OUT parameter
requires only UPDATE privilege.
mysql-test/r/sp-error.result:
Update the result for new message.
mysql-test/r/trigger-grant.result:
Add result for bug#14635.
mysql-test/r/trigger.result:
Add result for bug#14635.
mysql-test/t/trigger-grant.test:
Add test case for bug#14635.
mysql-test/t/trigger.test:
Add test case for bug#14635.
sql/item.cc:
Add implementations of set_value() and set_required_privilege() methods
of Settable_routine_parameter interface.
Use Item_trigger_field::want_privilege instead of
Item_trigger_field::access_type.
Reset privileges on Item_trigger_field::cleanup().
sql/item.h:
Add interface class Settable_routine_parameter and interface query
method to Item class. Item_splocal and Item_trigger_field implement
this interface.
For Item_trigger_field:
- add read_only attribute and is_read_only() method.
- remove access_type and add original_privilege and want_privilege
instead.
- add set_value() method.
- add reset_privilege() method.
sql/item_func.cc:
Add implementations of set_value() method of Settable_routine_parameter
interface.
sql/item_func.h:
Item_func_get_user_var implements Settable_routine_parameter interface.
sql/share/errmsg.txt:
Update english ER_SP_NOT_VAR_ARG message.
sql/sp_head.cc:
Use Settable_routine_parameter interface for parameter update.
sql/sql_yacc.yy:
Set read_only and want_privilege members in Item_trigger_field
appropriately. For NEW.x trigger variable used in left-hand-side
of SET statement the latter is set to UPDATE_ACL, otherwise it is
set to SELECT_ACL (but see Item_trigger_field::set_required_privilege(),
where it may be updated to different value).
In the code that converts IN predicates to EXISTS predicates it is changing
the select list elements to constant 1. Example :
SELECT ... FROM ... WHERE a IN (SELECT c FROM ...)
is transformed to :
SELECT ... FROM ... WHERE EXISTS (SELECT 1 FROM ... HAVING a = c)
However there can be no FROM clause in the IN subquery and it may not be
a simple select : SELECT ... FROM ... WHERE a IN (SELECT f(..) AS
c UNION SELECT ...) This query is transformed to : SELECT ... FROM ...
WHERE EXISTS (SELECT 1 FROM (SELECT f(..) AS c UNION SELECT ...)
x HAVING a = c) In the above query c in the HAVING clause is made to be
an Item_null_helper (a subclass of Item_ref) pointing to the real
Item_field (which is not referenced anywhere else in the query anymore).
This is done because Item_ref_null_helper collects information whether
there are NULL values in the result. This is OK for directly executed
statements, because the Item_field pointed by the Item_null_helper is
already fixed when the transformation is done. But when executed as
a prepared statement all the Item instances are "un-fixed" before the
recompilation of the prepared statement. So when the Item_null_helper
gets fixed it discovers that the Item_field it points to is not fixed
and issues an error. The remedy is to keep the original select list
references when there are no tables in the FROM clause. So the above
becomes : SELECT ... FROM ... WHERE EXISTS (SELECT c FROM (SELECT f(..)
AS c UNION SELECT ...) x HAVING a = c) In this way c is referenced
directly in the select list as well as by reference in the HAVING
clause. So it gets correctly fixed even with prepared statements. And
since the Item_null_helper subclass of Item_ref_null_helper is not used
anywhere else it's taken out.
mysql-test/r/ps_11bugs.result:
Test case for the bug
mysql-test/r/subselect.result:
Explain updated because of the tranformation
mysql-test/t/ps_11bugs.test:
Testcase for the bug
sql/item.cc:
Taking out Item_null_helper as it's no longer needed
sql/item.h:
Taking out Item_null_helper as it's no longer needed
sql/item_subselect.cc:
The described change to the IN->EXISTS transformation
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)
CONNECTION_ID() was implemented as a constant Item, i.e. an instance of
Item_static_int_func class holding value computed at creation time.
Since Items are created on parsing, and trigger statements are parsed
on table open, the first connection to open a particular table would
effectively set its own CONNECTION_ID() inside trigger statements for
that table.
Re-implement CONNECTION_ID() as a class derived from Item_int_func, and
compute connection_id on every call to fix_fields().
mysql-test/r/trigger.result:
Add result for bug#16461.
mysql-test/t/trigger.test:
Add test case for bug#16461.
sql/item.cc:
Remove now unused class Item_static_int_func.
sql/item.h:
Remove now unused class Item_static_int_func.
sql/item_create.cc:
Use new implementation of CONNECTION_ID().
sql/item_func.cc:
Re-implement CONNECTION_ID() as Item_func_connection_id
(was Item_static_int_func). Set max_length to 10, as it was before.
Compute connection_id dynamically on every call to fix_fields().
sql/item_func.h:
Re-implement CONNECTION_ID() as Item_func_connection_id
(was Item_static_int_func).
into mysql.com:/home/timka/mysql/src/5.0-bug-16710
mysql-test/r/group_min_max.result:
Auto merged
mysql-test/t/group_min_max.test:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/opt_range.cc:
Auto merged
The bug was due to a missed case in the detection of whether an index
can be used for loose scan. More precisely, the range optimizer chose
to use loose index scan for queries for which the condition(s) over
an index key part could not be pushed to the index together with the
loose scan.
As a result, loose index scan was selecting the first row in the
index with a given GROUP BY prefix, and was applying the WHERE
clause after that, while it should have inspected all rows with
the given prefix, and apply the WHERE clause to all of them.
The fix detects and skips such cases.
mysql-test/r/group_min_max.result:
Added test for BUG#16710.
mysql-test/t/group_min_max.test:
Added test for BUG#16710.
sql/item.cc:
Added new method [Item | Item_field]::find_item_in_field_list_processor.
sql/item.h:
Added new method [Item | Item_field]::find_item_in_field_list_processor.
sql/opt_range.cc:
Handle the case when there is no MIN/MAX aggregate function, and a
keypart of the index being considered, that is after the GROUP BY
prefix, is used in the WHERE clause and the condition where it is
used cannot be pushed to the index.
If this is the case, we rule out this index.
time per connection
Removed const_string() method from Item_string (it was only used in one
place, in a bad way). Defer possible SP variable, and access data directly
instead, in date_format item.
mysql-test/r/sp.result:
Updated results for new test (BUG#17476).
mysql-test/t/sp.test:
New test case (BUG#17476)
sql/item.h:
Removed const_string() from Item_string.
It was only used in one place, and we can just use str_value in Item directly.
sql/item_timefunc.cc:
Must defer a (possible) local SP variable to use max_length and str_value
in Item_func_date_format::fix_length_and_dec(), and refer to str_value
directly without the const_string() method (now removed); the cast didn't
work in all cases anyway.
mysql-test/r/bigint.result:
test result
mysql-test/t/bigint.test:
testcase
sql/item.h:
unsigned_arg is a separate parameter now
sql/item_cmpfunc.cc:
we can get unsigned field from the signed Item - from string
like '1234'
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
configure.in:
Added comment
ndb/include/ndbapi/NdbDictionary.hpp:
Fixed compiler warnings from gcc 4.0.2
sql/field.cc:
Fixed compiler warnings from gcc 4.0.2
sql/handler.h:
Fixed compiler warnings from gcc 4.0.2
sql/item.h:
Fixed compiler warnings from gcc 4.0.2
sql/item_cmpfunc.h:
Fixed compiler warnings from gcc 4.0.2
sql/log_event.h:
Fixed compiler warnings from gcc 4.0.2
sql/mysql_priv.h:
Fixed compiler warnings from gcc 4.0.2
For find_table_in_list I fixed it to use proper C++ class pointers instead of C style pointers
sql/opt_range.cc:
Fixed compiler warnings from gcc 4.0.2
sql/parse_file.h:
Fixed compiler warnings from gcc 4.0.2
sql/sp_rcontext.h:
Fixed compiler warnings from gcc 4.0.2
sql/spatial.h:
Fixed compiler warnings from gcc 4.0.2
sql/sql_base.cc:
Fixed compiler warnings from gcc 4.0.2
sql/sql_cache.h:
Fixed compiler warnings from gcc 4.0.2
sql/sql_class.h:
Fixed compiler warnings from gcc 4.0.2
sql/sql_parse.cc:
Fixed compiler warnings from gcc 4.0.2
(Not pretty, but seams to work...)
sql/sql_select.h:
Fixed compiler warnings from gcc 4.0.2
sql/sql_update.cc:
Fixed compiler warnings from gcc 4.0.2
sql/table.h:
Fixed compiler warnings from gcc 4.0.2
sql/tztime.cc:
Fixed compiler warnings from gcc 4.0.2
sql/tztime.h:
Fixed compiler warnings from gcc 4.0.2
If item->cached_table is set, find_field_in_tables() returns found field
even if it doesn't belong to current select. Because Item_field::fix_fields
doesn't expect such behaviour, reported bug occurs.
Item_field::fix_fields() was modifed to detect when find_field_in_tables()
can return field from outer select and process such fields accordingly.
In order to ease this code which was searching and processing outed fields was
moved into separate function called Item_field::fix_outer_field().
sql/item_subselect.h:
Fixed bug #15706: find_field_in_tables() returns field from outer select
Item_field::fix_outer_field() was marked as friend to Item_subselect class.
sql/item.h:
Fixed bug #15706: find_field_in_tables() returns field from outer select
fix_outer_field() function is added to the Item_field class.
sql/item.cc:
Fixed bug #15706: find_field_in_tables() returns field from outer select
Item_ref::fix_fields() and Item_field::fix_fields() were modifed to detect when
find_field_in_tables() can return field from outer select and process such
fields accordingly.
In order to ease this, code Item_field::fix_fields() which was searching and
processing outer fields was moved into separate function called
Item_field::fix_outer_field().
To the Item_field::fix_field() added a loop for finding context for found field.
mysql-test/t/disabled.def:
Fixed bug #15706: find_field_in_tables() returns field from outer select
Enable subselect test
- BUG#15166: Wrong update permissions required to execute triggers
- BUG#15196: Wrong select permission required to execute triggers
The idea of the fix is to check necessary privileges
in Item_trigger_field::fix_fields(), instead of having "special variables"
technique. To achieve this, we should pass to an Item_trigger_field instance
a flag, which will indicate the usage/access type of this trigger variable.
mysql-test/r/trigger-grant.result:
Update the result file.
mysql-test/t/trigger-grant.test:
Add test cases for BUG#15166 and BUG#15196
sql/item.cc:
Item_trigger_field: check appropriate (SELECT/UPDATE) privilege in fix_fields().
sql/item.h:
Add a flag to specify access type for trigger field.
sql/sql_trigger.cc:
"Special variable" technique of checking privileges for NEW/OLD variables
was replaced by checking table- and column-level privileges in
Item_trigger_field::fix_fields().
sql/sql_trigger.h:
"Special variable" technique of checking privileges for NEW/OLD variables
was replaced by checking table- and column-level privileges in
Item_trigger_field::fix_fields().
sql/sql_yacc.yy:
Specify access type for trigger fields.
into mysql.com:/home/my/mysql-5.0
mysql-test/r/create.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/trigger.test:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/field.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
mysql-test/t/disabled.def:
Manual merge
sql/mysqld.cc:
Manual merge
sql/sp_head.cc:
Manual merge
sql/sql_trigger.cc:
Manual merge
- 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
mysql-test/r/create.result:
Update results after removing wrong warnings for CREATE ... SELECT
New tests
mysql-test/r/handler.result:
Drop used tables
mysql-test/r/kill.result:
Make test portable
mysql-test/r/mysqlshow.result:
Drop tables used by previous test
mysql-test/r/trigger.result:
Reuse old procedure name
mysql-test/r/view.result:
Extra tests
mysql-test/t/create.test:
New tests to test fix of removing wrong warnings for CREATE ... SELECT
mysql-test/t/disabled.def:
Enable 'kill' test (should now be portable)
mysql-test/t/handler.test:
Drop used tables
mysql-test/t/kill.test:
Make test portable even if kill doesn't work at once
mysql-test/t/mysqlshow.test:
Drop tables used by previous test
mysql-test/t/trigger.test:
Reuse old procedure name
mysql-test/t/view.test:
Extra tests
sql/field.cc:
Removed compiler warning
sql/ha_federated.cc:
my_snprintf -> strmake()
(Simple optimization)
sql/ha_ndbcluster.cc:
Indentation cleanups and trival optimization
sql/item.cc:
Moved save_org_in_field() to item.cc to make it easier to test
Remove setting of null_value as this is not needed
sql/item.h:
Moved save_org_in_field() to item.cc to make it easier to test
sql/log_event.cc:
Remove inline of slave_load_file_stem()
Added 'extension' parameter to slave_load_file_stem() to get smaller code
Removed not critical (or needed) DBUG_ASSERT()'s
Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths
Indentation fixes
sql/opt_range.cc:
Moved code from declaration to function body
(To make it more readable)
sql/parse_file.cc:
Fixed DBUG_PRINT
sql/sp.cc:
Simple cleanups
- Removed not needed {} level
- Ensure saved variables starts with old_
sql/sp_head.cc:
Indentation fixes
Remove core dump when using --debug when m_next_cached_sp == 0
Fixed compiler warnings
Trivial optimizations
sql/sp_head.h:
Changed argument to set_definer() to const
Added THD argument to recursion_level_error() to avoid call to current_thd
sql/sql_acl.cc:
Removed not needed test (first_not_own_table is the guard)
sql/sql_base.cc:
Removed extra empty line
sql/sql_handler.cc:
Don't test table version in mysql_ha_read() as this is already tested in lock_tables()
Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables
(Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash)
sql/sql_insert.cc:
Mark fields that are set in CREATE ... SELECT as used
(Removed wrong warnings about field not having a default value)
sql/sql_parse.cc:
Removed not needed test of 'tables' (first_not_own_table is the guard)
Simplify code
sql/sql_select.cc:
Use group->field to check if value is null instead of item called by 'save_org_in_field'
This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null)
sql/sql_trigger.cc:
Move sql_modes_parameters outside of function
Indentation fixes
Fixed compiler warning
Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access()
(This allows us to remove the extra test in check_grant() and check_table_access())
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
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_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
to Crash": the bug was that due to non-standard name
resolution precedence in stored procedures (See Bug#5967)
a stored procedure variable took precedence over a table column
when the arguments for VALUES() function were resolved.
The implementation of VALUES() function was not designed to work
with Item_splocal and crashed.
VALUES() function is non-standard. It can refer to, and
is meaningful for, table columns only. The patch disables SP
variables as possible arguments of VALUES() function.
mysql-test/r/sp.result:
Test results fixed (Bug#15441).
Also make sure that the recently added test cases follow sp.test
internal tests standard.
mysql-test/t/sp.test:
Add a test case for Bug#15441 "Running SP causes Server to Crash".
sql/item.cc:
Cleanup Item_insert_value::fix_fields().
sql/item.h:
Add a comment for Item_insert_value.
sql/sql_yacc.yy:
Actual fix for Bug#15441 "Running SP causes Server to Crash":
we should not allow VALUES() function to reference SP variables.
into mysql.com:/home/alik/Documents/AllProgs/MySQL/devel/5.0-sp-vars-merge-2
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/sp_head.cc:
Merge.
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;
mysql-test/r/ctype_ujis.result:
Explicitly specify correct charset.
mysql-test/r/schema.result:
Drop our test database to not affect this test if some test
left it cause of failure.
mysql-test/r/show_check.result:
Drop our test database to not affect this test if some test
left it cause of failure.
mysql-test/r/skip_name_resolve.result:
Ignore columns with unpredictable values.
mysql-test/r/sp-big.result:
Add cleanup statement.
mysql-test/r/sp-dynamic.result:
Add cleanup statements.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sum_distinct-big.result:
Update result file.
mysql-test/r/type_newdecimal-big.result:
Update result file.
mysql-test/t/ctype_ujis.test:
Explicitly specify correct charset.
mysql-test/t/schema.test:
Drop our test database to not affect this test if some test
left it cause of failure.
mysql-test/t/show_check.test:
Drop our test database to not affect this test if some test
left it cause of failure.
mysql-test/t/skip_name_resolve.test:
Ignore columns with unpredictable values.
mysql-test/t/sp-big.test:
Add cleanup statement.
mysql-test/t/sp-dynamic.test:
Add cleanup statements.
mysql-test/t/sp.test:
Non-scalar values prohibited for assignment to SP-vars;
polishing.
mysql-test/t/type_newdecimal-big.test:
Update type specification so that the variables
can contain the large values used in the test.
sql/field.cc:
Extract create_field::init() to initialize an existing
instance of create_field from new_create_field().
sql/field.h:
Extract create_field::init() to initialize an existing
instance of create_field from new_create_field().
sql/item.cc:
- Introduce a new class: Item_sp_variable -- a base class
of stored-routine-variables classes;
- Introduce Item_case_expr -- an Item, which is used to access
to the expression of CASE statement;
sql/item.h:
- Introduce a new class: Item_sp_variable -- a base class
of stored-routine-variables classes;
- Introduce Item_case_expr -- an Item, which is used to access
to the expression of CASE statement;
sql/item_func.cc:
Pass the Field (instead of Item) for the return value of
a function to the function execution routine.
sql/item_func.h:
Pass the Field (instead of Item) for the return value of
a function to the function execution routine.
sql/mysql_priv.h:
Move create_virtual_tmp_table() out of sql_select.h.
sql/sp.cc:
Use create_result_field() instead of make_field().
sql/sp_head.cc:
- Add a function to map enum_field_types to Item::Type;
- Add sp_instr_push_case_expr instruction -- an instruction
to push CASE expression into the active running context;
- Add sp_instr_pop_case_expr instruction -- an instruction
to pop CASE expression from the active running context;
- Adapt the SP-execution code to using Fields instead of Items
for SP-vars;
- Use create_field structure for field description instead of
a set of members.
sql/sp_head.h:
- Add a function to map enum_field_types to Item::Type;
- Add sp_instr_push_case_expr instruction -- an instruction
to push CASE expression into the active running context;
- Add sp_instr_pop_case_expr instruction -- an instruction
to pop CASE expression from the active running context;
- Adapt the SP-execution code to using Fields instead of Items
for SP-vars;
- Use create_field structure for field description instead of
a set of members.
sql/sp_pcontext.cc:
- Change rules to assign an index of SP-variable: use
transparent index;
- Add an operation to retrieve a list of defined SP-vars
from the processing context recursively.
sql/sp_pcontext.h:
- Change rules to assign an index of SP-variable: use
transparent index;
- Add an operation to retrieve a list of defined SP-vars
from the processing context recursively.
sql/sp_rcontext.cc:
- Change rules to assign an index of SP-variable: use
transparent index;
- Use a tmp virtual table to store SP-vars instead of Items;
- Provide operations to work with CASE expresion.
sql/sp_rcontext.h:
- Change rules to assign an index of SP-variable: use
transparent index;
- Use a tmp virtual table to store SP-vars instead of Items;
- Provide operations to work with CASE expresion.
sql/sql_class.cc:
- Reflect Item_splocal ctor changes;
- Item_splocal::get_offset() has been renamed to get_var_idx().
sql/sql_class.h:
Polishing.
sql/sql_parse.cc:
Extract create_field::init() to initialize an existing
instance of create_field from new_create_field().
sql/sql_select.cc:
Take care of BLOB columns in create_virtual_tmp_table().
sql/sql_select.h:
Move create_virtual_tmp_table() out of sql_select.h.
sql/sql_trigger.cc:
Use boolean constants for boolean type instead of numerical ones.
sql/sql_yacc.yy:
Provide an instance of create_field for each SP-var.
mysql-test/include/sp-vars.inc:
The definitions of common-procedures, which are created
under different circumstances.
mysql-test/r/sp-vars.result:
Result file for the SP-vars test.
mysql-test/sp-vars.test:
A new test for checking SP-vars functionality.
into mysql.com:/home/timka/mysql/src/5.0-2486
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
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/item_sum.cc:
Auto merged
sql/item_sum.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
into mysql.com:/usr/home/ram/work/5.0.b12956
mysql-test/r/ps.result:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged