mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
This commit is contained in:
@ -380,6 +380,24 @@ drop function f2;
|
|||||||
drop table t2;
|
drop table t2;
|
||||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
|
||||||
drop user `a@`@localhost;
|
drop user `a@`@localhost;
|
||||||
|
grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option;
|
||||||
|
grant usage on *.* to mysqltest_2@localhost;
|
||||||
|
create database mysqltest_1;
|
||||||
|
use mysqltest_1;
|
||||||
|
create table t1 (f1 int);
|
||||||
|
grant create on `mysqltest\_1`.* to mysqltest_2@localhost;
|
||||||
|
grant select on mysqltest_1.t1 to mysqltest_2@localhost;
|
||||||
|
create database mysqltest_3;
|
||||||
|
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest_3'
|
||||||
|
use mysqltest_1;
|
||||||
|
create table t2(f1 int);
|
||||||
|
select * from t1;
|
||||||
|
f1
|
||||||
|
drop database mysqltest_1;
|
||||||
|
revoke all privileges, grant option from mysqltest_1@localhost;
|
||||||
|
revoke all privileges, grant option from mysqltest_2@localhost;
|
||||||
|
drop user mysqltest_1@localhost;
|
||||||
|
drop user mysqltest_2@localhost;
|
||||||
SET GLOBAL log_bin_trust_function_creators = 0;
|
SET GLOBAL log_bin_trust_function_creators = 0;
|
||||||
drop database if exists mysqltest_1;
|
drop database if exists mysqltest_1;
|
||||||
drop database if exists mysqltest_2;
|
drop database if exists mysqltest_2;
|
||||||
|
@ -1397,6 +1397,17 @@ TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1
|
|||||||
TRIGGERS information_schema.TRIGGERS 1
|
TRIGGERS information_schema.TRIGGERS 1
|
||||||
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
|
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
|
||||||
VIEWS information_schema.VIEWS 1
|
VIEWS information_schema.VIEWS 1
|
||||||
|
create table t1(f1 int);
|
||||||
|
create view v1 as select f1+1 as a from t1;
|
||||||
|
create table t2 (f1 int, f2 int);
|
||||||
|
create view v2 as select f1+1 as a, f2 as b from t2;
|
||||||
|
select table_name, is_updatable from information_schema.views;
|
||||||
|
table_name is_updatable
|
||||||
|
v1 NO
|
||||||
|
v2 YES
|
||||||
|
delete from v1;
|
||||||
|
drop view v1,v2;
|
||||||
|
drop table t1,t2;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
@ -23,6 +23,9 @@ c
|
|||||||
5
|
5
|
||||||
6
|
6
|
||||||
11
|
11
|
||||||
|
select is_updatable from information_schema.views where table_name='v1';
|
||||||
|
is_updatable
|
||||||
|
NO
|
||||||
create temporary table t1 (a int, b int);
|
create temporary table t1 (a int, b int);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a b
|
a b
|
||||||
@ -322,6 +325,12 @@ create table t1 (a int, b int, primary key(a));
|
|||||||
insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
|
insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
|
||||||
create view v1 (a,c) as select a, b+1 from t1;
|
create view v1 (a,c) as select a, b+1 from t1;
|
||||||
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
|
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
|
||||||
|
select is_updatable from information_schema.views where table_name='v2';
|
||||||
|
is_updatable
|
||||||
|
NO
|
||||||
|
select is_updatable from information_schema.views where table_name='v1';
|
||||||
|
is_updatable
|
||||||
|
YES
|
||||||
update v1 set c=a+c;
|
update v1 set c=a+c;
|
||||||
ERROR HY000: Column 'c' is not updatable
|
ERROR HY000: Column 'c' is not updatable
|
||||||
update v2 set a=a+c;
|
update v2 set a=a+c;
|
||||||
@ -604,6 +613,10 @@ insert into t1 values(5,'Hello, world of views');
|
|||||||
create view v1 as select * from t1;
|
create view v1 as select * from t1;
|
||||||
create view v2 as select * from v1;
|
create view v2 as select * from v1;
|
||||||
update v2 set col2='Hello, view world';
|
update v2 set col2='Hello, view world';
|
||||||
|
select is_updatable from information_schema.views;
|
||||||
|
is_updatable
|
||||||
|
YES
|
||||||
|
YES
|
||||||
select * from t1;
|
select * from t1;
|
||||||
col1 col2
|
col1 col2
|
||||||
5 Hello, view world
|
5 Hello, view world
|
||||||
|
@ -555,5 +555,35 @@ drop database mysqltest_1;
|
|||||||
drop database mysqltest_2;
|
drop database mysqltest_2;
|
||||||
drop user mysqltest_u1@localhost;
|
drop user mysqltest_u1@localhost;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#18660 Can't grant any privileges on single table in database
|
||||||
|
# with underscore char
|
||||||
|
#
|
||||||
|
grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option;
|
||||||
|
grant usage on *.* to mysqltest_2@localhost;
|
||||||
|
connect (con18600_1,localhost,mysqltest_1,,);
|
||||||
|
|
||||||
|
create database mysqltest_1;
|
||||||
|
use mysqltest_1;
|
||||||
|
create table t1 (f1 int);
|
||||||
|
|
||||||
|
grant create on `mysqltest\_1`.* to mysqltest_2@localhost;
|
||||||
|
grant select on mysqltest_1.t1 to mysqltest_2@localhost;
|
||||||
|
connect (con3,localhost,mysqltest_2,,);
|
||||||
|
connection con3;
|
||||||
|
--error 1044
|
||||||
|
create database mysqltest_3;
|
||||||
|
use mysqltest_1;
|
||||||
|
create table t2(f1 int);
|
||||||
|
select * from t1;
|
||||||
|
connection default;
|
||||||
|
drop database mysqltest_1;
|
||||||
|
|
||||||
|
revoke all privileges, grant option from mysqltest_1@localhost;
|
||||||
|
revoke all privileges, grant option from mysqltest_2@localhost;
|
||||||
|
drop user mysqltest_1@localhost;
|
||||||
|
drop user mysqltest_2@localhost;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
@ -1024,6 +1024,21 @@ where t.table_schema = 'information_schema' and
|
|||||||
group by c2.column_type order by num limit 1)
|
group by c2.column_type order by num limit 1)
|
||||||
group by t.table_name order by num1, t.table_name;
|
group by t.table_name order by num1, t.table_name;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#28266 IS_UPDATABLE field on VIEWS table in I_S database is wrong
|
||||||
|
#
|
||||||
|
create table t1(f1 int);
|
||||||
|
create view v1 as select f1+1 as a from t1;
|
||||||
|
create table t2 (f1 int, f2 int);
|
||||||
|
create view v2 as select f1+1 as a, f2 as b from t2;
|
||||||
|
select table_name, is_updatable from information_schema.views;
|
||||||
|
#
|
||||||
|
# Note: we can perform 'delete' for non updatable view.
|
||||||
|
#
|
||||||
|
delete from v1;
|
||||||
|
drop view v1,v2;
|
||||||
|
drop table t1,t2;
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
#
|
#
|
||||||
# Show engines
|
# Show engines
|
||||||
|
@ -32,6 +32,7 @@ create view v1 (c,d) as select a,b from t1
|
|||||||
# simple view
|
# simple view
|
||||||
create view v1 (c) as select b+1 from t1;
|
create view v1 (c) as select b+1 from t1;
|
||||||
select c from v1;
|
select c from v1;
|
||||||
|
select is_updatable from information_schema.views where table_name='v1';
|
||||||
|
|
||||||
# temporary table should not hide table of view
|
# temporary table should not hide table of view
|
||||||
create temporary table t1 (a int, b int);
|
create temporary table t1 (a int, b int);
|
||||||
@ -228,6 +229,8 @@ create table t1 (a int, b int, primary key(a));
|
|||||||
insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
|
insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
|
||||||
create view v1 (a,c) as select a, b+1 from t1;
|
create view v1 (a,c) as select a, b+1 from t1;
|
||||||
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
|
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
|
||||||
|
select is_updatable from information_schema.views where table_name='v2';
|
||||||
|
select is_updatable from information_schema.views where table_name='v1';
|
||||||
# try to update expression
|
# try to update expression
|
||||||
-- error 1348
|
-- error 1348
|
||||||
update v1 set c=a+c;
|
update v1 set c=a+c;
|
||||||
@ -497,6 +500,7 @@ insert into t1 values(5,'Hello, world of views');
|
|||||||
create view v1 as select * from t1;
|
create view v1 as select * from t1;
|
||||||
create view v2 as select * from v1;
|
create view v2 as select * from v1;
|
||||||
update v2 set col2='Hello, view world';
|
update v2 set col2='Hello, view world';
|
||||||
|
select is_updatable from information_schema.views;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop view v2, v1;
|
drop view v2, v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -4608,7 +4608,17 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
|
|||||||
Security_context *sctx= thd->security_ctx;
|
Security_context *sctx= thd->security_ctx;
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
ulong db_access;
|
ulong db_access;
|
||||||
bool db_is_pattern= test(want_access & GRANT_ACL);
|
/*
|
||||||
|
GRANT command:
|
||||||
|
In case of database level grant the database name may be a pattern,
|
||||||
|
in case of table|column level grant the database name can not be a pattern.
|
||||||
|
We use 'dont_check_global_grants' as a flag to determine
|
||||||
|
if it's database level grant command
|
||||||
|
(see SQLCOM_GRANT case, mysql_execute_command() function) and
|
||||||
|
set db_is_pattern according to 'dont_check_global_grants' value.
|
||||||
|
*/
|
||||||
|
bool db_is_pattern= (test(want_access & GRANT_ACL) &&
|
||||||
|
dont_check_global_grants);
|
||||||
#endif
|
#endif
|
||||||
ulong dummy;
|
ulong dummy;
|
||||||
DBUG_ENTER("check_access");
|
DBUG_ENTER("check_access");
|
||||||
|
@ -3599,6 +3599,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
|
|||||||
DBUG_ENTER("get_schema_views_record");
|
DBUG_ENTER("get_schema_views_record");
|
||||||
char definer[USER_HOST_BUFF_SIZE];
|
char definer[USER_HOST_BUFF_SIZE];
|
||||||
uint definer_len;
|
uint definer_len;
|
||||||
|
bool updatable_view;
|
||||||
|
|
||||||
if (tables->view)
|
if (tables->view)
|
||||||
{
|
{
|
||||||
@ -3636,7 +3637,34 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
|
|||||||
else
|
else
|
||||||
table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
|
table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
|
||||||
|
|
||||||
if (tables->updatable_view)
|
updatable_view= 0;
|
||||||
|
if (tables->algorithm != VIEW_ALGORITHM_TMPTABLE)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We should use tables->view->select_lex.item_list here and
|
||||||
|
can not use Field_iterator_view because the view always uses
|
||||||
|
temporary algorithm during opening for I_S and
|
||||||
|
TABLE_LIST fields 'field_translation' & 'field_translation_end'
|
||||||
|
are uninitialized is this case.
|
||||||
|
*/
|
||||||
|
List<Item> *fields= &tables->view->select_lex.item_list;
|
||||||
|
List_iterator<Item> it(*fields);
|
||||||
|
Item *item;
|
||||||
|
Item_field *field;
|
||||||
|
/*
|
||||||
|
chech that at least one coulmn in view is updatable
|
||||||
|
*/
|
||||||
|
while ((item= it++))
|
||||||
|
{
|
||||||
|
if ((field= item->filed_for_view_update()) && field->field &&
|
||||||
|
!field->field->table->pos_in_table_list->schema_table)
|
||||||
|
{
|
||||||
|
updatable_view= 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updatable_view)
|
||||||
table->field[5]->store(STRING_WITH_LEN("YES"), cs);
|
table->field[5]->store(STRING_WITH_LEN("YES"), cs);
|
||||||
else
|
else
|
||||||
table->field[5]->store(STRING_WITH_LEN("NO"), cs);
|
table->field[5]->store(STRING_WITH_LEN("NO"), cs);
|
||||||
|
@ -5790,8 +5790,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
strxnmov(new_name_buff, sizeof (new_name_buff) - 1, mysql_data_home, "/", db,
|
strxnmov(new_name_buff, sizeof (new_name_buff) - 1, mysql_data_home, "/", db,
|
||||||
"/", table_name, reg_ext, NullS);
|
"/", table_name, reg_ext, NullS);
|
||||||
(void) unpack_filename(new_name_buff, new_name_buff);
|
(void) unpack_filename(new_name_buff, new_name_buff);
|
||||||
if (lower_case_table_names != 2)
|
|
||||||
my_casedn_str(files_charset_info, new_name_buff);
|
|
||||||
/*
|
/*
|
||||||
If this is just a rename of a view, short cut to the
|
If this is just a rename of a view, short cut to the
|
||||||
following scenario: 1) lock LOCK_open 2) do a RENAME
|
following scenario: 1) lock LOCK_open 2) do a RENAME
|
||||||
|
Reference in New Issue
Block a user