Bug #34750 Print database name in Unknown Table error message
Submitted: 21 Feb 2008 21:25 Modified: 15 Dec 2010 1:37
Reporter: Baron Schwartz (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version: OS:Any
Assigned to: Jørgen Løland
Tags: qc
Triage: Triaged: D5 (Feature request)

[21 Feb 2008 21:25] Baron Schwartz
Description:
A familiar error:

ERROR 1051 (42S02) at line 8: Unknown table 'comment'

It would be very helpful if it included the DB name.

How to repeat:
mysql> drop table test.table_that_does_not_exist;
ERROR 1051 (42S02): Unknown table 'table_that_does_not_exist'

Suggested fix:
This would be great:

mysql> drop table test.table_that_does_not_exist;
ERROR 1051 (42S02): Unknown table 'test.table_that_does_not_exist'
[29 Feb 2008 9:05] Valerii Kravchuk
Thank you for a reasonable feature request.
[17 Aug 2010 6:07] Jørgen Løland
As I understand it, we want to print the database name if the current database is different from where the non-existing table is attempted deleted. Thus,

  use t;
  drop table test.notable;

should warn: "ERROR 42S02: Unknown table 'test.notable'", whereas 

  use t;
  drop table t.notable;

should warn: "ERROR 42S02: Unknown table 'notable'".
[17 Aug 2010 10:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/115916

3218 Jorgen Loland	2010-08-17
      Bug#34750: Print database name in Unknown Table error message
      
      Feature request to print database name in 
      "Unknown table '<table>'" comment.
      
      The patch makes error ER_BAD_TABLE_ERROR print the database name
      if the current database is not the same database as the table
      is attempted deleted from.
     @ mysql-test/r/drop.result
        Added test for BUG#34750
     @ mysql-test/r/grant.result
        Updated warning output for 'drop view'. Database name is now 
        printed if the current database is not the same database as the view is attempted deleted from.
     @ mysql-test/r/mdl_sync.result
        Updated warning output for 'drop table'. Database name is now 
        printed if the current database is not the same database as the table is attempted deleted from.
     @ mysql-test/r/profiling.result
        Updated warning output for 'drop view'. Database name is now 
        printed if the current database is not the same database as the view is attempted deleted from.
     @ mysql-test/r/sp.result
        Updated warning output for 'drop view'. Database name is now 
        printed if the current database is not the same database as the view is attempted deleted from.
     @ mysql-test/t/drop.test
        Added test for BUG#34750
     @ sql/sql_admin.cc
        Print database name in ER_BAD_TABLE_ERROR of the database name
        if the current database is not the same database as the table
        is attempted deleted from.
     @ sql/sql_base.cc
        Print database name in ER_BAD_TABLE_ERROR of the database name
        if the current database is not the same database as the table
        is attempted deleted from.
     @ sql/sql_table.cc
        Print database name in ER_BAD_TABLE_ERROR of the database name
        if the current database is not the same database as the table
        is attempted deleted from.
     @ sql/sql_view.cc
        Print database name in ER_BAD_TABLE_ERROR of the database name
        if the current database is not the same database as the table
        is attempted deleted from.
[18 Aug 2010 9:30] Jørgen Løland
Discussed with Evgeny: It's better to always print the database name. New patch coming up.
[18 Aug 2010 11:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/116085
[30 Aug 2010 6:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/117085
[30 Aug 2010 8:47] Jørgen Løland
Pushed to next-mr-bugfixing
[31 Aug 2010 6:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/117170

3263 Jorgen Loland	2010-08-31
      BUG#34750: Followup patch
      
      Result files of federated,funcs_1,parts were not updated in the 
      original patch.
     @ mysql-test/r/archive.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/federated/federated.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/federated/federated_server.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/innodb_trig_0102.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/innodb_views.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/memory_trig_0102.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/memory_views.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/myisam_trig_0102.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/myisam_views.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/funcs_1/r/storedproc.result
        Updated warning output for drop view/drop table: database name is now printed.
     @ mysql-test/suite/parts/r/part_ctype_utf32.result
        Updated warning output for drop view/drop table: database name is now printed.
[6 Sep 2010 7:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/117566

3274 Jorgen Loland	2010-09-06
      BUG#34750: Print database name in Unknown Table error message
      
      Followup patch - update result file for 
      partition_not_blackhole test
     @ mysql-test/r/partition_not_blackhole.result
        Updated warning output for drop view/drop table: database name is now printed.
[2 Oct 2010 18:14] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101002181053-6iotvl26uurcoryp) (version source revid:alexander.nozdrin@oracle.com-20101002180917-h0n62akupm3z20nt) (pib:21)
[5 Oct 2010 13:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/119999

3218 Tor Didriksen	2010-10-05
      BUG#34750 Print database name in Unknown Table error message, followup patch
     @ mysql-test/suite/innodb/r/innodb-autoinc.result
        BUG#34750 Print database name in Unknown Table error message
[13 Nov 2010 16:07] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)
[13 Nov 2010 16:32] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (pib:21)
[15 Dec 2010 1:30] Paul Dubois
Noted in 5.6.1 changelog.

"Unknown table" error messages that included only the table name now
include the database name as well.