Commit 1d4ac3d4 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup

parent 5de08a53
drop table if exists t1,t2,t3;
set @save_derived_optimizer_switch=@@optimizer_switch; set @save_derived_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off'; set optimizer_switch='derived_merge=off,derived_with_keys=off';
select * from (select 2 from DUAL) b; select * from (select 2 from DUAL) b;
......
...@@ -1038,4 +1038,6 @@ triggered ...@@ -1038,4 +1038,6 @@ triggered
triggered triggered
drop table t1,t2, t3; drop table t1,t2, t3;
drop user foo; drop user foo;
end of 5.5 tests #
# end of 5.5 tests
#
...@@ -67,3 +67,6 @@ SELECT * FROM t2; ...@@ -67,3 +67,6 @@ SELECT * FROM t2;
col_int_key pk_1 pk_2 col_int col_int_key pk_1 pk_2 col_int
1 2 3 4 1 2 3 4
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# end of 5.5 tests
#
# Initialize # Initialize
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
set @save_derived_optimizer_switch=@@optimizer_switch; set @save_derived_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off'; set optimizer_switch='derived_merge=off,derived_with_keys=off';
......
...@@ -371,7 +371,6 @@ drop table t1, t2; ...@@ -371,7 +371,6 @@ drop table t1, t2;
# #
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
--disable_warnings --disable_warnings
create database mysqltest; create database mysqltest;
--enable_warnings --enable_warnings
...@@ -381,7 +380,6 @@ create table mysqltest.t3 (a int, b int, primary key (a)); ...@@ -381,7 +380,6 @@ create table mysqltest.t3 (a int, b int, primary key (a));
grant select on mysqltest.* to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost;
grant update on mysqltest.t1 to mysqltest_1@localhost; grant update on mysqltest.t1 to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
update t1, t2 set t1.b=1 where t1.a=t2.a; update t1, t2 set t1.b=1 where t1.a=t2.a;
update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a; update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
connection root; connection root;
...@@ -494,15 +492,12 @@ insert into t2 values (10), (20), (30); ...@@ -494,15 +492,12 @@ insert into t2 values (10), (20), (30);
create view v1 as select a as b, a/10 as a from t2; create view v1 as select a as b, a/10 as a from t2;
connect (locker,localhost,root,,test); connect (locker,localhost,root,,test);
connection locker;
lock table t1 write; lock table t1 write;
connect (changer,localhost,root,,test); connect (changer,localhost,root,,test);
connection changer;
send alter table t1 add column c int default 100 after a; send alter table t1 add column c int default 100 after a;
connect (updater,localhost,root,,test); connect (updater,localhost,root,,test);
connection updater;
# Wait till "alter table t1 ..." of session changer is in work. # Wait till "alter table t1 ..." of session changer is in work.
# = There is one session waiting. # = There is one session waiting.
let $wait_condition= select count(*)= 1 from information_schema.processlist let $wait_condition= select count(*)= 1 from information_schema.processlist
...@@ -1086,5 +1081,7 @@ select * from t2; ...@@ -1086,5 +1081,7 @@ select * from t2;
drop table t1,t2, t3; drop table t1,t2, t3;
drop user foo; drop user foo;
--echo end of 5.5 tests --echo #
--echo # end of 5.5 tests
--echo #
...@@ -75,3 +75,7 @@ UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11; ...@@ -75,3 +75,7 @@ UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # end of 5.5 tests
--echo #
...@@ -5003,8 +5003,7 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start, ...@@ -5003,8 +5003,7 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
@retval TRUE Error, reported. @retval TRUE Error, reported.
*/ */
bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
Sroutine_hash_entry **sroutine_to_open_list, uint flags,
Prelocking_strategy *prelocking_strategy) Prelocking_strategy *prelocking_strategy)
{ {
/* /*
...@@ -5053,7 +5052,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, ...@@ -5053,7 +5052,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter,
has_prelocking_list= thd->lex->requires_prelocking(); has_prelocking_list= thd->lex->requires_prelocking();
table_to_open= start; table_to_open= start;
sroutine_to_open= sroutine_to_open_list; sroutine_to_open= &thd->lex->sroutines_list.first;
*counter= 0; *counter= 0;
thd_proc_info(thd, "Opening tables"); thd_proc_info(thd, "Opening tables");
...@@ -5112,8 +5111,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, ...@@ -5112,8 +5111,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter,
elements in prelocking list/set. elements in prelocking list/set.
*/ */
while (*table_to_open || while (*table_to_open ||
(thd->locked_tables_mode <= LTM_LOCK_TABLES && (thd->locked_tables_mode <= LTM_LOCK_TABLES && *sroutine_to_open))
*sroutine_to_open))
{ {
/* /*
For every table in the list of tables to open, try to find or open For every table in the list of tables to open, try to find or open
......
...@@ -276,8 +276,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); ...@@ -276,8 +276,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
bool lock_table_names(THD *thd, TABLE_LIST *table_list, bool lock_table_names(THD *thd, TABLE_LIST *table_list,
TABLE_LIST *table_list_end, ulong lock_wait_timeout, TABLE_LIST *table_list_end, ulong lock_wait_timeout,
uint flags); uint flags);
bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags,
Sroutine_hash_entry **sroutine_to_open, uint flags,
Prelocking_strategy *prelocking_strategy); Prelocking_strategy *prelocking_strategy);
/* open_and_lock_tables with optional derived handling */ /* open_and_lock_tables with optional derived handling */
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables, bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
...@@ -499,15 +498,6 @@ class Alter_table_prelocking_strategy : public Prelocking_strategy ...@@ -499,15 +498,6 @@ class Alter_table_prelocking_strategy : public Prelocking_strategy
}; };
inline bool
open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags,
Prelocking_strategy *prelocking_strategy)
{
return open_tables(thd, tables, counter, &thd->lex->sroutines_list.first,
flags, prelocking_strategy);
}
inline bool inline bool
open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags) open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags)
{ {
......
...@@ -1251,9 +1251,8 @@ int mysql_multi_update_prepare(THD *thd) ...@@ -1251,9 +1251,8 @@ int mysql_multi_update_prepare(THD *thd)
if (setup_tables_and_check_access(thd, &lex->select_lex.context, if (setup_tables_and_check_access(thd, &lex->select_lex.context,
&lex->select_lex.top_join_list, &lex->select_lex.top_join_list,
table_list, table_list, lex->select_lex.leaf_tables,
lex->select_lex.leaf_tables, FALSE, FALSE, UPDATE_ACL, SELECT_ACL, FALSE))
UPDATE_ACL, SELECT_ACL, FALSE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (lex->select_lex.handle_derived(thd->lex, DT_MERGE)) if (lex->select_lex.handle_derived(thd->lex, DT_MERGE))
...@@ -1272,9 +1271,7 @@ int mysql_multi_update_prepare(THD *thd) ...@@ -1272,9 +1271,7 @@ int mysql_multi_update_prepare(THD *thd)
} }
if (update_view && check_fields(thd, *fields)) if (update_view && check_fields(thd, *fields))
{
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
}
thd->table_map_for_update= tables_for_update= get_table_map(fields); thd->table_map_for_update= tables_for_update= get_table_map(fields);
...@@ -1293,8 +1290,7 @@ int mysql_multi_update_prepare(THD *thd) ...@@ -1293,8 +1290,7 @@ int mysql_multi_update_prepare(THD *thd)
TABLE *table= tl->table; TABLE *table= tl->table;
/* Only set timestamp column if this is not modified */ /* Only set timestamp column if this is not modified */
if (table->timestamp_field && if (table->timestamp_field &&
bitmap_is_set(table->write_set, bitmap_is_set(table->write_set, table->timestamp_field->field_index))
table->timestamp_field->field_index))
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
/* if table will be updated then check that it is unique */ /* if table will be updated then check that it is unique */
...@@ -1355,10 +1351,8 @@ int mysql_multi_update_prepare(THD *thd) ...@@ -1355,10 +1351,8 @@ int mysql_multi_update_prepare(THD *thd)
if (!tl->is_derived()) if (!tl->is_derived())
{ {
uint want_privilege= tl->updating ? UPDATE_ACL : SELECT_ACL; uint want_privilege= tl->updating ? UPDATE_ACL : SELECT_ACL;
if (check_access(thd, want_privilege, tl->db, if (check_access(thd, want_privilege, tl->db, &tl->grant.privilege,
&tl->grant.privilege, &tl->grant.m_internal, 0, 0) ||
&tl->grant.m_internal,
0, 0) ||
check_grant(thd, want_privilege, tl, FALSE, 1, FALSE)) check_grant(thd, want_privilege, tl, FALSE, 1, FALSE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -1434,25 +1428,18 @@ int mysql_multi_update_prepare(THD *thd) ...@@ -1434,25 +1428,18 @@ int mysql_multi_update_prepare(THD *thd)
Setup multi-update handling and call SELECT to do the join Setup multi-update handling and call SELECT to do the join
*/ */
bool mysql_multi_update(THD *thd, bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, List<Item> *fields,
TABLE_LIST *table_list, List<Item> *values, COND *conds, ulonglong options,
List<Item> *fields,
List<Item> *values,
COND *conds,
ulonglong options,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
bool ignore, bool ignore, SELECT_LEX_UNIT *unit,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex, multi_update **result)
SELECT_LEX *select_lex,
multi_update **result)
{ {
bool res; bool res;
DBUG_ENTER("mysql_multi_update"); DBUG_ENTER("mysql_multi_update");
if (!(*result= new multi_update(table_list, if (!(*result= new multi_update(table_list,
&thd->lex->select_lex.leaf_tables, &thd->lex->select_lex.leaf_tables,
fields, values, fields, values, handle_duplicates, ignore)))
handle_duplicates, ignore)))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -1463,11 +1450,9 @@ bool mysql_multi_update(THD *thd, ...@@ -1463,11 +1450,9 @@ bool mysql_multi_update(THD *thd,
List<Item> total_list; List<Item> total_list;
res= mysql_select(thd, &select_lex->ref_pointer_array, res= mysql_select(thd, &select_lex->ref_pointer_array, table_list,
table_list, select_lex->with_wild, select_lex->with_wild, total_list, conds, 0, NULL, NULL,
total_list, NULL, NULL,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK | options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE, OPTION_SETUP_TABLES_DONE,
*result, unit, select_lex); *result, unit, select_lex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment