1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

fixed bug in truncating nonexisting table, found by Carsten

mysql-test/r/truncate.result:
  test suit for truncate bug
mysql-test/t/truncate.test:
  test suit for truncate bug
This commit is contained in:
unknown
2002-08-05 11:45:39 +03:00
parent e8c681a76e
commit 2cb480f2a8
3 changed files with 6 additions and 1 deletions

View File

@ -20,3 +20,5 @@ truncate table t1;
select * from t1; select * from t1;
n n
drop table t1; drop table t1;
truncate non_existing_table;
Table 'test.non_existing_table' doesn't exist

View File

@ -18,3 +18,5 @@ insert into t1 values (1),(2),(3);
truncate table t1; truncate table t1;
select * from t1; select * from t1;
drop table t1; drop table t1;
--error 1146
truncate non_existing_table;

View File

@ -546,7 +546,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
db_type table_type; db_type table_type;
if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN) if ((table_type=get_table_type(path)) == DB_TYPE_UNKNOWN)
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->real_name); my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
table_list->real_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (!ha_supports_generate(table_type)) if (!ha_supports_generate(table_type))