Bug #31584 Can't create table with "LIKE" clause from information schema table
Submitted: 13 Oct 2007 17:19 Modified: 15 Oct 2007 12:54
Reporter: Giuseppe Maxia Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:5.0,5.1,6.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: CREATE TABLE, error message, information_schema, like

[13 Oct 2007 17:19] Giuseppe Maxia
Description:
If you want to create a table with the same structure of an INFORMATION_SCHEMA
table, the "LIKE" clause does not work.

Server version: 5.0.52-log Source distribution
mysql> create table test.t1 like information_schema.tables;
ERROR 1051 (42S02): Unknown table 'tables'

Server version: 5.1.23-beta-log Source distribution
mysql> create table test.t1 like information_schema.tables;
ERROR 1049 (42000): Unknown database 'test'

Notice also the confusing message, which are different for 5.0 and 5.1.
If there is a reason for not creating a table like an information_schema table, the error message should say so.

How to repeat:
create table test.t1 like information_schema.tables;

Suggested fix:
Allow the creation of a table using the "LIKE" clause when the object is an INFORMATION_SCHEMA table.

Or, if there is a reason for not allowing such creation, adjust the error message accordingly.
[15 Oct 2007 12:54] Sergei Golubchik
duplicate of Bug#25629