List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:February 20 2008 7:55pm
Subject:Re: bk commit into 5.1 tree (anozdrin:1.2561) BUG#34337
View as plain text  
* Alexander Nozdrin <alik@stripped> [08/02/20 15:22]:
> ChangeSet@stripped, 2008-02-20 15:00:07+03:00, anozdrin@quad. +3 -0
>   Fix for Bug#34337: Server crash when Altering a view using
>   a table name.

The patch is OK to push.

>   The problem was that fill_defined_view_parts() did not return
>   an error if a table is going to be altered. That happened if
>   the table was already in the table cache. In that case,
>   open_table() returned non-NULL value (valid TABLE-instance from
>   the cache).
> +
> +  /*
> +    open_table() will return NULL if 'decoy' is idenitifying a view *and*
> +    there is no TABLE object for that view in the table cache. However,
> +    decoy.view will be set to 1.
> +
> +    If there is a TABLE-instance for the oject identified by 'decoy',
> +    open_table() will return that instance no matter if it is a table or
> +    a view.
> +
> +    Thus, there is no need to check for the return value of open_table(),
> +    since the return value itself does not mean anything.
> +  */
> +
> +  open_table(thd, &decoy, thd->mem_root, &not_used, OPEN_VIEW_NO_PARSE);
> +
> +  if (!decoy.view)
>    {
> -    /* It's a table */
> +    /* It's a table. */
> +    my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW");
>      return TRUE;

It's better to reset decoy.view before calling open_table(): when
we start supporting ALTER VIEW in PS/SP that may save us from a
similar crash.

-- 
-- Konstantin Osipov              Software Developer, Moscow, Russia
-- MySQL AB, www.mysql.com   The best DATABASE COMPANY in the GALAXY
Thread
bk commit into 5.1 tree (anozdrin:1.2561) BUG#34337Alexander Nozdrin20 Feb
  • Re: bk commit into 5.1 tree (anozdrin:1.2561) BUG#34337Konstantin Osipov20 Feb