List:Bugs« Previous MessageNext Message »
From:Thimble Smith Date:June 5 2000 8:37pm
Subject:Re: Fw: Re:FIND_IN_SET and ELT function problem.
View as plain text  
On Mon, Jun 05, 2000 at 12:02:33PM -0400, Mike Krolak wrote:
> SELECT * FROM KS_page WHERE (page LIKE 'user_page') and
> (FIND_IN_SET(ELT(0,'subsidizer','sponsor','referral','subscriber'),user_level));
> 
> All of the responses were the same.  MySQL shut down and
> required a full restart of the server to start again.  The load
> rates jumped to 130%!

I've been able to verify this with both 3.22.32 and 3.23.16.  It
looks like the find_in_set function just doesn't handle a null
string.

Here's a patch which fixes the problem.  It might not be the fix
that gets into the next MySQL version, but a fix will definitely
be there.

To apply the patch, save the following text to a file, and then
run this command from they MySQL source directory:

    $ patch < /tmp/the_patch_file

Type 'make' and then 'make install'.


Index: sql/item_func.cc
===================================================================
RCS file: /home/cvs/mysql/sql/item_func.cc,v
retrieving revision 1.5
diff -u -r1.5 item_func.cc
--- sql/item_func.cc    2000/05/05 22:55:52     1.5
+++ sql/item_func.cc    2000/06/05 20:32:58
@@ -898,7 +898,7 @@
 {
   decimals=0;
   max_length=3;                                        // 1-999
-  if (args[0]->const_item() && args[1]->type() == FIELD_ITEM)
+  if (!args[0]->null_value && args[0]->const_item() &&
args[1]->type() == FIELD_ITEM)
   {
     Field *field= ((Item_field*) args[1])->field;
     if (field->real_type() == FIELD_TYPE_SET)


Tim
-- 
Tim Smith   < tim@stripped >  :MySQL Development Team:  Boone, NC  USA.
Thread
Fw: Re:FIND_IN_SET and ELT function problem.Mike Krolak5 Jun
  • Re: Fw: Re:FIND_IN_SET and ELT function problem.Thimble Smith5 Jun
    • Re: Fw: Re:FIND_IN_SET and ELT function problem.Michael Widenius6 Jun