summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/truncate.result2
-rw-r--r--mysql-test/t/truncate.test2
-rw-r--r--sql/sql_delete.cc3
3 files changed, 6 insertions, 1 deletions
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index e02797cc8e5..44dacdd9bf1 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -20,3 +20,5 @@ truncate table t1;
select * from t1;
n
drop table t1;
+truncate non_existing_table;
+Table 'test.non_existing_table' doesn't exist
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index 1729ddc586a..841ce06351e 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -18,3 +18,5 @@ insert into t1 values (1),(2),(3);
truncate table t1;
select * from t1;
drop table t1;
+--error 1146
+truncate non_existing_table;
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 256b03bb1fa..8ce25f257f5 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -546,7 +546,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
db_type table_type;
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);
}
if (!ha_supports_generate(table_type))