From: Jim Winstead Date: December 12 2005 6:12pm Subject: bk commit into 5.0 tree (jimw:1.1970) List-Archive: http://lists.mysql.com/commits/79 Message-Id: <20051212181202.C0554A8418@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 5.0 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1970 05/12/12 10:11:56 jimw@stripped +5 -0 Merge mysql.com:/home/jimw/my/mysql-4.1-clean into mysql.com:/home/jimw/my/mysql-5.0-clean sql/sql_update.cc 1.181 05/12/12 10:11:53 jimw@stripped +1 -2 Resolve conflicts sql/sql_insert.cc 1.180 05/12/12 10:11:53 jimw@stripped +1 -2 Resolve conflicts sql/sql_delete.cc 1.170 05/12/12 10:11:52 jimw@stripped +1 -2 Resolve conflicts mysql-test/t/bdb.test 1.50 05/12/12 10:11:52 jimw@stripped +0 -0 Resolve conflicts mysql-test/r/bdb.result 1.48 05/12/12 10:11:52 jimw@stripped +0 -0 Resolve conflicts # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-5.0-clean/RESYNC --- 1.169/sql/sql_delete.cc 2005-11-04 17:54:39 -08:00 +++ 1.170/sql/sql_delete.cc 2005-12-12 10:11:52 -08:00 @@ -293,6 +293,7 @@ if (!transactional_table) thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } + free_underlaid_joins(thd, select_lex); if (transactional_table) { if (ha_autocommit_or_rollback(thd,error >= 0)) @@ -304,7 +305,6 @@ mysql_unlock_tables(thd, thd->lock); thd->lock=0; } - free_underlaid_joins(thd, select_lex); if (error < 0) { thd->row_count_func= deleted; --- 1.179/sql/sql_insert.cc 2005-11-28 11:57:46 -08:00 +++ 1.180/sql/sql_insert.cc 2005-12-12 10:11:53 -08:00 @@ -257,7 +257,7 @@ */ bool log_on= (thd->options & OPTION_BIN_LOG) || (!(thd->security_ctx->master_access & SUPER_ACL)); - bool transactional_table; + bool transactional_table, joins_freed= FALSE; uint value_count; ulong counter = 1; ulonglong id; @@ -513,6 +513,9 @@ thd->row_count++; } + free_underlaid_joins(thd, &thd->lex->select_lex); + joins_freed= TRUE; + /* Now all rows are inserted. Time to update logs and sends response to user @@ -611,7 +614,6 @@ thd->row_count_func= info.copied+info.deleted+info.updated; ::send_ok(thd, (ulong) thd->row_count_func, id, buff); } - free_underlaid_joins(thd, &thd->lex->select_lex); thd->abort_on_warning= 0; DBUG_RETURN(FALSE); @@ -620,7 +622,8 @@ if (lock_type == TL_WRITE_DELAYED) end_delayed_insert(thd); #endif - free_underlaid_joins(thd, &thd->lex->select_lex); + if (!joins_freed) + free_underlaid_joins(thd, &thd->lex->select_lex); thd->abort_on_warning= 0; DBUG_RETURN(TRUE); } --- 1.180/sql/sql_update.cc 2005-12-02 20:42:28 -08:00 +++ 1.181/sql/sql_update.cc 2005-12-12 10:11:53 -08:00 @@ -527,6 +527,7 @@ if (!transactional_table) thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } + free_underlaid_joins(thd, select_lex); if (transactional_table) { if (ha_autocommit_or_rollback(thd, error >= 0)) @@ -539,7 +540,6 @@ thd->lock=0; } - free_underlaid_joins(thd, select_lex); if (error < 0) { char buff[STRING_BUFFER_USUAL_SIZE]; --- 1.47/mysql-test/r/bdb.result 2005-12-01 11:10:59 -08:00 +++ 1.48/mysql-test/r/bdb.result 2005-12-12 10:11:52 -08:00 @@ -1289,6 +1289,25 @@ id 4 DROP TABLE t1; +create table t1 (a int, key(a)) engine=bdb; +create table t2 (b int, key(b)) engine=bdb; +insert into t1 values (1),(1),(2),(3),(4); +insert into t2 values (1),(5),(6),(7); +delete from t1 where (a in (select b from t2)); +select count(*) from t1; +count(*) +3 +insert into t1 set a=(select b from t2); +ERROR 21000: Subquery returns more than 1 row +select count(*) from t1; +count(*) +3 +update t1 set a = a + 1 where (a in (select b from t2)); +select count(*) from t1; +count(*) +3 +drop table t1, t2; +End of 4.1 tests create temporary table t1 (a int, primary key(a)) engine=bdb; select * from t1; a --- 1.49/mysql-test/t/bdb.test 2005-12-01 11:11:00 -08:00 +++ 1.50/mysql-test/t/bdb.test 2005-12-12 10:11:52 -08:00 @@ -938,7 +938,25 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); DROP TABLE t1; -# End of 4.1 tests +# +# Bug #15536: Crash when DELETE with subquery using BDB tables +# +create table t1 (a int, key(a)) engine=bdb; +create table t2 (b int, key(b)) engine=bdb; +insert into t1 values (1),(1),(2),(3),(4); +insert into t2 values (1),(5),(6),(7); +delete from t1 where (a in (select b from t2)); +select count(*) from t1; +# INSERT also blows up +--error 1242 +insert into t1 set a=(select b from t2); +select count(*) from t1; +# UPDATE also blows up +update t1 set a = a + 1 where (a in (select b from t2)); +select count(*) from t1; +drop table t1, t2; + +--echo End of 4.1 tests # # alter temp table