![](https://secure.gravatar.com/avatar/bccaf81a23eecaecd9feaf01c7c42ff4.jpg?s=120&d=mm&r=g)
Hi Sanja, On Tue, Jul 30, 2013 at 11:00:59AM +0300, sanja@montyprogram.com wrote:
At file:///home/bell/maria/bzr/work-maria-5.2-MDEV-4823/
------------------------------------------------------------ revno: 3215 revision-id: sanja@montyprogram.com-20130730080057-ylgl6h11l2b3yflc parent: wlad@montyprogram.com-20130709202457-6n9syq59jdd2sy3b committer: sanja@montyprogram.com branch nick: work-maria-5.2-MDEV-4823 timestamp: Tue 2013-07-30 11:00:57 +0300 message: MDEV-4823: Server crashes in Item_func_not::fix_fields on creating a table with a virtual column using NOT
fix_field() call protocol was brocken (zero pointer passed as link to item which is possible only if you are sure that there can not be Items which transforms). ... === modified file 'sql/table.cc' --- a/sql/table.cc 2013-01-16 00:46:27 +0000 +++ b/sql/table.cc 2013-07-30 08:00:57 +0000 @@ -1812,7 +1812,7 @@ bool fix_vcol_expr(THD *thd, bool result= TRUE; TABLE_LIST tables; TABLE_LIST *save_table_list, *save_first_table, *save_last_table; - int error; + int error= 0; Name_resolution_context *context; const char *save_where; char* db_name; @@ -1860,7 +1860,13 @@ bool fix_vcol_expr(THD *thd, save_use_only_table_context= thd->lex->use_only_table_context; thd->lex->use_only_table_context= TRUE; /* Fix fields referenced to by the virtual column function */ - error= func_expr->fix_fields(thd, (Item**)0); + if (!func_expr->fixed) + error= func_expr->fix_fields(thd, (Item**)&vcol_info->expr_item); There is no need to use (Item**) cast, please remove it.
Ok to push after that.
+ + /* fix_fields could change the expression */ + func_expr= vcol_info->expr_item; + /* Number of columns will be checked later */ + /* Restore the original context*/ thd->lex->use_only_table_context= save_use_only_table_context; context->table_list= save_table_list;
BR Sergei -- Sergei Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog