Hi!
Ok to push with a couple of changes, see below
On Oct 23, Sergey Vojtovich wrote:
> > > diff -Nrup a/sql/item_func.cc b/sql/item_func.cc
> > > --- a/sql/item_func.cc 2007-06-13 16:32:58 +05:00
> > > +++ b/sql/item_func.cc 2007-10-19 14:24:59 +05:00
> > > @@ -3135,13 +3135,36 @@ bool Item_func_match::fix_fields(THD *th
> > > my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH");
> > > return 1;
> > > }
> > > - table= ((Item_field *)item)->field->table;
> > > + table= ((Item_field *)item)->field ? ((Item_field
> *)item)->field->table :
> > > + ((Item_field *)((Item_func_conv
> *)item)->key_item())->field->table;
> >
> > What is this ?
ok, in this case:
1. add a comment explaining this
2. You cannot do '((Item_field *)item)->field' - dereference an item
casted to Item_field if it's not, in fact, Item_field. Instead, use
item->type() == Item::FIELD_ITEM
> This is what we were talking about recently. In ps-protocol mode
> Item_func_match::fix_fields is called twice. When it is called first time we
> have original item tree here and add conversion layer a few lines below. When
> it is called second time, we already have conversion layer. Thus accessing
> ((Item_field*)item)->field->table causes server crash.
>
> > > + if (compatible_cs)
> > > + {
> > > + Item_string *conv_item= new Item_string("", 0, compatible_cs,
> > > + DERIVATION_EXPLICIT);
> > > + item= args[0];
> > > + args[0]= conv_item;
> > > + rc= agg_item_charsets(cmp_collation, func_name(), args, arg_count,
> > > + MY_COLL_ALLOW_SUPERSET_CONV |
> > > + MY_COLL_ALLOW_COERCIBLE_CONV |
> > > + MY_COLL_DISALLOW_NONE);
> >
> > hmm, when you aggregate ucs2 and utf8, does utf8 win ?
> Sure, because it has DERIVATION_EXPLICIT.
Ah, indeed. Sorry, didn't notice that ;)
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Dachauer Str. 37, D-80335 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140