Commit 095ae499 authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org
Browse files

bk resolve

parents dbc266ee aa7231af
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -50067,7 +50067,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@appendixsubsec Changes in release 4.0.3
@itemize @bullet
@item Fixed two bugs in @code{SELECT DISTINCT} with large tables.
@item
Fixed bug in multi-table delete when tables are re-ordered in table 
initialization method and ref_length's are of different sizes
@item 
Fixed two bugs in @code{SELECT DISTINCT} with large tables.
@item
Fixed bug in query cache initialisation with very small query cache size.
@item
+30 −0
Original line number Diff line number Diff line
@@ -70,3 +70,33 @@ create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
delete t1  from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500;
drop table t1,t2;
DROP TABLE IF EXISTS a,b,c;
CREATE TABLE a (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY  (id)
) TYPE=MyISAM;
INSERT INTO a VALUES (1,'aaa'),(2,'aaa'),(3,'aaa');
CREATE TABLE b (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY  (id)
) TYPE=MyISAM;
INSERT INTO b VALUES (2,'bbb'),(3,'bbb'),(4,'bbb');
CREATE TABLE c (
id int(11) NOT NULL default '0',
mydate datetime default NULL,
PRIMARY KEY  (id)
) TYPE=MyISAM;
INSERT INTO c VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22
00:00:00'),(7,'2002-07-22 00:00:00');
delete a,b,c from a,b,c
where to_days(now())-to_days(c.mydate)>=30
and c.id=a.id and c.id=b.id;
select * from c;
id	mydate
1	2002-02-04 00:00:00
5	2002-05-12 00:00:00
6	2002-06-22 00:00:00
7	2002-07-22 00:00:00
DROP TABLE IF EXISTS a,b,c;
+25 −0
Original line number Diff line number Diff line
@@ -80,3 +80,28 @@ while ($1)
enable_query_log;
delete t1  from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500;
drop table t1,t2;
DROP TABLE IF EXISTS a,b,c;
CREATE TABLE a (
  id int(11) NOT NULL default '0',
  name varchar(10) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;
INSERT INTO a VALUES (1,'aaa'),(2,'aaa'),(3,'aaa');
CREATE TABLE b (
  id int(11) NOT NULL default '0',
  name varchar(10) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;
INSERT INTO b VALUES (2,'bbb'),(3,'bbb'),(4,'bbb');
CREATE TABLE c (
  id int(11) NOT NULL default '0',
  mydate datetime default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;
INSERT INTO c VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22
00:00:00'),(7,'2002-07-22 00:00:00');
delete a,b,c from a,b,c
where to_days(now())-to_days(c.mydate)>=30
and c.id=a.id and c.id=b.id;
select * from c;
DROP TABLE IF EXISTS a,b,c;
+14 −13
Original line number Diff line number Diff line
@@ -215,21 +215,8 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt,
    num_of_tables(num_of_tables_arg), error(0), lock_option(lock_option_arg),
    do_delete(false)
{
  uint counter=0;
  not_trans_safe=false;
  tempfiles = (Unique **) sql_calloc(sizeof(Unique *) * (num_of_tables-1));

  /* Don't use key read with MULTI-TABLE-DELETE */
  dt->table->used_keys=0;
  for (dt=dt->next ; dt ; dt=dt->next,counter++)
  {
    TABLE *table=dt->table;
    table->used_keys=0;
    tempfiles[counter] = new Unique (refposcmp2,
				     (void *) &table->file->ref_length,
				     table->file->ref_length,
				     MEM_STRIP_BUF_SIZE);
  }
}


@@ -260,6 +247,7 @@ multi_delete::prepare(List<Item> &values)
void
multi_delete::initialize_tables(JOIN *join)
{
  int counter=0;
  TABLE_LIST *walk;
  table_map tables_to_delete_from=0;
  for (walk= delete_tables ; walk ; walk=walk->next)
@@ -281,6 +269,19 @@ multi_delete::initialize_tables(JOIN *join)
	not_trans_safe=true;
    }
  }
  walk= delete_tables;
  walk->table->used_keys=0;
  for (walk=walk->next ; walk ; walk=walk->next, counter++)
  {
    tables_to_delete_from|= walk->table->map;
    TABLE *table=walk->table;
  /* Don't use key read with MULTI-TABLE-DELETE */
    table->used_keys=0;
    tempfiles[counter] = new Unique (refposcmp2,
				     (void *) &table->file->ref_length,
				     table->file->ref_length,
				     MEM_STRIP_BUF_SIZE);
  }
  init_ftfuncs(thd,1);
}