Commit d3dc7313 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into sanja.is.com.ua:/home/bell/mysql/bk/work-repl-5.0
parents b2dbddc3 a7d0eaae
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1,v1;
drop view if exists t1,v1;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
insert into v1 values (2);
select * from v1 order by a;
a
1
2
select * from v1 order by a;
a
1
2
update v1 set a=3 where a=1;
select * from v1 order by a;
a
2
3
select * from v1 order by a;
a
2
3
delete from v1 where a=2;
select * from v1 order by a;
a
3
select * from v1 order by a;
a
3
alter view v1 as select a as b from t1;
select * from v1 order by 1;
b
3
drop view v1;
select * from v1 order by a;
ERROR 42S02: Table 'test.v1' doesn't exist
drop table t1;
source include/master-slave.inc;
--disable_warnings
drop table if exists t1,v1;
drop view if exists t1,v1;
sync_slave_with_master;
--enable_warnings
#
# Check that createion drop of view is replicated, also check replication of
# updating of view
#
connection master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
insert into v1 values (2);
select * from v1 order by a;
sync_slave_with_master;
# view already have to be on slave
select * from v1 order by a;
connection master;
update v1 set a=3 where a=1;
select * from v1 order by a;
sync_slave_with_master;
select * from v1 order by a;
connection master;
delete from v1 where a=2;
select * from v1 order by a;
sync_slave_with_master;
select * from v1 order by a;
connection master;
# 'alter view' internally maped to creation, but still check that it works
alter view v1 as select a as b from t1;
sync_slave_with_master;
select * from v1 order by 1;
connection master;
drop view v1;
sync_slave_with_master;
#error, because view have to be removed from slave
-- error 1146
select * from v1 order by a;
connection master;
drop table t1;
sync_slave_with_master;
......@@ -5516,6 +5516,9 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
/* global privileges */
grant->privilege= thd->master_access;
if (!thd->priv_user)
return; // it is slave
/* db privileges */
grant->privilege|= acl_get(thd->host, thd->ip, thd->priv_user, db, 0);
......
......@@ -4059,7 +4059,12 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_CREATE_VIEW:
{
res= mysql_create_view(thd, thd->lex->create_view_mode);
if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) &&
mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
mysql_bin_log.write(&qinfo);
}
break;
}
case SQLCOM_DROP_VIEW:
......@@ -4067,7 +4072,12 @@ mysql_execute_command(THD *thd)
if (check_table_access(thd, DROP_ACL, all_tables, 0) ||
end_active_trans(thd))
goto error;
res= mysql_drop_view(thd, first_table, thd->lex->drop_mode);
if (!(res= mysql_drop_view(thd, first_table, thd->lex->drop_mode)) &&
mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
mysql_bin_log.write(&qinfo);
}
break;
}
case SQLCOM_CREATE_TRIGGER:
......
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