summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-10-07 15:14:50 +0200
committerSergei Golubchik <serg@mariadb.org>2022-10-07 15:24:02 +0200
commit5f26f50020e9a41f644893088e94de74de55f95d (patch)
tree84f0658d3d0128275cf60fb978f1c7e3113e2c0e
parent3fe55fa8be9bdfbaefc69e0cd7dea12833fe9cbb (diff)
downloadmariadb-git-5f26f50020e9a41f644893088e94de74de55f95d.tar.gz
typo fixed, followup for 3fe55fa8be9
-rw-r--r--mysql-test/main/grant3.result8
-rw-r--r--mysql-test/main/grant3.test10
-rw-r--r--sql/sql_parse.cc2
3 files changed, 19 insertions, 1 deletions
diff --git a/mysql-test/main/grant3.result b/mysql-test/main/grant3.result
index cd686e19a9b..160153b1674 100644
--- a/mysql-test/main/grant3.result
+++ b/mysql-test/main/grant3.result
@@ -211,5 +211,13 @@ ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table `db1`.`t1
create table t1 (a int);
disconnect foo;
connection default;
+revoke create on db1.* from foo@localhost;
+grant insert on db1.* to foo@localhost;
+connect foo,localhost,foo;
+use db1;
+create table t2 as values (1),(2),(3);
+ERROR 42000: CREATE command denied to user 'foo'@'localhost' for table `db1`.`t2`
+disconnect foo;
+connection default;
drop user foo@localhost;
drop database db1;
diff --git a/mysql-test/main/grant3.test b/mysql-test/main/grant3.test
index 67c185bcccd..5337d59efd8 100644
--- a/mysql-test/main/grant3.test
+++ b/mysql-test/main/grant3.test
@@ -224,6 +224,16 @@ create table t1 as values (1),(2),(3);
create table t1 (a int);
disconnect foo;
connection default;
+
+revoke create on db1.* from foo@localhost;
+grant insert on db1.* to foo@localhost;
+connect foo,localhost,foo;
+use db1;
+--error ER_TABLEACCESS_DENIED_ERROR
+create table t2 as values (1),(2),(3);
+disconnect foo;
+
+connection default;
drop user foo@localhost;
drop database db1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 57d7f93eacc..37d54b1165e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -9869,7 +9869,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
if (lex->tmp_table())
want_priv= CREATE_TMP_ACL;
else if (select_lex->item_list.elements || select_lex->tvc)
- want_priv= INSERT_ACL;
+ want_priv|= INSERT_ACL;
/* CREATE OR REPLACE on not temporary tables require DROP_ACL */
if (lex->create_info.or_replace() && !lex->tmp_table())