Commit 90befc0a authored by jimw@mysql.com's avatar jimw@mysql.com

Merge bk-internal:/home/bk/mysql-5.0

into  mysql.com:/home/jimw/my/mysql-5.0-clean
parents a86cb213 e18679c7
...@@ -1289,6 +1289,25 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); ...@@ -1289,6 +1289,25 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
id id
4 4
DROP TABLE t1; 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; create temporary table t1 (a int, primary key(a)) engine=bdb;
select * from t1; select * from t1;
a a
......
...@@ -938,7 +938,25 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera"); ...@@ -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"); SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
DROP TABLE t1; 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 # alter temp table
......
...@@ -112,11 +112,6 @@ ...@@ -112,11 +112,6 @@
<collation name="latin5_turkish_ci"> <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> <map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 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 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
...@@ -130,10 +125,10 @@ ...@@ -130,10 +125,10 @@
9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB 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 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 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 41 41 41 41 41 41 41 44 46 46 46 46 4C 4C 4C 4C
49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5 49 51 52 52 52 52 53 E0 52 5A 5A 5A 5B 4C 58 57
CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA 41 41 41 41 41 41 41 44 46 46 46 46 4C 4C 4C 4C
49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF 49 51 52 52 52 52 53 FA 52 5A 5A 5A 5B 4B 58 5F
</map> </map>
</collation> </collation>
......
...@@ -293,6 +293,7 @@ cleanup: ...@@ -293,6 +293,7 @@ cleanup:
if (!transactional_table) if (!transactional_table)
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
} }
free_underlaid_joins(thd, select_lex);
if (transactional_table) if (transactional_table)
{ {
if (ha_autocommit_or_rollback(thd,error >= 0)) if (ha_autocommit_or_rollback(thd,error >= 0))
...@@ -304,7 +305,6 @@ cleanup: ...@@ -304,7 +305,6 @@ cleanup:
mysql_unlock_tables(thd, thd->lock); mysql_unlock_tables(thd, thd->lock);
thd->lock=0; thd->lock=0;
} }
free_underlaid_joins(thd, select_lex);
if (error < 0) if (error < 0)
{ {
thd->row_count_func= deleted; thd->row_count_func= deleted;
......
...@@ -257,7 +257,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -257,7 +257,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
*/ */
bool log_on= (thd->options & OPTION_BIN_LOG) || bool log_on= (thd->options & OPTION_BIN_LOG) ||
(!(thd->security_ctx->master_access & SUPER_ACL)); (!(thd->security_ctx->master_access & SUPER_ACL));
bool transactional_table; bool transactional_table, joins_freed= FALSE;
uint value_count; uint value_count;
ulong counter = 1; ulong counter = 1;
ulonglong id; ulonglong id;
...@@ -513,6 +513,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -513,6 +513,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->row_count++; 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 Now all rows are inserted. Time to update logs and sends response to
user user
...@@ -611,7 +614,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -611,7 +614,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->row_count_func= info.copied+info.deleted+info.updated; thd->row_count_func= info.copied+info.deleted+info.updated;
::send_ok(thd, (ulong) thd->row_count_func, id, buff); ::send_ok(thd, (ulong) thd->row_count_func, id, buff);
} }
free_underlaid_joins(thd, &thd->lex->select_lex);
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
...@@ -620,6 +622,7 @@ abort: ...@@ -620,6 +622,7 @@ abort:
if (lock_type == TL_WRITE_DELAYED) if (lock_type == TL_WRITE_DELAYED)
end_delayed_insert(thd); end_delayed_insert(thd);
#endif #endif
if (!joins_freed)
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -527,6 +527,7 @@ int mysql_update(THD *thd, ...@@ -527,6 +527,7 @@ int mysql_update(THD *thd,
if (!transactional_table) if (!transactional_table)
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
} }
free_underlaid_joins(thd, select_lex);
if (transactional_table) if (transactional_table)
{ {
if (ha_autocommit_or_rollback(thd, error >= 0)) if (ha_autocommit_or_rollback(thd, error >= 0))
...@@ -539,7 +540,6 @@ int mysql_update(THD *thd, ...@@ -539,7 +540,6 @@ int mysql_update(THD *thd,
thd->lock=0; thd->lock=0;
} }
free_underlaid_joins(thd, select_lex);
if (error < 0) if (error < 0)
{ {
char buff[STRING_BUFFER_USUAL_SIZE]; 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