diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2009-05-19 09:25:36 +0500 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2009-05-19 09:25:36 +0500 |
commit | a3b26f1aa6402ab995b234b6b0d75e192781c500 (patch) | |
tree | ab67ed94e3da5e3f5bb47ac3fdc1ea943aef80e1 /sql/sql_table.cc | |
parent | 7bd64afe8a47a9e7c5e4828b00a5a8fe17ad2bc4 (diff) | |
download | mariadb-git-a3b26f1aa6402ab995b234b6b0d75e192781c500.tar.gz |
Fix for bug#44860: ALTER TABLE on view crashes server
Problem: executing queries like "ALTER TABLE view1;" we don't
check new view's name (which is not specified),
that leads to server crash.
Fix: do nothing (to be consistent with the behaviour for tables)
in such cases.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2744619e138..5397128855a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6140,6 +6140,20 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (frm_type == FRMTYPE_VIEW && !(alter_info->flags & ~ALTER_RENAME)) { /* + The following branch handles "ALTER VIEW v1 /no arguments/;" + This feature is not documented one. + However, before "OPTIMIZE TABLE t1;" was implemented, + ALTER TABLE with no alter_specifications was used to force-rebuild + the table. That's why this grammar is allowed. That's why we ignore + it for views. So just do nothing in such a case. + */ + if (!new_name) + { + my_ok(thd); + DBUG_RETURN(FALSE); + } + + /* Avoid problems with a rename on a table that we have locked or if the user is trying to to do this in a transcation context */ |