Bug #37371 CREATE TABLE LIKE merge loses UNION parameter
Submitted: 12 Jun 2008 15:17 Modified: 15 Jul 2010 19:50
Reporter: Scott Noyes Email Updates:
Status: Closed
Category:Server: Merge Severity:S3 (Non-critical)
Version:5.0.62 OS:Any
Assigned to: Dmitry Lenev Target Version:
Triage: Triaged: D2 (Serious)

[12 Jun 2008 15:17] Scott Noyes
Description:
CREATE TABLE LIKE mergeTable; does not copy the UNION bit.

How to repeat:
mysql> SHOW CREATE TABLE tm\G
*************************** 1. row ***************************
       Table: tm
Create Table: CREATE TABLE `tm` (
  `id` int(11) default NULL,
  KEY `id` (`id`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`)
1 row in set (0.00 sec)

mysql> CREATE TABLE tm2 LIKE tm;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW CREATE TABLE tm2\G
*************************** 1. row ***************************
       Table: tm2
Create Table: CREATE TABLE `tm2` (
  `id` int(11) default NULL,
  KEY `id` (`id`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Suggested fix:
CREATE TABLE LIKE ought to copy the UNION too.
[19 Aug 2008 13:44] Dmitry Lenev
Hello!

The following patch http://lists.mysql.com/commits/51937, which among others fixes this
problem, was pushed into mysql-6.1-fk tree. Eventually this tree is going to be merged
into one of 6.x releases. Please let me know if there is a need for fixing this bug in
one of earlier versions so this patch could be back-ported.
[11 Jun 2010 9:10] Jon Olav Hauglid
This bug was originally fixed in the 6.1-fk tree. The fix was later backported as part of
the patch for Bug#42546 "Backup: RESTORE fails, thinking it finds an existing table".

This bug was therefore fixed in Ver 5.5.3, so I'm setting this bug to Documenting.

Test coverage (originally not backported) has now been backported in
http://lists.mysql.com/commits/110795 and pushed to mysql-trunk-runtime (Ver 5.5.5).
[22 Jun 2010 13:09] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100622130139-u05awgya93zvbsop) (version source
revid:marko.makela@oracle.com-20100603095032-v5ptkkzt1bhz0m1d) (merge vers: 5.1.48)
(pib:16)
[22 Jun 2010 13:11] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100622130623-r7yhm89fz9n5t9nb) (version
source revid:alik@sun.com-20100622130528-187gd949sa9b6pa6) (pib:16)
[15 Jul 2010 19:50] Paul DuBois
Noted in 5.5.3 changelog.

For CREATE TABLE ... LIKE with a MERGE source table that included a
UNION clause, that clause was omitted from the definition of the
destination table.