List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:January 19 2000 3:42am
Subject:Re: Failure with UPDATE statement
View as plain text  
>>>>> "Peter" == Peter Campbell <pc@stripped> writes:

Peter> Hi, I have uploaded the file "master.tar.gz" into your secret 
Peter> directory.

Peter> Notes: I downloaded the rpm release of 3.23.8 and installed it via 
Peter> "rpm -i --force filename" (for both server and client programs).

Peter> Have fun, cheers.


>> 
>> Hi again!
>> 
>> >>>>> "Peter" == Peter Campbell <pc@stripped> writes:
>> 
>> <cut>
>> 
Peter> Thanks for your replies...
>> 
Peter> I have upgraded to version 3.23.8 as suggested and am still having 
Peter> the same problems (I also ran a full myisamchk and reported 0 
Peter> errors).
>> 
Peter> Here is an example mysql session:
>> 
mysql> UPDATE MASTER SET QTY_ON_HAND = 5 WHERE 
Peter> COMPANY_ID = '01';
Peter> Query OK, 13690 rows affected (4.39 sec)
Peter> Rows matched: 13690  Changed: 13690  Warnings: 0
>> 
mysql> UPDATE MASTER SET QTY_ON_HAND = NULL WHERE 
Peter> COMPANY_ID = '01';
Peter> Query OK, 13690 rows affected (2.85 sec)
Peter> Rows matched: 13690  Changed: 13690  Warnings: 0
>> 
mysql> UPDATE MASTER SET QTY_ON_HAND = 0 WHERE 
Peter> COMPANY_ID = '01';
Peter> Query OK, 0 rows affected (1.06 sec)
Peter> Rows matched: 13690  Changed: 0  Warnings: 0

Hi!

This was a problem in 3.23 when only changing a 0 to NULL in a table
with BLOB/TEXT columns.

Here is a fix for this:

*** /my/monty/master/mysql-3.23.8-alpha/sql/sql_update.cc	Tue Dec 28 05:41:30 1999
--- ./sql_update.cc	Wed Jan 19 05:38:22 2000
***************
*** 24,29 ****
--- 24,34 ----
    if (!table->blob_fields)
      return cmp_record(table,1);
    ulong current_query_id=current_thd->query_id;
+ 
+   if (memcmp(table->null_flags,
+ 	     table->null_flags+table->rec_buff_length,
+ 	     table->null_bytes))
+     return 1;					// Diff in NULL value
    for (Field **ptr=table->field ; *ptr ; ptr++)
    {
      if ((*ptr)->query_id == current_query_id &&

Regards,
Monty
Thread
Failure with UPDATE statementPeter Campbell14 Jan
  • Re: Failure with UPDATE statementSasha Pachev14 Jan
  • Re: Failure with UPDATE statementsinisa14 Jan
  • Failure with UPDATE statementMichael Widenius14 Jan
Re: Failure with UPDATE statementMichael Widenius19 Jan