@@ -4563,6 +4563,19 @@ static void get_table_engine_for_i_s(THD *thd, char *buf, TABLE_LIST *tl,
4563
4563
}
4564
4564
4565
4565
4566
+ /*
4567
+ Hide error for a non-existing table.
4568
+ For example, this error can occur when we use a where condition
4569
+ with a db name and table, but the table does not exist or
4570
+ there is a view with the same name.
4571
+ */
4572
+ static bool hide_object_error (uint err)
4573
+ {
4574
+ return err == ER_NO_SUCH_TABLE || err == ER_WRONG_OBJECT ||
4575
+ err == ER_NOT_SEQUENCE;
4576
+ }
4577
+
4578
+
4566
4579
/* *
4567
4580
Fill I_S table with data obtained by performing full-blown table open.
4568
4581
@@ -4691,16 +4704,8 @@ fill_schema_table_by_open(THD *thd, MEM_ROOT *mem_root,
4691
4704
of backward compatibility.
4692
4705
*/
4693
4706
if (!is_show_fields_or_keys && result && thd->is_error () &&
4694
- (thd->get_stmt_da ()->sql_errno () == ER_NO_SUCH_TABLE ||
4695
- thd->get_stmt_da ()->sql_errno () == ER_WRONG_OBJECT ||
4696
- thd->get_stmt_da ()->sql_errno () == ER_NOT_SEQUENCE))
4707
+ hide_object_error (thd->get_stmt_da ()->sql_errno ()))
4697
4708
{
4698
- /*
4699
- Hide error for a non-existing table.
4700
- For example, this error can occur when we use a where condition
4701
- with a db name and table, but the table does not exist or
4702
- there is a view with the same name.
4703
- */
4704
4709
result= false ;
4705
4710
thd->clear_error ();
4706
4711
}
@@ -4791,8 +4796,8 @@ static int fill_schema_table_names(THD *thd, TABLE_LIST *tables,
4791
4796
else
4792
4797
table->field [3 ]->store (STRING_WITH_LEN (" ERROR" ), cs);
4793
4798
4794
- if (unlikely (thd->is_error () &&
4795
- thd->get_stmt_da ()->sql_errno () == ER_NO_SUCH_TABLE ))
4799
+ if (unlikely (thd->is_error ()) &&
4800
+ hide_object_error ( thd->get_stmt_da ()->sql_errno ()))
4796
4801
{
4797
4802
thd->clear_error ();
4798
4803
return 0 ;
@@ -5032,9 +5037,7 @@ static int fill_schema_table_from_frm(THD *thd, MEM_ROOT *mem_root,
5032
5037
share= tdc_acquire_share (thd, &table_list, GTS_TABLE | GTS_VIEW);
5033
5038
if (!share)
5034
5039
{
5035
- if (thd->get_stmt_da ()->sql_errno () == ER_NO_SUCH_TABLE ||
5036
- thd->get_stmt_da ()->sql_errno () == ER_WRONG_OBJECT ||
5037
- thd->get_stmt_da ()->sql_errno () == ER_NOT_SEQUENCE)
5040
+ if (hide_object_error (thd->get_stmt_da ()->sql_errno ()))
5038
5041
{
5039
5042
res= 0 ;
5040
5043
}
0 commit comments