Commit e18679c7 authored by jimw@mysql.com's avatar jimw@mysql.com

Merge mysql.com:/home/jimw/my/mysql-4.1-clean

into  mysql.com:/home/jimw/my/mysql-5.0-clean
parents c34595c9 f7ff3d65
......@@ -1289,6 +1289,25 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
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
......
......@@ -938,7 +938,25 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
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
......
......@@ -112,11 +112,6 @@
<collation name="latin5_turkish_ci">
<!--
# Note: all accented characters are compared separately (this
# is different from the default latin1 character set, where
# e.g. a = = , etc.).
-->
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
......@@ -130,10 +125,10 @@
9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB
AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB
BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB
CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA
49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5
CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA
49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF
41 41 41 41 41 41 41 44 46 46 46 46 4C 4C 4C 4C
49 51 52 52 52 52 53 E0 52 5A 5A 5A 5B 4C 58 57
41 41 41 41 41 41 41 44 46 46 46 46 4C 4C 4C 4C
49 51 52 52 52 52 53 FA 52 5A 5A 5A 5B 4B 58 5F
</map>
</collation>
......
......@@ -293,6 +293,7 @@ cleanup:
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 @@ cleanup:
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
}
free_underlaid_joins(thd, select_lex);
if (error < 0)
{
thd->row_count_func= deleted;
......
......@@ -257,7 +257,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
*/
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 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
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 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
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 @@ abort:
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);
}
......
......@@ -527,6 +527,7 @@ int mysql_update(THD *thd,
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 @@ int mysql_update(THD *thd,
thd->lock=0;
}
free_underlaid_joins(thd, select_lex);
if (error < 0)
{
char buff[STRING_BUFFER_USUAL_SIZE];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment