Bug #24024 wrong error message when drop table (used by pending transaction) fails
Submitted: 6 Nov 2006 19:14 Modified: 1 Nov 2007 15:54
Reporter: Matthias Leich Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[6 Nov 2006 19:14] Matthias Leich
Description:
Heavy simplified subtest from the not yet pushed test mix2_falcon:
------------------------------------------------------------------
set storage_engine = Falcon;
create table t1(a int not null, b int, primary key(a));
insert into t1(a) values (1);
create trigger t1t before insert on t1 for each row
begin
declare not_needed INTEGER;
set not_needed = 1;
end|
commit;
set autocommit = 0;
update t1 set b = 5 where a = 1;
# Switch to session b (user=root)
insert into t1(a) values(7);
commit;
drop trigger t1t;
SELECT * FROM t1;
a	b
1	NULL
7	NULL
drop table t1;
ERROR 42S02: Unknown table 't1'
   <--- What's this ?
# Switch to session default (user=root) + disconnect session b
drop table t1;
   <--- Now it works, but why not for the other session ?

InnoDB does not show this strange behaviour.
I set priority to 2 because I fear the reason for this bug
might cause much other bad effects, if the situation changes.
Please feel free to change the priority.

My environment:
 - PC Intel Pentium M (x86-32Bit) with Linux(SuSE 10.1)
 - MySQL compiled from source
     mysql-5.1-falcon last ChangeSet@1.2357, 2006-11-05
     BUILD/compile-pentium-debug-max

How to repeat:
I will push a falcon_bug_nnnnn testcase just after sending this bug report.
[7 Nov 2006 16:55] Matthias Leich
Protocol of simplified testcase:
set storage_engine = Falcon;
DROP TABLE IF EXISTS t1;
create table t1(a int not null, b int, primary key(a));
insert into t1(a) values (1);
commit;
set autocommit = 0;
update t1 set b = 5 where a = 1;
# Switch to session b (user=root)
insert into t1(a) values(7);
commit;
SELECT * FROM t1;
a	b
1	NULL
7	NULL
drop table t1;
ERROR 42S02: Unknown table 't1'
   <-- It is in my eyes ok that the server refuses the
       execution of DROP TABLE.
       But the error message is tottally misleading.
       An message telling that DROP TABLE is denied
       because another transaction uses this table or
       has a lock on this table would be much better.
[7 Dec 2006 14:39] Hakan Küçükyılmaz
Verified with falcon_bug_24024.test on Linux 32-bit with change set 1.2395, 2006-12-07.

Regards, Hakan
[19 Oct 2007 16:36] Kevin Lewis
Chris,  This is a wrong error message.
[1 Nov 2007 5:39] Christopher Powers
This is a problem with error handling in the server.

Falcon returns error HA_ERR_TABLE_EXIST (156) to ha_delete_table(), along with the text "table TEST.T1 has uncommitted updates and can't be dropped". ha_delete_table() adds to the error message and pushes on the error list.

The error is changed to 1051, "Unknown table" in mysql_rm_table_part2() and later printed.
[1 Nov 2007 15:54] Christopher Powers
Dupe of bug#22972, "Falcon: Partitioned table with pending transaction leads to strange error".