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/tomash/src/mysql_ab/mysql-5.0-bug20570
sql/item_strfunc.cc:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/r/view_grant.result:
Manual merge.
mysql-test/t/view_grant.test:
Manual merge.
run at startup"
The server returned an error when trying to execute init-file with a
stored procedure that could return multiple result sets to the client.
A stored procedure can return multiple result sets if it contains
PREPARE, SELECT, SHOW and similar statements.
The fix is to set client_capabilites|=CLIENT_MULTI_RESULTS in
sql_parse.cc:handle_bootstrap(). There is no "client" really, so
nothing is ever sent. This makes init-file feature behave consistently:
the prepared statements that can be called directly in the init-file
can be used in a stored procedure too.
Re-committed the patch originally submitted by Per-Erik after review.
mysql-test/Makefile.am:
Fix re-make without make clean.
mysql-test/r/init_connect.result:
Updated results (a test case for Bug#17843)
mysql-test/r/init_file.result:
Updated results (a test case for Bug#17843)
mysql-test/std_data/init_file.dat:
Add test coverage for new features added in 5.0. Note, that what can
be done in init_file is very limited as it does not support any other
delimiter except ';' -- only "one liners" and no multiple statement
procedures. Also, this is executed with a dummy user "boot@", which
calls for the use of DEFINER clause.
mysql-test/t/init_connect.test:
Add test coverage for new features added in 5.0.
mysql-test/t/init_file.test:
Add test coverage for new features added in 5.0 --
stored routines, views, triggers. The actual tests are in
std_data/init_file.dat, here we just check the results and clean up.
sql/sql_class.cc:
Initialize Security_context::priv_host to an empty string:
when executing an init-file, sql_parse.cc:get_default_definer()
will use this for the value of the definer if it's not set in the query.
sql/sql_parse.cc:
Set CLIENT_MULTI_RESULTS in handle_bootstrap(), to make prepared
statements work in stored procedures called from init-file.
invoker name
The bug was fixed similar to how context switch is handled in
Item_func_sp::execute_impl(): we store pointer to current
Name_resolution_context in Item_func_current_user class, and use
its Security_context in Item_func_current_user::fix_fields().
mysql-test/r/view_grant.result:
Add result for bug#20570.
mysql-test/t/view_grant.test:
Add test case for bug#20570.
sql/item_create.cc:
Remove create_func_current_user(), as it is not used for automatic
function creation.
sql/item_create.h:
Remove prototype for create_func_current_user().
sql/item_strfunc.cc:
Add implementations for Item_func_user::init(),
Item_func_user::fix_fields() and
Item_func_current_user::fix_fields() methods. The latter uses
Security_context from current Name_resolution_context, if one is
defined.
sql/item_strfunc.h:
Move implementation of CURRENT_USER() out of Item_func_user to
to new Item_func_current_user class. For both classes calculate
user name in fix_fields() method.
For Item_func_current_user add context field to store
Name_resolution_context in effect.
sql/sql_yacc.yy:
Pass current Name_resolution_context to Item_func_current_user.
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".
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
into mysql.com:/home/my/mysql-5.0
libmysql/libmysql.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/t/key.test:
Auto merged
sql/table.cc:
Auto merged
mysql-test/r/key.result:
Manual merge
mysql-test/t/mysqldump.test:
Manual merge
(Now we have same code as in 4.1 and 5.1)
sql/ha_ndbcluster.cc:
Manual merge
Change %ll -> llstr()
tests/mysql_client_test.c:
manual merge
mysql-test/r/key.result:
Fixed result after removing wrong bug fix
mysql-test/t/key.test:
Added SHOW CREATE TABLE, which is the proper way to check for table definitions
sql/table.cc:
Reverted wrong bug fix.
The intention with the original code was to show that MySQL treats the first
given unique key as a primary key. Clients can use the marked primary key as a
real primary key to validate row changes in case of conflicting updates. The
ODBC driver (and other drivers) may also use this fact to optimize/check
updates and handle conflicts. The marked key also shows what some engines, like InnoDB or NDB,
will use as it's internal primary key.
For checking if someone has declared a true PRIMARY KEY, one should use 'SHOW CREATE TABLE'
second iterations value
During assignment to the BLOB variable in routine body the value
wasn't copied.
mysql-test/r/sp-vars.result:
Add result for bug#17226.
mysql-test/t/sp-vars.test:
Add test case for bug#17226.
sql/field_conv.cc:
Honor copy_blobs flag.
- Added comments.
- Make SEL_ARG::clone() set SEL_ARG::elements in the created copy.
mysql-test/r/range.result:
BUG#16168: Testcase
mysql-test/t/range.test:
BUG#16168: Testcase
into mysql.com:/home/my/mysql-5.0
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/r/symlink.result:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
mysql-test/t/func_time.test:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
heap/hp_test1.c:
Changed type from last commit
mysql-test/mysql-test-run.sh:
Fixed problem with running with --gdb and two masters
Don't disable ndb becasue we run gdb
mysql-test/t/mysqldump.test:
Don't read ~/.my.cnf
sql/ha_ndbcluster.cc:
Portability fix
into mysql.com:/home/my/mysql-5.0
include/my_global.h:
Auto merged
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/r/symlink.result:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
mysys/my_handler.c:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
strings/strtod.c:
Auto merged
mysql-test/r/func_time.result:
Manual merge
mysql-test/t/func_time.test:
Manual merge
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/r/symlink.result:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
mysql-test/r/func_time.result:
SCCS merged
mysql-test/t/func_time.test:
SCCS merged
SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION are fixed as well as
INFORMATION_SCHEMA.ROUTINES.ROUTINE_NAME.
mysql-test/r/information_schema.result:
Add result for bug#20230.
mysql-test/t/information_schema.test:
Add test case for bug#20230.
sql/sp_head.cc:
Return NULL for routine definition if the user doesn't have enough
privilege to see it.
sql/sql_show.cc:
Make INFORMATION_SCHEMA.ROUTINES.ROUTINE_NAME NULL-able. Return
NULL if the user doesn't have enough privilege to see routine
definition.
into mysql.com:/opt/local/work/mysql-5.0-merge
mysql-test/r/func_sapdb.result:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
sql/item_timefunc.cc:
Auto merged
mysql-test/r/func_time.result:
Manual merge.
mysql-test/t/func_time.test:
Manual merge.
mysql-test/t/trigger.test:
Replace all numeric error code with symbolic names.
Left are --error 1 for system error, and --error 1100. The
symbolic constant for the latter is ER_TABLE_NOT_LOCKED, but using
it triggers a bug in test driver due to name prefix collision with
1099 ER_TABLE_NOT_LOCKED_FOR_WRITE. This bug is fixed in 5.1.
mysql-test/t/federated.test:
Use --replace_result to make test work on non-standard ports.
mysql-test/r/federated.result:
Use --replace_result to make test work on non-standard ports.
into mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug10946
mysql-test/r/trigger.result:
Auto merged
mysql-test/t/trigger.test:
Auto merged
sql/sql_trigger.cc:
Auto merged
It was hard to distinguish case, when one was unable to create trigger
on the table because trigger with same action time and event already
existed for this table, from the case, when one tried to create trigger
with name which was already occupied by some other trigger, since in
both these cases we emitted ER_TRG_ALREADY_EXISTS error and message.
Now we emit ER_NOT_SUPPORTED_YET error with appropriate additional
message in the first case. There is no sense in introducing separate
error for this situation since we plan to get rid of this limitation
eventually.
mysql-test/r/trigger.result:
Update result for new error message.
mysql-test/t/trigger.test:
Update test for new error code.
sql/sql_trigger.cc:
If there is already a trigger with the same activation time, report an
"Unsupported yet" error.
Pushbuild fixes to result file, test, and header file for federated.
mysql-test/r/federated.result:
BUG #19773
Pushbuild fixes - result file had hard-coded port
mysql-test/t/federated.test:
BUG #19773
Pushbuild fixes Test was missing --replace_result
sql/ha_federated.h:
BUG #19773
HPUX and Windows failed with variable named row and *row in method declaration
sp_grant_privileges(), the function that GRANTs EXECUTE + ALTER privs on a SP,
did so creating a user-entry with not password; mysql_routine_grant() would then
write that "change" to the user-table.
mysql-test/r/sp-security.result:
prove that creating a stored procedure will not destroy the creator's password
mysql-test/t/sp-security.test:
prove that creating a stored procedure will not destroy the creator's password
sql/sql_acl.cc:
get password from ACLs, convert to correct format, and use it when
forcing GRANTS for SPs
Final-review fixes per Monty, pre-push. OK'd for
push. Please see each file's comments.
mysql-test/r/federated.result:
BUG #19773
Results for multi-table deletes, updates
mysql-test/t/federated.test:
BUG #19773
Test multi table update and delete. Added drop table to end of previous test.
sql/ha_federated.cc:
BUG #19773
Post-review changes, per Monty. 3rd patch, OK'd for push.
- Added index_read_idx_with_result_set, which uses the result set passed to it
- Hash by entire connection scheme
- Protected store_result result set for table scan by adding a method result set
to index_read_idx and index_read which is passed to index_read_with_result, which
in turn iterates over the single record via read_next.
This is a change from having two result sets in the first two patches.
This keeps the code clean and avoids the need for yet another result set.
- Rewrote ::position and ::rnd_pos to store position - if primary key use
primary key, if not, use record buffer.
- Rewrote get_share to store hash with connect string vs. table name
- delete_row added subtration of "records" by affected->rows
- Added read_next to handle what rnd_next used to do (converting raw record
to query and vice versa)
- Removed many DBUG_PRINT lines
- Removed memset initialisation since subsequent loop accomplishes
- Removed un-necessary mysql_free_result lines
sql/ha_federated.h:
BUG #19773
Fixed "SET " to " SET " to make sure built statements are built with
"UPDATE `t1` SET .." instead of "UPDATE `t1`SET"
Bug #18361: Triggers on mysql.user table cause server crash
Because they do not work, we do not allow creating triggers on tables
within the 'mysql' schema.
(They may be made to work and re-enabled at some later date, but not
in 5.0 or 5.1.)
mysql-test/r/trigger.result:
Add new results
mysql-test/t/trigger.test:
Add new regression test for creating triggers on system schema
sql/share/errmsg.txt:
Add new error message
sql/sql_trigger.cc:
Disallow creating triggers on tables in the 'mysql' schema
The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT
statement from internal structures based on value set later at runtime, not
the original value set by the user.
The solution is to remember that original value.
mysql-test/r/auto_increment.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/func_compress.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/func_math.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/func_system.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/func_time.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/information_schema.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/query_cache.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/rpl_get_lock.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/rpl_master_pos_wait.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/show_check.result:
Add result for bug#17203.
mysql-test/r/subselect.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/type_blob.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/variables.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/r/view.result:
Update result to not report SQL_NO_CACHE if it wasn't there at first place.
mysql-test/t/show_check.test:
Add test case for bug#17203.
sql/sql_lex.cc:
Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
sql/sql_lex.h:
Add SELECT_LEX::sql_cache field to store original user setting.
sql/sql_select.cc:
Output SQL_CACHE and SQL_NO_CACHE depending on stored original user setting.
sql/sql_yacc.yy:
Make effect of SQL_CACHE and SQL_NO_CACHE mutually exclusive. Ignore
SQL_CACHE if SQL_NO_CACHE was used. Remember what was set by the user.
Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
mysql-test/r/func_sapdb.result:
test cases for date range edge cases added
mysql-test/r/func_time.result:
test cases for date range edge cases added
mysql-test/t/func_sapdb.test:
test cases for date range edge cases added
mysql-test/t/func_time.test:
test cases for date range edge cases added
'SELECT DISTINCT a,b FROM t1' should not use temp table if there is unique
index (or primary key) on a.
There are a number of other similar cases that can be calculated without the
use of a temp table : multi-part unique indexes, primary keys or using GROUP BY
instead of DISTINCT.
When a GROUP BY/DISTINCT clause contains all key parts of a unique
index, then it is guaranteed that the fields of the clause will be
unique, therefore we can optimize away GROUP BY/DISTINCT altogether.
This optimization has two effects:
* there is no need to create a temporary table to compute the
GROUP/DISTINCT operation (or the temporary table will be smaller if only GROUP
is removed and DISTINCT stays or if DISTINCT is removed and GROUP BY stays)
* this causes the statement in effect to become updatable in Connector/Java
because the result set columns will be direct reference to the primary key of
the table (instead to the temporary table that it currently references).
Implemented a check that will optimize away GROUP BY/DISTINCT for queries like
the above.
Currently it will work only for single non-constant table in the FROM clause.
mysql-test/r/distinct.result:
Bug #16458: Simple SELECT FOR UPDATE causes "Result Set not updatable" error
- test case
mysql-test/t/distinct.test:
Bug #16458: Simple SELECT FOR UPDATE causes "Result Set not updatable" error
- test case
sql/sql_select.cc:
Bug #16458: Simple SELECT FOR UPDATE causes "Result Set not updatable" error
- disable GROUP BY if contains the fields of a unique index.