Commit 05c99435 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-31014 Database privileges are insufficient for CONVERT TABLE TO PARTITION

check_access() updates ACL of first TABLE_LIST (t1), but not second
(tp). After it is done we copy t1 ACL to tp.
parent ef14d6d6
......@@ -344,3 +344,17 @@ connection default;
drop database EXISTENT;
drop user alan;
drop tables t1, tp1, tp2, tp4;
#
# MDEV-31014 Database privileges are insufficient for CONVERT TABLE TO PARTITION
#
create database db;
create user u@localhost;
grant all on db.* to u@localhost;
connect con1,localhost,u,,db;
create table t1 (a int) partition by range(a) (p1 values less than (100), p2 values less than (1000));
alter table t1 convert partition p2 to table tp;
alter table t1 convert table tp to partition p2 values less than (1000);
disconnect con1;
connection default;
drop user u@localhost;
drop database db;
......@@ -301,3 +301,21 @@ alter table t1 convert partition p1 to table tp1;
drop database EXISTENT;
drop user alan;
drop tables t1, tp1, tp2, tp4;
--echo #
--echo # MDEV-31014 Database privileges are insufficient for CONVERT TABLE TO PARTITION
--echo #
create database db;
create user u@localhost;
grant all on db.* to u@localhost;
--connect (con1,localhost,u,,db)
create table t1 (a int) partition by range(a) (p1 values less than (100), p2 values less than (1000));
alter table t1 convert partition p2 to table tp;
alter table t1 convert table tp to partition p2 values less than (1000);
# Cleanup
--disconnect con1
--connection default
drop user u@localhost;
drop database db;
......@@ -493,6 +493,14 @@ bool Sql_cmd_alter_table::execute(THD *thd)
0, 0))
DBUG_RETURN(TRUE); /* purecov: inspected */
if ((alter_info.partition_flags & ALTER_PARTITION_CONVERT_IN))
{
TABLE_LIST *tl= first_table->next_local;
tl->grant.privilege= first_table->grant.privilege;
tl->grant.m_internal= first_table->grant.m_internal;
}
/* If it is a merge table, check privileges for merge children. */
if (create_info.merge_list)
{
......
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