diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-10-06 19:09:44 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-10-07 14:41:03 +0200 |
commit | 3fe55fa8be9bdfbaefc69e0cd7dea12833fe9cbb (patch) | |
tree | ee021c1486e3c91d2e442e1d84d9e9106428128b /sql/sql_parse.cc | |
parent | 1d35ec1ae1d1ea27d4b352f54fe5a3e720851e83 (diff) | |
download | mariadb-git-3fe55fa8be9bdfbaefc69e0cd7dea12833fe9cbb.tar.gz |
CREATE ... VALUES ... didn't require INSERT privilege
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 471d93d97f6..57d7f93eacc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9857,7 +9857,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, { LEX *lex= thd->lex; SELECT_LEX *select_lex= lex->first_select_lex(); - ulong want_priv; + ulong want_priv= CREATE_ACL; bool error= TRUE; // Error message is given DBUG_ENTER("create_table_precheck"); @@ -9866,8 +9866,10 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, CREATE TABLE ... SELECT, also require INSERT. */ - want_priv= lex->tmp_table() ? CREATE_TMP_ACL : - (CREATE_ACL | (select_lex->item_list.elements ? INSERT_ACL : 0)); + if (lex->tmp_table()) + want_priv= CREATE_TMP_ACL; + else if (select_lex->item_list.elements || select_lex->tvc) + want_priv= INSERT_ACL; /* CREATE OR REPLACE on not temporary tables require DROP_ACL */ if (lex->create_info.or_replace() && !lex->tmp_table()) |