• unknown's avatar
    BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed · 196b616a
    unknown authored
    When there are no underlying tables specified for a merge table,
    SHOW CREATE TABLE outputs a statement that cannot be executed. The
    same is true for mysqldump (it generates dumps that cannot be
    executed).
    
    This happens because SQL parser does not accept empty UNION() clause.
    
    This patch changes the following:
    - it is now possible to execute CREATE/ALTER statement with
      empty UNION() clause.
    - the same as above, but still worth noting: it is now possible to
      remove underlying tables mapping using ALTER TABLE ... UNION=().
    - SHOW CREATE TABLE does not output UNION() clause if there are
      no underlying tables specified for a merge table. This makes
      mysqldump slightly smaller.
    
    
    mysql-test/r/merge.result:
      A test case for BUG#28248.
    mysql-test/t/merge.test:
      A test case for BUG#28248.
    sql/ha_myisammrg.cc:
      Do not output UNION clause in SHOW CREATE TABLE, when there are
      no underlying tables defined.
    sql/sql_yacc.yy:
      Make underlying table list for MERGE engine optional.
      
      As for MERGE engine empty underlying tables list is valid, it should
      be valid for the parser as well.
      
      This change is mostly needed to restore dumps made by earlier MySQL
      versions. Also with this fix it is possible to remove underlying
      tables mapping by using ALTER TABLE ... UNION=().
    196b616a
merge.test 17.2 KB