summaryrefslogtreecommitdiff
path: root/mysql-test/main/system_mysql_db_refs.result
blob: 870a550bb9542c78876f116b2f1c38fb9262d9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
create table test_db select * from mysql.db;
delete from test_db;
insert ignore into test_db (Host,Db,User) values (@name,@name,@name);
create table test_user select * from mysql.user;
delete from test_user;
insert ignore into test_user (Host,User) values (@name,@name);
create table test_func select * from mysql.func;
delete from test_func;
insert ignore into test_func (name) values (@name);
create table test_tables_priv select * from mysql.tables_priv;
delete from test_tables_priv;
insert ignore into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
create table test_columns_priv select * from mysql.columns_priv;
delete from test_columns_priv;
insert ignore into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
select
if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
from      test_db
left join test_user         on test_db.Host=test_user.Host
left join test_tables_priv  on test_db.Host=test_tables_priv.Host
left join test_columns_priv on test_db.Host=test_columns_priv.Host;
test_db_Host	test_user_Host	test_tables_priv_Host	test_columns_priv_Host
ok	ok	ok	ok
select
if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
from      test_db
left join test_tables_priv  on test_db.Db=test_tables_priv.Db
left join test_columns_priv on test_db.Db=test_columns_priv.Db;
test_db_Db	test_tables_priv_Db	est_columns_priv_Db
ok	ok	ok
select
if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
from      test_db
left join test_user         on test_db.User=test_user.User
left join test_tables_priv  on test_db.User=test_tables_priv.User
left join test_columns_priv on test_db.User=test_columns_priv.User;
test_db_User	test_user_User	test_tables_priv_User	test_columns_priv_User
ok	ok	ok	ok
select
if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
from      test_tables_priv
left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
test_tables_priv_User	test_columns_priv_User
ok	ok
drop table test_columns_priv;
drop table test_tables_priv;
drop table test_func;
drop table test_user;
drop table test_db;