Skip to content

Commit 7ba2242

Browse files
author
Sinisa@sinisa.nasamreza.org
committed
Two bug fixes
1 parent 3805a5e commit 7ba2242

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

Docs/manual.texi

+5
Original file line numberDiff line numberDiff line change
@@ -50797,6 +50797,11 @@ each individual 4.0.x release.
5079750797
@appendixsubsec Changes in release 4.0.5
5079850798
@itemize
5079950799
@item
50800+
Fixed a bug in multi-table deletes when outer join is used on an empty
50801+
table, which get's first to be deleted
50802+
@item
50803+
Fixed a bug in multi-table updates when a single table is updated
50804+
@item
5080050805
Updated source tree to be built using @code{automake 1.5} and
5080150806
@code{libtool 1.4}.
5080250807
@item

mysql-test/r/multi_update.result

+16
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,19 @@ ID ParId tst tst1
135135
2 2 MSSQL Microsoft
136136
3 3 ORACLE ORACLE
137137
drop table parent, child;
138+
drop table if exists t1, t2 ;
139+
create table t1 (n numeric(10));
140+
create table t2 (n numeric(10));
141+
insert into t2 values (1),(2),(4),(8),(16),(32);
142+
select * from t2 left outer join t1 using (n);
143+
n n
144+
1 NULL
145+
2 NULL
146+
4 NULL
147+
8 NULL
148+
16 NULL
149+
32 NULL
150+
delete t1,t2 from t2 left outer join t1 using (n);
151+
select * from t2 left outer join t1 using (n);
152+
n n
153+
drop table if exists t1,t2 ;

mysql-test/t/multi_update.test

+9-1
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,12 @@ WHERE child.ParId = parent.Id;
139139
select * from child;
140140

141141

142-
drop table parent, child;
142+
drop table parent, child;
143+
drop table if exists t1, t2 ;
144+
create table t1 (n numeric(10));
145+
create table t2 (n numeric(10));
146+
insert into t2 values (1),(2),(4),(8),(16),(32);
147+
select * from t2 left outer join t1 using (n);
148+
delete t1,t2 from t2 left outer join t1 using (n);
149+
select * from t2 left outer join t1 using (n);
150+
drop table if exists t1,t2 ;

sql/sql_delete.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ bool multi_delete::send_data(List<Item> &values)
329329
table->status|= STATUS_DELETED;
330330
if (!(error=table->file->delete_row(table->record[0])))
331331
deleted++;
332-
else
332+
else if (!table_being_deleted->next)
333333
{
334334
table->file->print_error(error,MYF(0));
335335
DBUG_RETURN(1);

sql/sql_update.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ bool multi_update::send_eof()
768768
thd->proc_info="updating the reference tables";
769769

770770
/* Does updates for the last n - 1 tables, returns 0 if ok */
771-
int error = do_updates(false); /* do_updates returns 0 if success */
771+
int error = (num_updated > 1) ? do_updates(false) : 0; /* do_updates returns 0 if success */
772772

773773
/* reset used flags */
774774
#ifndef NOT_USED

0 commit comments

Comments
 (0)