1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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.
This commit is contained in:
Ramil Kalimullin
2009-05-19 09:25:36 +05:00
parent 7bd64afe8a
commit a3b26f1aa6
4 changed files with 35 additions and 0 deletions

View File

@ -6139,6 +6139,20 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* Sic: there is a race here */
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