List:Internals« Previous MessageNext Message »
From:Paul McCullagh Date:July 19 2006 8:09am
Subject:Bug fix for multi-table UPDATE IGNORE
View as plain text  
Hi All,

I found a bug that can cause an engine to crash when executing a 
statement of the form:

UPDATE IGNORE t1, t2 ...;

The problem is, extra(HA_EXTRA_IGNORE_DUP_KEY) is not called in this 
case to inform the engine to ignore the duplicate key errors.

I have included a bug fix for the version I am using below. As far as I 
can tell, the code must also be added to mysql_multi_update_prepare() 
in version 5.1.

__  _______
\ \/ _   _/     Paul McCullagh
  \  / | |       SNAP Innovation GmbH
  /  \ | |       Altonaer Poststr 9a
/ /\ \| |       22767 Hamburg
------------    Germany
PrimeBase XT    www.primebase.com/xt


------ MySQL 4.1.16 ----- file: sql_update.cc ----- line: 687 ------

int mysql_multi_update(THD *thd,
		       TABLE_LIST *table_list,
		       List<Item> *fields,
		       List<Item> *values,
		       COND *conds,
		       ulong options,
		       enum enum_duplicates handle_duplicates, bool ignore,
		       SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
{
   int res;
   TABLE_LIST *tl;
   TABLE_LIST *update_list= (TABLE_LIST*) 
thd->lex->select_lex.table_list.first;
   List<Item> total_list;
   multi_update *result;
   DBUG_ENTER("mysql_multi_update");

   /* Setup timestamp handling */
   for (tl= update_list; tl; tl= tl->next)
   {
     TABLE *table= tl->table;
     /* Only set timestamp column if this is not modified */
     if (table->timestamp_field &&
         table->timestamp_field->query_id == thd->query_id)
       table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;

     /* We only need SELECT privilege for columns in the values list */
     table->grant.want_privilege= (SELECT_ACL & ~table->grant.privilege);

	/* PMC: engines may have to ignore duplicate key errors */
     if (ignore)
       table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
   }

Thread
mysql architectureGirish Maskeri Rama2 Jun
  • Re: mysql architectureJim Winstead2 Jun
RE: mysql architectureGirish Maskeri Rama5 Jun
  • RE: mysql architecturePetr Chardin5 Jun
    • Bug fix for multi-table UPDATE IGNOREPaul McCullagh19 Jul
      • Re: Bug fix for multi-table UPDATE IGNORELenz Grimmer27 Jul
        • Re: Bug fix for multi-table UPDATE IGNOREPaul McCullagh1 Aug