summaryrefslogtreecommitdiff
path: root/sql/sql_alter.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
commit9809f05199aeb0b67991fac41bd86f38730768dc (patch)
treefa2792ff86d0da014b535d743759810612338042 /sql/sql_alter.cc
parent0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff)
parent5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff)
downloadmariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz
5.5-merge
Diffstat (limited to 'sql/sql_alter.cc')
-rw-r--r--sql/sql_alter.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 046e09b20a3..5af01523aa7 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -13,8 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include "sql_parse.h" // check_access,
- // check_merge_table_access
+#include "sql_parse.h" // check_access
#include "sql_table.h" // mysql_alter_table,
// mysql_exchange_partition
#include "sql_alter.h"
@@ -60,11 +59,15 @@ bool Alter_table_statement::execute(THD *thd)
check_access(thd, INSERT_ACL | CREATE_ACL, select_lex->db,
&priv,
NULL, /* Don't use first_tab->grant with sel_lex->db */
- 0, 0) ||
- check_merge_table_access(thd, first_table->db,
- create_info.merge_list.first))
+ 0, 0))
DBUG_RETURN(TRUE); /* purecov: inspected */
+ /* If it is a merge table, check privileges for merge children. */
+ if (create_info.merge_list.first &&
+ check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
+ create_info.merge_list.first, FALSE, UINT_MAX, FALSE))
+ DBUG_RETURN(TRUE);
+
if (check_grant(thd, priv_needed, first_table, FALSE, UINT_MAX, FALSE))
DBUG_RETURN(TRUE); /* purecov: inspected */