an ALL/ANY quantified subquery in HAVING.
The Item::split_sum_func2 method should not create Item_ref
for objects of any class derived from Item_subselect.
mysql-test/r/subselect.result:
Added a test case for bug #21853.
mysql-test/t/subselect.test:
Added a test case for bug #21853.
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
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.
into neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
client/mysql.cc:
Auto merged
client/mysqltest.c:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/date_formats.result:
Auto merged
mysql-test/r/union.result:
Auto merged
mysql-test/t/union.test:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/r/func_group.result:
Merge manually
mysql-test/t/func_group.test:
Merge manually
into bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
mysql-test/r/sp.result:
Manual merge.
mysql-test/r/udf.result:
Manual merge.
mysql-test/t/sp.test:
Manual merge.
mysql-test/t/udf.test:
Manual merge.
into bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
include/mysql.h:
Auto merged
include/sql_common.h:
Auto merged
libmysql/libmysql.c:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/mysqldump.result:
Auto merged
mysql-test/t/udf.test:
Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql-common/client.c:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
mysql-test/r/ps.result:
Manual merge.
mysql-test/r/sp.result:
Manual merge.
mysql-test/t/ps.test:
Manual merge.
mysql-test/t/sp.test:
Manual merge.
sql/sql_prepare.cc:
Manual merge.
sql/table.cc:
Manual merge.
tests/mysql_client_test.c:
Manual merge.
into moonbone.local:/work/autopush/12185-bug-5.0-opt-mysql
mysql-test/r/create.result:
Auto merged
mysql-test/t/innodb.test:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/item.cc:
Auto merged
mysql-test/r/union.result:
SCCS merged
mysql-test/t/union.test:
SCCS merged
The Item::tmp_table_field_from_field_type() function creates Field_datetime
object instead of Field_timestamp object for timestamp field thus always
changing data type is a tmp table is used.
The Field_blob object constructor which is used in the
Item::tmp_table_field_from_field_type() is always setting packlength field of
newly created blob to 4. This leads to changing fields data type for example
from the blob to the longblob if a temporary table is used.
The Item::make_string_field() function always converts Field_string objects
to Field_varstring objects. This leads to changing data type from the
char/binary to varchar/varbinary.
Added appropriate Field_timestamp object constructor for using in the
Item::tmp_table_field_from_field_type() function.
Added Field_blob object constructor which sets pack length according to
max_length argument.
The Item::tmp_table_field_from_field_type() function now creates
Field_timestamp object for a timestamp field.
The Item_type_holder::display_length() now returns correct NULL length NULL
length.
The Item::make_string_field() function now doesn't change Field_string to
Field_varstring in the case of Item_type_holder.
The Item::tmp_table_field_from_field_type() function now uses the Field_blob
constructor which sets packlength according to max_length.
mysql-test/t/union.test:
Added test case for bug#12185: Data type aggregation may produce wrong result
Corrected test case after fix for bug#12185
mysql-test/t/innodb.test:
Corrected test case after fix for bug#12185
mysql-test/r/union.result:
Added test case for bug#12185: Data type aggregation may produce wrong result
Corrected test case after fix for bug#12185
mysql-test/r/innodb.result:
Corrected test case after fix for bug#12185
mysql-test/r/create.result:
Corrected the test case after fixing bug#12185
sql/field.h:
Fixed bug#12185: Data type aggregation may produce wrong result
Added Field_blob object constructor which sets packlength according to
max_length argument.
sql/item.cc:
Fixed bug#12185: Data type aggregation may produce wrong result
The Item::make_string_field() function now doesn't change Field_string to
Field_varstring in the case of Item_type_holder.
The Item::tmp_table_field_from_field_type() function now creates
Field_timestamp object for a timestamp field.
The Item::tmp_table_field_from_field_type() function now uses the Field_blob
constructor which sets packlength according to max_length.
The Item_type_holder::display_length() now returns correct NULL length NULL
length.
sql/field.cc:
Fixed bug#12185: Data type aggregation may produce wrong result
Added appropriate Field_timestamp object constructor for using in the
Item::tmp_table_field_from_field_type() function.
This was only demonstrated by the use of PASSWORD(), it was not related to
that function at all. The calculation of the size of a field in the results
of a UNION did not take into account the possible growth of a string field
when being converted to the aggregated character set.
mysql-test/r/union.result:
Add new results
mysql-test/t/union.test:
Add new regression test
sql/item.cc:
Fix calculation of max_length when figuring out the type of a column in
a UNION. It needs to take into account any expansion of field size due to
charset conversions.
and Stored Procedure
The essence of the bug was that for every re-execution of stored
routine or prepared statement new items for character set conversions
were created, thus increasing the number of items and the time of their
processing, and creating memory leak.
No test case is provided since current test suite can't cover such type
of bugs.
mysql-test/r/sp.result:
Add result for bug#21013: Performance Degrades when importing data
that uses Trigger and Stored Procedure.
mysql-test/t/sp.test:
Add test case for bug#21013: Performance Degrades when importing data
that uses Trigger and Stored Procedure.
sql/item.cc:
Switch arena only when in statement prepare mode. Subsequent executions
will use cached item tree.
When an alias is set to a column leading spaces are removed from the alias.
But when this is done on aliases set by user this can lead to confusion.
Now Item::set_name() method issues the warning if leading spaces were removed
from an alias set by user.
New warning message is added.
mysql-test/t/select.test:
Added test case for bug#10977:No warning issued if a column name is truncated.
mysql-test/r/select.result:
Added test case for bug#10977:No warning issued if a column name is truncated.
sql/sql_yacc.yy:
Fixed bug#10977: No warning issued if a column name is truncated
The is_autogenerated_name flag is set before set_name() method call.
sql/item.cc:
Fixed bug#10977: No warning issued if a column name is truncated
Now Item::set_name() method issues the warning if leading spaces were removed
from an alias set by user.
into bodhi.local:/opt/local/work/mysql-5.0-runtime
sql/ha_ndbcluster.cc:
Auto merged
sql/item.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/sql_update.cc:
Manual merge.
into mysql.com:/home/dlenev/mysql-5.0-bg18437-3
mysql-test/t/federated.test:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/item.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/federated.result:
Manual merge.
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
NDB table".
SQL-layer was not marking fields which were used in triggers as such. As
result these fields were not always properly retrieved/stored by handler
layer. So one might got wrong values or lost changes in triggers for NDB,
Federated and possibly InnoDB tables.
This fix solves the problem by marking fields used in triggers
appropriately.
Also this patch contains the following cleanup of ha_ndbcluster code:
We no longer rely on reading LEX::sql_command value in handler in order
to determine if we can enable optimization which allows us to handle REPLACE
statement in more efficient way by doing replaces directly in write_row()
method without reporting error to SQL-layer.
Instead we rely on SQL-layer informing us whether this optimization
applicable by calling handler::extra() method with
HA_EXTRA_WRITE_CAN_REPLACE flag.
As result we no longer apply this optimzation in cases when it should not
be used (e.g. if we have on delete triggers on table) and use in some
additional cases when it is applicable (e.g. for LOAD DATA REPLACE).
Finally this patch includes fix for bug#20728 "REPLACE does not work
correctly for NDB table with PK and unique index".
This was yet another problem which was caused by improper field mark-up.
During row replacement fields which weren't explicity used in REPLACE
statement were not marked as fields to be saved (updated) so they have
retained values from old row version. The fix is to mark all table
fields as set for REPLACE statement. Note that in 5.1 we already solve
this problem by notifying handler that it should save values from all
fields only in case when real replacement happens.
include/my_base.h:
Added HA_EXTRA_WRITE_CAN_REPLACE, HA_EXTRA_WRITE_CANNOT_REPLACE - new
parameters for ha_extra() method. We use them to inform handler that
write_row() which tries to insert new row into the table and encounters
some already existing row with same primary/unique key can replace old
row with new row instead of reporting error.
mysql-test/r/federated.result:
Additional test for bug#18437 "Wrong values inserted with a before update
trigger on NDB table".
mysql-test/r/ndb_replace.result:
Added test for bug #20728 "REPLACE does not work correctly for NDB table
with PK and unique index". Updated wrong results from older test.
mysql-test/t/federated.test:
Additional test for bug#18437 "Wrong values inserted with a before update
trigger on NDB table".
mysql-test/t/ndb_replace.test:
Added test for bug #20728 "REPLACE does not work correctly for NDB table
with PK and unique index".
sql/ha_ndbcluster.cc:
We no longer rely on reading LEX::sql_command value in handler in order
to determine if we can enable optimization which allows us to handle REPLACE
statement in more efficient way by doing replaces directly in write_row()
method without reporting error to SQL-layer.
Instead we rely on SQL-layer informing us whether this optimization
applicable by calling handler::extra() method with
HA_EXTRA_WRITE_CAN_REPLACE flag.
As result we no longer apply this optimization in cases when it should not
be used (e.g. if we have on delete triggers on table) and use in some
additional cases when it is applicable (e.g. for LOAD DATA REPLACE).
sql/item.cc:
Item_trigger_field::setup_field():
Added comment explaining why we don't set Field::query_id in this method.
sql/mysql_priv.h:
mysql_alter_table() function no longer takes handle_duplicates argument.
Added declaration of mark_fields_used_by_triggers_for_insert_stmt() function.
sql/sql_delete.cc:
Mark fields which are used by ON DELETE triggers so handler will retrieve
values for these fields.
sql/sql_insert.cc:
Explicitly inform handler that we are doing REPLACE (using ha_extra() method)
in cases when it can promote insert operation done by write_row() to replace.
Also when we do REPLACE we want to store values for all columns so we should
inform handler about it.
Finally we should mark fields used by ON UPDATE/ON DELETE triggers as such
so handler can properly retrieve/restore values in these fields during
execution of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE statements.
sql/sql_load.cc:
Explicitly inform handler that we are doing LOAD DATA REPLACE (using
ha_extra() method) in cases when it can promote insert operation done by
write_row() to replace.
Also when we do replace we want to save (replace) values for all columns
so we should inform handler about it.
Finally to properly execute LOAD DATA for table with triggers we should
mark fields used by ON INSERT triggers as such so handler can properly
store values for these fields.
sql/sql_parse.cc:
mysql_alter_table() function no longer takes handle_duplicates argument.
sql/sql_table.cc:
Got rid of handle_duplicates argument in mysql_alter_table() and
copy_data_between_tables() functions. These functions were always
called with handle_duplicates == DUP_ERROR and thus contained dead
(and probably incorrect) code.
sql/sql_trigger.cc:
Added Table_triggers_list::mark_fields_used() method which is used to mark
fields read/set by triggers as such so handlers will be able properly
retrieve/store values in these fields.
sql/sql_trigger.h:
Table_triggers_list:
Added mark_fields_used() method which is used to mark fields read/set by
triggers as such so handlers will be able properly retrieve/store values
in these fields. To implement this method added 'trigger_fields' member
which is array of lists linking items for all fields used in triggers
grouped by event and action time.
sql/sql_update.cc:
Mark fields which are used by ON UPDATE triggers so handler will retrieve
and save values for these fields.
mysql-test/r/ndb_trigger.result:
Added test for bug#18437 "Wrong values inserted with a before update trigger
on NDB table".
mysql-test/t/ndb_trigger.test:
Added test for bug#18437 "Wrong values inserted with a before update trigger
on NDB table".
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
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
mysql-test/r/view.result:
SCCS merged
mysql-test/t/view.test:
SCCS merged
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.
The select statement that specified a view could be
slightly changed when the view was saved in a frm file.
In particular references to an alias name in the HAVING
clause could be substituted for the expression named by
this alias.
This could result in an error message for a query of
the form SELECT * FROM <view>. Yet no such message
appeared when executing the query specifying the view.
mysql-test/r/having.result:
Adjusted results after fixing bug #19573.
mysql-test/r/view.result:
Added a test case for bug #19573.
mysql-test/t/view.test:
Added a test case for bug #19573.
into mysql.com:/opt/local/work/mysql-5.0-runtime-merge
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/im_options_set.result:
Auto merged
mysql-test/r/im_options_unset.result:
Auto merged
mysql-test/r/trigger-grant.result:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
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)
The SQL standard doesn't allow to use in HAVING clause fields that are not
present in GROUP BY clause and not under any aggregate function in the HAVING
clause. However, mysql allows using such fields. This extension assume that
the non-grouping fields will have the same group-wise values. Otherwise, the
result will be unpredictable. This extension allowed in strict
MODE_ONLY_FULL_GROUP_BY sql mode results in misunderstanding of HAVING
capabilities.
The new error message ER_NON_GROUPING_FIELD_USED message is added. It says
"non-grouping field '%-.64s' is used in %-.64s clause". This message is
supposed to be used for reporting errors when some field is not found in the
GROUP BY clause but have to be present there. Use cases for this message are
this bug and when a field is present in a SELECT item list not under any
aggregate function and there is GROUP BY clause present which doesn't mention
that field. It renders the ER_WRONG_FIELD_WITH_GROUP error message obsolete as
being more descriptive.
The resolve_ref_in_select_and_group() function now reports the
ER_NON_GROUPING_FIELD_FOUND error if the strict mode is set and the field for
HAVING clause is found in the SELECT item list only.
sql/share/errmsg.txt:
Added the new ER_NON_GROUPING_FIELD_USED error message for the bug#14169.
mysql-test/t/having.test:
Added test case for the bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode.
mysql-test/r/having.result:
Added test case for the bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode.
sql/sql_select.cc:
Added TODO comment to change the ER_WRONG_FIELD_WITH_GROUP to more detailed ER_NON_GROUPING_FIELD_USED message.
sql/item.cc:
Fixed bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode.
The resolve_ref_in_select_and_group() function now reports the
ER_NON_GROUPING_FIELD_FOUND error if the strict MODE_ONLY_FULL_GROUP_BY mode
is set and the field for HAVING clause is found in the SELECT item list only.
into mysql.com:/opt/local/work/mysql-5.0-runtime-merge
sql/item.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/mysqld.cc:
SCCS merged
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).
The problem was due to the fact that with --lower-case-table-names set to 1
the function find_field_in_group did not convert the prefix 'HU' in
HU.PROJ.CITY into lower case when looking for it in the group list. Yet the
names in the group list were extended by the database name in lower case.
mysql-test/r/having.result:
Added a test case for bug #15917.
mysql-test/t/having.test:
Added a test case for bug #15917.
sql/item.cc:
Fixed bug #15917: unexpected complain for a NIST test case.
The problem was due to the fact that with --lower-case-table-names set to 1
the function find_field_in_group did not convert the prefix 'HU' in
HU.PROJ.CITY into lower case when looking for it in the group list. Yet the
names in the group list were extended by the database name in lower case.
The needed conversion was added to the code of find_field_in_group.
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.
mysql-test/r/having.result:
Adjusted a test case results after fix for bug #16504.
mysql-test/r/select.result:
Added a test case for bug #16504.
mysql-test/r/subselect.result:
Adjusted a test case results after fix for bug #16504.
mysql-test/r/varbinary.result:
Adjusted a test case results after fix for bug #16504.
mysql-test/t/select.test:
Added a test case for bug #16504.
sql/item.cc:
Fixed bug #16504.
An Item_equal object may contain only a constant member.
It may happen after reading constant tables.
sql/item_cmpfunc.cc:
Fixed bug #16504.
Added method Item_equal::check_const that check appearance of new
constant items in a multiple equality.
sql/item_cmpfunc.h:
Fixed bug #16504.
Added method Item_equal::check_const that check appearance of new
constant items in a multiple equality.
sql/sql_select.cc:
Fixed bug #16504.
Adjusted multiple equalities after reading constant tables.
Fixed a few typo in comments.
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.
An invalid assertion in Item_direct_view_ref::eq caused
an assertion abort in the debug version.
mysql-test/r/view.result:
Added a test case for bug #18386.
mysql-test/t/view.test:
Added a test case for bug #18386.
sql/item.cc:
Fixed bug #18386.
An invalid assertion in Item_direct_view_ref::eq caused
an assertion abort in the debug version.
Changed the assertion.
Generating character set-independent quoting of strings for the
binary log when executing statements from inside stored procedure.
mysql-test/r/ctype_cp932_binlog.result:
Result change
mysql-test/t/ctype_cp932_binlog.test:
Adding check that string literals are written correctly for multi-byte
character sets.
sql/item.cc:
Cutting out character set-independent string escaping code and putting it
in a separate function.
sql/log_event.cc:
Adding characters set-independent code to separate function.
sql/mysql_priv.h:
Adding new function.
sql/sp_head.cc:
Escaping string value representing a string item.
union.result, union.test:
Adding test case.
item.cc:
Allow safe character set conversion in UNION
- string constant to column's charset
- to unicode
Thus, UNION now works the same with CONCAT (and other string functions)
in respect of aggregating arguments with different character sets.
sql/item.cc:
Allow character set conversion in UNION
- string to column's charset
- to unicode
Bug#15949 union + illegal mix of collations (IMPLICIT + COERCIBLE)
mysql-test/t/union.test:
Adding test case.
mysql-test/r/union.result:
Adding test case.